Browse Source

sotre SETCATEGORYID categoryId选中的系统

yx 4 năm trước cách đây
mục cha
commit
4f4b6642f8
3 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. 2 2
      src/components/menuList.vue
  2. 7 0
      src/store/index.js
  3. 1 1
      src/views/equipment/index.vue

+ 2 - 2
src/components/menuList.vue

@@ -162,10 +162,10 @@ export default {
         clickEventAcitve(item) {
             if (item.name == '楼层功能') {
                 this.$cookie.set('categoryId', 'LCGN', 3)
-                // store.commit('SETCATEGORYID', 'LCGN')
+                store.commit('SETCATEGORYID', 'LCGN')
             } else {
                 this.$cookie.set('categoryId', 'GDXT', 3)
-                // store.commit('SETCATEGORYID', 'GDXT')
+                store.commit('SETCATEGORYID', 'GDXT')
             }
             this.list.forEach(ele => {
                 ele.state = false

+ 7 - 0
src/store/index.js

@@ -35,6 +35,7 @@ export default new Vuex.Store({
         currentFloor: {}, //当前选中的楼层信息
         accessLevel: -1, // 权限级别
         showView: 1,
+        categoryId: 'GDXT', //当前选中的系统
     },
     getters: {
         plazaName: (state) => state.plazaName,
@@ -127,6 +128,12 @@ export default new Vuex.Store({
         STOREPLAZAID(state, id) {
             state.plazaId = id
         },
+        /**
+         * 修改 categoryId
+         */
+        SETCATEGORYID(state, data) {
+            state.categoryId = data
+        },
     },
     actions: {
         // 获取项目列表、userId

+ 1 - 1
src/views/equipment/index.vue

@@ -104,7 +104,7 @@ export default {
             this.systemName = item.name
             this.smsxt = item.smsxt
             this.$cookie.set('categoryId', item.categoryId, 3)
-            // store.commit('SETCATEGORYID', item.categoryId)
+            store.commit('SETCATEGORYID', item.categoryId)
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.querySmsxt()
             this.viewLengend()