提交 fa49b276 authored 作者: wangjiahao's avatar wangjiahao

refactor: 自定义颜色设置优化

上级 488044bd
...@@ -545,14 +545,7 @@ export default { ...@@ -545,14 +545,7 @@ export default {
// 将视图传入echart组件 // 将视图传入echart组件
if (response.success) { if (response.success) {
this.chart = response.data this.chart = response.data
if (this.isEdit) { this.getDataOnly(response.data)
this.componentViewsData[this.chart.id] = {
'title': this.chart.title,
'render': this.chart.render,
'type': this.chart.type,
'isPlugin': this.chart.isPlugin
}
}
this.chart['position'] = this.inTab ? 'tab' : 'panel' this.chart['position'] = this.inTab ? 'tab' : 'panel'
// 记录当前数据 // 记录当前数据
this.panelViewDetailsInfo[id] = JSON.stringify(this.chart) this.panelViewDetailsInfo[id] = JSON.stringify(this.chart)
...@@ -609,7 +602,6 @@ export default { ...@@ -609,7 +602,6 @@ export default {
tableChart.customStyle = JSON.stringify(tableChart.customStyle) tableChart.customStyle = JSON.stringify(tableChart.customStyle)
eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart }) eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart })
}, },
chartClick(param) { chartClick(param) {
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) { if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
(this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param) (this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param)
...@@ -863,6 +855,21 @@ export default { ...@@ -863,6 +855,21 @@ export default {
} }
this.mergeScale() 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
}
}
} }
} }
} }
......
...@@ -1191,7 +1191,7 @@ export default { ...@@ -1191,7 +1191,7 @@ export default {
return this.chartConfig ? this.chartConfig.propertyInner : null return this.chartConfig ? this.chartConfig.propertyInner : null
}, },
chartType() { chartType() {
return this.chart.type return this.chart ? this.chart.type : null
}, },
panelInfo() { panelInfo() {
return this.$store.state.panel.panelInfo return this.$store.state.panel.panelInfo
...@@ -1199,7 +1199,8 @@ export default { ...@@ -1199,7 +1199,8 @@ export default {
...mapState([ ...mapState([
'curComponent', 'curComponent',
'panelViewEditInfo', 'panelViewEditInfo',
'allViewRender' 'allViewRender',
'componentViewsData'
]) ])
/* pluginRenderOptions() { /* pluginRenderOptions() {
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || [] const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || []
...@@ -1238,6 +1239,9 @@ export default { ...@@ -1238,6 +1239,9 @@ export default {
} }
}, },
created() { created() {
this.bindPluginEvent()
this.initFromPanel()
this.chartInit()
const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views'))
if (plugins) { if (plugins) {
this.loadPluginType() this.loadPluginType()
...@@ -1253,9 +1257,6 @@ export default { ...@@ -1253,9 +1257,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.bindPluginEvent()
this.initFromPanel()
this.chartInit()
}, },
activated() { activated() {
}, },
...@@ -1282,7 +1283,9 @@ export default { ...@@ -1282,7 +1283,9 @@ export default {
this.resetDrill() this.resetDrill()
this.initFromPanel() this.initFromPanel()
this.getChart(this.param.id) this.getChart(this.param.id)
this.getData(this.param.id) if (this.componentViewsData[this.param.id]) {
this.chart = this.componentViewsData[this.param.id]
}
}, },
bindPluginEvent() { bindPluginEvent() {
bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter) bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter)
...@@ -1599,7 +1602,7 @@ export default { ...@@ -1599,7 +1602,7 @@ export default {
const view = this.buildParam(true, 'chart', false, switchType) const view = this.buildParam(true, 'chart', false, switchType)
if (!view) return if (!view) return
viewEditSave(this.panelInfo.id, view).then(() => { 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 }) bus.$emit('view-in-cache', { type: 'propChange', viewId: this.param.id })
}) })
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论