ソースを参照

添加物料清单为空校验逻辑并优化分批时间设置方法参数

yusheng 8 ヶ月 前
コミット
01959e6f97

+ 11 - 3
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -1238,7 +1238,8 @@
               this.$message.info('请添加销售订单');
               return false;
             }
-            let _arr2 = [];
+            let _arr2 = [],
+              isNoMaterial = [];
 
             _arr2 = _arr.map((m) => {
               if (
@@ -1251,12 +1252,19 @@
                 delete m.id;
                 delete m.code;
               }
-
+              if (!m.materialList.length) {
+                isNoMaterial.push(m.productName);
+              }
               return {
                 ...m
               };
             });
-
+            if (isNoMaterial.length) {
+              this.$message.info(
+                isNoMaterial.join(',') + ' 物料清单为空,请检查!'
+              );
+              return;
+            }
             this.formData['type'] = 1;
             this.formData['salesOrderList'] = _arr2;
             this.formData.baitingType = 2;

+ 7 - 2
src/views/materialPlan/components/produce-edit-dialog.vue

@@ -485,7 +485,7 @@
               return false;
             }
 
-            let _arr2 = [];
+            let _arr2 = [],isNoMaterial = [];
 
             _arr2 = _arr.map((m) => {
               if (
@@ -510,7 +510,12 @@
               };
             });
 
-            console.log(_arr2);
+            if (isNoMaterial.length) {
+              this.$message.info(
+                isNoMaterial.join(',') + ' 物料清单为空,请检查!'
+              );
+              return;
+            }
 
             this.formData['type'] = 2;
             this.formData['workOrderList'] = _arr2;

+ 15 - 7
src/views/materialPlan/components/producePlan.vue

@@ -448,7 +448,7 @@
             <el-option
               label="分批到货"
               :value="2"
-              @click.native="handleMethod()"
+              @click.native="handleMethod(null, null, true)"
             />
           </el-select>
         </el-form-item>
@@ -471,7 +471,7 @@
             type="primary"
             :underline="false"
             v-show="formData2.deliveryMethod == 2"
-            @click.native="handleMethod()"
+            @click.native="handleMethod(null, null, true)"
           >
             设置分批时间
           </el-link>
@@ -986,7 +986,7 @@
           planIds: planIds,
           demandType: this.formData.demandType
         });
-        
+
         if (this.$store.state.user.info.clientEnvironmentId == '5') {
           if (res && res.length > 0) {
             const firstOrderName = res[0].productName || '';
@@ -1180,12 +1180,12 @@
         };
         this.batchVisible = true;
       },
-      handleMethod(row, index) {
+      handleMethod(row, index, isAll) {
         console.log(index, 'index');
         if (row) {
           this.multipleSelection = [];
         }
-        this.$refs.timeDialogRef.open(row || {}, index);
+        this.$refs.timeDialogRef.open(row || {}, index, isAll);
       },
       chooseTime(current, timeList, currentIndex) {
         const tableList = this.$refs.table.getData();
@@ -1277,6 +1277,7 @@
             }
 
             let _arr2 = [];
+            let isNoMaterial = [];
 
             _arr2 = _arr.map((m) => {
               if (
@@ -1289,12 +1290,19 @@
                 delete m.id;
                 delete m.code;
               }
-
+              if (!m.materialList.length) {
+                isNoMaterial.push(m.productName);
+              }
               return {
                 ...m
               };
             });
-
+            if (isNoMaterial.length) {
+              this.$message.info(
+                isNoMaterial.join(',') + ' 物料清单为空,请检查!'
+              );
+              return;
+            }
             this.formData['type'] = 1;
             this.formData['salesOrderList'] = _arr2;
             this.formData.baitingType = 2;