Ver código fonte

first submit

wangxx 4 meses atrás
pai
commit
24547c5465

+ 11 - 0
src/store/getters.js

@@ -0,0 +1,11 @@
1
+const getters = {
2
+  token: state => state.user.token,
3
+  avatar: state => state.user.avatar,
4
+  id: state => state.user.id,
5
+  name: state => state.user.name,
6
+  roles: state => state.user.roles,
7
+  permissions: state => state.user.permissions,
8
+  currentLevel: state => state.eikonLevel.currentLevel,
9
+  currentLevelId: state => state.eikonLevel.currentLevelId,
10
+}
11
+export default getters

+ 19 - 0
src/store/index.js

@@ -0,0 +1,19 @@
1
+import Vue from 'vue'
2
+import Vuex from 'vuex'
3
+import user from '@/store/modules/user'
4
+import dict from '@/store/modules/dict'
5
+import eikonLevel from '@/store/modules/eikonLevel'
6
+import getters from './getters'
7
+
8
+Vue.use(Vuex)
9
+
10
+const store = new Vuex.Store({
11
+  modules: {
12
+    dict,
13
+    user,
14
+    eikonLevel
15
+  },
16
+  getters
17
+})
18
+
19
+export default store

+ 39 - 0
src/store/modules/dict.js

@@ -0,0 +1,39 @@
1
+// src/store/modules/dict.js
2
+export default {
3
+  namespaced: true,
4
+  state: () => ({
5
+    dict: []
6
+  }),
7
+  getters: {
8
+    getDict: (state) => (_key) => {
9
+      if (!_key) return null;
10
+      const item = state.dict.find((item) => item.key === _key);
11
+      return item ? item.value : null;
12
+    }
13
+  },
14
+  actions: {
15
+    setDict({ commit }, { key, value }) {
16
+      commit('SET_DICT', { key, value });
17
+    },
18
+    removeDict({ commit }, key) {
19
+      commit('REMOVE_DICT', key);
20
+    },
21
+    cleanDict({ commit }) {
22
+      commit('CLEAN_DICT');
23
+    }
24
+  },
25
+  mutations: {
26
+    SET_DICT(state, { key, value }) {
27
+      state.dict.push({ key, value });
28
+    },
29
+    REMOVE_DICT(state, key) {
30
+      const index = state.dict.findIndex(item => item.key === key);
31
+      if (index > -1) {
32
+        state.dict.splice(index, 1);
33
+      }
34
+    },
35
+    CLEAN_DICT(state) {
36
+      state.dict = [];
37
+    }
38
+  }
39
+};

+ 476 - 0
src/store/modules/eikonLevel.js

@@ -0,0 +1,476 @@
1
+import {
2
+  getPortrait,
3
+  getModuleMetrics,
4
+  getGrowthPortrait,
5
+  getOverview,
6
+  getUserProfile,
7
+  getCollaborationProfile,
8
+  getDetailProfile,
9
+  getSiteStatistics,
10
+  getAttendanceStatistics,
11
+  getDeptProfile,
12
+  getSiteProfile
13
+} from '@/api/eikonStatistics/eikonStatistics';
14
+import { getUserInfoById, getDeptUserTree } from '@/api/system/user';
15
+const eikonLevel = {
16
+  namespaced: true,
17
+  state: () => ({
18
+    currentLevel: '',
19
+    currentLevelId: '',
20
+    oldLevel: '',
21
+    oldLevelId: '',
22
+    allData: {},
23
+    systemData: {},
24
+    attendanceData: {},
25
+    itemData: {},
26
+    portraitData: {},
27
+    growthPortraitData: {},
28
+    overviewData: {},
29
+    profileData: {},
30
+    collaborationData: {},
31
+    detailData: {},
32
+    stationSiteData: [],
33
+    stationAttendanceData: [],
34
+    // 新增角色状态
35
+    isPersonal: false,
36
+    isZhanZhang: false,
37
+    isKeZhang: false,
38
+    isBanZuZhang: false,
39
+    // 新增部门树数据
40
+    departmentTree: [],
41
+    // 当前部门的完整路径
42
+    currentDepartmentPath: '',
43
+    // 当前levelId在组织中管理的人数
44
+    currentLevelUserCount: 0
45
+  }),
46
+  mutations: {
47
+    SET_CURRENT_LEVEL: (state, level) => {
48
+      state.currentLevel = level
49
+    },
50
+    SET_CURRENT_LEVEL_ID: (state, levelId) => {
51
+      state.currentLevelId = levelId
52
+    },
53
+    SET_OLD_LEVEL: (state, level) => {
54
+      state.oldLevel = level
55
+    },
56
+    SET_OLD_LEVEL_ID: (state, levelId) => {
57
+      state.oldLevelId = levelId
58
+    },
59
+    SET_ALL_DATA: (state, data) => {
60
+      state.allData = data
61
+    },
62
+    SET_SYSTEM_DATA: (state, data) => {
63
+      state.systemData = data
64
+    },
65
+    SET_ATTENDANCE_DATA: (state, data) => {
66
+      state.attendanceData = data
67
+    },
68
+    SET_ITEM_DATA: (state, data) => {
69
+      state.itemData = data
70
+    },
71
+    SET_PORTRAIT_DATA: (state, data) => {
72
+      state.portraitData = data
73
+    },
74
+    SET_GROWTH_PORTRAIT_DATA: (state, data) => {
75
+      state.growthPortraitData = data
76
+    },
77
+    // 新增角色状态mutations
78
+    SET_ROLE_STATES: (state, { isPersonal, isZhanZhang, isKeZhang, isBanZuZhang }) => {
79
+      state.isPersonal = isPersonal
80
+      state.isZhanZhang = isZhanZhang
81
+      state.isKeZhang = isKeZhang
82
+      state.isBanZuZhang = isBanZuZhang
83
+    },
84
+    SET_OVERVIEW_DATA: (state, data) => {
85
+      state.overviewData = data
86
+    },
87
+    SET_PROFILE_DATA: (state, data) => {
88
+      state.profileData = data
89
+    },
90
+    SET_COLLABORATION_DATA: (state, data) => {
91
+      state.collaborationData = data
92
+    },
93
+    SET_DETAIL_DATA: (state, data) => {
94
+      state.detailData = data
95
+    },
96
+    // 新增部门树相关mutations
97
+    SET_DEPARTMENT_TREE: (state, treeData) => {
98
+      state.departmentTree = treeData
99
+    },
100
+    SET_CURRENT_DEPARTMENT_PATH: (state, path) => {
101
+      state.currentDepartmentPath = path
102
+    },
103
+    SET_CURRENT_LEVEL_USER_COUNT: (state, count) => {
104
+      state.currentLevelUserCount = count
105
+    },
106
+    // 新增站点统计相关mutations
107
+    SET_STATION_SITE_DATA: (state, data) => {
108
+      state.stationSiteData = data
109
+    },
110
+    SET_STATION_ATTENDANCE_DATA: (state, data) => {
111
+      state.stationAttendanceData = data
112
+    }
113
+  },
114
+  actions: {
115
+    // 加载数据
116
+    async loadData({ commit, state, rootState, dispatch, getters }) {
117
+      // 清空所有数据变量
118
+      commit('SET_ALL_DATA', null)
119
+      commit('SET_SYSTEM_DATA', null)
120
+      commit('SET_ATTENDANCE_DATA', null)
121
+      commit('SET_ITEM_DATA', null)
122
+      commit('SET_PORTRAIT_DATA', null)
123
+      commit('SET_GROWTH_PORTRAIT_DATA', null)
124
+      commit('SET_OVERVIEW_DATA', null)
125
+      commit('SET_PROFILE_DATA', null)
126
+      commit('SET_COLLABORATION_DATA', null)
127
+      commit('SET_DETAIL_DATA', null)
128
+      commit('SET_STATION_SITE_DATA', null)
129
+      commit('SET_STATION_ATTENDANCE_DATA', null)
130
+
131
+      // let params = {
132
+      //   userId: rootState.user.id || '',
133
+      //   userTypeStr: state.currentLevel
134
+      // }
135
+      let portraitParams = {};
136
+      let overviewParams = {};
137
+      let detailParams = {};
138
+      let growthParams = {};
139
+
140
+      if (getters.isPersonal) {
141
+        portraitParams = {
142
+          checkedUserId: state.currentLevelId
143
+        }
144
+        overviewParams = {
145
+          userId: state.currentLevelId
146
+        }
147
+        detailParams = {
148
+          userId: state.currentLevelId
149
+        }
150
+        growthParams = {
151
+          userId: state.currentLevelId
152
+        }
153
+      }
154
+      if (getters.isBanZuZhang) {
155
+        portraitParams = {
156
+          checkedTeamId: state.currentLevelId
157
+        }
158
+        overviewParams = {
159
+          deptId: state.currentLevelId
160
+        }
161
+        detailParams = {
162
+          deptId: state.currentLevelId
163
+        }
164
+        growthParams = {
165
+          teamId: state.currentLevelId
166
+        }
167
+      }
168
+      if (getters.isKeZhang) {
169
+        portraitParams = {
170
+          checkedDepartmentId: state.currentLevelId
171
+        }
172
+        overviewParams = {
173
+          deptId: state.currentLevelId
174
+        }
175
+        detailParams = {
176
+          deptId: state.currentLevelId
177
+        }
178
+        growthParams = {
179
+          departmentId: state.currentLevelId
180
+        }
181
+      }
182
+      if (getters.isZhanZhang) {
183
+        portraitParams = {
184
+          checkedSiteId: state.currentLevelId
185
+        }
186
+        overviewParams = {
187
+          siteId: state.currentLevelId
188
+        }
189
+        detailParams = {
190
+          deptId: state.currentLevelId
191
+        }
192
+      }
193
+
194
+      try {
195
+        //总体概览
196
+        const overviewRes = await getOverview(detailParams)
197
+        //资质能力
198
+        const res = await getModuleMetrics({ ...detailParams, userTypeStr: state.currentLevel })
199
+        //巡检
200
+        const portraitRes = await getPortrait(portraitParams)
201
+        //学习成长
202
+        const growthPortraitRes = await getGrowthPortrait(growthParams)
203
+        //测试
204
+        let profileRes = {}
205
+        if (getters.isKeZhang) {
206
+          profileRes = await getDeptProfile(overviewParams)
207
+        } else if (getters.isZhanZhang) {
208
+          profileRes = await getSiteProfile(overviewParams)
209
+        } else {
210
+          profileRes = await getUserProfile(overviewParams)
211
+        }
212
+
213
+        //协同配合
214
+        let collaborationRes = {}
215
+        if (getters.isPersonal) {
216
+          collaborationRes = await getUserInfoById(state.currentLevelId)
217
+        } else {
218
+          collaborationRes = await getCollaborationProfile({ deptId: state.currentLevelId })
219
+        }
220
+        //能力画像-明细
221
+
222
+        if (!getters.isPersonal) {
223
+          const detailRes = await getDetailProfile(detailParams)
224
+          commit('SET_DETAIL_DATA', detailRes.data)
225
+        }
226
+
227
+        // 只有当state.currentLevel为station的时候请求这俩接口
228
+        if (getters.isZhanZhang) {
229
+          const siteStatisticsRes = await getSiteStatistics({ deptId: state.currentLevelId })
230
+          const attendanceStatisticsRes = await getAttendanceStatistics({ deptId: state.currentLevelId })
231
+          console.log(siteStatisticsRes, attendanceStatisticsRes)
232
+
233
+          commit('SET_STATION_SITE_DATA', siteStatisticsRes.data)
234
+          commit('SET_STATION_ATTENDANCE_DATA', attendanceStatisticsRes)
235
+        }
236
+
237
+        commit('SET_COLLABORATION_DATA', collaborationRes.data)
238
+
239
+
240
+        commit('SET_OVERVIEW_DATA', overviewRes.data)
241
+        commit('SET_PROFILE_DATA', profileRes.data)
242
+        commit('SET_PORTRAIT_DATA', portraitRes.data)
243
+        commit('SET_GROWTH_PORTRAIT_DATA', growthPortraitRes.data)
244
+        let result = res.data && res.data.moduleResults;
245
+        commit('SET_ALL_DATA', result)
246
+        commit('SET_SYSTEM_DATA', result && result.system || {})
247
+        commit('SET_ATTENDANCE_DATA', result && result.attendance || {})
248
+        commit('SET_ITEM_DATA', result && result.item || {})
249
+
250
+        return result
251
+      } catch (error) {
252
+        console.error('加载数据失败:', error);
253
+        throw error
254
+      }
255
+    },
256
+    // 保存所有数据
257
+    saveAllData({ commit }, data = {}) {
258
+      commit('SET_ALL_DATA', data)
259
+      commit('SET_SYSTEM_DATA', data.system || {})
260
+      commit('SET_ATTENDANCE_DATA', data.attendance || {})
261
+      commit('SET_ITEM_DATA', data.item || {})
262
+    },
263
+    // 切换级别
264
+    async initLevel({ commit, dispatch }, { level = '', levelId = '' } = {}) {
265
+      // 清空旧的级别信息
266
+      commit('SET_OLD_LEVEL', '')
267
+      commit('SET_OLD_LEVEL_ID', '')
268
+
269
+      commit('SET_CURRENT_LEVEL', level)
270
+      commit('SET_CURRENT_LEVEL_ID', levelId)
271
+
272
+      // 根据当前级别更新角色状态
273
+      const roleStates = {
274
+        isPersonal: level === 'personal',
275
+        isBanZuZhang: level === 'team',
276
+        isKeZhang: level === 'department',
277
+        isZhanZhang: level === 'station' || level === 'zhijianke',
278
+      }
279
+      commit('SET_ROLE_STATES', roleStates)
280
+
281
+      // 确保部门树数据已加载,然后更新当前部门路径
282
+      await dispatch('loadDepartmentTree')
283
+      dispatch('updateCurrentDepartmentPath', { level, levelId })
284
+    },
285
+    // 切换级别
286
+    async changeLevel({ commit, state, dispatch }, { level = '', levelId = '' } = {}) {
287
+      // 保存旧的级别信息
288
+      commit('SET_OLD_LEVEL', state.currentLevel)
289
+      commit('SET_OLD_LEVEL_ID', state.currentLevelId)
290
+
291
+      commit('SET_CURRENT_LEVEL', level)
292
+      commit('SET_CURRENT_LEVEL_ID', levelId)
293
+
294
+      // 根据当前级别更新角色状态
295
+      const roleStates = {
296
+        isPersonal: level === 'personal',
297
+        isBanZuZhang: level === 'team',
298
+        isKeZhang: level === 'department',
299
+        isZhanZhang: level === 'station' || level === 'zhijianke',
300
+      }
301
+      commit('SET_ROLE_STATES', roleStates)
302
+
303
+      // 确保部门树数据已加载,然后更新当前部门路径
304
+      await dispatch('loadDepartmentTree')
305
+      dispatch('updateCurrentDepartmentPath', { level, levelId })
306
+    },
307
+    // 重置级别状态
308
+    resetLevel({ commit }) {
309
+      commit('SET_CURRENT_LEVEL', '')
310
+      commit('SET_CURRENT_LEVEL_ID', '')
311
+      commit('SET_ROLE_STATES', {
312
+        isPersonal: false,
313
+        isZhanZhang: false,
314
+        isKeZhang: false,
315
+        isBanZuZhang: false
316
+      })
317
+    },
318
+    // 更新角色状态
319
+    updateRoleStates({ commit }, roleStates) {
320
+      commit('SET_ROLE_STATES', roleStates)
321
+    },
322
+    // 获取部门树数据
323
+    async loadDepartmentTree({ commit, rootState }) {
324
+      try {
325
+        const res = await getDeptUserTree({})
326
+        commit('SET_DEPARTMENT_TREE', res.data)
327
+        return res.data
328
+      } catch (error) {
329
+        console.error('获取部门树数据失败:', error)
330
+        throw error
331
+      }
332
+    },
333
+    // 根据ID获取部门完整路径
334
+    getDepartmentPathById({ state }, nodeId) {
335
+
336
+      if (!nodeId || !state.departmentTree.length) {
337
+        return []
338
+      }
339
+
340
+      const findNodePath = (treeNodes, targetId, path = []) => {
341
+        for (const treeNode of treeNodes) {
342
+          // 如果找到目标节点,返回包含本级 label 的路径
343
+          if (treeNode.id === targetId) {
344
+            return [...path, treeNode.label]
345
+          }
346
+
347
+          // 如果有子节点,递归查找
348
+          if (treeNode.children && treeNode.children.length > 0) {
349
+            const newPath = [...path, treeNode.label]
350
+            const result = findNodePath(treeNode.children, targetId, newPath)
351
+            if (result) {
352
+              return result
353
+            }
354
+          }
355
+        }
356
+        return null
357
+      }
358
+
359
+      const fullPath = findNodePath(state.departmentTree, nodeId)
360
+      return fullPath || []
361
+    },
362
+    // 根据ID获取本级别的label
363
+    getDepartmentLabelById({ state }, nodeId) {
364
+      if (!nodeId || !state.departmentTree.length) {
365
+        return ''
366
+      }
367
+
368
+      const findNode = (treeNodes, targetId) => {
369
+        for (const treeNode of treeNodes) {
370
+          // 如果找到目标节点,返回本级的label
371
+          if (treeNode.id === targetId) {
372
+            return treeNode.label
373
+          }
374
+
375
+          // 如果有子节点,递归查找
376
+          if (treeNode.children && treeNode.children.length > 0) {
377
+            const result = findNode(treeNode.children, targetId)
378
+            if (result) {
379
+              return result
380
+            }
381
+          }
382
+        }
383
+        return null
384
+      }
385
+
386
+      const label = findNode(state.departmentTree, nodeId)
387
+      return label || ''
388
+    },
389
+    // 获取指定节点所有子级中nodeType为"user"的节点个数
390
+    getUserCountByLevelId({ state }, levelId) {
391
+      if (!levelId || !state.departmentTree || !state.departmentTree.length) {
392
+        return 0
393
+      }
394
+
395
+      // 查找目标节点
396
+      const findTargetNode = (treeNodes, targetId) => {
397
+        for (const treeNode of treeNodes) {
398
+          if (treeNode.id === targetId) {
399
+            return treeNode
400
+          }
401
+          if (treeNode.children && treeNode.children.length > 0) {
402
+            const result = findTargetNode(treeNode.children, targetId)
403
+            if (result) {
404
+              return result
405
+            }
406
+          }
407
+        }
408
+        return null
409
+      }
410
+
411
+      // 递归统计所有子级中nodeType为"user"的节点个数
412
+      const countUserNodes = (node) => {
413
+        let count = 0
414
+
415
+        // 如果当前节点是用户节点,计数加1
416
+        if (node.nodeType === 'user') {
417
+          count++
418
+        }
419
+
420
+        // 递归统计所有子节点
421
+        if (node.children && node.children.length > 0) {
422
+          for (const child of node.children) {
423
+            count += countUserNodes(child)
424
+          }
425
+        }
426
+
427
+        return count
428
+      }
429
+
430
+      const targetNode = findTargetNode(state.departmentTree, levelId)
431
+      if (!targetNode) {
432
+        return 0
433
+      }
434
+
435
+      // 统计目标节点所有子级中的用户节点个数
436
+      return countUserNodes(targetNode)
437
+    },
438
+    // 更新当前部门路径
439
+    async updateCurrentDepartmentPath({ commit, dispatch, state, rootState }, { level, levelId }) {
440
+
441
+      // 根据级别获取对应的部门路径
442
+      const path = await dispatch('getDepartmentPathById', levelId)
443
+    
444
+      if (level === 'personal') {
445
+        // 个人模式:去掉数组里的最后一个元素
446
+        const personalPath = path.slice(0, -1)
447
+        const pathString = personalPath.join(' / ')
448
+        commit('SET_CURRENT_DEPARTMENT_PATH', pathString)
449
+        // 个人模式下管理人数为1(自己)
450
+        commit('SET_CURRENT_LEVEL_USER_COUNT', 1)
451
+      } else {
452
+        // 其他模式:使用完整路径
453
+        const pathString = path.join(' / ')
454
+        commit('SET_CURRENT_DEPARTMENT_PATH', pathString)
455
+        // 获取当前levelId在组织中管理的人数
456
+        const userCount = await dispatch('getUserCountByLevelId', levelId)
457
+        commit('SET_CURRENT_LEVEL_USER_COUNT', userCount)
458
+      }
459
+    }
460
+  },
461
+
462
+  getters: {
463
+    currentLevel: state => state.currentLevel,
464
+    currentLevelId: state => state.currentLevelId,
465
+    oldLevel: state => state.oldLevel,
466
+    oldLevelId: state => state.oldLevelId,
467
+    allData: state => state.allData,
468
+    // 新增角色状态getters
469
+    isPersonal: state => state.isPersonal,
470
+    isZhanZhang: state => state.isZhanZhang,
471
+    isKeZhang: state => state.isKeZhang,
472
+    isBanZuZhang: state => state.isBanZuZhang
473
+  }
474
+}
475
+
476
+export default eikonLevel

+ 122 - 0
src/store/modules/user.js

@@ -0,0 +1,122 @@
1
+import config from '@/config'
2
+import storage from '@/utils/storage'
3
+import constant from '@/utils/constant'
4
+import { isHttp, isEmpty } from "@/utils/validate"
5
+import { login, logout, getInfo } from '@/api/login'
6
+import { getToken, setToken, removeToken } from '@/utils/auth'
7
+import defAva from '@/static/images/profile.jpg'
8
+
9
+const baseUrl = config.baseUrl
10
+
11
+const user = {
12
+  state: {
13
+    token: getToken(),
14
+    id: storage.get(constant.id),
15
+    name: storage.get(constant.name),
16
+    userInfo: storage.get(constant.userInfo),
17
+    avatar: storage.get(constant.avatar),
18
+    roles: storage.get(constant.roles),
19
+    permissions: storage.get(constant.permissions)
20
+  },
21
+
22
+  mutations: {
23
+    SET_TOKEN: (state, token) => {
24
+      state.token = token
25
+    },
26
+    SET_ID: (state, id) => {
27
+      state.id = id
28
+      storage.set(constant.id, id)
29
+    },
30
+    SET_NAME: (state, name) => {
31
+      state.name = name
32
+      storage.set(constant.name, name)
33
+    },
34
+    SET_USERINFO: (state, userInfo) => {
35
+      state.userInfo = userInfo
36
+      storage.set(constant.userInfo, userInfo)
37
+    },
38
+    SET_AVATAR: (state, avatar) => {
39
+      state.avatar = avatar
40
+      storage.set(constant.avatar, avatar)
41
+    },
42
+    SET_ROLES: (state, roles) => {
43
+      state.roles = roles
44
+      storage.set(constant.roles, roles)
45
+    },
46
+    SET_PERMISSIONS: (state, permissions) => {
47
+      state.permissions = permissions
48
+      storage.set(constant.permissions, permissions)
49
+    }
50
+  },
51
+
52
+  actions: {
53
+    // 登录
54
+    Login({ commit }, userInfo) {
55
+      const username = userInfo.username.trim()
56
+      const password = userInfo.password
57
+      const code = userInfo.code
58
+      const uuid = userInfo.uuid
59
+      return new Promise((resolve, reject) => {
60
+        login(username, password, code, uuid).then(res => {
61
+          // 兼容后端clould版本改造
62
+          // setToken(res.data.access_token)
63
+          // commit('SET_TOKEN', res.data.access_token)
64
+          // 单体服务
65
+          setToken(res.token)
66
+          commit('SET_TOKEN', res.token)
67
+          resolve()
68
+        }).catch(error => {
69
+          reject(error)
70
+        })
71
+      })
72
+    },
73
+
74
+    // 获取用户信息
75
+    GetInfo({ commit, state }) {
76
+      return new Promise((resolve, reject) => {
77
+        getInfo().then(res => {
78
+          const user = res.user
79
+          const userInfo = res.userInfo
80
+		  let avatar = user.avatar || ""
81
+		  if (!isHttp(avatar)) {
82
+            avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar
83
+          }
84
+          const userid = (isEmpty(user) || isEmpty(user.userId)) ? "" : user.userId
85
+		  const username = (isEmpty(user) || isEmpty(user.userName)) ? "" : user.userName
86
+		  if (res.roles && res.roles.length > 0) {
87
+        
88
+            commit('SET_ROLES', res.roles)
89
+            commit('SET_PERMISSIONS', res.permissions)
90
+          } else {
91
+            commit('SET_ROLES', ['ROLE_DEFAULT'])
92
+          }
93
+          commit('SET_ID', userid)
94
+          commit('SET_NAME', username)
95
+          commit('SET_USERINFO', userInfo)
96
+          commit('SET_AVATAR', avatar)
97
+          resolve(res)
98
+        }).catch(error => {
99
+          reject(error)
100
+        })
101
+      })
102
+    },
103
+
104
+    // 退出系统
105
+    LogOut({ commit, state }) {
106
+      return new Promise((resolve, reject) => {
107
+        logout(state.token).then(() => {
108
+          commit('SET_TOKEN', '')
109
+          commit('SET_ROLES', [])
110
+          commit('SET_PERMISSIONS', [])
111
+          removeToken()
112
+          storage.clean()
113
+          resolve()
114
+        }).catch(error => {
115
+          reject(error)
116
+        })
117
+      })
118
+    }
119
+  }
120
+}
121
+
122
+export default user