From 742643e009dfd72591392f0d7dcf07c2a9a3ec9a Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 16 十二月 2025 13:47:56 +0800
Subject: [PATCH] 1.海川开心-开票台账发票信息上传了,没有查看的地方,只能上传

---
 src/api/publicApi/commonFile.js                      |    8 ++++++++
 src/views/salesManagement/invoiceLedger/index.vue    |   39 +++++++++++++++++++--------------------
 src/views/salesManagement/invoiceLedger/fileList.vue |    4 ++--
 3 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/src/api/publicApi/commonFile.js b/src/api/publicApi/commonFile.js
index b1b07c7..5157304 100644
--- a/src/api/publicApi/commonFile.js
+++ b/src/api/publicApi/commonFile.js
@@ -8,4 +8,12 @@
     method: 'delete',
     data: ids
   })
+}
+// 寮�绁ㄥ彴璐︽枃浠跺垹闄�
+export function delCommonFileInvoiceLedger(ids) {
+  return request({
+    url: '/invoiceLedger/delFile',
+    method: 'delete',
+    data: ids
+  })
 }
\ No newline at end of file
diff --git a/src/views/salesManagement/invoiceLedger/fileList.vue b/src/views/salesManagement/invoiceLedger/fileList.vue
index fb392c5..9d95833 100644
--- a/src/views/salesManagement/invoiceLedger/fileList.vue
+++ b/src/views/salesManagement/invoiceLedger/fileList.vue
@@ -18,7 +18,7 @@
 import { ref } from 'vue'
 import { ElMessageBox, ElMessage } from 'element-plus'
 import filePreview from '@/components/filePreview/index.vue'
-import { delCommonFile } from '@/api/publicApi/commonFile.js'
+import { delCommonFileInvoiceLedger} from '@/api/publicApi/commonFile.js'
 
 const dialogVisible = ref(false)
 const tableData = ref([])
@@ -45,7 +45,7 @@
     cancelButtonText: '鍙栨秷',
     type: 'warning',
   }).then(() => {
-    delCommonFile([row.id]).then(() => {
+		delCommonFileInvoiceLedger([row.id]).then(() => {
       ElMessage.success('鍒犻櫎鎴愬姛')
       // 浠庡垪琛ㄤ腑绉婚櫎宸插垹闄ょ殑闄勪欢
       const index = tableData.value.findIndex(item => item.id === row.id)
diff --git a/src/views/salesManagement/invoiceLedger/index.vue b/src/views/salesManagement/invoiceLedger/index.vue
index d9c87a7..d1bb3fe 100644
--- a/src/views/salesManagement/invoiceLedger/index.vue
+++ b/src/views/salesManagement/invoiceLedger/index.vue
@@ -108,7 +108,7 @@
             <el-form-item label="闄勪欢鏉愭枡锛�" prop="remark">
               <el-upload v-model:file-list="fileList" :action="upload.url" multiple ref="fileUpload" auto-upload
                 :headers="upload.headers" accept=".pdf" :limit="10" :before-upload="handleBeforeUpload"
-                :on-error="handleUploadError" :on-success="handleUploadSuccess" :on-remove="handleRemove">
+                :on-error="handleUploadError" :on-success="handleUploadSuccess">
                 <el-button type="primary">涓婁紶</el-button>
                 <template #tip>
                   <!--                  鏂囦欢鏍煎紡鏀寔 doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z-->
@@ -321,20 +321,26 @@
   proxy.$modal.closeLoading();
   console.log('handleUploadSuccess');
   if (res.code === 200) {
-    // proxy.$refs["fileUpload"].handleRemove(file);
-    // fileList.value.push(res.data);
     proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+    // 灏嗕笂浼犳垚鍔熺殑鏂囦欢淇℃伅娣诲姞鍒癴ileList涓�
+    const fileInfo = {
+      name: file.name,
+      url: res.data.url || file.response?.data?.url || file.url,
+      response: file.response
+    };
+    // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鏂囦欢锛岄伩鍏嶉噸澶嶆坊鍔�
+    const existingFileIndex = fileList.value.findIndex(f => f.name === fileInfo.name);
+    if (existingFileIndex === -1) {
+      fileList.value.push(fileInfo);
+    } else {
+      fileList.value[existingFileIndex] = fileInfo;
+    }
+    // 纭繚琛ㄥ崟鏁版嵁涓殑fileList涔熸洿鏂�
+    form.value.fileList = fileList.value;
   } else {
     proxy.$modal.msgError(res.msg);
     proxy.$refs.fileUpload.handleRemove(file);
   }
-}
-// 绉婚櫎鏂囦欢
-function handleRemove(file) {
-  // let index = fileList.value.findIndex((item) => item.url === file.url);
-  // if (index > -1) {
-  //   fileList.value.splice(index, 1);
-  // }
 }
 // 鎻愪氦琛ㄥ崟
 const submitForm = () => {
@@ -367,13 +373,6 @@
     .catch(() => {
       proxy.$modal.msg("宸插彇娑�");
     });
-};
-
-// 鎵撳紑闄勪欢涓婁紶寮圭獥
-const handleDownload = (val) => {
-  fileList.value = [];
-  uploadModal.value = true;
-  currentId.value = val.id;
 };
 
 // 纭鏂囦欢涓婁紶
@@ -443,9 +442,9 @@
 const fileListRef = ref(null)
 //鏌ョ湅闄勪欢
 const downLoadFile = (row) => {
-  getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
-    fileListRef.value.open(res.salesLedgerFiles)
-  });
+	invoiceLedgerProductInfo({ id: row.id }).then((res) => {
+		fileListRef.value.open(res.data.fileList)
+	});
 }
 
 onMounted(() => {

--
Gitblit v1.9.3