From 6e9147e21211f0d09bd8d30eee8e96600ff76d1b Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Tue, 25 Mar 2025 13:19:36 +0800 Subject: [PATCH] 1 --- src/views/system/DashboardComponents/department.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/views/system/DashboardComponents/department.vue b/src/views/system/DashboardComponents/department.vue index 7131b37..a10b907 100644 --- a/src/views/system/DashboardComponents/department.vue +++ b/src/views/system/DashboardComponents/department.vue @@ -137,17 +137,17 @@ export default { color: '#188df0', position: 'top', formatter: (params) => { - const m2 = this.list[params.dataIndex]?.money_total_2 || 0 - const m1 = this.list[params.dataIndex]?.money_total_1 || 0 - const m3 = this.list[params.dataIndex]?.use_money_total || 0 + const m2 = isNaN(Number(this.list[params.dataIndex]?.money_total_2)) ? 0 : Number(this.list[params.dataIndex]?.money_total_2) + const m1 = isNaN(Number(this.list[params.dataIndex]?.money_total_1)) ? 0 : Number(this.list[params.dataIndex]?.money_total_1) + const m3 = isNaN(Number(this.list[params.dataIndex]?.use_money_total)) ? 0 : Number(this.list[params.dataIndex]?.use_money_total) let per = 0 if (m2 !== 0) { - per = m2 === 0 ? ((m3 / m2) * 100) : 0 + per = (m3 / m2) * 100 } else if (m1 !== 0) { - per = m1 === 0 ? ((m3 / m1) * 100) : 0 + per = (m3 / m1) * 100 } - return Number(per) + '%' + return Number(per).toFixed(2) + '%' } }, itemStyle: {