xiaweibo 1 месяц назад
Родитель
Сommit
861e145de4

+ 18 - 4
src/api/drawLessons/index.ts

@@ -1,5 +1,6 @@
 import { http } from '@/utils/http/axios';
 import { http } from '@/utils/http/axios';
 import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
 import type { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
+import exp from 'constants';
 
 
 /**
 /**
  * 举一反三单条记录(与接口文档 DrawLessonsPageRes 一致)
  * 举一反三单条记录(与接口文档 DrawLessonsPageRes 一致)
@@ -80,11 +81,11 @@ export function queryDrawLessonsAdminDeptPage(
 
 
 /**
 /**
  * 2.2 查询举一反三详情
  * 2.2 查询举一反三详情
- * GET /api/drawLessons/admin/queryDetail?id=xxx
+ * GET /api/drawLessons/admin/queryMainDetail?id=xxx
  */
  */
 export function getDrawLessonsAdminDetail(id: number) {
 export function getDrawLessonsAdminDetail(id: number) {
   return http.request<DrawLessonsItem>({
   return http.request<DrawLessonsItem>({
-    url: '/drawLessons/admin/queryDetail',
+    url: '/drawLessons/admin/queryMainDetail',
     method: 'get',
     method: 'get',
     params: { id },
     params: { id },
   });
   });
@@ -92,7 +93,7 @@ export function getDrawLessonsAdminDetail(id: number) {
 
 
 /**
 /**
  * 2.2 查询举一反三详情
  * 2.2 查询举一反三详情
- * GET /api/drawLessons/admin/queryDetail?id=xxx
+ * GET /api/drawLessons/admin/queryMainDetail?id=xxx
  */
  */
 export function getDrawLessonsAdminDeptDetail(id: number) {
 export function getDrawLessonsAdminDeptDetail(id: number) {
   return http.request<DrawLessonsItem>({
   return http.request<DrawLessonsItem>({
@@ -365,7 +366,7 @@ export function cancellationMessagePost(id: number) {
 
 
 
 
 /**
 /**
- * 导出举一反三子记录
+ * 导出法律法规
  */
  */
 export function exportTheDocumentPost() {
 export function exportTheDocumentPost() {
   return http.request({
   return http.request({
@@ -377,3 +378,16 @@ export function exportTheDocumentPost() {
     },
     },
   });
   });
 }
 }
+
+/**
+ * 导出举一反三子记录
+ */
+export function exportDrawLessonsAdminPage() {
+  return http.request({
+    url: '/inventory/exportInventory',
+    method: 'post',
+    responseType: 'blob',
+  }, {
+    isTransformResponse: false,
+  });
+}

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

@@ -972,3 +972,14 @@ export function dangerWorkSaveApproval(params) {
   });   
   });   
 }
 }
 
 
+/**
+ * 导出风险清单
+ * @returns Promise<any> 导出的风险清单数据
+ */
+export function exportRiskList () {
+  return http.request({
+    url: `/safetyRisk/list/exportRiskList`,
+    method: 'post',
+  });
+}
+

+ 8 - 4
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/oneByOneManagement/oneByOneManagement.vue

@@ -208,6 +208,7 @@
     deleteDrawLessons,
     deleteDrawLessons,
     voidDrawLessons,
     voidDrawLessons,
     issueDrawLessons,
     issueDrawLessons,
+    exportDrawLessonsAdminPage,
     type DrawLessonsQueryParam,
     type DrawLessonsQueryParam,
   } from '@/api/drawLessons';
   } from '@/api/drawLessons';
   import { getAllDepartments } from '@/api/auth/dept';
   import { getAllDepartments } from '@/api/auth/dept';
@@ -313,12 +314,15 @@
 
 
   const handleDownload = async () => {
   const handleDownload = async () => {
     try {
     try {
-      // 后端如有专门导出接口,可在此替换
-      await queryDrawLessonsAdminPage(tableQuery);
-      ElMessage.success('导出逻辑待实现');
+      const response = await exportDrawLessonsAdminPage();
+      if (response) {
+        const fileName = `举一反三_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
     } catch (e) {
     } catch (e) {
       console.error('导出举一反三失败:', e);
       console.error('导出举一反三失败:', e);
-      ElMessage.error(e?.message || e?.data || '导出失败,请重试');
+      ElMessage.error('导出失败,请重试');
     }
     }
   };
   };
 
 

+ 8 - 4
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/oneByOneManagementDept/oneByOneManagementDept.vue

@@ -108,6 +108,7 @@
   import type { QueryPageRequest } from '@/types/basic-query';
   import type { QueryPageRequest } from '@/types/basic-query';
   import {
   import {
     queryDrawLessonsAdminDeptPage,
     queryDrawLessonsAdminDeptPage,
+    exportDrawLessonsAdminPage,
     type DrawLessonsQueryParam,
     type DrawLessonsQueryParam,
   } from '@/api/drawLessons';
   } from '@/api/drawLessons';
   import { downloadByData } from '@/utils/file/download';
   import { downloadByData } from '@/utils/file/download';
@@ -208,12 +209,15 @@
 
 
   const handleDownload = async () => {
   const handleDownload = async () => {
     try {
     try {
-      // 后端如有专门导出接口,可在此替换
-      await queryDrawLessonsAdminDeptPage(tableQuery);
-      ElMessage.success('导出逻辑待实现');
+      const response = await exportDrawLessonsAdminPage();
+      if (response) {
+        const fileName = `举一反三_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
     } catch (e) {
     } catch (e) {
       console.error('导出举一反三失败:', e);
       console.error('导出举一反三失败:', e);
-      ElMessage.error(e?.message || e?.data || '导出失败,请重试');
+      ElMessage.error('导出失败,请重试');
     }
     }
   };
   };
 
 

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

@@ -4,8 +4,14 @@
       <div class="breadcrumb-title"> 风险清单管理 </div>
       <div class="breadcrumb-title"> 风险清单管理 </div>
     </header>
     </header>
     <main class="safety-platform-container__main">
     <main class="safety-platform-container__main">
-        <div style="margin-bottom: 20px;">
-            <el-button type="primary" @click="$router.push({ name: 'riskManageAdd' })">添加 </el-button>
+        <div>
+            <el-button class="search-table-container--button" type="primary" @click="$router.push({ name: 'riskManageAdd' })">添加 </el-button>
+            <el-button plain class="search-table-container--button" @click="handleImport">
+              导入
+            </el-button>
+            <el-button plain class="search-table-container--button" @click="handleDownload">
+              导出
+            </el-button>
         </div>
         </div>
       <div class="search-form">
       <div class="search-form">
         <el-form :inline="true">
         <el-form :inline="true">
@@ -114,6 +120,16 @@
         />
         />
       </div>
       </div>
     </main>
     </main>
+    <BatchImport
+      v-if="batchImportVisible"
+      :visible="batchImportVisible"
+      :import-api-url="importApiUrl"
+      :template-url="templateUrl"
+      template-name="下载模板"
+      :show-template="false"
+      @close="batchImportVisible = false"
+      @update="handleUpdate"
+    />
   </div>
   </div>
 </template>
 </template>
 <script lang="ts" setup>
 <script lang="ts" setup>
@@ -125,6 +141,7 @@
     safetyRiskListQueryPage,
     safetyRiskListQueryPage,
     safetyRiskListDelete,
     safetyRiskListDelete,
     safetyRiskListApprove,
     safetyRiskListApprove,
+    exportRiskList,
   } from '@/api/production-safety/responsibility-implementation';
   } from '@/api/production-safety/responsibility-implementation';
   import { omit } from 'lodash-es';
   import { omit } from 'lodash-es';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
   import { useUserInfoHook } from '@/hooks/useUserInfoHook';
@@ -132,6 +149,10 @@
   import { downloadFile } from '@/views/disaster/utils';
   import { downloadFile } from '@/views/disaster/utils';
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
   import { getAllDepartments } from '@/api/auth/dept';
   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 router = useRouter();
   const { id } = useUserInfoHook();
   const { id } = useUserInfoHook();
@@ -232,6 +253,37 @@
     queryTableList();
     queryTableList();
   };
   };
 
 
+  // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/admin/prod/academyFile/importAcademyFile'));
+  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 exportRiskList();
+      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 () => {
   onMounted(async () => {
     await getDeptData();
     await getDeptData();
     queryTableList();
     queryTableList();