From f66dd649c7fc0ba9dcb63059daa388b5afe264cd Mon Sep 17 00:00:00 2001 From: stt Date: Fri, 14 Nov 2025 16:18:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E7=95=99=E4=B8=A4=E4=B8=AA=E5=B0=8F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cockpit/exceedanceLevel/index.vue | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/cockpit/exceedanceLevel/index.vue b/src/components/cockpit/exceedanceLevel/index.vue index cccebe5..f2d2236 100644 --- a/src/components/cockpit/exceedanceLevel/index.vue +++ b/src/components/cockpit/exceedanceLevel/index.vue @@ -93,7 +93,11 @@ const tableStore: any = new TableStore({ minWidth: '60', render: 'customTemplate', customTemplate: (row: any) => { - return `${row.maxValue}` + const extentValue = + row.maxValue !== null && row.maxValue !== undefined && row.maxValue !== '' + ? Math.floor(row.maxValue * 100) / 100 + : '/' + return `${extentValue}` } }, { @@ -104,7 +108,16 @@ const tableStore: any = new TableStore({ { title: '越限程度(%)', field: 'extent', - minWidth: '60' + minWidth: '60', + render: 'customTemplate', + customTemplate: (row: any) => { + // 保留两个小数 + const extentValue = + row.extent !== null && row.extent !== undefined && row.extent !== '' + ? Math.floor(row.extent * 100) / 100 + : '/' + return `${extentValue}` + } }, { title: '发生日期', @@ -145,8 +158,9 @@ const tableStore: any = new TableStore({ const chartData = xAxisLabels.map(label => { // 在表格数据中查找对应指标名称的数据项 const item = tableStore.table.data.find((row: any) => row.name === label) - // 如果找到对应项,则返回 extent 值,否则返回 0 - return item ? item.extent || 0 : 0 + // 如果找到对应项,则返回 extent 值,否则返回 0,并保留两位小数 + const extentValue = item ? item.extent || 0 : 0 + return Math.round(extentValue * 100) / 100 }) echartList.value = { title: {