From 52b9e43fe8ec7b471b0bfa5d4dd1dfe1da0cc846 Mon Sep 17 00:00:00 2001 From: huangchengfa <171504222@qq.com> Date: Thu, 11 Dec 2025 15:54:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=81=BF=E5=85=8D=E5=87=BA=E7=8E=B0NaN?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../warningControl/centerHome/components/WarningCount.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/views/backOfficeSystem/fourColorManage/warningControl/centerHome/components/WarningCount.vue b/src/views/backOfficeSystem/fourColorManage/warningControl/centerHome/components/WarningCount.vue index 6872e01..e99efa5 100644 --- a/src/views/backOfficeSystem/fourColorManage/warningControl/centerHome/components/WarningCount.vue +++ b/src/views/backOfficeSystem/fourColorManage/warningControl/centerHome/components/WarningCount.vue @@ -97,7 +97,11 @@ const createChartOption = (data, colors) => { }, formatter: (name) => { const item = data.find(d => d.name === name); - let percentage = ((item.value / total) * 100).toFixed(2); + // 确保value是有效数字,total不为0 + const value = Number(item.value) || 0; + const totalValue = Number(total) || 0; + let percentage = (totalValue > 0 && value > 0) ? ((value / totalValue) * 100).toFixed(2) : '0.00'; + // let percentage = ((item.value / total) * 100).toFixed(2); return `${name} ${item.value} {${item.colorType}|(${percentage}%)}` }