From d6fd41b9f0d7c2715496f77de7c848f0f7c164e2 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 3 Jun 2021 17:12:45 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-723=20=20feat=EF=BC=9Achart=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=97=B6=E8=B0=83=E7=94=A8=E8=AF=B7=E6=B1=82=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=8E=B7=E5=8F=96=E6=9C=80=E6=96=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/page/dashboard/panel.vue | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 6ea978c9e..894371841 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -324,13 +324,28 @@ export default { }, // 编辑图表信息,打开编辑弹窗 editChart (data) { - if (!data.param) { - data.param = { url: '', threshold: '' } - } - this.chart = JSON.parse(JSON.stringify(data)) - this.chart.panelId = this.showPanel.id - this.chart.panelName = this.showPanel.name - this.rightBox.chart.show = true + this.$get('visual/panel/chart/' + data.id).then(res => { + if (res.code === 200) { + const chartData = res.data.data + console.log(typeof chartData.param); + if (typeof chartData.param === 'string') { + chartData.param = JSON.parse(chartData.param) + } + if (!chartData.param) { + chartData.param = { url: '', threshold: '' } + } else if (!chartData.param.threshold) { + chartData.param.threshold = '' + } else if (!chartData.param.url) { + chartData.param.url = '' + } + this.chart = JSON.parse(JSON.stringify(chartData)) + this.chart.panelId = this.showPanel.id + this.chart.panelName = this.showPanel.name + this.rightBox.chart.show = true + } else { + this.$message.error(res.msg) + } + }) }, closeChartBox (refresh) { this.rightBox.chart.show = false