Просмотр исходного кода

发票表格组件优化:修改changeNum方法参数,增加type判断避免重复计算,修复仓库ID匹配逻辑

yusheng 9 месяцев назад
Родитель
Сommit
3ebb7998c9

+ 6 - 3
src/views/saleManage/saleOrder/invoice/components/replaceTable.vue

@@ -821,7 +821,7 @@
       },
 
       //修改数量更新合计/总重
-      changeNum(val, index) {
+      changeNum(val, index,type) {
         this.curIndex = index;
         if (this.pricingWay == 2) {
           if (val != this.form.datasource[index].orderTotalCount) {
@@ -879,7 +879,10 @@
               Number(this.form.datasource[index].singleWeight)
           );
         }
+        if(!type){
         this.tableHandleKeyUp(this.form.datasource[index], index, 'sum');
+
+        }
       },
       //计算单重
       singleWeightChange(row, index) {
@@ -948,7 +951,7 @@
             row.totalCount =
               (Number(row.blockCount) * modelLong * modeWide * modeHight) /
               1000000;
-            this.changeNum(row.totalCount, index);
+            this.changeNum(row.totalCount, index,true);
           }
         }
       },
@@ -1095,7 +1098,7 @@
           if (type == 'add') {
             data.forEach((item) => {
               const data = this.warehouseList.find(
-                (val) => val.id == item.warehouseList[0]?.warehouse_id
+                (val) => val.id == item.warehouseId
               );
               item['warehouseId'] = data.id;
               item['warehouseName'] = data.name;