imatrix-ui 2.9.37-dw → 2.9.39-dw
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.umd.min.js +7 -7
- package/package.json +3 -3
- package/packages/rich-editor/index.vue +1 -1
- package/src/i18n/langs/cn.js +4 -2
- package/src/i18n/langs/en.js +4 -2
- package/src/store/modules/user.js +8 -23
- package/src/styles/theme/dark-blue/element-variables.scss +1 -1
- package/src/utils/auth.js +17 -3
- package/src/utils/permissionAuth.js +44 -25
- package/src/utils/request.js +28 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imatrix-ui",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.39-dw",
|
|
4
4
|
"description": "前端组件库:表格、表单、组织结构树等",
|
|
5
5
|
"main": "lib/super-ui.umd.min.js",
|
|
6
6
|
"private": false,
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"element-ui": "2.15.3",
|
|
35
35
|
"eslint": "5.16.0",
|
|
36
36
|
"eslint-plugin-vue": "5.2.2",
|
|
37
|
-
"node-sass": "4.12.0",
|
|
38
37
|
"nprogress": "^0.2.0",
|
|
39
|
-
"sass
|
|
38
|
+
"sass": "^1.49.8",
|
|
39
|
+
"sass-loader": "^10.0.2",
|
|
40
40
|
"sessionstorage": "^0.1.0",
|
|
41
41
|
"vue": "^2.6.10",
|
|
42
42
|
"vue-cli-plugin-element": "^1.0.1",
|
|
@@ -112,7 +112,7 @@ export default {
|
|
|
112
112
|
},
|
|
113
113
|
toolbar: {
|
|
114
114
|
type: [String, Array],
|
|
115
|
-
default: ' undo redo | formatselect fontsizeselect bold italic strikethrough underline hr forecolor backcolor | image | ' +
|
|
115
|
+
default: ' undo redo | formatselect fontsizeselect bold italic strikethrough underline hr forecolor backcolor| link | image | ' +
|
|
116
116
|
' lineheight bullist numlist table | print fullscreen preview '
|
|
117
117
|
}
|
|
118
118
|
},
|
package/src/i18n/langs/cn.js
CHANGED
|
@@ -72,10 +72,12 @@ const cn = {
|
|
|
72
72
|
fileUpload: '文件上传',
|
|
73
73
|
selectYear: '选择年',
|
|
74
74
|
search: '查询',
|
|
75
|
-
forbiddenException: '
|
|
75
|
+
forbiddenException: '您没有权限访问',
|
|
76
76
|
theButtonIsNotBoundToAResource: '该按钮未绑定资源,请先绑定资源',
|
|
77
77
|
asyncExport: '正在异步导出,请等待消息通知!',
|
|
78
|
-
selectedWorkingGroup: '已选工作组'
|
|
78
|
+
selectedWorkingGroup: '已选工作组',
|
|
79
|
+
forbiddenExceptionLinkUrl: '请点击进行权限申请',
|
|
80
|
+
forbiddenExceptionLinkUser: '如有疑问请联系'
|
|
79
81
|
},
|
|
80
82
|
// 列表组件
|
|
81
83
|
superGrid: {
|
package/src/i18n/langs/en.js
CHANGED
|
@@ -72,10 +72,12 @@ const en = {
|
|
|
72
72
|
fileUpload: 'File Upload',
|
|
73
73
|
selectYear: 'Select Year',
|
|
74
74
|
search: 'Search',
|
|
75
|
-
forbiddenException: 'You do not have permission to access
|
|
75
|
+
forbiddenException: 'You do not have permission to access',
|
|
76
76
|
theButtonIsNotBoundToAResource: 'The button is not bound to a resource, Bind the resource first',
|
|
77
77
|
asyncExport: 'Asynchronous export, please wait for message notification!',
|
|
78
|
-
selectedWorkingGroup: 'Selected working group'
|
|
78
|
+
selectedWorkingGroup: 'Selected working group',
|
|
79
|
+
forbiddenExceptionLinkUrl: 'please click to apply',
|
|
80
|
+
forbiddenExceptionLinkUser: 'if you have any questions,please contact'
|
|
79
81
|
},
|
|
80
82
|
superGrid: {
|
|
81
83
|
columnConfig: 'Column Config',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ssoService from '../../api/sso-service'
|
|
2
|
-
import { setToken,
|
|
2
|
+
import { setToken, setUsername, getUsername, removeUsername, setCurrentUser, removeCurrentUser, setLanguage, clearPermission } from '../../utils/auth'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getPermissions, setPermissions, getMenus, setMenus, removeAllSystemPermissions } from '../../utils/permissionAuth'
|
|
5
5
|
import { isPlateSys } from '../../utils/common-util'
|
|
6
6
|
|
|
7
7
|
const user = {
|
|
@@ -26,6 +26,8 @@ const user = {
|
|
|
26
26
|
actions: {
|
|
27
27
|
// 登录
|
|
28
28
|
login({ commit }, userInfo) {
|
|
29
|
+
// 登录时先清除缓存的登录信息和权限信息
|
|
30
|
+
clearPermission()
|
|
29
31
|
const username = userInfo.username.trim()
|
|
30
32
|
return new Promise((resolve, reject) => {
|
|
31
33
|
ssoService.login(username, userInfo.password, userInfo.language).then(data => {
|
|
@@ -48,6 +50,8 @@ const user = {
|
|
|
48
50
|
loginWithCookieToken({ commit }, loginName) {
|
|
49
51
|
return new Promise((resolve, reject) => {
|
|
50
52
|
if (loginName) {
|
|
53
|
+
// 登录时清除缓存的资源
|
|
54
|
+
removeAllSystemPermissions()
|
|
51
55
|
// setToken(tokenInfo.jwt)
|
|
52
56
|
// commit('setToken', tokenInfo.jwt)
|
|
53
57
|
ssoService.getCurrentUserPermissionsBySystem(loginName).then(permissions => {
|
|
@@ -94,19 +98,9 @@ const user = {
|
|
|
94
98
|
return new Promise((resolve, reject) => {
|
|
95
99
|
ssoService.logout(state.token).then((data) => {
|
|
96
100
|
commit('setToken', '')
|
|
97
|
-
removeToken()
|
|
98
|
-
removeLanguage()
|
|
99
|
-
removeAllLanguages()
|
|
100
101
|
|
|
101
102
|
commit('setName', '')
|
|
102
|
-
|
|
103
|
-
removeCurrentUser()
|
|
104
|
-
|
|
105
|
-
removePermissions()
|
|
106
|
-
|
|
107
|
-
removeMenus()
|
|
108
|
-
|
|
109
|
-
removePublishControl()
|
|
103
|
+
clearPermission()
|
|
110
104
|
|
|
111
105
|
resolve(data)
|
|
112
106
|
}).catch(error => {
|
|
@@ -119,18 +113,9 @@ const user = {
|
|
|
119
113
|
clearToken({ commit }) {
|
|
120
114
|
return new Promise(resolve => {
|
|
121
115
|
commit('setToken', '')
|
|
122
|
-
removeToken()
|
|
123
|
-
removeLanguage()
|
|
124
|
-
removeAllLanguages()
|
|
125
116
|
|
|
126
117
|
commit('setName', '')
|
|
127
|
-
|
|
128
|
-
removeCurrentUser()
|
|
129
|
-
|
|
130
|
-
removePermissions()
|
|
131
|
-
|
|
132
|
-
removeMenus()
|
|
133
|
-
|
|
118
|
+
clearPermission()
|
|
134
119
|
resolve()
|
|
135
120
|
})
|
|
136
121
|
},
|
package/src/utils/auth.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import authApi from './auth-api'
|
|
2
2
|
|
|
3
|
+
import { removeAllSystemPermissions } from './permissionAuth'
|
|
4
|
+
|
|
3
5
|
export function getToken() {
|
|
4
6
|
return authApi.getToken()
|
|
5
7
|
}
|
|
@@ -60,7 +62,7 @@ export function removeSessionCache(key) {
|
|
|
60
62
|
authApi.removeSessionCache(key)
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
function removePublishControl() {
|
|
64
66
|
authApi.removePublishControl()
|
|
65
67
|
}
|
|
66
68
|
|
|
@@ -72,7 +74,7 @@ export function setLanguage(language) {
|
|
|
72
74
|
authApi.setLanguage(language)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
function removeLanguage() {
|
|
76
78
|
authApi.removeLanguage()
|
|
77
79
|
}
|
|
78
80
|
|
|
@@ -84,6 +86,18 @@ export function setAllLanguages(langs) {
|
|
|
84
86
|
authApi.setAllLanguages(langs)
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
|
|
89
|
+
function removeAllLanguages() {
|
|
88
90
|
authApi.removeAllLanguages()
|
|
89
91
|
}
|
|
92
|
+
// 清空token时需要清除的缓存信息
|
|
93
|
+
export function clearPermission() {
|
|
94
|
+
removeToken()
|
|
95
|
+
removeLanguage()
|
|
96
|
+
removeAllLanguages()
|
|
97
|
+
|
|
98
|
+
removeUsername()
|
|
99
|
+
removeCurrentUser()
|
|
100
|
+
|
|
101
|
+
removeAllSystemPermissions()
|
|
102
|
+
removePublishControl()
|
|
103
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import sessionStorage from 'sessionstorage'
|
|
2
1
|
import Vue from 'vue'
|
|
3
2
|
|
|
4
3
|
const permissionKey = 'PERMISSION-'
|
|
5
4
|
const permissionMenuKey = 'PERMISSION_MENU-'
|
|
5
|
+
const permissionAllSystemKey = 'PERMISSION_All_SYSTSEM_KEY'
|
|
6
6
|
export function getSystemCode() {
|
|
7
7
|
let systemCode
|
|
8
8
|
if (Vue.prototype.customSystem) {
|
|
@@ -21,7 +21,7 @@ export function getSystemCode() {
|
|
|
21
21
|
|
|
22
22
|
export function getPermissions() {
|
|
23
23
|
const systemCode = getSystemCode()
|
|
24
|
-
const permissions =
|
|
24
|
+
const permissions = localStorage.getItem(permissionKey + systemCode)
|
|
25
25
|
if (permissions) {
|
|
26
26
|
return JSON.parse(permissions)
|
|
27
27
|
}
|
|
@@ -35,26 +35,17 @@ export function setPermissions(permissions) {
|
|
|
35
35
|
const permission = permissions[i].replace(/\./g, '__')
|
|
36
36
|
permissionObjs[permission] = true
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const key = permissionKey + systemCode
|
|
39
|
+
localStorage.setItem(key, JSON.stringify(permissionObjs))
|
|
40
|
+
setPermissionAllSystemKey(key)
|
|
39
41
|
return permissionObjs
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
export function removePermissions() {
|
|
43
|
-
const systemCode = getSystemCode()
|
|
44
|
-
sessionStorage.removeItem(permissionKey + systemCode)
|
|
45
|
-
for (var i = 0; i < sessionStorage.length; i++) {
|
|
46
|
-
var key = sessionStorage.key(i)
|
|
47
|
-
if (key.indexOf(permissionKey) >= 0) {
|
|
48
|
-
sessionStorage.removeItem(key)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
44
|
export function getMenus(systemCode) {
|
|
54
45
|
if (!systemCode) {
|
|
55
46
|
systemCode = getSystemCode()
|
|
56
47
|
}
|
|
57
|
-
const permissions =
|
|
48
|
+
const permissions = localStorage.getItem(permissionMenuKey + systemCode)
|
|
58
49
|
if (permissions) {
|
|
59
50
|
return JSON.parse(permissions)
|
|
60
51
|
}
|
|
@@ -66,21 +57,49 @@ export function setMenus(menus, systemCode) {
|
|
|
66
57
|
if (!systemCode) {
|
|
67
58
|
systemCode = getSystemCode()
|
|
68
59
|
}
|
|
69
|
-
|
|
60
|
+
const key = permissionMenuKey + systemCode
|
|
61
|
+
localStorage.setItem(key, JSON.stringify(menus))
|
|
62
|
+
setPermissionAllSystemKey(key)
|
|
70
63
|
return menus
|
|
71
64
|
}
|
|
72
65
|
}
|
|
73
66
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
function setPermissionAllSystemKey(systemPermissionKey) {
|
|
68
|
+
const permissionAllSystems = getPermissionAllSystemKey()
|
|
69
|
+
if (permissionAllSystems.indexOf(systemPermissionKey) < 0) {
|
|
70
|
+
permissionAllSystems.push(systemPermissionKey)
|
|
77
71
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
localStorage.setItem(permissionAllSystemKey, permissionAllSystems.join(','))
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function getPermissionAllSystemKey() {
|
|
76
|
+
let permissionAllSystems = localStorage.getItem(permissionAllSystemKey)
|
|
77
|
+
if (permissionAllSystems) {
|
|
78
|
+
permissionAllSystems = permissionAllSystems.split(',')
|
|
79
|
+
}
|
|
80
|
+
if (!permissionAllSystems) {
|
|
81
|
+
permissionAllSystems = []
|
|
84
82
|
}
|
|
83
|
+
return permissionAllSystems
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function removePermissionSystemKey() {
|
|
87
|
+
localStorage.removeItem(permissionAllSystemKey)
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
function rtrim(str) { // 删除右边的空格
|
|
91
|
+
return str.replace(/(\s*$)/g, '')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 删除缓存的资源和菜单
|
|
95
|
+
export function removeAllSystemPermissions() {
|
|
96
|
+
const systemCode = getSystemCode()
|
|
97
|
+
localStorage.removeItem(permissionKey + systemCode)
|
|
98
|
+
localStorage.removeItem(permissionMenuKey + systemCode)
|
|
99
|
+
const permissionAllSystems = getPermissionAllSystemKey()
|
|
100
|
+
permissionAllSystems.forEach(key => {
|
|
101
|
+
key = rtrim(key)
|
|
102
|
+
localStorage.removeItem(key)
|
|
103
|
+
})
|
|
104
|
+
removePermissionSystemKey()
|
|
105
|
+
}
|
package/src/utils/request.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import store from '../store'
|
|
10
10
|
import checkPermission from './permission'
|
|
11
11
|
import Vue from 'vue'
|
|
12
|
-
import { h } from 'vue'
|
|
13
12
|
import {
|
|
14
13
|
getI18n
|
|
15
14
|
} from './util'
|
|
@@ -84,29 +83,42 @@ service.interceptors.response.use(
|
|
|
84
83
|
}
|
|
85
84
|
} else if (error.response.status === 403) {
|
|
86
85
|
// ForbiddenException(403) 403没权限
|
|
87
|
-
|
|
86
|
+
// 您没有权限访问
|
|
87
|
+
const message = getI18n().t('imatrixUIMessage.forbiddenException')
|
|
88
88
|
let vnode
|
|
89
89
|
if (Vue.prototype.forbiddenUser || Vue.prototype.forbiddenLinkUrl) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
vnode = '<p><span>' + message + '</span>'
|
|
91
|
+
// 请点击进行权限申请
|
|
92
|
+
const forbiddenExceptionLinkUrlMsg = getI18n().t('imatrixUIMessage.forbiddenExceptionLinkUrl')
|
|
93
93
|
if (Vue.prototype.forbiddenLinkUrl) {
|
|
94
|
-
vnode =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
94
|
+
vnode += ',<a href="#" style="color: #1800ff;font-weight: bold;text-decoration:underline" onclick="window.open(\'' + Vue.prototype.forbiddenLinkUrl + '\')">' + forbiddenExceptionLinkUrlMsg + '</a>'
|
|
95
|
+
}
|
|
96
|
+
if (Vue.prototype.forbiddenUser) {
|
|
97
|
+
// 如有疑问请联系
|
|
98
|
+
const forbiddenExceptionLinkUserMsg = getI18n().t('imatrixUIMessage.forbiddenExceptionLinkUser')
|
|
99
|
+
vnode += '<span>'
|
|
100
|
+
const forbiddenUserHtml = ',' + forbiddenExceptionLinkUserMsg + '<span style="color: #1800ff;"> ' + Vue.prototype.forbiddenUser + '</span>'
|
|
101
|
+
let contactUrlHtml
|
|
102
|
+
if (!window._clickForbiddenUser) {
|
|
103
|
+
contactUrlHtml = forbiddenUserHtml
|
|
104
|
+
} else {
|
|
105
|
+
// index.html中添加如下代码,绑定用户点击事件
|
|
106
|
+
// <script>
|
|
107
|
+
// window._clickForbiddenUser=function(linkUser) {
|
|
108
|
+
// alert(linkUser)
|
|
109
|
+
// }
|
|
110
|
+
// </script>
|
|
111
|
+
contactUrlHtml = '<a href="#" onclick="window._clickForbiddenUser(\'' + Vue.prototype.forbiddenUser + '\');return false">' + forbiddenUserHtml + '</a>'
|
|
112
|
+
}
|
|
113
|
+
vnode += '</span>'
|
|
114
|
+
vnode += contactUrlHtml
|
|
105
115
|
}
|
|
116
|
+
vnode += '</p>'
|
|
106
117
|
}
|
|
107
118
|
if (vnode) {
|
|
108
119
|
Message({
|
|
109
120
|
showClose: true,
|
|
121
|
+
dangerouslyUseHTMLString: true,
|
|
110
122
|
message: vnode,
|
|
111
123
|
type: 'error',
|
|
112
124
|
duration: 10 * 1000
|