This commit is contained in:
yanran200730
2022-01-17 18:19:15 +08:00
parent a533a2c845
commit 661c393ab3

View File

@@ -62,6 +62,7 @@ export default {
}, },
defaultExpandedKeys: [], defaultExpandedKeys: [],
}, },
ops: {},
path: [], path: [],
searchObj: { searchObj: {
@@ -73,6 +74,7 @@ export default {
}, },
infoWindowHtml: "", infoWindowHtml: "",
marker: {}, marker: {},
location: {},
activeId: null, activeId: null,
}; };
}, },
@@ -84,6 +86,7 @@ export default {
this.getTreeList().then(() => { this.getTreeList().then(() => {
this.getLeafNodes() this.getLeafNodes()
}) })
this.getCorpLocation()
}, },
watch: { watch: {
filterText(val) { filterText(val) {
@@ -102,6 +105,13 @@ export default {
} }
}) })
}, },
getCorpLocation(){
this.instance.post("/app/appdvcpconfig/getCorpLocation").then(res=>{
if(res.code==0){
this.location = res.data
}
})
},
getLeafNodes() { getLeafNodes() {
this.instance.post(`/app/appgirdinfo/listAll2`).then((res) => { this.instance.post(`/app/appgirdinfo/listAll2`).then((res) => {
if (res?.data) { if (res?.data) {
@@ -111,7 +121,7 @@ export default {
arr.push(e.points.map(p => [p.lng, p.lat])) arr.push(e.points.map(p => [p.lng, p.lat]))
} }
}) })
this.renderGridMap(arr) this.renderGridMap(arr, true)
} }
}) })
}, },
@@ -124,9 +134,12 @@ export default {
this.$message.error("所选网格没有标绘!") this.$message.error("所选网格没有标绘!")
} }
}, },
renderGridMap(paths) { renderGridMap(paths, flag) {
let {map, mapLib: TMap, retryMapCount} = this let {map, mapLib: TMap, retryMapCount} = this
if (TMap) { if (TMap) {
setTimeout(() => {
flag && map.setCenter(new TMap.LatLng(this.location.lat, this.location.lng))
}, 400)
const colors = ["#A194F4", "#7CBDF3", "#F3A57D", "#62D063", "#58DBDA", "#F7D151"] const colors = ["#A194F4", "#7CBDF3", "#F3A57D", "#62D063", "#58DBDA", "#F7D151"]
const fitBounds = (latLngList) => { const fitBounds = (latLngList) => {
// 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围 // 由多边形顶点坐标数组计算能完整呈现该多边形的最小矩形范围