agilebuilder-ui 1.0.70 → 1.0.71-tmp2
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 +26040 -25707
- package/lib/super-ui.umd.cjs +58 -58
- package/package.json +3 -2
- package/packages/department-tree/src/department-tree.vue +28 -10
- package/packages/department-tree-mobile/src/department-tree-app.vue +6 -6
- package/packages/department-user-tree/src/department-user-tree.vue +16 -2
- package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +6 -6
- package/packages/fs-upload-new/src/fs-button-upload.vue +8 -12
- package/packages/fs-upload-new/src/fs-drag-upload.vue +2 -2
- package/packages/fs-upload-new/src/fs-preview-new.vue +77 -27
- package/packages/super-grid/src/apis.js +6 -6
- package/packages/super-grid/src/search-button.vue +18 -14
- package/packages/super-grid/src/search-form-mobile.vue +250 -0
- package/packages/super-grid/src/search-form.vue +159 -82
- package/packages/super-grid/src/super-grid.vue +21 -5
- package/src/api/sso-service.js +25 -14
- package/src/i18n/langs/cn.js +2 -1
- package/src/i18n/langs/en.js +2 -1
- package/src/index.js +3 -1
- package/src/permission.js +108 -122
- package/src/styles/theme/green/sidebar.scss +12 -1
- package/src/utils/common-util.js +170 -115
- package/src/utils/jump-page-utils.js +34 -13
- package/src/utils/permissionAuth.js +47 -8
- package/src/utils/util.js +1 -1
package/src/utils/common-util.js
CHANGED
|
@@ -2,6 +2,8 @@ import * as Vue from 'vue'
|
|
|
2
2
|
import authApi from './auth-api'
|
|
3
3
|
import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
|
|
4
4
|
import { v4 as uuidv4 } from 'uuid'
|
|
5
|
+
import { getCookieCache } from './auth'
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* 获得相对地址
|
|
7
9
|
*/
|
|
@@ -22,9 +24,7 @@ export function getRelativeBaseUrl(originalBaseUrl) {
|
|
|
22
24
|
if (baseUrls.length >= 3) {
|
|
23
25
|
const baseUrlPrefix = baseUrls[0] + '//' + baseUrls[2]
|
|
24
26
|
// console.log('getRelativeBaseUrl---baseUrlPrefix=',baseUrlPrefix)
|
|
25
|
-
baseUrlSuffix = originalBaseUrl.substring(
|
|
26
|
-
originalBaseUrl.indexOf(baseUrlPrefix) + baseUrlPrefix.length
|
|
27
|
-
)
|
|
27
|
+
baseUrlSuffix = originalBaseUrl.substring(originalBaseUrl.indexOf(baseUrlPrefix) + baseUrlPrefix.length)
|
|
28
28
|
// console.log('getRelativeBaseUrl---baseUrlSuffix=',baseUrlSuffix)
|
|
29
29
|
}
|
|
30
30
|
if (relativeUrl.lastIndexOf('/') === relativeUrl.length - 1) {
|
|
@@ -83,19 +83,14 @@ export function replacePrefix(originalUrl) {
|
|
|
83
83
|
// console.log('replacePrefix---locationPrefixUrl=',locationPrefixUrl)
|
|
84
84
|
if (orginalPrefixUrl !== locationPrefixUrl) {
|
|
85
85
|
// 获得/demo/#/notice/task需要替换为http://127.0.0.1/demo/#/notice/task
|
|
86
|
-
let suffixUrl = originalUrl.substring(
|
|
87
|
-
originalUrl.indexOf(orginalPrefixUrl) + orginalPrefixUrl.length
|
|
88
|
-
)
|
|
86
|
+
let suffixUrl = originalUrl.substring(originalUrl.indexOf(orginalPrefixUrl) + orginalPrefixUrl.length)
|
|
89
87
|
if (suffixUrl.indexOf('/') !== 0) {
|
|
90
88
|
suffixUrl = '/' + suffixUrl
|
|
91
89
|
}
|
|
92
90
|
// console.log('replacePrefix---suffixUrl=',suffixUrl)
|
|
93
91
|
if (locationPrefixUrl.lastIndexOf('/') === locationPrefixUrl.length - 1) {
|
|
94
92
|
// 表示以“/”结尾,去掉最后一个“/”
|
|
95
|
-
locationPrefixUrl = locationPrefixUrl.substring(
|
|
96
|
-
0,
|
|
97
|
-
locationPrefixUrl.lastIndexOf('/')
|
|
98
|
-
)
|
|
93
|
+
locationPrefixUrl = locationPrefixUrl.substring(0, locationPrefixUrl.lastIndexOf('/'))
|
|
99
94
|
}
|
|
100
95
|
// console.log('replacePrefix---locationPrefixUrl2=',locationPrefixUrl)
|
|
101
96
|
newUrl = locationPrefixUrl + suffixUrl
|
|
@@ -132,12 +127,7 @@ export function getLoginUrl() {
|
|
|
132
127
|
}
|
|
133
128
|
getPortalFrontendUrl()
|
|
134
129
|
.then((portalUrl) => {
|
|
135
|
-
let loginUrl =
|
|
136
|
-
portalUrl +
|
|
137
|
-
'#/login?systemPath=' +
|
|
138
|
-
systemPath +
|
|
139
|
-
'&routerPath=' +
|
|
140
|
-
routerPath
|
|
130
|
+
let loginUrl = portalUrl + '#/login?systemPath=' + systemPath + '&routerPath=' + routerPath
|
|
141
131
|
if (param) {
|
|
142
132
|
loginUrl += '&' + param
|
|
143
133
|
}
|
|
@@ -171,8 +161,7 @@ export function isShowSystemMenu() {
|
|
|
171
161
|
export function getSystemFrontendUrl(frontendUrl) {
|
|
172
162
|
if (
|
|
173
163
|
window.$vueApp.config.globalProperties.projectModel &&
|
|
174
|
-
window.$vueApp.config.globalProperties.projectModel ===
|
|
175
|
-
'developing.model' &&
|
|
164
|
+
window.$vueApp.config.globalProperties.projectModel === 'developing.model' &&
|
|
176
165
|
window.$vueApp.config.globalProperties.frontUrl
|
|
177
166
|
) {
|
|
178
167
|
return window.$vueApp.config.globalProperties.frontUrl
|
|
@@ -184,8 +173,7 @@ export function getSystemFrontendUrl(frontendUrl) {
|
|
|
184
173
|
export function getSystemBackendUrl(backendUrl) {
|
|
185
174
|
if (
|
|
186
175
|
window.$vueApp.config.globalProperties.projectModel &&
|
|
187
|
-
window.$vueApp.config.globalProperties.projectModel ===
|
|
188
|
-
'developing.model' &&
|
|
176
|
+
window.$vueApp.config.globalProperties.projectModel === 'developing.model' &&
|
|
189
177
|
window.$vueApp.config.globalProperties.baseURL
|
|
190
178
|
) {
|
|
191
179
|
return window.$vueApp.config.globalProperties.baseURL
|
|
@@ -263,16 +251,12 @@ export function getTimeZone() {
|
|
|
263
251
|
const dateStr = new Date() + ''
|
|
264
252
|
let timeZone = ''
|
|
265
253
|
if (dateStr.indexOf('GMT') > 0) {
|
|
266
|
-
const timeZoneSuffix = dateStr
|
|
267
|
-
.substring(dateStr.indexOf('GMT') + 3, dateStr.indexOf('('))
|
|
268
|
-
.trim()
|
|
254
|
+
const timeZoneSuffix = dateStr.substring(dateStr.indexOf('GMT') + 3, dateStr.indexOf('(')).trim()
|
|
269
255
|
const partPrefix = timeZoneSuffix.substring(0, timeZoneSuffix.length - 2)
|
|
270
256
|
const partSuffix = timeZoneSuffix.substring(timeZoneSuffix.length - 2)
|
|
271
257
|
timeZone = 'UTC' + partPrefix + ':' + partSuffix
|
|
272
258
|
} else if (dateStr.indexOf('UTC') > 0) {
|
|
273
|
-
timeZone =
|
|
274
|
-
'UTC' +
|
|
275
|
-
dateStr.substring(dateStr.indexOf('UTC') + 3, dateStr.indexOf('(')).trim()
|
|
259
|
+
timeZone = 'UTC' + dateStr.substring(dateStr.indexOf('UTC') + 3, dateStr.indexOf('(')).trim()
|
|
276
260
|
}
|
|
277
261
|
return timeZone
|
|
278
262
|
}
|
|
@@ -286,8 +270,7 @@ export function setCustomSystemBackendUrl(customSystem) {
|
|
|
286
270
|
// 表示是生产环境时,需要根据数据库配置获得对应的后端地址
|
|
287
271
|
const backendUrl = window.$authApi.getSystemCacheUrlByCode(customSystem)
|
|
288
272
|
if (backendUrl) {
|
|
289
|
-
window.$vueApp.config.globalProperties.baseURL =
|
|
290
|
-
getRelativeBaseUrl(backendUrl)
|
|
273
|
+
window.$vueApp.config.globalProperties.baseURL = getRelativeBaseUrl(backendUrl)
|
|
291
274
|
}
|
|
292
275
|
}
|
|
293
276
|
}
|
|
@@ -305,13 +288,13 @@ export function pushCustomControlValidatorRef(pageCode, refName, ref) {
|
|
|
305
288
|
pageCustomControlRef.set(refName, ref)
|
|
306
289
|
}
|
|
307
290
|
|
|
308
|
-
export function removeCustomControlValidatorRef
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
291
|
+
export function removeCustomControlValidatorRef(pageCode, refName) {
|
|
292
|
+
if (window.customValidatorRef) {
|
|
293
|
+
const pageCustomControlRef = window.customValidatorRef.get(pageCode)
|
|
294
|
+
if (pageCustomControlRef) {
|
|
295
|
+
pageCustomControlRef.delete(refName)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
315
298
|
}
|
|
316
299
|
|
|
317
300
|
export function isMobileBrowser() {
|
|
@@ -379,33 +362,28 @@ export function cacheAllLanguagesUtil(http) {
|
|
|
379
362
|
setAllLanguages(cookieCacheLangs)
|
|
380
363
|
resolve()
|
|
381
364
|
} else {
|
|
382
|
-
http
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
})
|
|
405
|
-
}
|
|
406
|
-
cacheLangs(langResult)
|
|
407
|
-
resolve()
|
|
408
|
-
})
|
|
365
|
+
http.get(window.$vueApp.config.globalProperties.baseAPI + '/component/all-languages').then((langList) => {
|
|
366
|
+
const langResult = {}
|
|
367
|
+
if (langList) {
|
|
368
|
+
langList.forEach((item) => {
|
|
369
|
+
// 例如:zh_CN、en_US
|
|
370
|
+
const lang = item.value
|
|
371
|
+
let langShort
|
|
372
|
+
if (lang.indexOf('_') > 0) {
|
|
373
|
+
langShort = lang.substring(0, lang.indexOf('_'))
|
|
374
|
+
}
|
|
375
|
+
if (langShort && langShort === 'zh') {
|
|
376
|
+
// 中文处理,为了兼容历史逻辑
|
|
377
|
+
langShort = 'cn'
|
|
378
|
+
}
|
|
379
|
+
if (langShort) {
|
|
380
|
+
langResult[langShort] = lang
|
|
381
|
+
}
|
|
382
|
+
})
|
|
383
|
+
}
|
|
384
|
+
cacheLangs(langResult)
|
|
385
|
+
resolve()
|
|
386
|
+
})
|
|
409
387
|
}
|
|
410
388
|
} else {
|
|
411
389
|
resolve()
|
|
@@ -437,8 +415,8 @@ export function windowOpenUrl(url, projectModel) {
|
|
|
437
415
|
// _systemName_参数用于设置浏览器页签名的,国际化使用,在imatrix ui的beforeEach中有使用这个参数
|
|
438
416
|
if (param) {
|
|
439
417
|
jumpUrl += '&' + param
|
|
440
|
-
|
|
441
|
-
|
|
418
|
+
}
|
|
419
|
+
if (jumpUrl.indexOf('_systemName_=') === -1) {
|
|
442
420
|
jumpUrl += '&_systemName_=' + systemName
|
|
443
421
|
}
|
|
444
422
|
window.open(jumpUrl)
|
|
@@ -455,19 +433,35 @@ export function windowOpenUrl(url, projectModel) {
|
|
|
455
433
|
}
|
|
456
434
|
}
|
|
457
435
|
|
|
458
|
-
|
|
459
436
|
// 首次加载业务系统时,缓存当前用户语言
|
|
460
437
|
export function cacheCurrentLanguageUtil(http) {
|
|
438
|
+
const that = this
|
|
461
439
|
return new Promise((resolve, reject) => {
|
|
462
440
|
const token = getToken()
|
|
463
441
|
if (token) {
|
|
464
442
|
const currentLanguage = getLanguage()
|
|
465
|
-
|
|
443
|
+
debugger
|
|
444
|
+
if (
|
|
445
|
+
currentLanguage &&
|
|
446
|
+
currentLanguage !== 'undefined' &&
|
|
447
|
+
getLangFileUrl(window.$vueApp.config.globalProperties.currentSystem, currentLanguage)
|
|
448
|
+
) {
|
|
466
449
|
resolve(currentLanguage)
|
|
467
450
|
} else {
|
|
468
|
-
http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
|
|
469
|
-
|
|
470
|
-
|
|
451
|
+
// http.get(window.$vueApp.config.globalProperties.baseAPI + '/acs/user-languages').then((currentLanguage) => {
|
|
452
|
+
http
|
|
453
|
+
.get(
|
|
454
|
+
window.$vueApp.config.globalProperties.baseAPI +
|
|
455
|
+
'/acs/user/i18n-languages?systemCode=' +
|
|
456
|
+
window.$vueApp.config.globalProperties.currentSystem
|
|
457
|
+
)
|
|
458
|
+
.then((langInfo) => {
|
|
459
|
+
debugger
|
|
460
|
+
if (langInfo.i18nFileUrls && langInfo.i18nFileUrls[langInfo.language]) {
|
|
461
|
+
that.$loadScript(langInfo.i18nFileUrls[langInfo.language])
|
|
462
|
+
}
|
|
463
|
+
resolve(langInfo.language)
|
|
464
|
+
})
|
|
471
465
|
}
|
|
472
466
|
} else {
|
|
473
467
|
// 默认是中文
|
|
@@ -476,63 +470,124 @@ export function cacheCurrentLanguageUtil(http) {
|
|
|
476
470
|
})
|
|
477
471
|
}
|
|
478
472
|
export function setProjectSetting() {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
473
|
+
const projectSettingCache = Cookies.get('PROJECT_SETTINGS')
|
|
474
|
+
let projectSettings = null
|
|
475
|
+
if (projectSettingCache) {
|
|
476
|
+
projectSettings = JSON.parse(projectSettingCache)
|
|
477
|
+
this.setLogoUrl(projectSettings)
|
|
478
|
+
} else {
|
|
479
|
+
this.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
|
|
480
|
+
Cookies.set('PROJECT_SETTINGS', JSON.stringify(data))
|
|
481
|
+
projectSettings = data
|
|
482
|
+
})
|
|
483
|
+
}
|
|
484
|
+
if (projectSettings.browserImageUuid) {
|
|
485
|
+
const linkElement = document.getElementById('ambBrowserIcon')
|
|
486
|
+
if (linkElement) {
|
|
487
|
+
linkElement.href = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon'
|
|
488
|
+
}
|
|
489
|
+
}
|
|
496
490
|
}
|
|
497
491
|
|
|
498
492
|
// 动态加载css
|
|
499
493
|
export function loadCSS() {
|
|
500
494
|
var theme
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}
|
|
517
|
-
cssLink.rel = "stylesheet";
|
|
518
|
-
cssLink.type = "text/css";
|
|
519
|
-
cssLink.id="_loadTheme_"
|
|
520
|
-
cssLink.href = href;
|
|
521
|
-
if(!isHasLink){
|
|
522
|
-
document.getElementsByTagName("head")[0].appendChild(cssLink)
|
|
523
|
-
}
|
|
495
|
+
if (!theme) {
|
|
496
|
+
theme = localStorage.getItem('CURRENT_THEME')
|
|
497
|
+
}
|
|
498
|
+
if (!theme) {
|
|
499
|
+
console.error('皮肤主题为空!')
|
|
500
|
+
return
|
|
501
|
+
}
|
|
502
|
+
const baseAPI = localStorage.getItem('_baseAPI_')
|
|
503
|
+
if (baseAPI) {
|
|
504
|
+
const href = replacePrefix(baseAPI) + '/component/theme/load-theme?theme=' + theme + '&_t_=' + new Date().getTime()
|
|
505
|
+
let isHasLink = true
|
|
506
|
+
let cssLink = document.getElementById('_loadTheme_')
|
|
507
|
+
if (!cssLink) {
|
|
508
|
+
cssLink = document.createElement('link')
|
|
509
|
+
isHasLink = false
|
|
524
510
|
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
511
|
+
cssLink.rel = 'stylesheet'
|
|
512
|
+
cssLink.type = 'text/css'
|
|
513
|
+
cssLink.id = '_loadTheme_'
|
|
514
|
+
cssLink.href = href
|
|
515
|
+
if (!isHasLink) {
|
|
516
|
+
document.getElementsByTagName('head')[0].appendChild(cssLink)
|
|
528
517
|
}
|
|
529
518
|
}
|
|
519
|
+
const body = document.querySelector('body')
|
|
520
|
+
if (body) {
|
|
521
|
+
body.setAttribute('class', theme)
|
|
522
|
+
}
|
|
523
|
+
}
|
|
530
524
|
|
|
531
|
-
|
|
532
|
-
/**
|
|
525
|
+
/**
|
|
533
526
|
* 获取UUID,去掉破折号
|
|
534
527
|
* @returns
|
|
535
528
|
*/
|
|
536
529
|
export function getUuidv4() {
|
|
537
530
|
return uuidv4().replace(/-/g, '')
|
|
538
|
-
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export function replacePlaceholders(template, ...args) {
|
|
534
|
+
return template.replace(/{(\d+)}/g, (match, index) => {
|
|
535
|
+
return typeof args[index] !== 'undefined' ? args[index] : match
|
|
536
|
+
})
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function isOpenMobileGateway() {
|
|
540
|
+
// 系统参数设置中配置的是否开启移动网关,没有配置默认是开启的
|
|
541
|
+
let isOpenMobileGatewayCache = getCookieCache('IS_OPEN_MOBILE_GATEWAY')
|
|
542
|
+
if (isOpenMobileGatewayCache === undefined || isOpenMobileGatewayCache === null) {
|
|
543
|
+
isOpenMobileGatewayCache = 'true'
|
|
544
|
+
}
|
|
545
|
+
return isOpenMobileGatewayCache
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* 获得替换域名后的url
|
|
549
|
+
* @param {*} url
|
|
550
|
+
* @returns
|
|
551
|
+
*/
|
|
552
|
+
export function getReplaceUrlDomain(url) {
|
|
553
|
+
const isOpenMobileGatewayCache = isOpenMobileGateway()
|
|
554
|
+
console.log('===getReplaceUrlDomain==isOpenMobileGatewayCache=', isOpenMobileGatewayCache)
|
|
555
|
+
if (isOpenMobileGatewayCache === 'true' && url !== undefined && Vue.prototype.replaceUrl) {
|
|
556
|
+
// 表示需要替换url中的"https://域名"
|
|
557
|
+
const baseApi = Vue.prototype.baseAPI
|
|
558
|
+
if ((url + '').indexOf(Vue.prototype.replaceUrl + '/') < 0 && (url + '').indexOf('://') > 0) {
|
|
559
|
+
// 表示路径还未替换
|
|
560
|
+
console.log('===getReplaceUrlDomain==url.indexOf(Vue.prototype.replaceUrl) !== 0')
|
|
561
|
+
const prefixUrl1 = baseApi.substring(0, baseApi.indexOf('://'))
|
|
562
|
+
const urlSuffix1 = baseApi.substring(baseApi.indexOf('://') + 3)
|
|
563
|
+
const domainUrl1 = urlSuffix1.substring(0, urlSuffix1.indexOf('/'))
|
|
564
|
+
const prefixUrlBase = prefixUrl1 + '://' + domainUrl1
|
|
565
|
+
const prefixUrl2 = baseApi.substring(0, baseApi.indexOf('://'))
|
|
566
|
+
let urlSuffix = url.substring(url.indexOf('://') + 3)
|
|
567
|
+
const domainUrl2 = urlSuffix.substring(0, urlSuffix.indexOf('/'))
|
|
568
|
+
const prefixUrl = prefixUrl2 + '://' + domainUrl2
|
|
569
|
+
if (prefixUrl === prefixUrlBase) {
|
|
570
|
+
urlSuffix = urlSuffix.substring(urlSuffix.indexOf('/'))
|
|
571
|
+
url = Vue.prototype.replaceUrl + urlSuffix
|
|
572
|
+
console.log('===getReplaceUrlDomain==url=', url)
|
|
573
|
+
}
|
|
574
|
+
} else {
|
|
575
|
+
console.log('===getReplaceUrlDomain==has-replace-url=', url)
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return url
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function formatFileName(fileName) {
|
|
582
|
+
if (fileName) {
|
|
583
|
+
fileName = fileName.replace('#', '~~').replace('?', '~$').replace('&', '$')
|
|
584
|
+
}
|
|
585
|
+
return fileName
|
|
586
|
+
}
|
|
587
|
+
export function setLangFileUrl(systemCode, lang, url) {
|
|
588
|
+
window.sessionStorage.setItem('langFileUrl_' + systemCode + '_' + lang, url)
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export function getLangFileUrl(systemCode, lang) {
|
|
592
|
+
return window.sessionStorage.getItem('langFileUrl_' + systemCode + '_' + lang)
|
|
593
|
+
}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getEntityFieldValue,
|
|
6
6
|
setEntityFieldValue,
|
|
7
7
|
} from './util'
|
|
8
|
-
import { getSystemFrontendUrl, getUuidv4 } from './common-util'
|
|
8
|
+
import { getSystemFrontendUrl, getUuidv4, isMobileBrowser } from './common-util'
|
|
9
9
|
// 解析初始化条件,api方法;additionalParamMap是上个页面传过来的附加参数集合
|
|
10
10
|
export function initialization(
|
|
11
11
|
jumpPage,
|
|
@@ -365,6 +365,7 @@ function jumpToPageTwo(
|
|
|
365
365
|
if (!jumpPageUrl) {
|
|
366
366
|
return
|
|
367
367
|
}
|
|
368
|
+
const isMobile = isMobileBrowser()
|
|
368
369
|
if (jumpPageUrl.indexOf('page:') === 0) {
|
|
369
370
|
// 表示是自定义系统跳转页面编码
|
|
370
371
|
jumpWithSuperPage(
|
|
@@ -374,7 +375,8 @@ function jumpToPageTwo(
|
|
|
374
375
|
jumpPageSetting,
|
|
375
376
|
ids,
|
|
376
377
|
buttonCode,
|
|
377
|
-
isHasIdParam
|
|
378
|
+
isHasIdParam,
|
|
379
|
+
isMobile
|
|
378
380
|
).then((openPageParams) => {
|
|
379
381
|
resolve(openPageParams)
|
|
380
382
|
})
|
|
@@ -398,7 +400,8 @@ function jumpToPageTwo(
|
|
|
398
400
|
path = frontendUrl + '/#' + path
|
|
399
401
|
}
|
|
400
402
|
const systemName = getSystemNameWithLanguage(system)
|
|
401
|
-
|
|
403
|
+
// 移动端时会有返回值
|
|
404
|
+
const fullPath = jumpToPageWithFullPath(
|
|
402
405
|
dataId,
|
|
403
406
|
path,
|
|
404
407
|
additionalParameterStr,
|
|
@@ -406,9 +409,14 @@ function jumpToPageTwo(
|
|
|
406
409
|
ids,
|
|
407
410
|
buttonCode,
|
|
408
411
|
isHasIdParam,
|
|
409
|
-
systemName
|
|
412
|
+
systemName,
|
|
413
|
+
isMobile
|
|
410
414
|
)
|
|
411
|
-
|
|
415
|
+
if(fullPath){
|
|
416
|
+
// 移动端时返回的全路径
|
|
417
|
+
jumpPageSetting._path = fullPath
|
|
418
|
+
}
|
|
419
|
+
resolve(jumpPageSetting)
|
|
412
420
|
}
|
|
413
421
|
})
|
|
414
422
|
}
|
|
@@ -427,7 +435,8 @@ function jumpToPageWithFullPath(
|
|
|
427
435
|
ids,
|
|
428
436
|
buttonCode,
|
|
429
437
|
isHasIdParam,
|
|
430
|
-
systemName
|
|
438
|
+
systemName,
|
|
439
|
+
isMobile
|
|
431
440
|
) {
|
|
432
441
|
path = packagePathParams(
|
|
433
442
|
dataId,
|
|
@@ -451,6 +460,10 @@ function jumpToPageWithFullPath(
|
|
|
451
460
|
path += additionalParameterStr + systemNameParam
|
|
452
461
|
}
|
|
453
462
|
}
|
|
463
|
+
if(isMobile){
|
|
464
|
+
// 如果是移动端返回全路径即可
|
|
465
|
+
return path
|
|
466
|
+
}
|
|
454
467
|
let jumpMode = 'refresh'
|
|
455
468
|
if (jumpPage) {
|
|
456
469
|
if (jumpPage.jumpPageOpenMode) {
|
|
@@ -574,7 +587,8 @@ function jumpWithSuperPage(
|
|
|
574
587
|
jumpPageSetting,
|
|
575
588
|
ids,
|
|
576
589
|
buttonCode,
|
|
577
|
-
isHasIdParam
|
|
590
|
+
isHasIdParam,
|
|
591
|
+
isMobile
|
|
578
592
|
) {
|
|
579
593
|
return new Promise((resolve, reject) => {
|
|
580
594
|
// 表示是自定义系统跳转页面编码
|
|
@@ -587,10 +601,8 @@ function jumpWithSuperPage(
|
|
|
587
601
|
)
|
|
588
602
|
const pageCode = getPageCode(jumpPageUrl)
|
|
589
603
|
let jumpMode = 'refresh'
|
|
590
|
-
if (jumpPageSetting) {
|
|
591
|
-
if (jumpPageSetting.jumpPageOpenMode) {
|
|
604
|
+
if (jumpPageSetting && jumpPageSetting.jumpPageOpenMode) {
|
|
592
605
|
jumpMode = jumpPageSetting.jumpPageOpenMode
|
|
593
|
-
}
|
|
594
606
|
}
|
|
595
607
|
const jumpJsonData = {
|
|
596
608
|
jumpMode: jumpMode,
|
|
@@ -626,6 +638,7 @@ function jumpWithSuperPage(
|
|
|
626
638
|
popPageSetting.isRefreshWhenClosePopup = jumpPageSetting.isRefreshWhenClosePopup
|
|
627
639
|
}
|
|
628
640
|
popPageSetting._path = path
|
|
641
|
+
popPageSetting.customSystem = system.code
|
|
629
642
|
resolve(popPageSetting)
|
|
630
643
|
} else if (jumpMode === 'newTab') {
|
|
631
644
|
// 新页签打开
|
|
@@ -642,8 +655,16 @@ function jumpWithSuperPage(
|
|
|
642
655
|
) +
|
|
643
656
|
'&_t_=' +
|
|
644
657
|
new Date().getTime()
|
|
645
|
-
|
|
646
|
-
|
|
658
|
+
const popPageSetting = {
|
|
659
|
+
_path: path,
|
|
660
|
+
pageCode: pageCode,
|
|
661
|
+
customSystem: system.code
|
|
662
|
+
}
|
|
663
|
+
if(!isMobile){
|
|
664
|
+
// 不是移动端时直接open打开pc新页签
|
|
665
|
+
window.open(path)
|
|
666
|
+
}
|
|
667
|
+
resolve(popPageSetting)
|
|
647
668
|
} else {
|
|
648
669
|
// 刷新页面
|
|
649
670
|
const queryParam = {
|
|
@@ -651,7 +672,7 @@ function jumpWithSuperPage(
|
|
|
651
672
|
customSystem: system.code,
|
|
652
673
|
jumpMode: jumpMode,
|
|
653
674
|
buttonCode: buttonCode,
|
|
654
|
-
ids: ids ? ids.join(',') : ''
|
|
675
|
+
ids: ids ? ids.join(',') : ''
|
|
655
676
|
}
|
|
656
677
|
if (
|
|
657
678
|
jumpPageSetting.isNeedId === undefined ||
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as Vue from 'vue'
|
|
2
2
|
import {getSessionCache, getRunInfoKey} from './auth'
|
|
3
|
+
import { isMobileBrowser } from './common-util'
|
|
3
4
|
|
|
4
5
|
const permissionKey = 'PERMISSION-'
|
|
5
6
|
const permissionMenuKey = 'PERMISSION_MENU-'
|
|
6
7
|
const _RUN_PERMISSION = '_RUN_PERMISSION'
|
|
7
8
|
|
|
8
9
|
const permissionAllSystemKey = 'PERMISSION_All_SYSTSEM_KEY'
|
|
10
|
+
const mobilePermissionKey = 'PERMISSION-MOBILE-WEB'
|
|
9
11
|
export function getSystemCode() {
|
|
10
12
|
let systemCode
|
|
11
13
|
if (window.$vueApp.config.globalProperties.customSystem) {
|
|
@@ -23,13 +25,27 @@ export function getSystemCode() {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export function getPermissions() {
|
|
28
|
+
let totalPermissions = null
|
|
26
29
|
const systemCode = getSystemCode()
|
|
27
30
|
let permissions = localStorage.getItem(permissionKey + systemCode)
|
|
28
31
|
if (permissions) {
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
if(!totalPermissions){
|
|
33
|
+
totalPermissions = {}
|
|
34
|
+
}
|
|
35
|
+
Object.assign(totalPermissions,JSON.parse(permissions))
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
|
|
38
|
+
const isMobile = isMobileBrowser()
|
|
39
|
+
if(isMobile){
|
|
40
|
+
const permissions = localStorage.getItem(mobilePermissionKey)
|
|
41
|
+
if (permissions) {
|
|
42
|
+
if(!totalPermissions){
|
|
43
|
+
totalPermissions = {}
|
|
44
|
+
}
|
|
45
|
+
Object.assign(totalPermissions,JSON.parse(permissions))
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return totalPermissions
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
export function getTotalPermissions() {
|
|
@@ -45,6 +61,15 @@ export function getTotalPermissions() {
|
|
|
45
61
|
if (sysetemPermissions) {
|
|
46
62
|
sysetemPermissionsObj = JSON.parse(sysetemPermissions)
|
|
47
63
|
}
|
|
64
|
+
|
|
65
|
+
let mobilePermissionsObj
|
|
66
|
+
const isMobile = isMobileBrowser()
|
|
67
|
+
if(isMobile){
|
|
68
|
+
const mobilePermissions = localStorage.getItem(mobilePermissionKey)
|
|
69
|
+
if (mobilePermissions) {
|
|
70
|
+
mobilePermissionsObj = JSON.parse(mobilePermissions)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
48
73
|
const b = new Date().getTime()
|
|
49
74
|
if(runPermissionsObj || sysetemPermissionsObj) {
|
|
50
75
|
let permissions = {}
|
|
@@ -54,6 +79,9 @@ export function getTotalPermissions() {
|
|
|
54
79
|
if(sysetemPermissionsObj){
|
|
55
80
|
Object.assign(permissions, sysetemPermissionsObj)
|
|
56
81
|
}
|
|
82
|
+
if(mobilePermissionsObj){
|
|
83
|
+
Object.assign(permissions, mobilePermissionsObj)
|
|
84
|
+
}
|
|
57
85
|
// console.log('getTotalPermissions----permissions=', permissions )
|
|
58
86
|
return permissions
|
|
59
87
|
}
|
|
@@ -61,8 +89,21 @@ export function getTotalPermissions() {
|
|
|
61
89
|
}
|
|
62
90
|
|
|
63
91
|
export function setPermissions(permissions) {
|
|
64
|
-
const
|
|
65
|
-
|
|
92
|
+
const isMobile = isMobileBrowser()
|
|
93
|
+
let key
|
|
94
|
+
const permissionObjs = getPermissionObjs(permissions)
|
|
95
|
+
if(isMobile){
|
|
96
|
+
key = mobilePermissionKey
|
|
97
|
+
} else {
|
|
98
|
+
const systemCode = getSystemCode()
|
|
99
|
+
key = permissionKey + systemCode
|
|
100
|
+
}
|
|
101
|
+
localStorage.setItem(key, JSON.stringify(permissionObjs))
|
|
102
|
+
setPermissionAllSystemKey(key)
|
|
103
|
+
return permissionObjs
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function getPermissionObjs(permissions){
|
|
66
107
|
const permissionObjs = {}
|
|
67
108
|
for (let i = 0; i < permissions.length; i++) {
|
|
68
109
|
const functionCode = permissions[i]
|
|
@@ -71,9 +112,6 @@ export function setPermissions(permissions) {
|
|
|
71
112
|
permissionObjs[permission] = true
|
|
72
113
|
}
|
|
73
114
|
}
|
|
74
|
-
const key = permissionKey + systemCode
|
|
75
|
-
localStorage.setItem(key, JSON.stringify(permissionObjs))
|
|
76
|
-
setPermissionAllSystemKey(key)
|
|
77
115
|
return permissionObjs
|
|
78
116
|
}
|
|
79
117
|
|
|
@@ -147,6 +185,7 @@ function rtrim(str) { // 删除右边的空格
|
|
|
147
185
|
|
|
148
186
|
// 删除缓存的资源和菜单
|
|
149
187
|
export function removeAllSystemPermissions() {
|
|
188
|
+
localStorage.removeItem(mobilePermissionKey)
|
|
150
189
|
const systemCode = getSystemCode()
|
|
151
190
|
localStorage.removeItem(permissionKey + systemCode)
|
|
152
191
|
const myPermissionMenuKey = getRunInfoKey(permissionMenuKey)
|
package/src/utils/util.js
CHANGED
|
@@ -965,7 +965,7 @@ export function isImage(fileName) {
|
|
|
965
965
|
// const fileType = fileName.substring(fileName.lastIndexOf('.'), fileName.length).toLowerCase()
|
|
966
966
|
// const imageTypes = ['.jpg', '.JPG', '.png', '.bmp', '.BMP', '.jpeg', '.gif', '.psd', '.tif', '.tga', '.svg', '.eps']
|
|
967
967
|
// const index = imageTypes.indexOf(fileType)
|
|
968
|
-
if (
|
|
968
|
+
if (fileName &&
|
|
969
969
|
/\.(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|psd|PSD|tif|TIF)$/.test(
|
|
970
970
|
fileName
|
|
971
971
|
)
|