diff --git a/project/biaopin/dv/weiyang/AppDvWeiyang.vue b/project/biaopin/dv/weiyang/AppDvWeiyang.vue
index b3c3be32..78e59e64 100644
--- a/project/biaopin/dv/weiyang/AppDvWeiyang.vue
+++ b/project/biaopin/dv/weiyang/AppDvWeiyang.vue
@@ -521,6 +521,7 @@ export default {
chart: {aiTrend, workChain, residentDistribution, spDistribution, wotDistribution, integralOrder, residentGroupTrend},
chartData: {},
tableData: {},
+ mapOps: {}
}
},
computed: {
@@ -685,7 +686,7 @@ export default {
}
})
},
- renderMap(areaId) {
+ renderMap(areaId, cb) {
const mapGeo = this.$copy(weiyang)
let scatters = []
if (areaId) {
@@ -698,33 +699,32 @@ export default {
})
}
this.$nextTick(() => {
- this.$load(this.chart.map).then(() => {
- const options = this.$refs.map.handleMapOps(mapGeo, {
- geo: {label: {show: false}},
- series: {
- type: 'effectScatter', coordinateSystem: 'geo', itemStyle: {color: '#4DF6FF'},
- select: {itemStyle: {color: '#FFC800'}},
- data: scatters, label: {
- position: 'bottom', color: '#fff', fontSize: 12,
- show: true, formatter: params => {
- return params.name
- }
+ const options = this.$refs.map.handleMapOps(mapGeo, {
+ geo: {label: {show: false}},
+ series: {
+ type: 'effectScatter', coordinateSystem: 'geo', itemStyle: {color: '#4DF6FF'},
+ select: {itemStyle: {color: '#FFC800'}},
+ data: scatters, label: {
+ position: 'bottom', color: '#fff', fontSize: 12,
+ show: true, formatter: params => {
+ return params.name
}
- },
- tooltip: {
- position: 'top',
- backgroundColor: "rgba(11,42,64,0.6)", textStyle: {color: '#fff'}, formatter: params => {
- const {name, areaId} = params.data
- const item = this.chartData.mapInfo.find(e => e.areaId == areaId) || {}
- return `
+ }
+ },
+ tooltip: {
+ position: 'top',
+ backgroundColor: "rgba(11,42,64,0.6)", textStyle: {color: '#fff'}, formatter: params => {
+ const {name, areaId} = params.data
+ const item = this.chartData.mapInfo.find(e => e.areaId == areaId) || {}
+ return `
${name}
${["mapResidentCount", "mapResidentGroupCount", "mapWorkOrderCount"].map(prop => `
${this.getLabel(prop)} ${item[prop] || 0}
`).join("")}
`
- }
}
- })
- this.chart.map.setOption(options)
- })
+ }
+ }, true)
+ if (cb) cb(mapGeo, options)
+ else this.chart.map.setOption(options)
})
},
handleBack() {
@@ -735,7 +735,10 @@ ${["mapResidentCount", "mapResidentGroupCount", "mapWorkOrderCount"].map(prop =>
this.renderMap()
} else if (lv == 4) {
this.areaId = Area.getAreaCodeByLevel(areaCode, lv - 1)
- this.renderMap(this.areaId)
+ this.renderMap(this.areaId, (geo, ops) => {
+ this.map = geo
+ this.mapOps = ops
+ })
}
}
},
@@ -843,7 +846,7 @@ ${["mapResidentCount", "mapResidentGroupCount", "mapWorkOrderCount"].map(prop =>
-
+
返回上一级
diff --git a/ui/packages/tools/AiEchartMap.vue b/ui/packages/tools/AiEchartMap.vue
index 07f12ace..ac1b9373 100644
--- a/ui/packages/tools/AiEchartMap.vue
+++ b/ui/packages/tools/AiEchartMap.vue
@@ -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)}`)