From 07f9f8657d057a38792c3822acc9b08d83478967 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 07 五月 2026 14:23:10 +0800
Subject: [PATCH] 合并代码

---
 src/views/safeProduction/safeQualifications/index.vue |   69 ++++++++++++++++++++++++----------
 1 files changed, 49 insertions(+), 20 deletions(-)

diff --git a/src/views/safeProduction/safeQualifications/index.vue b/src/views/safeProduction/safeQualifications/index.vue
index d7c41f9..39111be 100644
--- a/src/views/safeProduction/safeQualifications/index.vue
+++ b/src/views/safeProduction/safeQualifications/index.vue
@@ -110,7 +110,7 @@
             <el-button link
                        type="primary"
                        size="small"
-                       @click="downLoadFile(scope.row)">闄勪欢</el-button>
+                       @click="openFileDialog(scope.row)">闄勪欢</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -202,14 +202,8 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <!-- 闄勪欢鍒楄〃寮圭獥 -->
-    <FileListDialog ref="fileListRef"
-                    v-model="fileListDialogVisible"
-                    :show-upload-button="true"
-                    :show-delete-button="true"
-                    :upload-method="handleUpload"
-                    :delete-method="handleFileDelete"
-                    title="闄勪欢鍒楄〃" />
+<!-- todo 闄勪欢棰勮鐩稿叧 -->
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="safe_certification" :record-id="recordId"  />
   </div>
 </template>
 
@@ -220,7 +214,6 @@
   import { ElMessageBox, ElMessage } from "element-plus";
   import useUserStore from "@/store/modules/user";
   import { userListNoPage } from "@/api/system/user.js";
-  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
   import FormDialog from "@/components/Dialog/FormDialog.vue";
   import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
   import {
@@ -235,7 +228,7 @@
   import useFormData from "@/hooks/useFormData.js";
   import request from "@/utils/request";
   import dayjs from "dayjs";
-
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
   const userStore = useUserStore();
   const { proxy } = getCurrentInstance();
   const tableData = ref([]);
@@ -405,7 +398,9 @@
         executionDate: "",
       };
     } else {
-      form.value = row;
+      // 鍏抽敭锛氱紪杈戞椂涓嶈鐩存帴寮曠敤琛ㄦ牸琛屽璞★紝閬垮厤鍙栨秷/閲嶇疆鏃舵妸鍒楄〃鏁版嵁涓�璧锋竻绌�
+      // 浣跨敤娣辨嫹璐濇柇寮�寮曠敤鍏崇郴
+      form.value = JSON.parse(JSON.stringify(row || {}));
     }
     dialogFormVisible.value = true;
   };
@@ -514,14 +509,22 @@
   const fileListRef = ref(null);
   const fileListDialogVisible = ref(false);
   const currentFileRow = ref(null);
-  const downLoadFile = row => {
-    currentFileRow.value = row;
-    fileListPage({ safeCertificationId: row.id }).then(res => {
-      if (fileListRef.value) {
-        fileListRef.value.open(res.data.records);
-      }
-    });
-  };
+  const filePagination = ref({
+    current: 1,
+    size: 10,
+    total: 0,
+  });
+
+  // 鎵撳紑闄勪欢寮圭獥
+  const recordId =ref(0)
+  const fileDialogVisible = ref(false)
+
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
+  
   const currentFactoryName = ref("");
   const getCurrentFactoryName = async () => {
     let res = await userStore.getInfo();
@@ -603,6 +606,8 @@
               // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
               const listRes = await fileListPage({
                 safeCertificationId: currentFileRow.value.id,
+                current: filePagination.value.current,
+                size: filePagination.value.size,
               });
               if (listRes.code === 200 && fileListRef.value) {
                 const fileList = (listRes.data?.records || []).map(item => ({
@@ -612,6 +617,7 @@
                   ...item,
                 }));
                 fileListRef.value.setList(fileList);
+                filePagination.value.total = listRes.data?.total || 0;
               }
               // 杩斿洖鏂版枃浠朵俊鎭�
               resolve({
@@ -639,6 +645,26 @@
       input.click();
     });
   };
+  const paginationSearch = async (page, size) => {
+    filePagination.value.current = page;
+    filePagination.value.size = size;
+    const listRes = await fileListPage({
+      safeCertificationId: currentFileRow.value.id,
+      current: filePagination.value.current,
+      size: filePagination.value.size,
+    });
+    if (listRes.code === 200) {
+      const fileList = (listRes.data?.records || []).map(item => ({
+        name: item.name,
+        url: item.url,
+        id: item.id,
+        ...item,
+      }));
+
+      fileListRef.value.setList(fileList);
+      filePagination.value.total = listRes.data?.total || 0;
+    }
+  };
   // 鍒犻櫎闄勪欢
   const handleFileDelete = async row => {
     try {
@@ -649,6 +675,8 @@
         if (currentFileRow.value && fileListRef.value) {
           const listRes = await fileListPage({
             safeCertificationId: currentFileRow.value.id,
+            current: filePagination.value.current,
+            size: filePagination.value.size,
           });
           if (listRes.code === 200) {
             const fileList = (listRes.data?.records || []).map(item => ({
@@ -658,6 +686,7 @@
               ...item,
             }));
             fileListRef.value.setList(fileList);
+            filePagination.value.total = listRes.data?.total || 0;
           }
         }
         return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃

--
Gitblit v1.9.3