Przeglądaj źródła

优化生产类型选择逻辑及表单验证格式

yusheng 7 miesięcy temu
rodzic
commit
50fd0ef1ad

+ 4 - 2
src/views/saleOrder/components/order-search.vue

@@ -690,9 +690,11 @@
             delete bomMap[item.bomType];
           }
         });
-        if (arr.length > 0 && produceType) {
+        if (arr.length) {
           let obj = arr.find((el) => el.code == produceType);
-          produceType = obj ? produceType : arr[0].code;
+          produceType = obj
+            ? produceType
+            : arr.filter((el) => el.code != 1)?.[0]?.code;
         }
         if (arr.length == 0) {
           produceType = '';

+ 10 - 9
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -1133,7 +1133,7 @@
         //   this.form.endTime = new Date(data.endTime);
         // }
         this.form.productionRequirements =
-            data?.salesOrders[0]?.productionRequirements || '';
+          data?.salesOrders[0]?.productionRequirements || '';
         if (!data.bomCategoryId || data.bomCategoryId == null) {
           this.form.produceType = '';
           this.selectionRowShow = true;
@@ -1305,13 +1305,14 @@
               res.factoriesId || this.$route.query.factoriesId;
           }
 
-          // this.form.produceType =
-          //   res.produceType || this.$route.query.produceType
-          //     ? parseInt(this.$route.query.produceType)
-          //     : null;
-          this.form.produceType = this.$route.query.produceType
-            ? parseInt(this.$route.query.produceType)
-            : res.produceType;
+          this.form.produceType =
+            res.produceType ||
+            (this.$route.query.produceType
+              ? parseInt(this.$route.query.produceType)
+              : null);
+          // this.form.produceType = this.$route.query.produceType
+          // ? parseInt(this.$route.query.produceType)
+          // : res.produceType;
           console.log('this.form', this.form, res);
           this.changeProduceType('init');
           this.form.bomCategoryId =
@@ -1459,7 +1460,7 @@
         let flag = this.parameterVerification();
         // 必填参数校验
         if (!flag) return;
-        this.$refs.form.validate((valid,obj) => {
+        this.$refs.form.validate((valid, obj) => {
           if (valid) {
             if (this.form.produceType == 1) {
               this.$message.warning('请选择MBOM或者ABOM');