forked from github/dataease
Merge pull request #2389 from dataease/pr@dev@feat_new-version
fix: 修复部分类型视图无法自定义颜色的问题
This commit is contained in:
commit
a7a37a5043
@ -524,7 +524,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getData(id, cache = true) {
|
getData(id, cache = true, dataBroadcast = false) {
|
||||||
if (id) {
|
if (id) {
|
||||||
this.requestStatus = 'waiting'
|
this.requestStatus = 'waiting'
|
||||||
this.message = null
|
this.message = null
|
||||||
@ -549,7 +549,7 @@ export default {
|
|||||||
// 将视图传入echart组件
|
// 将视图传入echart组件
|
||||||
if (response.success) {
|
if (response.success) {
|
||||||
this.chart = response.data
|
this.chart = response.data
|
||||||
this.getDataOnly(response.data)
|
this.getDataOnly(response.data, dataBroadcast)
|
||||||
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)
|
||||||
@ -845,7 +845,7 @@ export default {
|
|||||||
getDataEdit(param) {
|
getDataEdit(param) {
|
||||||
this.$store.state.styleChangeTimes++
|
this.$store.state.styleChangeTimes++
|
||||||
if (param.type === 'propChange') {
|
if (param.type === 'propChange') {
|
||||||
this.getData(param.viewId, false)
|
this.getData(param.viewId, false, true)
|
||||||
} else if (param.type === 'styleChange') {
|
} else if (param.type === 'styleChange') {
|
||||||
this.chart.customAttr = param.viewInfo.customAttr
|
this.chart.customAttr = param.viewInfo.customAttr
|
||||||
this.chart.customStyle = param.viewInfo.customStyle
|
this.chart.customStyle = param.viewInfo.customStyle
|
||||||
@ -860,7 +860,7 @@ export default {
|
|||||||
this.mergeScale()
|
this.mergeScale()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getDataOnly(sourceResponseData) {
|
getDataOnly(sourceResponseData, dataBroadcast) {
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) {
|
if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) {
|
||||||
viewData(this.chart.id, this.panelInfo.id, {
|
viewData(this.chart.id, this.panelInfo.id, {
|
||||||
@ -869,9 +869,15 @@ export default {
|
|||||||
queryFrom: 'panel'
|
queryFrom: 'panel'
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.componentViewsData[this.chart.id] = response.data
|
this.componentViewsData[this.chart.id] = response.data
|
||||||
|
if (dataBroadcast) {
|
||||||
|
bus.$emit('prop-change-data')
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.componentViewsData[this.chart.id] = sourceResponseData
|
this.componentViewsData[this.chart.id] = sourceResponseData
|
||||||
|
if (dataBroadcast) {
|
||||||
|
bus.$emit('prop-change-data')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,7 @@
|
|||||||
import { COLOR_PANEL, DEFAULT_COLOR_CASE } from '../../chart/chart'
|
import { COLOR_PANEL, DEFAULT_COLOR_CASE } from '../../chart/chart'
|
||||||
import { getColors } from '@/views/chart/chart/util'
|
import { getColors } from '@/views/chart/chart/util'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
|
import bus from '@/utils/bus'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ColorSelector',
|
name: 'ColorSelector',
|
||||||
@ -248,11 +249,15 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState([
|
...mapState([
|
||||||
'batchOptStatus'
|
'batchOptStatus',
|
||||||
|
'componentViewsData'
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init()
|
this.init()
|
||||||
|
bus.$on('prop-change-data', () => {
|
||||||
|
this.initCustomColor()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeColorOption(modifyName = 'value') {
|
changeColorOption(modifyName = 'value') {
|
||||||
@ -336,8 +341,10 @@ export default {
|
|||||||
this.chart.type === 'funnel' ||
|
this.chart.type === 'funnel' ||
|
||||||
this.chart.type === 'radar' ||
|
this.chart.type === 'radar' ||
|
||||||
this.chart.type === 'scatter')) {
|
this.chart.type === 'scatter')) {
|
||||||
const chart = JSON.parse(JSON.stringify(this.chart))
|
if (this.componentViewsData[this.chart.id]) {
|
||||||
this.colorForm.seriesColors = getColors(chart, this.colorForm.colors, reset)
|
const chart = JSON.parse(JSON.stringify(this.componentViewsData[this.chart.id]))
|
||||||
|
this.colorForm.seriesColors = getColors(chart, this.colorForm.colors, reset)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1199,8 +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')) || []
|
||||||
@ -1283,9 +1283,9 @@ export default {
|
|||||||
this.resetDrill()
|
this.resetDrill()
|
||||||
this.initFromPanel()
|
this.initFromPanel()
|
||||||
this.getChart(this.param.id)
|
this.getChart(this.param.id)
|
||||||
if (this.componentViewsData[this.param.id]) {
|
// if (this.componentViewsData[this.param.id]) {
|
||||||
this.chart = 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)
|
||||||
|
Loading…
Reference in New Issue
Block a user