diff --git a/src/store/modules/panel.js b/src/store/modules/panel.js index 243d5ec6..c2f4d8ce 100644 --- a/src/store/modules/panel.js +++ b/src/store/modules/panel.js @@ -14,7 +14,8 @@ const panel = { chartLastPosition: { x: 0, y: 0 - } + }, + chartList:[] }, mutations: { setShowRightBox (state, flag) { @@ -55,6 +56,12 @@ const panel = { }, setChartListId (state, id) { state.chartListId = id + }, + setChartList (state, chart) { + state.chartList.push(chart) + }, + cleanChartList (state) { + state.chartList = [] } }, getters: { @@ -93,6 +100,9 @@ const panel = { }, getChartListId (state, id) { return state.chartListId + }, + getChartList (state) { + return state.chartList } }, actions: { diff --git a/src/views/charts/PanelChart.vue b/src/views/charts/PanelChart.vue index 649af453..69807c7a 100644 --- a/src/views/charts/PanelChart.vue +++ b/src/views/charts/PanelChart.vue @@ -379,6 +379,7 @@ export default { mounted () { this.showLoading(true) this.getChartData() + this.$store.commit('cleanChartList') }, setup (props) { const dateRangeValue = 60 diff --git a/src/views/charts/charts/chart-echart-mixin.js b/src/views/charts/charts/chart-echart-mixin.js index 479abfbd..ccb5e945 100644 --- a/src/views/charts/charts/chart-echart-mixin.js +++ b/src/views/charts/charts/chart-echart-mixin.js @@ -79,9 +79,19 @@ export default { this.$emit('showLoading', true) try { this.myChart.setOption(this.chartOption) + this.$store.commit('setChartList', this.$_.cloneDeep(this.myChart)) if (chartNum && chartNum == 2) { this.myChart2.setOption(this.chartOption) + this.$store.commit('setChartList', this.$_.cloneDeep(this.myChart2)) } + let _this = this + window.addEventListener("resize", function(){ + _this.$store.getters.getChartList.forEach(chart =>{ + if(chart){ + chart.resize() + } + }) + }); } finally { setTimeout(() => { this.$emit('showLoading', false)