diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index e0b487b5f7..8a78a069d7 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -166,24 +166,28 @@ export default { this.myEcharts(chart_option) }, registerDynamicMap(areaCode) { + this.downOrUp = true if (this.$store.getters.geoMap[areaCode]) { - this.downOrUp = true const json = this.$store.getters.geoMap[areaCode] this.$echarts.registerMap('MAP', json) + console.log('开始切换地图:' + areaCode) return } geoJson(areaCode).then(res => { - this.downOrUp = true this.$echarts.registerMap('MAP', res) + console.log('开始切换地图:' + areaCode) this.$store.dispatch('map/setGeo', { key: areaCode, value: res }) + }).catch(() => { + this.downOrUp = true }) }, initMapChart(geoJson, chart) { if (!this.$echarts.getMap('MAP') || !this.downOrUp) { + console.log('开始初始化地图:') this.$echarts.registerMap('MAP', geoJson) } // this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 70ac9bd746..abf33cb007 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1457,9 +1457,11 @@ export default { const currentNode = this.findEntityByCode(aCode || this.view.customAttr.areaCode, this.places) if (currentNode && currentNode.children && currentNode.children.length > 0) { const nextNode = currentNode.children.find(item => item.name === name) + if (!nextNode || !nextNode.code) return null // this.view.customAttr.areaCode = nextNode.code this.currentAcreaNode = nextNode this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(nextNode.code) + return nextNode } }, // 根据地名获取areaCode