@lambo-design/shared 1.0.0-beta.8 → 1.0.0-beta.80
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 +2 -2
- package/config/themes/atrovirens/atrovirens.css +533 -0
- package/config/themes/atrovirens/atrovirens.css.map +1 -0
- package/config/themes/atrovirens/atrovirens.less +624 -0
- package/config/themes/atrovirens/var.less +627 -0
- package/config/themes/default/default.css +533 -241
- package/config/themes/default/default.css.map +1 -0
- package/config/themes/default/default.less +379 -74
- package/config/themes/default/var.less +318 -4
- package/config/themes/eap/eap.css +533 -0
- package/config/themes/eap/eap.css.map +1 -0
- package/config/themes/eap/eap.less +624 -0
- package/config/themes/eap/var.less +628 -0
- package/config/themes/gold/gold.css +533 -0
- package/config/themes/gold/gold.css.map +1 -0
- package/config/themes/gold/gold.less +624 -0
- package/config/themes/gold/var.less +319 -4
- package/config/themes/index.js +10 -2
- package/config/themes/lime/lime.css +533 -0
- package/config/themes/lime/lime.css.map +1 -0
- package/config/themes/lime/lime.less +624 -0
- package/config/themes/lime/var.less +319 -4
- package/config/themes/orange/orange.css +533 -0
- package/config/themes/orange/orange.css.map +1 -0
- package/config/themes/orange/orange.less +624 -0
- package/config/themes/orange/var.less +629 -0
- package/config/themes/red/red.css +533 -0
- package/config/themes/red/red.css.map +1 -0
- package/config/themes/red/red.less +624 -0
- package/config/themes/red/var.less +628 -0
- package/config/themes/theme-atrovirens.js +515 -0
- package/config/themes/theme-default.js +270 -7
- package/config/themes/theme-eap.js +515 -0
- package/config/themes/theme-gold.js +271 -8
- package/config/themes/theme-lime.js +271 -8
- package/config/themes/theme-orange.js +516 -0
- package/config/themes/theme-red.js +515 -0
- package/directives/index.js +23 -0
- package/directives/module/draggable.js +56 -0
- package/directives/module/permission.js +49 -0
- package/index.js +3 -1
- package/package.json +23 -20
- 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/utils/ajax/interceptors.js +13 -6
- package/utils/assist.js +48 -9
- package/utils/base64.js +126 -0
- package/utils/date.js +0 -27
- package/utils/excel.js +122 -21
- package/utils/menu/index.js +24 -2
- package/utils/platform.js +34 -6
- package/utils/theme.js +5 -0
- package/utils/vxetable/index.js +15 -4
- package/config/themes/gold/default.css +0 -241
- package/config/themes/gold/default.less +0 -319
- package/config/themes/lime/default.css +0 -241
- package/config/themes/lime/default.less +0 -319
package/plugin/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import DateFormat from "./module/date-format";
|
|
2
|
+
import Loading from "./module/loading";
|
|
3
|
+
import WarnHandler from "./module/warn-handler";
|
|
4
|
+
export default {
|
|
5
|
+
install : function (Vue, options) {
|
|
6
|
+
DateFormat.install(Vue,options);
|
|
7
|
+
Loading.install(Vue.options);
|
|
8
|
+
WarnHandler.install(Vue.options);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
export { DateFormat , Loading , WarnHandler}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
/**
|
|
3
|
+
* 对Date的扩展,将 Date 转化为指定格式的String
|
|
4
|
+
* 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
|
|
5
|
+
* 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
|
|
6
|
+
* 例:
|
|
7
|
+
* (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
|
|
8
|
+
* (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
|
|
9
|
+
*/
|
|
10
|
+
install: function (Vue, options) {
|
|
11
|
+
Date.prototype.Format = function (fmt) {
|
|
12
|
+
let o = {
|
|
13
|
+
"M+": this.getMonth() + 1, //月份
|
|
14
|
+
"d+": this.getDate(), //日
|
|
15
|
+
"H+": this.getHours(), //小时
|
|
16
|
+
"m+": this.getMinutes(), //分
|
|
17
|
+
"s+": this.getSeconds(), //秒
|
|
18
|
+
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
|
19
|
+
"S": this.getMilliseconds() //毫秒
|
|
20
|
+
};
|
|
21
|
+
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
22
|
+
for (let k in o)
|
|
23
|
+
if (new RegExp("(" + k + ")").test(fmt)) {
|
|
24
|
+
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
|
|
25
|
+
}
|
|
26
|
+
return fmt;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
install : function (Vue, options) {
|
|
3
|
+
//通用Loading
|
|
4
|
+
Vue.prototype.$ShowLoading = function(text){
|
|
5
|
+
this.$Spin.show({
|
|
6
|
+
render: (h) => {
|
|
7
|
+
return h('div', [
|
|
8
|
+
h('Icon', {
|
|
9
|
+
'class': 'demo-spin-icon-load',
|
|
10
|
+
props: {
|
|
11
|
+
type: 'ios-loading',
|
|
12
|
+
size: 24
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
h('div', text||'Loading')
|
|
16
|
+
])
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
Vue.prototype.$CloseLoading = function(){
|
|
22
|
+
this.$Spin.hide();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
install : function (Vue, options) {
|
|
3
|
+
Vue.config.warnHandler = function (err, vm, info) {
|
|
4
|
+
if (err.toString().indexOf("Component names should conform to valid custom element name in html5 specification")>0){
|
|
5
|
+
console.warn("[Lambo warn]: " + err + info);
|
|
6
|
+
}else{
|
|
7
|
+
console.error("[Vue warn]: " + err + info);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -5,6 +5,7 @@ import Bus from '../bus';
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
let timer1, timer2;
|
|
8
|
+
let hasDialog = false;
|
|
8
9
|
|
|
9
10
|
function requestInterceptors(config) {
|
|
10
11
|
const params = getUrlParams();
|
|
@@ -63,12 +64,18 @@ function responseInterceptors(response) {
|
|
|
63
64
|
if (data instanceof Object) {
|
|
64
65
|
const code = data["code"];
|
|
65
66
|
if (code === 10106) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
}
|
|
72
79
|
}
|
|
73
80
|
}
|
|
74
81
|
return response;
|
package/utils/assist.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// deepCopy
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
export function deepCopy(data) {
|
|
4
5
|
let i;
|
|
5
6
|
const t = typeOf(data);
|
|
@@ -24,6 +25,23 @@ export function deepCopy(data) {
|
|
|
24
25
|
}
|
|
25
26
|
return o;
|
|
26
27
|
}
|
|
28
|
+
export function deepMerge(target, ...sources) {
|
|
29
|
+
if (!sources.length) return target;
|
|
30
|
+
const source = sources.shift();
|
|
31
|
+
|
|
32
|
+
if (isObject(target) && isObject(source)) {
|
|
33
|
+
for (const key in source) {
|
|
34
|
+
if (isObject(source[key])) {
|
|
35
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
36
|
+
deepMerge(target[key], source[key]);
|
|
37
|
+
} else {
|
|
38
|
+
Object.assign(target, { [key]: source[key] });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return deepMerge(target, ...sources);
|
|
44
|
+
}
|
|
27
45
|
|
|
28
46
|
export function typeOf(obj) {
|
|
29
47
|
const toString = Object.prototype.toString;
|
|
@@ -43,16 +61,12 @@ export function typeOf(obj) {
|
|
|
43
61
|
}
|
|
44
62
|
|
|
45
63
|
export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
|
|
46
|
-
|
|
64
|
+
let renderOption = {
|
|
47
65
|
props: {
|
|
48
66
|
type: type,
|
|
49
67
|
size: "small",
|
|
50
68
|
ghost: true,
|
|
51
69
|
},
|
|
52
|
-
directives: [{
|
|
53
|
-
name: "permission",
|
|
54
|
-
value: permission
|
|
55
|
-
}],
|
|
56
70
|
style: {
|
|
57
71
|
margin: '0 2px'
|
|
58
72
|
},
|
|
@@ -61,19 +75,44 @@ export function operateBtn(vm, h, currentRow, operationName, operation, type, pe
|
|
|
61
75
|
operation(vm, currentRow);
|
|
62
76
|
}
|
|
63
77
|
}
|
|
64
|
-
}
|
|
78
|
+
}
|
|
79
|
+
if(permission){
|
|
80
|
+
renderOption['directives'] = [{
|
|
81
|
+
name: "permission",
|
|
82
|
+
value: permission
|
|
83
|
+
}]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return h('Button', renderOption, operationName);
|
|
87
|
+
|
|
65
88
|
}
|
|
66
89
|
|
|
67
|
-
export function operateHref(vm, h, currentRow, operationName, operation) {
|
|
68
|
-
|
|
90
|
+
export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
|
|
91
|
+
let renderOption = {
|
|
92
|
+
style: {
|
|
93
|
+
margin: '0 4px'
|
|
94
|
+
},
|
|
69
95
|
on: {
|
|
70
96
|
'click': () => {
|
|
71
97
|
operation(vm, currentRow);
|
|
72
98
|
}
|
|
73
99
|
}
|
|
74
|
-
}
|
|
100
|
+
}
|
|
101
|
+
if(permission){
|
|
102
|
+
renderOption['directives'] = [{
|
|
103
|
+
name: "permission",
|
|
104
|
+
value: permission
|
|
105
|
+
}]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return h('a', renderOption, operationName);
|
|
75
109
|
}
|
|
76
110
|
|
|
77
111
|
export function isJson(arg) {
|
|
78
112
|
return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
|
|
79
113
|
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
export function isObject(item) {
|
|
117
|
+
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
118
|
+
}
|
package/utils/base64.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
let Base64 = {
|
|
2
|
+
Base64Chars:
|
|
3
|
+
"abcdefghijklmnopqrstuv" +
|
|
4
|
+
"wxyzABCDEFGHIJKLMNOP" +
|
|
5
|
+
"QRSTUVWXYZ0123456789@*-",
|
|
6
|
+
/**
|
|
7
|
+
* Encode a string to a Base64 string follow Bse64 regular.
|
|
8
|
+
* @param s, a normal string
|
|
9
|
+
* @return a Base64 string
|
|
10
|
+
*/
|
|
11
|
+
encode: function (s) {
|
|
12
|
+
if (!s || s.length == 0) return s;
|
|
13
|
+
|
|
14
|
+
var d = "";
|
|
15
|
+
var b = this.ucs2_utf8(s);
|
|
16
|
+
var b0, b1, b2, b3;
|
|
17
|
+
var len = b.length;
|
|
18
|
+
var i = 0;
|
|
19
|
+
while (i < len) {
|
|
20
|
+
var tmp = b[i++];
|
|
21
|
+
b0 = (tmp & 0xfc) >> 2;
|
|
22
|
+
b1 = (tmp & 0x03) << 4;
|
|
23
|
+
if (i < len) {
|
|
24
|
+
tmp = b[i++];
|
|
25
|
+
b1 |= (tmp & 0xf0) >> 4;
|
|
26
|
+
b2 = (tmp & 0x0f) << 2;
|
|
27
|
+
if (i < len) {
|
|
28
|
+
tmp = b[i++];
|
|
29
|
+
b2 |= (tmp & 0xc0) >> 6;
|
|
30
|
+
b3 = tmp & 0x3f;
|
|
31
|
+
} else {
|
|
32
|
+
b3 = 64; // 1 byte "-" is supplement
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
b2 = b3 = 64; // 2 bytes "-" are supplement
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
d += this.Base64Chars.charAt(b0);
|
|
41
|
+
d += this.Base64Chars.charAt(b1);
|
|
42
|
+
d += this.Base64Chars.charAt(b2);
|
|
43
|
+
d += this.Base64Chars.charAt(b3);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return d;
|
|
47
|
+
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Encodes a ucs2 string to a utf8 integer array.
|
|
52
|
+
* @param s, a string
|
|
53
|
+
* @return an integer array
|
|
54
|
+
*/
|
|
55
|
+
ucs2_utf8: function (s) {
|
|
56
|
+
if (!s) return null;
|
|
57
|
+
var d = new Array();
|
|
58
|
+
if (s == "") return d;
|
|
59
|
+
|
|
60
|
+
var c = 0, i = 0, j = 0;
|
|
61
|
+
var len = s.length;
|
|
62
|
+
while (i < len) {
|
|
63
|
+
c = s.charCodeAt(i++);
|
|
64
|
+
if (c <= 0x7f) {
|
|
65
|
+
// 1 byte
|
|
66
|
+
|
|
67
|
+
d[j++] = c;
|
|
68
|
+
} else if ((c >= 0x80) && (c <= 0x7ff)) {
|
|
69
|
+
// 2 bytes
|
|
70
|
+
|
|
71
|
+
d[j++] = ((c >> 6) & 0x1f) | 0xc0;
|
|
72
|
+
d[j++] = (c & 0x3f) | 0x80;
|
|
73
|
+
} else {
|
|
74
|
+
// 3 bytes
|
|
75
|
+
|
|
76
|
+
d[j++] = (c >> 12) | 0xe0;
|
|
77
|
+
d[j++] = ((c >> 6) & 0x3f) | 0x80;
|
|
78
|
+
d[j++] = (c & 0x3f) | 0x80;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return d;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Encodes a utf8 integer array to a ucs2 string.
|
|
86
|
+
* @param s, an integer array
|
|
87
|
+
* @return a string
|
|
88
|
+
*/
|
|
89
|
+
utf8_ucs2: function (s) {
|
|
90
|
+
if (!s) return null;
|
|
91
|
+
var len = s.length;
|
|
92
|
+
if (len == 0) return "";
|
|
93
|
+
|
|
94
|
+
var d = "";
|
|
95
|
+
var c = 0, i = 0, tmp = 0;
|
|
96
|
+
while (i < len) {
|
|
97
|
+
c = s[i++];
|
|
98
|
+
if ((c & 0xe0) == 0xe0) {
|
|
99
|
+
// 3 bytes
|
|
100
|
+
|
|
101
|
+
tmp = (c & 0x0f) << 12;
|
|
102
|
+
c = s[i++];
|
|
103
|
+
tmp |= ((c & 0x3f) << 6);
|
|
104
|
+
c = s[i++];
|
|
105
|
+
tmp |= (c & 0x3f);
|
|
106
|
+
} else if ((c & 0xc0) == 0xc0) {
|
|
107
|
+
// 2 bytes
|
|
108
|
+
|
|
109
|
+
tmp = (c & 0x1f) << 6;
|
|
110
|
+
c = s[i++];
|
|
111
|
+
tmp |= (c & 0x3f);
|
|
112
|
+
} else {
|
|
113
|
+
// 1 byte
|
|
114
|
+
|
|
115
|
+
tmp = c;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
d += String.fromCharCode(tmp);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return d;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
export {
|
|
125
|
+
Base64
|
|
126
|
+
}
|
package/utils/date.js
CHANGED
|
@@ -4,33 +4,6 @@ import config from '../config/config'
|
|
|
4
4
|
* 本项目已集成 moment.js (http://momentjs.cn/),推荐使用 moment.js
|
|
5
5
|
*/
|
|
6
6
|
import moment from "moment";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 对Date的扩展,将 Date 转化为指定格式的String
|
|
10
|
-
* 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
|
|
11
|
-
* 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
|
|
12
|
-
* 例:
|
|
13
|
-
* (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
|
|
14
|
-
* (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
|
|
15
|
-
*/
|
|
16
|
-
Date.prototype.Format = function (fmt) {
|
|
17
|
-
let o = {
|
|
18
|
-
"M+": this.getMonth() + 1, //月份
|
|
19
|
-
"d+": this.getDate(), //日
|
|
20
|
-
"H+": this.getHours(), //小时
|
|
21
|
-
"m+": this.getMinutes(), //分
|
|
22
|
-
"s+": this.getSeconds(), //秒
|
|
23
|
-
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
|
24
|
-
"S": this.getMilliseconds() //毫秒
|
|
25
|
-
};
|
|
26
|
-
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
27
|
-
for (let k in o)
|
|
28
|
-
if (new RegExp("(" + k + ")").test(fmt)){
|
|
29
|
-
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
|
|
30
|
-
}
|
|
31
|
-
return fmt;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
7
|
export function timestampToTime(timestamp) {
|
|
35
8
|
let date = new Date(timestamp);
|
|
36
9
|
let Y = date.getFullYear() + '-';
|
package/utils/excel.js
CHANGED
|
@@ -3,6 +3,7 @@ import XLSX from 'xlsx';
|
|
|
3
3
|
import * as cpexcel from 'xlsx/dist/cpexcel.full.mjs';
|
|
4
4
|
XLSX.set_cptable(cpexcel);
|
|
5
5
|
import {deepCopy} from "./assist";
|
|
6
|
+
import XLSXStyle from 'xlsx-style'
|
|
6
7
|
|
|
7
8
|
const titleRules = {
|
|
8
9
|
'': '',
|
|
@@ -15,7 +16,9 @@ const typeRules = {
|
|
|
15
16
|
'index': 'index',
|
|
16
17
|
'select': 'select',
|
|
17
18
|
'selection': 'selection',
|
|
18
|
-
'single-selection': 'single-selection'
|
|
19
|
+
'single-selection': 'single-selection',
|
|
20
|
+
'checkbox': 'checkbox',
|
|
21
|
+
'radio': 'radio'
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
function auto_width(ws, data) {
|
|
@@ -127,7 +130,7 @@ function add_style(ws, title) {
|
|
|
127
130
|
Object.keys(ws).forEach(item => {
|
|
128
131
|
if (/^[A-Z]+\d+$/.test(item)) {
|
|
129
132
|
var alphabet = item.replace(/[^a-z]+/ig, "");
|
|
130
|
-
if (colhash.indexOf(alphabet)
|
|
133
|
+
if (colhash.indexOf(alphabet) === -1) {
|
|
131
134
|
colhash.push(alphabet)
|
|
132
135
|
for (var i = 1; i <= rowSum; i++) {
|
|
133
136
|
if (!ws.hasOwnProperty(alphabet + i)) {
|
|
@@ -141,7 +144,7 @@ function add_style(ws, title) {
|
|
|
141
144
|
}
|
|
142
145
|
})
|
|
143
146
|
|
|
144
|
-
let
|
|
147
|
+
let titleStyle = {
|
|
145
148
|
border: {
|
|
146
149
|
left: {style: 'thin', color: {rgb: "000000"}},
|
|
147
150
|
top: {style: 'thin', color: {rgb: "000000"}},
|
|
@@ -177,14 +180,14 @@ function add_style(ws, title) {
|
|
|
177
180
|
*/
|
|
178
181
|
var reg = new RegExp("^[A-Z]+[1 -" + title.length + "]$", "gim");
|
|
179
182
|
if (reg.test(item)) {
|
|
180
|
-
ws[item].s =
|
|
183
|
+
ws[item].s = titleStyle
|
|
181
184
|
} else
|
|
182
185
|
|
|
183
186
|
/**
|
|
184
187
|
* 表体样式: 垂直居中,边框
|
|
185
188
|
*/
|
|
186
189
|
if (/^[A-Z]+\d+$/.test(item)) {
|
|
187
|
-
if (parseInt(item.replace(/[^0-9]/ig, "")) % 2
|
|
190
|
+
if (parseInt(item.replace(/[^0-9]/ig, "")) % 2 === 0) {
|
|
188
191
|
ws[item].s = bodyStyle
|
|
189
192
|
} else {
|
|
190
193
|
ws[item].s = bodyPairStyle
|
|
@@ -203,9 +206,9 @@ function add_style(ws, title) {
|
|
|
203
206
|
function title_filter(data) {
|
|
204
207
|
let filterData = deepCopy(data);
|
|
205
208
|
for (var i = 0; i < filterData.length; i++) {
|
|
206
|
-
if ((filterData[i].hasOwnProperty('type') && filterData[i].type
|
|
209
|
+
if ((filterData[i].hasOwnProperty('type') && filterData[i].type !== undefined && filterData[i].type === typeRules[filterData[i].type]) ||
|
|
207
210
|
// !filterData[i].hasOwnProperty('title') ||
|
|
208
|
-
filterData[i].title
|
|
211
|
+
filterData[i].title === titleRules[filterData[i].title]) {
|
|
209
212
|
filterData.splice(i, 1)
|
|
210
213
|
i--
|
|
211
214
|
}
|
|
@@ -217,9 +220,9 @@ function title_el_filter(data) {
|
|
|
217
220
|
let filterData = deepCopy(data);
|
|
218
221
|
|
|
219
222
|
for (var i = 0; i < filterData.length; i++) {
|
|
220
|
-
if ((filterData[i].hasOwnProperty('property') && filterData[i].property
|
|
223
|
+
if ((filterData[i].hasOwnProperty('property') && filterData[i].property === typeRules[filterData[i].property]) ||
|
|
221
224
|
// !filterData[i].hasOwnProperty('title') ||
|
|
222
|
-
filterData[i].label
|
|
225
|
+
filterData[i].label === titleRules[filterData[i].label]) {
|
|
223
226
|
filterData.splice(i, 1)
|
|
224
227
|
i--
|
|
225
228
|
}
|
|
@@ -275,27 +278,47 @@ export const title_transform = (paramData) => {
|
|
|
275
278
|
let result = []
|
|
276
279
|
let data1 = []
|
|
277
280
|
let data2 = []
|
|
278
|
-
let
|
|
281
|
+
let data3 = []
|
|
282
|
+
let flag2 = false
|
|
283
|
+
let flag3 = false
|
|
279
284
|
let data = title_filter(paramData)
|
|
280
285
|
// let data = paramData
|
|
281
286
|
for (var i = 0; i < data.length; i++) {
|
|
282
287
|
data1.push(data[i].title)
|
|
283
288
|
data2.push(data[i].title)
|
|
289
|
+
data3.push(data[i].title)
|
|
284
290
|
if ('children' in data[i]) {
|
|
285
|
-
|
|
291
|
+
flag2 = true
|
|
286
292
|
data2.pop()
|
|
293
|
+
data3.pop()
|
|
287
294
|
let children = data[i].children
|
|
288
295
|
for (var j = 0; j < children.length; j++) {
|
|
289
296
|
data1.push(data[i].title)
|
|
290
297
|
data2.push(children[j].title)
|
|
298
|
+
data3.push(children[j].title)
|
|
299
|
+
if ('children' in children[j]) {
|
|
300
|
+
flag3 = true
|
|
301
|
+
data3.pop();
|
|
302
|
+
let subChildren = children[j].children
|
|
303
|
+
for (var k = 0; k < subChildren.length; k++) {
|
|
304
|
+
data1.push(data[i].title)
|
|
305
|
+
data2.push(children[j].title)
|
|
306
|
+
data3.push(subChildren[k].title)
|
|
307
|
+
}
|
|
308
|
+
data1.pop()
|
|
309
|
+
data2.pop()
|
|
310
|
+
}
|
|
291
311
|
}
|
|
292
312
|
data1.pop()
|
|
293
313
|
}
|
|
294
314
|
}
|
|
295
315
|
result.push(data1)
|
|
296
|
-
if (
|
|
316
|
+
if (flag2) {
|
|
297
317
|
result.push(data2)
|
|
298
318
|
}
|
|
319
|
+
if (flag3) {
|
|
320
|
+
result.push(data3)
|
|
321
|
+
}
|
|
299
322
|
return result
|
|
300
323
|
}
|
|
301
324
|
|
|
@@ -336,7 +359,14 @@ export const key_transform = (paramData) => {
|
|
|
336
359
|
if ("children" in data[i]) {
|
|
337
360
|
let children = data[i].children
|
|
338
361
|
for (var j = 0; j < children.length; j++) {
|
|
339
|
-
|
|
362
|
+
if ("children" in children[j]) {
|
|
363
|
+
let subChildren = children[j].children
|
|
364
|
+
for (var k = 0; k < subChildren.length; k++) {
|
|
365
|
+
result.push(subChildren[k].key)
|
|
366
|
+
}
|
|
367
|
+
}else{
|
|
368
|
+
result.push(children[j].key)
|
|
369
|
+
}
|
|
340
370
|
}
|
|
341
371
|
} else {
|
|
342
372
|
result.push(data[i].key)
|
|
@@ -362,6 +392,30 @@ export const key_el_transform = (paramData) => {
|
|
|
362
392
|
return result
|
|
363
393
|
}
|
|
364
394
|
|
|
395
|
+
export const key_vxe_transform = (paramData) => {
|
|
396
|
+
let result = []
|
|
397
|
+
let data = title_filter(paramData)
|
|
398
|
+
// let data = paramData
|
|
399
|
+
for (var i = 0; i < data.length; i++) {
|
|
400
|
+
if ("children" in data[i]) {
|
|
401
|
+
let children = data[i].children
|
|
402
|
+
for (var j = 0; j < children.length; j++) {
|
|
403
|
+
if ("children" in children[j]) {
|
|
404
|
+
let subChildren = children[j].children
|
|
405
|
+
for (var k = 0; k < subChildren.length; k++) {
|
|
406
|
+
result.push(subChildren[k].property)
|
|
407
|
+
}
|
|
408
|
+
}else{
|
|
409
|
+
result.push(children[j].property)
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
} else {
|
|
413
|
+
result.push(data[i].property)
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return result
|
|
417
|
+
}
|
|
418
|
+
|
|
365
419
|
export const enums_transform = (paramData) => {
|
|
366
420
|
let result = []
|
|
367
421
|
let data = title_filter(paramData)
|
|
@@ -404,6 +458,27 @@ export const enums_el_transform = (paramData) => {
|
|
|
404
458
|
return result
|
|
405
459
|
}
|
|
406
460
|
|
|
461
|
+
export const enums_vxe_transform = (paramData) => {
|
|
462
|
+
let result = []
|
|
463
|
+
let data = title_filter(paramData)
|
|
464
|
+
// let data = paramData
|
|
465
|
+
for (var i = 0; i < data.length; i++) {
|
|
466
|
+
if ("children" in data[i]) {
|
|
467
|
+
let children = data[i].children
|
|
468
|
+
for (var j = 0; j < children.length; j++) {
|
|
469
|
+
if("enums" in children[j]){
|
|
470
|
+
result.push({key:children[j].property,enums:children[j].enums})
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
if("enums" in data[i]){
|
|
475
|
+
result.push({key:data[i].property,enums:data[i].enums})
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return result
|
|
480
|
+
}
|
|
481
|
+
|
|
407
482
|
export const export_table_to_excel = (id, filename) => {
|
|
408
483
|
const table = document.getElementById(id);
|
|
409
484
|
const wb = XLSX.utils.table_to_book(table);
|
|
@@ -435,7 +510,6 @@ export const export_json_to_excel = ({data, key, title, filename, spanColumns, a
|
|
|
435
510
|
export const export_array_to_excel = ({key, data, title, filename, spanColumns, autoWidth, format}) => {
|
|
436
511
|
const wb = XLSX.utils.book_new();
|
|
437
512
|
const arr = json_to_array(key, data);
|
|
438
|
-
console.log(arr)
|
|
439
513
|
for (var i = title.length; i > 0; i--) {
|
|
440
514
|
arr.unshift(title[i - 1])
|
|
441
515
|
}
|
|
@@ -451,18 +525,43 @@ export const export_array_to_excel = ({key, data, title, filename, spanColumns,
|
|
|
451
525
|
merge_content(ws, data, spanColumns, title.length)
|
|
452
526
|
add_style(ws, title)
|
|
453
527
|
XLSX.utils.book_append_sheet(wb, ws, filename);
|
|
454
|
-
|
|
528
|
+
if(format === 'csv'){
|
|
529
|
+
XLSX.writeFile(wb, filename + '.' + format,{
|
|
530
|
+
// 要生成的文件类型
|
|
531
|
+
bookType: "csv",
|
|
532
|
+
// // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
|
|
533
|
+
bookSST: false});
|
|
534
|
+
}else{
|
|
535
|
+
// XLSX.writeFileXLSX(wb, filename + '.' + format);
|
|
536
|
+
const workbookBlob = workbook2blob(wb);
|
|
537
|
+
saveAs(workbookBlob, filename + '.' + format);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
// 将workbook装化成blob对象
|
|
541
|
+
function workbook2blob(workbook) {
|
|
542
|
+
// 生成excel的配置项
|
|
543
|
+
const wopts = {
|
|
544
|
+
// 要生成的文件类型
|
|
545
|
+
bookType: "xlsx",
|
|
546
|
+
// // 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
|
|
547
|
+
bookSST: false,
|
|
548
|
+
type: "binary"
|
|
549
|
+
};
|
|
550
|
+
let wbout = XLSXStyle.write(workbook, wopts);
|
|
551
|
+
let blob = new Blob([s2ab(wbout)], {
|
|
552
|
+
type: "application/octet-stream"
|
|
553
|
+
});
|
|
554
|
+
return blob;
|
|
455
555
|
}
|
|
456
|
-
|
|
457
556
|
function s2ab(s) {
|
|
458
557
|
if (typeof ArrayBuffer !== 'undefined') {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
for (
|
|
558
|
+
let buf = new ArrayBuffer(s.length);
|
|
559
|
+
let view = new Uint8Array(buf);
|
|
560
|
+
for (let i = 0; i !== s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
|
|
462
561
|
return buf;
|
|
463
562
|
} else {
|
|
464
|
-
|
|
465
|
-
for (
|
|
563
|
+
let buf = new Array(s.length);
|
|
564
|
+
for (let i = 0; i !== s.length; ++i) buf[i] = s.charCodeAt(i) & 0xFF;
|
|
466
565
|
return buf;
|
|
467
566
|
}
|
|
468
567
|
}
|
|
@@ -512,10 +611,12 @@ export default {
|
|
|
512
611
|
export_json_to_excel,
|
|
513
612
|
key_transform,
|
|
514
613
|
key_el_transform,
|
|
614
|
+
key_vxe_transform,
|
|
515
615
|
title_transform,
|
|
516
616
|
title_el_transform,
|
|
517
617
|
enums_transform,
|
|
518
618
|
enums_el_transform,
|
|
619
|
+
enums_vxe_transform,
|
|
519
620
|
enums_to_value,
|
|
520
621
|
read,
|
|
521
622
|
s2ab,
|
package/utils/menu/index.js
CHANGED
|
@@ -9,6 +9,26 @@ export const hasRoute = ($router, name) => {
|
|
|
9
9
|
let res = routes.filter(item => item.name === name)
|
|
10
10
|
return res && res.length > 0
|
|
11
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
|
+
}
|
|
12
32
|
/**
|
|
13
33
|
* 动态生成菜单
|
|
14
34
|
* @param permissionList
|
|
@@ -44,7 +64,7 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
44
64
|
return;
|
|
45
65
|
}
|
|
46
66
|
list.forEach(item => {
|
|
47
|
-
if (item.appId == appId) {
|
|
67
|
+
if (item.appId == appId && (!item.hasOwnProperty("hideInMenu") || (item.hasOwnProperty("hideInMenu") && !item.hideInMenu))) {
|
|
48
68
|
// 判断是否为父级菜单
|
|
49
69
|
if (item.pid === parentId) {
|
|
50
70
|
if (item.type === 1 || item.type === 2) {
|
|
@@ -54,7 +74,9 @@ const listToMenuTree = (list, menuTree, pageNode, parentId, crumbs, root, appId)
|
|
|
54
74
|
title: item.label,
|
|
55
75
|
icon: item.icon,
|
|
56
76
|
crumbs: [...crumbs],
|
|
57
|
-
activeName: item.name
|
|
77
|
+
activeName: item.name,
|
|
78
|
+
notCache: item.notCache ? true : false,
|
|
79
|
+
hideInMenu: item.hideInMenu ? true : false
|
|
58
80
|
},
|
|
59
81
|
type: item.type,
|
|
60
82
|
pid: item.pid,
|