Quellcode durchsuchen

fix: 添加 excludeStatementId 以排除当前对账单在客户候选列表中的占用

xieyong vor 1 Woche
Ursprung
Commit
b0956799cf

+ 20 - 2
src/views/purchasingManage/purchaseOrder/accountstatement/components/purchaseForm.vue

@@ -273,9 +273,19 @@
     },
     props: ['dataForm', 'datasource', 'dialogType','recorpayList'],
     computed: {
+      /**
+       * 在途判定会剔除「已被其它对账单占用」的数据,修改本单时本单自身也算占用,
+       * 需要用 excludeStatementId 把它自己排除掉,否则本单的供应商在候选列表里选不到。
+       * 新增场景没有自身占用,不传。
+       */
+      excludeStatementId() {
+        return this.dialogType == 'edit' && this.dataForm && this.dataForm.id
+          ? this.dataForm.id
+          : undefined;
+      },
       // 对账池客户列表的必填参数:2 = 采购订单(采购侧对账只能选供应商)
       poolCustomerQuery() {
-        return { type: 2 };
+        return this.withExcludeStatementId({ type: 2 });
       },
       /**
        * 对账池订单列表参数:2 = 采购订单。
@@ -288,7 +298,7 @@
         if (contactId) {
           params.contactId = contactId;
         }
-        return params;
+        return this.withExcludeStatementId(params);
       },
       //计算未对账金额
       accountStatementPrice() {
@@ -602,6 +612,14 @@
       };
     },
     methods: {
+      /**
+       * 给对账池客户/订单列表的查询参数补上 excludeStatementId(修改场景专用)。
+       * 非修改场景或还没拿到本单 id 时保持参数不变,避免传 undefined 让后端判空出错。
+       */
+      withExcludeStatementId(params) {
+        const id = this.excludeStatementId;
+        return id ? { ...params, excludeStatementId: id } : params;
+      },
       /**
        * 对账池客户列表接口,作为 prop 传给供应商选择弹框当数据源。
        * Vue 2 的模板表达式只能访问实例上的属性,import 进来的模块函数必须挂到 methods,

+ 21 - 2
src/views/saleManage/saleOrder/accountstatement/components/saleForm.vue

@@ -645,9 +645,20 @@
       };
     },
     computed: {
+      /**
+       * 在途判定会剔除「已被其它对账单占用」的数据,修改本单时本单自身也算占用,
+       * 需要用 excludeStatementId 把它自己排除掉,否则本单的客户在候选列表里选不到。
+       * 新增场景没有自身占用,不传。
+       */
+      excludeStatementId() {
+        console.log(this.dialogType,'<-- excludeStatementId');
+        return this.dialogType == 'update' && this.dataForm && this.dataForm.id
+          ? this.dataForm.id
+          : undefined;
+      },
       // 对账池客户列表的必填参数:1 = 销售订单(销售侧对账只能选客户)
       poolCustomerQuery() {
-        return { type: 1 };
+        return this.withExcludeStatementId({ type: 1 });
       },
       /**
        * 对账池订单列表参数:1 = 销售订单。
@@ -660,7 +671,7 @@
         if (contactId) {
           params.contactId = contactId;
         }
-        return params;
+        return this.withExcludeStatementId(params);
       },
       // dateTypeOps() {
       //   return this.dataForm.queryDimension != 2
@@ -680,6 +691,14 @@
       }
     },
     methods: {
+      /**
+       * 给对账池客户/订单列表的查询参数补上 excludeStatementId(修改场景专用)。
+       * 非修改场景或还没拿到本单 id 时保持参数不变,避免传 undefined 让后端判空出错。
+       */
+      withExcludeStatementId(params) {
+        const id = this.excludeStatementId;
+        return id ? { ...params, excludeStatementId: id } : params;
+      },
       /**
        * 对账池客户列表 / 订单列表接口,作为 prop 传给选择弹框当数据源。
        * Vue 2 的模板表达式只能访问实例上的属性,import 进来的模块函数必须挂到 methods,