agilebuilder-ui 1.0.69 → 1.0.71-tmp1

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.
@@ -1,6 +1,7 @@
1
1
  import request from '../utils/request'
2
2
  import {getLanguage, getTheme} from '../utils/auth'
3
3
  import * as Vue from 'vue'
4
+ import { isMobileBrowser } from '../utils/common-util'
4
5
  function login(username, password, language) {
5
6
  const usernamePasswordToken = {
6
7
  username,
@@ -60,22 +61,26 @@ function logout() {
60
61
  }
61
62
 
62
63
  function getCurrentUserPermissionsBySystem(loginName, systemCode) {
63
- if (!systemCode) {
64
- if (window.$vueApp.config.globalProperties.customSystem) {
65
- systemCode = window.$vueApp.config.globalProperties.customSystem
66
- } else {
67
- systemCode = window.$vueApp.config.globalProperties.systemCode
64
+ if(isMobileBrowser()){
65
+ return getCurrentUserMobilePermissions(loginName)
66
+ } else {
67
+ if (!systemCode) {
68
+ if (window.$vueApp.config.globalProperties.customSystem) {
69
+ systemCode = window.$vueApp.config.globalProperties.customSystem
70
+ } else {
71
+ systemCode = window.$vueApp.config.globalProperties.systemCode
72
+ }
68
73
  }
74
+ return request.get(
75
+ window.$vueApp.config.globalProperties.baseAPI +
76
+ '/sso/current-users/permissions/with-system?loginName=' +
77
+ encodeURI(loginName) +
78
+ '&systemCode=' +
79
+ systemCode +
80
+ '&_t=' +
81
+ new Date().getTime()
82
+ )
69
83
  }
70
- return request.get(
71
- window.$vueApp.config.globalProperties.baseAPI +
72
- '/sso/current-users/permissions/with-system?loginName=' +
73
- encodeURI(loginName) +
74
- '&systemCode=' +
75
- systemCode +
76
- '&_t=' +
77
- new Date().getTime()
78
- )
79
84
  }
80
85
 
81
86
  function isPasswordExpired(username, password) {
@@ -212,6 +217,12 @@ function getDevPlatformPermissions(roleCodes) {
212
217
  )
213
218
  }
214
219
 
220
+
221
+
222
+ function getCurrentUserMobilePermissions (loginName) {
223
+ return request.get(Vue.prototype.baseAPI + '/sso/current-users/mobile-permissions?loginName=' + encodeURI(loginName) + '&_t=' + new Date().getTime())
224
+ }
225
+
215
226
  export default {
216
227
  login,
217
228
  getCurrentUser,
@@ -81,7 +81,8 @@ const cn = {
81
81
  asyncExport: '正在异步导出,请等待消息通知!',
82
82
  selectedWorkingGroup: '已选工作组',
83
83
  forbiddenExceptionLinkUrl: '请点击进行权限申请',
84
- forbiddenExceptionLinkUser: '如有疑问请联系'
84
+ forbiddenExceptionLinkUser: '如有疑问请联系',
85
+ uploadFileTip: '上传的文件不超过{fileSize}M'
85
86
  },
86
87
  // 列表组件
87
88
  superGrid: {
@@ -83,7 +83,8 @@ const en = {
83
83
  asyncExport: 'Asynchronous export, please wait for message notification!',
84
84
  selectedWorkingGroup: 'Selected working group',
85
85
  forbiddenExceptionLinkUrl: 'please click to apply',
86
- forbiddenExceptionLinkUser: 'if you have any questions,please contact'
86
+ forbiddenExceptionLinkUser: 'if you have any questions,please contact',
87
+ uploadFileTip: 'The file size should lower {fileSize}M'
87
88
  },
88
89
  superGrid: {
89
90
  columnConfig: 'Column Config',
package/src/permission.js CHANGED
@@ -8,17 +8,17 @@ import { ElMessage as Message } from 'element-plus'
8
8
  import * as Vue from 'vue'
9
9
  import authApi from './utils/auth-api'
10
10
 
11
- import {cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil} from './utils/common-util'
11
+ import { cacheAllLanguagesUtil, getLocaleByLang, cacheCurrentLanguageUtil } from './utils/common-util'
12
12
 
13
13
  // 首次加载业务系统时,获得用户的语言
14
14
  function initUserLanguage() {
15
15
  return new Promise((resolve, reject) => {
16
- cacheCurrentLanguageUtil(window.$http).then((lang) => {
17
- const locale = getLocaleByLang(lang)
18
- // i18n.locale = locale // 关键语句
19
- window.$locale = locale
20
- resolve()
21
- })
16
+ cacheCurrentLanguageUtil(window.$http).then((lang) => {
17
+ const locale = getLocaleByLang(lang)
18
+ // i18n.locale = locale // 关键语句
19
+ window.$locale = locale
20
+ resolve()
21
+ })
22
22
  })
23
23
  }
24
24
 
@@ -27,13 +27,7 @@ function cacheAllLanguages() {
27
27
  return cacheAllLanguagesUtil(window.$http)
28
28
  }
29
29
 
30
- const whiteList = [
31
- '/login',
32
- '/update-password',
33
- '/forget-password',
34
- '/reset-password',
35
- '/redirect',
36
- ] // 不重定向白名单
30
+ const whiteList = ['/login', '/update-password', '/forget-password', '/reset-password', '/redirect'] // 不重定向白名单
37
31
 
38
32
  let devpJWTKey = '_devpJWT'
39
33
  let runDevpJWTKey = '_runDevpJWT'
@@ -59,12 +53,12 @@ router.beforeEach((to, from, next) => {
59
53
  let token
60
54
  // 是否是开发环境功能
61
55
  let isDevp = isDevpSystem()
62
- if(authApi.getSessionCache(runDevpJWTKey)) {
56
+ if (authApi.getSessionCache(runDevpJWTKey)) {
63
57
  // setToken(authApi.getSessionCache(runDevpJWTKey))
64
58
  token = authApi.getSessionCache(runDevpJWTKey)
65
59
  console.log('router.beforeEach-authApi.getSessionCache(_runDevpJWT)=', authApi.getSessionCache(runDevpJWTKey))
66
60
  }
67
- if(!token) {
61
+ if (!token) {
68
62
  token = getToken()
69
63
  }
70
64
  console.log('router.beforeEach-token=', token)
@@ -100,14 +94,9 @@ router.beforeEach((to, from, next) => {
100
94
  }
101
95
  console.log('iMatrix-router.beforeEach2-isNeedMenu==', isNeedMenu)
102
96
  if (
103
- ([
104
- '/update-password',
105
- '/forget-password',
106
- '/reset-password',
107
- '/redirect',
108
- ].indexOf(to.path) === -1 ||
109
- store.getters.whiteList.indexOf(to.path) !== -1) &&
110
- token
97
+ (['/update-password', '/forget-password', '/reset-password', '/redirect'].indexOf(to.path) === -1 ||
98
+ store.getters.whiteList.indexOf(to.path) !== -1) &&
99
+ token
111
100
  ) {
112
101
  if (to.path === '/login') {
113
102
  next({ path: '/', query: to.query })
@@ -118,101 +107,87 @@ router.beforeEach((to, from, next) => {
118
107
  // 表示刷新了页面(例如点击了一级菜单)后,会重新走该方法
119
108
  console.log('router.beforeEach-store.getters.name === ""')
120
109
  store
121
- .dispatch('isLoginTimeOut')
122
- .then((result) => {
123
- if (result === true) {
124
- store.dispatch('clearToken').then(() => {
125
- next({ path: '/', replace: true })
126
- NProgress.done()
127
- })
128
- } else {
129
- store
130
- .dispatch('getCurrentUser')
131
- .then((user) => {
132
- return new Promise((resolve, reject) => {
133
- initUserLanguage().then(()=>{
134
- resolve(user)
135
- })
136
- })
137
- }).then((user)=>{
138
- return new Promise((resolve, reject) => {
139
- cacheAllLanguages().then(()=>{
140
- resolve(user)
141
- })
142
- })
143
- }).then((user)=>{
144
- console.log('router.beforeEach-getCurrentUser')
145
- const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
146
- if(!isDevp && devpRoleCodes){
147
- // 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
148
- // console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
149
- return store.dispatch(
150
- 'getDevPlatformPermissions',
151
- devpRoleCodes
152
- )
153
- } else {
154
- // 开发平台本身的功能或直接平台功能时
155
- // console.log('开发平台本身的功能或直接平台功能时')
156
- return store.dispatch(
157
- 'getCurrentUserPermissions',
158
- user.loginName
159
- )
160
- }
161
- })
162
- .then((permissions) => {
163
- return store.dispatch('generateRoutes', permissions)
164
- })
165
- .then(() => {
166
- if (isNeedMenu) {
167
- // 需要显示左侧菜单 并 不是开发平台时,开发平台的菜单需要在设计项目时获得
168
- console.log('iMatrix-router.beforeEach2-getPermissionMenus')
169
- return store.dispatch('getPermissionMenus', window.$vueApp.config.globalProperties.currentSystem)
170
- } else {
171
- return new Promise((resolve, reject) => {
172
- resolve()
173
- })
174
- }
110
+ .dispatch('isLoginTimeOut')
111
+ .then((result) => {
112
+ if (result === true) {
113
+ store.dispatch('clearToken').then(() => {
114
+ next({ path: '/', replace: true })
115
+ NProgress.done()
116
+ })
117
+ } else {
118
+ store
119
+ .dispatch('getCurrentUser')
120
+ .then((user) => {
121
+ return new Promise((resolve, reject) => {
122
+ initUserLanguage().then(() => {
123
+ resolve(user)
175
124
  })
176
- .then(() => {
177
- // 根据roles权限生成可访问的路由表
178
- console.log(
179
- 'router.beforeEach-generateRoutes==to=',
180
- to,
181
- ',from=',
182
- from
183
- )
184
- store.getters.protectedRouters.forEach(item =>{
185
- router.addRoute(item)
186
- })
187
- // 404等错误路由一定要放到受权限保护的路由之后
188
- // router.addRoutes(errorRouterMap)
189
- window.sessionStorage.setItem(
190
- new Date().getTime() + '-name=null-from~~toPath',
191
- from.path + '~~' + to.path
192
- )
193
- next({ ...to, replace: true })
125
+ })
126
+ })
127
+ .then((user) => {
128
+ return new Promise((resolve, reject) => {
129
+ cacheAllLanguages().then(() => {
130
+ resolve(user)
194
131
  })
195
- .catch((err) => {
196
- store.dispatch('clearToken').then(() => {
197
- Message.error(
198
- err || 'Verification failed, please login again'
199
- )
200
- next({ path: '/' })
201
- })
132
+ })
133
+ })
134
+ .then((user) => {
135
+ console.log('router.beforeEach-getCurrentUser')
136
+ const devpRoleCodes = authApi.getSessionCache(runCurrentRoleKey)
137
+ if (!isDevp && devpRoleCodes) {
138
+ // 表示是开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码,对应运行平台的岗位编码
139
+ // console.log('开发环境设计时生成的运行平台的JWT,且缓存了项目权限编码时,!isDevp && devpRoleCodes')
140
+ return store.dispatch('getDevPlatformPermissions', devpRoleCodes)
141
+ } else {
142
+ // 开发平台本身的功能或直接平台功能时
143
+ // console.log('开发平台本身的功能或直接平台功能时')
144
+ return store.dispatch('getCurrentUserPermissions', user.loginName)
145
+ }
146
+ })
147
+ .then((permissions) => {
148
+ return store.dispatch('generateRoutes', permissions)
149
+ })
150
+ .then(() => {
151
+ if (isNeedMenu) {
152
+ // 需要显示左侧菜单 并 不是开发平台时,开发平台的菜单需要在设计项目时获得
153
+ console.log('iMatrix-router.beforeEach2-getPermissionMenus')
154
+ return store.dispatch('getPermissionMenus', window.$vueApp.config.globalProperties.currentSystem)
155
+ } else {
156
+ return new Promise((resolve, reject) => {
157
+ resolve()
202
158
  })
203
- }
204
- })
205
- .catch((err) => {
206
- store.dispatch('clearToken').then(() => {
207
- Message.error(err || 'Verification failed, please login again')
208
- next({ path: '/' })
209
- })
159
+ }
160
+ })
161
+ .then(() => {
162
+ // 根据roles权限生成可访问的路由表
163
+ console.log('router.beforeEach-generateRoutes==to=', to, ',from=', from)
164
+ store.getters.protectedRouters.forEach((item) => {
165
+ router.addRoute(item)
166
+ })
167
+ // 404等错误路由一定要放到受权限保护的路由之后
168
+ // router.addRoutes(errorRouterMap)
169
+ window.sessionStorage.setItem(
170
+ new Date().getTime() + '-name=null-from~~toPath',
171
+ from.path + '~~' + to.path
172
+ )
173
+ next({ ...to, replace: true })
174
+ })
175
+ .catch((err) => {
176
+ store.dispatch('clearToken').then(() => {
177
+ Message.error(err || 'Verification failed, please login again')
178
+ next({ path: '/' })
179
+ })
180
+ })
181
+ }
182
+ })
183
+ .catch((err) => {
184
+ store.dispatch('clearToken').then(() => {
185
+ Message.error(err || 'Verification failed, please login again')
186
+ next({ path: '/' })
210
187
  })
188
+ })
211
189
  } else {
212
- console.log(
213
- 'router.beforeEach-store.getters.name ==',
214
- store.getters.name
215
- )
190
+ console.log('router.beforeEach-store.getters.name ==', store.getters.name)
216
191
  if (isNeedMenu) {
217
192
  // 需要显示左侧菜单
218
193
  let systemCode = window.$vueApp.config.globalProperties.currentSystem
@@ -228,10 +203,7 @@ router.beforeEach((to, from, next) => {
228
203
  }
229
204
  }
230
205
  } else {
231
- if (
232
- whiteList.indexOf(to.path) !== -1 ||
233
- store.getters.whiteList.indexOf(to.path) !== -1
234
- ) {
206
+ if (whiteList.indexOf(to.path) !== -1 || store.getters.whiteList.indexOf(to.path) !== -1) {
235
207
  next()
236
208
  } else {
237
209
  // 必须使用to.fullPath,fullPath是带有参数的,to.path没有参数,会导致跳转到的页面参数丢失
@@ -284,14 +284,25 @@
284
284
  .router-link-active >.is-active{
285
285
  color: $--menu-dont-color;
286
286
  }
287
+
287
288
  .el-menu-item{
288
- color: #FFFFFF;
289
+ color: $--menu-dont-color;
289
290
  }
291
+
290
292
  .el-menu-item:hover{
291
293
  background-color: $--menu-hove-background-color;
292
294
  color: #FFFFFF;
293
295
  }
294
296
 
297
+ .el-menu-item.is-active {
298
+ color: $--menu-dont-color;
299
+ }
300
+
301
+ .el-menu-item.is-active:hover {
302
+ background-color: $--menu-hove-background-color;
303
+ color: #FFFFFF;
304
+ }
305
+
295
306
  .el-sub-menu .el-sub-menu__title{
296
307
  color: #FFFFFF;
297
308
  }