From 76706e2f8e62fea697148b79ab772893a97ae2f4 Mon Sep 17 00:00:00 2001 From: hanyuxia Date: Tue, 25 Feb 2020 14:33:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9BUG=20dashboard=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=201.=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4table=E7=B1=BB=E5=9E=8B=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E5=8C=BA=E5=9F=9F=E5=A4=A7=E5=B0=8F=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9B=BE=E8=A1=A8=E9=97=B4=E9=97=B4=E9=9A=94=E5=8F=98?= =?UTF-8?q?=E5=A4=A7=202.=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98=EF=BC=9A?= =?UTF-8?q?=E6=9B=B2=E7=BA=BF=E5=9B=BE=E5=88=9A=E5=8A=A0=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E6=8C=A4=E5=9C=A8=E5=B7=A6=E4=B8=8A=E8=A7=92=E4=B8=80=E5=9B=A2?= =?UTF-8?q?=203.=E6=9B=B2=E7=BA=BF=E5=9B=BE=E6=98=BE=E7=A4=BA=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD2=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-table.scss | 2 +- .../components/charts/line-chart-block.vue | 27 +++++++------------ .../src/components/page/dashboard/panel.vue | 4 ++- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-table.scss b/nezha-fronted/src/components/charts/chart-table.scss index becc79e0b..04cc38204 100644 --- a/nezha-fronted/src/components/charts/chart-table.scss +++ b/nezha-fronted/src/components/charts/chart-table.scss @@ -14,7 +14,7 @@ margin-right: 40px; } .chart-table { - width: calc(100% - 62px); + width: calc(100% - 18px); height: 100%;//calc(100% - 40px); // min-height: 500px; position: relative; diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 3f2954d57..2906e41f2 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -313,6 +313,7 @@ this.chartType = 'line'; } let chartId = ''; + if (chartSite === 'local') { this.echartStore = echarts.init(ele); chartId='lineChartArea'; @@ -663,11 +664,6 @@ return obj; }); */ - this.echartStore.clear(); - //option.title = title; - this.echartStore.setOption(option);//创建图表 - //this.echartStore.hideLoading(); - this.$refs['localLoading'+this.chartIndex].endLoading(); if(legend){ this.legendList = []; legend.forEach((item, i) => { @@ -686,8 +682,14 @@ }else { this.echartStore.resize({height:(chartInfo.height-divHeight-25-35)}); } + + this.echartStore.clear(); + //option.title = title; + this.echartStore.setOption(option);//创建图表 + this.$refs['localLoading'+this.chartIndex].endLoading(); + this.firstShow = true; // 展示操作按键 }); - this.firstShow = true; // 展示操作按键 + } else if (chartSite === 'screen') { // 全屏显示 /* option.series = dataArg.map((item) => {// params.series = dataArg.map((item) => { @@ -740,10 +742,8 @@ } option.title = {}; this.echartModalStore.setOption(option);//显示全屏界面 - //this.echartModalStore.hideLoading(); this.showLegend = true; this.$refs['localLoadingScreen'+this.chartIndex].endLoading(); - //this.echartModalStore.resize({height:chartInfo.height}); if(legend){ this.screenLegendList = []; legend.forEach((item, i) => { @@ -758,14 +758,6 @@ this.$nextTick(() => { let divHeight = this.$refs.screenLegendArea.offsetHeight; this.echartModalStore.resize({height:(400-divHeight)}); - /* - let divHeight = this.$refs.screenLegendArea.offsetHeight; - if(!chartInfo.height){ - this.echartModalStore.resize({height:(400-divHeight)}); - }else { - this.echartModalStore.resize({height:(chartInfo.height-divHeight-25)}); - } - */ }); } }, @@ -1298,13 +1290,14 @@ }, mounted() { this.firstLoad = false; + /* let Myecharts2 = echarts.init(document.getElementById('lineChartArea')); console.log(Myecharts2); setTimeout(function () { Myecharts2.resize() }, 500) - +*/ }, beforeDestroy() {}, }; diff --git a/nezha-fronted/src/components/page/dashboard/panel.vue b/nezha-fronted/src/components/page/dashboard/panel.vue index 364028b77..53c65ab81 100644 --- a/nezha-fronted/src/components/page/dashboard/panel.vue +++ b/nezha-fronted/src/components/page/dashboard/panel.vue @@ -440,6 +440,7 @@ this.$get('panel?pageNo=1&pageSize=-1').then(response => { if (response.code === 200) { this.panelData = response.data.list; + let isInitData = false; if (response.data.list.length > 0) { if (this.$store.state.showPanel.id !== 0 && this.$store.state.showPanel.name !== '') { this.showPanel.name = this.$store.state.showPanel.name; @@ -453,6 +454,7 @@ this.showPanel.name = response.data.list[0].name; this.filter.panelId = this.showPanel.id; this.getData(this.filter); + isInitData = true; } this.filter.panelId = this.showPanel.id; } else { @@ -460,7 +462,7 @@ this.filter.panelId = ''; } this.pageObj.total = response.data.total; - if (this.panel.id === '' || this.panel.id === this.showPanel.id) { + if (!isInitData &&(this.panel.id === '' || this.panel.id === this.showPanel.id)) { this.getData(this.filter); } this.$store.state.showPanel.id = 0;