yuan
3 天以前 4b2653193a1b642553c63886acd3ead519a4ad35
feat: 添加客户下拉兜底功能,确保客户ID回显名称
已修改1个文件
25 ■■■■■ 文件已修改
src/views/salesManagement/salesLedger/index.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue
@@ -1726,6 +1726,25 @@
    }
  );
};
// 客户下拉兜底:详情/编辑回显客户名称依赖 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)) {
@@ -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()