Просмотр исходного кода

feat: 添加导出功能到多个模块,优化相关接口和模板名称

sunqijun 1 месяц назад
Родитель
Сommit
2bd3f1d6b2

+ 23 - 5
src/api/employee-training-record-card-management/index.ts

@@ -24,16 +24,17 @@ export interface EmployeeTableType {
   updatedAt: Date;
 }
 
-// 分页查询参数接口
-export interface EducationStaffTrainingCardQueryParam {
-  pageNumber: number;
-  pageSize: number;
-  queryParam?: {
+interface  QueryParamType {
     numOrName?: string;
     status?: number | string;
     dateOfJoiningStart?: string;
     dateOfJoiningEnd?: string;
   };
+// 分页查询参数接口
+export interface EducationStaffTrainingCardQueryParam {
+  pageNumber: number;
+  pageSize: number;
+  queryParam?: QueryParamType
 }
 
 // 员工培训记录卡项接口
@@ -90,6 +91,23 @@ export function getEducationStaffTrainingCardDetail(id: number) {
   });
 }
 
+/**
+ * @description: 导出
+ * @param {QueryParamType} params
+ * @return {*}
+ */
+export function exportTableData(params: QueryParamType){
+  return http.request(
+    {
+        url: '/educationStaffTrainingCard/exportEducationStaffTrainingCard',
+        method: 'post',
+        responseType: 'blob',
+        params,
+        },
+        { isTransformResponse: false },
+    );
+}
+
 // ______查看详情数据_____________
 
 /**

+ 17 - 0
src/api/production-education-training-plan-dept/index.ts

@@ -134,3 +134,20 @@ export function queryEducationAndTrainingProgramDetail(id: string | number) {
     method: 'get',
   });
 }
+
+/**
+ * @description: 导出
+ * @param {ProductionSafetyFileQuery} params
+ * @return {*}
+ */
+export function exportTableData(params: ProductionSafetyFileQuery){
+  return http.request(
+    {
+        url: '/educationTrainingPlanIssuance/exportEducationTrainingPlanIssuance',
+        method: 'post',
+        responseType: 'blob',
+        params,
+        },
+        { isTransformResponse: false },
+    );
+}

+ 16 - 0
src/api/production-education-training-plan/index.ts

@@ -102,3 +102,19 @@ export function queryEducationAndTrainingProgramDetail(id: string | number) {
     method: 'get',
   });
 }
+/**
+ * @description: 导出
+ * @param {*} params
+ * @return {*}
+ */
+export function exportTableData(params){
+  return http.request(
+    {
+        url: '/educationTrainingPlan/exportProductionEducationTrainingPlan',
+        method: 'post',
+        responseType: 'blob',
+        params,
+    },
+    { isTransformResponse: false },
+    );
+}

+ 1 - 1
src/views/production-safety/productionSafetySystem/safetySystemConstructionWorkPlanManagement/safetySystemConstructionWorkPlanManagement.vue

@@ -188,7 +188,7 @@
       :visible="batchImportVisible"
       :import-api-url="importApiUrl"
       :template-url="templateUrl"
-      template-name="安全组织体系"
+      template-name="安全体系建设工作计划管理"
       :show-template="false"
       @close="batchImportVisible = false"
       @update="handleUpdate"

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

@@ -164,7 +164,7 @@
     pageNumber: 1,
     pageSize: 10,
     queryParam: {
-      status: '1',
+      approvalStatus: '1',
       projectName: '',
       constructionLocation: '',
       department: '',

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

@@ -1,12 +1,12 @@
 <template>
   <div class="safety-platform-container">
+    <el-alert v-if="showAlertBar" :title="formValue.rejectReason" type="warning" />
     <header class="safety-platform-container__header">
       <div class="breadcrumb-title">
         <BreadcrumbBack />
         编辑施工安全申请
       </div>
     </header>
-    <el-alert v-if="showAlertBar" :title="formValue.rejectReason" type="error" />
 
     <main class="safety-platform-container__main">
       <el-form ref="formRef" :inline="true" label-width="auto" :model="formValue" :rules="rules">

+ 2 - 2
src/views/production-safety/safetyTrainingAndEducation/educationTrainingPlanManagement/components/educationTrainingPlanManagementDetail.vue

@@ -78,8 +78,8 @@
 
     <!-- 小结内容 -->
      <section v-if="form.status===2">
-        <h5 class="border-b">材料小结</h5>
-        <div v-if="form.dets.length!==0" v-for="item in form.dets">
+        <h5 class="border-b" v-if="form.dets.length!==0" >材料小结</h5>
+        <div v-for="item in form.dets">
             <el-form  label-width="150px" style="max-width: 600px" label-position="left">
                 <el-form-item label="材料上传" v-if="item.uploadAttach" required>
                     <ul>

+ 16 - 20
src/views/production-safety/safetyTrainingAndEducation/educationTrainingPlanManagement/educationTrainingPlanManagement.vue

@@ -1,19 +1,16 @@
 <template>
   <div class="safety-platform-container">
     <header class="safety-platform-container__header">
-      <div class="breadcrumb-title"> 教育培训计划管理</div>
+      <div class="breadcrumb-title">教育培训计划管理</div>
     </header>
     <main class="safety-platform-container__main">
       <div class="search-table-container">
         <header>
           <div style="position: relative">
             <el-button type="primary" class="search-table-container--button" @click="handleCreate"> 添加 </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> -->
+            <el-button plain class="search-table-container--button" @click="handleImport">
+                导入
+            </el-button>
           </div>
           <div class="act-search">
             <section class="select-box">
@@ -63,6 +60,9 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
+              <el-button plain class="search-table-container--button" @click="handleDownload">
+                导出
+              </el-button>
             </section>
           </div>
         </header>
@@ -155,6 +155,7 @@
     issueEducationAndTrainingProgram,
     cancelEducationAndTrainingProgram,
     deleteEducationAndTrainingProgram,
+    exportTableData
   } from '@/api/production-education-training-plan';
   import { downloadByData } from '@/utils/file/download';
   import BatchImport from '@/components/batch-import/BatchImport.vue';
@@ -250,7 +251,7 @@
   // 批量导入
   const batchImportVisible = ref(false);
   const { urlPrefix } = useGlobSetting();
-  const importApiUrl = ref(urlJoin(urlPrefix, '/inventory/importInventory'));
+  const importApiUrl = ref(urlJoin(urlPrefix, '/educationTrainingPlan/importProductionEducationTrainingPlan'));
   const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-inventory-template.xlsx');
 
   const handleImport = () => {
@@ -264,19 +265,14 @@
 
   const handleDownload = async () => {
     try {
-      const exportParams = {
-        stuffName: tableQuery.queryParam.stuffName || undefined,
-        status: tableQuery.queryParam.status,
-        ids: tableQuery.queryParam.ids.length > 0 ? tableQuery.queryParam.ids : undefined,
-      };
-      // const response = await exportInventory(exportParams);
-      // if (response) {
-      //     const fileName = `物品库存管理_${new Date().toISOString().split('T')[0]}.xlsx`;
-      //     downloadByData(response, fileName);
-      //     ElMessage.success('导出成功');
-      // }
+      const response = await exportTableData(tableQuery.queryParam);
+      if (response) {
+          const fileName = `教育培训计划管理_${new Date().toISOString().split('T')[0]}.xlsx`;
+          downloadByData(response, fileName);
+          ElMessage.success('导出成功');
+      }
     } catch (e) {
-      console.error('导出物品库存失败:', e);
+      console.error('导出教育培训计划管理失败:', e);
       ElMessage.error('导出失败,请重试');
     }
   };

+ 14 - 18
src/views/production-safety/safetyTrainingAndEducation/educationTrainingPlanManagementDept/educationTrainingPlanManagementDept.vue

@@ -13,9 +13,8 @@
             <!-- <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 class="act-search">
             <section class="select-box">
@@ -65,6 +64,9 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
+              <el-button plain class="search-table-container--button" @click="handleDownload">
+                导出   
+              </el-button> 
             </section>
           </div>
         </header>
@@ -144,7 +146,7 @@
   import { TABLE_OPTIONS, TABLE_COLUMNS, STATUS_OPTIONS } from './configs/tables';
   import { useRouter } from 'vue-router';
   import type { QueryPageRequest } from '@/types/basic-query';
-  import { getEducationAndTrainingProgramList, updateEducationTrainingPlanCourseSummary, } from '@/api/production-education-training-plan-dept';
+  import { getEducationAndTrainingProgramList, updateEducationTrainingPlanCourseSummary,exportTableData } from '@/api/production-education-training-plan-dept';
   import { downloadByData } from '@/utils/file/download';
   import BatchImport from '@/components/batch-import/BatchImport.vue';
   import { useGlobSetting } from '@/hooks/setting';
@@ -313,7 +315,6 @@
         pagination.total = res.totalRow;
       }
     } catch (e) {
-      console.error('获取列表失败:', e);
       tableData.value = [];
       pagination.total = 0;
     } finally {
@@ -363,20 +364,15 @@
 
   const handleDownload = async () => {
     try {
-      const exportParams = {
-        stuffName: tableQuery.queryParam.stuffName || undefined,
-        status: tableQuery.queryParam.status,
-        ids: tableQuery.queryParam.ids.length > 0 ? tableQuery.queryParam.ids : undefined,
-      };
-      // const response = await exportInventory(exportParams);
-      // if (response) {
-      //     const fileName = `物品库存管理_${new Date().toISOString().split('T')[0]}.xlsx`;
-      //     downloadByData(response, fileName);
-      //     ElMessage.success('导出成功');
-      // }
+      const response = await exportTableData(tableQuery.queryParam);
+      if (response) {
+          const fileName = `教育培训计划管理(部门)_${new Date().toISOString().split('T')[0]}.xlsx`;
+          downloadByData(response, fileName);
+          ElMessage.success('导出成功');
+      }
     } catch (e) {
-      console.error('导出物品库存失败:', e);
-      ElMessage.error('导出失败,请重试');
+      console.error('导出教育培训计划管理(部门)失败:', e);
+      ElMessage.error('导出教育培训计划管理(部门)失败,请重试');
     }
   };
 

+ 16 - 20
src/views/production-safety/safetyTrainingAndEducation/employeeTrainingRecordCardManagement/employeeTrainingRecordCardManagement.vue

@@ -6,13 +6,10 @@
     <main class="safety-platform-container__main">
       <div class="search-table-container">
         <header>
-          <div style="position: relative">
-            <!-- <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 style="position: relative" class="search-table-container--button">
+            <el-button plain  @click="handleImport">
+                导入
+            </el-button>
           </div>
 
           <div class="act-search">
@@ -49,6 +46,9 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
+              <el-button plain class="search-table-container--button" @click="handleDownload">
+                导出
+            </el-button>
             </section>
           </div>
         </header>
@@ -102,6 +102,7 @@
   import {
     queryEducationStaffTrainingCardPage,
     deleteEducationStaffTrainingCard,
+    exportTableData
   } from '@/api/employee-training-record-card-management';
   import { downloadByData } from '@/utils/file/download';
   import BatchImport from '@/components/batch-import/BatchImport.vue';
@@ -179,7 +180,7 @@
   // 批量导入
   const batchImportVisible = ref(false);
   const { urlPrefix } = useGlobSetting();
-  const importApiUrl = ref(urlJoin(urlPrefix, '/inventory/importInventory'));
+  const importApiUrl = ref(urlJoin(urlPrefix, '/educationStaffTrainingCard/importEducationStaffTrainingCard'));
   const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-inventory-template.xlsx');
 
   const handleImport = () => {
@@ -193,19 +194,14 @@
 
   const handleDownload = async () => {
     try {
-      const exportParams = {
-        stuffName: tableQuery.queryParam.stuffName || undefined,
-        status: tableQuery.queryParam.status,
-        ids: tableQuery.queryParam.ids.length > 0 ? tableQuery.queryParam.ids : undefined,
-      };
-      // const response = await exportInventory(exportParams);
-      // if (response) {
-      //     const fileName = `物品库存管理_${new Date().toISOString().split('T')[0]}.xlsx`;
-      //     downloadByData(response, fileName);
-      //     ElMessage.success('导出成功');
-      // }
+      const response = await exportTableData(tableQuery.queryParam);
+      if (response) {
+          const fileName = `员工培训记录卡管理_${new Date().toISOString().split('T')[0]}.xlsx`;
+          downloadByData(response, fileName);
+          ElMessage.success('导出成功');
+      }
     } catch (e) {
-      console.error('导出物品库存失败:', e);
+      console.error('导出员工培训记录卡失败:', e);
       ElMessage.error('导出失败,请重试');
     }
   };