|
@@ -24,24 +24,34 @@
|
|
|
</el-dropdown>
|
|
</el-dropdown>
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:toolkit v-if="this.baseForm.qualityMode == 2 && conditionType == 2">
|
|
<template v-slot:toolkit v-if="this.baseForm.qualityMode == 2 && conditionType == 2">
|
|
|
- <div>
|
|
|
|
|
- <div style="display: flex;align-items: center;">
|
|
|
|
|
- <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>
|
|
|
|
|
- </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" :disabled="conditionType == 1"></el-input>
|
|
|
|
|
- <el-button type="primary" size="mini" @click="handleSampleSubmit"
|
|
|
|
|
- style="margin-right: 12px;">确认</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-form ref="ruleForm" :model="formData" label-width="60px" size="mini" :rules="rules" class="flex"
|
|
|
|
|
+ :show-message="false">
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item prop="number" label-width="0" style="margin-bottom: 0;">
|
|
|
|
|
+ <el-input v-model="formData.number" placeholder="请输入" size="mini"
|
|
|
|
|
+ @change="handleInputNumber"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="6">
|
|
|
|
|
+ <el-form-item prop="sampleUnit" label-width="0" style="margin: 0;">
|
|
|
|
|
+ <DictSelection dictName="计量单位" clearable v-model="formData.sampleUnit" size="mini"
|
|
|
|
|
+ @change="changeSamUnit">
|
|
|
|
|
+ </DictSelection>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="8">
|
|
|
|
|
+ <el-form-item prop="portion" label="数量" style="margin: 0;">
|
|
|
|
|
+ <el-input v-model="formData.portion" placeholder="请输入" size="mini" @change="handleInput"
|
|
|
|
|
+ :disabled="conditionType == 1"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="4" style="text-align: right;">
|
|
|
|
|
+ <el-button type="primary" size="mini" @click="handleSampleSubmit"
|
|
|
|
|
+ style="margin-right: 12px;">确认</el-button>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </el-row>
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
</el-tab-pane>
|
|
</el-tab-pane>
|
|
@@ -128,6 +138,7 @@ import {
|
|
|
outInRecordsPage,
|
|
outInRecordsPage,
|
|
|
getBatchInfoData
|
|
getBatchInfoData
|
|
|
} from '@/api/inspectionPlan/index.js';
|
|
} from '@/api/inspectionPlan/index.js';
|
|
|
|
|
+import { rules } from 'eslint-config-prettier';
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
baseInfo
|
|
baseInfo
|
|
@@ -254,6 +265,30 @@ export default {
|
|
|
sampleUnit: '',
|
|
sampleUnit: '',
|
|
|
portion: null
|
|
portion: null
|
|
|
},
|
|
},
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ number: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ sampleUnit: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请选择样品单位',
|
|
|
|
|
+ trigger: 'change'
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ portion: [
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
isConsumable: '',
|
|
isConsumable: '',
|
|
|
conditionType: null,
|
|
conditionType: null,
|
|
|
|
|
|
|
@@ -666,9 +701,6 @@ export default {
|
|
|
const data1 = this.$refs.table12.getData()
|
|
const data1 = this.$refs.table12.getData()
|
|
|
this.$set(this.formData, 'sampleUnit', data1[0]?.measureUnit);
|
|
this.$set(this.formData, 'sampleUnit', data1[0]?.measureUnit);
|
|
|
this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
|
|
this.$set(this.baseForm, 'sampleMeasureUnit', data1[0]?.measureUnit);
|
|
|
-
|
|
|
|
|
- // this.formData.sampleUnit = data1[0]?.measureUnit;
|
|
|
|
|
- // this.baseForm.sampleMeasureUnit = data1[0].measureUnit
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -836,40 +868,40 @@ export default {
|
|
|
},
|
|
},
|
|
|
handleInputNumber(val) {
|
|
handleInputNumber(val) {
|
|
|
let packingList = this.$refs.table12.getData()
|
|
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;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const maxValue = packingList.length > 1 ? packingList.length : packingList[0].measureQuantity;
|
|
|
|
|
+
|
|
|
|
|
+ if (val > maxValue) {
|
|
|
|
|
+ this.$message.warning('数量不能大于计量数量!');
|
|
|
|
|
+ this.formData.number = maxValue;
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- handleInput() {
|
|
|
|
|
- if (this.formData.portion == null || this.formData.portion == '' || this.formData.portion == 0) {
|
|
|
|
|
- this.$message.warning('生成取样数量不能为空!');
|
|
|
|
|
|
|
+ handleInput(val) {
|
|
|
|
|
+ if (val == 0 || val == '' || val == null) {
|
|
|
this.$refs.table12.clearSelection();
|
|
this.$refs.table12.clearSelection();
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ let packingList = this.$refs.table12.getData();
|
|
|
|
|
+ if (!packingList || packingList.length === 0) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- let packingList = this.$refs.table12.getData()
|
|
|
|
|
- console.log(this.isCheck, 'this.isCheck')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const portion = Number(this.formData.portion);
|
|
|
if (this.isCheck) {
|
|
if (this.isCheck) {
|
|
|
- if (this.formData.portion > packingList.length) {
|
|
|
|
|
|
|
+ if (portion > packingList.length) {
|
|
|
this.$message.warning('取样数量不能大于来源清单数量!');
|
|
this.$message.warning('取样数量不能大于来源清单数量!');
|
|
|
|
|
+ this.formData.portion = packingList.length;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- const rows = packingList.slice(0, this.formData.portion);
|
|
|
|
|
- rows.forEach((row) => {
|
|
|
|
|
|
|
+ packingList.slice(0, this.formData.portion).forEach(row => {
|
|
|
this.$refs.table12.toggleRowSelection(row);
|
|
this.$refs.table12.toggleRowSelection(row);
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- if (this.formData.portion > packingList[0].measureQuantity) {
|
|
|
|
|
|
|
+ const maxQuantity = Number(packingList[0].measureQuantity);
|
|
|
|
|
+ if (portion > maxQuantity) {
|
|
|
this.$message.warning('取样数量不能大于计量数量!');
|
|
this.$message.warning('取样数量不能大于计量数量!');
|
|
|
|
|
+ this.formData.portion = maxQuantity;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -879,31 +911,28 @@ export default {
|
|
|
this.isConsumable = val.isConsumable;
|
|
this.isConsumable = val.isConsumable;
|
|
|
},
|
|
},
|
|
|
changeSamUnit(val) {
|
|
changeSamUnit(val) {
|
|
|
- console.log(val, 'dddd')
|
|
|
|
|
this.$refs.baseInfoRefs.getsampleMeasureUnit(val)
|
|
this.$refs.baseInfoRefs.getsampleMeasureUnit(val)
|
|
|
},
|
|
},
|
|
|
handleSampleSubmit() {
|
|
handleSampleSubmit() {
|
|
|
- this.sampleList = []
|
|
|
|
|
- if (this.formData.portion == null || this.formData.portion == 0 || this.formData.number == '' || this.formData.number == null) {
|
|
|
|
|
- this.$message.warning('计量数量或者取样数量不能为空!');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
|
|
|
|
|
|
|
+ this.$refs.ruleForm.validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ this.sampleList = []
|
|
|
|
|
+ this.baseForm.sampleMeasureUnit = this.formData.sampleUnit
|
|
|
|
|
|
|
|
- console.log(this.conditionType, 'conditionType')
|
|
|
|
|
- console.log(this.selectedList, '.conditionType')
|
|
|
|
|
|
|
+ if (this.conditionType == 1) {
|
|
|
|
|
+ this.sampleList = this.selectedList
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let measureQ = this.formData.number;
|
|
|
|
|
+ let unit = this.formData.sampleUnit;
|
|
|
|
|
+ let nums = Number(this.formData.portion);
|
|
|
|
|
|
|
|
- if (this.conditionType == 1) {
|
|
|
|
|
- this.sampleList = this.selectedList
|
|
|
|
|
- } else {
|
|
|
|
|
- let measureQ = this.formData.number;
|
|
|
|
|
- let unit = this.formData.sampleUnit;
|
|
|
|
|
- let nums = Number(this.formData.portion);
|
|
|
|
|
|
|
+ console.log(measureQ, unit, nums, 'measureQ, unit, nums')
|
|
|
|
|
+ this.getNewSampleList(measureQ, unit, nums)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.activeName = '2'
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- console.log(measureQ, unit, nums, 'measureQ, unit, nums')
|
|
|
|
|
- this.getNewSampleList(measureQ, unit, nums)
|
|
|
|
|
- }
|
|
|
|
|
- this.activeName = '2'
|
|
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
getNewSampleList(measureQ, unit, nums) {
|
|
getNewSampleList(measureQ, unit, nums) {
|
|
@@ -979,4 +1008,9 @@ export default {
|
|
|
border: 1px solid#ebeef5;
|
|
border: 1px solid#ebeef5;
|
|
|
border-top: none;
|
|
border-top: none;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.flex {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|