fix:日志数据回显

This commit is contained in:
shijing 2025-05-15 13:21:29 +08:00
parent e30f3645f8
commit 6f8d5ba993
5 changed files with 105 additions and 66 deletions

View File

@ -331,6 +331,10 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
mlogId: {
type: String,
default: "",
},
mgroup: { mgroup: {
type: String, type: String,
default: "", default: "",
@ -387,7 +391,9 @@ export default {
isSaveing: false, isSaveing: false,
options: [], options: [],
testitems:[], testitems:[],
mlogdefect:[],
qct_defects:[], qct_defects:[],
mlogindefect:[],
qct_indefects:[], qct_indefects:[],
teamOptions:[], teamOptions:[],
routeOptions: [], routeOptions: [],
@ -459,6 +465,15 @@ export default {
that.defectinform[item.defect_name] = 0; that.defectinform[item.defect_name] = 0;
}) })
that.qct_indefects=res.qct_defects; that.qct_indefects=res.qct_defects;
if(that.mlogindefect.length>0){
that.qct_indefects.forEach(item => {
that.mlogindefect.forEach(item2=>{
if(item.defect==item2.defect){
that.defectinform[item.defect_name] = item2.count;
}
})
})
}
}) })
//material_out //material_out
that.$API.qm.qct.getQct.req({material: that.material_out,tag:'process'}).then((res) => { that.$API.qm.qct.getQct.req({material: that.material_out,tag:'process'}).then((res) => {
@ -466,16 +481,16 @@ export default {
that.defectform[item.defect_name] = 0; that.defectform[item.defect_name] = 0;
}) })
that.qct_defects=res.qct_defects; that.qct_defects=res.qct_defects;
if(that.mlogdefect.length>0){
that.qct_defects.forEach(item => {
that.mlogdefect.forEach(item2=>{
if(item.defect==item2.defect){
that.defectform[item.defect_name] = item2.count;
}
})
})
}
}) })
// if(that.mlogbItem.qct!==null){
// that.$API.qm.qct.item.req(that.mlogbItem.qct).then((res) => {
// res.qct_defects.forEach((item) => {
// that.defectform[item.defect_name] = that.defectform[item.defect_name]?that.defectform[item.defect_name]:0;
// })
// that.max_defect_rate =Number(res.max_defect_rate);
// that.qct_defects=res.qct_defects;
// })
// }
}, },
getEquipment() { getEquipment() {
let that = this; let that = this;
@ -494,8 +509,7 @@ export default {
that.$API.mtm.route.item.req(that.route).then(res=>{ that.$API.mtm.route.item.req(that.route).then(res=>{
that.material_in = res.material_in; that.material_in = res.material_in;
that.material_out = that.form.material_out = res.material_out; that.material_out = that.form.material_out = res.material_out;
that.getdefects(); that.getMlogObj();
}); });
}, },
// //
@ -579,9 +593,17 @@ export default {
} }
return this; return this;
}, },
getMlogObj(){
let that = this;
this.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
console.log("this.$API.wpm.mlog.item", res);
that.mlogindefect = res.mlogindefect;
that.mlogdefect = res.mlogdefect;
that.getdefects();
})
},
// //
setData(data) { setData(data) {
console.log("data", data);
Object.assign(this.form, data); Object.assign(this.form, data);
}, },
countUseChange(){ countUseChange(){
@ -616,12 +638,6 @@ export default {
that.form.mgroup = that.mgroup; that.form.mgroup = that.mgroup;
let mlogdefect = [],mlogindefect =[]; let mlogdefect = [],mlogindefect =[];
that.qct_defects.forEach(item => { that.qct_defects.forEach(item => {
if(that.defectinform[item.defect_name]>0){
let objin = {};
objin.defect = item.defect;
objin.count = that.defectinform[item.defect_name];
mlogindefect.push(objin);
}
if(that.defectform[item.defect_name]>0){ if(that.defectform[item.defect_name]>0){
let obj = {}; let obj = {};
obj.defect = item.defect; obj.defect = item.defect;
@ -629,6 +645,15 @@ export default {
mlogdefect.push(obj) mlogdefect.push(obj)
} }
}) })
that.qct_indefects.forEach(item => {
if(that.defectinform[item.defect_name]>0){
let objin = {};
objin.defect = item.defect;
objin.count = that.defectinform[item.defect_name];
mlogindefect.push(objin);
}
})
that.form.qct = that.qct; that.form.qct = that.qct;
that.form.mlogdefect = mlogdefect; that.form.mlogdefect = mlogdefect;
that.form.mlogindefect = mlogindefect; that.form.mlogindefect = mlogindefect;

View File

@ -120,6 +120,7 @@
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialogs" ref="saveDialogs"
:mlogId="mlogId"
:fmlog="fmlogId" :fmlog="fmlogId"
:mgroup="mgroup" :mgroup="mgroup"
:route="route" :route="route"
@ -290,6 +291,7 @@ export default {
}); });
}, },
table_edit(row){ table_edit(row){
this.mlogId = row.id;
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialogs.open('edit').setData(row); this.$refs.saveDialogs.open('edit').setData(row);

View File

@ -336,6 +336,7 @@
:mlog="mlogId" :mlog="mlogId"
:mgroup="mgroup" :mgroup="mgroup"
:is_fix = "is_fix" :is_fix = "is_fix"
:mlogbindefect = "mlogbindefect"
:mgroupMtype="mgroupMtype" :mgroupMtype="mgroupMtype"
:mgroupName = "mgroupName" :mgroupName = "mgroupName"
:codeText = "codeText" :codeText = "codeText"
@ -349,6 +350,7 @@
ref="checkDialog" ref="checkDialog"
:deptId="deptId" :deptId="deptId"
:mgroupMtype="mgroupMtype" :mgroupMtype="mgroupMtype"
:mlogboutdefect = "mlogboutdefect"
@success="handleCheckSuccess" @success="handleCheckSuccess"
@closed="dialog.check = false" @closed="dialog.check = false"
> >
@ -556,6 +558,8 @@ export default {
options: [], options: [],
tableData:[], tableData:[],
tableData2:[], tableData2:[],
mlogbindefect:[],
mlogboutdefect:[],
saveInDialog: false, saveInDialog: false,
ticketDialog:false, ticketDialog:false,
printVisible:false, printVisible:false,
@ -728,12 +732,14 @@ export default {
}); });
}, },
table_out_check(row) { table_out_check(row) {
this.dialog.check = true; let that = this;
that.mlogboutdefect = row.mlogbdefect;
let obj = {}; let obj = {};
Object.assign(obj, row); Object.assign(obj, row);
obj.mgroup_name = this.mlogItem.mgroup_name; obj.mgroup_name = that.mlogItem.mgroup_name;
this.$nextTick(() => { that.$nextTick(() => {
this.$refs.checkDialog.open(obj); that.dialog.check = true;
that.$refs.checkDialog.open(obj);
}); });
}, },

View File

@ -292,7 +292,11 @@ export default {
deptId:{ deptId:{
type: String, type: String,
default: "", default: "",
} },
mlogboutdefect:{
type:Array,
default:()=>[]
},
}, },
data() { data() {
return { return {
@ -306,7 +310,6 @@ export default {
count_ok_full:0, count_ok_full:0,
count_notok: 0, count_notok: 0,
mlogbdefect:[], mlogbdefect:[],
mlogbindefect:[],
test_user_name:"" test_user_name:""
}, },
count_ok_b:0, count_ok_b:0,
@ -377,7 +380,13 @@ export default {
let that = this; let that = this;
that.visible = true; that.visible = true;
that.mlogbItem = data; that.mlogbItem = data;
that.count_json = [] that.form.batch = data.batch;
that.form.count_real =Number(data.count_real);
that.form.count_ok= Number(data.count_ok);
that.form.count_ok_full= Number(data.count_ok_full);
that.form.count_notok= Number(data.count_notok);
that.count_ok_b = that.form.count_ok- Number(data.count_ok_full);
that.count_json = [];
if(data.count_json_from.length>0){ if(data.count_json_from.length>0){
data.count_json_from.forEach((item) => { data.count_json_from.forEach((item) => {
let cells = item.end-item.start+1; let cells = item.end-item.start+1;
@ -401,18 +410,6 @@ export default {
item.count_test = that.count_cell; item.count_test = that.count_cell;
that.count_json.push(item); that.count_json.push(item);
}) })
that.form.batch = data.batch;
if(data.mlogbdefect.length>0){
that.form.test_user_name = data.test_user_name;
console.log('data.mlogbdefect有数据',data.mlogbdefect);
data.mlogbdefect.forEach((item2) => {
that.defectform[item2.defect_name] = Number(item2.count);
})
}
that.form.count_real =Number(data.count_real);
that.form.count_ok= Number(data.count_ok);
that.form.count_notok= Number(data.count_notok);
that.count_ok_b = that.form.count_ok- Number(data.count_ok_full);
// //
if(that.mgroupMtype==20){ if(that.mgroupMtype==20){
if(data.count_json_wx.ok_num&&data.count_json_wx.ok_num!==null){ if(data.count_json_wx.ok_num&&data.count_json_wx.ok_num!==null){
@ -437,10 +434,19 @@ export default {
if(that.mlogbItem.qct!==null){ if(that.mlogbItem.qct!==null){
that.$API.qm.qct.item.req(that.mlogbItem.qct).then((res) => { that.$API.qm.qct.item.req(that.mlogbItem.qct).then((res) => {
res.qct_defects.forEach((item) => { res.qct_defects.forEach((item) => {
that.defectform[item.defect_name] = that.defectform[item.defect_name]?that.defectform[item.defect_name]:0; that.defectform[item.defect_name] = 0;
}) })
that.max_defect_rate =Number(res.max_defect_rate); that.max_defect_rate =res.max_defect_rate?Number(res.max_defect_rate):null;
that.qct_defects=res.qct_defects; that.qct_defects=res.qct_defects;
if(that.mlogboutdefect.length>0){
that.qct_defects.forEach(item => {
that.mlogboutdefect.forEach(item2=>{
if(item.defect==item2.defect){
that.defectform[item.defect_name] = item2.count;
}
})
})
}
}) })
} }
}, },

View File

@ -152,7 +152,7 @@
<el-col :md="12" :sm="24" v-for="item in qct_defects" :key="item.id"> <el-col :md="12" :sm="24" v-for="item in qct_defects" :key="item.id">
<el-form-item :label="item.defect_name"> <el-form-item :label="item.defect_name">
<el-input-number <el-input-number
v-model="defectinform[item.defect_name]" v-model="defectform[item.defect_name]"
:min="0" :min="0"
style="width: 100%" style="width: 100%"
controls-position="right" controls-position="right"
@ -209,7 +209,11 @@ export default {
mgroupMtype:{ mgroupMtype:{
type: String, type: String,
default: "", default: "",
} },
mlogbindefect:{
type:Array,
default:()=>[]
},
}, },
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
@ -248,7 +252,7 @@ export default {
cellsList:[], cellsList:[],
qct_defects:[], qct_defects:[],
materialOptions: [], materialOptions: [],
defectinform:{}, defectform:{},
visible: false, visible: false,
isSaveing: false, isSaveing: false,
setFiltersVisible: false, setFiltersVisible: false,
@ -321,24 +325,20 @@ export default {
}, },
getdefects(){ getdefects(){
let that = this; let that = this;
that.$API.qm.qct.list.req({qctmat__material:that.materialIn,page:0,tags:'process'}).then((res) => { that.$API.qm.qct.getQct.req({material: that.materialIn,tag:'process'}).then((res) => {
if(res.length>0){ res.qct_defects.forEach((item) => {
that.$API.qm.qct.item.req(res[0].id).then((res) => { that.defectform[item.defect_name] = 0;
res.qct_defects.forEach((item) => { })
that.defectinform[item.defect_name] = 0; that.qct_defects=res.qct_defects;
let count_pn_jgqbl = 0;
if(data.mlogbindefect.length>0){
that.qct_defects.forEach(item => {
data.mlogbindefect.forEach(item2=>{
if(item.defect==item2.defect){
count_pn_jgqbl+=item2.count;
that.defectform[item.defect_name] = item2.count;
}
}) })
that.qct_defects=res.qct_defects;
let count_pn_jgqbl = 0;
if(data.mlogbindefect.length>0){
that.qct_defects.forEach(item => {
data.mlogbindefect.forEach(item2=>{
if(item.defect==item2.defect){
count_pn_jgqbl+=item2.count;
that.defectinform[item.defect_name] = item2.count;
}
})
})
}
}) })
} }
}) })
@ -402,7 +402,7 @@ export default {
that.form.count_pn_jgqbl = 0; that.form.count_pn_jgqbl = 0;
that.qct_defects.forEach(item => { that.qct_defects.forEach(item => {
if(item.defect_okcate==30){ if(item.defect_okcate==30){
that.form.count_pn_jgqbl += that.defectinform[item.defect_name]; that.form.count_pn_jgqbl += that.defectform[item.defect_name];
} }
}) })
that.countCellChanges(); that.countCellChanges();
@ -417,17 +417,17 @@ export default {
if(that.mgroupMtype==10&&that.cellsList.length>0){ if(that.mgroupMtype==10&&that.cellsList.length>0){
that.form.count_json_from = that.cellsList; that.form.count_json_from = that.cellsList;
} }
let count_pn_jgqbl = 0,mlogbindefect=[]; let count_pn_jgqbl = 0,mlogbdefect=[];
that.qct_defects.forEach(item => { that.qct_defects.forEach(item => {
if(that.defectinform[item.defect_name]>0){ if(that.defectform[item.defect_name]>0){
count_pn_jgqbl += that.defectinform[item.defect_name] ; count_pn_jgqbl += that.defectform[item.defect_name] ;
let obj = {}; let obj = {};
obj.defect = item.defect; obj.defect = item.defect;
obj.count = that.defectinform[item.defect_name]; obj.count = that.defectform[item.defect_name];
mlogbindefect.push(obj); mlogbdefect.push(obj);
} }
}) })
that.form.mlogbindefect = mlogbindefect; that.form.mlogbdefect = mlogbdefect;
that.form.count_pn_jgqbl = count_pn_jgqbl; that.form.count_pn_jgqbl = count_pn_jgqbl;
that.$API.wpm.mlogb.in.req(that.form).then((res) => { that.$API.wpm.mlogb.in.req(that.form).then((res) => {
that.isSaveing = false; that.isSaveing = false;