@lambo-design/shared 1.0.0-beta.5 → 1.0.0-beta.51
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 +12 -0
- package/config/themes/atrovirens/atrovirens.css +243 -0
- package/config/themes/atrovirens/atrovirens.css.map +1 -0
- package/config/themes/atrovirens/atrovirens.less +320 -0
- package/config/themes/atrovirens/var.less +314 -0
- package/config/themes/default/default.css +243 -241
- package/config/themes/default/default.css.map +1 -0
- package/config/themes/default/default.less +75 -74
- package/config/themes/default/var.less +4 -4
- package/config/themes/gold/default.css +243 -241
- package/config/themes/gold/default.css.map +1 -0
- package/config/themes/gold/default.less +75 -74
- package/config/themes/gold/var.less +4 -4
- package/config/themes/index.js +8 -2
- package/config/themes/lime/default.css +243 -241
- package/config/themes/lime/default.css.map +1 -0
- package/config/themes/lime/default.less +75 -74
- package/config/themes/lime/var.less +4 -4
- package/config/themes/orange/orange.css +243 -0
- package/config/themes/orange/orange.css.map +1 -0
- package/config/themes/orange/orange.less +320 -0
- package/config/themes/orange/var.less +314 -0
- package/config/themes/red/red.css +243 -0
- package/config/themes/red/red.css.map +1 -0
- package/config/themes/red/red.less +320 -0
- package/config/themes/red/var.less +314 -0
- package/config/themes/theme-atrovirens.js +253 -0
- package/config/themes/theme-default.js +241 -240
- package/config/themes/theme-gold.js +9 -8
- package/config/themes/theme-lime.js +9 -8
- package/config/themes/theme-orange.js +255 -0
- package/config/themes/theme-red.js +256 -0
- package/directives/index.js +23 -0
- package/directives/module/draggable.js +56 -0
- package/directives/module/permission.js +49 -0
- package/index.js +2 -1
- package/package.json +6 -4
- package/utils/ajax/interceptors.js +97 -90
- package/utils/assist.js +88 -79
- package/utils/excel.js +25 -15
- package/utils/menu/before-close.js +17 -0
- package/utils/menu/index.js +35 -2
- package/utils/platform.js +84 -8
- package/utils/theme.js +1 -1
- package/utils/vxetable/index.js +25 -0
|
@@ -1,90 +1,97 @@
|
|
|
1
|
-
import qs from 'qs'
|
|
2
|
-
import cacheRules from "./cacheconf";
|
|
3
|
-
import {getToken,getUrlParams} from '../platform'
|
|
4
|
-
import Bus from '../bus';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
let timer1, timer2;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
1
|
+
import qs from 'qs'
|
|
2
|
+
import cacheRules from "./cacheconf";
|
|
3
|
+
import {getToken,getUrlParams} from '../platform'
|
|
4
|
+
import Bus from '../bus';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let timer1, timer2;
|
|
8
|
+
let hasDialog = false;
|
|
9
|
+
|
|
10
|
+
function requestInterceptors(config) {
|
|
11
|
+
const params = getUrlParams();
|
|
12
|
+
|
|
13
|
+
let token = getToken();
|
|
14
|
+
if (token) {
|
|
15
|
+
config.headers.token = token;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//sso_token认证
|
|
19
|
+
if (params.hasOwnProperty('sso_token')||sessionStorage.getItem('sso_token')) {
|
|
20
|
+
config.params = Object.assign({
|
|
21
|
+
sso_token: params.sso_token||sessionStorage.getItem('sso_token') ,
|
|
22
|
+
sso_id: params.sso_id
|
|
23
|
+
}, config.params)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//oauth认证
|
|
27
|
+
if (params.hasOwnProperty('token')) {
|
|
28
|
+
if (config.url.indexOf('?') === -1) {
|
|
29
|
+
config.url = config.url + "?token=" + params.token + "&ssoid=" + params.ssoid;
|
|
30
|
+
} else {
|
|
31
|
+
config.url = config.url + "&token=" + params.token + "&ssoid=" + params.ssoid;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (config.method === 'post') {
|
|
36
|
+
// payload为自定义不使用qs.stringify序列化的标记,默认config.payload == undefined;
|
|
37
|
+
// 为true时用于匹配@requestBody定义参数的接口
|
|
38
|
+
// 使用方式:post(config.AAAServerContext + '/AAA/BBB/CCC', { ...paramRequestBody }, { payload: true })
|
|
39
|
+
if (!config.payload) {
|
|
40
|
+
config.data = qs.stringify(config.data)
|
|
41
|
+
}
|
|
42
|
+
} else if (config.method === 'get') {
|
|
43
|
+
for (let rule of cacheRules) {
|
|
44
|
+
if (rule.test(config.url)) {
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (config.url.indexOf('?') === -1) {
|
|
49
|
+
config.url = config.url + "?t=" + new Date().getTime();
|
|
50
|
+
} else {
|
|
51
|
+
config.url = config.url + "&t=" + new Date().getTime();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function requestError(error) {
|
|
58
|
+
console.error("服务器内部异常,请稍候再试",error);
|
|
59
|
+
return Promise.reject(error);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function responseInterceptors(response) {
|
|
63
|
+
const data = response.data;
|
|
64
|
+
if (data instanceof Object) {
|
|
65
|
+
const code = data["code"];
|
|
66
|
+
if (code === 10106) {
|
|
67
|
+
if (!hasDialog) {
|
|
68
|
+
clearTimeout(timer1);
|
|
69
|
+
timer1 = setTimeout(function () {
|
|
70
|
+
hasDialog = true;
|
|
71
|
+
if (confirm("会话已失效,是否重新登录")) {
|
|
72
|
+
hasDialog = false;
|
|
73
|
+
Bus.$emit("needLogin");
|
|
74
|
+
} else {
|
|
75
|
+
hasDialog = false;
|
|
76
|
+
}
|
|
77
|
+
}, 500)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function responseError(error) {
|
|
85
|
+
clearTimeout(timer2);
|
|
86
|
+
timer2 = setTimeout(function () {
|
|
87
|
+
console.error("服务器内部异常,请稍候再试");
|
|
88
|
+
}, 500)
|
|
89
|
+
return Promise.reject(error);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default {
|
|
93
|
+
requestInterceptors,
|
|
94
|
+
responseInterceptors,
|
|
95
|
+
requestError,
|
|
96
|
+
responseError
|
|
97
|
+
}
|
package/utils/assist.js
CHANGED
|
@@ -1,79 +1,88 @@
|
|
|
1
|
-
// deepCopy
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
'[object
|
|
33
|
-
'[object
|
|
34
|
-
'[object
|
|
35
|
-
'[object
|
|
36
|
-
'[object
|
|
37
|
-
'[object
|
|
38
|
-
'[object
|
|
39
|
-
'[object
|
|
40
|
-
'[object
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
1
|
+
// deepCopy
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function deepCopy(data) {
|
|
5
|
+
let i;
|
|
6
|
+
const t = typeOf(data);
|
|
7
|
+
let o;
|
|
8
|
+
|
|
9
|
+
if (t === 'array') {
|
|
10
|
+
o = [];
|
|
11
|
+
} else if (t === 'object') {
|
|
12
|
+
o = {};
|
|
13
|
+
} else {
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (t === 'array') {
|
|
18
|
+
for (i = 0; i < data.length; i++) {
|
|
19
|
+
o.push(deepCopy(data[i]));
|
|
20
|
+
}
|
|
21
|
+
} else if (t === 'object') {
|
|
22
|
+
for (i in data) {
|
|
23
|
+
o[i] = deepCopy(data[i]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return o;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function typeOf(obj) {
|
|
30
|
+
const toString = Object.prototype.toString;
|
|
31
|
+
const map = {
|
|
32
|
+
'[object Boolean]': 'boolean',
|
|
33
|
+
'[object Number]': 'number',
|
|
34
|
+
'[object String]': 'string',
|
|
35
|
+
'[object Function]': 'function',
|
|
36
|
+
'[object Array]': 'array',
|
|
37
|
+
'[object Date]': 'date',
|
|
38
|
+
'[object RegExp]': 'regExp',
|
|
39
|
+
'[object Undefined]': 'undefined',
|
|
40
|
+
'[object Null]': 'null',
|
|
41
|
+
'[object Object]': 'object'
|
|
42
|
+
};
|
|
43
|
+
return map[toString.call(obj)];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
|
|
47
|
+
return h('Button', {
|
|
48
|
+
props: {
|
|
49
|
+
type: type,
|
|
50
|
+
size: "small",
|
|
51
|
+
ghost: true,
|
|
52
|
+
},
|
|
53
|
+
directives: [(permission === '' || permission === null) ? '' : {
|
|
54
|
+
name: "permission",
|
|
55
|
+
value: permission
|
|
56
|
+
}],
|
|
57
|
+
style: {
|
|
58
|
+
margin: '0 2px'
|
|
59
|
+
},
|
|
60
|
+
on: {
|
|
61
|
+
'click': () => {
|
|
62
|
+
operation(vm, currentRow);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, operationName);
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
|
|
70
|
+
return h('a', {
|
|
71
|
+
style: {
|
|
72
|
+
margin: '0 4px'
|
|
73
|
+
},
|
|
74
|
+
directives: [(permission === '' || permission === null) ? '' : {
|
|
75
|
+
name: "permission",
|
|
76
|
+
value: permission
|
|
77
|
+
}],
|
|
78
|
+
on: {
|
|
79
|
+
'click': () => {
|
|
80
|
+
operation(vm, currentRow);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, operationName);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function isJson(arg) {
|
|
87
|
+
return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
|
|
88
|
+
};
|
package/utils/excel.js
CHANGED
|
@@ -15,7 +15,9 @@ const typeRules = {
|
|
|
15
15
|
'index': 'index',
|
|
16
16
|
'select': 'select',
|
|
17
17
|
'selection': 'selection',
|
|
18
|
-
'single-selection': 'single-selection'
|
|
18
|
+
'single-selection': 'single-selection',
|
|
19
|
+
'checkbox': 'checkbox',
|
|
20
|
+
'radio': 'radio'
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
function auto_width(ws, data) {
|
|
@@ -127,7 +129,7 @@ function add_style(ws, title) {
|
|
|
127
129
|
Object.keys(ws).forEach(item => {
|
|
128
130
|
if (/^[A-Z]+\d+$/.test(item)) {
|
|
129
131
|
var alphabet = item.replace(/[^a-z]+/ig, "");
|
|
130
|
-
if (colhash.indexOf(alphabet)
|
|
132
|
+
if (colhash.indexOf(alphabet) === -1) {
|
|
131
133
|
colhash.push(alphabet)
|
|
132
134
|
for (var i = 1; i <= rowSum; i++) {
|
|
133
135
|
if (!ws.hasOwnProperty(alphabet + i)) {
|
|
@@ -141,7 +143,7 @@ function add_style(ws, title) {
|
|
|
141
143
|
}
|
|
142
144
|
})
|
|
143
145
|
|
|
144
|
-
let
|
|
146
|
+
let titleStyle = {
|
|
145
147
|
border: {
|
|
146
148
|
left: {style: 'thin', color: {rgb: "000000"}},
|
|
147
149
|
top: {style: 'thin', color: {rgb: "000000"}},
|
|
@@ -177,14 +179,14 @@ function add_style(ws, title) {
|
|
|
177
179
|
*/
|
|
178
180
|
var reg = new RegExp("^[A-Z]+[1 -" + title.length + "]$", "gim");
|
|
179
181
|
if (reg.test(item)) {
|
|
180
|
-
ws[item].s =
|
|
182
|
+
ws[item].s = titleStyle
|
|
181
183
|
} else
|
|
182
184
|
|
|
183
185
|
/**
|
|
184
186
|
* 表体样式: 垂直居中,边框
|
|
185
187
|
*/
|
|
186
188
|
if (/^[A-Z]+\d+$/.test(item)) {
|
|
187
|
-
if (parseInt(item.replace(/[^0-9]/ig, "")) % 2
|
|
189
|
+
if (parseInt(item.replace(/[^0-9]/ig, "")) % 2 === 0) {
|
|
188
190
|
ws[item].s = bodyStyle
|
|
189
191
|
} else {
|
|
190
192
|
ws[item].s = bodyPairStyle
|
|
@@ -203,9 +205,9 @@ function add_style(ws, title) {
|
|
|
203
205
|
function title_filter(data) {
|
|
204
206
|
let filterData = deepCopy(data);
|
|
205
207
|
for (var i = 0; i < filterData.length; i++) {
|
|
206
|
-
if ((filterData[i].hasOwnProperty('type') && filterData[i].type
|
|
208
|
+
if ((filterData[i].hasOwnProperty('type') && filterData[i].type !== undefined && filterData[i].type === typeRules[filterData[i].type]) ||
|
|
207
209
|
// !filterData[i].hasOwnProperty('title') ||
|
|
208
|
-
filterData[i].title
|
|
210
|
+
filterData[i].title === titleRules[filterData[i].title]) {
|
|
209
211
|
filterData.splice(i, 1)
|
|
210
212
|
i--
|
|
211
213
|
}
|
|
@@ -217,9 +219,9 @@ function title_el_filter(data) {
|
|
|
217
219
|
let filterData = deepCopy(data);
|
|
218
220
|
|
|
219
221
|
for (var i = 0; i < filterData.length; i++) {
|
|
220
|
-
if ((filterData[i].hasOwnProperty('property') && filterData[i].property
|
|
222
|
+
if ((filterData[i].hasOwnProperty('property') && filterData[i].property === typeRules[filterData[i].property]) ||
|
|
221
223
|
// !filterData[i].hasOwnProperty('title') ||
|
|
222
|
-
filterData[i].label
|
|
224
|
+
filterData[i].label === titleRules[filterData[i].label]) {
|
|
223
225
|
filterData.splice(i, 1)
|
|
224
226
|
i--
|
|
225
227
|
}
|
|
@@ -451,18 +453,26 @@ export const export_array_to_excel = ({key, data, title, filename, spanColumns,
|
|
|
451
453
|
merge_content(ws, data, spanColumns, title.length)
|
|
452
454
|
add_style(ws, title)
|
|
453
455
|
XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
454
|
-
|
|
456
|
+
if(format === 'csv'){
|
|
457
|
+
XLSX.writeFile(wb, filename + '.' + format,{
|
|
458
|
+
// 要生成的文件类型
|
|
459
|
+
bookType: "csv",
|
|
460
|
+
// // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
|
|
461
|
+
bookSST: false});
|
|
462
|
+
}else{
|
|
463
|
+
XLSX.writeFileXLSX(wb, filename + '.' + format);
|
|
464
|
+
}
|
|
455
465
|
}
|
|
456
466
|
|
|
457
467
|
function s2ab(s) {
|
|
458
468
|
if (typeof ArrayBuffer !== 'undefined') {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
for (
|
|
469
|
+
let buf = new ArrayBuffer(s.length);
|
|
470
|
+
let view = new Uint8Array(buf);
|
|
471
|
+
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
|
462
472
|
return buf;
|
|
463
473
|
} else {
|
|
464
|
-
|
|
465
|
-
for (
|
|
474
|
+
let buf = new Array(s.length);
|
|
475
|
+
for (let i = 0; i !== s.length; ++i) buf[i] = s.charCodeAt(i) & 0xFF;
|
|
466
476
|
return buf;
|
|
467
477
|
}
|
|
468
478
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Modal } from '@lambo-design/core'
|
|
2
|
+
|
|
3
|
+
const beforeClose = {
|
|
4
|
+
before_close_normal: (resolve) => {
|
|
5
|
+
Modal.confirm({
|
|
6
|
+
title: '确定要关闭这一页吗?',
|
|
7
|
+
onOk: () => {
|
|
8
|
+
resolve(true)
|
|
9
|
+
},
|
|
10
|
+
onCancel: () => {
|
|
11
|
+
resolve(false)
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default beforeClose
|
package/utils/menu/index.js
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 判断是否存在路由
|
|
3
|
+
* @param $router
|
|
4
|
+
* @param name
|
|
5
|
+
* @returns {*|boolean}
|
|
6
|
+
*/
|
|
7
|
+
export const hasRoute = ($router, name) => {
|
|
8
|
+
let routes = $router.getRoutes();
|
|
9
|
+
let res = routes.filter(item => item.name === name)
|
|
10
|
+
return res && res.length > 0
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 判断是否存在路由并且页面存在
|
|
14
|
+
* @param $router
|
|
15
|
+
* @param path
|
|
16
|
+
* @returns {*|boolean}
|
|
17
|
+
*/
|
|
18
|
+
export const hasRoutePath = ($router, path) => {
|
|
19
|
+
if ($router && path) {
|
|
20
|
+
let routes = $router.getRoutes();
|
|
21
|
+
if (path.trim().startsWith("dida/")) {
|
|
22
|
+
path = path.trim().replace("dida/","");
|
|
23
|
+
if (!path.startsWith("/")) {
|
|
24
|
+
path = "/" + path;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let res = routes.filter(item => item.path === path)
|
|
28
|
+
return res && res.length > 0
|
|
29
|
+
}
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
1
32
|
/**
|
|
2
33
|
* 动态生成菜单
|
|
3
34
|
* @param permissionList
|
|
@@ -33,7 +64,7 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
33
64
|
return;
|
|
34
65
|
}
|
|
35
66
|
list.forEach(item => {
|
|
36
|
-
if (item.appId == appId) {
|
|
67
|
+
if (item.appId == appId && (!item.hasOwnProperty("hideInMenu") || (item.hasOwnProperty("hideInMenu") && !item.hideInMenu))) {
|
|
37
68
|
// 判断是否为父级菜单
|
|
38
69
|
if (item.pid === parentId) {
|
|
39
70
|
if (item.type === 1 || item.type === 2) {
|
|
@@ -43,7 +74,9 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
43
74
|
title: item.label,
|
|
44
75
|
icon: item.icon,
|
|
45
76
|
crumbs: [...crumbs],
|
|
46
|
-
activeName: item.name
|
|
77
|
+
activeName: item.name,
|
|
78
|
+
notCache: item.notCache ? true : false,
|
|
79
|
+
hideInMenu: item.hideInMenu ? true : false
|
|
47
80
|
},
|
|
48
81
|
type: item.type,
|
|
49
82
|
pid: item.pid,
|
package/utils/platform.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export const TOKEN_KEY = 'v8-token'
|
|
1
|
+
export const TOKEN_KEY = 'lambo-token'
|
|
3
2
|
|
|
4
3
|
export const COOKIE_KEY = 'lambo-sso-key'
|
|
5
4
|
|
|
5
|
+
export const SSO_TOKEN_KEY = 'lambo-sso-token'
|
|
6
|
+
|
|
6
7
|
export function objEqual(obj1, obj2) {
|
|
7
8
|
const keysArr1 = Object.keys(obj1)
|
|
8
9
|
const keysArr2 = Object.keys(obj2)
|
|
@@ -152,14 +153,20 @@ export const showTitle = (item, vm) => {
|
|
|
152
153
|
/**
|
|
153
154
|
* @description 本地存储和获取标签导航列表
|
|
154
155
|
*/
|
|
155
|
-
export const setTagNavListInLocalstorage = list => {
|
|
156
|
-
|
|
156
|
+
export const setTagNavListInLocalstorage = (list , key) => {
|
|
157
|
+
if (!key) {
|
|
158
|
+
key = 'LD-tagNavList';
|
|
159
|
+
}
|
|
160
|
+
localStorage[key] = JSON.stringify(list)
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
163
|
* @returns {Array} 其中的每个元素只包含路由原信息中的name, path, meta三项
|
|
160
164
|
*/
|
|
161
|
-
export const getTagNavListFromLocalstorage = () => {
|
|
162
|
-
|
|
165
|
+
export const getTagNavListFromLocalstorage = (key) => {
|
|
166
|
+
if (!key) {
|
|
167
|
+
key = 'LD-tagNavList';
|
|
168
|
+
}
|
|
169
|
+
const list = localStorage[key]
|
|
163
170
|
return list ? JSON.parse(list) : []
|
|
164
171
|
}
|
|
165
172
|
|
|
@@ -265,7 +272,7 @@ export const getArrayFromFile = (file) => {
|
|
|
265
272
|
reader.readAsText(file) // 以文本格式读取
|
|
266
273
|
let arr = []
|
|
267
274
|
reader.onload = function (evt) {
|
|
268
|
-
let data = evt.target.
|
|
275
|
+
let data = evt.target.card // 读到的数据
|
|
269
276
|
let pasteData = data.trim()
|
|
270
277
|
arr = pasteData.split((/[\n\u0085\u2028\u2029]|\r\n?/g)).map(row => {
|
|
271
278
|
return row.split('\t')
|
|
@@ -357,7 +364,7 @@ export const routeEqual = (route1, route2) => {
|
|
|
357
364
|
const params2 = route2.params || {}
|
|
358
365
|
const query1 = route1.query || {}
|
|
359
366
|
const query2 = route2.query || {}
|
|
360
|
-
return (route1.name === route2.name)
|
|
367
|
+
return (route1.name === route2.name) && objEqual(params1, params2) && objEqual(query1, query2)
|
|
361
368
|
}
|
|
362
369
|
|
|
363
370
|
/**
|
|
@@ -517,3 +524,72 @@ export function oneOf (value, validList) {
|
|
|
517
524
|
}
|
|
518
525
|
return false
|
|
519
526
|
}
|
|
527
|
+
|
|
528
|
+
export const recursionKeyFindItem = (arr, filterKey, filterValue, recursionKey) => {
|
|
529
|
+
for (const item of arr) {
|
|
530
|
+
if (item[filterKey] && item[filterKey] == filterValue) {
|
|
531
|
+
return item;
|
|
532
|
+
}
|
|
533
|
+
let result = null;
|
|
534
|
+
if (item[recursionKey]) {
|
|
535
|
+
result = recursionKeyFindItem(item[recursionKey], filterKey, filterValue, recursionKey);
|
|
536
|
+
if (result) {
|
|
537
|
+
return result;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return null;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
export const filterMenuName = (menuList, name) => {
|
|
545
|
+
return recursionKeyFindItem(menuList, 'name', name, 'children')
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
export const filterMenuUri = (menuList, name) => {
|
|
549
|
+
return recursionKeyFindItem(menuList, 'uri', name, 'children')
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
export const tagExists = (taglist, name) => {
|
|
553
|
+
return taglist && taglist.filter(item => item.name === name).length > 0;
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
export const getPreviousTagIndex = (tagList, name) => {
|
|
557
|
+
let count = 0;
|
|
558
|
+
if (tagList && name) {
|
|
559
|
+
for (let i = 0 ;i < tagList.length; i++) {
|
|
560
|
+
let item = tagList[i];
|
|
561
|
+
if (item.name == name) {
|
|
562
|
+
count = i - 1;
|
|
563
|
+
if (count < 0) {
|
|
564
|
+
count = 0;
|
|
565
|
+
}
|
|
566
|
+
return count;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
return count;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
export const getDelTagIndex = (tagList, name) => {
|
|
574
|
+
let count = 1;
|
|
575
|
+
if (tagList && name) {
|
|
576
|
+
for (let i = 1 ;i < tagList.length; i++) {
|
|
577
|
+
let item = tagList[i];
|
|
578
|
+
if (item.name !== name) {
|
|
579
|
+
return count;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
return count;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export const turnToPage = (vm, name ,url) =>{
|
|
587
|
+
if (window.top && window.top.location.href != window.location.href) {
|
|
588
|
+
sessionStorage.removeItem('activeName')
|
|
589
|
+
window.parent.location.href = url;
|
|
590
|
+
} else {
|
|
591
|
+
vm.$router.push({
|
|
592
|
+
name: name
|
|
593
|
+
})
|
|
594
|
+
}
|
|
595
|
+
}
|