Sfoglia il codice sorgente

fix: 优化发票对话框产品列表初始化逻辑,增加清空数据源参数

yusheng 9 mesi fa
parent
commit
7d76946b55

+ 19 - 17
src/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue

@@ -441,7 +441,7 @@
           this.oldProductList = JSON.parse(JSON.stringify(productList));
           if (eom_saleOrder_addInvoice?.value == 1) {
             this.$refs.inventoryTableref &&
-              this.$refs.inventoryTableref.putTableValue(productList);
+              this.$refs.inventoryTableref.putTableValue(productList,true);
           } else {
             this.$refs.inventoryTableref &&
               this.$refs.inventoryTableref.$refs.productListRef.open(
@@ -519,7 +519,7 @@
             data.carNo = data.carNo ? data.carNo.split(',') : [];
             this.form = data;
             this.$refs.inventoryTableref &&
-              this.$refs.inventoryTableref.putTableValue(data.productList);
+              this.$refs.inventoryTableref.putTableValue(data.productList,true);
             this.$refs.stowageTableRef &&
               this.$refs.stowageTableRef.putTableValue(data.carList);
             this.$refs.taskInfoTableRef &&
@@ -543,6 +543,7 @@
             linkName: '',
             linkPhone: '',
             orderNo: '',
+            productList:[],
             orderId: '',
             contactId: '',
             contactName: '',
@@ -552,7 +553,7 @@
             pricingWay: ''
           });
           this.$refs.inventoryTableref &&
-            this.$refs.inventoryTableref.putTableValue([]);
+            this.$refs.inventoryTableref.putTableValue([],true);
           return;
         }
         this.searchParams = {
@@ -575,17 +576,17 @@
             linkPhone,
             orderId,
             orderNo,
-            productList,
+            // productList,
             contactId,
             contactName,
             pricingWay = data?.saleOrder?.pricingWay
           } = data;
-          if (productList && productList.length > 0) {
-            productList.forEach((v) => {
-              v.orderTotalCount = v.orderTotalCount || v.totalCount;
-              v.extField = {};
-            });
-          }
+          // if (productList && productList.length > 0) {
+          //   productList.forEach((v) => {
+          //     v.orderTotalCount = v.orderTotalCount || v.totalCount;
+          //     v.extField = {};
+          //   });
+          // }
           this.form = Object.assign({}, this.form, {
             contactId,
             contactName,
@@ -593,18 +594,19 @@
             linkPhone,
             orderNo,
             orderIds: orderId,
-            productList,
+            // productList,
             carNo: carNo ? carNo.split(',') : [],
             pricingWay,
             entrustedCode: code,
             entrustedId: id
           });
-          productList.forEach((item, index) => {
-            item.id = '';
-            item['tempId'] = index;
-          });
-          this.$refs.inventoryTableref &&
-            this.$refs.inventoryTableref.putTableValue(productList, code);
+            this.getSaleOrderDetails([orderId]);
+          // productList.forEach((item, index) => {
+          //   item.id = '';
+          //   item['tempId'] = index;
+          // });
+          // this.$refs.inventoryTableref &&
+          //   this.$refs.inventoryTableref.putTableValue(productList, code);
         });
       },
       //替代料

+ 4 - 1
src/views/saleManage/saleOrder/invoice/components/inventoryTable.vue

@@ -1270,7 +1270,10 @@
       },
 
       //修改回显
-      putTableValue(data) {
+      putTableValue(data,isInit) {
+        if(isInit){
+             this.form.datasource= []
+        }
         if (data) {
           this.setValue(data);
         }