Explorar o código

修改BOM和工艺路线更新逻辑

yusheng hai 7 meses
pai
achega
35e448a466
Modificáronse 1 ficheiros con 18 adicións e 13 borrados
  1. 18 13
      src/views/productionPlan/components/factoryAdd/index.vue

+ 18 - 13
src/views/productionPlan/components/factoryAdd/index.vue

@@ -1266,7 +1266,7 @@
       },
 
       // 选择BOM
-      async changeBomId(row, index, bomData) {
+      async changeBomId(row, index, bomData, typeChange) {
         if (bomData) {
           row.bomCategoryName = bomData.name;
           row.bomCategoryVersions = bomData.versions;
@@ -1280,11 +1280,16 @@
             row.produceVersionName = arr[0].version;
             row.produceRoutingId = arr[0].id;
             row.routingList = arr;
-            this.$set(row, 'produceRoutingId', arr[0].id);
-            this.$set(row, 'produceRoutingId', arr[0].id);
+            if (typeChange) {
+              this.$set(this.form.productInfoList[index], 'routingList', arr);
+              this.$set(this.form.productInfoList[index], 'produceRoutingId', arr[0].id);
+            } else {
+              this.$set(row, 'produceRoutingId', arr[0].id);
+              this.$set(row, 'routingList', arr);
+            }
 
             row.selectionRowShow = false;
-            this.$set(row, 'routingList', arr);
+            console.log(row.routingList, 'this.form.productInfoList');
             // });
           }
           this.$forceUpdate();
@@ -1298,14 +1303,14 @@
       },
       // 清空BOM 跟工艺路线
       wipeData(index) {
-        let row = this.form.productInfoList[index];
-        row.bomCategoryId = '';
-        row.routingList = [];
-        row.bomVersionList = [];
-        row.produceRoutingId = '';
-        row.produceRoutingName = '';
-        row.produceVersionName = '';
-        row.selectionRowShow = false;
+        this.$set(this.form.productInfoList[index], 'bomCategoryId', '');
+        this.$set(this.form.productInfoList[index], 'routingList', []);
+        this.$set(this.form.productInfoList[index], 'bomVersionList', []);
+        this.$set(this.form.productInfoList[index], 'produceRoutingId', '');
+        this.$set(this.form.productInfoList[index], 'produceRoutingName', '');
+        this.$set(this.form.productInfoList[index], 'produceVersionName', '');
+        this.$set(this.form.productInfoList[index], 'selectionRowShow', false);
+
         // this.selectionRowShow = false;
       },
 
@@ -1326,7 +1331,7 @@
               row.bomVersionList = arr;
               this.form.productInfoList[index].bomVersionList = arr;
               row.bomCategoryId = arr[0].id;
-              this.changeBomId(row, index, arr[0]);
+              this.changeBomId(row, index, arr[0], 'typeChange');
               let arrAll = JSON.parse(JSON.stringify(this.form));
               this.$set(this, 'form', arrAll);
             }