From a886f736b538a7b4dce88878ef6a85937da7b384 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 8 Jun 2021 13:44:39 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=2044.100?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list-group.vue | 2 +- nezha-fronted/src/components/charts/chart-list.vue | 2 +- nezha-fronted/src/components/charts/chart-table.vue | 13 ++++++++++++- .../src/components/charts/chartPreview.vue | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index ee0082122..90a01c17e 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -757,7 +757,7 @@ export default { // 循环处理每个elements下获取的数据列 if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) } diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index db9a91123..42542caad 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -946,7 +946,7 @@ export default { // 循环处理每个elements下获取的数据列 if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) } diff --git a/nezha-fronted/src/components/charts/chart-table.vue b/nezha-fronted/src/components/charts/chart-table.vue index c0fb98fbf..b28eed9c3 100644 --- a/nezha-fronted/src/components/charts/chart-table.vue +++ b/nezha-fronted/src/components/charts/chart-table.vue @@ -367,7 +367,7 @@ export default { } this.data = chartItem this.unit = chartDataFormat.getUnit(this.data.unit) - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' seriesItem = this.getStatisticsResult(statistics, seriesItem) seriesItem && (seriesItem = seriesItem.map(item => { if (chartItem.param && chartItem.param.valueMapping && chartItem.param.valueMapping.type) { @@ -584,6 +584,17 @@ export default { break } + default : { + copy.sort((x, y) => { return parseFloat(y.data[0]) - parseFloat(x.data[0]) }) + result = copy.map(item => { + return { + element: item.element, + time: bus.timeFormate(new Date(item.data[0]), 'yyyy-MM-dd hh:mm:ss'), + value: item.data[1] + } + }) + break + } } return result }, diff --git a/nezha-fronted/src/components/charts/chartPreview.vue b/nezha-fronted/src/components/charts/chartPreview.vue index 8a0abe8c5..a2dfdff70 100644 --- a/nezha-fronted/src/components/charts/chartPreview.vue +++ b/nezha-fronted/src/components/charts/chartPreview.vue @@ -470,7 +470,7 @@ export default { if (response.data.result) { if (chartItem.type === 'singleStat') { if (response.data.result.length === 1) { - const statistics = chartItem.param.statistics + const statistics = chartItem.param.statistics || 'null' if (response.data.result[0].values) { singleStatRlt = bus.getSingleStatRlt(statistics, response.data.result[0].values) this.noData = false