Pārlūkot izejas kodu

fix: 修改参数信息

xiaweibo 1 mēnesi atpakaļ
vecāks
revīzija
d9b9372498

+ 59 - 0
src/api/production-safety-system/index.ts

@@ -1505,3 +1505,62 @@ export function updateAreaCheckPlan(data: AreaCheckPlanRecord & { id: number })
   return updateAreaCheckPlanManage(data);
 }
 
+/**
+ * 导出区域检查计划清单
+ * @returns Promise<any> 导出的区域检查计划清单数据
+ */
+export function exportAreaCheckPlanList (params: AreaCheckPlanQuery) {
+  return http.request({
+    url: '/areaCheckPlanManageDept/exportAreaCheckPlan',
+    method: 'post',
+    responseType: 'blob',
+    data: params,
+  }, {
+    isTransformResponse: false,
+  });
+}
+
+/**
+ * 导出区域检查计划清单
+ * @returns Promise<any> 导出的区域检查计划清单数据
+ */
+export function exportAreaCheckInspectionRecord (params: AreaCheckPlanQuery) {
+  return http.request({
+    url: '/areaCheckPlanManageDept/exportAreaCheckPlanDetail',
+    method: 'post',
+    responseType: 'blob',
+    data: params,
+  }, {
+    isTransformResponse: false,
+  });
+}
+
+/**
+ * 导出区域检查计划管理
+ * @returns Promise<any> 导出的区域检查计划管理数据
+ */
+export function exportAreaCheckPlanAdministration (params: AreaCheckPlanQuery) {
+  return http.request({
+    url: '/areaCheckPlanManageAdmin/exportAreaCheckPlan',
+    method: 'post',
+    responseType: 'blob',
+    data: params,
+  }, {
+    isTransformResponse: false,
+  });
+}
+
+/**
+ * 导出区域检查计划管理
+ * @returns Promise<any> 导出的区域检查计划管理数据
+ */
+export function exportInspectionRecordTow (params: AreaCheckPlanQuery) {
+  return http.request({
+    url: '/areaCheckPlanManageAdmin/exportAreaCheckPlanLog',
+    method: 'post',
+    responseType: 'blob',
+    data: params,
+  }, {
+    isTransformResponse: false,
+  });
+}

+ 51 - 1
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagement/areaCheckPlanManagement.vue

@@ -10,6 +10,9 @@
             <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>
           </div>
 
           <div class="act-search">
@@ -70,6 +73,9 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
+              <el-button plain  @click="handleDownload">
+                导出
+              </el-button>
             </section>
           </div>
         </header>
@@ -270,6 +276,16 @@
         <el-button type="primary" @click="handleIssueSave">保存</el-button>
       </template>
     </el-dialog>
+    <BatchImport
+      v-if="batchImportVisible"
+      :visible="batchImportVisible"
+      :import-api-url="importApiUrl"
+      :template-url="templateUrl"
+      template-name="下载模板"
+      :show-template="false"
+      @close="batchImportVisible = false"
+      @update="handleUpdate"
+    />
   </div>
 </template>
 
@@ -290,12 +306,16 @@
     cancelAreaCheckPlanManage,
     queryAreaCheckPlanManageDetail,
     mapAreaCheckPlanApiRecordToUi,
+    exportAreaCheckPlanAdministration,
   } from '@/api/production-safety-system';
   import { getAllDepartments } from '@/api/auth/dept';
   import type { DeptTree } from '@/types/dept/type';
   import { queryUserGroupPage } from '@/api/system/person-group';
   import type { PersonGroupListItem } from '@/types/person-group/type';
-
+  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 basicTableRef = ref<InstanceType<typeof BasicTable>>();
@@ -594,6 +614,36 @@
     }
   };
 
+  // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/areaCheckPlanManageAdmin/importAreaCheckPlan'));
+  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 exportAreaCheckPlanAdministration(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('导出失败,请重试');
+    }
+  };
+
   onMounted(() => {
     venueCategoryOptions.value = [
       { label: '各级风险点', value: '各级风险点' },

+ 24 - 2
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagement/components/areaCheckPlanManagementDetail.vue

@@ -462,6 +462,7 @@
     queryCheckListTemplateNameList,
     queryUnqualifiedItemNumPage,
     sandAreaCheckRecordToProductionHiddenDanger,
+    exportInspectionRecordTow,
     type ChecklistTemplate,
     type UnqualifiedItemNumRecord,
     type SandAreaCheckRecordToHiddenDangerReq,
@@ -472,6 +473,8 @@
     HIDDEN_DANGER_FORM_DATA,
     HIDDEN_DANGER_FORM_RULES,
   } from '@/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form';
+  import { downloadByData } from '@/utils/file/download';
+import { id } from 'element-plus/es/locale';
 
   const router = useRouter();
   const route = useRoute();
@@ -848,8 +851,27 @@
     recordPagination.pageNumber = 1;
     loadRecordList();
   };
-  const onRecordExport = () => {
-    ElMessage.success('导出功能开发中');
+  const onRecordExport = async () => {
+    try {
+      const [start, end] = recordDateRange.value && recordDateRange.value.length === 2
+        ? recordDateRange.value
+        : ['', ''];
+      const queryParam = {
+          id: currentId.value,
+          searchKey: recordSearchKeyword.value || undefined,
+          startDate: start || undefined,
+          endDate: end || undefined,
+        };
+      const response = await exportInspectionRecordTow(queryParam);
+      if (response) {
+        const fileName = `区域检查记录_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
+    } catch (e) {
+      console.error('导出区域检查记录失败:', e);
+      ElMessage.error('导出失败,请重试');
+    }
   };
 
   const handleSandToHiddenDanger = (row: { id?: number } & Record<string, unknown>) => {

+ 20 - 0
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagementDept/areaCheckPlanManagementDept.vue

@@ -66,6 +66,9 @@
             <section class="search-btn">
               <el-button type="primary" @click="handleSearch">查询</el-button>
               <el-button @click="handleReset">重置</el-button>
+              <el-button plain  @click="handleDownload">
+                导出
+              </el-button>
             </section>
           </div>
         </header>
@@ -115,8 +118,11 @@
   import type { AreaCheckPlanQuery, AreaCheckPlanRecord } from '../areaCheckPlanManagement/configs/types';
   import {
     queryAreaCheckPlanManageDeptPage,
+    exportAreaCheckPlanList,
     mapAreaCheckPlanApiRecordToUi,
   } from '@/api/production-safety-system';
+  import { downloadByData } from '@/utils/file/download';
+  import { ElMessage } from 'element-plus';
 
   const router = useRouter();
 
@@ -206,6 +212,20 @@
     });
   };
 
+  const handleDownload = async () => {
+    try {
+      const response = await exportAreaCheckPlanList(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('导出失败,请重试');
+    }
+  };
+
   onMounted(() => {
     venueCategoryOptions.value = [
       { label: '各级风险点', value: '各级风险点' },

+ 26 - 4
src/views/production-safety/hiddenTroubleInvestigationAndGovernance/areaCheckPlanManagementDept/components/areaCheckPlanManagementDeptDetail.vue

@@ -39,11 +39,11 @@
         <div class="row">
           <div class="col">
             <div class="label">主责部门执行人所属分组名称:</div>
-            <div class="value">{{ viewDetail.mainDeptExecutorGroupName || '-' }}</div>
+            <div class="value">{{ viewDetail.primaryResponsibleDeptExecGroupName || '-' }}</div>
           </div>
           <div class="col">
             <div class="label">主责部门责任人:</div>
-            <div class="value">{{ viewDetail.mainDeptResponsiblePerson || '-' }}</div>
+            <div class="value">{{ viewDetail.primaryResponsibleDeptPersonName || '-' }}</div>
           </div>
         </div>
         <div class="row">
@@ -334,6 +334,7 @@
     mapAreaCheckPlanApiRecordToUi,
     queryUnqualifiedItemNumDeptPage,
     sandAreaCheckRecordToProductionHiddenDanger,
+    exportAreaCheckInspectionRecord,
     type UnqualifiedItemNumRecord,
     type SandAreaCheckRecordToHiddenDangerReq,
   } from '@/api/production-safety-system';
@@ -347,6 +348,7 @@
     HIDDEN_DANGER_FORM_RULES,
   } from '@/views/production-safety/hiddenTroubleInvestigationAndGovernance/hiddenTroubleAccountManagement/configs/form';
   import { queryAvailableUserList } from '@/api/production-safety/responsibility-implementation';
+  import { downloadByData } from '@/utils/file/download';
 
   const router = useRouter();
   const route = useRoute();
@@ -387,6 +389,8 @@
       createdPersonName: (d?.createdPersonName ?? '') || '-',
       createdAt: (d?.createdAt ?? '') || '-',
       businessWork: (d?.businessWork ?? '') || '-',
+      primaryResponsibleDeptExecGroupName: d?.primaryResponsibleDeptExecGroupName ?? '-',
+      primaryResponsibleDeptPersonName: d?.primaryResponsibleDeptPersonName ?? '-',
     };
   });
 
@@ -561,8 +565,26 @@
     recordPagination.pageNumber = 1;
     loadRecordList();
   };
-  const onRecordExport = () => {
-    ElMessage.success('导出功能开发中');
+  const onRecordExport = async () => {
+    try {
+      const [start, end] = recordDateRange.value && recordDateRange.value.length === 2
+        ? recordDateRange.value
+        : ['', ''];
+      const queryParam = {
+          searchKey: recordSearchKeyword.value || undefined,
+          startDate: start || undefined,
+          endDate: end || undefined,
+      };
+      const response = await exportAreaCheckInspectionRecord(queryParam);
+      if (response) {
+        const fileName = `检查记录_${new Date().toISOString().split('T')[0]}.xlsx`;
+        downloadByData(response, fileName);
+        ElMessage.success('导出成功');
+      }
+    } catch (e) {
+      console.error('导出院级文件失败:', e);
+      ElMessage.error('导出失败,请重试');
+    }
   };
 
   const loadUnqualifiedList = async () => {