BUG 30074
This commit is contained in:
@@ -65,43 +65,14 @@ export default {
|
||||
created() {
|
||||
this.$dict.load('girdType')
|
||||
this.areaId = this.user.areaId
|
||||
// this.getLeafNodes()
|
||||
uni.$on('goback', e => {
|
||||
this.getGridList(e.id, true)
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
document.title = "网格管理"
|
||||
},
|
||||
|
||||
methods: {
|
||||
toChoose () {
|
||||
uni.navigateTo({
|
||||
url: './SelectGird?isFormMap=1'
|
||||
})
|
||||
},
|
||||
getLeafNodes() {
|
||||
this.$http.post(`/app/appgirdinfo/queryGirdMemberGirdsById`).then((res) => {
|
||||
if (res?.data) {
|
||||
this.treeList = res.data
|
||||
|
||||
const arr = res.data.filter(v => v.points).map(e => {
|
||||
return {
|
||||
id: e.id,
|
||||
girdName: e.girdName,
|
||||
points: e.points.map(p => [p.lng, p.lat])
|
||||
}
|
||||
})
|
||||
|
||||
arr.length > 0 && this.renderGridMap(arr)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getGridList(id) {
|
||||
this.$loading()
|
||||
this.$http.post(`/app/appgirdinfo/queryChildGirdInfoByGirdId?girdId=${id}`).then((res) => {
|
||||
this.$hideLoading()
|
||||
if (res?.data) {
|
||||
const arr = res.data.map(v => {
|
||||
return {
|
||||
@@ -112,11 +83,10 @@ export default {
|
||||
})
|
||||
this.renderGridMap(arr)
|
||||
}
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.$hideLoading()
|
||||
})
|
||||
},
|
||||
|
||||
getGridInfo(id, flag) {
|
||||
this.$loading()
|
||||
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${id}`).then((res) => {
|
||||
@@ -142,7 +112,6 @@ export default {
|
||||
this.$hideLoading()
|
||||
})
|
||||
},
|
||||
|
||||
renderGridMap(paths, count = 0) {
|
||||
let {map, lib: TMap, $refs: {AiTMap: {fitBounds}}} = this
|
||||
if (TMap) {
|
||||
@@ -157,9 +126,8 @@ export default {
|
||||
}
|
||||
if (paths?.length > 0) {
|
||||
let bounds = []
|
||||
|
||||
paths.forEach((path, i) => {
|
||||
let color = colors[i % colors.length]
|
||||
if(path.points?.length>0){
|
||||
let polygon = new TMap.MultiPolygon({
|
||||
map, styles: {
|
||||
default: new TMap.PolygonStyle({
|
||||
@@ -174,16 +142,12 @@ export default {
|
||||
})
|
||||
this.polygons.push(polygon)
|
||||
bounds.push(fitBounds(path.points.map(e => new TMap.LatLng(e[1], e[0]))))
|
||||
|
||||
polygon.on('click', e => {
|
||||
const id = e.target.id
|
||||
this.getGridInfo(id)
|
||||
})
|
||||
|
||||
const points = path.points.map(e => new TMap.LatLng(e[1], e[0]))
|
||||
|
||||
var position = TMap.geometry.computeCentroid(points)
|
||||
|
||||
const position = TMap.geometry.computeCentroid(points)
|
||||
let label = new TMap.MultiLabel({
|
||||
id: `label~${path.id}`,
|
||||
data: path.id,
|
||||
@@ -200,7 +164,7 @@ export default {
|
||||
{
|
||||
id: `label-class-${i}`,
|
||||
styleId: 'building',
|
||||
position: position,
|
||||
position,
|
||||
content: path.girdName,
|
||||
}
|
||||
]
|
||||
@@ -209,6 +173,7 @@ export default {
|
||||
label.on('click', e => {
|
||||
this.getGridInfo(e.target.id.split('~')[1])
|
||||
});
|
||||
}
|
||||
})
|
||||
bounds = bounds.reduce((a, b) => {
|
||||
return fitBounds([
|
||||
@@ -234,16 +199,9 @@ export default {
|
||||
callPhone(phone) {
|
||||
uni.makePhoneCall({phoneNumber: phone})
|
||||
},
|
||||
handleSelect(e) {
|
||||
if (e?.points?.length > 0) {
|
||||
this.form = e
|
||||
const points = e.points.map(e => new TMap.LatLng(e.lat, e.lng))
|
||||
var position = TMap.geometry.computeCentroid(points)
|
||||
this.map.setCenter(position)
|
||||
this.map.setZoom(18)
|
||||
} else {
|
||||
this.$u.toast("所选网格没有标绘!")
|
||||
}
|
||||
handleSelectGird(v) {
|
||||
this.form = v || {}
|
||||
this.getGridList(v?.id, true)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user