agilebuilder-ui 1.0.63 → 1.0.65
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/lib/super-ui.css +1 -1
- package/lib/super-ui.js +197 -174
- package/lib/super-ui.umd.cjs +5 -5
- package/package.json +1 -1
- package/packages/department-user-tree-inline/src/search-result.vue +33 -34
- package/packages/dynamic-source-select/src/dynamic-source-select.vue +142 -51
- package/packages/super-grid/src/dynamic-input.vue +1 -1
- package/packages/super-grid/src/normal-column.vue +1 -0
- package/packages/super-grid/src/super-grid.vue +1 -0
- package/src/api/sso-service.js +16 -1
- package/src/i18n/langs/cn.js +2 -1
- package/src/i18n/langs/en.js +2 -1
- package/src/store/modules/user.js +24 -30
- package/src/utils/auth.js +17 -3
- package/src/utils/permissionAuth.js +56 -27
|
@@ -4,6 +4,8 @@ import {getSessionCache, getRunInfoKey} from './auth'
|
|
|
4
4
|
const permissionKey = 'PERMISSION-'
|
|
5
5
|
const permissionMenuKey = 'PERMISSION_MENU-'
|
|
6
6
|
const _RUN_PERMISSION = '_RUN_PERMISSION'
|
|
7
|
+
|
|
8
|
+
const permissionAllSystemKey = 'PERMISSION_All_SYSTSEM_KEY'
|
|
7
9
|
export function getSystemCode() {
|
|
8
10
|
let systemCode
|
|
9
11
|
if (window.$vueApp.config.globalProperties.customSystem) {
|
|
@@ -22,7 +24,7 @@ export function getSystemCode() {
|
|
|
22
24
|
|
|
23
25
|
export function getPermissions() {
|
|
24
26
|
const systemCode = getSystemCode()
|
|
25
|
-
let permissions =
|
|
27
|
+
let permissions = localStorage.getItem(permissionKey + systemCode)
|
|
26
28
|
if (permissions) {
|
|
27
29
|
permissions = JSON.parse(permissions)
|
|
28
30
|
return permissions
|
|
@@ -39,7 +41,7 @@ export function getTotalPermissions() {
|
|
|
39
41
|
}
|
|
40
42
|
let sysetemPermissionsObj
|
|
41
43
|
const systemCode = getSystemCode()
|
|
42
|
-
const sysetemPermissions =
|
|
44
|
+
const sysetemPermissions = localStorage.getItem(permissionKey + systemCode)
|
|
43
45
|
if (sysetemPermissions) {
|
|
44
46
|
sysetemPermissionsObj = JSON.parse(sysetemPermissions)
|
|
45
47
|
}
|
|
@@ -69,31 +71,19 @@ export function setPermissions(permissions) {
|
|
|
69
71
|
permissionObjs[permission] = true
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
76
|
-
const b = new Date().getTime()
|
|
74
|
+
const key = permissionKey + systemCode
|
|
75
|
+
localStorage.setItem(key, JSON.stringify(permissionObjs))
|
|
76
|
+
setPermissionAllSystemKey(key)
|
|
77
77
|
return permissionObjs
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export function removePermissions() {
|
|
81
|
-
const systemCode = getSystemCode()
|
|
82
|
-
window.sessionStorage.removeItem(permissionKey + systemCode)
|
|
83
|
-
for (var i = 0; i < window.sessionStorage.length; i++) {
|
|
84
|
-
var key = window.sessionStorage.key(i)
|
|
85
|
-
if (key.indexOf(permissionKey) >= 0) {
|
|
86
|
-
window.sessionStorage.removeItem(key)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
80
|
|
|
91
81
|
export function getMenus(systemCode) {
|
|
92
82
|
if (!systemCode) {
|
|
93
83
|
systemCode = getSystemCode()
|
|
94
84
|
}
|
|
95
85
|
const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
|
|
96
|
-
const permissions =
|
|
86
|
+
const permissions = localStorage.getItem(
|
|
97
87
|
myPermissionMenuKey + systemCode
|
|
98
88
|
)
|
|
99
89
|
if (permissions) {
|
|
@@ -108,10 +98,9 @@ export function setMenus(menus, systemCode) {
|
|
|
108
98
|
systemCode = getSystemCode()
|
|
109
99
|
}
|
|
110
100
|
const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
)
|
|
101
|
+
const key = myPermissionMenuKey + systemCode
|
|
102
|
+
localStorage.setItem(key, JSON.stringify(menus))
|
|
103
|
+
setPermissionAllSystemKey(key)
|
|
115
104
|
return menus
|
|
116
105
|
}
|
|
117
106
|
}
|
|
@@ -121,11 +110,51 @@ export function removeMenus(systemCode) {
|
|
|
121
110
|
systemCode = getSystemCode()
|
|
122
111
|
}
|
|
123
112
|
const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
|
|
124
|
-
|
|
125
|
-
for (var i = 0; i <
|
|
126
|
-
var key =
|
|
127
|
-
if (key.indexOf(permissionMenuKey) >= 0) {
|
|
128
|
-
|
|
113
|
+
localStorage.removeItem(myPermissionMenuKey + systemCode)
|
|
114
|
+
for (var i = 0; i < localStorage.length; i++) {
|
|
115
|
+
var key = localStorage.key(i)
|
|
116
|
+
if (key.indexOf(myPermissionMenuKey) >= 0 || key.indexOf(permissionMenuKey) >= 0) {
|
|
117
|
+
localStorage.removeItem(key)
|
|
129
118
|
}
|
|
130
119
|
}
|
|
131
120
|
}
|
|
121
|
+
|
|
122
|
+
function setPermissionAllSystemKey(systemPermissionKey) {
|
|
123
|
+
const permissionAllSystems = getPermissionAllSystemKey()
|
|
124
|
+
if (permissionAllSystems.indexOf(systemPermissionKey) < 0) {
|
|
125
|
+
permissionAllSystems.push(systemPermissionKey)
|
|
126
|
+
}
|
|
127
|
+
localStorage.setItem(permissionAllSystemKey, permissionAllSystems.join(','))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getPermissionAllSystemKey() {
|
|
131
|
+
let permissionAllSystems = localStorage.getItem(permissionAllSystemKey)
|
|
132
|
+
if (permissionAllSystems) {
|
|
133
|
+
permissionAllSystems = permissionAllSystems.split(',')
|
|
134
|
+
}
|
|
135
|
+
if (!permissionAllSystems) {
|
|
136
|
+
permissionAllSystems = []
|
|
137
|
+
}
|
|
138
|
+
return permissionAllSystems
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function removePermissionSystemKey() {
|
|
142
|
+
localStorage.removeItem(permissionAllSystemKey)
|
|
143
|
+
}
|
|
144
|
+
function rtrim(str) { // 删除右边的空格
|
|
145
|
+
return str.replace(/(\s*$)/g, '')
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 删除缓存的资源和菜单
|
|
149
|
+
export function removeAllSystemPermissions() {
|
|
150
|
+
const systemCode = getSystemCode()
|
|
151
|
+
localStorage.removeItem(permissionKey + systemCode)
|
|
152
|
+
const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
|
|
153
|
+
localStorage.removeItem(myPermissionMenuKey + systemCode)
|
|
154
|
+
const permissionAllSystems = getPermissionAllSystemKey()
|
|
155
|
+
permissionAllSystems.forEach(key => {
|
|
156
|
+
key = rtrim(key)
|
|
157
|
+
localStorage.removeItem(key)
|
|
158
|
+
})
|
|
159
|
+
removePermissionSystemKey()
|
|
160
|
+
}
|