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

+ 15 - 0
src/api/production-safety/personal-protective-equipment-receive.ts

@@ -80,3 +80,18 @@ export function deletePersonalProtectiveEquipmentReceive(id: number) {
     method: 'delete',
   });
 }
+
+/**
+ * 导出劳防用品领用管理
+ * @returns Promise<any> 导出的劳防用品领用管理
+ */
+export function exportPersonalProtectiveEquipmentReceiveList (queryParams) {
+  return http.request({
+    url: '/personalProtectiveEquipmentReceive/exportProtectiveEquipmentReceive',
+    method: 'post',
+    responseType: 'blob',
+    data: queryParams,
+  }, {
+    isTransformResponse: false,
+  });
+}

+ 15 - 0
src/api/production-safety/personal-protective-equipment.ts

@@ -79,3 +79,18 @@ export function deletePersonalProtectiveEquipment(id: number) {
     method: 'delete',
   });
 }
+
+/**
+ * 导出危险作业管理审核
+ * @returns Promise<any> 导出的危险作业管理审核
+ */
+export function exportPersonalProtectiveEquipment (queryParams) {
+  return http.request({
+    url: '/personalProtectiveEquipment/exportPersonalProtectiveEquipment',
+    method: 'post',
+    responseType: 'blob',
+    data: queryParams,
+  }, {
+    isTransformResponse: false,
+  });
+}

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

@@ -8,11 +8,14 @@
            <el-button type="primary" @click="$router.push({ name: 'laborProductsManageAdd' })">
             添加
           </el-button>
+          <el-button plain @click="handleImport">
+            导入
+          </el-button>
         </div>
       <div class="search-form">
         <el-form :inline="true">
           <el-form-item label="物品名称">
-            <el-input
+            <el-input 
               v-model="queryParams.queryParam.name"
               placeholder="请输入物品名称"
               clearable
@@ -51,6 +54,9 @@
          
           <el-button type="primary" @click="queryTableList">查询</el-button>
           <el-button @click="handleRestParams">重置</el-button>
+          <el-button plain  @click="handleDownload">
+            导出
+          </el-button>
         </div>
       </div>
 
@@ -106,6 +112,16 @@
         />
       </div>
     </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>
 </template>
 
@@ -116,9 +132,14 @@
     queryPersonalProtectiveEquipmentList,
     deletePersonalProtectiveEquipment,
     type QueryPersonalProtectiveEquipmentCommonPageReq,
+    exportPersonalProtectiveEquipment,
     type PersonalProtectiveEquipment,
   } from '@/api/production-safety/personal-protective-equipment';
   import type { QueryPageRequest } from '@/types/basic-query';
+  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 loading = ref(false);
   const queryParams = reactive<QueryPageRequest<QueryPersonalProtectiveEquipmentCommonPageReq>>({
@@ -191,6 +212,36 @@
     queryTableList();
   };
 
+    // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/personalProtectiveEquipment/importPersonalProtectiveEquipment'));
+  const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
+
+  const handleImport = () => {
+    batchImportVisible.value = true;
+  };
+
+  const handleUpdate = () => {
+    batchImportVisible.value = false;
+    queryTableList();
+  };
+
+  const handleDownload = async () => {
+    try {
+      const response = await exportPersonalProtectiveEquipment(queryParams.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(() => {
     queryTableList();
   });

+ 52 - 2
src/views/production-safety/risk-identification-and-control/labor-products-requisition-manage/list.vue

@@ -5,12 +5,15 @@
     </header>
     <main class="safety-platform-container__main">
         <div style="margin-bottom:20px">
-            <el-button
+          <el-button
             type="primary"
             @click="$router.push({ name: 'laborProductsRequisitionManageAdd' })"
           >
             添加
           </el-button>
+          <el-button plain @click="handleImport">
+            导入
+          </el-button>
         </div>
       <div class="search-form">
         <el-form :inline="true">
@@ -35,9 +38,11 @@
           </el-form-item>
         </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>
 
@@ -97,6 +102,16 @@
         />
       </div>
     </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>
 </template>
 
@@ -106,10 +121,15 @@
   import {
     queryPersonalProtectiveEquipmentReceiveList,
     deletePersonalProtectiveEquipmentReceive,
+    exportPersonalProtectiveEquipmentReceiveList,
     type QueryPersonalProtectiveEquipmentReceivePageReq,
     type PersonalProtectiveEquipmentReceive,
   } from '@/api/production-safety/personal-protective-equipment-receive';
   import type { QueryPageRequest } from '@/types/basic-query';
+  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 loading = ref(false);
   const queryParams = reactive<
@@ -169,6 +189,36 @@
       .catch(() => {});
   };
 
+  // 批量导入
+  const batchImportVisible = ref(false);
+  const { urlPrefix } = useGlobSetting();
+  // /productionSafety/academyFile/import
+  const importApiUrl = ref(urlJoin(urlPrefix, '/personalProtectiveEquipmentReceive/importProtectiveEquipmentReceive'));
+  const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-academy-file-template.xlsx');
+
+  const handleImport = () => {
+    batchImportVisible.value = true;
+  };
+
+  const handleUpdate = () => {
+    batchImportVisible.value = false;
+    queryTableList();
+  };
+
+  const handleDownload = async () => {
+    try {
+      const response = await exportPersonalProtectiveEquipmentReceiveList(queryParams.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 handleRestParams = () => {
     queryParams.pageNumber = 1;
     queryParams.pageSize = 10;