fix: Antv和ECharts组合图互相覆盖

#6188
This commit is contained in:
ulleo 2023-10-24 17:30:34 +08:00
parent de85b47b19
commit c9d2356c70
2 changed files with 27 additions and 12 deletions

View File

@ -631,9 +631,14 @@ export default {
panelInfo() {
return this.$store.state.panel.panelInfo
},
isPlugin() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
return plugins.some(plugin => plugin.value === this.view.type && plugin.render === this.view.render)
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
const isPlugin = this.isPlugin
return { type, render, isPlugin }
}
},
watch: {
@ -657,10 +662,11 @@ export default {
// this.view.isPlugin = val && this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(val)
// },
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
this.view.isPlugin = newVal.isPlugin
// if (newVal.type === oldVal.type && newVal.render === oldVal.render && newVal.isPlugin === oldVal.isPlugin) {
// return
// }
// this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
}
},

View File

@ -1996,9 +1996,14 @@ export default {
!equalsAny(this.view.type, 'liquid', 'bidirectional-bar',
'word-cloud', 'table-pivot', 'label', 'richTextView', 'flow-map')
},
isPlugin() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
return plugins.some(plugin => plugin.value === this.view.type && plugin.render === this.view.render)
},
watchChartTypeChangeObj() {
const { type, render } = this.view
return { type, render }
const isPlugin = this.isPlugin
return { type, render, isPlugin }
},
...mapState([
'curComponent',
@ -2036,10 +2041,12 @@ export default {
this.$emit('typeChange', newVal)
},
watchChartTypeChangeObj(newVal, oldVal) {
if (newVal.type === oldVal.type && newVal.render === oldVal.render) {
this.view.isPlugin = newVal.isPlugin
if (newVal.type === oldVal.type && newVal.render === oldVal.render && newVal.isPlugin === oldVal.isPlugin) {
return
}
this.view.isPlugin = this.$refs['cu-chart-type'] && this.$refs['cu-chart-type'].currentIsPlugin(newVal.type, newVal.render)
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
}
},
created() {
@ -3317,12 +3324,14 @@ export default {
this.$store.commit('recordViewEdit', { viewId: this.param.id, hasEdit: status })
},
changeChartRender() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, false, true)
// watchChartTypeChangeObj
// this.setChartDefaultOptions()
// this.calcData(true, 'chart', true, false, true)
},
changeChartType() {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, true)
// watchChartTypeChangeObj
// this.setChartDefaultOptions()
// this.calcData(true, 'chart', true, true)
},
setChartDefaultOptions() {