Browse Source

修改工艺路线的bug

695593266@qq.com 5 months ago
parent
commit
4735326ac5
1 changed files with 51 additions and 26 deletions
  1. 51 26
      src/views/material/BOMmanage/components/routing.vue

+ 51 - 26
src/views/material/BOMmanage/components/routing.vue

@@ -383,34 +383,59 @@
           pageNum: page,
           size: limit
         });
-        if (data?.length > 0) {
-          this.tableData = data[0];
-          const isCreateBom = sessionStorage.getItem('isCreateBom');
-          if (
-            (this.attributeData.approvalStatus == 0 ||
-              this.attributeData.approvalStatus == 3) &&
-            (Object.keys(this.tableData.processRoute).length == 0 ||
-              this.tableData.processRoute.list.length == 0) &&
-            isCreateBom == '2' &&
-            !this.isWt &&
-            this.isCategory
-          ) {
-            if (this.tableData.routingIdList.length != 0) {
-              // this.selected(this.tableData.routingIdList);
-              this.getAllRouteList();
-            }
+        const record = data[0];
+        record.processRoute = record.processRoute || {};
+        record.processRoute.list = Array.isArray(record.processRoute.list)
+          ? record.processRoute.list
+          : [];
+
+        this.tableData = record;
+
+        const isCreateBom = sessionStorage.getItem('isCreateBom');
+
+        if (
+          (this.attributeData.approvalStatus == 0 ||
+            this.attributeData.approvalStatus == 3) &&
+          record.processRoute.list.length === 0 &&
+          isCreateBom == '2' &&
+          !this.isWt &&
+          this.isCategory
+        ) {
+          if (record.routingIdList && record.routingIdList.length) {
+            this.getAllRouteList();
           }
-          // console.log(this.tableData, 'tableData');
-          // console.log(data[0].processRoute.list, 'data[0].processRoute.list');
-          data[0].processRoute.list.forEach((item) => {
-            item.fileParam = item.fileParam ? item.fileParam : [];
-          });
-
-          return data[0].processRoute.list || [];
-        } else {
-          this.tableData = {};
-          return [];
         }
+
+        record.processRoute.list.forEach((item) => {
+          item.fileParam = item.fileParam || [];
+        });
+
+        return record.processRoute.list;
+        // if (data?.length > 0) {
+        //   this.tableData = data[0];
+        //   const isCreateBom = sessionStorage.getItem('isCreateBom');
+        //   if (
+        //     (this.attributeData.approvalStatus == 0 ||
+        //       this.attributeData.approvalStatus == 3) &&
+        //     (Object.keys(this.tableData.processRoute).length == 0 ||
+        //       this.tableData.processRoute.list.length == 0) &&
+        //     isCreateBom == '2' &&
+        //     !this.isWt &&
+        //     this.isCategory
+        //   ) {
+        //     if (this.tableData.routingIdList.length != 0) {
+        //       this.getAllRouteList();
+        //     }
+        //   }
+        //   data[0].processRoute.list.forEach((item) => {
+        //     item.fileParam = item.fileParam ? item.fileParam : [];
+        //   });
+
+        //   return data[0].processRoute.list || [];
+        // } else {
+        //   this.tableData = {};
+        //   return [];
+        // }
       },
 
       fileBtn(item, index) {