| | |
| | | } |
| | | ); |
| | | }; |
| | | // 客户下拉兜底:详情/编辑回显客户名称依赖 customerOption 与 customerId 匹配, |
| | | // 若该客户不在下拉列表中(已划入公海、非本人维护、已被删除等), |
| | | // el-select 匹配不到选项会直接显示客户ID,这里补一条占位选项保证回显名称。 |
| | | 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)) { |
| | |
| | | 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") { |
| | |
| | | fileList.value = form.value.storageBlobVOs; |
| | | // 编辑时设置自动生成为false,允许手动修改 |
| | | form.value.autoGenerateContractNo = false; |
| | | ensureCustomerOption(); |
| | | }); |
| | | } |
| | | // let userAll = await userStore.getInfo() |