BUG 25642

This commit is contained in:
aixianling
2021-12-22 17:33:25 +08:00
parent c239b6aa04
commit 224caa595d

View File

@@ -92,6 +92,7 @@ export default {
created() { created() {
this.dict.load("onlineStatus") this.dict.load("onlineStatus")
this.getTreeList().then(() => { this.getTreeList().then(() => {
this.getLeafNodes()
}) })
}, },
watch: { watch: {
@@ -105,22 +106,24 @@ export default {
return data.girdName.indexOf(value) !== -1; return data.girdName.indexOf(value) !== -1;
}, },
getTreeList() { getTreeList() {
return this.instance.post(`/app/appgirdinfo/listAll`, null, null).then((res) => { return this.instance.post(`/app/appgirdinfo/listAll`).then((res) => {
if (res.code == 0) { if (res.code == 0) {
this.treeObj.treeList = res.data; this.treeObj.treeList = res.data;
} }
}) })
}, },
getLeafNodes(count) { getLeafNodes() {
let {tree} = this.$refs this.instance.post(`/app/appgirdinfo/listAll2`).then((res) => {
if (tree) { if (res?.data) {
} else { let arr = []
if (count < 5) { res.data.forEach(e => {
setTimeout(() => { if (e.points?.length > 0) {
this.getLeafNodes(++count) arr.push(e.points.map(p => [p.lng, p.lat]))
}, 1000) }
})
this.renderGridMap(arr)
} }
} })
}, },
handleNodeClick(val) { handleNodeClick(val) {
let path = []; let path = [];
@@ -132,15 +135,18 @@ export default {
renderGridMap(paths) { renderGridMap(paths) {
let {map, mapLib: AMap, retryMapCount} = this let {map, mapLib: AMap, retryMapCount} = this
if (AMap) { if (AMap) {
const colors = ["#A194F4", "#7CBDF3", "#F3A57D", "#62D063", "#58DBDA", "#F7D151"]
map.clearMap() map.clearMap()
paths.forEach(path => { paths.forEach((path, i) => {
this.polygon = new AMap.Polyline({ let color = colors[i % colors.length]
this.polygon = new AMap.Polygon({
path, path,
strokeColor: "#FF33FF", strokeColor: color,
strokeWeight: 6, strokeWeight: 2,
strokeStyle: "solid", strokeStyle: "dashed",
strokeOpacity: 1, strokeOpacity: 1,
fillColor: "#1791fc", fillColor: color,
fillOpacity: 0.1,
zIndex: 50, zIndex: 50,
lineJoin: "round", lineJoin: "round",
lineCap: "round", lineCap: "round",
@@ -322,7 +328,7 @@ export default {
& > b { & > b {
color: #fff; color: #fff;
font-size: 18px; font-size: 18px;
line-height: 76px; line-height: 60px;
} }
.tree { .tree {