Просмотр исходного кода

产品物料详情增加‘计量类型’

yijing 1 год назад
Родитель
Сommit
73828018cc

+ 1 - 20
src/views/material/product/components/WarehouseInfo.vue

@@ -209,27 +209,8 @@ export default {
         return '';
       }
     },
-    // netWeight: {
-    //   type: String,
-    //   default() {
-    //     return '';
-    //   }
-    // },
   },
   watch: {
-    'form.isUnpack': {
-      handler(val) {
-        this.$emit('changeType', val);
-      },
-      deep: true
-    },
-    // netWeight(val) {
-    //   this.packagingSpecification = this.packagingSpecification.map(
-    //     (item) => {
-    //       return { ...item, minPackageCell: val };
-    //     }
-    //   );
-    // },
     measuringUnit(val) {
       this.packagingSpecification = this.packagingSpecification.map(
         (item) => {
@@ -331,7 +312,7 @@ export default {
   created() {
     console.log(
       'this.packageDispositionVOList------------------包装组',
-      this.packageDispositionVOList
+      this.packageDispositionVOList, this.form
     );
     if (this.packageDispositionVOList.length == 0) {
       this.hasPushed = false;

+ 45 - 9
src/views/material/product/detail.vue

@@ -78,6 +78,14 @@
             </el-form-item>
           </el-col>
 
+          <el-col :span="8">
+            <el-form-item label="计量类型" prop="measureType">
+              <el-select v-model="form.measureType" style="width: 100%" @change="changeMeasureType">
+                <el-option v-for="item in measureTypeList" :key="item.value" :value="item.value"
+                  :label="item.label"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
           <el-col :span="8">
             <el-form-item label="计量单位" prop="measuringUnit">
               <DictSelection dictName="计量单位" clearable v-model="form.measuringUnit" @change="changeUnit">
@@ -166,7 +174,7 @@
     <!-- 仓储配置 -->
     <WarehouseInfo ref="warehouseRefs" v-if="isShow" :form="categoryWms" :measuringUnit="form.measuringUnit"
       :packingUnit="form.packingUnit" :packageDispositionVOList="packageDispositionVOList"
-      @change="changePackagingSpecification" @changeType="changeType" />
+      @change="changePackagingSpecification" />
     <!-- 销售配置 -->
     <SalesInfos ref="salesRefs" :form="categorySales" />
     <!-- 采购信息 -->
@@ -245,6 +253,27 @@ export default {
       isShow: true,
       packagingSpecificationList: [],
       loading: false,
+      measureTypeList: [
+        {
+          label: '数量',
+          value: 1
+        },
+        {
+          label: '重量',
+          value: 2
+        },
+        {
+          label: '体积',
+          value: 3
+        }, {
+          label: '容积',
+          value: 4
+        },
+        {
+          label: '面积',
+          value: 5
+        },
+      ],
       levelOptions: [
         {
           label: '特级',
@@ -306,7 +335,7 @@ export default {
       },
       categoryVehicle: {},
       categoryWms: {
-        isUnpack: '',
+        isUnpack: 1,
         isWarn: 1,
         inventoryMode: '',
         secureInventory: '1',
@@ -321,6 +350,9 @@ export default {
       fileList: [],
       // 表单验证规则
       rules: {
+        measureType: [
+          { required: true, message: '请选择计量类型', trigger: 'change' }
+        ],
         categoryLevelGroupName: [
           { required: true, message: '请选择所属物料组', trigger: 'change' }
         ],
@@ -374,7 +406,8 @@ export default {
             netWeight: '',
             weightUnit: '',
             packingUnit: '',
-            extField: {}
+            extField: {},
+            measureType: 1
           };
           this.categorySales = {};
           this.purchaseInfo = {};
@@ -388,7 +421,7 @@ export default {
           this.categoryQms = {};
           this.categoryVehicle = {};
           this.categoryWms = {
-            isUnpack: '',
+            isUnpack: 1,
             isWarn: 1,
             inventoryMode: this.form.isConsumable,
             minPackageCell: '',
@@ -480,6 +513,14 @@ export default {
         this.form.volume = '';
       }
 
+    },
+    changeMeasureType() {
+      if (this.form.measureType == 1) {
+        this.$set(this.categoryWms, 'isUnpack', 1);
+      } else {
+        this.$set(this.categoryWms, 'isUnpack', 0);
+      }
+
     },
     handleInput(value) {
       // this.form.volume = this.$handleInputPublicHasPoint(value);
@@ -495,7 +536,6 @@ export default {
     },
     changeConsumable() {
       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) {
@@ -537,10 +577,6 @@ 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);