فهرست منبع

store中保存系统字段,更改系统时,查询右下角数量

yx 4 سال پیش
والد
کامیت
66de51dec8
3فایلهای تغییر یافته به همراه27 افزوده شده و 11 حذف شده
  1. 17 3
      src/components/Legend/src/legend.vue
  2. 8 7
      src/store/index.js
  3. 2 1
      src/views/equipment/index.vue

+ 17 - 3
src/components/Legend/src/legend.vue

@@ -137,7 +137,8 @@ export default {
             typeNum: '',
             draftNum: null, //草稿箱数量, 编辑器修改icon右上角显示
             interval: 10 * 60 * 1000, //定时器时长,默认 10分钟
-            timer: null //保存定时器
+            timer: null, //保存定时器
+            timer1: null
         }
     },
     computed: {
@@ -184,6 +185,18 @@ export default {
                 }
             },
             deep: true
+        },
+        '$store.state.categoryId': {
+            handler(newV, oldV) {
+                if (newV !== oldV) {
+                    clearInterval(this.timer1)
+                    this.getDraftNum()
+                    this.timer1 = setInterval(() => {
+                        this.getDraftNum()
+                    }, this.interval)
+                }
+            },
+            deep: true
         }
     },
     methods: {
@@ -194,14 +207,15 @@ export default {
         async getDraftNum() {
             let res = null,
                 // floorId = this.$cookie.get('floorMapId'),
-                floorId = this.$store.state.currentFloor.gname || this.$cookie.get('floorMapId')
+                floorId = this.$store.state.currentFloor.gname || this.$cookie.get('floorMapId'),
+                categoryId = this.$cookie.get('categoryId')
             // 增加校验 floorId,防止上传 undefined
             if (!floorId) {
                 return true
             }
             let data = {
                 Distinct: true,
-                Filters: `projectId='${this.plazaId}';isPub=false;floorId='${floorId}'`,
+                Filters: `projectId='${this.plazaId}';isPub=false;BuildingId='1';categoryId='${categoryId}';floorId='${floorId}'`,
                 PageNumber: 1,
                 PageSize: 500,
                 Projection: ['floorId']

+ 8 - 7
src/store/index.js

@@ -8,9 +8,8 @@ import router from '../router'
 Vue.use(Vuex)
 export default new Vuex.Store({
     state: {
-        // ssoToken: 'admin:lengqiang',
-        ssoToken: null,
-        plazaName: '',
+        ssoToken: 'admin:lengqiang',
+        // ssoToken: null,
         isPreview: false,
         lastRoute: '',
         isrequestAuth: true, // 是否请求登录校验接口
@@ -33,12 +32,11 @@ export default new Vuex.Store({
         remarksText: '', //备注
         bunkObj: {}, // 铺位名称
         currentFloor: {}, //当前选中的楼层信息
+        categoryId: 'GDXT', //当前选中的系统
         accessLevel: -1, // 权限级别
         showView: 1,
     },
     getters: {
-        plazaName: (state) => state.plazaName,
-        accessLevel: (state) => state.accessLevel,
         isPreview: (state) => state.isPreview,
         ssoToken: (state) => state.ssoToken,
         lastRoute: (state) => state.lastRoute,
@@ -56,8 +54,11 @@ export default new Vuex.Store({
         showView: (state) => state.showView,
     },
     mutations: {
-        SETPLAZENAME(state, data) {
-            state.plazaName = data
+        /**
+         * 修改 categoryId
+         */
+        SETCATEGORYID(state, data) {
+            state.categoryId = data
         },
         SETSHOWVIEW(state, data) {
             state.showView = data

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

@@ -61,7 +61,7 @@ import editList from '@/components/edit.vue'
 import { system } from '@/utils/plugins/components.js'
 import { queryPic } from '@/api/public.js'
 import { mapGetters } from 'vuex'
-
+import store from '../../store'
 export default {
     data() {
         return {
@@ -93,6 +93,7 @@ export default {
             this.systemName = item.name
             this.smsxt = item.smsxt
             this.$cookie.set('categoryId', item.categoryId, 3)
+            store.commit('SETCATEGORYID', item.categoryId)
             this.$refs.floorMap.init(this.floorInfo.gname)
             this.querySmsxt()
             this.viewLengend()