Jelajahi Sumber

Merge branch 'develop' of git.sagacloud.cn:web/wanda-bm-guide into aly_dev

guoxiaohuan 4 tahun lalu
induk
melakukan
6ce7e23534
3 mengubah file dengan 30 tambahan dan 7 penghapusan
  1. 12 5
      src/App.vue
  2. 11 1
      src/store/index.js
  3. 7 1
      src/views/statistics/index.vue

+ 12 - 5
src/App.vue

@@ -34,12 +34,9 @@ export default {
             localStorage.setItem('beforeunload', state)
         })
     },
-    mounted() {
-        // 请求该项目下的楼层数据
-        this.getFengMap()
-    },
+    mounted() {},
     computed: {
-        ...mapGetters(['plazaId', 'fmapID', 'haveFengMap'])
+        ...mapGetters(['plazaId', 'fmapID', 'haveFengMap', 'accessLevel'])
     },
     methods: {
         ...mapActions(['getfmapID']),
@@ -75,6 +72,16 @@ export default {
                 })
             }
         }
+    },
+    watch: {
+        plazaId(plazaId) {
+            console.log('获取到id', plazaId)
+            // 当获取到到项目id,请求底图
+            if (plazaId) {
+                // 请求该项目下的楼层数据
+                this.getFengMap()
+            }
+        }
     }
 }
 </script>

+ 11 - 1
src/store/index.js

@@ -22,7 +22,7 @@ export default new Vuex.Store({
             orgCode: '',
             username: 'lengqiang', //账户名称
         },
-        plazaId: '1000423', //项目Id
+        plazaId: '', //项目Id
         projectName: '', //全局项目名称
         floorsArr: [], //楼层数组
         floorSelect: [], //楼层下拉框
@@ -37,6 +37,7 @@ export default new Vuex.Store({
         accessLevel: -1, // 权限级别
         showView: 1,
         categoryId: 'GDXT', //当前选中的系统
+        isGetmap: false, //是否可以请求底图(在项目中方可请求)
     },
     getters: {
         plazaName: (state) => state.plazaName,
@@ -56,6 +57,7 @@ export default new Vuex.Store({
         remarksText: (state) => state.remarksText,
         bunkObj: (state) => state.bunkObj,
         showView: (state) => state.showView,
+        isGetmap: (state) => state.isGetmap,
     },
     mutations: {
         SETPLAZENAME(state, data) {
@@ -128,6 +130,11 @@ export default new Vuex.Store({
         },
         STOREPLAZAID(state, id) {
             state.plazaId = id
+            if (id) {
+                state.isGetmap = true
+            } else {
+                state.isGetmap = false
+            }
         },
         /**
          * 修改 categoryId
@@ -135,6 +142,9 @@ export default new Vuex.Store({
         SETCATEGORYID(state, data) {
             state.categoryId = data
         },
+        SETISGETMAP(state, data) {
+            state.isGetmap = data
+        },
     },
     actions: {
         // 获取项目列表、userId

+ 7 - 1
src/views/statistics/index.vue

@@ -324,6 +324,8 @@ export default {
         },
         // 获取 区域/中心/项目
         selectProjectItem(ids, data) {
+             localStorage.setItem('PLAZAID', '')
+             this.$store.commit('STOREPLAZAID', '') 
             this.currentLevel = data.level
             if (data.level === 0) {  //  level=0时 plazaId必填
                 this.queryPlazaInfoCount(data.ccode, data.level, data.cid)
@@ -347,6 +349,7 @@ export default {
                 this.$store.commit('SETPLAZENAME', data.cname) 
                 localStorage.setItem('PLAZAID', data.ccode)
                  this.$store.commit('STOREPLAZAID', data.ccode) 
+                 this.$store.commit('SETISGETMAP',true)
             }
         },
    
@@ -884,6 +887,8 @@ export default {
                 className: 'my-leaflet-div-icon',
                 iconSize: 30
             })
+             localStorage.setItem('PLAZAID', '')
+             this.$store.commit('STOREPLAZAID', '') 
             setTimeout(()=>{
                 let zoom = myMaps.getZoom()
                 let sizes = this.circleSize[zoom]
@@ -909,7 +914,8 @@ export default {
                             this.$router.push({path:'/home/homePage' })  
                             this.$store.commit('SETPLAZENAME', data.cname) 
                             localStorage.setItem('PLAZAID', data.ccode)
-                            this.$store.commit('STOREPLAZAID', data.ccode) 
+                            this.$store.commit('STOREPLAZAID', data.ccode) ;
+                            this.$store.commit('SETISGETMAP',true)
                         }   
                     })
                 }