From 45d4fe24016c03fcccbe7c9798533ca97e2e7aea Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 03 十二月 2026 16:59:34 +0800
Subject: [PATCH] 回款新增和修改问题

---
 src/views/project/fund/applyDetail/index.vue |  173 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 142 insertions(+), 31 deletions(-)

diff --git a/src/views/project/fund/applyDetail/index.vue b/src/views/project/fund/applyDetail/index.vue
index f3fa626..62dc708 100644
--- a/src/views/project/fund/applyDetail/index.vue
+++ b/src/views/project/fund/applyDetail/index.vue
@@ -304,7 +304,7 @@
                 <i class="el-icon-warning-outline" />
                 褰撳墠涓烘煡鐪嬫ā寮忥紝涓嶈兘涓婁紶闄勪欢
               </div>
-              <el-table ref="annexTable" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400">
+              <el-table ref="annexTable" :data="fileListto" :row-class-name="annexRowClass" @row-click="previewInline" @row-dblclick="downFile" style="width: 100%" height="400">
                 <el-table-column prop="name" :show-overflow-tooltip="true" label="鍚嶇О">
                   <template slot-scope="scope">
                     <i style="color:#409EFF" class=" el-icon-s-order" />{{
@@ -616,7 +616,7 @@
                 <i class="el-icon-warning-outline" />
                 褰撳墠涓烘煡鐪嬫ā寮忥紝涓嶈兘涓婁紶闄勪欢
               </div>
-                <el-table ref="annexTable2" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400">
+                <el-table ref="annexTable2" :data="fileListto" :row-class-name="annexRowClass" @row-click="previewInline" @row-dblclick="downFile" style="width: 100%" height="400">
                   <el-table-column prop="name" :show-overflow-tooltip="true" label="鍚嶇О">
                     <template slot-scope="scope">
                       <i style="color:#409EFF" class=" el-icon-s-order" />
@@ -664,7 +664,7 @@
                 <i class="el-icon-warning-outline" />
                 褰撳墠涓烘煡鐪嬫ā寮忥紝涓嶈兘涓婁紶闄勪欢
               </div>
-                <el-table ref="invoiceTable" :data="invoicefileListto" :row-class-name="invoiceRowClass" @row-click="downFile" style="width: 100%" height="400">
+                <el-table ref="invoiceTable" :data="invoicefileListto" :row-class-name="invoiceRowClass" @row-click="previewInline" @row-dblclick="downFile" style="width: 100%" height="400">
                   <el-table-column prop="name" :show-overflow-tooltip="true" label="鍚嶇О">
                     <template slot-scope="scope">
                       <i style="color:#409EFF" class=" el-icon-s-order" />
@@ -1144,6 +1144,7 @@
       flashInvoiceName: "",
       invoicepdfimg: "",
       invoicepdfimgsrcList: [],
+      previewToken: 0,
       invoDatatop: [],
       activeName: "invoice", //鏂囦欢绫诲瀷锛氶粯璁ゅ彂绁ㄦ枃浠�
       //涓婁紶闄勪欢璺緞
@@ -2521,6 +2522,10 @@
 
             addorupdateFund(this.form).then(response => {
               if (response.code === 200) {
+                // 2026-11-23锛氬悗绔墧闄や簡鏃犳晥锛坆lob:/data:锛夐檮浠跺湴鍧�鏃剁粰鍑烘彁绀�
+                if (response.attachWarn) {
+                  this.$modal.msgWarning(response.attachWarn);
+                }
                 this.$modal.msgSuccess("鐢宠鍗曚繚瀛樻垚鍔燂紒");
                 // 闈炴彁閱掔姸鎬佷笅鎵ц瀹℃壒瑙e喅寮傛璋冪敤寤惰繜闂
                 if (!this.Savereminder) {
@@ -2803,6 +2808,9 @@
       } else {
         this.rbDetails.splice(rowIndex + 1, 0, rowData);
       }
+      // 2026-11-30锛氭柊澧炶鍚庢妸褰撳墠鎿嶄綔琛屽垏鍒版柊琛岋紝骞舵竻绌轰笂涓�娆$殑棰勮鎬�
+      this.atpresent = this.rbDetails.indexOf(rowData);
+      this.resetPreviewState();
       this.Reminderquantity++;
       this.totalquantity++;
       for (let i = 0; i < this.rbDetails.length; i++) {
@@ -3072,13 +3080,33 @@
     },
 
     remove(file, fileList) {
-      const rbDetails = [...this.rbDetails];
+      // 2026-11-23锛氫笉鍐嶇敤"棰勮鐢ㄤ复鏃跺垪琛�"(blob: URL) 鏁磋〃瑕嗙洊闄勪欢瀛楁锛�
+      // 鏀逛负鎸夋枃浠跺悕绮剧‘鍒犻櫎锛岄伩鍏� blob: 鍦板潃琚繚瀛樿繘 annexfiles / invoicefiles銆�
+      const name =
+        (file && (file.name || (file.raw && file.raw.name))) || "";
+      if (!this.rbDetails[this.atpresent]) {
+        return;
+      }
       if (this.activeName == "common") {
-        this.fileListto.splice(this.fileListto.indexOf(file), 1);
-        rbDetails[this.atpresent].annexfilesList = this.fileListto;
+        this.spliceByName(this.fileListto, name);
+        this.spliceByName(this.rbDetails[this.atpresent].annexfilesList, name);
       } else {
-        this.invoicefileListto.splice(this.invoicefileListto.indexOf(file), 1);
-        rbDetails[this.atpresent].invoicefilesList = this.invoicefileListto;
+        this.spliceByName(this.invoicefileListto, name);
+        this.spliceByName(
+          this.rbDetails[this.atpresent].invoicefilesList,
+          name
+        );
+      }
+    },
+
+    /** 鎸夋枃浠跺悕浠庡垪琛ㄤ腑鍒犻櫎涓�椤癸紙鎵句笉鍒板垯涓嶅仛浠讳綍浜嬶級 */
+    spliceByName(list, name) {
+      if (!list || !name) {
+        return;
+      }
+      const idx = list.findIndex(item => item && item.name === name);
+      if (idx > -1) {
+        list.splice(idx, 1);
       }
     },
 
@@ -3150,9 +3178,11 @@
             type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
           };
           this.pdfimgsrcList.push(localUrl);
+          // 2026-11-23锛歶rl 瀛樻湇鍔$璺緞锛堟潈濞佸�硷級锛宲reviewUrl 鍙敤浜庢湰鍦伴瑙�
           this.fileListto.push({
             name: file.name,
-            url: localUrl
+            url: response.fileName,
+            previewUrl: localUrl
           });
 
           this.$modal.msgSuccess(response.msg);
@@ -3185,9 +3215,11 @@
             type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
           };
           this.invoicepdfimgsrcList.push(localUrl);
+          // 2026-11-23锛歶rl 瀛樻湇鍔$璺緞锛堟潈濞佸�硷級锛宲reviewUrl 鍙敤浜庢湰鍦伴瑙�
           this.invoicefileListto.push({
             name: file.name,
-            url: localUrl
+            url: response.fileName,
+            previewUrl: localUrl
           });
 
           this.$modal.msgSuccess(response.msg);
@@ -3211,18 +3243,33 @@
     },
 
     // 鐐瑰嚮绁ㄦ嵁
+    /**
+     * 2026-11-30锛氭竻绌虹エ鎹脊绐楃殑棰勮鐘舵�併��
+     * 鍘熷疄鐜版紡娓� embeddedFile / invoiceEmbeddedFile锛屽鑷村啀娆℃墦寮�寮圭獥鏃�
+     * 棰勮缁勪欢浠嶆樉绀轰笂涓�娆¢�夋嫨鐨勫彂绁ㄥ浘鐗囥��
+     */
+    resetPreviewState() {
+      this.fileListto = [];
+      this.invoicefileListto = [];
+      this.pdfimg = "";
+      this.invoicepdfimg = "";
+      this.pdfimgsrcList = [];
+      this.invoicepdfimgsrcList = [];
+      this.embeddedFile = null;
+      this.invoiceEmbeddedFile = null;
+      this.pdftitle = "";
+      // 閫掑浠ょ墝锛氳涓婁竴琛屽皻鏈繑鍥炵殑 fetch 缁撴灉澶辨晥锛岄伩鍏嶅紓姝ュ洖鍐欒鐩�
+      this.previewToken = (this.previewToken || 0) + 1;
+    },
+
     Filepopup(index, rows, row) {
       const config = {
         headers: { Authorization: "Bearer " + this.ICDtoken }
       };
 
       this.tableDatatop = [];
-      this.fileListto = [];
-      this.invoicefileListto = [];
-      this.pdfimg = "";
-      this.invoicepdfimg = [];
-      this.pdfimgsrcList = [];
-      this.invoicepdfimgsrcList = [];
+      this.resetPreviewState();
+      const previewToken = ++this.previewToken;
       this.tableDatatop.push(row);
       this.atpresent = index;
       this.pdfVisible = true;
@@ -3257,7 +3304,9 @@
               .then(blob => {
                 return {
                   name: value.name,
-                  url: URL.createObjectURL(blob)
+                  // 2026-11-23锛氭潈濞佸湴鍧�浠嶆槸鏈嶅姟绔矾寰勶紝blob 鍙斁 previewUrl
+                  url: value.url,
+                  previewUrl: URL.createObjectURL(blob)
                 };
               })
               .catch(error => {
@@ -3268,10 +3317,16 @@
         );
 
         Promise.all(fetchPromises).then(fileListto => {
+          // 2026-11-30锛氬垏鎹㈣鍚庢棫璇锋眰杩斿洖锛屼涪寮冭繃鏈熺粨鏋滐紝閬垮厤瑕嗙洊褰撳墠琛岄瑙�
+          if (previewToken !== this.previewToken) {
+            return;
+          }
+
           this.fileListto = fileListto.filter(item => item !== null);
-          this.pdfimg = this.fileListto[0].url;
+          this.pdfimg =
+            this.fileListto.length > 0 ? this.fileListto[0].previewUrl : "";
           console.log(this.pdfimg, "pdfimg");
-          this.pdfimgsrcList = this.fileListto.map(item => item.url);
+          this.pdfimgsrcList = this.fileListto.map(item => item.previewUrl);
         });
 
         this.previewpdf = true;
@@ -3290,7 +3345,9 @@
               .then(blob => {
                 return {
                   name: value.name,
-                  url: URL.createObjectURL(blob)
+                  // 2026-11-23锛氭潈濞佸湴鍧�浠嶆槸鏈嶅姟绔矾寰勶紝blob 鍙斁 previewUrl
+                  url: value.url,
+                  previewUrl: URL.createObjectURL(blob)
                 };
               })
               .catch(error => {
@@ -3301,13 +3358,21 @@
         );
 
         Promise.all(fetchPromises).then(invoicefileListto => {
+          // 2026-11-30锛氬垏鎹㈣鍚庢棫璇锋眰杩斿洖锛屼涪寮冭繃鏈熺粨鏋滐紝閬垮厤瑕嗙洊褰撳墠琛岄瑙�
+          if (previewToken !== this.previewToken) {
+            return;
+          }
+
           this.invoicefileListto = invoicefileListto.filter(
             item => item !== null
           );
-          this.invoicepdfimg = this.invoicefileListto[0].url;
+          this.invoicepdfimg =
+            this.invoicefileListto.length > 0
+              ? this.invoicefileListto[0].previewUrl
+              : "";
           console.log(this.invoicepdfimg, "invoicepdfimg");
           this.invoicepdfimgsrcList = this.invoicefileListto.map(
-            item => item.url
+            item => item.previewUrl
           );
         });
 
@@ -3328,13 +3393,42 @@
     },
 
     // 璐圭敤鎶ラ攢锛氶檮浠剁粺涓�浣跨敤鐙珛 FilePreview锛堝綍鍏ャ�佸鎵广�佽鎯呬竴鑷达級
+    /**
+     * 2026-11-30锛氬崟鍑诲垪琛ㄩ」 鈫� 鍦ㄦ湰椤甸瑙堬紙鍙充晶 preview-pane锛夈��
+     * 鍙屽嚮鎵嶆墦寮�鐙珛鐨勯瑙堥〉闈紙downFile 鈫� $previewFile锛夈��
+     */
+    previewInline(row) {
+      if (!row) {
+        return;
+      }
+      const url = row.previewUrl || row.url;
+      if (!url) {
+        return;
+      }
+      const file = {
+        name: row.name || "",
+        url,
+        type: /\.pdf$/i.test(row.name || "") ? "pdf" : "image"
+      };
+      if (this.activeName == "common") {
+        this.embeddedFile = file;
+      } else {
+        this.invoiceEmbeddedFile = file;
+      }
+    },
+
     downFile(item) {
       const source =
         this.activeName == "common" ? this.fileListto : this.invoicefileListto;
-      let list = (source || []).map(f => ({ name: f.name, url: f.url }));
-      let index = list.findIndex(f => f.url === item.url);
-      if (index < 0 && item && item.url) {
-        list = [{ name: item.name, url: item.url }];
+      // 2026-11-23锛氶瑙堜紭鍏堢敤鏈湴 blob锛坧reviewUrl锛夛紝娌℃湁鍒欓��鍥炴湇鍔$璺緞
+      let list = (source || []).map(f => ({
+        name: f.name,
+        url: f.previewUrl || f.url
+      }));
+      const target = item && (item.previewUrl || item.url);
+      let index = list.findIndex(f => f.url === target);
+      if (index < 0 && target) {
+        list = [{ name: item.name, url: target }];
         index = 0;
       }
       this.$previewFile(list, index > -1 ? index : 0);
@@ -3355,7 +3449,10 @@
       console.log(row);
       let indexvalue = "";
       if (this.activeName == "common") {
-        const indexlist = this.getIndexInArray(this.pdfimgsrcList, row.url);
+        const indexlist = this.getIndexInArray(
+          this.pdfimgsrcList,
+          row.previewUrl || row.url
+        );
         this.pdfimgsrcList.splice(indexlist, 1);
         const index = this.getIndexInArray(this.fileListto, row);
         this.fileListto.splice(index, 1);
@@ -3364,11 +3461,13 @@
           item => item.name == row.name
         );
         console.log(indexvalue, "鍒犻櫎绱㈠紩");
-        this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
+        if (indexvalue > -1) {
+          this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
+        }
       } else {
         const indexlist = this.getIndexInArray(
           this.invoicepdfimgsrcList,
-          row.url
+          row.previewUrl || row.url
         );
         this.invoicepdfimgsrcList.splice(indexlist, 1);
         const index = this.getIndexInArray(this.invoicefileListto, row);
@@ -3378,7 +3477,9 @@
           item => item.name == row.name
         );
         console.log(indexvalue, "鍒犻櫎绱㈠紩");
-        this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
+        if (indexvalue > -1) {
+          this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
+        }
       }
     },
     // 鐐瑰嚮涓婄Щ
@@ -3431,7 +3532,17 @@
       // console.log(this.rbDetails[this.atpresent].invoicefilesList,'invoicefilesList');
     },
     Downloadfile(row) {
-      window.location.href = row.url;
+      // 2026-11-23锛氫紭鍏堢敤鏈湴 blob 涓嬭浇锛涙病鏈夊垯鎷兼湇鍔$鍦板潃
+      const target = (row && (row.previewUrl || row.url)) || "";
+      if (!target) {
+        return;
+      }
+      if (/^(blob:|data:|https?:)/i.test(target)) {
+        window.location.href = target;
+      } else {
+        window.location.href =
+          this.Networkheader + process.env.VUE_APP_BASE_API + target;
+      }
     },
 
     //涓撳/鍖荤枟鏈烘瀯/璐圭敤鎶ラ攢鏈烘瀯閫夋嫨

--
Gitblit v1.9.3