yijing 1 vuosi sitten
vanhempi
commit
c58bb5ecb2
1 muutettua tiedostoa jossa 21 lisäystä ja 17 poistoa
  1. 21 17
      src/views/inspectionPlan/components/edit.vue

+ 21 - 17
src/views/inspectionPlan/components/edit.vue

@@ -23,7 +23,7 @@
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
-            <template v-slot:toolkit v-if="this.baseForm.qualityMode == 2 ">
+            <template v-slot:toolkit v-if="this.baseForm.qualityMode == 2">
               <el-row>
                 <el-form ref="ruleForm" :model="formData" label-width="60px" size="mini" :rules="rules" class="flex"
                   :show-message="false">
@@ -42,19 +42,21 @@
                   </el-col>
                   <el-col :span="8" v-if="conditionType == 2">
                     <el-form-item prop="portion" label="数量" style="margin: 0;">
-                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput" clearable></el-input>
+                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"
+                        clearable></el-input>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="24" v-if="conditionType == 1 && !isCheck ">
+                  <el-col :span="24" v-if="conditionType == 1 && !isCheck">
                     <el-form-item prop="portion" label="数量" style="margin: 0;">
-                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput" clearable></el-input>
+                      <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"
+                        clearable></el-input>
                     </el-form-item>
                   </el-col>
-                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 1 && !isCheck ">
+                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 1 && !isCheck">
                     <el-button type="primary" size="mini" @click="handleSampleSubmit"
                       style="margin-right: 12px;">确认</el-button>
                   </el-col>
-                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 2 ">
+                  <el-col :span="4" style="text-align: right;" v-if="conditionType == 2">
                     <el-button type="primary" size="mini" @click="handleSampleSubmit"
                       style="margin-right: 12px;">确认</el-button>
                   </el-col>
@@ -677,16 +679,16 @@ export default {
       this.selectedList = selection;
       //如果取小样
       if (this.conditionType == 2) {
-        if (this.isCheck){
+        if (this.isCheck) {
           this.formData.portion = selection.length;
           this.baseForm.sampleNumber = selection.length;
-        }else{
+        } else {
           this.baseForm.sampleNumber = this.formData.portion;
         }
         const data1 = this.$refs.table12.getData()
         this.$set(this.formData, 'sampleUnit', data1[0]?.measureUnit);
         this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
-      }else if (this.conditionType == 1){
+      } else if (this.conditionType == 1) {
         this.baseForm.sampleNumber = this.formData.portion;
       }
     },
@@ -702,9 +704,9 @@ export default {
         if (this.selectedList.length == 0) {
           this.$message.warning('请先选择样品!');
         } else {
-          if (this.isCheck){
+          if (this.isCheck) {
             for (let i = 0; i < this.selectedList.length; i++) {
-              for (let j = 0; j < this.selectedList[i].measureQuantity; j++){
+              for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
                 // this.selectedList[i].sampleCode = await this.getSampleCode();
                 this.sampleList.push({
                   ...this.selectedList[i],
@@ -714,15 +716,15 @@ export default {
                 });
               }
             }
-          }else{
+          } else {
             for (let i = 0; i < this.selectedList.length; i++) {
               let forNum = 0;
               if (this.formData.portion != null && this.formData.portion != '') {
                 forNum = this.formData.portion;
-              }else{
+              } else {
                 forNum = this.selectedList[i].measureQuantity;
               }
-              for (let j = 0; j < forNum; j++){
+              for (let j = 0; j < forNum; j++) {
                 // this.selectedList[i].sampleCode = await this.getSampleCode();
                 this.sampleList.push({
                   ...this.selectedList[i],
@@ -783,7 +785,7 @@ export default {
       const portion = Number(this.formData.portion);
       // 清空当前选中
       this.$refs.table12.clearSelection();
-      if (this.conditionType == 2){ // 取小样
+      if (this.conditionType == 2) { // 取小样
         // 确保 portion 不超过数据列表长度
         const safePortion = Math.min(portion, packingList.length);
         if (this.isCheck) { // 是否拆包  false 不拆包
@@ -802,7 +804,7 @@ export default {
         packingList.slice(0, safePortion).forEach(row => {
           this.$refs.table12.toggleRowSelection(row, true);
         });
-      }else if (this.conditionType == 1){
+      } else if (this.conditionType == 1) {
         // 确保 portion 不超过数据列表长度
         const safePortion = Math.min(portion, measureQuantitySum);
         if (portion > measureQuantitySum) {
@@ -1022,7 +1024,9 @@ export default {
     //检验方式改变时,重新获取样品列表
     changeModel(val) {
       this.baseForm.qualityMode = val;
-      this.baseForm.sampleNumber = '';
+      if (this.btnType != 'issued') {
+        this.baseForm.sampleNumber = ''
+      }
       console.log(this.baseForm.productNumber, 'productNumberproductNumber数量')
       if (this.baseForm.qualityMode == 1) {
         this.handleSampleList();