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