From b4fb6d19e33450b40da8d8b75a720bab8434af02 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 30 四月 2026 16:03:32 +0800
Subject: [PATCH] 修改上传文件组件导入

---
 src/views/financialManagement/expenseManagement/index.vue            |  176 ------------
 src/views/safeProduction/safeQualifications/index.vue                |   40 +--
 src/views/procurementManagement/procurementInvoiceLedger/index.vue   |  159 -----------
 src/views/procurementManagement/procurementLedger/index.vue          |   27 -
 src/views/productionManagement/processRoute/index.vue                |    3 
 src/views/salesManagement/invoiceLedger/index.vue                    |   25 -
 src/views/collaborativeApproval/rulesRegulationsManagement/index.vue |   80 -----
 src/views/salesManagement/salesLedger/index.vue                      |   34 +-
 src/views/safeProduction/safetyTrainingAssessment/index.vue          |   49 +--
 src/views/customerService/afterSalesHandling/index.vue               |  165 -----------
 src/views/productionManagement/workOrderManagement/index.vue         |    3 
 11 files changed, 113 insertions(+), 648 deletions(-)

diff --git a/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue b/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
index eb0802e..f7ba9d9 100644
--- a/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
+++ b/src/views/collaborativeApproval/rulesRegulationsManagement/index.vue
@@ -212,14 +212,7 @@
         </el-table-column>
       </el-table>
     </el-dialog>
-    <FileListDialog ref="fileListDialogRef"
-                    v-model="fileDialogVisible"
-                    :show-upload-button="true"
-                    :show-delete-button="true"
-                    :delete-method="handleAttachmentDelete"
-                    :rules-regulations-management-id="currentFileRuleId"
-                    :name-column-label="'闄勪欢鍚嶇О'"
-                    @upload="handleAttachmentUpload"/>
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="rules_regulations_management" :record-id="recordId"  />
   </div>
 </template>
 
@@ -235,7 +228,7 @@
     addReadingStatus,
     updateReadingStatus,
   } from "@/api/collaborativeApproval/sealManagement.js";
-  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
   import {
     listRuleFiles,
     delRuleFile,
@@ -254,14 +247,7 @@
     total: 0,
   });
   // 闄勪欢寮圭獥
-  const fileDialogVisible = ref(false);
-  const fileListDialogRef = ref(null);
   const currentFileRuleId = ref(null);
-  const filePage = reactive({
-    current: 1,
-    size: 1000,
-    total: 0,
-  });
   // 瑙勭珷鍒跺害鐩稿叧
   const showRegulationDialog = ref(false);
   const showRegulationDetailDialog = ref(false);
@@ -564,63 +550,15 @@
     );
   };
 
-  // 闄勪欢锛氭煡璇�
-  const fetchRuleFiles = async rulesRegulationsManagementId => {
-    const params = {
-      current: filePage.current,
-      size: filePage.size,
-      rulesRegulationsManagementId,
-    };
-    const res = await listRuleFiles(params);
-    const records = res?.data?.records || [];
-    filePage.total = res?.data?.total || records.length;
-    const mapped = records.map(item => ({
-      id: item.id,
-      name: item.fileName || item.name,
-      url: item.fileUrl || item.url,
-      raw: item,
-    }));
-    fileListDialogRef.value?.setList(mapped);
-  };
-
   // 鎵撳紑闄勪欢寮圭獥
-  const openFileDialog = async row => {
-    currentFileRuleId.value = row.id;
-    fileDialogVisible.value = true;
-    await fetchRuleFiles(row.id);
-  };
+  const recordId =ref(0)
+  const fileDialogVisible = ref(false)
 
-  // 鍒锋柊闄勪欢鍒楄〃
-  const refreshFileList = async () => {
-    if (!currentFileRuleId.value) return;
-    await fetchRuleFiles(currentFileRuleId.value);
-  };
-
-  // 涓婁紶闄勪欢锛堢敱瀛愮粍浠惰Е鍙戯級
-  const handleAttachmentUpload = async filePayload => {
-    if (!currentFileRuleId.value) return;
-    const payload = {
-      name: filePayload?.fileName || filePayload?.name,
-      url: filePayload?.fileUrl || filePayload?.url,
-      rulesRegulationsManagementId: currentFileRuleId.value,
-    };
-    await addRuleFile(payload);
-    ElMessage.success("鏂囦欢涓婁紶鎴愬姛");
-    await refreshFileList();
-  };
-
-  // 鍒犻櫎闄勪欢
-  const handleAttachmentDelete = async row => {
-    if (!row?.id) return false;
-    try {
-      await ElMessageBox.confirm("纭鍒犻櫎璇ラ檮浠讹紵", "鎻愮ず", { type: "warning" });
-    } catch {
-      return false;
-    }
-    await delRuleFile([row.id]);
-    ElMessage.success("鍒犻櫎鎴愬姛");
-    await refreshFileList();
-  };
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
 
   // 鑾峰彇瑙勭珷鍒跺害鍒楄〃鏁版嵁
   const getRegulationList = async () => {
diff --git a/src/views/customerService/afterSalesHandling/index.vue b/src/views/customerService/afterSalesHandling/index.vue
index 57cc2eb..d023f51 100644
--- a/src/views/customerService/afterSalesHandling/index.vue
+++ b/src/views/customerService/afterSalesHandling/index.vue
@@ -102,33 +102,19 @@
 			></PIMTable>
 		</div>
 		<form-dia ref="formDia" @close="handleQuery"></form-dia>
-		<FileListDialog
-			ref="fileListRef"
-			v-model="fileListDialogVisible"
-			title="鍞悗闄勪欢"
-			:show-upload-button="true"
-			:show-delete-button="true"
-			:upload-method="handleFileUpload"
-			:delete-method="handleFileDelete"
-		/>
-	</div>
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="after_sales_service" :record-id="recordId"  />
+  </div>
 </template>
 
 <script setup>
-import { onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick } from "vue";
+import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick, defineAsyncComponent} from "vue";
 import FormDia from "@/views/customerService/afterSalesHandling/components/formDia.vue";
-import FileListDialog from "@/components/Dialog/FileListDialog.vue";
 import { ElMessageBox } from "element-plus";
-import request from "@/utils/request";
-import { getToken } from "@/utils/auth";
 import {
 	afterSalesServiceListPage,
-	afterSalesServiceFileListPage,
-	afterSalesServiceFileDel,
 } from "@/api/customerService/index.js";
-import useUserStore from "@/store/modules/user.js";
 const { proxy } = getCurrentInstance();
-const userStore = useUserStore()
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
 const data = reactive({
 	searchForm: {
@@ -303,144 +289,15 @@
   })
 }
 
+
+// 鎵撳紑闄勪欢寮圭獥
+const recordId =ref(0)
+const fileDialogVisible = ref(false)
+
 // 鎵撳紑闄勪欢寮规
 const openFilesFormDia = async (row) => {
-	currentFileRow.value = row
-	try {
-		const res = await afterSalesServiceFileListPage({
-			afterSalesServiceId: row.id,
-			current: 1,
-			size: 100,
-		})
-		if (res.code === 200 && fileListRef.value) {
-			const fileList = (res.data?.records || []).map((item) => ({
-				name: item.name || item.fileName,
-				url: item.url || item.fileUrl,
-				id: item.id,
-				...item,
-			}))
-			fileListRef.value.open(fileList)
-			fileListDialogVisible.value = true
-		} else {
-			fileListRef.value?.open([])
-			fileListDialogVisible.value = true
-		}
-	} catch (error) {
-		proxy.$modal.msgError("鑾峰彇闄勪欢鍒楄〃澶辫触")
-		fileListRef.value?.open([])
-		fileListDialogVisible.value = true
-	}
-}
-
-// 涓婁紶闄勪欢
-const handleFileUpload = async () => {
-	if (!currentFileRow.value) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁")
-		return
-	}
-	return new Promise((resolve) => {
-		const input = document.createElement("input")
-		input.type = "file"
-		input.style.display = "none"
-		input.onchange = async (e) => {
-			const file = e.target.files[0]
-			if (!file) {
-				resolve(null)
-				return
-			}
-			try {
-				const formData = new FormData()
-				formData.append("file", file)
-				formData.append("id", currentFileRow.value.id)
-				const uploadRes = await request({
-					url: "/afterSalesService/file/upload",
-					method: "post",
-					data: formData,
-					headers: {
-						"Content-Type": "multipart/form-data",
-						Authorization: `Bearer ${getToken()}`,
-					},
-				})
-				if (uploadRes.code === 200) {
-					proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛")
-					// 閲嶆柊鑾峰彇鏂囦欢鍒楄〃
-					const listRes = await afterSalesServiceFileListPage({
-						afterSalesServiceId: currentFileRow.value.id,
-						current: 1,
-						size: 100,
-					})
-					if (listRes.code === 200 && fileListRef.value) {
-						const fileList = (listRes.data?.records || []).map((item) => ({
-							name: item.fileName,
-							url: item.fileUrl,
-							id: item.id,
-							...item,
-						}))
-						fileListRef.value.setList(fileList)
-					}
-					resolve({ name: file.name, url: "", id: null })
-				} else {
-					proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触")
-					resolve(null)
-				}
-			} catch (err) {
-				proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触")
-				resolve(null)
-			} finally {
-				document.body.removeChild(input)
-			}
-		}
-		document.body.appendChild(input)
-		input.click()
-	})
-}
-
-// 鍒犻櫎闄勪欢
-const handleFileDelete = async (row) => {
-	try {
-		// 娣诲姞纭瀵硅瘽妗�
-		const confirmResult = await ElMessageBox.confirm(
-			'纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�',
-			'鍒犻櫎纭',
-			{
-				confirmButtonText: '纭畾',
-				cancelButtonText: '鍙栨秷',
-				type: 'warning'
-			}
-		)
-
-		if (confirmResult === 'confirm') {
-			const res = await afterSalesServiceFileDel(row.id)
-			if (res.code === 200) {
-				proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
-				if (currentFileRow.value && fileListRef.value) {
-					const listRes = await afterSalesServiceFileListPage({
-						afterSalesServiceId: currentFileRow.value.id,
-						current: 1,
-						size: 100,
-					})
-					if (listRes.code === 200) {
-						const fileList = (listRes.data?.records || []).map((item) => ({
-							name: item.fileName,
-							url: item.fileUrl,
-							id: item.id,
-							...item,
-						}))
-						fileListRef.value.setList(fileList)
-					}
-				}
-			} else {
-				proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触")
-				return false
-			}
-		}
-	} catch (error) {
-		// 濡傛灉鐢ㄦ埛鍙栨秷鍒犻櫎锛屼笉鏄剧ず閿欒淇℃伅
-		if (error !== 'cancel') {
-			proxy.$modal.msgError("鍒犻櫎澶辫触")
-		}
-		return false
-	}
+  recordId.value = row.id
+  fileDialogVisible.value = true
 }
 
 // 鏌ヨ鍒楄〃
diff --git a/src/views/financialManagement/expenseManagement/index.vue b/src/views/financialManagement/expenseManagement/index.vue
index ac55d01..173f8e1 100644
--- a/src/views/financialManagement/expenseManagement/index.vue
+++ b/src/views/financialManagement/expenseManagement/index.vue
@@ -76,27 +76,18 @@
       </PIMTable>
     </div>
     <Modal ref="modalRef" @success="getTableData"></Modal>
-    <FileListDialog 
-      ref="fileListRef" 
-      v-model="fileListDialogVisible"
-      :show-upload-button="true"
-      :show-delete-button="true"
-      :upload-method="handleUpload"
-      :delete-method="handleFileDelete"
-    />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="account_expense" :record-id="recordId"  />
   </div>
 </template>
 
 <script setup>
 import { usePaginationApi } from "@/hooks/usePaginationApi";
-import { listPage, delAccountExpense, fileListPage, fileAdd, fileDel } from "@/api/financialManagement/expenseManagement";
-import { onMounted, getCurrentInstance, ref, computed } from "vue";
+import { listPage, delAccountExpense } from "@/api/financialManagement/expenseManagement";
+import {onMounted, getCurrentInstance, ref, computed, defineAsyncComponent} from "vue";
 import Modal from "./Modal.vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import dayjs from "dayjs";
-import FileListDialog from "@/components/Dialog/FileListDialog.vue";
-import request from "@/utils/request";
-import { getToken } from "@/utils/auth";
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
 defineOptions({
   name: "鏀嚭绠$悊",
@@ -108,9 +99,6 @@
 const modalRef = ref();
 const { checkout_payment } = proxy.useDict("checkout_payment");
 const { expense_types } = proxy.useDict("expense_types");
-const fileListRef = ref(null);
-const fileListDialogVisible = ref(false);
-const currentFileRow = ref(null);
 const accountType = ref('鏀嚭');
 
 const {
@@ -315,156 +303,16 @@
       proxy.$modal.msg("宸插彇娑�");
     });
 };
+
+// 鎵撳紑闄勪欢寮圭獥
+const recordId =ref(0)
+const fileDialogVisible = ref(false)
+
 // 鎵撳紑闄勪欢寮规
 const openFilesFormDia = async (row) => {
-  currentFileRow.value = row;
-  accountType.value = '鏀嚭';
-  try {
-    const res = await fileListPage({
-      accountId: row.id,
-      accountType: accountType.value,
-      current: 1,
-      size: 100
-    });
-    if (res.code === 200 && fileListRef.value) {
-      // 灏嗘暟鎹浆鎹负 FileListDialog 闇�瑕佺殑鏍煎紡
-      const fileList = (res.data?.records || []).map(item => ({
-        name: item.name,
-        url: item.url,
-        id: item.id,
-        ...item
-      }));
-      fileListRef.value.open(fileList);
-      fileListDialogVisible.value = true;
-    }
-  } catch (error) {
-    proxy.$modal.msgError("鑾峰彇闄勪欢鍒楄〃澶辫触");
-  }
-};
-
-// 涓婁紶闄勪欢
-const handleUpload = async () => {
-  if (!currentFileRow.value) {
-    proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁");
-    return null;
-  }
-  
-  return new Promise((resolve) => {
-    // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
-    const input = document.createElement('input');
-    input.type = 'file';
-    input.style.display = 'none';
-    input.onchange = async (e) => {
-      const file = e.target.files[0];
-      if (!file) {
-        resolve(null);
-        return;
-      }
-      
-      try {
-        // 浣跨敤 FormData 涓婁紶鏂囦欢
-        const formData = new FormData();
-        formData.append('file', file);
-        
-        const uploadRes = await request({
-          url: '/file/upload',
-          method: 'post',
-          data: formData,
-          headers: {
-            'Content-Type': 'multipart/form-data',
-            Authorization: `Bearer ${getToken()}`
-          }
-        });
-        
-        if (uploadRes.code === 200) {
-          // 淇濆瓨闄勪欢淇℃伅
-          const fileData = {
-            accountId: currentFileRow.value.id,
-            accountType: accountType.value,
-            name: uploadRes.data.originalName || file.name,
-            url: uploadRes.data.tempPath || uploadRes.data.url
-          };
-          
-          const saveRes = await fileAdd(fileData);
-          if (saveRes.code === 200) {
-            proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
-            // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
-            const listRes = await fileListPage({
-              accountId: currentFileRow.value.id,
-              accountType: accountType.value,
-              current: 1,
-              size: 100
-            });
-            if (listRes.code === 200 && fileListRef.value) {
-              const fileList = (listRes.data?.records || []).map(item => ({
-                name: item.name,
-                url: item.url,
-                id: item.id,
-                ...item
-              }));
-              fileListRef.value.setList(fileList);
-            }
-            // 杩斿洖鏂版枃浠朵俊鎭�
-            resolve({
-              name: fileData.name,
-              url: fileData.url,
-              id: saveRes.data?.id
-            });
-          } else {
-            proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触");
-            resolve(null);
-          }
-        } else {
-          proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
-          resolve(null);
-        }
-      } catch (error) {
-        proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
-        resolve(null);
-      } finally {
-        document.body.removeChild(input);
-      }
-    };
-    
-    document.body.appendChild(input);
-    input.click();
-  });
-};
-
-// 鍒犻櫎闄勪欢
-const handleFileDelete = async (row) => {
-  try {
-    const res = await fileDel([row.id]);
-    if (res.code === 200) {
-      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
-      if (currentFileRow.value && fileListRef.value) {
-        const listRes = await fileListPage({
-          accountId: currentFileRow.value.id,
-          accountType: accountType.value,
-          current: 1,
-          size: 100
-        });
-        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);
-        }
-      }
-      return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
-    } else {
-      proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
-      return false;
-    }
-  } catch (error) {
-    proxy.$modal.msgError("鍒犻櫎澶辫触");
-    return false;
-  }
-};
+  recordId.value = row.id
+  fileDialogVisible.value = true
+}
 
 onMounted(() => {
   getTableData();
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/index.vue b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
index d82e3e7..c94d8c2 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -69,7 +69,7 @@
           <el-button
             type="primary"
             link
-            @click="downLoadFile(row)"
+            @click="openFileDialog(row)"
           >
             闄勪欢
           </el-button>
@@ -83,16 +83,7 @@
         </template>
       </PIMTable>
     </div>
-    <FileListDialog 
-      ref="fileListRef" 
-      v-model="fileListDialogVisible"
-      title="闄勪欢鍒楄〃"
-      :showUploadButton="true"
-      :showDeleteButton="true"
-      :deleteMethod="handleDeleteFile"
-      :uploadMethod="handleFileUpload"
-      :rulesRegulationsManagementId="currentRowId"
-    />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="ticket_registration" :record-id="recordId"  />
     <EditModal ref="editmodalRef" @success="getTableData"></EditModal>
   </div>
 </template>
@@ -113,9 +104,9 @@
 import { onMounted } from "vue";
 import { ElMessageBox } from "element-plus";
 import EditModal from "./Modal/EditModal.vue";
-import FileListDialog from '@/components/Dialog/FileListDialog.vue';
 import useUserStore from "@/store/modules/user.js";
 const userStore = useUserStore();
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
 defineOptions({
   name: "鏉ョエ鍙拌处",
@@ -290,143 +281,15 @@
   onCurrentChange(page);
 };
 
-const downLoadFile = row => {
-  currentRowId.value = row.id;
-  if (fileListRef.value) {
-    fileListRef.value.open(row.commonFiles || []);
-  }
-};
+// 鎵撳紑闄勪欢寮圭獥
+const recordId =ref(0)
+const fileDialogVisible = ref(false)
 
-// 涓婁紶闄勪欢锛堣嚜瀹氫箟涓婁紶鏂规硶锛�
-const handleFileUpload = async () => {
-  if (!currentRowId.value) {
-    proxy.$modal.msgWarning("缂哄皯鐧昏ID锛屾棤娉曚繚瀛橀檮浠�");
-    return;
-  }
-  
-  return new Promise((resolve) => {
-    // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
-    const input = document.createElement('input');
-    input.type = 'file';
-    input.style.display = 'none';
-    input.onchange = async (e) => {
-      const file = e.target.files[0];
-      if (!file) {
-        resolve(null);
-        return;
-      }
-      
-      try {
-        // 浣跨敤 FormData 涓婁紶鏂囦欢
-        const formData = new FormData();
-        formData.append('file', file);
-        formData.append('type', '4'); // type 鍙傛暟锛岀敤鎴锋湭鎸囧畾鍏蜂綋鍊硷紝鍏堜紶绌哄瓧绗︿覆
-        formData.append('id', currentRowId.value); // 褰撳墠琛岀殑 id
-        
-        const uploadRes = await request({
-          url: '/file/uploadByCommon',
-          method: 'post',
-          data: formData,
-          headers: {
-            'Content-Type': 'multipart/form-data',
-            Authorization: `Bearer ${getToken()}`
-          }
-        });
-        
-        if (uploadRes.code === 200) {
-          proxy.$modal.msgSuccess("闄勪欢涓婁紶鎴愬姛");
-          
-          // 鍒锋柊鍒楄〃鑾峰彇鏈�鏂版暟鎹�
-          await new Promise((resolveRefresh) => {
-            // 璋冪敤 API 鑾峰彇鏈�鏂板垪琛ㄦ暟鎹�
-            productRecordPage({
-              ...filters,
-              current: pagination.currentPage,
-              size: pagination.pageSize
-            }).then(({ code, data }) => {
-              if (code === 200) {
-                // 鏇存柊鏁版嵁鍒楄〃
-                dataList.value = data.records;
-                pagination.total = data.total;
-                
-                // 浠庡閮ㄦ暟鎹幏鍙� commonFiles
-                const currentRow = dataList.value.find(row => row.id === currentRowId.value);
-                if (currentRow && fileListRef.value) {
-                  // 鍒锋柊闄勪欢鍒楄〃锛屼娇鐢ㄤ粠澶栭儴鑾峰彇鐨勬渶鏂� commonFiles
-                  fileListRef.value.open(currentRow.commonFiles || []);
-                }
-                resolveRefresh();
-              } else {
-                resolveRefresh();
-              }
-            }).catch(() => {
-              resolveRefresh();
-            });
-          });
-          
-          resolve({
-            name: uploadRes.data?.originalName || file.name,
-            url: uploadRes.data?.tempPath || uploadRes.data?.url,
-            id: uploadRes.data?.id
-          });
-        } else {
-          proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
-          resolve(null);
-        }
-      } catch (error) {
-        console.error("闄勪欢涓婁紶澶辫触:", error);
-        proxy.$modal.msgError("闄勪欢涓婁紶澶辫触");
-        resolve(null);
-      } finally {
-        document.body.removeChild(input);
-      }
-    };
-    
-    document.body.appendChild(input);
-    input.click();
-  });
-};
-
-// 鍒犻櫎闄勪欢
-const handleDeleteFile = async (file) => {
-  try {
-    await delCommonFile([file.id]);
-    proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-    
-    // 鍒锋柊鍒楄〃鑾峰彇鏈�鏂版暟鎹�
-    await new Promise((resolveRefresh) => {
-      // 璋冪敤 API 鑾峰彇鏈�鏂板垪琛ㄦ暟鎹�
-      productRecordPage({
-        ...filters,
-        current: pagination.currentPage,
-        size: pagination.pageSize
-      }).then(({ code, data }) => {
-        if (code === 200) {
-          // 鏇存柊鏁版嵁鍒楄〃
-          dataList.value = data.records;
-          pagination.total = data.total;
-          
-          // 浠庡閮ㄦ暟鎹幏鍙� commonFiles
-          const currentRow = dataList.value.find(row => row.id === currentRowId.value);
-          if (currentRow && fileListRef.value) {
-            // 鍒锋柊闄勪欢鍒楄〃锛屼娇鐢ㄤ粠澶栭儴鑾峰彇鐨勬渶鏂� commonFiles
-            fileListRef.value.open(currentRow.commonFiles || []);
-          }
-          resolveRefresh();
-        } else {
-          resolveRefresh();
-        }
-      }).catch(() => {
-        resolveRefresh();
-      });
-    });
-    
-    return true;
-  } catch (error) {
-    proxy.$modal.msgError("鍒犻櫎澶辫触");
-    return false;
-  }
-};
+// 鎵撳紑闄勪欢寮规
+const openFileDialog = async (row) => {
+  recordId.value = row.id
+  fileDialogVisible.value = true
+}
 
 const openEdit = (row) => {
   editmodalRef.value.open(row);
diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 32b54a9..55c18db 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -177,7 +177,7 @@
                        :disabled="scope.row.approvalStatus !== 1 && scope.row.approvalStatus !== 4">缂栬緫</el-button>
             <el-button link
                        type="primary"
-                       @click="downLoadFile(scope.row)">闄勪欢</el-button>
+                       @click="openFileDialog(scope.row)">闄勪欢</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -640,11 +640,7 @@
         </el-row>
       </el-form>
     </FormDialog>
-    <FileListDialog 
-      ref="fileListRef" 
-      v-model="fileListDialogVisible"
-      title="闄勪欢鍒楄〃"
-    />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="purchase_ledger" :record-id="recordId"  />
   </div>
 </template>
 
@@ -661,8 +657,6 @@
   } from "vue";
   import { Search, Delete } from "@element-plus/icons-vue";
   import { ElMessageBox, ElMessage } from "element-plus";
-  import FormDialog from '@/components/Dialog/FormDialog.vue';
-  import FileListDialog from '@/components/Dialog/FileListDialog.vue';
   import {
     getSalesLedgerWithProducts,
     addOrUpdateSalesLedgerProduct,
@@ -685,6 +679,7 @@
     delPurchaseTemplate,
   } from "@/api/procurementManagement/procurementLedger.js";
   import useFormData from "@/hooks/useFormData.js";
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
   const { proxy } = getCurrentInstance();
   const tableData = ref([]);
@@ -1753,13 +1748,15 @@
     }
   };
 
-  const fileListRef = ref(null);
-  const fileListDialogVisible = ref(false);
-  const downLoadFile = row => {
-    if (fileListRef.value) {
-      fileListRef.value.open(row.salesLedgerFiles);
-    }
-  };
+  // 鎵撳紑闄勪欢寮圭獥
+  const recordId =ref(0)
+  const fileDialogVisible = ref(false)
+
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
 
   // 鑾峰彇妯℃澘淇℃伅
   const getTemplateList = async () => {
diff --git a/src/views/productionManagement/processRoute/index.vue b/src/views/productionManagement/processRoute/index.vue
index 4a713dc..43425c6 100644
--- a/src/views/productionManagement/processRoute/index.vue
+++ b/src/views/productionManagement/processRoute/index.vue
@@ -61,7 +61,8 @@
   import EditProcess from "@/views/productionManagement/processRoute/Edit.vue";
   import RouteItemForm from "@/views/productionManagement/processRoute/ItemsForm.vue";
   import { listPage, del } from "@/api/productionManagement/processRoute.js";
-  import FileList from "@/components/Dialog/FileList.vue";
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+
   import { useRouter } from "vue-router";
   import { ElMessage, ElMessageBox } from "element-plus";
 
diff --git a/src/views/productionManagement/workOrderManagement/index.vue b/src/views/productionManagement/workOrderManagement/index.vue
index bb09a10..4f09330 100644
--- a/src/views/productionManagement/workOrderManagement/index.vue
+++ b/src/views/productionManagement/workOrderManagement/index.vue
@@ -264,7 +264,8 @@
   import QRCode from "qrcode";
   import { getCurrentInstance, reactive, toRefs } from "vue";
   import MaterialDialog from "./components/MaterialDialog.vue";
-  import FileList from "@/components/Dialog/FileList.vue";
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+
   import useUserStore from "@/store/modules/user";
   const { proxy } = getCurrentInstance();
   const userStore = useUserStore();
diff --git a/src/views/safeProduction/safeQualifications/index.vue b/src/views/safeProduction/safeQualifications/index.vue
index 819c6da..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>
@@ -203,16 +203,7 @@
       </el-form>
     </FormDialog>
 <!-- todo 闄勪欢棰勮鐩稿叧 -->
-    <FileListDialog ref="fileListRef"
-                    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="闄勪欢鍒楄〃" />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="safe_certification" :record-id="recordId"  />
   </div>
 </template>
 
@@ -223,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 {
@@ -238,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([]);
@@ -524,19 +514,17 @@
     size: 10,
     total: 0,
   });
-  const downLoadFile = row => {
-    currentFileRow.value = row;
-    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 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();
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index b595bf6..2c98308 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -239,7 +239,7 @@
           <el-descriptions-item label="闄勪欢鍒楄〃:">
             <el-button type="primary"
                        size="small"
-                       @click="downLoadFile(endform)">闄勪欢鍒楄〃</el-button>
+                       @click="openFileDialog(endform)">闄勪欢鍒楄〃</el-button>
           </el-descriptions-item>
         </el-descriptions>
         <!-- <el-divider style="margin: 20px 0;" /> -->
@@ -359,22 +359,12 @@
       </template>
     </el-dialog>
     <!--  todo 闄勪欢棰勮鐩稿叧 -->
-    <FileListDialog ref="fileListRef"
-                    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="闄勪欢鍒楄〃" />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="safe_training" :record-id="recordId"  />
   </div>
 </template>
 
 <script setup>
   import { Search } from "@element-plus/icons-vue";
-  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
   import {
     onMounted,
     ref,
@@ -403,6 +393,7 @@
   import useUserStore from "@/store/modules/user";
   import dayjs from "dayjs";
   const userStore = useUserStore();
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
   // 琛ㄥ崟楠岃瘉瑙勫垯
   const rules = {
@@ -621,7 +612,7 @@
           name: "闄勪欢",
           type: "text",
           clickFun: row => {
-            downLoadFile(row);
+            openFileDialog(row);
           },
           color: "#007AFF",
         },
@@ -783,27 +774,17 @@
       form.value.principalMobile = selectedUser.phonenumber;
     }
   };
-  /**
-   * 涓嬭浇鏂囦欢
-   *
-   * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
-   */
-  const fileListRef = ref(null);
-  const fileListDialogVisible = ref(false);
-  const currentFileRow = ref(null);
-  const downLoadFile = row => {
-    currentFileRow.value = row;
-    safeTrainingFileListPage({
-      safeTrainingId: 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 recordId =ref(0)
+  const fileDialogVisible = ref(false)
+
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
+  
   // 涓婁紶闄勪欢
   const handleUpload = async () => {
     if (!currentFileRow.value) {
diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index 3827854..444560d 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -44,7 +44,7 @@
         <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
           <template #default="scope">
             <el-button link type="primary" @click="openForm(scope.row)">缂栬緫</el-button>
-            <el-button link type="primary" @click="downLoadFile(scope.row)">闄勪欢</el-button>
+            <el-button link type="primary" @click="openFileDialog(scope.row)">闄勪欢</el-button>
             <el-button link type="primary" @click="delInvoiceLedger(scope.row)">鍒犻櫎</el-button>
           </template>
         </el-table-column>
@@ -134,7 +134,7 @@
         </div>
       </template>
     </el-dialog>
-    <FileListDialog ref="fileListRef" v-model="fileListDialogVisible" />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="invoice_registration_product" :record-id="recordId"  />
   </div>
 </template>
 
@@ -155,8 +155,8 @@
 import useUserStore from "@/store/modules/user.js";
 import useFormData from "@/hooks/useFormData";
 import dayjs from "dayjs";
-import FileListDialog from '@/components/Dialog/FileListDialog.vue';
 import { getCurrentDate } from "@/utils/index.js";
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
 
 const { proxy } = getCurrentInstance();
 const tableData = ref([]);
@@ -422,17 +422,14 @@
   getList();
 };
 
-//闄勪欢鐩稿叧
-const fileListRef = ref(null)
-const fileListDialogVisible = ref(false)
-//鏌ョ湅闄勪欢
-const downLoadFile = (row) => {
-	invoiceLedgerProductInfo({ id: row.id }).then((res) => {
-		if (fileListRef.value) {
-			fileListRef.value.open(res.data.fileList)
-			fileListDialogVisible.value = true
-		}
-	});
+// 鎵撳紑闄勪欢寮圭獥
+const recordId =ref(0)
+const fileDialogVisible = ref(false)
+
+// 鎵撳紑闄勪欢寮规
+const openFileDialog = async (row) => {
+  recordId.value = row.id
+  fileDialogVisible.value = true
 }
 
 onMounted(() => {
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index dc648be..1235f94 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -231,7 +231,7 @@
                        :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫</el-button>
             <el-button link
                        type="primary"
-                       @click="downLoadFile(scope.row)">闄勪欢</el-button>
+                       @click="openFileDialog(scope.row)">闄勪欢</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -740,9 +740,7 @@
     </FormDialog>
 <!-- // todo 闄勪欢棰勮鐩稿叧 -->
     <!-- 闄勪欢鍒楄〃寮圭獥 -->
-    <FileListDialog ref="fileListRef"
-                    v-model="fileListDialogVisible"
-                    title="闄勪欢鍒楄〃" />
+    <FileList v-if="fileDialogVisible"  v-model:visible="fileDialogVisible" record-type="sales_ledger" :record-id="recordId"  />
     <!-- 鎵撳嵃棰勮寮圭獥 -->
     <el-dialog v-model="printPreviewVisible"
                title="鎵撳嵃棰勮"
@@ -904,10 +902,8 @@
   import { onMounted, ref, getCurrentInstance } from "vue";
   import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
   import { ElMessageBox, ElMessage } from "element-plus";
-  import { UploadFilled, Download } from "@element-plus/icons-vue";
   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 {
@@ -929,6 +925,9 @@
   import { useRouter, useRoute } from "vue-router";
   import { listCustomerPrivatePool } from "@/api/basicData/customerFile.js";
   import FileUpload from "@/components/AttachmentUpload/file/index.vue";
+
+  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
+
   const router = useRouter();
   const route = useRoute();
   const userStore = useUserStore();
@@ -2440,20 +2439,15 @@
     return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
   };
 
-  /**
-   * 涓嬭浇鏂囦欢
-   *
-   * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
-   */
-  const fileListRef = ref(null);
-  const fileListDialogVisible = ref(false);
-  const downLoadFile = row => {
-    getSalesLedgerWithProducts({ id: row.id, type: 1 }).then(res => {
-      if (fileListRef.value) {
-        fileListRef.value.open(res.salesLedgerFiles);
-      }
-    });
-  };
+  // 鎵撳紑闄勪欢寮圭獥
+  const recordId =ref(0)
+  const fileDialogVisible = ref(false)
+
+  // 鎵撳紑闄勪欢寮规
+  const openFileDialog = async (row) => {
+    recordId.value = row.id
+    fileDialogVisible.value = true
+  }
 
   // 鎵撳紑鍙戣揣寮规
   const openDeliveryForm = row => {

--
Gitblit v1.9.3