adtec-core-package 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,8 +2,7 @@ import { defineStore } from 'pinia'
|
|
|
2
2
|
import type { ISysMenuInfoVo } from '../interface/ISysMenuInfoVo'
|
|
3
3
|
import { useEventBus } from '@vueuse/core'
|
|
4
4
|
import WujieVue from 'wujie-vue3'
|
|
5
|
-
|
|
6
|
-
import Base64 from 'crypto-js/enc-base64'
|
|
5
|
+
|
|
7
6
|
const bus = useEventBus<string>('ActiveMenuInfo')
|
|
8
7
|
export const permissionStore = defineStore({
|
|
9
8
|
id: 'permissionStore',
|
|
@@ -50,7 +49,6 @@ export const permissionStore = defineStore({
|
|
|
50
49
|
* @constructor
|
|
51
50
|
*/
|
|
52
51
|
IsOperationAuth(operCode: string) {
|
|
53
|
-
this.loadData()
|
|
54
52
|
if (this.getActiveMenuInfo?.operation) {
|
|
55
53
|
const find = this.getActiveMenuInfo?.operation?.find((c) => c.code === operCode)
|
|
56
54
|
if (find) {
|
|
@@ -67,59 +65,37 @@ export const permissionStore = defineStore({
|
|
|
67
65
|
* @param menuInfo
|
|
68
66
|
*/
|
|
69
67
|
setActiveMenuInfoLevel1(menuInfo: ISysMenuInfoVo) {
|
|
70
|
-
this.loadData()
|
|
71
68
|
this.activeMenuInfoLevel1 = menuInfo
|
|
72
|
-
this.updatesessionStorage()
|
|
73
69
|
},
|
|
74
70
|
/**
|
|
75
71
|
* 设置打开的菜单
|
|
76
72
|
* @param menuInfo
|
|
77
73
|
*/
|
|
78
74
|
setOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
79
|
-
this.loadData()
|
|
80
75
|
const find = this.openMenuInfo.find((c) => c.id === menuInfo.id)
|
|
81
76
|
if (!find) {
|
|
82
77
|
this.openMenuInfo.push(menuInfo)
|
|
83
78
|
}
|
|
84
79
|
this.activeMenuInfo = menuInfo
|
|
85
80
|
bus.emit()
|
|
86
|
-
this.updatesessionStorage()
|
|
87
81
|
},
|
|
88
82
|
/**
|
|
89
83
|
* 移除打开的菜单
|
|
90
84
|
* @param menuInfo
|
|
91
85
|
*/
|
|
92
86
|
removeOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
93
|
-
this.
|
|
94
|
-
if(this.openMenuInfo.indexOf(menuInfo)>-1) {
|
|
95
|
-
this.openMenuInfo.splice(this.openMenuInfo.indexOf(menuInfo), 1)
|
|
96
|
-
}
|
|
87
|
+
this.openMenuInfo.splice(this.openMenuInfo.indexOf(menuInfo), 1)
|
|
97
88
|
if (menuInfo.applicationModule !== 'system' && menuInfo.isLink !== 1) {
|
|
98
89
|
//关闭子应用菜单
|
|
99
90
|
WujieVue.bus.$emit('wujie-router-close', menuInfo)
|
|
100
91
|
}
|
|
101
|
-
this.updatesessionStorage()
|
|
102
92
|
},
|
|
103
93
|
/**
|
|
104
94
|
* 移除所有打开的菜单
|
|
105
95
|
* @param menuInfo
|
|
106
96
|
*/
|
|
107
97
|
removeAllOpenMenuInfo(menuInfo: ISysMenuInfoVo) {
|
|
108
|
-
this.loadData()
|
|
109
98
|
this.openMenuInfo = []
|
|
110
|
-
this.updatesessionStorage()
|
|
111
|
-
},
|
|
112
|
-
updatesessionStorage(){
|
|
113
|
-
sessionStorage.setItem("permissionStore",Base64.stringify(Utf8.parse(JSON.stringify(this.$state))))
|
|
114
|
-
},
|
|
115
|
-
loadData(){
|
|
116
|
-
const s=sessionStorage.getItem("permissionStore")+""
|
|
117
|
-
if(s) {
|
|
118
|
-
const p = JSON.parse(Base64.parse(s).toString(Utf8))
|
|
119
|
-
this.openMenuInfo=p.openMenuInfo
|
|
120
|
-
this.activeMenuInfoLevel1=p.activeMenuInfoLevel1
|
|
121
|
-
this.activeMenuInfo=p.activeMenuInfo
|
|
122
|
-
}
|
|
123
99
|
},
|
|
124
100
|
clear() {
|
|
125
101
|
this.openMenuInfo = []
|