@lambo-design/shared 1.0.0-beta.27 → 1.0.0-beta.271
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/config/config.js +17 -2
- package/config/index.js +7 -2
- package/config/themes/atrovirens/atrovirens.css +578 -0
- package/config/themes/atrovirens/atrovirens.css.map +1 -0
- package/config/themes/atrovirens/atrovirens.less +673 -0
- package/config/themes/atrovirens/var.less +680 -0
- package/config/themes/blue/blue.css +578 -0
- package/config/themes/blue/blue.css.map +1 -0
- package/config/themes/blue/blue.less +675 -0
- package/config/themes/blue/var.less +683 -0
- package/config/themes/blue-white/blue-white.css +582 -0
- package/config/themes/blue-white/blue-white.css.map +1 -0
- package/config/themes/blue-white/blue-white.less +675 -0
- package/config/themes/blue-white/var.less +681 -0
- package/config/themes/blue-white-tight/blue-white-tight.css +579 -0
- package/config/themes/blue-white-tight/blue-white-tight.css.map +1 -0
- package/config/themes/blue-white-tight/blue-white-tight.less +676 -0
- package/config/themes/blue-white-tight/var.less +683 -0
- package/config/themes/cuiwei/cuiwei.css +578 -0
- package/config/themes/cuiwei/cuiwei.css.map +10 -0
- package/config/themes/cuiwei/cuiwei.less +673 -0
- package/config/themes/cuiwei/var.less +683 -0
- package/config/themes/danqing/danqing.css +578 -0
- package/config/themes/danqing/danqing.css.map +1 -0
- package/config/themes/danqing/danqing.less +673 -0
- package/config/themes/danqing/danqing.wxss +576 -0
- package/config/themes/danqing/var.less +684 -0
- package/config/themes/deep/deep.css +578 -0
- package/config/themes/deep/deep.css.map +1 -0
- package/config/themes/deep/deep.less +673 -0
- package/config/themes/deep/var.less +683 -0
- package/config/themes/default/default.css +393 -58
- package/config/themes/default/default.css.map +1 -1
- package/config/themes/default/default.less +371 -16
- package/config/themes/default/var.less +380 -11
- package/config/themes/eap/eap.css +578 -0
- package/config/themes/eap/eap.css.map +1 -0
- package/config/themes/eap/eap.less +676 -0
- package/config/themes/eap/var.less +683 -0
- package/config/themes/gold/gold.css +578 -0
- package/config/themes/gold/gold.css.map +1 -0
- package/config/themes/gold/gold.less +676 -0
- package/config/themes/gold/var.less +374 -5
- package/config/themes/index.js +20 -3
- package/config/themes/lime/lime.css +578 -0
- package/config/themes/lime/lime.css.map +1 -0
- package/config/themes/lime/lime.less +676 -0
- package/config/themes/lime/var.less +374 -5
- package/config/themes/orange/orange.css +343 -8
- package/config/themes/orange/orange.css.map +1 -1
- package/config/themes/orange/orange.less +356 -0
- package/config/themes/orange/var.less +375 -5
- package/config/themes/red/red.css +343 -8
- package/config/themes/red/red.css.map +1 -1
- package/config/themes/red/red.less +356 -0
- package/config/themes/red/var.less +374 -5
- package/config/themes/theme-atrovirens.js +563 -0
- package/config/themes/theme-blue.js +563 -0
- package/config/themes/theme-bw.js +567 -0
- package/config/themes/theme-bwt.js +564 -0
- package/config/themes/theme-cuiwei.js +564 -0
- package/config/themes/theme-danqing.js +567 -0
- package/config/themes/theme-deep.js +563 -0
- package/config/themes/theme-default.js +369 -59
- package/config/themes/theme-eap.js +563 -0
- package/config/themes/theme-gold.js +317 -7
- package/config/themes/theme-lime.js +317 -7
- package/config/themes/theme-orange.js +551 -28
- package/config/themes/theme-red.js +555 -33
- package/config/themes/theme-white.js +563 -0
- package/config/themes/white/var.less +683 -0
- package/config/themes/white/white.css +578 -0
- package/config/themes/white/white.css.map +1 -0
- package/config/themes/white/white.less +675 -0
- package/directives/module/print.js +1 -0
- package/directives/module/vue-print-nb/README.md +63 -0
- package/directives/module/vue-print-nb/print.js +94 -0
- package/directives/module/vue-print-nb/printarea.js +532 -0
- package/index.js +7 -1
- package/nstyles/common.less +197 -0
- package/nstyles/components/404.less +46 -0
- package/nstyles/components/button.less +34 -0
- package/nstyles/components/date-picker.less +37 -0
- package/nstyles/components/drawer.less +20 -0
- package/nstyles/components/dropdown.less +18 -0
- package/nstyles/components/excel-flow.less +72 -0
- package/nstyles/components/form.less +313 -0
- package/nstyles/components/index.less +23 -0
- package/nstyles/components/layout/collect.less +10 -0
- package/nstyles/components/layout/detail-view.less +107 -0
- package/nstyles/components/layout/full-screen.less +7 -0
- package/nstyles/components/layout/index.less +7 -0
- package/nstyles/components/layout/other-menu.less +142 -0
- package/nstyles/components/layout/page-view.less +101 -0
- package/nstyles/components/layout/sider-trigger.less +41 -0
- package/nstyles/components/layout/tags-nav.less +113 -0
- package/nstyles/components/modal.less +90 -0
- package/nstyles/components/n-button.less +131 -0
- package/nstyles/components/n-image-preview.less +131 -0
- package/nstyles/components/n-model/index.less +19 -0
- package/nstyles/components/n-model/report-index.less +43 -0
- package/nstyles/components/n-panel.less +41 -0
- package/nstyles/components/n-picker.less +37 -0
- package/nstyles/components/n-sign.less +17 -0
- package/nstyles/components/n-tooltip.less +10 -0
- package/nstyles/components/panel.less +31 -0
- package/nstyles/components/select.less +3 -0
- package/nstyles/components/sign.less +27 -0
- package/nstyles/components/table.less +315 -0
- package/nstyles/components/tree.less +159 -0
- package/nstyles/components/upload.less +164 -0
- package/nstyles/index.less +5 -0
- package/nstyles/reset.less +73 -0
- package/nstyles/third/ag.less +174 -0
- package/nstyles/third/icons/sort-desc.svg +1 -0
- package/nstyles/third/icons/sort-up.svg +1 -0
- package/nstyles/third/icons/sorting.svg +1 -0
- package/nstyles/third/index.less +11 -0
- package/nstyles/third/view-design.less +375 -0
- package/nstyles/variables/base.less +143 -0
- package/nstyles/variables/index.less +4 -0
- package/nstyles/variables/theme/default/button.less +7 -0
- package/nstyles/variables/theme/default/common.less +57 -0
- package/nstyles/variables/theme/default/index.less +7 -0
- package/nstyles/variables/theme/default/layout.less +40 -0
- package/nstyles/variables/theme/default/table.less +37 -0
- package/nstyles/variables/theme/default/tag.less +3 -0
- package/nstyles/variables/theme/default/upload.less +3 -0
- package/nstyles/variables/theme/index.less +13 -0
- package/nstyles/variables/theme/lsv/button.less +7 -0
- package/nstyles/variables/theme/lsv/common.less +39 -0
- package/nstyles/variables/theme/lsv/index.less +5 -0
- package/nstyles/variables/theme/lsv/layout.less +21 -0
- package/nstyles/variables/theme/lsv/table.less +20 -0
- package/nstyles/variables/theme/lsv/tag.less +3 -0
- package/nstyles/variables/theme/small/button.less +7 -0
- package/nstyles/variables/theme/small/common.less +39 -0
- package/nstyles/variables/theme/small/index.less +5 -0
- package/nstyles/variables/theme/small/layout.less +21 -0
- package/nstyles/variables/theme/small/table.less +17 -0
- package/nstyles/variables/theme/small/tag.less +3 -0
- package/package.json +28 -7
- package/plugin/index.js +12 -0
- package/plugin/module/date-format.js +30 -0
- package/plugin/module/loading.js +26 -0
- package/plugin/module/warn-handler.js +11 -0
- package/styles/image/inspur.png +0 -0
- package/styles/image/lan_navigator.png +0 -0
- package/styles/image/layout-header-bg-cuiwei.png +0 -0
- package/styles/image/lv_navigator.png +0 -0
- package/utils/ajax/content-type.js +30 -0
- package/utils/ajax/headers.js +11 -0
- package/utils/ajax/interceptors.js +12 -4
- package/utils/ajax/sseFetchUtil.js +118 -0
- package/utils/assist.js +155 -27
- package/utils/base64.js +126 -0
- package/utils/blob.js +47 -0
- package/utils/crypto/aes.js +23 -0
- package/utils/crypto/index.js +10 -0
- package/utils/crypto/rsa.js +23 -0
- package/utils/date.js +334 -305
- package/utils/dict/built-in-dict.js +20 -0
- package/utils/dict/index.js +191 -0
- package/utils/event.js +72 -0
- package/utils/excel.js +373 -241
- package/utils/file.js +19 -0
- package/utils/form/validate.js +29 -0
- package/utils/half-year.js +68 -0
- package/utils/index.js +37 -0
- package/utils/json.js +29 -0
- package/utils/lodop.js +5 -0
- package/utils/menu/index.js +292 -15
- package/utils/mime_type.js +67 -0
- package/utils/modelerUtil.js +4 -1
- package/utils/n/api.js +22 -0
- package/utils/n/date.js +57 -0
- package/utils/n/index.js +10 -0
- package/utils/n/is-type.js +176 -0
- package/utils/n/number.js +144 -0
- package/utils/n/permission-cache.js +11 -0
- package/utils/n/reuqest/axiosN.js +17 -0
- package/utils/n/reuqest/content-type.js +19 -0
- package/utils/n/reuqest/interceptors.js +95 -0
- package/utils/n/reuqest/url-params.js +12 -0
- package/utils/n/storage.js +51 -0
- package/utils/n/token.js +51 -0
- package/utils/n/user-cache.js +11 -0
- package/utils/n/user.js +34 -0
- package/utils/n/uuid.js +16 -0
- package/utils/n-generator-routers.js +208 -0
- package/utils/n-router.js +205 -0
- package/utils/n-theme.js +30 -0
- package/utils/number.js +72 -15
- package/utils/oss.js +57 -0
- package/utils/platform.js +807 -30
- package/utils/quarter.js +58 -0
- package/utils/storage.js +198 -0
- package/utils/style.js +24 -0
- package/utils/theme.js +98 -3
- package/utils/transfer-queue.js +7 -0
- package/utils/transform.js +205 -0
- package/utils/type.js +102 -0
- package/utils/util.js +795 -0
- package/utils/vForm.js +349 -0
- package/utils/validator.js +181 -0
- package/config/themes/gold/default.css +0 -243
- package/config/themes/gold/default.css.map +0 -1
- package/config/themes/gold/default.less +0 -320
- package/config/themes/lime/default.css +0 -243
- package/config/themes/lime/default.css.map +0 -1
- package/config/themes/lime/default.less +0 -320
package/utils/platform.js
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {deepCopy} from './assist';
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import config from "../config/config";
|
|
4
|
+
import systemLogo from '../styles/image/inspur.png';
|
|
5
|
+
import {changeByThemeKey, changeThemeByThemeId} from "./theme";
|
|
6
|
+
import ajax from "./ajax";
|
|
7
|
+
import qs from 'qs'
|
|
2
8
|
|
|
3
|
-
export
|
|
9
|
+
export let TOKEN_KEY = "lambo-token"
|
|
4
10
|
|
|
5
|
-
export
|
|
11
|
+
export let getTokenKey = function () {
|
|
12
|
+
if (config.tokenKey) {
|
|
13
|
+
return config.tokenKey
|
|
14
|
+
}
|
|
15
|
+
return "lambo-token"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export let COOKIE_KEY = "lambo-sso-key"
|
|
19
|
+
|
|
20
|
+
export let getCookieKey = function () {
|
|
21
|
+
if (config.cookieKey) {
|
|
22
|
+
return config.cookieKey
|
|
23
|
+
}
|
|
24
|
+
return "lambo-sso-key"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export let SSO_TOKEN_KEY = "lambo-sso-token"
|
|
28
|
+
|
|
29
|
+
export let getSsoTokenKey = function () {
|
|
30
|
+
if (config.ssoTokenKey) {
|
|
31
|
+
return config.ssoTokenKey
|
|
32
|
+
}
|
|
33
|
+
return "lambo-sso-token"
|
|
34
|
+
}
|
|
6
35
|
|
|
7
36
|
export function objEqual(obj1, obj2) {
|
|
8
37
|
const keysArr1 = Object.keys(obj1)
|
|
@@ -13,6 +42,10 @@ export function objEqual(obj1, obj2) {
|
|
|
13
42
|
else return !keysArr1.some(key => obj1[key] !== obj2[key])
|
|
14
43
|
}
|
|
15
44
|
|
|
45
|
+
export function arraysEqual(a, b) {
|
|
46
|
+
return _.isEqual(a,b)
|
|
47
|
+
}
|
|
48
|
+
|
|
16
49
|
/**
|
|
17
50
|
* @param {Array} list 标签列表
|
|
18
51
|
* @param {String} name 当前关闭的标签的name
|
|
@@ -31,47 +64,47 @@ export function getNextRoute(list, route) {
|
|
|
31
64
|
|
|
32
65
|
|
|
33
66
|
export const setToken = (token) => {
|
|
34
|
-
sessionStorage.setItem(
|
|
67
|
+
typeof sessionStorage != 'undefined' && sessionStorage.setItem(getTokenKey(), token)
|
|
35
68
|
}
|
|
36
69
|
|
|
37
70
|
export const getToken = () => {
|
|
38
|
-
const token = sessionStorage.getItem(
|
|
71
|
+
const token = typeof sessionStorage != 'undefined' && sessionStorage.getItem(getTokenKey())
|
|
39
72
|
if (token) return token
|
|
40
73
|
else return false
|
|
41
74
|
}
|
|
42
75
|
|
|
43
76
|
export const setSessionStorage = (key, value) => {
|
|
44
|
-
sessionStorage.setItem(key, JSON.stringify(value))
|
|
77
|
+
typeof sessionStorage != 'undefined' && sessionStorage.setItem(key, JSON.stringify(value))
|
|
45
78
|
}
|
|
46
79
|
|
|
47
80
|
export const getSessionStorage = (key) => {
|
|
48
|
-
const value = sessionStorage.getItem(key)
|
|
81
|
+
const value = typeof sessionStorage != 'undefined' && sessionStorage.getItem(key)
|
|
49
82
|
if (value) return JSON.parse(value)
|
|
50
83
|
else return null
|
|
51
84
|
}
|
|
52
85
|
|
|
53
86
|
export const removeSessionStorage = (key) => {
|
|
54
|
-
return sessionStorage.removeItem(key)
|
|
87
|
+
return typeof sessionStorage != 'undefined' && sessionStorage.removeItem(key)
|
|
55
88
|
}
|
|
56
89
|
|
|
57
90
|
export const clearSessionStorage = () => {
|
|
58
|
-
return sessionStorage.clear()
|
|
91
|
+
return typeof sessionStorage != 'undefined' && sessionStorage.clear()
|
|
59
92
|
}
|
|
60
93
|
|
|
61
94
|
export const setLocalStorage = (key, localstorage) => {
|
|
62
|
-
localStorage.setItem(key, localstorage)
|
|
95
|
+
typeof localStorage != 'undefined' &&localStorage.setItem(key, localstorage)
|
|
63
96
|
}
|
|
64
97
|
|
|
65
98
|
export const getLocalStorage = (key) => {
|
|
66
|
-
return localStorage.getItem(key)
|
|
99
|
+
return typeof localStorage != 'undefined' &&localStorage.getItem(key)
|
|
67
100
|
}
|
|
68
101
|
|
|
69
102
|
export const removeLocalStorage = (key) => {
|
|
70
|
-
return localStorage.removeItem(key)
|
|
103
|
+
return typeof localStorage != 'undefined' &&localStorage.removeItem(key)
|
|
71
104
|
}
|
|
72
105
|
|
|
73
106
|
export const clearLocalStorage = () => {
|
|
74
|
-
return localStorage.clear()
|
|
107
|
+
return typeof localStorage != 'undefined' &&localStorage.clear()
|
|
75
108
|
}
|
|
76
109
|
|
|
77
110
|
export const hasChild = (item) => {
|
|
@@ -315,6 +348,12 @@ export const getTableDataFromArray = (array) => {
|
|
|
315
348
|
}
|
|
316
349
|
}
|
|
317
350
|
|
|
351
|
+
/**
|
|
352
|
+
* 寻找上级节点
|
|
353
|
+
* @param ele
|
|
354
|
+
* @param tag
|
|
355
|
+
* @returns {*}
|
|
356
|
+
*/
|
|
318
357
|
export const findNodeUpper = (ele, tag) => {
|
|
319
358
|
if (ele.parentNode) {
|
|
320
359
|
if (ele.parentNode.tagName === tag.toUpperCase()) {
|
|
@@ -325,6 +364,12 @@ export const findNodeUpper = (ele, tag) => {
|
|
|
325
364
|
}
|
|
326
365
|
}
|
|
327
366
|
|
|
367
|
+
/**
|
|
368
|
+
* 根据class寻找上级节点
|
|
369
|
+
* @param ele
|
|
370
|
+
* @param classes
|
|
371
|
+
* @returns {*}
|
|
372
|
+
*/
|
|
328
373
|
export const findNodeUpperByClasses = (ele, classes) => {
|
|
329
374
|
let parentNode = ele.parentNode
|
|
330
375
|
if (parentNode) {
|
|
@@ -337,6 +382,12 @@ export const findNodeUpperByClasses = (ele, classes) => {
|
|
|
337
382
|
}
|
|
338
383
|
}
|
|
339
384
|
|
|
385
|
+
/**
|
|
386
|
+
* 根据ele寻找下级节点
|
|
387
|
+
* @param ele
|
|
388
|
+
* @param tag
|
|
389
|
+
* @returns {*}
|
|
390
|
+
*/
|
|
340
391
|
export const findNodeDownward = (ele, tag) => {
|
|
341
392
|
const tagName = tag.toUpperCase()
|
|
342
393
|
if (ele.childNodes.length) {
|
|
@@ -350,6 +401,12 @@ export const findNodeDownward = (ele, tag) => {
|
|
|
350
401
|
}
|
|
351
402
|
}
|
|
352
403
|
|
|
404
|
+
/**
|
|
405
|
+
* @description 判断要查询的数组是否至少有一个元素包含在目标数组中
|
|
406
|
+
* @param access 需要查询的数组
|
|
407
|
+
* @param canViewAccess 目标数组
|
|
408
|
+
* @returns {*}
|
|
409
|
+
*/
|
|
353
410
|
export const showByAccess = (access, canViewAccess) => {
|
|
354
411
|
return hasOneOf(canViewAccess, access)
|
|
355
412
|
}
|
|
@@ -379,16 +436,23 @@ export const routeHasExist = (tagNavList, routeItem) => {
|
|
|
379
436
|
return res
|
|
380
437
|
}
|
|
381
438
|
|
|
382
|
-
|
|
439
|
+
/**
|
|
440
|
+
* scrollTop animation
|
|
441
|
+
* @param el
|
|
442
|
+
* @param from
|
|
443
|
+
* @param to
|
|
444
|
+
* @param duration
|
|
445
|
+
* @param endCallback
|
|
446
|
+
*/
|
|
383
447
|
export const scrollTop = (el, from = 0, to, duration = 500, endCallback) => {
|
|
384
448
|
if (!window.requestAnimationFrame) {
|
|
385
449
|
window.requestAnimationFrame = (
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
450
|
+
window.webkitRequestAnimationFrame ||
|
|
451
|
+
window.mozRequestAnimationFrame ||
|
|
452
|
+
window.msRequestAnimationFrame ||
|
|
453
|
+
function (callback) {
|
|
454
|
+
return window.setTimeout(callback, 1000 / 60)
|
|
455
|
+
}
|
|
392
456
|
)
|
|
393
457
|
}
|
|
394
458
|
const difference = Math.abs(from - to)
|
|
@@ -428,8 +492,16 @@ export const setTitle = (configTitle,routeItem, vm) => {
|
|
|
428
492
|
window.document.title = resTitle
|
|
429
493
|
}
|
|
430
494
|
|
|
431
|
-
|
|
432
|
-
|
|
495
|
+
/**
|
|
496
|
+
* 获取浏览器地址url中的参数
|
|
497
|
+
* @param url
|
|
498
|
+
* @returns {Object}
|
|
499
|
+
*/
|
|
500
|
+
export const getUrlParams = (url) => {
|
|
501
|
+
if (!url){
|
|
502
|
+
url = location.search;
|
|
503
|
+
}
|
|
504
|
+
//const url = location.search; //获取url中"?"符后的字串
|
|
433
505
|
const theRequest = new Object();
|
|
434
506
|
if (url.indexOf("?") != -1) {
|
|
435
507
|
const str = url.substr(1);
|
|
@@ -468,6 +540,80 @@ export const getChangeTableDatas = (oldData, newData) => {
|
|
|
468
540
|
return list
|
|
469
541
|
}
|
|
470
542
|
|
|
543
|
+
/**
|
|
544
|
+
* 合并数组并去重
|
|
545
|
+
* @param oldRow
|
|
546
|
+
* @param newRow
|
|
547
|
+
* @param key
|
|
548
|
+
* @returns {*[]}
|
|
549
|
+
*/
|
|
550
|
+
export const removeDup = (oldRow,newRow,key) => {
|
|
551
|
+
let resultMap = {};
|
|
552
|
+
for(let o of oldRow){
|
|
553
|
+
resultMap[o[key]] = o;
|
|
554
|
+
}
|
|
555
|
+
for (let n of newRow) {
|
|
556
|
+
resultMap[n[key]] = n;
|
|
557
|
+
}
|
|
558
|
+
let result = []
|
|
559
|
+
for (let row in resultMap) {
|
|
560
|
+
result.push(resultMap[row])
|
|
561
|
+
}
|
|
562
|
+
return result;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* 获取数组修改的数据
|
|
566
|
+
* @param oldRow
|
|
567
|
+
* @param newRow
|
|
568
|
+
* @param key
|
|
569
|
+
* @returns {{delList: *[], addList: *[]}}
|
|
570
|
+
*/
|
|
571
|
+
export const getChangeData = (oldRow,newRow,key) =>{
|
|
572
|
+
let oldMap = {};
|
|
573
|
+
for(let o of oldRow){
|
|
574
|
+
if (key){
|
|
575
|
+
oldMap[o[key]] = o;
|
|
576
|
+
} else {
|
|
577
|
+
oldMap[o] = o;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
let newMap = {}
|
|
581
|
+
for(let n of newRow){
|
|
582
|
+
if (key){
|
|
583
|
+
newMap[n[key]] = n;
|
|
584
|
+
} else {
|
|
585
|
+
newMap[n] = n;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
let addList = []
|
|
589
|
+
for (let n of newRow) {
|
|
590
|
+
if (key){
|
|
591
|
+
if (!oldMap[n[key]]) {
|
|
592
|
+
addList.push(n);
|
|
593
|
+
}
|
|
594
|
+
} else {
|
|
595
|
+
if (!oldMap[n]) {
|
|
596
|
+
addList.push(n);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
let delList = []
|
|
601
|
+
for (let o of oldRow) {
|
|
602
|
+
if (key){
|
|
603
|
+
if (!newMap[o[key]]) {
|
|
604
|
+
delList.push(o);
|
|
605
|
+
}
|
|
606
|
+
} else {
|
|
607
|
+
if (!newMap[o]) {
|
|
608
|
+
delList.push(o);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return {
|
|
613
|
+
addList,delList
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
471
617
|
/**
|
|
472
618
|
* @param {Array} arr1
|
|
473
619
|
* @param {Array} arr2
|
|
@@ -502,6 +648,11 @@ const hasOneOf = (targetarr, arr) => {
|
|
|
502
648
|
return targetarr.some(_ => arr.indexOf(_) > -1)
|
|
503
649
|
}
|
|
504
650
|
|
|
651
|
+
/**
|
|
652
|
+
* foreach
|
|
653
|
+
* @param arr
|
|
654
|
+
* @param fn 回调函数,参数接收arr的元素,索引,arr本身
|
|
655
|
+
*/
|
|
505
656
|
const forEach = (arr, fn) => {
|
|
506
657
|
if (!arr.length || !fn) return
|
|
507
658
|
let i = -1
|
|
@@ -525,9 +676,17 @@ export function oneOf (value, validList) {
|
|
|
525
676
|
return false
|
|
526
677
|
}
|
|
527
678
|
|
|
679
|
+
/**
|
|
680
|
+
* recursionKeyFindItem
|
|
681
|
+
* @param arr
|
|
682
|
+
* @param filterKey
|
|
683
|
+
* @param filterValue
|
|
684
|
+
* @param recursionKey
|
|
685
|
+
* @returns {*|null}
|
|
686
|
+
*/
|
|
528
687
|
export const recursionKeyFindItem = (arr, filterKey, filterValue, recursionKey) => {
|
|
529
688
|
for (const item of arr) {
|
|
530
|
-
if (item[filterKey] && item[filterKey] == filterValue) {
|
|
689
|
+
if (item[filterKey] && item[filterKey] == filterValue && item['type'] == 2) {
|
|
531
690
|
return item;
|
|
532
691
|
}
|
|
533
692
|
let result = null;
|
|
@@ -541,18 +700,340 @@ export const recursionKeyFindItem = (arr, filterKey, filterValue, recursionKey)
|
|
|
541
700
|
return null;
|
|
542
701
|
};
|
|
543
702
|
|
|
703
|
+
/**
|
|
704
|
+
* filterMenuName
|
|
705
|
+
* @param menuList
|
|
706
|
+
* @param name
|
|
707
|
+
* @returns {*|null}
|
|
708
|
+
*/
|
|
544
709
|
export const filterMenuName = (menuList, name) => {
|
|
545
710
|
return recursionKeyFindItem(menuList, 'name', name, 'children')
|
|
546
711
|
};
|
|
547
712
|
|
|
713
|
+
/**
|
|
714
|
+
* filterMenuUri
|
|
715
|
+
* @param menuList
|
|
716
|
+
* @param name
|
|
717
|
+
* @returns {*|null}
|
|
718
|
+
*/
|
|
548
719
|
export const filterMenuUri = (menuList, name) => {
|
|
549
720
|
return recursionKeyFindItem(menuList, 'uri', name, 'children')
|
|
550
721
|
};
|
|
551
722
|
|
|
723
|
+
/**
|
|
724
|
+
* tagExists
|
|
725
|
+
* @param taglist
|
|
726
|
+
* @param name
|
|
727
|
+
* @returns {boolean}
|
|
728
|
+
*/
|
|
552
729
|
export const tagExists = (taglist, name) => {
|
|
553
730
|
return taglist && taglist.filter(item => item.name === name).length > 0;
|
|
554
731
|
};
|
|
555
732
|
|
|
733
|
+
/**
|
|
734
|
+
* 判断菜单是否为新窗口打开
|
|
735
|
+
* @param menu
|
|
736
|
+
*/
|
|
737
|
+
export const isOpenBlank = (menu) => {
|
|
738
|
+
let extendProps = {}
|
|
739
|
+
if (menu && menu.meta && menu.meta.data && menu.meta.data.extension) {
|
|
740
|
+
extendProps = JSON.parse(menu.meta.data.extension)
|
|
741
|
+
}
|
|
742
|
+
if (menu && menu.extension) {
|
|
743
|
+
extendProps = JSON.parse(menu.extension)
|
|
744
|
+
}
|
|
745
|
+
if (extendProps && extendProps.target_type && extendProps.target_type == 'blank') {
|
|
746
|
+
return true;
|
|
747
|
+
}
|
|
748
|
+
if (extendProps && extendProps.targetType && extendProps.targetType == 'blank') {
|
|
749
|
+
return true;
|
|
750
|
+
}
|
|
751
|
+
return false;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* 判断应用是否为移动应用
|
|
756
|
+
* @param app
|
|
757
|
+
*/
|
|
758
|
+
export const isMobileApp = (app) => {
|
|
759
|
+
try{
|
|
760
|
+
let extendProps = {};
|
|
761
|
+
if (app.extendProps) {
|
|
762
|
+
if (typeof app.extendProps == 'string') {
|
|
763
|
+
extendProps = JSON.parse(app.extendProps);
|
|
764
|
+
} else {
|
|
765
|
+
extendProps = app.extendProps;
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
if (app.setting) {
|
|
769
|
+
if (typeof app.setting == 'string') {
|
|
770
|
+
extendProps = JSON.parse(app.setting);
|
|
771
|
+
} else {
|
|
772
|
+
extendProps = app.setting;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
if (extendProps && extendProps.is_mobile_app && extendProps.is_mobile_app == '1') {
|
|
776
|
+
return true;
|
|
777
|
+
}
|
|
778
|
+
}catch (e) {
|
|
779
|
+
console.error(e)
|
|
780
|
+
}
|
|
781
|
+
return false;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* 获取pc应用列表
|
|
786
|
+
* @param appList
|
|
787
|
+
* @returns {*[]}
|
|
788
|
+
*/
|
|
789
|
+
export const getPCAppList = (appList,filterCenter = false) => {
|
|
790
|
+
let finalList = []
|
|
791
|
+
if(appList) {
|
|
792
|
+
for (let app of appList) {
|
|
793
|
+
if ((!isMobileApp(app) && filterCenter && isCenterApp(app))
|
|
794
|
+
|| (!isMobileApp(app) && !filterCenter)) {
|
|
795
|
+
finalList.push(app);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return finalList;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* 获取移动应用列表
|
|
804
|
+
* @param appList
|
|
805
|
+
* @returns {*[]}
|
|
806
|
+
*/
|
|
807
|
+
export const getMobileAppList = (appList,filterCenter= false) => {
|
|
808
|
+
let finalList = []
|
|
809
|
+
if(appList) {
|
|
810
|
+
for (let app of appList) {
|
|
811
|
+
if ((isMobileApp(app) && filterCenter && isCenterApp(app))
|
|
812
|
+
|| (isMobileApp(app) && !filterCenter)) {
|
|
813
|
+
finalList.push(app);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return finalList;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* 判断应用是否门户应用
|
|
821
|
+
* @param menu
|
|
822
|
+
*/
|
|
823
|
+
export const isCenterApp = (app) => {
|
|
824
|
+
try{
|
|
825
|
+
let extendProps = {};
|
|
826
|
+
if (app.extendProps) {
|
|
827
|
+
if (typeof app.extendProps == 'string') {
|
|
828
|
+
extendProps = JSON.parse(app.extendProps);
|
|
829
|
+
} else {
|
|
830
|
+
extendProps = app.extendProps;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
if (app.setting) {
|
|
834
|
+
if (typeof app.setting == 'string') {
|
|
835
|
+
extendProps = JSON.parse(app.setting);
|
|
836
|
+
} else {
|
|
837
|
+
extendProps = app.setting;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
if (extendProps && extendProps.is_center_app && extendProps.is_center_app == '1') {
|
|
841
|
+
return true;
|
|
842
|
+
}
|
|
843
|
+
}catch (e) {
|
|
844
|
+
console.error(e);
|
|
845
|
+
}
|
|
846
|
+
return false;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* 获取一级菜单作为顶级导航
|
|
851
|
+
* @param permissionList
|
|
852
|
+
* @param appType
|
|
853
|
+
* @returns {*[]}
|
|
854
|
+
*/
|
|
855
|
+
export const buildNavListByMenu = (permissionList,appInfo,appType,defaultHideName = '') => {
|
|
856
|
+
let navList = []
|
|
857
|
+
if (permissionList && appInfo && appInfo.appId) {
|
|
858
|
+
let permissions = permissionList.filter(item => item.hasOwnProperty('pid')
|
|
859
|
+
&& item.pid == '0' && item.appId == appInfo.appId && item.name != defaultHideName)
|
|
860
|
+
for (let per of permissions) {
|
|
861
|
+
if (appType && appType == 'sc') {
|
|
862
|
+
let nav = {
|
|
863
|
+
"data" : deepCopy(per),
|
|
864
|
+
"appInfo" : deepCopy(appInfo),
|
|
865
|
+
"orderNo": per.orders,
|
|
866
|
+
"application": {
|
|
867
|
+
"extendProps": per.extension ? JSON.parse(per.extension) : "",
|
|
868
|
+
"appId": per.permissionId,
|
|
869
|
+
"appBizCode": per.permissionValue,
|
|
870
|
+
"appName": per.title,
|
|
871
|
+
"appDesc": per.description,
|
|
872
|
+
"appUrl": appInfo.basepath,
|
|
873
|
+
"icon": per.icon,
|
|
874
|
+
"appStatus": 1,
|
|
875
|
+
"manageUnitId": "",
|
|
876
|
+
"protocolType": null,
|
|
877
|
+
"grantTypes": null,
|
|
878
|
+
"logoutUrl": null,
|
|
879
|
+
"redirectUrls": null,
|
|
880
|
+
"codeExpiresIn": null,
|
|
881
|
+
"idTokenExpiresIn": null,
|
|
882
|
+
"accessTokenExpiresIn": null,
|
|
883
|
+
"clientId": "",
|
|
884
|
+
"clientSecret": "",
|
|
885
|
+
"isEnableSso": false,
|
|
886
|
+
"isShare": false,
|
|
887
|
+
"referAppId": null,
|
|
888
|
+
"externalId": null,
|
|
889
|
+
"callerAppId": null,
|
|
890
|
+
"orderNo": 1,
|
|
891
|
+
"parentId": null,
|
|
892
|
+
"appType": null,
|
|
893
|
+
"relativeName": null,
|
|
894
|
+
"shortName": null,
|
|
895
|
+
"authType": "1",
|
|
896
|
+
"isLower": null
|
|
897
|
+
},
|
|
898
|
+
"basepath": appInfo.basepath,
|
|
899
|
+
"appId": per.permissionId,
|
|
900
|
+
"icon": per.icon,
|
|
901
|
+
"name": per.name,
|
|
902
|
+
"extendProps": per.extension ? JSON.parse(per.extension) : "",
|
|
903
|
+
"title": per.title,
|
|
904
|
+
"type": "00",
|
|
905
|
+
"status": 1
|
|
906
|
+
}
|
|
907
|
+
navList.push(nav)
|
|
908
|
+
} else {
|
|
909
|
+
let nav = {
|
|
910
|
+
"data" : deepCopy(per),
|
|
911
|
+
"appInfo" : deepCopy(appInfo),
|
|
912
|
+
"id": per.id,
|
|
913
|
+
"appId": per.permissionId,
|
|
914
|
+
"systemId": per.systemId,
|
|
915
|
+
"icon": per.icon,
|
|
916
|
+
"banner": null,
|
|
917
|
+
"theme": null,
|
|
918
|
+
"basepath": appInfo.basepath,
|
|
919
|
+
"status": 1,
|
|
920
|
+
"name": per.name,
|
|
921
|
+
"title": per.title,
|
|
922
|
+
"type": "00",
|
|
923
|
+
"setting": "",
|
|
924
|
+
"description": per.description,
|
|
925
|
+
"orders": per.orders,
|
|
926
|
+
"createTime": 1710772466000,
|
|
927
|
+
"updateTime": 1710772466000
|
|
928
|
+
}
|
|
929
|
+
navList.push(nav)
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return navList;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* 判断是否为子菜单
|
|
938
|
+
* @param permissionList
|
|
939
|
+
* @param pid
|
|
940
|
+
* @param per
|
|
941
|
+
* @returns {boolean|boolean|*}
|
|
942
|
+
*/
|
|
943
|
+
export const isChildPermission = (permissionList, pid, per) => {
|
|
944
|
+
if (permissionList && pid && per && per.pid) {
|
|
945
|
+
let res = permissionList.find(item => item.hasOwnProperty('permissionId') && item.permissionId == per.pid)
|
|
946
|
+
if (res && res.permissionId && res.permissionId == pid) {
|
|
947
|
+
return true;
|
|
948
|
+
} else {
|
|
949
|
+
return isChildPermission(permissionList, pid, res)
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
return false;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* 获取所有子菜单
|
|
956
|
+
* @param permissionList
|
|
957
|
+
* @param pid
|
|
958
|
+
*/
|
|
959
|
+
export const getChildPermissions = (permissionList, pid, appInfo) => {
|
|
960
|
+
let res = []
|
|
961
|
+
if (permissionList && pid) {
|
|
962
|
+
for (let permission of permissionList) {
|
|
963
|
+
if (isChildPermission(permissionList, pid, permission)) {
|
|
964
|
+
let per2 = deepCopy(permission);
|
|
965
|
+
per2.appId = pid;
|
|
966
|
+
if (per2.pid == pid) {
|
|
967
|
+
per2.pid = "0";
|
|
968
|
+
}
|
|
969
|
+
per2.appInfo = deepCopy(appInfo)
|
|
970
|
+
res.push(per2);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
return res;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* 恢复权限的原始信息
|
|
978
|
+
* @param permission
|
|
979
|
+
*/
|
|
980
|
+
export const getOriginalPermission = (permission) => {
|
|
981
|
+
if (permission && permission.meta && permission.meta.data && permission.meta.data.appInfo) {
|
|
982
|
+
let per2 = deepCopy(permission);
|
|
983
|
+
if (per2.hasOwnProperty('pid') && per2.pid == '0') {
|
|
984
|
+
per2.pid = per2.meta.data.appId;
|
|
985
|
+
per2.meta.data.pid = per2.meta.data.appId;
|
|
986
|
+
}
|
|
987
|
+
per2.meta.appId = permission.meta.data.appInfo.appId;
|
|
988
|
+
per2.meta.data.appId = permission.meta.data.appInfo.appId;
|
|
989
|
+
return per2;
|
|
990
|
+
}
|
|
991
|
+
return permission
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* 单应用时修改源权限信息
|
|
996
|
+
* @param permissionList
|
|
997
|
+
* @param menu
|
|
998
|
+
* @param appInfo
|
|
999
|
+
* @returns {*}
|
|
1000
|
+
*/
|
|
1001
|
+
export const buildSinglePermission = (permissionList, menu) => {
|
|
1002
|
+
let permission = permissionList.find(item => item.permissionId == menu.permissionId && item.appId == menu.appId)
|
|
1003
|
+
let rootPermission = getRootPermission(permissionList, permission)
|
|
1004
|
+
if (rootPermission && rootPermission.permissionId) {
|
|
1005
|
+
menu.appInfo = {
|
|
1006
|
+
appId: menu.appId
|
|
1007
|
+
}
|
|
1008
|
+
menu.appId = rootPermission.permissionId;
|
|
1009
|
+
}
|
|
1010
|
+
return menu;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* 获取菜单根节点
|
|
1014
|
+
* @param permissionList
|
|
1015
|
+
* @param permission
|
|
1016
|
+
* @returns {*|{pid}|{}}
|
|
1017
|
+
*/
|
|
1018
|
+
export const getRootPermission = (permissionList, permission) => {
|
|
1019
|
+
if (permissionList, permission) {
|
|
1020
|
+
if (!permission.hasOwnProperty('pid')) {
|
|
1021
|
+
return permission
|
|
1022
|
+
} else if (permission.pid == '0') {
|
|
1023
|
+
return permission
|
|
1024
|
+
} else {
|
|
1025
|
+
let parentPermission = permissionList.find(item => item.permissionId == permission.pid && item.appId == permission.appId)
|
|
1026
|
+
return getRootPermission(permissionList, parentPermission);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
return permission;
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* getPreviousTagIndex
|
|
1033
|
+
* @param tagList
|
|
1034
|
+
* @param name
|
|
1035
|
+
* @returns {number}
|
|
1036
|
+
*/
|
|
556
1037
|
export const getPreviousTagIndex = (tagList, name) => {
|
|
557
1038
|
let count = 0;
|
|
558
1039
|
if (tagList && name) {
|
|
@@ -570,6 +1051,12 @@ export const getPreviousTagIndex = (tagList, name) => {
|
|
|
570
1051
|
return count;
|
|
571
1052
|
};
|
|
572
1053
|
|
|
1054
|
+
/**
|
|
1055
|
+
* getDelTagIndex
|
|
1056
|
+
* @param tagList
|
|
1057
|
+
* @param name
|
|
1058
|
+
* @returns {number}
|
|
1059
|
+
*/
|
|
573
1060
|
export const getDelTagIndex = (tagList, name) => {
|
|
574
1061
|
let count = 1;
|
|
575
1062
|
if (tagList && name) {
|
|
@@ -583,13 +1070,303 @@ export const getDelTagIndex = (tagList, name) => {
|
|
|
583
1070
|
return count;
|
|
584
1071
|
}
|
|
585
1072
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
1073
|
+
/**
|
|
1074
|
+
* turnToPage
|
|
1075
|
+
* @param vm
|
|
1076
|
+
* @param name
|
|
1077
|
+
* @param url
|
|
1078
|
+
* @param forceLocation
|
|
1079
|
+
* @param queryObj
|
|
1080
|
+
*/
|
|
1081
|
+
export const turnToPage = (vm, name ,url, forceLocation = false, queryObj = {}) =>{
|
|
1082
|
+
let query = qs.stringify(queryObj)
|
|
1083
|
+
if(query){
|
|
1084
|
+
url = url + '?' + query;
|
|
1085
|
+
}
|
|
1086
|
+
if (window.top && window.top.location.href !== window.location.href) {
|
|
1087
|
+
typeof sessionStorage != 'undefined' && sessionStorage.removeItem('activeName')
|
|
1088
|
+
window.top.location.href = url;
|
|
1089
|
+
} else if (forceLocation){
|
|
1090
|
+
typeof sessionStorage != 'undefined' && sessionStorage.removeItem('activeName')
|
|
1091
|
+
if (window.top){
|
|
1092
|
+
window.top.location.href = url;
|
|
1093
|
+
} else {
|
|
1094
|
+
window.location.href = url;
|
|
1095
|
+
}
|
|
1096
|
+
} else if (vm && vm.$router){
|
|
591
1097
|
vm.$router.push({
|
|
592
|
-
name: name
|
|
1098
|
+
name: name,
|
|
1099
|
+
...queryObj
|
|
593
1100
|
})
|
|
1101
|
+
} else {
|
|
1102
|
+
window.location.href = url;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
/**
|
|
1108
|
+
* 获取上级节点的方法
|
|
1109
|
+
* @param vm
|
|
1110
|
+
* @param methodName
|
|
1111
|
+
* @returns {*}
|
|
1112
|
+
*/
|
|
1113
|
+
export const getParentMethod = (vm,methodName) => {
|
|
1114
|
+
if (vm.$parent) {
|
|
1115
|
+
if (vm.$parent[methodName]) {
|
|
1116
|
+
return vm.$parent[methodName];
|
|
1117
|
+
} else {
|
|
1118
|
+
return getParentMethod(vm.$parent,methodName)
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return undefined;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* 执行全屏操作
|
|
1126
|
+
* @param vm
|
|
1127
|
+
*/
|
|
1128
|
+
export const doParentMethod = (vm,methodName) => {
|
|
1129
|
+
let action = getParentMethod(vm,methodName)
|
|
1130
|
+
if (action) {
|
|
1131
|
+
action()
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* 替换url中的指定参数
|
|
1136
|
+
* @param url
|
|
1137
|
+
* @param paramName
|
|
1138
|
+
* @param paramValue
|
|
1139
|
+
* @returns {string}
|
|
1140
|
+
*/
|
|
1141
|
+
export const replaceUrlParam = (url, paramName, paramValue) => {
|
|
1142
|
+
let pattern = new RegExp('(' + paramName + '=)([^&]+)', 'i');
|
|
1143
|
+
let queryString = url.split('?')[1];
|
|
1144
|
+
if (queryString) {
|
|
1145
|
+
let newParam = paramName + '=' + encodeURIComponent(paramValue);
|
|
1146
|
+
let newQueryString = queryString.replace(pattern, newParam);
|
|
1147
|
+
return url.split('?')[0] + '?' + newQueryString;
|
|
1148
|
+
} else {
|
|
1149
|
+
return url + '?' + paramName + '=' + encodeURIComponent(paramValue);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* 拼接url
|
|
1154
|
+
* @param href
|
|
1155
|
+
* @param key
|
|
1156
|
+
* @param value
|
|
1157
|
+
* @returns {string}
|
|
1158
|
+
*/
|
|
1159
|
+
export const buildParams = (href, key, value) =>{
|
|
1160
|
+
if (href && key && value) {
|
|
1161
|
+
if (!href.includes(key + '=')) {
|
|
1162
|
+
if (href.includes('?')) {
|
|
1163
|
+
href += '&' + key + '=' + value
|
|
1164
|
+
} else {
|
|
1165
|
+
href += '?' + key + '=' + value
|
|
1166
|
+
}
|
|
1167
|
+
} else {
|
|
1168
|
+
href = this.replaceUrlParam(href,key,value)
|
|
1169
|
+
}
|
|
1170
|
+
return href;
|
|
1171
|
+
}
|
|
1172
|
+
return '';
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* 组装菜单url
|
|
1176
|
+
* @param item
|
|
1177
|
+
* @param ssoToken
|
|
1178
|
+
* @param ssoid
|
|
1179
|
+
* @returns {string}
|
|
1180
|
+
*/
|
|
1181
|
+
export const buildMenuUri = (item,ssoToken,ssoid) => {
|
|
1182
|
+
if (!item.uri) {
|
|
1183
|
+
return ''
|
|
1184
|
+
}
|
|
1185
|
+
let href = ''
|
|
1186
|
+
let uri = item.uri
|
|
1187
|
+
if (uri.startsWith('http')) {
|
|
1188
|
+
href = uri
|
|
1189
|
+
} else {
|
|
1190
|
+
let basepath = ''
|
|
1191
|
+
if (item.navList) {
|
|
1192
|
+
let navList = deepCopy(item.navList);
|
|
1193
|
+
let appId = '';
|
|
1194
|
+
if (item.appId) {
|
|
1195
|
+
appId = item.appId;
|
|
1196
|
+
} else if (item.meta && item.meta.appId) {
|
|
1197
|
+
appId = item.meta.appId;
|
|
1198
|
+
}
|
|
1199
|
+
let appInfo = navList.find(app => app.appId === appId)
|
|
1200
|
+
if (appInfo && appInfo.basepath) {
|
|
1201
|
+
basepath = appInfo.basepath
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
if (!basepath.startsWith('/') && !basepath.startsWith('http')) {
|
|
1205
|
+
basepath = '/' + basepath
|
|
1206
|
+
}
|
|
1207
|
+
if (basepath.endsWith('/')) {
|
|
1208
|
+
basepath = basepath.substring(0, basepath.length - 1)
|
|
1209
|
+
}
|
|
1210
|
+
if (!uri.startsWith('/')) {
|
|
1211
|
+
uri = '/' + uri
|
|
1212
|
+
}
|
|
1213
|
+
href = basepath + uri
|
|
1214
|
+
}
|
|
1215
|
+
href = buildParams(href,"layout","screen");
|
|
1216
|
+
if (ssoToken) {
|
|
1217
|
+
href = buildParams(href,"token",ssoToken);
|
|
1218
|
+
}
|
|
1219
|
+
if (ssoid) {
|
|
1220
|
+
href = buildParams(href,"ssoid",ssoid);
|
|
1221
|
+
}
|
|
1222
|
+
if (item.cts) {
|
|
1223
|
+
href = buildParams(href,"cts",item.cts);
|
|
1224
|
+
}
|
|
1225
|
+
return href
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* 给query添加时间戳
|
|
1229
|
+
*/
|
|
1230
|
+
export const addTimestamp = ($route) => {
|
|
1231
|
+
let query = {};
|
|
1232
|
+
if ($route.query) {
|
|
1233
|
+
query = $route.query;
|
|
1234
|
+
}
|
|
1235
|
+
query = Object.assign({},query,{cts:new Date().getTime()})
|
|
1236
|
+
$route.query = query;
|
|
1237
|
+
return $route;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* 根据配置信息修改系统信息
|
|
1241
|
+
* @param systemInfo
|
|
1242
|
+
*/
|
|
1243
|
+
export const changeSystemInfo = async (systemInfo) => {
|
|
1244
|
+
let defaultSystemInfo = {
|
|
1245
|
+
layoutSize: 'small',
|
|
1246
|
+
systemLogo: systemLogo,
|
|
1247
|
+
logoWidth: '150px',
|
|
1248
|
+
systemName: sessionStorage.getItem('systemName') ? sessionStorage.getItem('systemName') : config.title,
|
|
1249
|
+
nameSize: 1,
|
|
1250
|
+
navType: 'dropdown',
|
|
1251
|
+
rightTopOptButtonList: ['collect', 'fullScreen'],
|
|
1252
|
+
rightTopShowFunList: ['theme', 'personalCenter', 'noticeList', 'logout'],
|
|
1253
|
+
menuLogo: '1',
|
|
1254
|
+
titleShow: 'wrap',
|
|
1255
|
+
menuScaling: '1',
|
|
1256
|
+
footerInfo: 'Copyright © 2021 浪潮数字商业科技有限公司 版权所有<br> 辽ICP备11001865号-3',
|
|
1257
|
+
showTheme: '',
|
|
1258
|
+
theme: 'default',
|
|
1259
|
+
tabNum: 5,
|
|
1260
|
+
topMenu: 4,
|
|
1261
|
+
};
|
|
1262
|
+
if (systemInfo) {
|
|
1263
|
+
systemInfo = Object.assign(defaultSystemInfo, systemInfo);
|
|
1264
|
+
} else {
|
|
1265
|
+
systemInfo = defaultSystemInfo;
|
|
1266
|
+
}
|
|
1267
|
+
if (systemInfo.logo) {
|
|
1268
|
+
systemInfo.systemLogo = config.ossServerContext + '/anon/system/file/get/' + systemInfo.logo
|
|
1269
|
+
} else {
|
|
1270
|
+
systemInfo.systemLogo = ''
|
|
1271
|
+
}
|
|
1272
|
+
sessionStorage.setItem('systemLogo', systemInfo.systemLogo)
|
|
1273
|
+
if (systemInfo.systemLogo) {
|
|
1274
|
+
let link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
|
1275
|
+
link.setAttribute('href', systemInfo.systemLogo);
|
|
1276
|
+
if (!link.getAttribute('rel')) {
|
|
1277
|
+
link.setAttribute('rel', 'icon');
|
|
1278
|
+
}
|
|
1279
|
+
if (!link.getAttribute('type')) {
|
|
1280
|
+
link.setAttribute('type', 'image/png');
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if (systemInfo.logoWidth) {
|
|
1284
|
+
systemInfo.logoWidth = systemInfo.logoWidth + ''
|
|
1285
|
+
}
|
|
1286
|
+
if (systemInfo.systemName) {
|
|
1287
|
+
document.title = systemInfo.systemName
|
|
1288
|
+
sessionStorage.setItem('systemName', systemInfo.systemName)
|
|
1289
|
+
}
|
|
1290
|
+
if (localStorage.getItem('theme')) {
|
|
1291
|
+
systemInfo.theme = localStorage.getItem('theme')
|
|
1292
|
+
}
|
|
1293
|
+
changeByThemeKey(systemInfo.theme)
|
|
1294
|
+
if (localStorage.getItem('themeIdCurrent')) {
|
|
1295
|
+
systemInfo.showTheme = localStorage.getItem('themeIdCurrent')
|
|
1296
|
+
}
|
|
1297
|
+
if (systemInfo.showTheme) {
|
|
1298
|
+
let showTheme = systemInfo.showTheme
|
|
1299
|
+
let split = showTheme.split('-')
|
|
1300
|
+
let systemForm = null
|
|
1301
|
+
let themeId = split[0];
|
|
1302
|
+
let status = split[1];
|
|
1303
|
+
let filterStatus = split[2];
|
|
1304
|
+
if (themeId) {
|
|
1305
|
+
let res = await ajax.get(config.upmsServerContext + '/anon/system/themeInfo?themeId=' + split[0])
|
|
1306
|
+
if (res.data.code == 1) {
|
|
1307
|
+
systemForm = res.data.data[0]
|
|
1308
|
+
if (!status && systemForm.status) {
|
|
1309
|
+
status = systemForm.status;
|
|
1310
|
+
}
|
|
1311
|
+
if (!filterStatus && systemForm.filterStatus) {
|
|
1312
|
+
filterStatus = systemForm.filterStatus;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
if (systemForm) {
|
|
1317
|
+
changeThemeByThemeId(themeId, status, filterStatus, systemForm)
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
if (!systemInfo.rightTopOptButtonList || systemInfo.rightTopOptButtonList.length <= 0) {
|
|
1321
|
+
systemInfo.rightTopOptButtonList = ['collect', 'fullScreen'];
|
|
1322
|
+
}
|
|
1323
|
+
if (!systemInfo.rightTopShowFunList || systemInfo.rightTopShowFunList.length <= 0) {
|
|
1324
|
+
systemInfo.rightTopShowFunList = ['theme', 'personalCenter', 'noticeList', 'logout']
|
|
1325
|
+
}
|
|
1326
|
+
return systemInfo;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
export const buildHomeConfigs = (settings) => {
|
|
1330
|
+
let result = [];
|
|
1331
|
+
if (settings && settings.length > 0) {
|
|
1332
|
+
let settingMap = {}
|
|
1333
|
+
for (let st of settings) {
|
|
1334
|
+
let key = st.categoryCode;
|
|
1335
|
+
if (!key) {
|
|
1336
|
+
key = "otherCategory";
|
|
1337
|
+
}
|
|
1338
|
+
if (settingMap[key]) {
|
|
1339
|
+
let oldSt = settingMap[key];
|
|
1340
|
+
if (st.permit && oldSt.permit
|
|
1341
|
+
&& (st.permit.permissionType > oldSt.permit.permissionType
|
|
1342
|
+
|| (st.permit.permissionType == oldSt.permit.permissionType
|
|
1343
|
+
&& st.permit.createTime > oldSt.permit.createTime))) {
|
|
1344
|
+
settingMap[key] = st;
|
|
1345
|
+
}
|
|
1346
|
+
} else {
|
|
1347
|
+
settingMap[key] = st;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
if (settingMap['default']) {
|
|
1351
|
+
result.push(settingMap['default']);
|
|
1352
|
+
}
|
|
1353
|
+
for(let key in settingMap) {
|
|
1354
|
+
if (key != 'default') {
|
|
1355
|
+
result.push(settingMap[key])
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
594
1358
|
}
|
|
595
|
-
|
|
1359
|
+
return result;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
export const getAllElements = ( plist = [], result = []) => {
|
|
1363
|
+
for (let obj of plist) {
|
|
1364
|
+
if (obj.permissionId) {
|
|
1365
|
+
result.push(obj.permissionId);
|
|
1366
|
+
}
|
|
1367
|
+
if (obj.children && obj.children.length > 0) {
|
|
1368
|
+
getAllElements(obj.children, result);
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
return result;
|
|
1372
|
+
}
|