From bb6b2def908504dee04d68b9c6b7742632787fdd Mon Sep 17 00:00:00 2001
From: WXL <wl_5969728@163.com>
Date: 星期四, 22 一月 2026 13:44:47 +0800
Subject: [PATCH] 报销单附件删除问题维护

---
 src/views/project/travelexpenseapply/travelexpensedetail/index.vue |   74 ++++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 18 deletions(-)

diff --git a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
index f24c82e..204af08 100644
--- a/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
+++ b/src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -1220,12 +1220,16 @@
               <el-image
                 style="width: 95%; height: 90%"
                 :src="invoicepdfimg"
-                :preview-src-list="invoicepdfimgsrcList"
+                @click="invoicehandleImageClick(initialIndex)"
               >
-                <!-- <div slot="error" class="image-slot">
-              <i class="el-icon-picture-outline"></i>
-            </div> -->
               </el-image>
+              <custom-image-viewer
+                :url-list="invoicepdfimgsrcList"
+                :initial-index="invoicecurrentIndex"
+                :visible="invoiceviewerVisible"
+                @update:visible="invoiceviewerVisible = $event"
+                @close="invoicehandleViewerClose"
+              />
             </div>
             <div v-else class="pdfimgmins">{{ hintitle }}</div>
           </div>
@@ -1460,8 +1464,11 @@
       invoicepdfimg: "",
       invoicepdfimgsrcList: [],
       currentIndex: 0, // 鍒濆绱㈠紩
+      invoicecurrentIndex: 0, // 鍒濆绱㈠紩
       initialIndex: 0, // 鍒濆绱㈠紩
       viewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
+      invoiceviewerVisible: false, // 鎺у埗棰勮缁勪欢鏄剧ず
+
       //浜哄憳绫诲埆
       persontype: null,
       //鍒拌揪鍦�
@@ -1615,8 +1622,15 @@
       this.currentIndex = index;
       this.viewerVisible = true;
     },
+    invoicehandleImageClick(index) {
+      this.invoicecurrentIndex = index;
+      this.invoiceviewerVisible = true;
+    },
     handleViewerClose() {
       this.viewerVisible = false;
+    },
+    invoicehandleViewerClose() {
+      this.invoiceviewerVisible = false;
     },
     handleImageError() {
       console.error("鍥剧墖鍔犺浇澶辫触");
@@ -1891,13 +1905,27 @@
         const index = this.getIndexInArray(this.fileListto, row);
         this.fileListto.splice(index, 1);
         console.log(this.rbDetails[this.atpresent].annexfilesList);
-        indexvalue = this.rbDetails[this.atpresent].annexfilesList.find(
-          (item, index) => {
-            return item.name == row.name;
-          }
-        );
-        console.log(indexvalue, "鍒犻櫎绱㈠紩");
-        this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
+        // indexvalue = this.rbDetails[this.atpresent].annexfilesList.find(
+        //   (item, index) => {
+        //     return item.name == row.name;
+        //   }
+        // );
+        // console.log(indexvalue, "鍒犻櫎绱㈠紩");
+        // this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
+        const targetIndex = this.rbDetails[
+          this.atpresent
+        ].annexfilesList.findIndex(item => {
+          return item.name === row.name; // 寤鸿浣跨敤涓ユ牸鐩哥瓑 ===
+        });
+        console.log(targetIndex, "鍒犻櫎绱㈠紩"); // 鐜板湪鎵撳嵃鐨勬槸绱㈠紩鍙凤紝渚嬪 0, 1, 2...
+
+        if (targetIndex > -1) {
+          // 纭繚鎵惧埌浜嗗厓绱�
+          this.rbDetails[this.atpresent].annexfilesList.splice(targetIndex, 1);
+          console.log("鍒犻櫎鎴愬姛");
+        } else {
+          console.log("鏈壘鍒板搴旈」鐩紝鏃犳硶鍒犻櫎");
+        }
       } else {
         const indexlist = this.getIndexInArray(
           this.invoicepdfimgsrcList,
@@ -1907,13 +1935,23 @@
         const index = this.getIndexInArray(this.invoicefileListto, row);
         this.invoicefileListto.splice(index, 1);
         console.log(this.rbDetails[this.atpresent].invoicefilesList);
-        indexvalue = this.rbDetails[this.atpresent].invoicefilesList.find(
-          (item, index) => {
-            return item.name == row.name;
-          }
-        );
-        console.log(indexvalue, "鍒犻櫎绱㈠紩");
-        this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
+        const targetIndex = this.rbDetails[
+          this.atpresent
+        ].invoicefilesList.findIndex(item => {
+          return item.name === row.name; // 寤鸿浣跨敤涓ユ牸鐩哥瓑 ===
+        });
+        console.log(targetIndex, "鍒犻櫎绱㈠紩"); // 鐜板湪鎵撳嵃鐨勬槸绱㈠紩鍙凤紝渚嬪 0, 1, 2...
+
+        if (targetIndex > -1) {
+          // 纭繚鎵惧埌浜嗗厓绱�
+          this.rbDetails[this.atpresent].invoicefilesList.splice(
+            targetIndex,
+            1
+          );
+          console.log("鍒犻櫎鎴愬姛");
+        } else {
+          console.log("鏈壘鍒板搴旈」鐩紝鏃犳硶鍒犻櫎");
+        }
       }
     },
     // 鐐瑰嚮涓婄Щ

--
Gitblit v1.9.3