ソースを参照

地图公司问题

Shannon_mu 2 年 前
コミット
5b73e2d42d

+ 13 - 9
commandCenter/src/components/common/Header.vue

@@ -91,7 +91,7 @@ export default {
         };
     },
     computed: {
-        ...mapState(['globalCommunity','thisArr']),
+        ...mapState(['globalCommunity', 'thisArr']),
         menuList() {
             return this.$store.getters['getMenuList'] || [];
         }
@@ -105,7 +105,7 @@ export default {
         // },
         thisArr: {
             handler(newVal, oldVal) {
-                this.communityValue =  this.$store.getters['getThisArr']
+                this.communityValue = this.$store.getters['getThisArr'];
             },
             deep: true
         }
@@ -167,14 +167,18 @@ export default {
             }
         },
         fitersValue(arrs, value) {
-            value.children.map((item) => {
-                if (item.type == 'org') {
-                    arrs.push(item);
-                    if (!!item.children) {
-                        this.fitersValue(arrs, item);
+            if (!!value.children) {
+                value.children.map((item) => {
+                    if (item.type == 'org') {
+                        arrs.push(item);
+                        if (!!item.children) {
+                            this.fitersValue(arrs, item);
+                        }
                     }
-                }
-            });
+                });
+            } else {
+                arrs.push(value);
+            }
         },
         communityNameList() {
             this.$http.get('/sc-community/assets/tree/community/findCompanyCommunityTree').then(({ data, msg, status }) => {

+ 6 - 5
commandCenter/src/views/commandDispatch/map.vue

@@ -51,8 +51,8 @@ export default {
         init() {
             this.map = new AMap.Map('mapInit', {
                 resizeEnable: true, //是否监控地图容器尺寸变化
-                center: this.centet,
-                zoom: 8, //初始化地图层级
+                center: !!this.centet[0] ? this.centet : '',
+                zoom: !!this.centet[0] ? 8 : 5, //初始化地图层级
                 mapStyle: 'amap://styles/darkblue',
                 defaultCursor: 'pointer'
             });
@@ -177,7 +177,6 @@ export default {
                     let arrs = [];
                     this.fitersValue(arrs, data);
                     this.centet = this.getPointsCenter(arrs);
-
                     resolve && resolve(true);
                 }
             });
@@ -226,9 +225,11 @@ export default {
             let thisValue = this.globalCommunity.value;
             value.map((item) => {
                 if (item.type == 'org') {
-                    this.fitersValue(arrs, item.children);
+                    if (!!item.children) {
+                        this.fitersValue(arrs, item.children);
+                    }
                 } else {
-                    if (thisValue.includes(item.parentId)) {
+                    if (!!thisValue && thisValue.includes(item.parentId)) {
                         arrs.push(item);
                     }
                 }