CN-356 Panel 图表bug

This commit is contained in:
hyx
2022-03-14 18:30:26 +08:00
parent 0378b4806c
commit c53c109b74
3 changed files with 22 additions and 1 deletions

View File

@@ -14,7 +14,8 @@ const panel = {
chartLastPosition: { chartLastPosition: {
x: 0, x: 0,
y: 0 y: 0
} },
chartList:[]
}, },
mutations: { mutations: {
setShowRightBox (state, flag) { setShowRightBox (state, flag) {
@@ -55,6 +56,12 @@ const panel = {
}, },
setChartListId (state, id) { setChartListId (state, id) {
state.chartListId = id state.chartListId = id
},
setChartList (state, chart) {
state.chartList.push(chart)
},
cleanChartList (state) {
state.chartList = []
} }
}, },
getters: { getters: {
@@ -93,6 +100,9 @@ const panel = {
}, },
getChartListId (state, id) { getChartListId (state, id) {
return state.chartListId return state.chartListId
},
getChartList (state) {
return state.chartList
} }
}, },
actions: { actions: {

View File

@@ -379,6 +379,7 @@ export default {
mounted () { mounted () {
this.showLoading(true) this.showLoading(true)
this.getChartData() this.getChartData()
this.$store.commit('cleanChartList')
}, },
setup (props) { setup (props) {
const dateRangeValue = 60 const dateRangeValue = 60

View File

@@ -79,9 +79,19 @@ export default {
this.$emit('showLoading', true) this.$emit('showLoading', true)
try { try {
this.myChart.setOption(this.chartOption) this.myChart.setOption(this.chartOption)
this.$store.commit('setChartList', this.$_.cloneDeep(this.myChart))
if (chartNum && chartNum == 2) { if (chartNum && chartNum == 2) {
this.myChart2.setOption(this.chartOption) 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 { } finally {
setTimeout(() => { setTimeout(() => {
this.$emit('showLoading', false) this.$emit('showLoading', false)