From 5af665569d0cc093184f99b70ac38745ef53b911 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 20:39:04 +0800
Subject: [PATCH] 新疆-融邦环保 1.油品出库表单改「多台账分摊绑定」:各台账数量之和必须等于出库吨位,产品取各台账明细交集,代储不锁行可自由增删 2.新增到货记录模块:销售台账页入口,车辆随出库单联动,到货上限=该台账分摊量,附件走永久链接 3.发货台账改层级父行:油品出库为父行,children 为到货记录,来源列区分发货单/油品出库/到货 4.开票/收款候选按「出库单×客户」拆行,bindingId 与出库单 id 分两串回传,防重复开票/收款 5.销售台账下拉补产品/规格型号 6.代储入库绑定销售订单:油品入库表单加销售订单下拉,入库台账列表加「销售订单」列 7.采购申请补齐台账字段(油库、采购合同号、提货方式、物流方式、最佳到站日期、采购类别、付款方式、预警数量、附件等) 8.修复采购申请「转订单后跳转无反应」 9.采购台账删掉「销售合同号」的搜索条件、列表列和表单字段 10.公海客户新增「信托基金(元)」,代储金额合计超限标红提示

---
 src/views/financialManagement/receivable/receipt.vue |   72 ++++++++++++++++++++++++++++++++----
 1 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/src/views/financialManagement/receivable/receipt.vue b/src/views/financialManagement/receivable/receipt.vue
index 29194e7..5e74b13 100644
--- a/src/views/financialManagement/receivable/receipt.vue
+++ b/src/views/financialManagement/receivable/receipt.vue
@@ -232,7 +232,7 @@
       <el-table ref="outboundTableRef"
                 v-loading="outboundBatchLoading"
                 :data="outboundBatchList"
-                row-key="id"
+                :row-key="getOutboundOptionValue"
                 border
                 stripe
                 max-height="480"
@@ -378,6 +378,8 @@
   const outboundSelectVisible = ref(false);
   const outboundTableRef = ref(null);
   const dialogOutboundSelection = ref([]);
+  // 鍕鹃�夎鐨勫畬鏁存槑缁嗭細鎻愪氦鏃舵寜 bindingId 鏄惁涓虹┖鎷嗘垚涓や釜 id 瀛楁
+  const selectedOutboundRows = ref([]);
 
   const getReceiptMethodLabel = value => {
     if (value === undefined || value === null || value === "") return "-";
@@ -396,6 +398,8 @@
     amount: 0,
     receiptMethod: "",
     stockOutRecordIds: [],
+    // 娌瑰搧鍑哄簱鐨勭粦瀹氳 id锛堜笌鍑哄簱鍗� id 鍒嗗紑瀛橈紝娣风敤浼氭挒鍙凤級
+    stockOutBindingIds: [],
     outboundBatches: "",
     remark: "",
     createTime: "",
@@ -538,7 +542,7 @@
         item.outboundNo ??
         item.label ??
         `鍑哄簱鍗�${index + 1}`;
-      const value = item.id ?? item.stockOutRecordId ?? label;
+      const value = getOutboundOptionValue(item) ?? label;
       const outboundAmount = Number(item.outboundAmount) || 0;
       const amountReceived = Number(item.amountReceived) || 0;
       const availableAmount = outboundAmount - amountReceived;
@@ -554,7 +558,38 @@
 
   const isSameOutboundId = (a, b) => String(a) === String(b);
 
-  const getOutboundRowId = row => row?.id ?? row?.stockOutRecordId;
+  // 涓�涓� CK 鍙峰彲鑳芥寜瀹㈡埛鎷嗘垚澶氳锛堟补鍝佸嚭搴撴寜銆屽嚭搴撳崟 脳 瀹㈡埛銆嶅嚭鍙傦級锛�
+  // 鎵�浠ヤ笉鑳界敤鍑哄簱鍗� id 褰撳敮涓�閿細鏈� bindingId 鐨勮鐢� bindingId锛屽叾浣欑敤鍑哄簱鍗� id
+  const getOutboundOptionValue = row => {
+    const bindingId = row?.bindingId;
+    if (bindingId !== undefined && bindingId !== null && bindingId !== "") {
+      return `binding-${bindingId}`;
+    }
+    const id = row?.id ?? row?.stockOutRecordId;
+    return id === undefined || id === null ? undefined : `record-${id}`;
+  };
+
+  // 涓や釜 id 绌洪棿閮芥槸灏忔暣鏁帮紝娣风潃瀛樹細鎾炲彿锛團IND_IN_SET 鍒嗕笉鍑烘潵锛夊鑷村悓涓�鎵硅揣閲嶅鏀舵锛�
+  // 鎵�浠ュ繀椤绘寜 bindingId 鏄惁涓虹┖鎷嗘垚涓や覆鍒嗗紑鍥炰紶
+  const splitOutboundIds = rows => {
+    const recordIds = [];
+    const bindingIds = [];
+    rows.forEach(row => {
+      const bindingId = row?.bindingId;
+      if (bindingId !== undefined && bindingId !== null && bindingId !== "") {
+        bindingIds.push(bindingId);
+        return;
+      }
+      const id = row?.id ?? row?.stockOutRecordId;
+      if (id !== undefined && id !== null) {
+        recordIds.push(id);
+      }
+    });
+    return { recordIds, bindingIds };
+  };
+
+  // 缂栬緫鍥炴樉鏃惰〃鍗曢噷瀛樼殑鏄甫鍓嶇紑鐨勯�夐」鍊硷紝鍥炰紶鍓嶈杩樺師鎴愯8 id
+  const stripOutboundPrefix = value => String(value).replace(/^(record|binding)-/, "");
 
   const outboundBatchDisplayText = computed(() => {
     if (isEdit.value || isView.value) {
@@ -584,7 +619,7 @@
       );
       if (exists) return;
       const fromList = outboundBatchList.value.find(row =>
-        isSameOutboundId(getOutboundRowId(row), id)
+        isSameOutboundId(getOutboundOptionValue(row), id)
       );
       if (fromList) {
         const [option] = normalizeOutboundBatchOptions([fromList]);
@@ -617,7 +652,7 @@
         (form.stockOutRecordIds || []).map(id => String(id))
       );
       outboundBatchList.value.forEach(row => {
-        const rowId = getOutboundRowId(row);
+        const rowId = getOutboundOptionValue(row);
         if (
           rowId !== undefined &&
           rowId !== null &&
@@ -635,6 +670,8 @@
       outboundBatchOptions.value = [];
       if (!keepSelected) {
         form.stockOutRecordIds = [];
+        form.stockOutBindingIds = [];
+        selectedOutboundRows.value = [];
         form.amount = 0;
       }
       return Promise.resolve();
@@ -666,6 +703,8 @@
 
   const handleCustomerChange = customerId => {
     form.stockOutRecordIds = [];
+    form.stockOutBindingIds = [];
+    selectedOutboundRows.value = [];
     form.outboundBatches = "";
     form.amount = 0;
     loadOutboundBatches(customerId);
@@ -689,12 +728,14 @@
       return;
     }
     form.stockOutRecordIds = dialogOutboundSelection.value
-      .map(row => getOutboundRowId(row))
+      .map(row => getOutboundOptionValue(row))
       .filter(id => id !== undefined && id !== null);
     form.outboundBatches = dialogOutboundSelection.value
       .map(row => row.outboundBatches ?? row.batchNo ?? row.shippingNo ?? "")
       .filter(Boolean)
       .join("銆�");
+    // 淇濈暀鏁磋锛氭彁浜ゆ椂鎵嶇煡閬撴瘡琛屾槸璧� stockOutRecordIds 杩樻槸 stockOutBindingIds
+    selectedOutboundRows.value = [...dialogOutboundSelection.value];
     outboundSelectVisible.value = false;
     syncCollectionAmount();
     formRef.value?.validateField("stockOutRecordIds");
@@ -731,6 +772,13 @@
   const buildExportParams = () => appendFilterParams({});
 
   const buildSubmitPayload = (forUpdate = false) => {
+    // 鏂伴�夌殑琛屾寜 bindingId 鎷嗘垚涓や覆锛涚紪杈戞椂閫夋嫨寮规娌¢噸寮�锛屾部鐢ㄨ褰曢噷甯﹀洖鏉ョ殑涓や覆
+    const { recordIds, bindingIds } = selectedOutboundRows.value.length
+      ? splitOutboundIds(selectedOutboundRows.value)
+      : {
+          recordIds: (form.stockOutRecordIds || []).map(stripOutboundPrefix),
+          bindingIds: (form.stockOutBindingIds || []).map(stripOutboundPrefix),
+        };
     const payload = {
       customerId: form.customerId,
       collectionDate: form.receiptDate,
@@ -738,7 +786,8 @@
       collectionMethod: form.receiptMethod,
       collectionNumber: form.receiptCode || "",
       remark: form.remark || "",
-      stockOutRecordIds: (form.stockOutRecordIds || []).join(","),
+      stockOutRecordIds: recordIds.join(","),
+      stockOutBindingIds: bindingIds.join(","),
       createTime: form.createTime,
     };
     if (forUpdate) {
@@ -748,9 +797,10 @@
   };
 
   const fillFormFromRow = row => {
+    // 甯﹀墠缂�鍥炴樉鎵嶈兘鍜屽�欓�夐�夐」鐨勫�煎涓婏紙缁戝畾琛屼笌鍑哄簱鍗曟槸涓や釜 id 绌洪棿锛�
     const stockOutRecordIds = parseStockOutRecordIds(
       row.stockOutRecordIds ?? row.stockOutRecordId
-    );
+    ).map(id => `record-${id}`);
     Object.assign(form, {
       receiptCode: row.receiptCode ?? row.collectionNumber ?? "",
       customerId: row.customerId,
@@ -758,6 +808,10 @@
       amount: Number(row.amount ?? row.collectionAmount ?? 0),
       receiptMethod: row.receiptMethod ?? row.collectionMethod ?? "",
       stockOutRecordIds,
+      // 缂栬緫鏃朵笉閲嶅紑閫夋嫨寮规锛屽師鏍峰甫鍥炲幓鎵嶈兘淇濅綇缁戝畾琛屽叧鑱�
+      stockOutBindingIds: parseStockOutRecordIds(row.stockOutBindingIds).map(
+        id => `binding-${id}`
+      ),
       outboundBatches: formatOutboundBatches(row.outboundBatches),
       remark: row.remark ?? "",
       createTime: row.createTime ?? "",
@@ -837,12 +891,14 @@
       amount: 0,
       receiptMethod: getDefaultReceiptMethod(),
       stockOutRecordIds: [],
+      stockOutBindingIds: [],
       outboundBatches: "",
       remark: "",
       createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
     });
     outboundBatchList.value = [];
     outboundBatchOptions.value = [];
+    selectedOutboundRows.value = [];
     dialogVisible.value = true;
   };
 

--
Gitblit v1.9.3