宜搭同一产品数量进行叠加案例中遇到的问题【引用带公式项,数据自动计算后迟一步才能更新】。
原代码如下:
export function onChange({ value, extra }) {
var temp = {};//定义一个对象 var or = {} for (var i in value) { var key = value[i].textField_lub0ffqh; var key1 = value[i].selectField_lv6240bp; if ((temp[key]={}) && (key1 == '生油')) { //审批表: temp[key].textField_lvaks77e = value[i].selectField_lv6240bp; temp[key].textField_lv5yletz = value[i].textField_lub0ffqg; temp[key].textField_lv5yleu0 = value[i].textField_lub0ffqh; temp[key].numberField_lv5yleu1 = Number(value[i].numberField_lub0ffqj); temp[key].numberField_lv5yleu2 = Number(value[i].numberField_lub0ffqk); temp[key].numberField_lv5yleu3 = Number(value[i].numberField_lub0ffql); temp[key].numberField_lv5yleu4 = Number(value[i].numberField_lub0ffqm); temp[key].numberField_lv5yleu5 = Number(value[i].numberField_lub0ffqn); temp[key].numberField_lv5yleu6 = Number(value[i].numberField_lub0ffqo); temp[key].textField_lv5yleu7 = value[i].textField_lub0ffqp; //信息表: temp[key].textField_lvaks77f = value[i].selectField_lv6240bp; temp[key].textField_lv6367ra = value[i].textField_lub0ffqg; temp[key].numberField_lv6367rb = Number(value[i].numberField_lub0ffqr); temp[key].textField_lv6367rc = value[i].textField_lub0ffqs; temp[key].textField_lv6367rd = value[i].textField_lub0ffqh; temp[key].textField_lv6367re = value[i].textField_lub0ffqt; temp[key].dateField_lv6367rf = value[i].dateField_lub0ffqv; temp[key].numberField_lv6367rg = Number(value[i].numberField_lub0ffqj); temp[key].textField_lv6367rh = value[i].textField_lub0ffqx; temp[key].textField_lv6367ri = value[i].selectField_lub0ffr1; temp[key].textField_lv6367rj = value[i].textField_lub0ffqy;
}
//审批表: else if ((temp[key]={}) && (key1 == '主油')) { temp[key].textField_lvaks77e = value[i].selectField_lv6240bp; temp[key].textField_lv5yletz = value[i].textField_lub0ffqg; temp[key].textField_lv5yleu0 = value[i].textField_lub0ffqh; temp[key].numberField_lv5yleu1 = Number(value[i].numberField_lub0ffqj); temp[key].numberField_lv5yleu2 = Number(value[i].numberField_lub0ffqk); temp[key].numberField_lv5yleu3 = Number(value[i].numberField_lub0ffql); temp[key].numberField_lv5yleu4 = Number(value[i].numberField_lub0ffqm); temp[key].numberField_lv5yleu5 = Number(value[i].numberField_lub0ffqn); temp[key].numberField_lv5yleu6 = Number(value[i].numberField_lub0ffqo); temp[key].textField_lv5yleu7 = value[i].textField_lub0ffqp; //信息表: temp[key].textField_lvaks77f = value[i].selectField_lv6240bp; temp[key].textField_lv6367ra = value[i].textField_lub0ffqg; temp[key].numberField_lv6367rb = value[i].numberField_lub0ffqr; temp[key].textField_lv6367rc = value[i].textField_lub0ffqs; temp[key].textField_lv6367rd = value[i].textField_lub0ffqh; temp[key].textField_lv6367re = value[i].textField_lub0ffqt; temp[key].dateField_lv6367rf = value[i].dateField_lub0ffqv; temp[key].numberField_lv6367rg = value[i].numberField_lub0ffqj; temp[key].textField_lv6367rh = value[i].textField_lub0ffqx; temp[key].textField_lv6367ri = value[i].selectField_lub0ffr1; temp[key].textField_lv6367rj = value[i].textField_lub0ffqy; } else if ((temp[key] = {}) && (key1 == '负油')){ //信息表: temp[key].textField_lvaks77f = value[i].selectField_lv6240bp; temp[key].textField_lv6367ra = value[i].textField_lub0ffqg; temp[key].numberField_lv6367rb = value[i].numberField_lub0ffqr; temp[key].textField_lv6367rc = value[i].textField_lub0ffqs; temp[key].textField_lv6367rd = value[i].textField_lub0ffqh; temp[key].textField_lv6367re = value[i].textField_lub0ffqt; temp[key].dateField_lv6367rf = value[i].dateField_lub0ffqv; temp[key].numberField_lv6367rg = value[i].numberField_lub0ffqj; temp[key].textField_lv6367rh = value[i].textField_lub0ffqx; temp[key].textField_lv6367ri = value[i].selectField_lub0ffr1; temp[key].textField_lv6367rj = value[i].textField_lub0ffqy; } else { //信息表: temp[key] = {};
}
} //console.log('temp[key]', temp) var newArry = []; for (var k in temp) { newArry.push(temp[k]); } //console.log(newArry); this.$('tableField_lv5ylety').setValue(newArry) this.$('tableField_lv6367r8').setValue(newArry)}
赞3
踩0