Merge branch 'dev' of github.com:dataease/dataease into dev

This commit is contained in:
taojinlong 2021-08-16 14:09:23 +08:00
commit ede4ebded2
3 changed files with 32 additions and 32 deletions

View File

@ -296,6 +296,8 @@ export default {
this.drillClickDimensionList = []
if (this.chart.type === 'map') {
this.backToParent(0, length)
const current = this.$refs[this.element.propValue.id]
current && current.registerDynamicMap && current.registerDynamicMap(null)
}
},

View File

@ -48,7 +48,6 @@ export default {
return {
myChart: {},
chartId: uuid.v1(),
currentGeoJson: null,
showTrackBar: true,
trackBarStyle: {
position: 'absolute',
@ -57,7 +56,7 @@ export default {
},
pointParam: null,
downOrUp: false
dynamicAreaCode: null
}
},
@ -144,52 +143,50 @@ export default {
if (chart.type === 'map') {
const customAttr = JSON.parse(chart.customAttr)
if (!customAttr.areaCode) return
if (this.$store.getters.geoMap[customAttr.areaCode]) {
const json = this.$store.getters.geoMap[customAttr.areaCode]
const cCode = this.dynamicAreaCode || customAttr.areaCode
if (this.$store.getters.geoMap[cCode]) {
const json = this.$store.getters.geoMap[cCode]
this.initMapChart(json, chart)
return
}
geoJson(customAttr.areaCode).then(res => {
this.initMapChart(res, chart)
geoJson(cCode).then(res => {
this.$store.dispatch('map/setGeo', {
key: customAttr.areaCode,
key: cCode,
value: res
// value: res.data
}).then(() => {
this.initMapChart(res, chart)
})
this.currentGeoJson = res
})
return
}
this.myEcharts(chart_option)
},
registerDynamicMap(areaCode) {
this.downOrUp = true
if (this.$store.getters.geoMap[areaCode]) {
const json = this.$store.getters.geoMap[areaCode]
this.$echarts.registerMap('MAP', json)
console.log('开始切换地图:' + areaCode)
return
}
geoJson(areaCode).then(res => {
this.$echarts.registerMap('MAP', res)
console.log('开始切换地图:' + areaCode)
this.$store.dispatch('map/setGeo', {
key: areaCode,
value: res
})
}).catch(() => {
this.downOrUp = true
})
this.dynamicAreaCode = areaCode
// if (this.$store.getters.geoMap[areaCode]) {
// const json = this.$store.getters.geoMap[areaCode]
// this.myChart.dispose()
// this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
// this.$echarts.registerMap('MAP', json)
// return
// }
// geoJson(areaCode).then(res => {
// this.$store.dispatch('map/setGeo', {
// key: areaCode,
// value: res
// }).then(() => {
// this.myChart.dispose()
// this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
// this.$echarts.registerMap('MAP', res)
// })
// }).catch(() => {
// this.downOrUp = true
// })
},
initMapChart(geoJson, chart) {
if (!this.$echarts.getMap('MAP') || !this.downOrUp) {
console.log('开始初始化地图:')
this.$echarts.registerMap('MAP', geoJson)
}
this.$echarts.registerMap('MAP', geoJson)
// this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
const chart_option = baseMapOption(base_json, chart)

View File

@ -1425,6 +1425,7 @@ export default {
if (this.chart.type === 'map') {
this.backToParent(0, length)
this.currentAcreaNode = null
this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(null)
}
},
drillJump(index) {