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/salesManagement/receiptPaymentLedger/index.vue |  126 ++++++++++++++++++++++++++++-------------
 1 files changed, 86 insertions(+), 40 deletions(-)

diff --git a/src/views/salesManagement/receiptPaymentLedger/index.vue b/src/views/salesManagement/receiptPaymentLedger/index.vue
index 31bee75..f2b148f 100644
--- a/src/views/salesManagement/receiptPaymentLedger/index.vue
+++ b/src/views/salesManagement/receiptPaymentLedger/index.vue
@@ -16,7 +16,7 @@
         >
       </div>
     </div>
-    <div style="display: flex">
+    <div class="ledger-content">
       <div class="table_list">
         <el-table
           :data="tableData"
@@ -27,38 +27,39 @@
           :summary-method="summarizeMainTable"
           @row-click="rowClickMethod"
           height="calc(100vh - 18.5em)"
+          style="width: 100%"
         >
           <el-table-column
             align="center"
             label="搴忓彿"
             type="index"
-            width="60"
+            min-width="60"
           />
           <el-table-column
             label="瀹㈡埛鍚嶇О"
             prop="customerName"
             show-overflow-tooltip
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="鍚堝悓閲戦(鍏�)"
             prop="invoiceTotal"
             show-overflow-tooltip
             :formatter="formattedNumber"
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="鍥炴閲戦(鍏�)"
             prop="receiptPaymentAmount"
             show-overflow-tooltip
             :formatter="formattedNumber"
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="搴旀敹閲戦(鍏�)"
             prop="unReceiptPaymentAmount"
             show-overflow-tooltip
-						width="200"
+						min-width="200"
           >
             <template #default="{ row, column }">
               <el-text type="danger">
@@ -84,44 +85,45 @@
           show-summary
           :summary-method="summarizeMainTable1"
           height="calc(100vh - 18.5em)"
+          style="width: 100%"
         >
           <el-table-column
             align="center"
             label="搴忓彿"
             type="index"
-            width="60"
+            min-width="60"
           />
           <el-table-column
             label="鍙戠敓鏃ユ湡"
             prop="receiptPaymentDate"
             show-overflow-tooltip
-						width="110"
+						min-width="110"
           />
           <el-table-column
             label="閿�鍞悎鍚屽彿"
             prop="salesContractNo"
             show-overflow-tooltip
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="鍚堝悓閲戦(鍏�)"
             prop="invoiceTotal"
             show-overflow-tooltip
             :formatter="formattedNumber"
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="鍥炴閲戦(鍏�)"
             prop="receiptPaymentAmount"
             show-overflow-tooltip
             :formatter="formattedNumber"
-						width="200"
+						min-width="200"
           />
           <el-table-column
             label="搴旀敹閲戦(鍏�)"
             prop="unReceiptPaymentAmount"
             show-overflow-tooltip
-						width="200"
+						min-width="200"
           >
             <template #default="{ row, column }">
               <el-text type="danger">
@@ -130,14 +132,6 @@
             </template>
           </el-table-column>
         </el-table>
-        <pagination
-          v-show="recordTotal > 0"
-          :total="recordTotal"
-          layout="total, sizes, prev, pager, next, jumper"
-          :page="recordPage.current"
-          :limit="recordPage.size"
-          @pagination="recordPaginationChange"
-        />
       </div>
     </div>
   </div>
@@ -178,7 +172,6 @@
   getList();
 };
 const paginationChange = (obj) => {
-  console.log("paginationChange", current, limit);
   page.current = obj.page;
   page.size = obj.limit;
   getList();
@@ -197,7 +190,8 @@
   });
 };
 const formattedNumber = (row, column, cellValue) => {
-  return parseFloat(cellValue).toFixed(2);
+  const num = Number(cellValue);
+  return Number.isFinite(num) ? num.toFixed(2) : "0.00";
 };
 // 涓昏〃鍚堣鏂规硶
 const summarizeMainTable = (param) => {
@@ -212,25 +206,71 @@
 };
 // 瀛愯〃鍚堣鏂规硶
 const summarizeMainTable1 = (param) => {
-  var summarizeTable = proxy.summarizeTable(
-    param,
-    ["invoiceAmount", "receiptAmount", "unReceiptAmount"],
-    {
-      ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
-      futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+  const toNum = (v) => {
+    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;
+  };
+
+  // 浠ュ彸渚у綋鍓嶅睍绀烘暟鎹负鍑�
+  const rows = receiptRecord.value || [];
+
+  // 鍚堝悓閲戦鎸夐攢鍞悎鍚屽彿鍘婚噸
+  const invoiceByContract = new Map();
+  for (const row of rows) {
+    const contractNo = row?.salesContractNo;
+    if (!contractNo) continue;
+    if (!invoiceByContract.has(contractNo)) {
+      invoiceByContract.set(contractNo, toNum(row?.invoiceTotal));
     }
-  );
-  // 鍙栨渶鍚庝竴琛屾暟鎹�;
-  if (receiptRecord.value?.length > 0) {
-    const index = tableData.value.findIndex(
-      (item) => item.id == customerId.value
-    );
-    summarizeTable[summarizeTable.length - 1] =
-      tableData.value[index].unReceiptPaymentAmount.toFixed(2);
-  } else {
-    summarizeTable[summarizeTable.length - 1] = 0.0;
   }
-  return summarizeTable;
+  const invoiceTotal = Array.from(invoiceByContract.values()).reduce(
+    (sum, val) => sum + val,
+    0
+  );
+
+  // 鍥炴閲戦姝e父姹傚拰
+  const receiptTotal = rows.reduce(
+    (sum, row) => sum + toNum(row?.receiptPaymentAmount),
+    0
+  );
+
+  const latestRowByContract = new Map();
+  for (const row of rows) {
+    const contractNo = row?.salesContractNo;
+    if (!contractNo) continue;
+    const existed = latestRowByContract.get(contractNo);
+    const currentTime = toTime(row?.receiptPaymentDate);
+    const existedTime = toTime(existed?.receiptPaymentDate);
+    const shouldReplace =
+      !existed ||
+      currentTime > existedTime ||
+      (currentTime === existedTime && toId(row?.id) > toId(existed?.id));
+    if (shouldReplace) {
+      latestRowByContract.set(contractNo, row);
+    }
+  }
+  const unReceiptTotal = Array.from(latestRowByContract.values()).reduce(
+    (sum, row) => sum + toNum(row?.unReceiptPaymentAmount),
+    0
+  );
+
+  const columns = param?.columns || [];
+  return columns.map((column, index) => {
+    if (index === 0) return "鍚堣";
+    const prop = column?.property ?? column?.prop;
+    if (prop === "invoiceTotal") return invoiceTotal.toFixed(2);
+    if (prop === "receiptPaymentAmount") return receiptTotal.toFixed(2);
+    if (prop === "unReceiptPaymentAmount") return unReceiptTotal.toFixed(2);
+    return "";
+  });
 };
 
 const receiptPaymentList = (id) => {
@@ -271,7 +311,13 @@
 </script>
 
 <style scoped lang="scss">
+.ledger-content {
+  display: flex;
+  gap: 12px;
+}
+
 .table_list {
-  width: 50%;
+  flex: 1;
+  min-width: 0;
 }
 </style>

--
Gitblit v1.9.3