fix:将已扫板段对应的批次预填入多选,避免手动添加把扫描数据顶掉
This commit is contained in:
parent
aa81a28d1c
commit
bbf58b9167
|
|
@ -665,7 +665,16 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addMaterial(){
|
addMaterial(){
|
||||||
this.addShow = true;
|
let that = this;
|
||||||
|
that.addShow = true;
|
||||||
|
// 将已扫板段对应的批次预填入多选,避免手动添加把扫描数据顶掉
|
||||||
|
if(that.form.handoverb && that.form.handoverb.length > 0){
|
||||||
|
that.form.handoverb.forEach(item => {
|
||||||
|
if(item.wm && that.selectItems.indexOf(item.wm) === -1){
|
||||||
|
that.selectItems.push(item.wm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
delMaterial(index){
|
delMaterial(index){
|
||||||
this.selectItems.splice(index,1);
|
this.selectItems.splice(index,1);
|
||||||
|
|
@ -715,6 +724,15 @@ export default {
|
||||||
},
|
},
|
||||||
materialChange() {
|
materialChange() {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
// shangpaipingmo:先缓存已扫板段数据,重建后保留
|
||||||
|
let scannedMap = {};
|
||||||
|
if(that.route_code == 'shangpaipingmo'){
|
||||||
|
(that.form.handoverb || []).forEach(h => {
|
||||||
|
if(h.wm && h.handoverbw && h.handoverbw.length > 0){
|
||||||
|
scannedMap[h.wm] = h;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
that.form.new_batch = that.route_code=='shangpaipingmo'?that.form.new_batch:"";
|
that.form.new_batch = that.route_code=='shangpaipingmo'?that.form.new_batch:"";
|
||||||
let totalCount = 0,data = [];
|
let totalCount = 0,data = [];
|
||||||
if(that.selectItems.length>0){
|
if(that.selectItems.length>0){
|
||||||
|
|
@ -755,15 +773,31 @@ export default {
|
||||||
}
|
}
|
||||||
data.forEach((item,index)=>{
|
data.forEach((item,index)=>{
|
||||||
item.wm = item.id;
|
item.wm = item.id;
|
||||||
item.count = item.count_canhandover;
|
|
||||||
totalCount += Number(item.count_canhandover);
|
|
||||||
item.tracking = item.material_.tracking;
|
item.tracking = item.material_.tracking;
|
||||||
if(item.material_.process_name){
|
if(item.material_.process_name){
|
||||||
item.process = item.material_.process_name;
|
item.process = item.material_.process_name;
|
||||||
}
|
}
|
||||||
item.handoverbw = [];
|
let scanned = scannedMap[item.id];
|
||||||
that.getWprList(item.id,index);
|
if(scanned){
|
||||||
|
// 保留已扫板段的 handoverbw 和数量
|
||||||
|
item.handoverbw = scanned.handoverbw;
|
||||||
|
item.count = scanned.count;
|
||||||
|
totalCount += Number(scanned.count);
|
||||||
|
} else {
|
||||||
|
item.count = item.count_canhandover;
|
||||||
|
totalCount += Number(item.count_canhandover);
|
||||||
|
item.handoverbw = [];
|
||||||
|
that.getWprList(item.id,index);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
// 同步 checkedStatus:全选状态由各批次 handoverbw 实际勾选情况决定
|
||||||
|
that.checkedStatus = data.map(item => {
|
||||||
|
let scanned = scannedMap[item.id];
|
||||||
|
if(scanned && scanned.handoverbw && scanned.handoverbw.length > 0){
|
||||||
|
return scanned.handoverbw.every(w => w.checked !== false);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
that.totalCount = totalCount;
|
that.totalCount = totalCount;
|
||||||
that.form.handoverb = data;
|
that.form.handoverb = data;
|
||||||
|
|
@ -1049,16 +1083,22 @@ export default {
|
||||||
let obj1 = {};
|
let obj1 = {};
|
||||||
obj1.wpr = res[0].id;
|
obj1.wpr = res[0].id;
|
||||||
obj1.number = res[0].number;
|
obj1.number = res[0].number;
|
||||||
|
obj1.checked = true;
|
||||||
that.form.handoverb[indexs].count+=1;
|
that.form.handoverb[indexs].count+=1;
|
||||||
that.form.handoverb[indexs].handoverbw.push(obj1);
|
that.form.handoverb[indexs].handoverbw.push(obj1);
|
||||||
|
that.checkedStatus.push(true)
|
||||||
|
that.selectItems.push(res[0].id)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
that.form.handoverb[indexs].handoverbw = [];
|
that.form.handoverb[indexs].handoverbw = [];
|
||||||
let obj1 = {};
|
let obj1 = {};
|
||||||
obj1.wpr = res[0].id;
|
obj1.wpr = res[0].id;
|
||||||
|
obj1.checked = true;
|
||||||
obj1.number = res[0].number;
|
obj1.number = res[0].number;
|
||||||
that.form.handoverb[indexs].count=1;
|
that.form.handoverb[indexs].count=1;
|
||||||
that.form.handoverb[indexs].handoverbw.push(obj1);
|
that.form.handoverb[indexs].handoverbw.push(obj1);
|
||||||
|
that.checkedStatus.push(true)
|
||||||
|
that.selectItems.push(res[0].id)
|
||||||
}
|
}
|
||||||
}else{//handoverb里没有有这个物料批次
|
}else{//handoverb里没有有这个物料批次
|
||||||
if(that.new_wm==''){
|
if(that.new_wm==''){
|
||||||
|
|
@ -1082,9 +1122,12 @@ export default {
|
||||||
obj2.count = 1;
|
obj2.count = 1;
|
||||||
let obj3 = {};
|
let obj3 = {};
|
||||||
obj3.wpr = res[0].id;
|
obj3.wpr = res[0].id;
|
||||||
|
obj3.checked = true;
|
||||||
obj3.number = res[0].number;
|
obj3.number = res[0].number;
|
||||||
obj2.handoverbw.push(obj3);
|
obj2.handoverbw.push(obj3);
|
||||||
that.form.handoverb.push(obj2);
|
that.form.handoverb.push(obj2);
|
||||||
|
that.checkedStatus.push(true)
|
||||||
|
that.selectItems.push(res[0].id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -1097,9 +1140,12 @@ export default {
|
||||||
obj2.count = 1;
|
obj2.count = 1;
|
||||||
let obj3 = {};
|
let obj3 = {};
|
||||||
obj3.wpr = res[0].id;
|
obj3.wpr = res[0].id;
|
||||||
|
obj3.checked = true;
|
||||||
obj3.number = res[0].number;
|
obj3.number = res[0].number;
|
||||||
obj2.handoverbw.push(obj3);
|
obj2.handoverbw.push(obj3);
|
||||||
that.form.handoverb.push(obj2);
|
that.form.handoverb.push(obj2);
|
||||||
|
that.checkedStatus.push(true)
|
||||||
|
that.selectItems.push(res[0].id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue