Merge pull request #2354 from dataease/pr@dev@refactor_self-color

refactor: 自定义颜色设置优化
This commit is contained in:
王嘉豪 2022-05-30 17:09:27 +08:00 committed by GitHub
commit 2db9553acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 16 deletions

View File

@ -545,14 +545,7 @@ export default {
// echart
if (response.success) {
this.chart = response.data
if (this.isEdit) {
this.componentViewsData[this.chart.id] = {
'title': this.chart.title,
'render': this.chart.render,
'type': this.chart.type,
'isPlugin': this.chart.isPlugin
}
}
this.getDataOnly(response.data)
this.chart['position'] = this.inTab ? 'tab' : 'panel'
//
this.panelViewDetailsInfo[id] = JSON.stringify(this.chart)
@ -609,7 +602,6 @@ export default {
tableChart.customStyle = JSON.stringify(tableChart.customStyle)
eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart })
},
chartClick(param) {
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
(this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param)
@ -863,6 +855,21 @@ export default {
}
this.mergeScale()
}
},
getDataOnly(sourceResponseData) {
if (this.isEdit) {
if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) {
viewData(this.chart.id, this.panelInfo.id, {
filter: [],
drill: [],
queryFrom: 'panel'
}).then(response => {
this.componentViewsData[this.chart.id] = response.data
})
} else {
this.componentViewsData[this.chart.id] = sourceResponseData
}
}
}
}
}

View File

@ -1191,7 +1191,7 @@ export default {
return this.chartConfig ? this.chartConfig.propertyInner : null
},
chartType() {
return this.chart.type
return this.chart ? this.chart.type : null
},
panelInfo() {
return this.$store.state.panel.panelInfo
@ -1199,7 +1199,8 @@ export default {
...mapState([
'curComponent',
'panelViewEditInfo',
'allViewRender'
'allViewRender',
'componentViewsData'
])
/* pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
@ -1238,6 +1239,9 @@ export default {
}
},
created() {
this.bindPluginEvent()
this.initFromPanel()
this.chartInit()
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views'))
if (plugins) {
this.loadPluginType()
@ -1253,9 +1257,6 @@ export default {
}
},
mounted() {
this.bindPluginEvent()
this.initFromPanel()
this.chartInit()
},
activated() {
},
@ -1282,7 +1283,9 @@ export default {
this.resetDrill()
this.initFromPanel()
this.getChart(this.param.id)
this.getData(this.param.id)
if (this.componentViewsData[this.param.id]) {
this.chart = this.componentViewsData[this.param.id]
}
},
bindPluginEvent() {
bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter)
@ -1599,7 +1602,7 @@ export default {
const view = this.buildParam(true, 'chart', false, switchType)
if (!view) return
viewEditSave(this.panelInfo.id, view).then(() => {
this.getData(this.param.id)
// this.getData(this.param.id)
bus.$emit('view-in-cache', { type: 'propChange', viewId: this.param.id })
})
},