fix: 增加下钻方法返回值

This commit is contained in:
fit2cloud-chenyw 2021-08-16 11:03:13 +08:00
parent 6b1abd07f8
commit 10a4b2cefa
2 changed files with 8 additions and 2 deletions

View File

@ -166,24 +166,28 @@ export default {
this.myEcharts(chart_option) this.myEcharts(chart_option)
}, },
registerDynamicMap(areaCode) { registerDynamicMap(areaCode) {
if (this.$store.getters.geoMap[areaCode]) {
this.downOrUp = true this.downOrUp = true
if (this.$store.getters.geoMap[areaCode]) {
const json = this.$store.getters.geoMap[areaCode] const json = this.$store.getters.geoMap[areaCode]
this.$echarts.registerMap('MAP', json) this.$echarts.registerMap('MAP', json)
console.log('开始切换地图:' + areaCode)
return return
} }
geoJson(areaCode).then(res => { geoJson(areaCode).then(res => {
this.downOrUp = true
this.$echarts.registerMap('MAP', res) this.$echarts.registerMap('MAP', res)
console.log('开始切换地图:' + areaCode)
this.$store.dispatch('map/setGeo', { this.$store.dispatch('map/setGeo', {
key: areaCode, key: areaCode,
value: res value: res
}) })
}).catch(() => {
this.downOrUp = true
}) })
}, },
initMapChart(geoJson, chart) { initMapChart(geoJson, chart) {
if (!this.$echarts.getMap('MAP') || !this.downOrUp) { 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) // this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)

View File

@ -1457,9 +1457,11 @@ export default {
const currentNode = this.findEntityByCode(aCode || this.view.customAttr.areaCode, this.places) const currentNode = this.findEntityByCode(aCode || this.view.customAttr.areaCode, this.places)
if (currentNode && currentNode.children && currentNode.children.length > 0) { if (currentNode && currentNode.children && currentNode.children.length > 0) {
const nextNode = currentNode.children.find(item => item.name === name) const nextNode = currentNode.children.find(item => item.name === name)
if (!nextNode || !nextNode.code) return null
// this.view.customAttr.areaCode = nextNode.code // this.view.customAttr.areaCode = nextNode.code
this.currentAcreaNode = nextNode this.currentAcreaNode = nextNode
this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code) this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code)
return nextNode
} }
}, },
// areaCode // areaCode