修复村返回镇时,地图数据的刷新
This commit is contained in:
@@ -33,7 +33,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
chart: null,
|
||||
geo: null
|
||||
geo: null,
|
||||
timer: null
|
||||
}
|
||||
},
|
||||
directives: {
|
||||
@@ -82,7 +83,11 @@ export default {
|
||||
}
|
||||
return Promise.all([getGeo])
|
||||
},
|
||||
handleMapOps(geoJson, ops) {
|
||||
handleMapOps(geoJson, ops, stopInit = false) {
|
||||
if (stopInit) {
|
||||
clearTimeout(this.timer)
|
||||
this.chart?.hideLoading()
|
||||
}
|
||||
const {echarts, turf} = window
|
||||
const boundary = geoJson.features?.length > 1 ? turf.union(geoJson) : this.$copy(geoJson.features[0])
|
||||
boundary.properties = {...boundary.properties}
|
||||
@@ -115,12 +120,14 @@ export default {
|
||||
text: "数据加载中...", textColor: "#fff",
|
||||
maskColor: 'rgba(0, 0, 0, 0.2)'
|
||||
})
|
||||
this.loadLibs().then(() => {
|
||||
this.chart.setOption(this.handleMapOps(this.geo, this.ops))
|
||||
}).finally(() => {
|
||||
this.$emit('map', this.chart)
|
||||
this.chart.hideLoading()
|
||||
})
|
||||
this.$emit('map', this.chart)
|
||||
this.timer = setTimeout(() => {
|
||||
this.loadLibs().then(() => {
|
||||
this.chart.setOption(this.handleMapOps(this.geo, this.ops))
|
||||
}).finally(() => {
|
||||
this.chart.hideLoading()
|
||||
})
|
||||
}, 1000)
|
||||
},
|
||||
getData(url = `https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=${this.user.info.areaId?.substring(0, 6)}`) {
|
||||
return http.post(`/app/appdvcpconfig/apiForward?url=${encodeURIComponent(url)}`)
|
||||
|
||||
Reference in New Issue
Block a user