From 1e2380610b8b2dcfb175422c2eca9071d55b0ce8 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Mon, 22 Jan 2024 11:45:21 +0800 Subject: [PATCH] =?UTF-8?q?PR=20=E5=90=88=E8=AE=A1=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E8=BD=AC=E6=8D=A2=E4=B8=BANuber?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=86=8D=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/common/compUtils.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils/common/compUtils.ts b/src/utils/common/compUtils.ts index a3b2c0a..29bd915 100644 --- a/src/utils/common/compUtils.ts +++ b/src/utils/common/compUtils.ts @@ -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); }); @@ -516,4 +521,4 @@ export function tenantSaasMessage(title){ cancelButtonProps: { style: { display: 'none' } }, }) } -} \ No newline at end of file +}