Explorar o código

Merge branch 'feat/production-safety' of http://192.168.6.110/product-group-fe/sfy-safety-group/sfy-safety into feat/production-safety

sunqijun hai 1 mes
pai
achega
656d50c134

+ 42 - 0
src/api/production-safety/responsibility-implementation/index.ts

@@ -986,3 +986,45 @@ export function exportRiskList () {
   });
 }
 
+/**
+ * 导出危险清单管理
+ * @returns Promise<any> 导出的危险清单数据
+ */
+export function exportHazardList () {
+  return http.request({
+    url: '/safetyHazardInventory/exportHazard',
+    method: 'post',
+    responseType: 'blob',
+  }, {
+    isTransformResponse: false,
+  });
+}
+
+/**
+ * 导出施工安全管理
+ * @returns Promise<any> 导出的施工安全管理数据
+ */
+export function exportConstructionSafetyList () {
+  return http.request({
+    url: '/constructionSafety/exportConstruction',
+    method: 'post',
+    responseType: 'blob',
+  }, {
+    isTransformResponse: false,
+  });
+}
+
+
+/**
+ * 导出危险作业审批管理
+ * @returns Promise<any> 导出的危险作业审批管理数据
+ */
+export function exportHazardApprovalList () {
+  return http.request({
+    url: '/dangerWork/exportDangerWorkApproval',
+    method: 'post',
+    responseType: 'blob',
+  }, {
+    isTransformResponse: false,
+  });
+}

+ 1 - 1
src/views/production-safety/productionSafetySystem/safetySystemConstructionWorkPlanManagement/configs/tables.ts

@@ -74,7 +74,7 @@ export const WORK_PLAN_TABLE_COLUMNS: TableColumnProps[] = [
   },
   {
     label: '责任部门',
-    prop: 'responsibleDeptName',
+    prop: 'responsibleDeptNames',
     align: 'left',
     minWidth: '120px',
   },

+ 11 - 9
src/views/production-safety/productionSafetySystem/safetySystemConstructionWorkPlanManagementDept/components/safetySystemConstructionWorkPlanManagementDeptDetail.vue

@@ -183,13 +183,14 @@
     }
     try {
       const list = await formatAttachmentList(files);
-      const jsonArr = (list || [])
-        .map((r) => ({
-          file_name: r.fileName,
-          url: r.fileUrl || '',
-        }))
-        .filter((x) => x.url);
-      form.fileUrl = JSON.stringify(jsonArr);
+      // debugger
+      // const jsonArr = (list || [])
+      //   .map((r) => ({
+      //     fileName: r.fileName,
+      //     fileUrl: r.fileUrl || '',
+      //   }))
+      //   .filter((x) => x.fileName);
+      form.fileUrl = JSON.stringify(list);
     } catch (e) {
       console.error('附件上传失败:', e);
       ElMessage.error('附件上传失败,请重试');
@@ -275,12 +276,13 @@
     try {
       if (isViewMode && form.fileUrl) {
         // 处理附件格式
-        form.fileUrl = JSON.parse(form.fileUrl)[0].url;
+        // debugger
+        // form.fileUrl = JSON.parse(form.fileUrl)[0].url;
       }
       if (isEditMode.value && currentId.value) {
         await issueWorkPlanDept({
           id: currentId.value,
-          fileUrl: form.fileUrl,
+          fileUrl: JSON.parse(form.fileUrl),
         });
         ElMessage.success('保存成功');
       }

+ 55 - 3
src/views/production-safety/risk-identification-and-control/construction-safety-manage/list.vue

@@ -6,6 +6,9 @@
     <main class="safety-platform-container__main">
         <div style="margin-bottom:20px">
             <el-button type="primary" @click="$router.push({ name: 'constructionSafetyManageAdd' })">添加 </el-button>
+            <!-- <el-button plain class="search-table-container--button" @click="handleImport">
+              导入
+            </el-button> -->
         </div>
       <div class="search-form">
         <el-form :inline="true">
@@ -43,9 +46,11 @@
         </el-form>
 
         <div>
-          
           <el-button type="primary" @click="queryTableList">查询</el-button>
           <el-button @click="handleRestParams">重置</el-button>
+          <el-button plain  @click="handleDownload">
+            导出
+          </el-button>
         </div>
       </div>
 
@@ -107,6 +112,16 @@
           @current-change="handleCurrentChange"
         />
       </div>
+      <BatchImport
+        v-if="batchImportVisible"
+        :visible="batchImportVisible"
+        :import-api-url="importApiUrl"
+        :template-url="templateUrl"
+        template-name="下载模板"
+        :show-template="false"
+        @close="batchImportVisible = false"
+        @update="handleUpdate"
+      />
     </main>
   </div>
   <BasicDialog
@@ -177,6 +192,7 @@
     constructionSafetyQueryPageConstruction,
     constructionSafetyDeleteConstructionById,
     constructionSafetyUpdateApply,
+    exportConstructionSafetyList,
   } from '@/api/production-safety/responsibility-implementation';
   import BasicDialog from '@/components/BasicDialog.vue';
   import { getApprovalNodeInstanceList } from '@/api/approval/approval';
@@ -188,7 +204,10 @@
   import { getAllDepartments } from '@/api/auth/dept';
   import { APPROVAL_TYPE_MAP, APPROVER_TYPE } from '@/views/emergency/emergency-plan/src/constant';
   import { useEmergencySuppliesHook } from '@/views/emergency/emergency-supplies/src/hook';
-
+  import BatchImport from '@/components/batch-import/BatchImport.vue';
+  import { useGlobSetting } from '@/hooks/setting';
+  import urlJoin from 'url-join';
+  import { downloadByData } from '@/utils/file/download';
   const router = useRouter();
   const { id } = useUserInfoHook();
   const firstLevelDepts = ref<any[]>([]);
@@ -339,6 +358,36 @@
     });
   };
 
+  // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/safetyRisk/list/importRiskList'));
+  const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
+
+  const handleImport = () => {
+    batchImportVisible.value = true;
+  };
+
+  const handleUpdate = () => {
+    batchImportVisible.value = false;
+    // getTableData();
+  };
+
+  const handleDownload = async () => {
+    try {
+      const response = await exportConstructionSafetyList();
+      if (response) {
+        const fileName = `施工作业安全管理_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
+    } catch (e) {
+      console.error('导出院级文件失败:', e);
+      ElMessage.error('导出失败,请重试');
+    }
+  };
+
   onMounted(async () => {
     await getDeptData();
     queryTableList();
@@ -362,7 +411,10 @@
   :deep(.breadcrumb .title) {
     margin-left: 0;
   }
-
+  :deep(main) {
+    display: flex;
+    flex-direction: column;
+  }
   .search-form {
     min-width: 800px;
     display: flex;

+ 19 - 1
src/views/production-safety/risk-identification-and-control/hazard-approval-manage/list.vue

@@ -46,6 +46,9 @@
           
           <el-button type="primary" @click="queryTableList">查询</el-button>
           <el-button @click="handleRestParams">重置</el-button>
+          <el-button plain  @click="handleDownload">
+            导出
+          </el-button>
         </div>
       </div>
 
@@ -183,6 +186,7 @@
     dangerWorkSubmit,
     dangerWorkQueryPage,
     dangerWorkDeleteDangerWork,
+    exportHazardApprovalList,
   } from '@/api/production-safety/responsibility-implementation';
   import BasicDialog from '@/components/BasicDialog.vue';
   import { getApprovalNodeInstanceList } from '@/api/approval/approval';
@@ -190,7 +194,7 @@
   import { omit } from 'lodash-es';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
   import type { ApprovalNodeInstanceType } from '@/views/system/approval/types';
-
+  import { downloadByData } from '@/utils/file/download';
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { getAllDepartments } from '@/api/auth/dept';
   import { APPROVAL_TYPE_MAP, APPROVER_TYPE } from '@/views/emergency/emergency-plan/src/constant';
@@ -340,6 +344,20 @@
     });
   };
 
+    const handleDownload = async () => {
+    try {
+      const response = await exportHazardApprovalList();
+      if (response) {
+        const fileName = `危险作业审批管理_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
+    } catch (e) {
+      console.error('导出院级文件失败:', e);
+      ElMessage.error('导出失败,请重试');
+    }
+  };
+
   onMounted(async () => {
     await getDeptData();
     queryTableList();

+ 51 - 1
src/views/production-safety/risk-identification-and-control/hazard-manage/list.vue

@@ -6,6 +6,9 @@
     <main class="safety-platform-container__main">
       <div style="margin-bottom: 20px">
         <el-button type="primary" @click="$router.push({ name: 'hazardManageAdd' })">添加 </el-button>
+        <el-button plain @click="handleImport">
+          导入
+        </el-button>
       </div>
       <div class="search-form">
         <el-form :inline="true">
@@ -63,6 +66,9 @@
         <div>
           <el-button type="primary" @click="queryTableList">查询</el-button>
           <el-button @click="handleRestParams">重置</el-button>
+          <el-button plain  @click="handleDownload">
+            导出
+          </el-button>
         </div>
       </div>
 
@@ -114,6 +120,16 @@
           @current-change="handleCurrentChange"
         />
       </div>
+      <BatchImport
+        v-if="batchImportVisible"
+        :visible="batchImportVisible"
+        :import-api-url="importApiUrl"
+        :template-url="templateUrl"
+        template-name="下载模板"
+        :show-template="false"
+        @close="batchImportVisible = false"
+        @update="handleUpdate"
+      />
     </main>
   </div>
 </template>
@@ -125,6 +141,7 @@
     safetyHazardInventoryQueryPage,
     safetyHazardInventoryDelete,
     safetyRiskListApprove,
+    exportHazardList,
   } from '@/api/production-safety/responsibility-implementation';
   import { omit } from 'lodash-es';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
@@ -132,7 +149,10 @@
   import { downloadFile } from '@/views/disaster/utils';
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { getAllDepartments } from '@/api/auth/dept';
-
+  import BatchImport from '@/components/batch-import/BatchImport.vue';
+  import { useGlobSetting } from '@/hooks/setting';
+  import urlJoin from 'url-join';
+  import { downloadByData } from '@/utils/file/download';
   const router = useRouter();
   const { id } = useUserInfoHook();
   const firstLevelDepts = ref<any[]>([]);
@@ -233,6 +253,36 @@
     queryTableList();
   };
 
+  // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/safetyHazardInventory/importHazard'));
+  const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
+
+  const handleImport = () => {
+    batchImportVisible.value = true;
+  };
+
+  const handleUpdate = () => {
+    batchImportVisible.value = false;
+    // getTableData();
+  };
+
+  const handleDownload = async () => {
+    try {
+      const response = await exportHazardList();
+      if (response) {
+        const fileName = `危险清单管理_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
+    } catch (e) {
+      console.error('导出危险清单失败:', e);
+      ElMessage.error('导出失败,请重试');
+    }
+  };
+
   onMounted(async () => {
     await getDeptData();
     queryTableList();

+ 1 - 1
src/views/production-safety/risk-identification-and-control/risk-manage/list.vue

@@ -259,7 +259,7 @@
   const batchImportVisible = ref(false);
   const { urlPrefix } = useGlobSetting();
   // /productionSafety/academyFile/import
-  const importApiUrl = ref(urlJoin(urlPrefix, '/admin/prod/academyFile/importAcademyFile'));
+  const importApiUrl = ref(urlJoin(urlPrefix, '/safetyRisk/list/importRiskList'));
   const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
 
   const handleImport = () => {