Explorar el Código

优化销售订单BOM版本过滤逻辑,增强批次号校验及搜索功能

yusheng hace 8 meses
padre
commit
fcb310eba5

+ 3 - 1
src/views/saleOrder/components/create-order.vue

@@ -884,10 +884,12 @@
                 );
               }
               item.lackNum = null;
+              if(item.bomVersionList?.length&&item.productType){
+                  item.bomVersionList=item.bomVersionList.filter(el=>el.bomType==item.productType)
+              }
             });
           }
           // this.disabledList = res.productInfoList;
-
           if (res.productInfoList.length > 0) {
             const promiselist = [];
             res.productInfoList.forEach(async (el, index) => {

+ 40 - 27
src/views/saleOrder/salesToProductionNewTwo.vue

@@ -142,16 +142,6 @@
               ></el-input>
             </el-form-item>
           </el-col>
-
-          <!-- <el-col v-bind="styleResponsive ? { lg: 3, md: 6 } : { span: 3 }">
-              <el-form-item label="使用改型:" prop="modification">
-                <el-checkbox
-                  v-model="form.modification"
-                  :true-label="1"
-                  :false-label="0"
-                ></el-checkbox>
-              </el-form-item>
-            </el-col> -->
         </el-row>
         <el-row :gutter="24">
           <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
@@ -430,16 +420,27 @@
             prop="batchNo"
           >
             <template slot-scope="scope">
-              <el-input
-                v-model="scope.row.batchNo"
-                size="small"
-                style="width: 100%"
-                placeholder="批次号"
-                @input="
-                  (value) =>
-                    (scope.row.batchNo = value.replace(/[^a-zA-Z0-9_-]/g, ''))
-                "
-              ></el-input>
+              <el-form-item
+                label-width="0px"
+                :prop="'salesOrders.' + scope.$index + '.batchNo'"
+                :rules="{
+                  required: isSalesToProduction_batchNo,
+                  message: '请输入批次号',
+                  trigger: 'blur'
+                }"
+                class="table-item"
+              >
+                <el-input
+                  v-model="scope.row.batchNo"
+                  size="small"
+                  style="width: 100%"
+                  placeholder="批次号"
+                  @input="
+                    (value) =>
+                      (scope.row.batchNo = value.replace(/[^a-zA-Z0-9_-]/g, ''))
+                  "
+                ></el-input>
+              </el-form-item>
             </template>
           </el-table-column>
           <el-table-column
@@ -931,7 +932,8 @@
         validDate,
         modelList: [], // 机型数据
         colorList: [], // 颜色数据
-        isReview: false
+        isReview: false,
+        isSalesToProduction_batchNo: false
       };
     },
     props: {
@@ -977,6 +979,11 @@
       this.mandatoryField();
       this.getCodeData();
       this.getplannedReleaseRequire('planned_release_require');
+      parameterGetByCode({ code: 'salesToProduction_batchNo' }).then((res) => {
+        if (res) {
+          this.isSalesToProduction_batchNo = res.value == '1' ? true : false;
+        }
+      });
     },
     computed: {
       clientEnvironmentId() {
@@ -1436,11 +1443,22 @@
         let flag = this.parameterVerification();
         // 必填参数校验
         if (!flag) return;
-        this.$refs.form.validate((valid) => {
+        this.$refs.form.validate((valid,obj) => {
           if (valid) {
+            if (this.form.produceType == 1) {
+              this.$message.warning('请选择MBOM或者ABOM');
+              return;
+            }
             this.mapList();
 
             this.$refs.submitRefs.open();
+          } else {
+            if (obj) {
+              let messages = Object.keys(obj).map((key) => obj[key][0]);
+              if (messages.length > 0) {
+                this.$message.warning(messages[0].message);
+              }
+            }
           }
         });
       },
@@ -1726,11 +1744,6 @@
       },
 
       async publishData(type) {
-        if (!this.form.batchNo && this.clientEnvironmentId == 5) {
-          this.$message.warning('批次号不能为空');
-          return;
-        }
-
         const key = getRouteTabKey();
         let params = deepClone(this.form);
         params.categoryId = params.salesOrders[0]?.categoryId;

+ 3 - 3
src/views/workOrder/components/order-search.vue

@@ -136,8 +136,8 @@
           <el-input
             size="mini"
             clearable
-            v-model="where.searchInfo"
-            placeholder="批次号/生产工单号/计划编号/产品编码/产品名称/牌号/型号"
+            v-model="where.keyWord"
+            placeholder="批次号/生产工单号/产品名称"
           />
         </el-form-item>
       </el-col>
@@ -166,7 +166,7 @@
                     <el-input
                       size="mini"
                       clearable
-                      v-model="where.keyWord"
+                      v-model="where.searchInfo"
                       placeholder="请输入"
                     />
                   </el-form-item>