eoss-mobiles 0.2.13 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/checkbox.js +260 -199
- package/lib/config/api.js +4 -1
- package/lib/date.js +3 -3
- package/lib/eoss-mobile.common.js +746 -249
- package/lib/flow.js +362 -277
- package/lib/index.js +1 -1
- package/lib/notice-bar.js +2 -2
- package/lib/picker.js +260 -199
- package/lib/pull-refresh.js +2 -2
- package/lib/radio.js +260 -199
- package/lib/retrial-auth.js +2457 -0
- package/lib/selector.js +294 -233
- package/lib/table-column.js +260 -199
- package/lib/table.js +227 -172
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/retrial-auth.css +1 -0
- package/lib/utils/axios.js +140 -154
- package/lib/utils/http.js +5 -5
- package/lib/utils/util.js +71 -2
- package/package.json +1 -1
- package/packages/date/src/main.vue +1 -1
- package/packages/flow/src/components/Handle.vue +4 -1
- package/packages/flow/src/components/Opinion.vue +39 -3
- package/packages/flow/src/components/StartFlow.vue +3 -3
- package/packages/flow/src/main.vue +6 -0
- package/packages/retrial-auth/index.js +5 -0
- package/packages/retrial-auth/src/main.vue +257 -0
- package/packages/selector/src/selector-tree.vue +1 -1
- package/packages/selector/src/tree.vue +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/retrial-auth.css +1 -0
- package/packages/theme-chalk/src/index.scss +1 -0
- package/packages/theme-chalk/src/retrial-auth.scss +28 -0
- package/src/config/api.js +3 -0
- package/src/index.js +4 -1
- package/src/utils/axios.js +156 -174
- package/src/utils/http.js +15 -5
- package/src/utils/util.js +164 -84
package/src/utils/util.js
CHANGED
|
@@ -1,9 +1,43 @@
|
|
|
1
1
|
/* eslint-disable indent */
|
|
2
2
|
// import { authCenter } from '../config/api';
|
|
3
3
|
import { generate } from '@eoss-design/color';
|
|
4
|
-
|
|
4
|
+
// import CryptoJS from 'crypto-js'
|
|
5
5
|
const sm2 = require('sm-crypto').sm2;
|
|
6
|
-
|
|
6
|
+
// /**
|
|
7
|
+
// * esEncrypt
|
|
8
|
+
// * @desc:sm2加密
|
|
9
|
+
// * @author huangbo
|
|
10
|
+
// * @date 2022年5月7日
|
|
11
|
+
// * @param {string} [data] - 被加密的字符串
|
|
12
|
+
// * @param {string} [key] - 公钥
|
|
13
|
+
// **/
|
|
14
|
+
// const encryptDes = (message, key) => {
|
|
15
|
+
// const keyHex = CryptoJS.enc.Utf8.parse(key);
|
|
16
|
+
// const encrypted = CryptoJS.DES.encrypt(message, keyHex, {
|
|
17
|
+
// mode: CryptoJS.mode.ECB,
|
|
18
|
+
// padding: CryptoJS.pad.Pkcs7
|
|
19
|
+
// });
|
|
20
|
+
// return encrypted.toString();
|
|
21
|
+
// }
|
|
22
|
+
// /**
|
|
23
|
+
// * esEncrypt
|
|
24
|
+
// * @desc:sm2加密
|
|
25
|
+
// * @author huangbo
|
|
26
|
+
// * @date 2022年5月7日
|
|
27
|
+
// * @param {string} [data] - 被加密的字符串
|
|
28
|
+
// * @param {string} [key] - 公钥
|
|
29
|
+
// **/
|
|
30
|
+
// const decryptDes = (ciphertext, key) => {
|
|
31
|
+
// const keyHex = CryptoJS.enc.Utf8.parse(key);
|
|
32
|
+
// // direct decrypt ciphertext
|
|
33
|
+
// const decrypted = CryptoJS.DES.decrypt({
|
|
34
|
+
// ciphertext: CryptoJS.enc.Base64.parse(ciphertext)
|
|
35
|
+
// }, keyHex, {
|
|
36
|
+
// mode: CryptoJS.mode.ECB,
|
|
37
|
+
// padding: CryptoJS.pad.Pkcs7
|
|
38
|
+
// });
|
|
39
|
+
// return decrypted.toString(CryptoJS.enc.Utf8);
|
|
40
|
+
// }
|
|
7
41
|
/**
|
|
8
42
|
* esEncrypt
|
|
9
43
|
* @desc:sm2加密
|
|
@@ -12,7 +46,7 @@ const sm2 = require('sm-crypto').sm2;
|
|
|
12
46
|
* @param {string} [data] - 被加密的字符串
|
|
13
47
|
* @param {string} [key] - 公钥
|
|
14
48
|
**/
|
|
15
|
-
const esEncrypt = function
|
|
49
|
+
const esEncrypt = function(data, key, mode) {
|
|
16
50
|
const cipherMode = mode ? mode : 1;
|
|
17
51
|
if (!new RegExp('^04').test(key)) {
|
|
18
52
|
key = '04' + key;
|
|
@@ -29,7 +63,7 @@ const esEncrypt = function (data, key, mode) {
|
|
|
29
63
|
* @param {string} [data] - 被解密的加密字符串
|
|
30
64
|
* @param {string} [key] - 私钥
|
|
31
65
|
**/
|
|
32
|
-
const esDecode = function
|
|
66
|
+
const esDecode = function(data, key, mode) {
|
|
33
67
|
const cipherMode = mode ? mode : 1;
|
|
34
68
|
const result = sm2.doDecrypt(data, key, cipherMode);
|
|
35
69
|
return result;
|
|
@@ -42,7 +76,7 @@ const esDecode = function (data, key, mode) {
|
|
|
42
76
|
* @param {string} [str] - 被查找的字符串
|
|
43
77
|
* @param {string} [reg] - 指定字符串
|
|
44
78
|
**/
|
|
45
|
-
const startWith = function
|
|
79
|
+
const startWith = function(str, reg) {
|
|
46
80
|
if (new RegExp('^' + reg).test(str)) {
|
|
47
81
|
return true;
|
|
48
82
|
}
|
|
@@ -56,11 +90,11 @@ const startWith = function (str, reg) {
|
|
|
56
90
|
* @param {string} [str] - 域名或者路径
|
|
57
91
|
* @param {string} [url] - 地址
|
|
58
92
|
**/
|
|
59
|
-
const jointUrl = function
|
|
93
|
+
const jointUrl = function(url, str) {
|
|
60
94
|
if (startWith(url, 'http') || startWith(url, 'blob:') || !str) {
|
|
61
95
|
return url;
|
|
62
96
|
}
|
|
63
|
-
return startWith(url, str) ? url :
|
|
97
|
+
return startWith(url, str) ? url : str + url;
|
|
64
98
|
};
|
|
65
99
|
/**
|
|
66
100
|
* queryParams
|
|
@@ -69,7 +103,7 @@ const jointUrl = function (url, str) {
|
|
|
69
103
|
* @date 2022年5月7日
|
|
70
104
|
* @param {Object} [obj] - 被转换的对象
|
|
71
105
|
**/
|
|
72
|
-
const queryParams = function
|
|
106
|
+
const queryParams = function(obj) {
|
|
73
107
|
let arry = [];
|
|
74
108
|
for (let i in obj) {
|
|
75
109
|
arry.push(i + '=' + obj[i]);
|
|
@@ -87,7 +121,7 @@ const queryParams = function (obj) {
|
|
|
87
121
|
* @param {Object} [url] - url地址
|
|
88
122
|
* @param {Object} [obj] - 被转换的对象
|
|
89
123
|
**/
|
|
90
|
-
const urlJoinParams = function
|
|
124
|
+
const urlJoinParams = function(url, obj) {
|
|
91
125
|
let arry = decodeURI(url).split('?');
|
|
92
126
|
let params = {};
|
|
93
127
|
if (arry.length > 1) {
|
|
@@ -112,7 +146,7 @@ const urlJoinParams = function (url, obj) {
|
|
|
112
146
|
* @param {Object} [arr] - 原始数组
|
|
113
147
|
* @param {String} [key] - 对象子元素的属性名
|
|
114
148
|
**/
|
|
115
|
-
const arrUnique = function
|
|
149
|
+
const arrUnique = function(arr, key) {
|
|
116
150
|
var newArr = [];
|
|
117
151
|
if (key === undefined) {
|
|
118
152
|
arr.sort();
|
|
@@ -140,7 +174,7 @@ const arrUnique = function (arr, key) {
|
|
|
140
174
|
* @date 2022年5月7日
|
|
141
175
|
* @param {Object} [obj] - 对象
|
|
142
176
|
**/
|
|
143
|
-
const isObject = function
|
|
177
|
+
const isObject = function(obj) {
|
|
144
178
|
let proto;
|
|
145
179
|
let Ctor;
|
|
146
180
|
let hasOwn = {}.hasOwnProperty;
|
|
@@ -166,7 +200,7 @@ const isObject = function (obj) {
|
|
|
166
200
|
* @date 2022年5月7日
|
|
167
201
|
* @param {Object} [obj] - 对象
|
|
168
202
|
**/
|
|
169
|
-
const isFunction = function
|
|
203
|
+
const isFunction = function(obj) {
|
|
170
204
|
return (
|
|
171
205
|
typeof obj === 'function' &&
|
|
172
206
|
typeof obj.nodeType !== 'number' &&
|
|
@@ -181,7 +215,7 @@ const isFunction = function (obj) {
|
|
|
181
215
|
* @param {Object} [target] - 被扩展的对象
|
|
182
216
|
* @param {Boolean}} [deep] - 是否深度操作
|
|
183
217
|
**/
|
|
184
|
-
const extend = function
|
|
218
|
+
const extend = function() {
|
|
185
219
|
let options;
|
|
186
220
|
let name;
|
|
187
221
|
let src;
|
|
@@ -240,7 +274,7 @@ const extend = function () {
|
|
|
240
274
|
* @author tangdaibing
|
|
241
275
|
* @date 2022年5月7日
|
|
242
276
|
**/
|
|
243
|
-
const getObjectType = function
|
|
277
|
+
const getObjectType = function(data) {
|
|
244
278
|
let type = Object.prototype.toString.call(data).toLowerCase();
|
|
245
279
|
const typeFormat = {
|
|
246
280
|
'[object string]': 'string',
|
|
@@ -262,15 +296,15 @@ const getObjectType = function (data) {
|
|
|
262
296
|
* @date 2022年5月7日
|
|
263
297
|
* @param {String} [name] - 参数名称
|
|
264
298
|
**/
|
|
265
|
-
const getParams = function
|
|
299
|
+
const getParams = function(name) {
|
|
266
300
|
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
|
|
267
301
|
var r = window.location.search
|
|
268
302
|
? decodeURI(window.location.search)
|
|
269
|
-
|
|
270
|
-
|
|
303
|
+
.substr(1)
|
|
304
|
+
.match(reg)
|
|
271
305
|
: decodeURI(window.location.hash)
|
|
272
|
-
|
|
273
|
-
|
|
306
|
+
.slice(decodeURI(window.location.hash).indexOf('?') + 1)
|
|
307
|
+
.match(reg);
|
|
274
308
|
if (r != null) {
|
|
275
309
|
return unescape(r[2]);
|
|
276
310
|
} else {
|
|
@@ -284,7 +318,7 @@ const getParams = function (name) {
|
|
|
284
318
|
* @date 2022年5月7日
|
|
285
319
|
* @param {String} [url] - js文件地址
|
|
286
320
|
**/
|
|
287
|
-
const getScript = function
|
|
321
|
+
const getScript = function(url) {
|
|
288
322
|
// eslint-disable-next-line no-undef
|
|
289
323
|
return new Promise((resolve, reject) => {
|
|
290
324
|
var xmlHttp = null;
|
|
@@ -308,7 +342,7 @@ const getScript = function (url) {
|
|
|
308
342
|
}
|
|
309
343
|
};
|
|
310
344
|
xmlHttp.send();
|
|
311
|
-
}).catch(function onRejected() {
|
|
345
|
+
}).catch(function onRejected() {});
|
|
312
346
|
};
|
|
313
347
|
/**
|
|
314
348
|
* domEval
|
|
@@ -332,7 +366,7 @@ function domEval(code) {
|
|
|
332
366
|
* @param {Object} [item] - 目标对象
|
|
333
367
|
* @param {String} [key] - 目标对象的属性名
|
|
334
368
|
**/
|
|
335
|
-
const indexOfObj = function
|
|
369
|
+
const indexOfObj = function(arry, item, key) {
|
|
336
370
|
for (var i = 0; i < arry.length; i++) {
|
|
337
371
|
if (key) {
|
|
338
372
|
if (typeof item === 'string' && arry[i][key] === item) {
|
|
@@ -357,7 +391,7 @@ const indexOfObj = function (arry, item, key) {
|
|
|
357
391
|
* @date 2022年5月7日
|
|
358
392
|
* @param {String} [el] - 文字所在的dom
|
|
359
393
|
**/
|
|
360
|
-
const overbrim = function
|
|
394
|
+
const overbrim = function(el) {
|
|
361
395
|
let w = el.offsetWidth;
|
|
362
396
|
var s = el.scrollWidth;
|
|
363
397
|
if (s > w) {
|
|
@@ -376,7 +410,7 @@ const overbrim = function (el) {
|
|
|
376
410
|
* @param {String, Array, Object} [key] - 数据的名称,array类型表示多个key保存同一个value,object类型时对象的属性名称作为key属性值作为value
|
|
377
411
|
* @param {String} [value] - 数据的值
|
|
378
412
|
**/
|
|
379
|
-
const setStorage = function
|
|
413
|
+
const setStorage = function(type, key, value) {
|
|
380
414
|
if (type === undefined || type === 'sessionStorage') {
|
|
381
415
|
if (typeof key === 'string') {
|
|
382
416
|
sessionStorage.setItem(key, value);
|
|
@@ -410,7 +444,7 @@ const setStorage = function (type, key, value) {
|
|
|
410
444
|
* @date 2022年5月7日
|
|
411
445
|
* @param {String, Array} [key] - 获取的名称
|
|
412
446
|
**/
|
|
413
|
-
const removeStorage = function
|
|
447
|
+
const removeStorage = function(key) {
|
|
414
448
|
if (Array.isArray(key)) {
|
|
415
449
|
for (let i = 0; i < key.length; i++) {
|
|
416
450
|
sessionStorage.removeItem(key[i]);
|
|
@@ -431,7 +465,7 @@ const removeStorage = function (key) {
|
|
|
431
465
|
* @date 2022年5月7日
|
|
432
466
|
* @param {String} [key] - 获取的名称
|
|
433
467
|
**/
|
|
434
|
-
const getStorage = function
|
|
468
|
+
const getStorage = function(key) {
|
|
435
469
|
if (key) {
|
|
436
470
|
let res =
|
|
437
471
|
sessionStorage.getItem(key) || localStorage.getItem(key) || window[key];
|
|
@@ -464,7 +498,7 @@ const getStorage = function (key) {
|
|
|
464
498
|
}
|
|
465
499
|
return defaults;
|
|
466
500
|
};
|
|
467
|
-
const getValues = function
|
|
501
|
+
const getValues = function(obj, flag) {
|
|
468
502
|
let val = {};
|
|
469
503
|
obj.forEach(items => {
|
|
470
504
|
if (items.contents) {
|
|
@@ -545,7 +579,7 @@ const loading = ($loading, res) => {
|
|
|
545
579
|
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
546
580
|
* @param {String} [fmt] - 格式
|
|
547
581
|
**/
|
|
548
|
-
const formatDate = function
|
|
582
|
+
const formatDate = function(date, fmt) {
|
|
549
583
|
let obj;
|
|
550
584
|
if (date) {
|
|
551
585
|
obj = new Date(date);
|
|
@@ -586,7 +620,7 @@ const formatDate = function (date, fmt) {
|
|
|
586
620
|
* @date 2022年5月7日
|
|
587
621
|
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
588
622
|
**/
|
|
589
|
-
const timeFrame = function
|
|
623
|
+
const timeFrame = function(date) {
|
|
590
624
|
let obj;
|
|
591
625
|
if (date) {
|
|
592
626
|
obj = new Date(date);
|
|
@@ -598,8 +632,8 @@ const timeFrame = function (date) {
|
|
|
598
632
|
h < 12
|
|
599
633
|
? (period = '上午好!')
|
|
600
634
|
: h < 18
|
|
601
|
-
|
|
602
|
-
|
|
635
|
+
? (period = '下午好!')
|
|
636
|
+
: (period = '晚上好!');
|
|
603
637
|
return period;
|
|
604
638
|
};
|
|
605
639
|
/**
|
|
@@ -611,7 +645,7 @@ const timeFrame = function (date) {
|
|
|
611
645
|
* @param {String} [attr] - 样式属性名
|
|
612
646
|
**/
|
|
613
647
|
|
|
614
|
-
const getStyle = function
|
|
648
|
+
const getStyle = function(dom, attr) {
|
|
615
649
|
if (dom.style[attr]) {
|
|
616
650
|
return dom.style[attr];
|
|
617
651
|
}
|
|
@@ -629,7 +663,7 @@ const getStyle = function (dom, attr) {
|
|
|
629
663
|
* @param {String} [url] - url地址
|
|
630
664
|
**/
|
|
631
665
|
|
|
632
|
-
const handlerUrl = function
|
|
666
|
+
const handlerUrl = function(url, host) {
|
|
633
667
|
var arry = url.split('?');
|
|
634
668
|
if (arry.length > 1) {
|
|
635
669
|
if (arry[1].indexOf('_tt') > -1) {
|
|
@@ -658,7 +692,7 @@ const handlerUrl = function (url, host) {
|
|
|
658
692
|
* @date 2022年5月7日
|
|
659
693
|
* @param {string} [$color] - 颜色值
|
|
660
694
|
**/
|
|
661
|
-
const getRgb = function
|
|
695
|
+
const getRgb = function($color) {
|
|
662
696
|
let rgb = [];
|
|
663
697
|
// 16进制颜色值的正则
|
|
664
698
|
let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
@@ -690,7 +724,7 @@ const getRgb = function ($color) {
|
|
|
690
724
|
* @date 2022年5月7日
|
|
691
725
|
* @param {string} [$color] - 颜色值
|
|
692
726
|
**/
|
|
693
|
-
const rgbToHsv = function
|
|
727
|
+
const rgbToHsv = function($color) {
|
|
694
728
|
let rgb = getRgb($color);
|
|
695
729
|
let $red = rgb[0];
|
|
696
730
|
let $green = rgb[1];
|
|
@@ -842,7 +876,7 @@ function getColor($color, $n) {
|
|
|
842
876
|
* @param {string} [$color2] - 颜色值
|
|
843
877
|
* @param {string} [$n] - 百分比 0~1
|
|
844
878
|
**/
|
|
845
|
-
const mixColor = function
|
|
879
|
+
const mixColor = function($color1, $color2, $n) {
|
|
846
880
|
const rgb1 = getRgb($color1);
|
|
847
881
|
const rgb2 = getRgb($color2);
|
|
848
882
|
const r = rgb1[0] * $n + rgb2[0] * (1 - $n);
|
|
@@ -857,7 +891,7 @@ const mixColor = function ($color1, $color2, $n) {
|
|
|
857
891
|
* @date 2022年5月7日
|
|
858
892
|
* @param {string} [$color] - 颜色值
|
|
859
893
|
**/
|
|
860
|
-
const updateTheme = function
|
|
894
|
+
const updateTheme = function($color, send) {
|
|
861
895
|
$color = $color ? $color : '#409eff';
|
|
862
896
|
if (send === undefined) {
|
|
863
897
|
send = true;
|
|
@@ -889,7 +923,7 @@ const updateTheme = function ($color, send) {
|
|
|
889
923
|
* @param {object} [data] - 数据---其中type必须表示操作类型
|
|
890
924
|
* @param {string} [url] - 指定的消息发送URI地址
|
|
891
925
|
**/
|
|
892
|
-
const sendMessage = function
|
|
926
|
+
const sendMessage = function({ data = {}, url }) {
|
|
893
927
|
const iframes = document.getElementsByTagName('iframe');
|
|
894
928
|
for (let i = 0; i < iframes.length; i++) {
|
|
895
929
|
if (url !== undefined) {
|
|
@@ -912,8 +946,8 @@ const sendMessage = function ({ data = {}, url }) {
|
|
|
912
946
|
* @param {string} [url] - 消息源的 URI
|
|
913
947
|
* @param {function} [callback] - 回调函数
|
|
914
948
|
**/
|
|
915
|
-
const receiveMessage = function
|
|
916
|
-
window.addEventListener('message', function
|
|
949
|
+
const receiveMessage = function({ data = {}, url, callback }) {
|
|
950
|
+
window.addEventListener('message', function(e) {
|
|
917
951
|
if (url !== undefined) {
|
|
918
952
|
if (e.origin !== url) {
|
|
919
953
|
// 验证消息来源地址
|
|
@@ -931,7 +965,7 @@ const receiveMessage = function ({ data = {}, url, callback }) {
|
|
|
931
965
|
* @date 2022年5月7日
|
|
932
966
|
* @param {string} [type] - 类型
|
|
933
967
|
**/
|
|
934
|
-
const getTypeName = function
|
|
968
|
+
const getTypeName = function(type) {
|
|
935
969
|
let typeName = '';
|
|
936
970
|
const sysorgname = getStorage('sysorgname');
|
|
937
971
|
const sysdepname = getStorage('sysdepname');
|
|
@@ -1009,7 +1043,7 @@ const getTypeName = function (type) {
|
|
|
1009
1043
|
* @param {string、number} [num] - 数字或字符串型数字
|
|
1010
1044
|
* @param {number} [precision] - 需要的小数位数
|
|
1011
1045
|
**/
|
|
1012
|
-
const replenish = function
|
|
1046
|
+
const replenish = function(num, precision) {
|
|
1013
1047
|
if (num && precision && precision > 0) {
|
|
1014
1048
|
let power = Math.pow(10, precision);
|
|
1015
1049
|
let res = num === 'string' ? Number(num) : num;
|
|
@@ -1035,7 +1069,7 @@ const replenish = function (num, precision) {
|
|
|
1035
1069
|
* @param {callback} [function] - 回调函数
|
|
1036
1070
|
* @param {val} [string] - 被验证的原值
|
|
1037
1071
|
**/
|
|
1038
|
-
const identical = function
|
|
1072
|
+
const identical = function(value, callback, val) {
|
|
1039
1073
|
if (value === '' || value === null || value === undefined) {
|
|
1040
1074
|
if (val === '' || val === null || val === undefined) {
|
|
1041
1075
|
callback();
|
|
@@ -1059,7 +1093,7 @@ const identical = function (value, callback, val) {
|
|
|
1059
1093
|
* @param {name} [string] - 导出文件名
|
|
1060
1094
|
* @param {numbers} [boolean] - 序号
|
|
1061
1095
|
**/
|
|
1062
|
-
const exportXls = function
|
|
1096
|
+
const exportXls = function({ thead = [], data = [], name, numbers }) {
|
|
1063
1097
|
let tbody = '';
|
|
1064
1098
|
let aligns = [];
|
|
1065
1099
|
let fields = [];
|
|
@@ -1072,7 +1106,9 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1072
1106
|
const tr = thead[i];
|
|
1073
1107
|
for (let x = 0; x < tr.length; x++) {
|
|
1074
1108
|
const td = tr[x];
|
|
1075
|
-
tbody += `<th rowspan="${td.rowspan}" colspan="${td.colspan}" align="${
|
|
1109
|
+
tbody += `<th rowspan="${td.rowspan}" colspan="${td.colspan}" align="${
|
|
1110
|
+
td.align
|
|
1111
|
+
}">${td.label}</th>`;
|
|
1076
1112
|
if (td.property) {
|
|
1077
1113
|
fields.push(td.property);
|
|
1078
1114
|
aligns.push(td.align);
|
|
@@ -1091,7 +1127,10 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1091
1127
|
name = 'table_' + new Date().getTime();
|
|
1092
1128
|
}
|
|
1093
1129
|
var uri = 'data:application/vnd.ms-excel;base64,';
|
|
1094
|
-
var template =
|
|
1130
|
+
var template =
|
|
1131
|
+
'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><meta charset="UTF-8"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table style="vnd.ms-excel.numberformat:@">' +
|
|
1132
|
+
tbody +
|
|
1133
|
+
'</table></body></html>';
|
|
1095
1134
|
alink.href = uri + window.btoa(unescape(encodeURIComponent(template)));
|
|
1096
1135
|
alink.download = name + '.xls';
|
|
1097
1136
|
document.body.appendChild(alink);
|
|
@@ -1111,8 +1150,15 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1111
1150
|
* ```
|
|
1112
1151
|
* @return {Array} ['#e6f9ff','#0e91ef',...]
|
|
1113
1152
|
*/
|
|
1114
|
-
const handlerGetThemeCluster = function
|
|
1115
|
-
|
|
1153
|
+
const handlerGetThemeCluster = function(
|
|
1154
|
+
color,
|
|
1155
|
+
mode = 'light',
|
|
1156
|
+
backgroundColor = '#000000'
|
|
1157
|
+
) {
|
|
1158
|
+
return generate(
|
|
1159
|
+
color,
|
|
1160
|
+
mode === 'dark' ? { theme: 'dark', backgroundColor } : {}
|
|
1161
|
+
);
|
|
1116
1162
|
};
|
|
1117
1163
|
|
|
1118
1164
|
/**
|
|
@@ -1181,7 +1227,7 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1181
1227
|
* @author liufan
|
|
1182
1228
|
* @param {Object} data -链接参数
|
|
1183
1229
|
*/
|
|
1184
|
-
|
|
1230
|
+
const JSCallNativeOpenUrl = function(data) {
|
|
1185
1231
|
let u = navigator.userAgent;
|
|
1186
1232
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1187
1233
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
@@ -1198,7 +1244,7 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1198
1244
|
* @author liufan
|
|
1199
1245
|
* @param {Object} data 正文参数
|
|
1200
1246
|
*/
|
|
1201
|
-
|
|
1247
|
+
const openMainBodyFile = function(data) {
|
|
1202
1248
|
let u = navigator.userAgent;
|
|
1203
1249
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1204
1250
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
@@ -1215,45 +1261,62 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1215
1261
|
* @author liufan
|
|
1216
1262
|
* @param {String} url 调整地址
|
|
1217
1263
|
*/
|
|
1218
|
-
|
|
1264
|
+
const openUrl = function(url) {
|
|
1265
|
+
let u = navigator.userAgent;
|
|
1266
|
+
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1267
|
+
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1268
|
+
if (isAndroid) {
|
|
1269
|
+
window.open(url);
|
|
1270
|
+
} else if (isiOS) {
|
|
1271
|
+
window.location.href = url;
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
/**
|
|
1275
|
+
* openAttachment
|
|
1276
|
+
* @desc:原生app通用打开附件
|
|
1277
|
+
* @date 2023年3月2日
|
|
1278
|
+
* @author liufan
|
|
1279
|
+
* @param {Object} data -附件信息
|
|
1280
|
+
*/
|
|
1281
|
+
const openAttachment = function(data) {
|
|
1282
|
+
if (window.isCh) {
|
|
1283
|
+
window.uexPDF.openOther(data);
|
|
1284
|
+
} else {
|
|
1219
1285
|
let u = navigator.userAgent;
|
|
1220
1286
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1221
1287
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1222
1288
|
if (isAndroid) {
|
|
1223
|
-
window.
|
|
1289
|
+
window.AndroidWebView.jsOpenAccessory(JSON.stringify(data));
|
|
1224
1290
|
} else if (isiOS) {
|
|
1225
|
-
window.
|
|
1291
|
+
window.webkit.messageHandlers.jsOpenAccessory.postMessage(data);
|
|
1226
1292
|
}
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
* @param {Object、Array} target
|
|
1255
|
-
*/
|
|
1256
|
-
const deepClone = (target) => {
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
/**
|
|
1296
|
+
* jsGoPayrollIndexAct
|
|
1297
|
+
* @desc:原生app打开工资条页面
|
|
1298
|
+
* @date 2024年1月11日
|
|
1299
|
+
* @author liufan
|
|
1300
|
+
*/
|
|
1301
|
+
const jsGoPayrollIndexAct = function(id) {
|
|
1302
|
+
let u = navigator.userAgent;
|
|
1303
|
+
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1304
|
+
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1305
|
+
if (isAndroid) {
|
|
1306
|
+
window.AndroidWebView.jsGoPayrollIndexAct(id);
|
|
1307
|
+
} else if (isiOS) {
|
|
1308
|
+
window.webkit.messageHandlers.jsGoPayrollIndexAct.postMessage(id);
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* deepClone
|
|
1314
|
+
* @desc:深拷贝
|
|
1315
|
+
* @date 2023年3月2日
|
|
1316
|
+
* @author liufan
|
|
1317
|
+
* @param {Object、Array} target
|
|
1318
|
+
*/
|
|
1319
|
+
const deepClone = target => {
|
|
1257
1320
|
let result;
|
|
1258
1321
|
// 如果当前需要深拷贝的是一个对象的话
|
|
1259
1322
|
if (typeof target === 'object') {
|
|
@@ -1299,6 +1362,21 @@ const exclAttribute = ({ attrs = 'value', data }) => {
|
|
|
1299
1362
|
}
|
|
1300
1363
|
return obj;
|
|
1301
1364
|
};
|
|
1365
|
+
/**
|
|
1366
|
+
* 获取UUID
|
|
1367
|
+
* @desc:generateUUID
|
|
1368
|
+
* @author liufan
|
|
1369
|
+
* @date 2024年1月12日
|
|
1370
|
+
**/
|
|
1371
|
+
const generateUUID = () => {
|
|
1372
|
+
var d = new Date().getTime();
|
|
1373
|
+
var uuid = 'xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
1374
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
|
1375
|
+
d = Math.floor(d / 16);
|
|
1376
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
1377
|
+
});
|
|
1378
|
+
return uuid;
|
|
1379
|
+
};
|
|
1302
1380
|
export default {
|
|
1303
1381
|
esEncrypt,
|
|
1304
1382
|
esDecode,
|
|
@@ -1342,5 +1420,7 @@ export default {
|
|
|
1342
1420
|
getTypeName,
|
|
1343
1421
|
replenish,
|
|
1344
1422
|
identical,
|
|
1345
|
-
|
|
1423
|
+
jsGoPayrollIndexAct,
|
|
1424
|
+
exportXls,
|
|
1425
|
+
generateUUID
|
|
1346
1426
|
};
|