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