fix: 监听图表type或render变化逻辑错误

This commit is contained in:
ulleo 2023-11-07 11:55:22 +08:00
parent 57ffac98e1
commit 5ec6823c61

View File

@ -2147,31 +2147,34 @@ export default {
},
watchChartTypeChangeObj(newVal, oldVal) {
this.view.isPlugin = newVal.isPlugin
if (newVal.id === oldVal.id && newVal.type !== oldVal.type && oldVal.type === 'table-info' && this.view.xaxis.length > 0) {
//
this.$message({
showClose: true,
message: this.$t('chart.table_info_switch'),
type: 'warning'
})
this.view.xaxis = []
}
if (newVal.id === oldVal.id && newVal.type !== oldVal.type) {
this.view.senior.threshold = {}
}
if (newVal.type === oldVal.type && newVal.render === oldVal.render && newVal.isPlugin === oldVal.isPlugin) {
return
}
if (newVal.render === 'antv' && newVal.type === 'chart-mix') {
// antv
this.view.xaxis.forEach(x => {
x.customSort = []
x.sort = 'none'
})
}
if (oldVal.id !== 'echart') {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
// render
if (newVal.id === oldVal.id) {
if (newVal.type !== oldVal.type && oldVal.type === 'table-info' && this.view.xaxis.length > 0) {
//
this.$message({
showClose: true,
message: this.$t('chart.table_info_switch'),
type: 'warning'
})
this.view.xaxis = []
}
if (newVal.type !== oldVal.type) {
this.view.senior.threshold = {}
}
if (newVal.render === 'antv' && newVal.type === 'chart-mix') {
// antv
this.view.xaxis.forEach(x => {
x.customSort = []
x.sort = 'none'
})
}
if (newVal.type !== oldVal.type || newVal.render !== oldVal.render) {
this.setChartDefaultOptions()
this.calcData(true, 'chart', true, newVal.type !== oldVal.type, newVal.render !== oldVal.render)
}
}
}
},