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;