From 4b2653193a1b642553c63886acd3ead519a4ad35 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期四, 15 十月 2026 13:55:09 +0800
Subject: [PATCH] feat: 添加客户下拉兜底功能,确保客户ID回显名称
---
src/views/salesManagement/salesLedger/index.vue | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 5d21226..5da3fd9 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -1726,6 +1726,25 @@
}
);
};
+// 瀹㈡埛涓嬫媺鍏滃簳锛氳鎯�/缂栬緫鍥炴樉瀹㈡埛鍚嶇О渚濊禆 customerOption 涓� customerId 鍖归厤锛�
+// 鑻ヨ瀹㈡埛涓嶅湪涓嬫媺鍒楄〃涓紙宸插垝鍏ュ叕娴枫�侀潪鏈汉缁存姢銆佸凡琚垹闄ょ瓑锛夛紝
+// el-select 鍖归厤涓嶅埌閫夐」浼氱洿鎺ユ樉绀哄鎴稩D锛岃繖閲岃ˉ涓�鏉″崰浣嶉�夐」淇濊瘉鍥炴樉鍚嶇О銆�
+const ensureCustomerOption = () => {
+ const cid = form.value?.customerId;
+ if (cid === null || cid === undefined || cid === "") return;
+ const list = customerOption.value || [];
+ if (list.some((c) => String(c.id) === String(cid))) return;
+ customerOption.value = [
+ {
+ id: cid,
+ customerName: form.value.customerName || `瀹㈡埛${cid}`,
+ taxpayerIdentificationNumber:
+ form.value.taxpayerIdentificationNumber || "",
+ },
+ ...list,
+ ];
+};
+
// 鎵撳紑寮规
const openForm = async (type, row) => {
if (type === "edit" && row && !canEditLedger(row)) {
@@ -1738,8 +1757,9 @@
selectedQuotation.value = null;
let userLists = await userListNoPage();
userList.value = userLists.data;
- listCustomer({ current: -1, size: -1, type: 0 }).then((res) => {
- customerOption.value = res.data.records;
+ listCustomer({ current: -1, size: -1 }).then((res) => {
+ customerOption.value = res.data.records || [];
+ ensureCustomerOption();
});
form.value.entryPerson = userStore.id;
if (type === "add") {
@@ -1760,6 +1780,7 @@
fileList.value = form.value.storageBlobVOs;
// 缂栬緫鏃惰缃嚜鍔ㄧ敓鎴愪负false锛屽厑璁告墜鍔ㄤ慨鏀�
form.value.autoGenerateContractNo = false;
+ ensureCustomerOption();
});
}
// let userAll = await userStore.getInfo()
--
Gitblit v1.9.3