fix:mlogb检验的form表单(全检/抽检)

This commit is contained in:
shijing 2024-09-03 15:30:22 +08:00
parent 1a291c6a2e
commit ed0d2a8cad
1 changed files with 97 additions and 58 deletions

View File

@ -16,26 +16,26 @@
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="物料批次" prop="batch">
<el-form-item label="检验类型">
<el-select
v-model="form.batch"
placeholder="物料批次"
clearable
v-model="form.type2"
placeholder="检验类型"
style="width: 100%"
@change="handleChange"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.batch"
:value="item.id"
>
<span>{{item.batch}}</span>
<span style="float:right">({{item.count}})</span>
</el-option>
<el-option
v-for="item in typeOption"
:key="item.value"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="物料批次" prop="batch">
<el-input v-model="form.batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="总数">
<el-input
@ -44,34 +44,44 @@
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="检验数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count"
style="width: 100%"
precision="0"
@change="handleCheckChange"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-col :md="12" :sm="24" v-if="form.type2==20">
<el-form-item label="合格数量">
<el-input v-model="form.count_ok" disabled></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-form-item label="抽检数量">
<el-input-number
:max="batchCount"
controls-position="right"
v-model="form.count_sampling"
style="width: 100%"
precision="0"
@change="handleCheckChange"
@change="handleCountNotokChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格数量">
<el-input
v-model="form.count_ok"
<el-col :md="12" :sm="24" v-if="form.type2==10">
<el-form-item label="抽检合格数">
<el-input-number
controls-position="right"
v-model="form.count_sampling_ok"
style="width: 100%"
disabled
></el-input>
precision="0"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
@ -85,6 +95,16 @@
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="合格率">
<el-input-number
controls-position="right"
v-model="count_ok_rate"
style="width: 100%"
precision="0"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="检验日期" prop="test_date">
<el-date-picker
@ -123,7 +143,6 @@
v-model="count_notok_json.count_n_hd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -135,7 +154,6 @@
v-model="count_notok_json.count_n_wj"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -147,7 +165,6 @@
v-model="count_notok_json.count_n_yd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -159,7 +176,6 @@
v-model="count_notok_json.count_n_txd"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -171,7 +187,6 @@
v-model="count_notok_json.count_n_qp"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -183,7 +198,6 @@
v-model="count_notok_json.count_n_swen"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -195,12 +209,21 @@
v-model="count_notok_json.count_n_bb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="小崩边">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_xbb"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="划伤">
<el-input-number
@ -208,7 +231,6 @@
v-model="count_notok_json.count_n_hs"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -220,7 +242,6 @@
v-model="count_notok_json.count_n_md"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -233,7 +254,17 @@
v-model="count_notok_json.count_n_ps"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="其他">
<el-input-number
controls-position="right"
v-model="count_notok_json.count_n_qt"
style="width: 100%"
precision="0"
@change="handleCountChange"
></el-input-number>
</el-form-item>
@ -274,9 +305,11 @@ export default {
batch: "",
count: null,
count_ok: null,
count_sampling_ok:'',
count_notok: 0,
count_notok_json:{}
},
count_ok_rate:100,
count_notok_json:{
//
count_n_wj: 0,
@ -289,32 +322,27 @@ export default {
count_n_hs: 0,
count_n_md: 0,
count_n_bb:0,
count_n_xbb:0,
count_n_ps: 0,
count_n_qt:0,
},
rules: {
test_date: [
{
required: true,
message: "请选择检验日期",
trigger: "blur",
},
],
batch: [
{
required: true,
message: "请选择物料批次",
trigger: "blur",
},
],
test_date: [{required: true,message: "请选择检验日期",trigger: "blur"}],
batch: [{required: true,message: "请选择物料批次",trigger: "blur"}],
test_user: [{required: true,message: "请选择物料批次",trigger: "blur"}],
},
options: [],
userList : [],
typeOption:[
{name:'全检',value:20},
{name:'抽检',value:10},
],
selectionFilters: [],
batchCount:null,
formCount:null,
visible: false,
supplier:null,
isSaveing: false,
options: [],
userList : [],
selectionFilters: [],
setFiltersVisible: false,
};
},
@ -323,6 +351,7 @@ export default {
this.form.batch = this.itemObj.batch;
this.form.wm = this.itemObj.id;
this.form.count = this.itemObj.count;
this.form.supplier = this.itemObj.supplier;
this.deptID = this.$TOOL.data.get('gx_deptID');
this.getUsers();
},
@ -351,9 +380,6 @@ export default {
});
});
},
handleCheckChange(){
this.form.count_ok = this.form.count-this.form.count_notok;
},
handleCountChange(type){
this.form.count_notok =
this.count_notok_json.count_n_wj+
@ -364,12 +390,20 @@ export default {
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_xbb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps;
this.form.count_ok = this.form.count - this.form.count_notok;
this.count_notok_json.count_n_ps+
this.count_notok_json.count_n_qt;
this.handleCountNotokChange();
},
handleCountNotokChange(){
this.form.count_ok = this.form.count - this.form.count_notok;
if(this.form.type2==10){//
this.form.count_sampling_ok = this.form.count_sampling - this.form.count_notok;
this.count_ok_rate = ((this.form.count_sampling_ok/this.form.count_sampling)*100).toFixed(2);
}else{//
this.form.count_ok = this.form.count - this.form.count_notok;
this.count_ok_rate = ((this.form.count_ok/this.form.count)*100).toFixed(2);
}
},
//
getMaterialBatch() {
@ -398,8 +432,10 @@ export default {
this.count_notok_json.count_n_swen+
this.count_notok_json.count_n_hs+
this.count_notok_json.count_n_bb+
this.count_notok_json.count_n_xbb+
this.count_notok_json.count_n_md+
this.count_notok_json.count_n_ps;
this.count_notok_json.count_n_ps+
this.count_notok_json.count_n_qt;
if(count_notok>this.form.count_notok){
this.$notify.error("不合格数量有问题");
that.isSaveing = false;
@ -407,6 +443,9 @@ export default {
if(count_notok<this.form.count_notok){
that.count_notok_json.count_n_qt = this.form.count_notok-count_notok;
}
if(that.supplier!== null&&that.form.type2==10){
that.form.need_update_wm = false;
}
that.form.count_ok = this.form.count-this.form.count_notok;
that.form.count_notok_json = that.count_notok_json;
that.$API.qm.ftestwork.create.req(that.form)