网格管理员
@@ -74,9 +83,10 @@ export default {
if (res?.data) {
this.treeList = res.data
- const arr = res.data.map(e => {
+ 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])
}
})
@@ -111,8 +121,8 @@ export default {
}
if (paths?.length > 0) {
let bounds = []
+
paths.forEach((path, i) => {
- console.log(path)
let color = colors[i % colors.length]
let polygon = new TMap.MultiPolygon({
map, styles: {
@@ -135,10 +145,33 @@ export default {
})
const points = path.points.map(e => new TMap.LatLng(e[1], e[0]))
-
- // console.log(TMap)
- // var position = TMap.geometry.computeCentroid(points)
+ var position = TMap.geometry.computeCentroid(points)
+
+ let label = new TMap.MultiLabel({
+ id: `label~${path.id}`,
+ data: path.id,
+ map: map,
+ styles: {
+ building: new TMap.LabelStyle({
+ color: '#3777FF',
+ size: 20,
+ alignment: 'center',
+ verticalAlignment: 'middle'
+ })
+ },
+ geometries: [
+ {
+ id: `label-class-${i}`,
+ styleId: 'building',
+ position: position,
+ content: path.girdName,
+ }
+ ]
+ })
+ label.on('click', e => {
+ this.getGridInfo(e.target.id.split('~')[1])
+ });
})
bounds = bounds.reduce((a, b) => {
return fitBounds([
@@ -166,9 +199,10 @@ export default {
},
handleSelect(e) {
if (e?.points?.length > 0) {
- this.form = e
- let path = e.points?.map(p => [p.lng, p.lat]) || []
- this.renderGridMap([path])
+ 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(15)
} else {
this.$u.toast("所选网格没有标绘!")
}
diff --git a/src/components/AiTMap.vue b/src/components/AiTMap.vue
index c1e3165f..ada7504e 100644
--- a/src/components/AiTMap.vue
+++ b/src/components/AiTMap.vue
@@ -57,7 +57,6 @@ export default {
center: new TMap.LatLng(this.config.lat, this.config.lng),
...this.ops
})
- console.log(TMap)
this.$emit('loaded')
this.$emit('update:lib', TMap)
this.$emit('update:map', this.tmap)
From 9387e1416b3d50d7f8eb7612a7de794625cf3745 Mon Sep 17 00:00:00 2001
From: shijingjing <1789544664@qq.com>
Date: Fri, 14 Jan 2022 16:08:53 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E6=BC=8F=E4=BA=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/apps/AppGridManagement/AddFamily.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/apps/AppGridManagement/AddFamily.vue b/src/apps/AppGridManagement/AddFamily.vue
index 926c25b3..c24d2767 100644
--- a/src/apps/AppGridManagement/AddFamily.vue
+++ b/src/apps/AppGridManagement/AddFamily.vue
@@ -23,7 +23,7 @@
{{item.phone}}
{{item.idNumber && item.idNumber.replace(/(.{6}).*(.{4})/,"$1********$2")}}
-
{{item.householdAddress}}
+
{{item.currentAreaName || '' + item.currentAddress}}