From f1af23dd2cb022d543a92841c866dd26ceccc6ef Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 19 三月 2026 17:00:28 +0800
Subject: [PATCH] fix: 新增资质后,点击编辑,原有内容消失不展示了(进销存升级一样问题)

---
 src/views/safeProduction/safeQualifications/index.vue |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/src/views/safeProduction/safeQualifications/index.vue b/src/views/safeProduction/safeQualifications/index.vue
index 8bf320b..1d067d9 100644
--- a/src/views/safeProduction/safeQualifications/index.vue
+++ b/src/views/safeProduction/safeQualifications/index.vue
@@ -82,7 +82,11 @@
                          show-overflow-tooltip />
         <el-table-column label="瑙勭▼璧勮川绫诲瀷"
                          prop="type"
-                         show-overflow-tooltip />
+                         show-overflow-tooltip>
+          <template #default="scope">
+            {{ type_qualification.find(item => item.value === scope.row.type)?.label || '-' }}
+          </template>
+        </el-table-column>
         <el-table-column label="鐗堟湰鍙�"
                          prop="version"
                          width="180"
@@ -203,8 +207,11 @@
                     v-model="fileListDialogVisible"
                     :show-upload-button="true"
                     :show-delete-button="true"
+                    :is-show-pagination="true"
+                    :page="filePagination"
                     :upload-method="handleUpload"
                     :delete-method="handleFileDelete"
+                    @pagination="paginationSearch"
                     title="闄勪欢鍒楄〃" />
   </div>
 </template>
@@ -401,7 +408,9 @@
         executionDate: "",
       };
     } else {
-      form.value = row;
+      // 鍏抽敭锛氱紪杈戞椂涓嶈鐩存帴寮曠敤琛ㄦ牸琛屽璞★紝閬垮厤鍙栨秷/閲嶇疆鏃舵妸鍒楄〃鏁版嵁涓�璧锋竻绌�
+      // 浣跨敤娣辨嫹璐濇柇寮�寮曠敤鍏崇郴
+      form.value = JSON.parse(JSON.stringify(row || {}));
     }
     dialogFormVisible.value = true;
   };
@@ -446,6 +455,7 @@
   // 鍏抽棴寮规
   const closeDia = () => {
     proxy.resetForm("formRef");
+    form.value = {};
     dialogFormVisible.value = false;
   };
   // 鍏抽棴浜у搧寮规
@@ -510,12 +520,22 @@
   const fileListRef = ref(null);
   const fileListDialogVisible = ref(false);
   const currentFileRow = ref(null);
+  const filePagination = ref({
+    current: 1,
+    size: 10,
+    total: 0,
+  });
   const downLoadFile = row => {
     currentFileRow.value = row;
-    fileListPage({ safeCertificationId: row.id }).then(res => {
+    fileListPage({
+      safeCertificationId: row.id,
+      current: filePagination.value.current,
+      size: filePagination.value.size,
+    }).then(res => {
       if (fileListRef.value) {
         fileListRef.value.open(res.data.records);
       }
+      filePagination.value.total = res.data.total || 0;
     });
   };
   const currentFactoryName = ref("");
@@ -599,6 +619,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 => ({
@@ -608,6 +630,7 @@
                   ...item,
                 }));
                 fileListRef.value.setList(fileList);
+                filePagination.value.total = listRes.data?.total || 0;
               }
               // 杩斿洖鏂版枃浠朵俊鎭�
               resolve({
@@ -635,6 +658,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 {
@@ -645,6 +688,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 => ({
@@ -654,6 +699,7 @@
               ...item,
             }));
             fileListRef.value.setList(fileList);
+            filePagination.value.total = listRes.data?.total || 0;
           }
         }
         return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
@@ -681,9 +727,9 @@
     background-color: #fef0f0 !important;
   }
 
-  :deep(.warning-row td) {
-    // color: #cf1322 !important;
-  }
+  /* :deep(.warning-row td) {
+    color: #cf1322 !important;
+  } */
 
   .actions {
     display: flex;

--
Gitblit v1.9.3