yijing пре 1 година
родитељ
комит
cf744e2f30
1 измењених фајлова са 60 додато и 37 уклоњено
  1. 60 37
      src/views/inspectionPlan/components/edit.vue

+ 60 - 37
src/views/inspectionPlan/components/edit.vue

@@ -23,24 +23,25 @@
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
-            <template v-slot:toolkit v-if="this.baseForm.qualityMode == 2">
-              <template v-if="baseForm.conditionType == 2">
+            <template v-slot:toolkit>
+              <div v-if="conditionType == 2">
                 <div style="display: flex;align-items: center;">
-                  <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"></el-input>
+                  <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"
+                    @change="handleInputNumber"></el-input>
                   <DictSelection dictName="计量单位" clearable v-model="formData.sampleUnit" size="mini"
                     style="width: 120px;margin-left: 12px;" @change="changeSamUnit">
                   </DictSelection>
                 </div>
-              </template>
-              <template>
+              </div>
+              <div>
                 <div style="margin-left: 12px;display: flex;align-items: center;">
                   <div>数量:</div>
                   <el-input v-model="formData.portion" style="width: 120px;margin:0 12px;" placeholder="请输入" size="mini"
-                    @change="handleInput"></el-input>
+                    @change="handleInput" :disabled="conditionType == 1"></el-input>
                   <el-button type="primary" size="mini" @click="handleSampleSubmit"
                     style="margin-right: 12px;">确认</el-button>
                 </div>
-              </template>
+              </div>
             </template>
           </ele-pro-table>
         </el-tab-pane>
@@ -49,7 +50,6 @@
             :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id">
             <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
             <template v-for="column in tableColumns2">
-              <el-table-column label="样品编码" prop="sampleCode"></el-table-column>
               <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
                 :width="column.width" :align="column.align"></el-table-column>
             </template>
@@ -94,7 +94,7 @@
     </template>
 
 
-    <ele-modal :visible.sync="takeAsampleVisible" title="选择取样信息" width="80vw" append-to-body @close="handleCancel"
+    <!-- <ele-modal :visible.sync="takeAsampleVisible" title="选择取样信息" width="80vw" append-to-body @close="handleCancel"
       :maxable="true">
 
       <el-table ref="showSampleListTable" :data="selectedList" tooltip-effect="dark" :max-height="300" border
@@ -111,7 +111,7 @@
         <el-button type="primary" @click="handleConfirm">确定</el-button>
         <el-button @click="handleCancel">取消</el-button>
       </div>
-    </ele-modal>
+    </ele-modal> -->
   </ele-modal>
 </template>
 
@@ -171,7 +171,7 @@ export default {
         remark: '',
         accessory: [],
 
-        conditionType: null,
+        conditionType: 1,
       };
     };
     return {
@@ -180,6 +180,12 @@ export default {
       baseForm: { ...defaultForm() },
 
       tableColumns2: [
+        {
+          label: '样品编码',
+          prop: 'sampleCode',
+          width: '150',
+          align: 'center'
+        },
         {
           label: '编码',
           prop: 'categoryCode',
@@ -192,7 +198,7 @@ export default {
           width: '150',
           align: 'center'
         },
-        { label: '批次号', prop: 'batchNo', align: 'center' },
+        { label: '批次号', prop: 'batchNo', align: 'center', width: 120, },
         { label: '发货条码', prop: 'barcodes', align: 'center' },
         { label: '包装编码', prop: 'packageNo', align: 'center' },
         { label: '计量数量', prop: 'measureQuantity', align: 'center' },
@@ -249,20 +255,27 @@ export default {
         portion: null
       },
       isConsumable: '',
+      conditionType: null,
     };
   },
   computed: {
     tableColumns() {
       let arr = [
 
-        (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
-          ? {
-            columnKey: 'selection',
-            type: 'selection',
-            width: 45,
-            align: 'center'
-          }
-          : null,
+        // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
+        //   ? {
+        //     columnKey: 'selection',
+        //     type: 'selection',
+        //     width: 45,
+        //     align: 'center'
+        //   }
+        //   : null,
+        {
+          columnKey: 'selection',
+          type: 'selection',
+          width: 45,
+          align: 'center'
+        },
         {
           columnKey: 'index',
           label: '序号',
@@ -286,7 +299,7 @@ export default {
           width: 120,
           showOverflowTooltip: true
         },
-        { label: '批次号', prop: 'batchNo', align: 'center' },
+        { label: '批次号', prop: 'batchNo', align: 'center', width: 120, },
         { label: '发货条码', prop: 'barcodes', align: 'center' },
         {
           label: '包装编码', prop: 'packageNo', align: 'center',
@@ -408,17 +421,6 @@ export default {
         //操作行点击时查询清单
         // await this.getInventoryList();
         await this.reload({ planId: row.id });
-        
-        this.$nextTick(() => {
-          if (this.$refs.table12) {
-            this.$refs.table12.doLayout()
-          }
-        })
-        if (this.baseForm.type == 1) {
-          this.sampleList = this.$refs.table12.getData()
-        } else {
-          this.sampleList = []
-        }
 
         //操作行点击时查询样品
         await this.getSampleList(row.id);
@@ -647,7 +649,7 @@ export default {
 
       this.baseForm.sampleNumber = selection.length;
       //如果取小样
-      if (this.baseForm.conditionType == 2) {
+      if (this.conditionType == 2) {
         // this.baseForm.sampleMeasureUnit = this.$refs.table12.getData()[0].measureUnit
         this.formData.sampleUnit = this.$refs.table12.getData()[0].measureUnit
       }
@@ -716,6 +718,7 @@ export default {
         if (this.baseForm.isUnpack == null || this.baseForm.isUnpack == '') {
           this.baseForm.isUnpack = this.isCheck ? 1 : 2;
         }
+        this.baseForm.conditionType = this.conditionType;
         let params = {
           ...this.baseForm,
           qualityInventoryList: this.$refs.table12.getData(),
@@ -759,7 +762,7 @@ export default {
         if (this.baseForm.isUnpack == null || this.baseForm.isUnpack == '') {
           this.baseForm.isUnpack = this.isCheck ? 1 : 2;
         }
-
+        this.baseForm.conditionType = this.conditionType;
         let params = {
           ...this.baseForm,
           qualityInventoryList: this.$refs.table12.getData(),
@@ -789,7 +792,7 @@ export default {
     },
     handleSampleNumber(val) {
       console.log(val, 'val')
-      this.baseForm.conditionType = val;
+      this.conditionType = val;
       //清空样品清单列表
       this.sampleList = []
       //取整样
@@ -811,6 +814,22 @@ export default {
         }
       }
     },
+    handleInputNumber(val) {
+      let packingList = this.$refs.table12.getData()
+      if (packingList.length > 1) {
+        if (val > packingList.length) {
+          this.$message.warning('数量不能大于来源清单数量!');
+          return;
+        }
+      } else {
+        if (packingList.length == 1) {
+          if (val > packingList[0].measureQuantity) {
+            this.$message.warning('数量不能大于计量数量!');
+            return;
+          }
+        }
+      }
+    },
     handleInput() {
       if (this.formData.portion == null || this.formData.portion == '' || this.formData.portion == 0) {
         this.$message.warning('生成取样数量不能为空!');
@@ -864,13 +883,17 @@ export default {
       this.$refs.baseInfoRefs.getsampleMeasureUnit(val)
     },
     handleSampleSubmit() {
-
+      this.sampleList = []
       if (this.formData.portion == null || this.formData.portion == 0) {
         this.$message.warning('生成取样数量不能为空!');
         return;
       }
       this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
-      if (this.baseForm.conditionType == 1) {
+
+      console.log(this.conditionType, 'conditionType')
+      console.log(this.selectedList, '.conditionType')
+
+      if (this.conditionType == 1) {
         this.sampleList = this.selectedList
       } else {
         let measureQ = this.formData.number;