Procházet zdrojové kódy

加工类型批量默认不拆

yijing před 1 rokem
rodič
revize
a6eeeaf54b

+ 6 - 0
src/views/material/product/components/WarehouseInfo.vue

@@ -217,6 +217,12 @@ export default {
     // },
   },
   watch: {
+    'form.isUnpack': {
+      handler(val) {
+        this.$emit('changeType', val);
+      },
+      deep: true
+    },
     // netWeight(val) {
     //   this.packagingSpecification = this.packagingSpecification.map(
     //     (item) => {

+ 35 - 20
src/views/material/product/detail.vue

@@ -114,7 +114,8 @@
           </el-col>
 
           <el-col :span="8">
-            <el-form-item label="净重">
+            <el-form-item label="净重"
+              :rules="{ required: form.measuringUnit == form.weightUnit, trigger: ['blur', 'change'] }">
               <div class="form-line">
                 <el-input v-model="form.netWeight" @input="handleInput3" />
               </div>
@@ -165,7 +166,7 @@
     <!-- 仓储配置 -->
     <WarehouseInfo ref="warehouseRefs" v-if="isShow" :form="categoryWms" :measuringUnit="form.measuringUnit"
       :packingUnit="form.packingUnit" :packageDispositionVOList="packageDispositionVOList"
-      @change="changePackagingSpecification" />
+      @change="changePackagingSpecification" @changeType="changeType" />
     <!-- 销售配置 -->
     <SalesInfos ref="salesRefs" :form="categorySales" />
     <!-- 采购信息 -->
@@ -305,7 +306,7 @@ export default {
       },
       categoryVehicle: {},
       categoryWms: {
-        isUnpack: 1,
+        isUnpack: '',
         isWarn: 1,
         inventoryMode: '',
         secureInventory: '1',
@@ -387,7 +388,7 @@ export default {
           this.categoryQms = {};
           this.categoryVehicle = {};
           this.categoryWms = {
-            isUnpack: 1,
+            isUnpack: '',
             isWarn: 1,
             inventoryMode: this.form.isConsumable,
             minPackageCell: '',
@@ -460,20 +461,25 @@ export default {
   },
   methods: {
     inputSpe(val) {
-      if (!val || typeof val !== 'string') {
-        this.form.volume = 0;
-        return;
-      };
+      if (this.form.measuringUnit == '立方') {
+        if (!val || typeof val !== 'string') {
+          this.form.volume = 0;
+          return;
+        };
 
-      let modelArr = val.split('*');
-      let modelLong = modelArr[0]; // model规格长度
-      let modeWide = modelArr[1]; // model规格宽度
-      let modeHight = modelArr[2]?.substr(0, modelArr[2].indexOf('cm')); // model规格高度
-      modeHight = Number(modeHight);
+        let modelArr = val.split('*');
+        let modelLong = modelArr[0]; // model规格长度
+        let modeWide = modelArr[1]; // model规格宽度
+        let modeHight = modelArr[2]?.substr(0, modelArr[2].indexOf('cm')); // model规格高度
+        modeHight = Number(modeHight);
+
+        let aa = (modelLong * modeWide * modeHight) / 1000000;
+        console.log(aa, 'aa')
+        this.form.volume = aa;
+      } else {
+        this.form.volume = '';
+      }
 
-      let aa = (modelLong * modeWide * modeHight) / 1000000;
-      console.log(aa, 'aa')
-      this.form.volume = aa;
     },
     handleInput(value) {
       // this.form.volume = this.$handleInputPublicHasPoint(value);
@@ -482,13 +488,14 @@ export default {
       this.form.roughWeight = this.$handleInputPublicHasPoint(value);
     },
     handleInput3(value) {
-      this.form.netWeight = this.$handleInputPublicHasPoint(value);
+      // this.form.netWeight = this.$handleInputPublicHasPoint(value);
       if (this.form.weightUnit == this.form.measuringUnit) {
         this.$refs.warehouseRefs.changeNetWeight(this.form.netWeight);
       }
     },
     changeConsumable() {
-      this.categoryWms.inventoryMode = this.form.isConsumable;
+      this.$set(this.categoryWms, 'inventoryMode', this.form.isConsumable);
+      this.$set(this.categoryWms, 'isUnpack', this.form.isConsumable === 1 ? 0 : 1);
     },
     changeWeightUnit() {
       if (this.form.measuringUnit && this.form.packingUnit && this.form.netWeight) {
@@ -500,8 +507,11 @@ export default {
 
         if (this.form.measuringUnit) {
           // 计量单位是‘立方’   体积单位默认是‘立方’
-          if (this.form.measuringUnit == '立方') {
+          if (this.form.measuringUnit == '立方' && this.form.specification != '') {
             this.form.volumeUnit = '立方';
+            this.inputSpe(this.form.specification)
+          } else {
+            this.form.volume = 0;
           }
           this.categoryPurchase.measuringUnit = this.form.measuringUnit;
           console.log(this.categoryPurchase.measuringUnit, '采购信息');
@@ -527,8 +537,13 @@ export default {
         this.isShow = true;
       }
     },
+    changeType(val) {
+      this.$set(this.form, 'isConsumable', val == 1 ? 0 : 1);
+      this.$set(this.categoryWms, 'inventoryMode', val == 1 ? 0 : 1);
+    },
+
     changePackagingSpecification(val) {
-      console.log('changePackagingSpecification---', val);
+      console.log('changePackagingSpecification--------默认包装组', val);
       this.packagingSpecificationList = val;
     },
     async _getDetails() {