fix:上盘平磨合批弹窗总计不刷新,交接数量@change的countChanges方法未声明变量报错;总计改为computed计算属性,随handoverb自动汇总,并移除分散的手动累加与500ms定时重算
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0a3f7d7292
commit
94859d431d
|
|
@ -101,7 +101,6 @@
|
||||||
:step-strictly="true"
|
:step-strictly="true"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
placeholder="交接数量"
|
placeholder="交接数量"
|
||||||
@change="countChanges($index)"
|
|
||||||
>
|
>
|
||||||
</el-input-number>
|
</el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -383,7 +382,6 @@ export default {
|
||||||
route_code: "",
|
route_code: "",
|
||||||
project_code:'',
|
project_code:'',
|
||||||
materials:[],
|
materials:[],
|
||||||
totalCount: 0,
|
|
||||||
deptID:'',
|
deptID:'',
|
||||||
bwIndex:0,
|
bwIndex:0,
|
||||||
checkedStatus:[],
|
checkedStatus:[],
|
||||||
|
|
@ -466,6 +464,11 @@ export default {
|
||||||
that.getMgroupOptions();
|
that.getMgroupOptions();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
// 总计:始终等于各批次交接数量之和,随 handoverb 自动刷新
|
||||||
|
totalCount() {
|
||||||
|
if (!this.form.handoverb || this.form.handoverb.length === 0) return 0;
|
||||||
|
return this.form.handoverb.reduce((sum, item) => sum + Number(item.count || 0), 0);
|
||||||
|
},
|
||||||
// 合批时源批次 state 均为 OK(10) 且 defect 不一致,才显示"清除缺陷"勾选
|
// 合批时源批次 state 均为 OK(10) 且 defect 不一致,才显示"清除缺陷"勾选
|
||||||
defectMismatch() {
|
defectMismatch() {
|
||||||
if (this.mtype !== 30) return false;
|
if (this.mtype !== 30) return false;
|
||||||
|
|
@ -490,11 +493,6 @@ export default {
|
||||||
that.checkedStatus.splice(index,1);
|
that.checkedStatus.splice(index,1);
|
||||||
this.form.handoverb[this.bwIndex].handoverbw.splice(index,1);
|
this.form.handoverb[this.bwIndex].handoverbw.splice(index,1);
|
||||||
this.form.handoverb[this.bwIndex].count--;
|
this.form.handoverb[this.bwIndex].count--;
|
||||||
let totalCount = 0;
|
|
||||||
that.form.handoverb.forEach((item)=>{
|
|
||||||
totalCount += item.count;
|
|
||||||
})
|
|
||||||
that.totalCount = totalCount;
|
|
||||||
},
|
},
|
||||||
showbw(index){
|
showbw(index){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
@ -680,7 +678,6 @@ export default {
|
||||||
delMaterial(index){
|
delMaterial(index){
|
||||||
this.selectItems.splice(index,1);
|
this.selectItems.splice(index,1);
|
||||||
this.form.handoverb.splice(index,1);
|
this.form.handoverb.splice(index,1);
|
||||||
this.countChange();
|
|
||||||
},
|
},
|
||||||
codeTextChange(text){
|
codeTextChange(text){
|
||||||
this.wm_in = text;
|
this.wm_in = text;
|
||||||
|
|
@ -701,12 +698,10 @@ export default {
|
||||||
}
|
}
|
||||||
that.form.handoverb = data?data:[];
|
that.form.handoverb = data?data:[];
|
||||||
if(data&&data!==''&&data.length>0){
|
if(data&&data!==''&&data.length>0){
|
||||||
that.totalCount = 0;
|
|
||||||
data.forEach((item,index)=>{
|
data.forEach((item,index)=>{
|
||||||
item.wm = item.id;
|
item.wm = item.id;
|
||||||
that.checkedStatus.push(true)
|
that.checkedStatus.push(true)
|
||||||
that.selectItems.push(item.id)
|
that.selectItems.push(item.id)
|
||||||
that.totalCount += Number(item.count);
|
|
||||||
that.getWprList(item.wm,index);
|
that.getWprList(item.wm,index);
|
||||||
})
|
})
|
||||||
if(that.isFeiPinku){
|
if(that.isFeiPinku){
|
||||||
|
|
@ -720,7 +715,6 @@ export default {
|
||||||
},
|
},
|
||||||
clearSelect(){
|
clearSelect(){
|
||||||
let that = this;
|
let that = this;
|
||||||
that.totalCount = 0;
|
|
||||||
that.form.handoverb = [];
|
that.form.handoverb = [];
|
||||||
},
|
},
|
||||||
materialChange() {
|
materialChange() {
|
||||||
|
|
@ -735,7 +729,7 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
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 data = [];
|
||||||
if(that.selectItems.length>0){
|
if(that.selectItems.length>0){
|
||||||
console.log('that.selectItems',that.selectItems)
|
console.log('that.selectItems',that.selectItems)
|
||||||
data = that.materialOptions.filter((item) => {
|
data = that.materialOptions.filter((item) => {
|
||||||
|
|
@ -783,10 +777,8 @@ export default {
|
||||||
// 保留已扫板段的 handoverbw 和数量
|
// 保留已扫板段的 handoverbw 和数量
|
||||||
item.handoverbw = scanned.handoverbw;
|
item.handoverbw = scanned.handoverbw;
|
||||||
item.count = scanned.count;
|
item.count = scanned.count;
|
||||||
totalCount += Number(scanned.count);
|
|
||||||
} else {
|
} else {
|
||||||
item.count = item.count_canhandover;
|
item.count = item.count_canhandover;
|
||||||
totalCount += Number(item.count_canhandover);
|
|
||||||
item.handoverbw = [];
|
item.handoverbw = [];
|
||||||
that.getWprList(item.id,index);
|
that.getWprList(item.id,index);
|
||||||
}
|
}
|
||||||
|
|
@ -800,7 +792,6 @@ export default {
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.totalCount = totalCount;
|
|
||||||
that.form.handoverb = data;
|
that.form.handoverb = data;
|
||||||
},
|
},
|
||||||
getWprList(id,index){
|
getWprList(id,index){
|
||||||
|
|
@ -830,28 +821,6 @@ export default {
|
||||||
}else{
|
}else{
|
||||||
this.checkedStatus[index] = false;
|
this.checkedStatus[index] = false;
|
||||||
}
|
}
|
||||||
this.countChange();
|
|
||||||
},
|
|
||||||
countChange(){
|
|
||||||
let that = this;
|
|
||||||
let totalCount = 0;
|
|
||||||
if(this.form.handoverb&&this.form.handoverb.length&&this.form.handoverb.length>0){
|
|
||||||
this.form.handoverb.forEach(item=>{
|
|
||||||
totalCount += Number(item.count);
|
|
||||||
})
|
|
||||||
that.totalCount = totalCount;
|
|
||||||
}else{
|
|
||||||
that.totalCount = 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
countChanges(index){
|
|
||||||
if(this.form.handoverb[index]){}else{}
|
|
||||||
if(this.form.handoverb.length>0){
|
|
||||||
this.form.handoverb.forEach(item=>{
|
|
||||||
totalCount += item.count;
|
|
||||||
})
|
|
||||||
that.totalCount = totalCount;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
//提交
|
//提交
|
||||||
submit() {
|
submit() {
|
||||||
|
|
@ -910,7 +879,6 @@ export default {
|
||||||
//表单注入数据
|
//表单注入数据
|
||||||
setData(data) {
|
setData(data) {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.totalCount = data.count?data.count:data.handoverb.count;
|
|
||||||
Object.assign(this.form, data);
|
Object.assign(this.form, data);
|
||||||
this.$API.system.user.list.req({ depts: data.send_dept, page: 0 }).then((res) => {
|
this.$API.system.user.list.req({ depts: data.send_dept, page: 0 }).then((res) => {
|
||||||
that.userList = res;
|
that.userList = res;
|
||||||
|
|
@ -1154,9 +1122,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
|
||||||
this.countChange();
|
|
||||||
}, 500);
|
|
||||||
},
|
},
|
||||||
new_batch(){
|
new_batch(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue