diff --git a/packages/grid/AppGridMap/components/list.vue b/packages/grid/AppGridMap/components/list.vue index df6ea79d..c70d9050 100644 --- a/packages/grid/AppGridMap/components/list.vue +++ b/packages/grid/AppGridMap/components/list.vue @@ -103,24 +103,7 @@ export default { getTreeList() { this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => { if (res?.data) { - this.$nextTick(() => { - this.$refs.tree.setCurrentKey(res.data.id) - }) - - this.treeObj.treeList = res.data.filter(e => !e.parentGirdId) - const parentGirdId = this.treeObj.treeList[0].id - - this.treeObj.treeList.map(p => this.addChild(p, res.data.map(v => { - if (v.id === parentGirdId) { - this.treeObj.defaultExpandedKeys.push(v.id) - } - - return { - ...v - } - }), { - parent: 'parentGirdId' - })) + this.treeObj.treeList = this.$arr2tree(res.data,{parent:"parentGirdId"}) this.getLeafNodes() } }); @@ -128,7 +111,7 @@ export default { onMapInit() { this.instance.post("/app/appdvcpconfig/getCorpLocation").then(res => { - if (res.code === 0) { + if (res?.data) { this.map.setCenter(new this.mapLib.LatLng(res.data.lat, res.data.lng)) } }) @@ -144,7 +127,6 @@ export default { points: v.points ? v.points.map(p => [p.lng, p.lat]) : [] } }).filter(v => v.points.length) - this.renderGridMap(arr) } })