Bläddra i källkod

选择加工类型给拆包加个默认值

695593266@qq.com 4 dagar sedan
förälder
incheckning
839b4483ec
1 ändrade filer med 90 tillägg och 30 borttagningar
  1. 90 30
      src/views/material/product/detail.vue

+ 90 - 30
src/views/material/product/detail.vue

@@ -38,7 +38,10 @@
                 @click.native="openCode"
                 :disabled="status == 0"
               /> -->
-              <el-input v-model="form.code" :disabled="status == 0 || isReadOnly">
+              <el-input
+                v-model="form.code"
+                :disabled="status == 0 || isReadOnly"
+              >
                 <template slot="append" v-if="status != 0 && !isReadOnly">
                   <el-link :underline="false" @click.native="getCodeOpen"
                     >申请编码
@@ -195,7 +198,11 @@
                 trigger: 'change'
               }"
             >
-              <el-input v-model="form.specification" @input="inputSpe" :disabled="isReadOnly" />
+              <el-input
+                v-model="form.specification"
+                @input="inputSpe"
+                :disabled="isReadOnly"
+              />
             </el-form-item>
           </el-col>
 
@@ -306,7 +313,11 @@
               }"
             >
               <div class="form-line">
-                <el-input v-model="form.roughWeight" @input="handleInput2" :disabled="isReadOnly" />
+                <el-input
+                  v-model="form.roughWeight"
+                  @input="handleInput2"
+                  :disabled="isReadOnly"
+                />
               </div>
             </el-form-item>
           </el-col>
@@ -323,7 +334,11 @@
               }"
             >
               <div class="form-line">
-                <el-input v-model="form.netWeight" @input="handleInput3" :disabled="isReadOnly" />
+                <el-input
+                  v-model="form.netWeight"
+                  @input="handleInput3"
+                  :disabled="isReadOnly"
+                />
               </div>
             </el-form-item>
           </el-col>
@@ -472,7 +487,9 @@
                     :disabled="f.extAttribute?.disabled || isReadOnly"
                     clearable
                     :isProhibit="
-                      f.modelType == 'dict' ? f.extAttribute?.disabled || isReadOnly : false
+                      f.modelType == 'dict'
+                        ? f.extAttribute?.disabled || isReadOnly
+                        : false
                     "
                     :dictName="f.modelType == 'dict' ? f.label : ''"
                   ></component>
@@ -483,23 +500,35 @@
           <template v-if="industryAttribute == 1">
             <el-col :span="8">
               <el-form-item label="性味与归经">
-                <el-input v-model="form.propertiesChannelTropism" :disabled="isReadOnly" />
+                <el-input
+                  v-model="form.propertiesChannelTropism"
+                  :disabled="isReadOnly"
+                />
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="功能与主治">
-                <el-input v-model="form.actionsAndUses" :disabled="isReadOnly" />
+                <el-input
+                  v-model="form.actionsAndUses"
+                  :disabled="isReadOnly"
+                />
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="用法与用量">
-                <el-input v-model="form.usageAndDosage" :disabled="isReadOnly" />
+                <el-input
+                  v-model="form.usageAndDosage"
+                  :disabled="isReadOnly"
+                />
               </el-form-item>
             </el-col>
           </template>
           <el-col :span="8" v-if="clientEnvironmentId == 5">
             <el-form-item label="需要序列号">
-              <el-radio-group v-model="form.extTagField.needProductSequence" :disabled="isReadOnly">
+              <el-radio-group
+                v-model="form.extTagField.needProductSequence"
+                :disabled="isReadOnly"
+              >
                 <el-radio :label="1">是</el-radio>
                 <el-radio :label="0">否</el-radio>
               </el-radio-group>
@@ -512,7 +541,11 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="产品图片">
-              <ImgUpload ref="imgUploadRef" v-model="form.imgUrl" :disabled="isReadOnly" />
+              <ImgUpload
+                ref="imgUploadRef"
+                v-model="form.imgUrl"
+                :disabled="isReadOnly"
+              />
             </el-form-item>
           </el-col>
         </el-row>
@@ -523,7 +556,10 @@
       <!-- {{ form.extTagField }} -->
       <el-form label-width="100px">
         <el-form-item label="是否消耗品">
-          <el-radio-group v-model="form.extTagField.isConsumables" :disabled="isReadOnly">
+          <el-radio-group
+            v-model="form.extTagField.isConsumables"
+            :disabled="isReadOnly"
+          >
             <el-radio :label="1">是</el-radio>
             <el-radio :label="0">否</el-radio>
           </el-radio-group>
@@ -562,7 +598,11 @@
       :disabled="isReadOnly"
     />
     <!-- 生产信息 -->
-    <ProductionInfo ref="productionRefs" :form="categoryMes" :disabled="isReadOnly" />
+    <ProductionInfo
+      ref="productionRefs"
+      :form="categoryMes"
+      :disabled="isReadOnly"
+    />
     <!-- 计划 -->
     <PlanInfo ref="planRefs" :form="categoryAps" :disabled="isReadOnly" />
     <!-- 质量配置 -->
@@ -571,7 +611,11 @@
     <!-- 舟皿信息 -->
     <BoatInfo :form="categoryPallet" :disabled="isReadOnly" />
     <!-- 周转车信息 -->
-    <TurnoverInfo ref="turnoverRefs" :form="categoryVehicle" :disabled="isReadOnly" />
+    <TurnoverInfo
+      ref="turnoverRefs"
+      :form="categoryVehicle"
+      :disabled="isReadOnly"
+    />
     <!-- 模具信息 -->
     <MoldInfo ref="moldRefs" :form="categoryMold" :disabled="isReadOnly" />
     <!-- 备注信息 -->
@@ -816,7 +860,7 @@
         categoryQms: [...copyObj(defCategoryQms)],
         categoryVehicle: {},
         categoryWms: {
-          isUnpack: 0,
+          isUnpack: 1,
           isWarn: 1,
           inventoryMode: '',
           secureInventory: '1',
@@ -916,7 +960,7 @@
 
             this.categoryVehicle = {};
             this.categoryWms = {
-              isUnpack: 0,
+              isUnpack: 1,
               isWarn: 1,
               inventoryMode: this.form.isConsumable,
               minPackageCell: '',
@@ -1011,8 +1055,15 @@
     },
     async activated() {
       this.status = this.$route.query.status;
-      this.isReadOnly = this.$route.query.readOnly === 'true' || this.$route.query.readOnly === true;
-      console.log('activated - isReadOnly 状态:', this.isReadOnly, 'readOnly参数:', this.$route.query.readOnly);
+      this.isReadOnly =
+        this.$route.query.readOnly === 'true' ||
+        this.$route.query.readOnly === true;
+      console.log(
+        'activated - isReadOnly 状态:',
+        this.isReadOnly,
+        'readOnly参数:',
+        this.$route.query.readOnly
+      );
       this.form.categoryLevelId = this.$route.query.categoryLevelId;
       this.form.categoryLevelName = this.$route.query.categoryLevelName;
       this.form.categoryLevelPath = this.$route.query.categoryLevelPath;
@@ -1036,16 +1087,23 @@
         if (res.value) {
           this.isNetWeight = res.value;
           if (this.clientEnvironmentId != 5) {
-            if (this.isNetWeight == 1) {
+            if (this.isNetWeight == 1 && !this.$route.query.id) {
               console.log('dadada');
-              this.$set(this.categoryWms, 'isUnpack', 1);
+              this.setDefaultUnpackByConsumable();
             }
           }
         }
       });
 
-      this.isReadOnly = this.$route.query.readOnly === 'true' || this.$route.query.readOnly === true;
-      console.log('详情页 isReadOnly 状态:', this.isReadOnly, 'readOnly参数:', this.$route.query.readOnly);
+      this.isReadOnly =
+        this.$route.query.readOnly === 'true' ||
+        this.$route.query.readOnly === true;
+      console.log(
+        '详情页 isReadOnly 状态:',
+        this.isReadOnly,
+        'readOnly参数:',
+        this.$route.query.readOnly
+      );
 
       parameterGetByCode({
         code: 'mandatory_field'
@@ -1109,12 +1167,19 @@
     mounted() {
       if (this.clientEnvironmentId == 4) {
         this.form.measureType = 3;
-        this.$set(this.categoryWms, 'isUnpack', 0);
-      } else if (this.clientEnvironmentId == 5) {
-        this.$set(this.categoryWms, 'isUnpack', 0);
       }
     },
     methods: {
+      getDefaultIsUnpackByConsumable(isConsumable) {
+        return Number(isConsumable) === 1 ? 0 : 1;
+      },
+      setDefaultUnpackByConsumable() {
+        this.$set(
+          this.categoryWms,
+          'isUnpack',
+          this.getDefaultIsUnpackByConsumable(this.form.isConsumable)
+        );
+      },
       inputSpe(val) {
         if (this.form.measuringUnit == '立方') {
           if (!val || typeof val !== 'string') {
@@ -1169,12 +1234,6 @@
         }
       },
       changeMeasureType() {
-        if (this.form.measureType == 1) {
-          console.log('7897979');
-          this.$set(this.categoryWms, 'isUnpack', 1);
-        } else {
-          this.$set(this.categoryWms, 'isUnpack', 0);
-        }
         this.setNetWeight();
       },
       handleInput(value) {
@@ -1191,6 +1250,7 @@
       },
       changeConsumable() {
         this.$set(this.categoryWms, 'inventoryMode', this.form.isConsumable);
+        this.setDefaultUnpackByConsumable();
       },
       changeWeightUnit() {
         if (