forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
ede4ebded2
@ -296,6 +296,8 @@ export default {
|
|||||||
this.drillClickDimensionList = []
|
this.drillClickDimensionList = []
|
||||||
if (this.chart.type === 'map') {
|
if (this.chart.type === 'map') {
|
||||||
this.backToParent(0, length)
|
this.backToParent(0, length)
|
||||||
|
const current = this.$refs[this.element.propValue.id]
|
||||||
|
current && current.registerDynamicMap && current.registerDynamicMap(null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
myChart: {},
|
myChart: {},
|
||||||
chartId: uuid.v1(),
|
chartId: uuid.v1(),
|
||||||
currentGeoJson: null,
|
|
||||||
showTrackBar: true,
|
showTrackBar: true,
|
||||||
trackBarStyle: {
|
trackBarStyle: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@ -57,7 +56,7 @@ export default {
|
|||||||
},
|
},
|
||||||
pointParam: null,
|
pointParam: null,
|
||||||
|
|
||||||
downOrUp: false
|
dynamicAreaCode: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -144,52 +143,50 @@ export default {
|
|||||||
if (chart.type === 'map') {
|
if (chart.type === 'map') {
|
||||||
const customAttr = JSON.parse(chart.customAttr)
|
const customAttr = JSON.parse(chart.customAttr)
|
||||||
if (!customAttr.areaCode) return
|
if (!customAttr.areaCode) return
|
||||||
|
const cCode = this.dynamicAreaCode || customAttr.areaCode
|
||||||
if (this.$store.getters.geoMap[customAttr.areaCode]) {
|
if (this.$store.getters.geoMap[cCode]) {
|
||||||
const json = this.$store.getters.geoMap[customAttr.areaCode]
|
const json = this.$store.getters.geoMap[cCode]
|
||||||
this.initMapChart(json, chart)
|
this.initMapChart(json, chart)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
geoJson(customAttr.areaCode).then(res => {
|
geoJson(cCode).then(res => {
|
||||||
this.initMapChart(res, chart)
|
|
||||||
|
|
||||||
this.$store.dispatch('map/setGeo', {
|
this.$store.dispatch('map/setGeo', {
|
||||||
key: customAttr.areaCode,
|
key: cCode,
|
||||||
value: res
|
value: res
|
||||||
// value: res.data
|
}).then(() => {
|
||||||
|
this.initMapChart(res, chart)
|
||||||
})
|
})
|
||||||
this.currentGeoJson = res
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.myEcharts(chart_option)
|
this.myEcharts(chart_option)
|
||||||
},
|
},
|
||||||
registerDynamicMap(areaCode) {
|
registerDynamicMap(areaCode) {
|
||||||
this.downOrUp = true
|
this.dynamicAreaCode = areaCode
|
||||||
if (this.$store.getters.geoMap[areaCode]) {
|
// 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.myChart.dispose()
|
||||||
console.log('开始切换地图:' + areaCode)
|
// this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
|
||||||
return
|
// this.$echarts.registerMap('MAP', json)
|
||||||
}
|
// return
|
||||||
geoJson(areaCode).then(res => {
|
// }
|
||||||
this.$echarts.registerMap('MAP', res)
|
// geoJson(areaCode).then(res => {
|
||||||
console.log('开始切换地图:' + areaCode)
|
// this.$store.dispatch('map/setGeo', {
|
||||||
this.$store.dispatch('map/setGeo', {
|
// key: areaCode,
|
||||||
key: areaCode,
|
// value: res
|
||||||
value: res
|
// }).then(() => {
|
||||||
})
|
// this.myChart.dispose()
|
||||||
}).catch(() => {
|
// this.myChart = this.$echarts.getInstanceByDom(document.getElementById(this.chartId))
|
||||||
this.downOrUp = true
|
// this.$echarts.registerMap('MAP', res)
|
||||||
})
|
// })
|
||||||
|
// }).catch(() => {
|
||||||
|
// this.downOrUp = true
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
|
|
||||||
initMapChart(geoJson, chart) {
|
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)
|
// this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
|
||||||
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
|
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
|
||||||
const chart_option = baseMapOption(base_json, chart)
|
const chart_option = baseMapOption(base_json, chart)
|
||||||
|
@ -1425,6 +1425,7 @@ export default {
|
|||||||
if (this.chart.type === 'map') {
|
if (this.chart.type === 'map') {
|
||||||
this.backToParent(0, length)
|
this.backToParent(0, length)
|
||||||
this.currentAcreaNode = null
|
this.currentAcreaNode = null
|
||||||
|
this.$refs.dynamicChart && this.$refs.dynamicChart.registerDynamicMap && this.$refs.dynamicChart.registerDynamicMap(null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
drillJump(index) {
|
drillJump(index) {
|
||||||
|
Loading…
Reference in New Issue
Block a user