Merge remote-tracking branch 'coding/master'
This commit is contained in:
commit
6459fb4056
|
|
@ -49,6 +49,7 @@
|
|||
:labelField="'batch'"
|
||||
style="width: 100%;"
|
||||
:params = "paramsM"
|
||||
:multiple="isMultipleBatch"
|
||||
@change="materialBatchChange"
|
||||
>
|
||||
<!-- :params = "{type__in: '10,20',is_hidden: false}" -->
|
||||
|
|
@ -66,6 +67,28 @@
|
|||
</xtSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="isMultipleBatch && multiBatchList.length>0">
|
||||
<template v-for="item in multiBatchList" :key="item.id">
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="批次号">
|
||||
<el-input v-model="item.batch" disabled/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item :label="mgroupMtype==10?'领用数量':'批次总数'">
|
||||
<el-input-number
|
||||
v-model="item.count_use"
|
||||
:max="item.count_cando"
|
||||
:min="0"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="关联任务">
|
||||
<el-select
|
||||
|
|
@ -96,7 +119,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-col :md="12" :sm="24" v-if="!isMultipleBatch">
|
||||
<el-form-item :label="mgroupMtype==10?'领用数量':'批次总数'">
|
||||
<el-input-number
|
||||
v-model="form.count_use"
|
||||
|
|
@ -278,6 +301,7 @@ export default {
|
|||
materialFix:"",
|
||||
options: [],
|
||||
cellsList:[],
|
||||
multiBatchList:[],
|
||||
qct_defects:[],
|
||||
routeOptions: [],
|
||||
materialOptions: [],
|
||||
|
|
@ -289,6 +313,11 @@ export default {
|
|||
paramsM:{},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isMultipleBatch(){
|
||||
return this.mgroupName == 'IQC-内质检验' || this.mgroupName == 'IQC-外观检验';
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
that.paramsM.mtaskx =that.form.mtask;
|
||||
|
|
@ -331,9 +360,10 @@ export default {
|
|||
open(mode="add",data) {
|
||||
this.visible = true;
|
||||
this.form.mtask = "";
|
||||
this.form.wm_in = "";
|
||||
this.form.wm_in = this.isMultipleBatch ? [] : "";
|
||||
this.form.count_use = 0;
|
||||
this.form.parent = "";
|
||||
this.multiBatchList = [];
|
||||
if(data){
|
||||
this.form = data;
|
||||
this.cellsList = data.count_json_from;
|
||||
|
|
@ -422,6 +452,33 @@ export default {
|
|||
},
|
||||
materialBatchChange(){
|
||||
let that = this;
|
||||
if(that.isMultipleBatch){
|
||||
let list = Array.isArray(that.selectObj) ? that.selectObj : [];
|
||||
if(list.length == 0){
|
||||
that.wmInLabel = "";
|
||||
that.multiBatchList = [];
|
||||
return;
|
||||
}
|
||||
that.wmInLabel = list.map(o => that.formatWmaterialLabel(o)).join(";");
|
||||
let prevMap = {};
|
||||
that.multiBatchList.forEach(m => { prevMap[m.id] = m.count_use; });
|
||||
that.multiBatchList = list.map(o => ({
|
||||
id: o.id,
|
||||
batch: o.batch,
|
||||
material: o.material,
|
||||
count_cando: o.count_cando,
|
||||
count_use: prevMap[o.id] != null ? prevMap[o.id] : o.count_cando,
|
||||
}));
|
||||
let firstObj = list[0];
|
||||
that.getRoute(firstObj.material);
|
||||
that.form.batch = firstObj.batch;
|
||||
that.batch_count = firstObj.count;
|
||||
if(that.is_fix){
|
||||
that.materialFix = firstObj.material;
|
||||
}
|
||||
that.getdefects(firstObj.material);
|
||||
return;
|
||||
}
|
||||
if(!that.selectObj || !that.selectObj.id){
|
||||
that.wmInLabel = "";
|
||||
return;
|
||||
|
|
@ -505,11 +562,6 @@ export default {
|
|||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
that.form.mlog = that.mlog;
|
||||
that.form.batch = that.selectObj.batch;
|
||||
// that.form.count_use = that.selectObj.count_cando;
|
||||
if(that.mgroupMtype==10&&that.cellsList.length>0){
|
||||
that.form.count_json_from = that.cellsList;
|
||||
}
|
||||
let count_pn_jgqbl = 0,mlogbdefect=[];
|
||||
that.qct_defects.forEach(item => {
|
||||
if(that.defectform[item.defect_name]>0){
|
||||
|
|
@ -522,8 +574,34 @@ export default {
|
|||
})
|
||||
that.form.mlogbdefect = mlogbdefect;
|
||||
that.form.count_pn_jgqbl = count_pn_jgqbl;
|
||||
console.log(that.form);
|
||||
console.log(that.selectObj);
|
||||
if(that.isMultipleBatch){
|
||||
let list = that.multiBatchList || [];
|
||||
if(list.length == 0){
|
||||
that.isSaveing = false;
|
||||
that.$message.error("请选择批次号");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
for(let item of list){
|
||||
let payload = { ...that.form };
|
||||
payload.wm_in = item.id;
|
||||
payload.batch = item.batch;
|
||||
payload.count_use = item.count_use;
|
||||
await that.$API.wpm.mlogb.in.req(payload);
|
||||
}
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
} catch(err) {
|
||||
that.isSaveing = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
that.form.batch = that.selectObj.batch;
|
||||
if(that.mgroupMtype==10&&that.cellsList.length>0){
|
||||
that.form.count_json_from = that.cellsList;
|
||||
}
|
||||
that.$API.wpm.mlogb.in.req(that.form).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
|
|
|
|||
Loading…
Reference in New Issue