PR 合计工具方法,转换为Nuber类型再计算

pull/1164/head
zhangdaiscott 2024-01-22 11:45:21 +08:00
parent 258b5f9d6b
commit 1e2380610b
1 changed files with 7 additions and 2 deletions

View File

@ -143,7 +143,12 @@ export function mapTableTotalSummary(tableData: Recordable[], fieldKeys: string[
let totals: any = { _row: '合计', _index: '合计' };
fieldKeys.forEach((key) => {
totals[key] = tableData.reduce((prev, next) => {
prev += next[key];
// update-begin--author:liaozhiyang---date:20240118---for【QQYUN-7891】PR 合计工具方法转换为Nuber类型再计算
const value = Number(next[key]);
if (!Number.isNaN(value)) {
prev += value;
}
// update-end--author:liaozhiyang---date:20240118---for【QQYUN-7891】PR 合计工具方法转换为Nuber类型再计算
return prev;
}, 0);
});