From a460c442c29e939d9f0cac5f03f730a6e2cc361a Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Fri, 15 May 2020 17:15:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20alertmsg-current=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E3=80=81=E4=BF=AE=E5=A4=8D=E5=9B=BE=E8=A1=A8=E7=9C=8B?= =?UTF-8?q?=E4=B8=8D=E8=A7=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBox/tabs/alertMessageTab.vue | 18 +++++-- .../src/components/page/alert/list.vue | 22 +++++--- .../page/dashboard/overview/test.vue | 53 +++++++++---------- 3 files changed, 53 insertions(+), 40 deletions(-) diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue index 3ede33458..5172ec8e7 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTab.vue @@ -196,6 +196,7 @@ import axios from 'axios'; import nzAlertTag from '../../../page/alert/nzAlertTag'; import chart from '../../../page/dashboard/overview/chart' + import bus from '../../../../libs/bus' export default { name: "alertMessageTab", components: { @@ -526,12 +527,10 @@ } this.legend.push(legend); chartData.data = queryData.values.map((dpsItem, dpsIndex) => { - return [dpsItem[0] * 1000, parseFloat(dpsItem[1]).toFixed(1)]; + return [bus.computeTimezone(dpsItem[0]) * 1000, parseFloat(dpsItem[1]).toFixed(2)]; }); this.chartDatas.push(chartData); - this.$refs.messageChart.setRandomColors(this.chartDatas.length) - this.$refs.messageChart.setLegend(this.legend) - this.$refs.messageChart.setSeries(this.chartDatas); + } } else { this.$message.error(response.data.error) @@ -540,6 +539,9 @@ } }); this.$nextTick(() => { + this.$refs.messageChart.setRandomColors(this.chartDatas.length); + this.$refs.messageChart.setLegend(this.legend); + this.$refs.messageChart.setSeries(this.chartDatas); this.$refs.messageChart.endLoading(); }); } catch(err) { @@ -592,7 +594,13 @@ this.$get('/prom/api/v1/query?query=' + paramStr.substring(1, paramStr.length-1).replace(/\+/g, "%2B").replace(/ /g, "%20").replace(/\\/g, "")).then(response2 => { let current = []; if (response2.data && response2.data.result && response2.data.result.length > 0) { - current = response2.data.result[0].value; + current = response2.data.result[0].value.map((item, i) => { + if (i == 0) { + return bus.computeTimezone(item); + } else { + return parseFloat(item).toFixed(2); + } + }); } this.$set(item, "current", current); }); diff --git a/nezha-fronted/src/components/page/alert/list.vue b/nezha-fronted/src/components/page/alert/list.vue index 5a9755026..5245c972d 100644 --- a/nezha-fronted/src/components/page/alert/list.vue +++ b/nezha-fronted/src/components/page/alert/list.vue @@ -3,6 +3,9 @@ height: 100%; } +