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: {