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