From 792ad8ef7684685544fbf03cc93d4eb2dc605bfa Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 09 二月 2026 11:44:53 +0800
Subject: [PATCH] 公司 1.商机管理附件删除修改

---
 src/views/salesManagement/opportunityManagement/index.vue    |   22 ++++++++++++++++++++--
 src/views/salesManagement/opportunityManagement/fileList.vue |   31 ++++++++++++++++++++++++++-----
 2 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/src/views/salesManagement/opportunityManagement/fileList.vue b/src/views/salesManagement/opportunityManagement/fileList.vue
index d0e4cb2..51e3d15 100644
--- a/src/views/salesManagement/opportunityManagement/fileList.vue
+++ b/src/views/salesManagement/opportunityManagement/fileList.vue
@@ -17,20 +17,24 @@
 <script setup>
 import { ref, getCurrentInstance } from 'vue'
 import filePreview from '@/components/filePreview/index.vue'
+import { ElMessageBox } from 'element-plus'
 import {
   delLedgerFile
 } from "@/api/salesManagement/salesLedger.js";
 
+const emit = defineEmits(['refresh'])
 const dialogVisible = ref(false)
 const tableData = ref([])
+const currentRowId = ref(null)
 const { proxy } = getCurrentInstance();
 const filePreviewRef = ref()
 const handleClose = () => {
   dialogVisible.value = false
 }
-const open = (list) => {
+const open = (list, rowId = null) => {
   dialogVisible.value = true
   tableData.value = list
+  currentRowId.value = rowId
 }
 const downLoadFile = (row) => {
   proxy.$download.name(row.url);
@@ -40,10 +44,27 @@
   filePreviewRef.value.open(row.url)
 }
 const delFile = (row) => {
-  let ids = [];
-  ids.push(row.id);
-  delLedgerFile(ids).then((res) => {
-    proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+  ElMessageBox.confirm('纭畾瑕佸垹闄よ闄勪欢鍚楋紵', '鍒犻櫎纭', {
+    confirmButtonText: '纭畾',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    let ids = [];
+    ids.push(row.id);
+    delLedgerFile(ids).then((res) => {
+      if (res.code === 200) {
+        proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        // 閫氱煡鐖剁粍浠跺埛鏂版暟鎹�
+        emit('refresh', currentRowId.value);
+      } else {
+        proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
+      }
+    }).catch((error) => {
+      console.error("鍒犻櫎闄勪欢澶辫触:", error);
+      proxy.$modal.msgError("鍒犻櫎澶辫触锛岃绋嶅悗閲嶈瘯");
+    });
+  }).catch(() => {
+    // 鐢ㄦ埛鍙栨秷鍒犻櫎
   });
 }
 defineExpose({
diff --git a/src/views/salesManagement/opportunityManagement/index.vue b/src/views/salesManagement/opportunityManagement/index.vue
index 40bab75..9a45e12 100644
--- a/src/views/salesManagement/opportunityManagement/index.vue
+++ b/src/views/salesManagement/opportunityManagement/index.vue
@@ -276,7 +276,7 @@
     </el-dialog>
 
     <!-- 闄勪欢鍒楄〃瀵硅瘽妗� -->
-    <FileList ref="fileListRef" />
+    <FileList ref="fileListRef" @refresh="handleFileListRefresh" />
   </div>
 </template>
 
@@ -349,6 +349,7 @@
 
 // FileList缁勪欢寮曠敤
 const fileListRef = ref(null)
+const currentAttachmentRow = ref(null)
 
 // 涓婁紶閰嶇疆
 const upload = reactive({
@@ -802,7 +803,24 @@
 
 // 鏌ョ湅闄勪欢
 function handleAttachment(row) {
-	fileListRef.value.open(row.businessCommonFiles)
+	currentAttachmentRow.value = row
+	fileListRef.value.open(row.businessCommonFiles, row.id)
+}
+
+// 闄勪欢鍒楄〃鍒锋柊
+function handleFileListRefresh(rowId) {
+	// 閲嶆柊鑾峰彇鍒楄〃鏁版嵁
+	getList()
+	// 绛夊緟鍒楄〃鏁版嵁鏇存柊鍚庯紝鎵惧埌瀵瑰簲鐨勮骞舵洿鏂伴檮浠跺垪琛�
+	setTimeout(() => {
+		if (currentAttachmentRow.value && tableData.value) {
+			const updatedRow = tableData.value.find(item => item.id === currentAttachmentRow.value.id)
+			if (updatedRow && updatedRow.businessCommonFiles) {
+				currentAttachmentRow.value = updatedRow
+				fileListRef.value.open(updatedRow.businessCommonFiles, updatedRow.id)
+			}
+		}
+	}, 300)
 }
 
 onMounted(() => {

--
Gitblit v1.9.3