From d50fbd21ca3944ae8ce41f46d01502827fda93ad Mon Sep 17 00:00:00 2001 From: junjie Date: Thu, 18 Mar 2021 10:08:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/ChartComponent.vue | 5 +++-- frontend/src/views/chart/components/ColorSelector.vue | 7 ++++++- frontend/src/views/chart/view/ChartEdit.vue | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 3cf27335bc..2e065d2594 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -52,8 +52,9 @@ export default { // console.log(chart_option); // 处理shape attr if (chart.customAttr) { - if (chart.customAttr.color) { - chart_option.color = chart.customAttr.color.colors + const customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + chart_option.color = customAttr.color.colors } } this.myEcharts(chart_option) diff --git a/frontend/src/views/chart/components/ColorSelector.vue b/frontend/src/views/chart/components/ColorSelector.vue index 383cd1ee4f..088e271427 100644 --- a/frontend/src/views/chart/components/ColorSelector.vue +++ b/frontend/src/views/chart/components/ColorSelector.vue @@ -94,7 +94,12 @@ export default { 'chart': { handler: function() { const chart = JSON.parse(JSON.stringify(this.chart)) - this.colorForm.colorCase = chart.customAttr.color.value + if (chart.customAttr) { + const customAttr = JSON.parse(chart.customAttr) + if (customAttr.color) { + this.colorForm.colorCase = customAttr.color.value + } + } } } }, diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index b65d2cdb7a..00dc35945f 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -264,7 +264,7 @@ export default { getData(id) { if (id) { post('/chart/view/getData/' + id, null).then(response => { - this.view = response.data + this.view = JSON.parse(JSON.stringify(response.data)) this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : [] this.view.yaxis = this.view.yaxis ? JSON.parse(this.view.yaxis) : [] this.view.customAttr = this.view.customAttr ? JSON.parse(this.view.customAttr) : {}