累加 分类累加
this.PersonCollect = res.reduce((total, cur, index) => {
let hasValue = total.findIndex(current => { return current.AccountType === cur.AccountType })
hasValue === -1 && total.push(cur)
hasValue !== -1 && (total[hasValue].TotalFee = floatObj.add(total[hasValue].TotalFee, cur.TotalFee));
hasValue !== -1 && (total[hasValue].Qrt = floatObj.add(total[hasValue].Qrt, cur.Qrt));
return total
}, []).map(item => {
let dataOption = {
AccountType: item.AccountType,
AccountTypeName: item.AccountTypeName,
Qrt: item.Qrt,
TotalFee: item.TotalFee
}
return dataOption;
})