This commit is contained in:
liuye
2022-02-11 10:46:14 +08:00
parent 19329ff652
commit 3b7332a998
2 changed files with 22 additions and 8 deletions

View File

@@ -63,7 +63,8 @@ export default {
showSelect: false,
editor: null,
polygons: [],
labels: []
labels: [],
latLngCenter: [], //中心点
}
},
computed: {...mapState(['user', 'config'])},
@@ -78,6 +79,7 @@ export default {
// }, 400)
// return false
}
this.form.girdName = e.girdName
this.getGridList(e.id, true)
})
},
@@ -114,14 +116,23 @@ export default {
this.$http.post(`/app/appgirdinfo/queryChildGirdInfoByGirdId?girdId=${id}`).then((res) => {
this.$hideLoading()
if (res?.data) {
const arr = res.data.map(v => {
return {
id: v.id,
girdName: v.girdName,
points: v.points ? v.points.map(p => [p.lng, p.lat]) : []
const arr = []
res.data.map(v => {
if(v.points) {
arr.push(
{
id: v.id,
girdName: v.girdName,
points: v.points ? v.points.map(p => [p.lng, p.lat]) : []
}
)
if(this.latLngCenter.length) {
return
}else {
this.latLngCenter.push(v.points[0].lat, v.points[0].lng)
}
}
})
this.renderGridMap(arr)
}
}).catch(() => {
@@ -159,6 +170,10 @@ export default {
console.log(paths)
let {map, lib: TMap, $refs: {AiTMap: {fitBounds}}} = this
if (TMap) {
if(this.latLngCenter.length) {
map.setCenter(this.latLngCenter)
this.map.setZoom(14)
}
const colors = ["#A194F4", "#7CBDF3", "#F3A57D", "#62D063", "#58DBDA", "#F7D151"]
if (this.polygons.length > 0) {
this.polygons.forEach(e => e.destroy())