| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <template>
- <div class="safety-platform-container">
- <header class="safety-platform-container__header">
- <div class="breadcrumb-title">{{ $route.meta.title }}</div>
- <!-- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="公共区域" :name="1" />
- <el-tab-pane label="非公共区域" :name="2" />
- </el-tabs> -->
- </header>
- <main class="safety-platform-container__main">
- <div style="margin-bottom: 20px">
- <el-button
- type="primary"
- @click="
- $router.push({
- name: 'addResponsibilities:nonPublic',
- })
- "
- >添加
- </el-button>
- </div>
- <div class="search-form">
- <el-form :inline="true">
- <el-form-item label="区域名称">
- <el-input v-model="queryParams.queryParam.nameFunction" placeholder="搜索功能名称" style="width: 170px" />
- </el-form-item>
- <el-form-item label="状态">
- <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
- <el-option :value="1" label="正常" />
- <el-option :value="2" label="待确认" />
- <el-option :value="3" label="已拒绝" />
- </el-select>
- </el-form-item>
- <el-form-item label="安全责任部门">
- <el-cascader
- v-model="queryParams.queryParam.safetyResponsibleDepartmentId"
- style="width: 170px"
- ref="cascaderRef"
- :options="firstLevelDepts"
- :props="cascaderProp"
- :show-all-levels="false"
- placeholder="部门名称"
- filterable
- @change="handleChangeDept"
- />
- </el-form-item>
- <el-form-item label="安全具体责任人" prop="safetyResponsibleBuilding">
- <el-select
- v-model="queryParams.queryParam.safetySpecificPerson"
- placeholder="请选择"
- style="width: 170px"
- filterable
- >
- <el-option v-for="item in userOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- </el-form>
- <div>
- <!-- <el-button @click="batchImportVisible = true">导入</el-button>
- <el-button type="primary" @click="handleDownload">导出</el-button> -->
- <el-button type="primary" @click="queryTableList">查询</el-button>
- <el-button @click="handleRestParams">重置</el-button>
- </div>
- </div>
- <div class="table-content">
- <el-table :data="tableData.data">
- <el-table-column type="index" label="序号" width="80" />
- <el-table-column label="楼号" prop="buildingNo" width="80" />
- <el-table-column label="楼层" prop="buildingArea" width="100" />
- <el-table-column label="房间/区域" prop="floorRoomNo" width="180" />
- <el-table-column label="功能名称" prop="nameFunction" width="120" />
- <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
- <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
- <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
- <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
- <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
- <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
- <el-table-column label="变更原因" prop="changeReason" width="170" />
- <el-table-column label="状态" prop="statusName" width="100" />
- <el-table-column fixed="right" min-width="240" label="操作">
- <template #default="scope">
- <template v-if="scope.row.status === 1">
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'editResponsibilities:nonPublic',
- query: {
- id: scope.row.id,
- },
- })
- "
- >编辑
- </el-button>
- <el-popconfirm title="确定要删除吗?" @confirm="handleConfirmDeleteRow(scope)">
- <template #reference>
- <el-button type="primary" link>删除</el-button>
- </template>
- </el-popconfirm>
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'changeResponsibilities:nonPublic',
- query: {
- id: scope.row.id,
- },
- })
- "
- >变更</el-button
- >
- </template>
- <template v-if="scope.row.canChange === true">
- <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 1)">确认</el-button>
- <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 0)">拒绝</el-button>
- </template>
- <template v-if="scope.row.status === 3">
- <el-button type="primary" link>变更</el-button>
- </template>
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'viewResponsibilities:nonPublic',
- query: {
- id: scope.row.id,
- },
- })
- "
- >查看</el-button
- >
- <el-button
- link
- type="primary"
- v-if="scope.row.creatBy === id && scope.row.status === 2"
- @click="handleAreaCheckListApprove(scope, 0)"
- >
- 撤回
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="pagination-container" v-if="tableData.total > 0">
- <el-pagination
- background
- layout="prev, pager, next, jumper,sizes, total"
- :current-page="queryParams.pageNumber"
- :page-size="queryParams.pageSize"
- :total="tableData.total"
- :page-sizes="[10, 20, 50, 100]"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- </main>
- </div>
- <BatchImport
- :visible="batchImportVisible"
- :importApiUrl="importApiUrl"
- :templateUrl="templateUrl"
- :templateName="'责任清单-批量导入模版'"
- @close="() => (batchImportVisible = false)"
- @update="handleUpdate"
- />
- </template>
- <script lang="ts" setup>
- import { onMounted, ref, reactive } from 'vue';
- import { ElMessage } from 'element-plus';
- import { useRouter } from 'vue-router';
- import {
- areaCheckListQueryPage,
- areaCheckListApprove,
- areaCheckListDelete,
- areaCheckListExportArea,
- queryAvailableUserList,
- } from '@/api/production-safety/responsibility-implementation';
- import urlJoin from 'url-join';
- import { BatchImport } from '@/components/batch-import';
- import { unformatAttachment } from '@/components/UploadFiles/utils';
- import { downloadFile } from '@/views/disaster/utils';
- import { useGlobSetting } from '@/hooks/setting';
- import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
- import { getAllDepartments } from '@/api/auth/dept';
- import { useUserInfoHook } from '@/views/disaster/hooks';
- const { id } = useUserInfoHook();
- const router = useRouter();
- const activeTab = ref(2);
- const queryParams = reactive<any>({
- pageNumber: 1,
- pageSize: 10,
- queryParam: {
- type: 2,
- nameFunction: '',
- status: '',
- safetyResponsibleDepartmentId: [],
- safetySpecificPerson: '',
- },
- });
- const cascaderRef = ref<any>(null);
- const firstLevelDepts = ref<any[]>([]);
- const cascaderProp = {
- expandTrigger: 'click',
- checkStrictly: true,
- // emitPath: false,
- value: 'id',
- label: 'deptName',
- };
- // 批量导入
- const batchImportVisible = ref(false);
- const { urlPrefix } = useGlobSetting();
- const importApiUrl = ref(urlJoin(urlPrefix, '/areaCheckList/importArea?type=2'));
- const templateUrl = ref('');
- const handleUpdate = () => {
- batchImportVisible.value = false;
- queryTableList();
- };
- const tableData = reactive({
- data: [],
- total: 0,
- });
- const userOptions = ref<any[]>([]);
- const handleChangeDept = () => {
- const deptInfo = cascaderRef.value?.getCheckedNodes();
- if (deptInfo?.[0]) {
- // queryParams.queryParam.department = deptInfo[0].label;
- queryParams.queryParam.safetyResponsibleDepartmentId = deptInfo[0].pathValues;
- }
- };
- const handleTabChange = (tab) => {
- if (tab === 1) {
- router.push({
- name: 'listResponsibilities:public',
- });
- } else if (tab === 2) {
- router.push({
- name: 'listResponsibilities:nonPublic',
- });
- }
- };
- const getDeptData = () => {
- getAllDepartments().then((res) => {
- firstLevelDepts.value = formatDeptTree(res);
- });
- };
- async function handleDownload() {
- // getQuery();
- try {
- const res = await areaCheckListExportArea(queryParams.queryParam);
- if (res.size === 0) return;
- const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
- const url = window.URL.createObjectURL(blob);
- downloadFile(url, '责任清单.xlsx');
- } catch (e) {
- ElMessage.error('下载失败');
- console.log(e);
- }
- }
- const handleAreaCheckListApprove = (scope, approveType) => {
- areaCheckListApprove({
- id: scope.row.id,
- approveType,
- refuseReason: null,
- }).then(() => {
- if (approveType === 1) {
- ElMessage.success('请尽快修改该责任清单的安全责任所/中心、安全责任部门及相关负责人信息');
- } else {
- ElMessage.success('操作成功!');
- }
- queryTableList();
- });
- };
- const handleQueryAvailableUserList = (deptName = '', realname = '') => {
- queryAvailableUserList({
- pageNumber: 1,
- pageSize: 200,
- queryParam: {
- deptName,
- realname,
- },
- }).then((res: any) => {
- userOptions.value = (res.records || []).map((u: any) => ({
- value: u.userId || u.id,
- label: u.realname,
- }));
- });
- };
- const handleSizeChange = (value) => {
- queryParams.pageSize = value;
- queryTableList();
- };
- const handleCurrentChange = (value) => {
- queryParams.pageNumber = value;
- queryTableList();
- };
- const handleConfirmDeleteRow = (scope) => {
- areaCheckListDelete(scope.row.id).then(() => {
- ElMessage.success('删除成功!');
- queryTableList();
- });
- };
- const queryTableList = () => {
- areaCheckListQueryPage(queryParams).then((res) => {
- tableData.data = res.records;
- tableData.total = res.totalRow;
- });
- };
- const handleRestParams = () => {
- Object.assign(queryParams, {
- pageNumber: 1,
- pageSize: 10,
- queryParam: {
- ...queryParams.queryParam,
- status: '',
- nameFunction: '',
- safetyResponsibleDepartmentId: [],
- safetySpecificPerson: '',
- },
- });
- queryTableList();
- };
- onMounted(async () => {
- await getDeptData();
- await handleQueryAvailableUserList();
- queryTableList();
- });
- </script>
- <style lang="scss" scoped>
- @use '@/styles/page-details-layout.scss' as *;
- @use '@/styles/page-main-layout.scss' as *;
- @use '@/styles/basic-table-action.scss' as *;
- :deep(.el-tabs__header) {
- margin: 0;
- }
- :deep(.el-tabs__item) {
- font-size: 14px !important;
- }
- :deep(.flexContent) {
- display: flex;
- }
- :deep(.breadcrumb .title) {
- margin-left: 0;
- }
- :deep(.el-form) {
- flex: 1;
- display: flex;
- row-gap: 15px;
- flex-wrap: wrap;
- }
- :deep(.el-form-item) {
- margin-bottom: 0;
- }
- :deep(main) {
- display: flex;
- flex-direction: column;
- }
- .search-form {
- min-width: 800px;
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- margin-bottom: 20px;
- }
- .button-content {
- margin-bottom: 20px;
- }
- .table-content {
- flex: 1;
- overflow: hidden;
- overflow-y: auto;
- }
- .page-content {
- display: flex;
- justify-content: flex-end;
- }
- .pagination-container {
- margin-top: 20px;
- display: flex;
- justify-content: flex-end;
- }
- </style>
|