fix(TicketStatistics): 处理未定义和空值的显示问题

修复表格中百分比和日期显示为未定义或空值时的问题,改为显示'-'或默认值

修复统计报表页面打开白屏的BUG
This commit is contained in:
zhang1106
2025-12-25 17:04:43 +08:00
parent bfb789dfd9
commit 8d1cd417fa
+3 -3
View File
@@ -123,7 +123,7 @@ function TicketStatistics() {
width: 120, width: 120,
render: (pct) => ( render: (pct) => (
<span style={{ color: pct > 30 ? '#ff4d4f' : '#52c41a' }}> <span style={{ color: pct > 30 ? '#ff4d4f' : '#52c41a' }}>
{pct.toFixed(1)}% {pct !== undefined && pct !== null ? `${pct.toFixed(1)}%` : '-'}
</span> </span>
) )
} }
@@ -148,7 +148,7 @@ function TicketStatistics() {
dataIndex: 'percentage', dataIndex: 'percentage',
key: 'percentage', key: 'percentage',
width: 100, width: 100,
render: (pct) => `${pct.toFixed(1)}%` render: (pct) => `${pct !== undefined && pct !== null ? pct.toFixed(1) : 0}%`
}, },
{ {
title: '已完成', title: '已完成',
@@ -404,7 +404,7 @@ function TicketStatistics() {
dataIndex: 'date', dataIndex: 'date',
key: 'date', key: 'date',
width: 120, width: 120,
render: (text) => dayjs(text).format('YYYY-MM-DD') render: (text) => text ? dayjs(text).format('YYYY-MM-DD') : '-'
}, },
{ {
title: '新建工单', title: '新建工单',