From bfaaa299a0aebd4ccc488cbe5a67e7d73304fb2c Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 24 四月 2026 15:56:03 +0800
Subject: [PATCH] fix: 图片预览路径替换为link

---
 src/views/procurementManagement/paymentLedger/index.vue |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/src/views/procurementManagement/paymentLedger/index.vue b/src/views/procurementManagement/paymentLedger/index.vue
index 5b5ba9c..e707d08 100644
--- a/src/views/procurementManagement/paymentLedger/index.vue
+++ b/src/views/procurementManagement/paymentLedger/index.vue
@@ -195,6 +195,14 @@
     const n = Number(v);
     return Number.isFinite(n) ? n : 0;
   };
+  const toTime = (v) => {
+    const t = new Date(v).getTime();
+    return Number.isFinite(t) ? t : -Infinity;
+  };
+  const toId = (v) => {
+    const n = Number(v);
+    return Number.isFinite(n) ? n : -Infinity;
+  };
 
   // 浠ュ綋鍓嶅彸渚ц〃鏍煎睍绀虹殑鏁版嵁涓哄噯锛堝垎椤� slice 鍚庣殑鏁版嵁锛�
   const rows = originalTableDataSon.value || [];
@@ -214,7 +222,25 @@
   );
 
   const paymentTotal = rows.reduce((sum, r) => sum + toNum(r?.paymentAmount), 0);
-  const payableTotal = rows.reduce((sum, r) => sum + toNum(r?.payableAmount), 0);
+  const latestRowByContract = new Map();
+  for (const r of rows) {
+    const contractNo = r?.purchaseContractNumber;
+    if (!contractNo) continue;
+    const existed = latestRowByContract.get(contractNo);
+    const currentTime = toTime(r?.paymentDate);
+    const existedTime = toTime(existed?.paymentDate);
+    const shouldReplace =
+      !existed ||
+      currentTime > existedTime ||
+      (currentTime === existedTime && toId(r?.id) > toId(existed?.id));
+    if (shouldReplace) {
+      latestRowByContract.set(contractNo, r);
+    }
+  }
+  const payableTotal = Array.from(latestRowByContract.values()).reduce(
+    (sum, r) => sum + toNum(r?.payableAmount),
+    0
+  );
 
   const columns = param?.columns || [];
   const summary = columns.map((col, idx) => {

--
Gitblit v1.9.3