eoss-mobiles 0.2.13 → 0.2.14
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 +72 -32
- package/lib/config/api.js +4 -1
- package/lib/eoss-mobile.common.js +536 -60
- package/lib/flow.js +173 -109
- package/lib/index.js +1 -1
- package/lib/notice-bar.js +2 -2
- package/lib/picker.js +72 -32
- package/lib/pull-refresh.js +2 -2
- package/lib/radio.js +72 -32
- package/lib/retrial-auth.js +2436 -0
- package/lib/selector.js +90 -50
- package/lib/table-column.js +72 -32
- package/lib/table.js +39 -5
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/retrial-auth.css +1 -0
- package/lib/utils/axios.js +2 -3
- package/lib/utils/util.js +35 -1
- package/package.json +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/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 +2 -2
- package/src/utils/util.js +128 -82
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@import './common/var.scss';
|
|
2
|
+
.em-retrial-auth {
|
|
3
|
+
&-box {
|
|
4
|
+
padding: 10px;
|
|
5
|
+
background-color: #fff;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
.van-cell {
|
|
8
|
+
padding-left: 0px;
|
|
9
|
+
padding-right: 0px;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
&-icon-box{
|
|
13
|
+
width: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
padding: 20px 0px 10px 0px;
|
|
17
|
+
&-item{
|
|
18
|
+
margin:0px 5px;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
padding: 7px;
|
|
21
|
+
background-color:#D9D9D9 ;
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
}
|
|
24
|
+
.active{
|
|
25
|
+
background-color:$--color-primary;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/config/api.js
CHANGED
|
@@ -2,6 +2,9 @@ import $ from '../utils/util';
|
|
|
2
2
|
var activiti = '/bpm';
|
|
3
3
|
var pending = '/bpm';
|
|
4
4
|
var mecp = $.getStorage('flowPath') || '';
|
|
5
|
+
export const initRetrialAuth = '/sso2/retrialAuth/initRetrialAuth'; // 初始化二级身份权限验证页面
|
|
6
|
+
export const getRetrialAuthCode = '/sso2/retrialAuth/getRetrialAuthCode'; // 获取二级身份验证验证码
|
|
7
|
+
export const codeRetrialAuth = '/sso2/retrialAuth/codeRetrialAuth';// 二级身份验证-验证码验证
|
|
5
8
|
// 获取机构/用户/角色/群组等选择器
|
|
6
9
|
export const selectObject = '/api/v1/mecpSys/selectObject.json';
|
|
7
10
|
// // 获取代码表数据
|
package/src/index.js
CHANGED
|
@@ -40,6 +40,7 @@ import Stepper from '../packages/stepper/index.js';
|
|
|
40
40
|
import Esign from '../packages/esign/index.js';
|
|
41
41
|
import Pagination from '../packages/pagination/index.js';
|
|
42
42
|
import Swipe from '../packages/swipe/index.js';
|
|
43
|
+
import RetrialAuth from '../packages/retrial-auth/index.js';
|
|
43
44
|
import PullRefresh from '../packages/pull-refresh/index.js';
|
|
44
45
|
import NoticeBar from '../packages/notice-bar/index.js';
|
|
45
46
|
|
|
@@ -84,6 +85,7 @@ const components = [
|
|
|
84
85
|
Esign,
|
|
85
86
|
Pagination,
|
|
86
87
|
Swipe,
|
|
88
|
+
RetrialAuth,
|
|
87
89
|
PullRefresh,
|
|
88
90
|
NoticeBar
|
|
89
91
|
];
|
|
@@ -99,7 +101,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
export default {
|
|
102
|
-
version: '0.2.
|
|
104
|
+
version: '0.2.14',
|
|
103
105
|
install,
|
|
104
106
|
Button,
|
|
105
107
|
ButtonGroup,
|
|
@@ -140,6 +142,7 @@ export default {
|
|
|
140
142
|
Esign,
|
|
141
143
|
Pagination,
|
|
142
144
|
Swipe,
|
|
145
|
+
RetrialAuth,
|
|
143
146
|
PullRefresh,
|
|
144
147
|
NoticeBar
|
|
145
148
|
};
|
package/src/utils/axios.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Axios from 'axios';
|
|
2
|
-
// import Vue from 'vue';
|
|
3
2
|
import { Toast } from 'eoss-mobile-vant';
|
|
4
3
|
import $ from './util';
|
|
5
4
|
import qs from 'qs';
|
|
@@ -113,6 +112,7 @@ http.interceptors.request.use(
|
|
|
113
112
|
}
|
|
114
113
|
);
|
|
115
114
|
// 响应拦截器
|
|
115
|
+
|
|
116
116
|
http.interceptors.response.use(
|
|
117
117
|
response => {
|
|
118
118
|
if (response.status === 200) {
|
|
@@ -122,7 +122,7 @@ http.interceptors.response.use(
|
|
|
122
122
|
return Promise.resolve(response.data);
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
|
-
return Promise.reject(response);
|
|
125
|
+
return Promise.reject(response.data);
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
error => {
|
package/src/utils/util.js
CHANGED
|
@@ -12,7 +12,7 @@ const sm2 = require('sm-crypto').sm2;
|
|
|
12
12
|
* @param {string} [data] - 被加密的字符串
|
|
13
13
|
* @param {string} [key] - 公钥
|
|
14
14
|
**/
|
|
15
|
-
const esEncrypt = function
|
|
15
|
+
const esEncrypt = function(data, key, mode) {
|
|
16
16
|
const cipherMode = mode ? mode : 1;
|
|
17
17
|
if (!new RegExp('^04').test(key)) {
|
|
18
18
|
key = '04' + key;
|
|
@@ -29,7 +29,7 @@ const esEncrypt = function (data, key, mode) {
|
|
|
29
29
|
* @param {string} [data] - 被解密的加密字符串
|
|
30
30
|
* @param {string} [key] - 私钥
|
|
31
31
|
**/
|
|
32
|
-
const esDecode = function
|
|
32
|
+
const esDecode = function(data, key, mode) {
|
|
33
33
|
const cipherMode = mode ? mode : 1;
|
|
34
34
|
const result = sm2.doDecrypt(data, key, cipherMode);
|
|
35
35
|
return result;
|
|
@@ -42,7 +42,7 @@ const esDecode = function (data, key, mode) {
|
|
|
42
42
|
* @param {string} [str] - 被查找的字符串
|
|
43
43
|
* @param {string} [reg] - 指定字符串
|
|
44
44
|
**/
|
|
45
|
-
const startWith = function
|
|
45
|
+
const startWith = function(str, reg) {
|
|
46
46
|
if (new RegExp('^' + reg).test(str)) {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
@@ -56,11 +56,11 @@ const startWith = function (str, reg) {
|
|
|
56
56
|
* @param {string} [str] - 域名或者路径
|
|
57
57
|
* @param {string} [url] - 地址
|
|
58
58
|
**/
|
|
59
|
-
const jointUrl = function
|
|
59
|
+
const jointUrl = function(url, str) {
|
|
60
60
|
if (startWith(url, 'http') || startWith(url, 'blob:') || !str) {
|
|
61
61
|
return url;
|
|
62
62
|
}
|
|
63
|
-
return startWith(url, str) ? url :
|
|
63
|
+
return startWith(url, str) ? url : str + url;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
66
|
* queryParams
|
|
@@ -69,7 +69,7 @@ const jointUrl = function (url, str) {
|
|
|
69
69
|
* @date 2022年5月7日
|
|
70
70
|
* @param {Object} [obj] - 被转换的对象
|
|
71
71
|
**/
|
|
72
|
-
const queryParams = function
|
|
72
|
+
const queryParams = function(obj) {
|
|
73
73
|
let arry = [];
|
|
74
74
|
for (let i in obj) {
|
|
75
75
|
arry.push(i + '=' + obj[i]);
|
|
@@ -87,7 +87,7 @@ const queryParams = function (obj) {
|
|
|
87
87
|
* @param {Object} [url] - url地址
|
|
88
88
|
* @param {Object} [obj] - 被转换的对象
|
|
89
89
|
**/
|
|
90
|
-
const urlJoinParams = function
|
|
90
|
+
const urlJoinParams = function(url, obj) {
|
|
91
91
|
let arry = decodeURI(url).split('?');
|
|
92
92
|
let params = {};
|
|
93
93
|
if (arry.length > 1) {
|
|
@@ -112,7 +112,7 @@ const urlJoinParams = function (url, obj) {
|
|
|
112
112
|
* @param {Object} [arr] - 原始数组
|
|
113
113
|
* @param {String} [key] - 对象子元素的属性名
|
|
114
114
|
**/
|
|
115
|
-
const arrUnique = function
|
|
115
|
+
const arrUnique = function(arr, key) {
|
|
116
116
|
var newArr = [];
|
|
117
117
|
if (key === undefined) {
|
|
118
118
|
arr.sort();
|
|
@@ -140,7 +140,7 @@ const arrUnique = function (arr, key) {
|
|
|
140
140
|
* @date 2022年5月7日
|
|
141
141
|
* @param {Object} [obj] - 对象
|
|
142
142
|
**/
|
|
143
|
-
const isObject = function
|
|
143
|
+
const isObject = function(obj) {
|
|
144
144
|
let proto;
|
|
145
145
|
let Ctor;
|
|
146
146
|
let hasOwn = {}.hasOwnProperty;
|
|
@@ -166,7 +166,7 @@ const isObject = function (obj) {
|
|
|
166
166
|
* @date 2022年5月7日
|
|
167
167
|
* @param {Object} [obj] - 对象
|
|
168
168
|
**/
|
|
169
|
-
const isFunction = function
|
|
169
|
+
const isFunction = function(obj) {
|
|
170
170
|
return (
|
|
171
171
|
typeof obj === 'function' &&
|
|
172
172
|
typeof obj.nodeType !== 'number' &&
|
|
@@ -181,7 +181,7 @@ const isFunction = function (obj) {
|
|
|
181
181
|
* @param {Object} [target] - 被扩展的对象
|
|
182
182
|
* @param {Boolean}} [deep] - 是否深度操作
|
|
183
183
|
**/
|
|
184
|
-
const extend = function
|
|
184
|
+
const extend = function() {
|
|
185
185
|
let options;
|
|
186
186
|
let name;
|
|
187
187
|
let src;
|
|
@@ -240,7 +240,7 @@ const extend = function () {
|
|
|
240
240
|
* @author tangdaibing
|
|
241
241
|
* @date 2022年5月7日
|
|
242
242
|
**/
|
|
243
|
-
const getObjectType = function
|
|
243
|
+
const getObjectType = function(data) {
|
|
244
244
|
let type = Object.prototype.toString.call(data).toLowerCase();
|
|
245
245
|
const typeFormat = {
|
|
246
246
|
'[object string]': 'string',
|
|
@@ -262,15 +262,15 @@ const getObjectType = function (data) {
|
|
|
262
262
|
* @date 2022年5月7日
|
|
263
263
|
* @param {String} [name] - 参数名称
|
|
264
264
|
**/
|
|
265
|
-
const getParams = function
|
|
265
|
+
const getParams = function(name) {
|
|
266
266
|
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
|
|
267
267
|
var r = window.location.search
|
|
268
268
|
? decodeURI(window.location.search)
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
.substr(1)
|
|
270
|
+
.match(reg)
|
|
271
271
|
: decodeURI(window.location.hash)
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
.slice(decodeURI(window.location.hash).indexOf('?') + 1)
|
|
273
|
+
.match(reg);
|
|
274
274
|
if (r != null) {
|
|
275
275
|
return unescape(r[2]);
|
|
276
276
|
} else {
|
|
@@ -284,7 +284,7 @@ const getParams = function (name) {
|
|
|
284
284
|
* @date 2022年5月7日
|
|
285
285
|
* @param {String} [url] - js文件地址
|
|
286
286
|
**/
|
|
287
|
-
const getScript = function
|
|
287
|
+
const getScript = function(url) {
|
|
288
288
|
// eslint-disable-next-line no-undef
|
|
289
289
|
return new Promise((resolve, reject) => {
|
|
290
290
|
var xmlHttp = null;
|
|
@@ -308,7 +308,7 @@ const getScript = function (url) {
|
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
310
|
xmlHttp.send();
|
|
311
|
-
}).catch(function onRejected() {
|
|
311
|
+
}).catch(function onRejected() {});
|
|
312
312
|
};
|
|
313
313
|
/**
|
|
314
314
|
* domEval
|
|
@@ -332,7 +332,7 @@ function domEval(code) {
|
|
|
332
332
|
* @param {Object} [item] - 目标对象
|
|
333
333
|
* @param {String} [key] - 目标对象的属性名
|
|
334
334
|
**/
|
|
335
|
-
const indexOfObj = function
|
|
335
|
+
const indexOfObj = function(arry, item, key) {
|
|
336
336
|
for (var i = 0; i < arry.length; i++) {
|
|
337
337
|
if (key) {
|
|
338
338
|
if (typeof item === 'string' && arry[i][key] === item) {
|
|
@@ -357,7 +357,7 @@ const indexOfObj = function (arry, item, key) {
|
|
|
357
357
|
* @date 2022年5月7日
|
|
358
358
|
* @param {String} [el] - 文字所在的dom
|
|
359
359
|
**/
|
|
360
|
-
const overbrim = function
|
|
360
|
+
const overbrim = function(el) {
|
|
361
361
|
let w = el.offsetWidth;
|
|
362
362
|
var s = el.scrollWidth;
|
|
363
363
|
if (s > w) {
|
|
@@ -376,7 +376,7 @@ const overbrim = function (el) {
|
|
|
376
376
|
* @param {String, Array, Object} [key] - 数据的名称,array类型表示多个key保存同一个value,object类型时对象的属性名称作为key属性值作为value
|
|
377
377
|
* @param {String} [value] - 数据的值
|
|
378
378
|
**/
|
|
379
|
-
const setStorage = function
|
|
379
|
+
const setStorage = function(type, key, value) {
|
|
380
380
|
if (type === undefined || type === 'sessionStorage') {
|
|
381
381
|
if (typeof key === 'string') {
|
|
382
382
|
sessionStorage.setItem(key, value);
|
|
@@ -410,7 +410,7 @@ const setStorage = function (type, key, value) {
|
|
|
410
410
|
* @date 2022年5月7日
|
|
411
411
|
* @param {String, Array} [key] - 获取的名称
|
|
412
412
|
**/
|
|
413
|
-
const removeStorage = function
|
|
413
|
+
const removeStorage = function(key) {
|
|
414
414
|
if (Array.isArray(key)) {
|
|
415
415
|
for (let i = 0; i < key.length; i++) {
|
|
416
416
|
sessionStorage.removeItem(key[i]);
|
|
@@ -431,7 +431,7 @@ const removeStorage = function (key) {
|
|
|
431
431
|
* @date 2022年5月7日
|
|
432
432
|
* @param {String} [key] - 获取的名称
|
|
433
433
|
**/
|
|
434
|
-
const getStorage = function
|
|
434
|
+
const getStorage = function(key) {
|
|
435
435
|
if (key) {
|
|
436
436
|
let res =
|
|
437
437
|
sessionStorage.getItem(key) || localStorage.getItem(key) || window[key];
|
|
@@ -464,7 +464,7 @@ const getStorage = function (key) {
|
|
|
464
464
|
}
|
|
465
465
|
return defaults;
|
|
466
466
|
};
|
|
467
|
-
const getValues = function
|
|
467
|
+
const getValues = function(obj, flag) {
|
|
468
468
|
let val = {};
|
|
469
469
|
obj.forEach(items => {
|
|
470
470
|
if (items.contents) {
|
|
@@ -545,7 +545,7 @@ const loading = ($loading, res) => {
|
|
|
545
545
|
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
546
546
|
* @param {String} [fmt] - 格式
|
|
547
547
|
**/
|
|
548
|
-
const formatDate = function
|
|
548
|
+
const formatDate = function(date, fmt) {
|
|
549
549
|
let obj;
|
|
550
550
|
if (date) {
|
|
551
551
|
obj = new Date(date);
|
|
@@ -586,7 +586,7 @@ const formatDate = function (date, fmt) {
|
|
|
586
586
|
* @date 2022年5月7日
|
|
587
587
|
* @param {String, Number} [date] - 时间字符串或时间戳
|
|
588
588
|
**/
|
|
589
|
-
const timeFrame = function
|
|
589
|
+
const timeFrame = function(date) {
|
|
590
590
|
let obj;
|
|
591
591
|
if (date) {
|
|
592
592
|
obj = new Date(date);
|
|
@@ -598,8 +598,8 @@ const timeFrame = function (date) {
|
|
|
598
598
|
h < 12
|
|
599
599
|
? (period = '上午好!')
|
|
600
600
|
: h < 18
|
|
601
|
-
|
|
602
|
-
|
|
601
|
+
? (period = '下午好!')
|
|
602
|
+
: (period = '晚上好!');
|
|
603
603
|
return period;
|
|
604
604
|
};
|
|
605
605
|
/**
|
|
@@ -611,7 +611,7 @@ const timeFrame = function (date) {
|
|
|
611
611
|
* @param {String} [attr] - 样式属性名
|
|
612
612
|
**/
|
|
613
613
|
|
|
614
|
-
const getStyle = function
|
|
614
|
+
const getStyle = function(dom, attr) {
|
|
615
615
|
if (dom.style[attr]) {
|
|
616
616
|
return dom.style[attr];
|
|
617
617
|
}
|
|
@@ -629,7 +629,7 @@ const getStyle = function (dom, attr) {
|
|
|
629
629
|
* @param {String} [url] - url地址
|
|
630
630
|
**/
|
|
631
631
|
|
|
632
|
-
const handlerUrl = function
|
|
632
|
+
const handlerUrl = function(url, host) {
|
|
633
633
|
var arry = url.split('?');
|
|
634
634
|
if (arry.length > 1) {
|
|
635
635
|
if (arry[1].indexOf('_tt') > -1) {
|
|
@@ -658,7 +658,7 @@ const handlerUrl = function (url, host) {
|
|
|
658
658
|
* @date 2022年5月7日
|
|
659
659
|
* @param {string} [$color] - 颜色值
|
|
660
660
|
**/
|
|
661
|
-
const getRgb = function
|
|
661
|
+
const getRgb = function($color) {
|
|
662
662
|
let rgb = [];
|
|
663
663
|
// 16进制颜色值的正则
|
|
664
664
|
let reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
@@ -690,7 +690,7 @@ const getRgb = function ($color) {
|
|
|
690
690
|
* @date 2022年5月7日
|
|
691
691
|
* @param {string} [$color] - 颜色值
|
|
692
692
|
**/
|
|
693
|
-
const rgbToHsv = function
|
|
693
|
+
const rgbToHsv = function($color) {
|
|
694
694
|
let rgb = getRgb($color);
|
|
695
695
|
let $red = rgb[0];
|
|
696
696
|
let $green = rgb[1];
|
|
@@ -842,7 +842,7 @@ function getColor($color, $n) {
|
|
|
842
842
|
* @param {string} [$color2] - 颜色值
|
|
843
843
|
* @param {string} [$n] - 百分比 0~1
|
|
844
844
|
**/
|
|
845
|
-
const mixColor = function
|
|
845
|
+
const mixColor = function($color1, $color2, $n) {
|
|
846
846
|
const rgb1 = getRgb($color1);
|
|
847
847
|
const rgb2 = getRgb($color2);
|
|
848
848
|
const r = rgb1[0] * $n + rgb2[0] * (1 - $n);
|
|
@@ -857,7 +857,7 @@ const mixColor = function ($color1, $color2, $n) {
|
|
|
857
857
|
* @date 2022年5月7日
|
|
858
858
|
* @param {string} [$color] - 颜色值
|
|
859
859
|
**/
|
|
860
|
-
const updateTheme = function
|
|
860
|
+
const updateTheme = function($color, send) {
|
|
861
861
|
$color = $color ? $color : '#409eff';
|
|
862
862
|
if (send === undefined) {
|
|
863
863
|
send = true;
|
|
@@ -889,7 +889,7 @@ const updateTheme = function ($color, send) {
|
|
|
889
889
|
* @param {object} [data] - 数据---其中type必须表示操作类型
|
|
890
890
|
* @param {string} [url] - 指定的消息发送URI地址
|
|
891
891
|
**/
|
|
892
|
-
const sendMessage = function
|
|
892
|
+
const sendMessage = function({ data = {}, url }) {
|
|
893
893
|
const iframes = document.getElementsByTagName('iframe');
|
|
894
894
|
for (let i = 0; i < iframes.length; i++) {
|
|
895
895
|
if (url !== undefined) {
|
|
@@ -912,8 +912,8 @@ const sendMessage = function ({ data = {}, url }) {
|
|
|
912
912
|
* @param {string} [url] - 消息源的 URI
|
|
913
913
|
* @param {function} [callback] - 回调函数
|
|
914
914
|
**/
|
|
915
|
-
const receiveMessage = function
|
|
916
|
-
window.addEventListener('message', function
|
|
915
|
+
const receiveMessage = function({ data = {}, url, callback }) {
|
|
916
|
+
window.addEventListener('message', function(e) {
|
|
917
917
|
if (url !== undefined) {
|
|
918
918
|
if (e.origin !== url) {
|
|
919
919
|
// 验证消息来源地址
|
|
@@ -931,7 +931,7 @@ const receiveMessage = function ({ data = {}, url, callback }) {
|
|
|
931
931
|
* @date 2022年5月7日
|
|
932
932
|
* @param {string} [type] - 类型
|
|
933
933
|
**/
|
|
934
|
-
const getTypeName = function
|
|
934
|
+
const getTypeName = function(type) {
|
|
935
935
|
let typeName = '';
|
|
936
936
|
const sysorgname = getStorage('sysorgname');
|
|
937
937
|
const sysdepname = getStorage('sysdepname');
|
|
@@ -1009,7 +1009,7 @@ const getTypeName = function (type) {
|
|
|
1009
1009
|
* @param {string、number} [num] - 数字或字符串型数字
|
|
1010
1010
|
* @param {number} [precision] - 需要的小数位数
|
|
1011
1011
|
**/
|
|
1012
|
-
const replenish = function
|
|
1012
|
+
const replenish = function(num, precision) {
|
|
1013
1013
|
if (num && precision && precision > 0) {
|
|
1014
1014
|
let power = Math.pow(10, precision);
|
|
1015
1015
|
let res = num === 'string' ? Number(num) : num;
|
|
@@ -1035,7 +1035,7 @@ const replenish = function (num, precision) {
|
|
|
1035
1035
|
* @param {callback} [function] - 回调函数
|
|
1036
1036
|
* @param {val} [string] - 被验证的原值
|
|
1037
1037
|
**/
|
|
1038
|
-
const identical = function
|
|
1038
|
+
const identical = function(value, callback, val) {
|
|
1039
1039
|
if (value === '' || value === null || value === undefined) {
|
|
1040
1040
|
if (val === '' || val === null || val === undefined) {
|
|
1041
1041
|
callback();
|
|
@@ -1059,7 +1059,7 @@ const identical = function (value, callback, val) {
|
|
|
1059
1059
|
* @param {name} [string] - 导出文件名
|
|
1060
1060
|
* @param {numbers} [boolean] - 序号
|
|
1061
1061
|
**/
|
|
1062
|
-
const exportXls = function
|
|
1062
|
+
const exportXls = function({ thead = [], data = [], name, numbers }) {
|
|
1063
1063
|
let tbody = '';
|
|
1064
1064
|
let aligns = [];
|
|
1065
1065
|
let fields = [];
|
|
@@ -1072,7 +1072,9 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1072
1072
|
const tr = thead[i];
|
|
1073
1073
|
for (let x = 0; x < tr.length; x++) {
|
|
1074
1074
|
const td = tr[x];
|
|
1075
|
-
tbody += `<th rowspan="${td.rowspan}" colspan="${td.colspan}" align="${
|
|
1075
|
+
tbody += `<th rowspan="${td.rowspan}" colspan="${td.colspan}" align="${
|
|
1076
|
+
td.align
|
|
1077
|
+
}">${td.label}</th>`;
|
|
1076
1078
|
if (td.property) {
|
|
1077
1079
|
fields.push(td.property);
|
|
1078
1080
|
aligns.push(td.align);
|
|
@@ -1091,7 +1093,10 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1091
1093
|
name = 'table_' + new Date().getTime();
|
|
1092
1094
|
}
|
|
1093
1095
|
var uri = 'data:application/vnd.ms-excel;base64,';
|
|
1094
|
-
var template =
|
|
1096
|
+
var template =
|
|
1097
|
+
'<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:@">' +
|
|
1098
|
+
tbody +
|
|
1099
|
+
'</table></body></html>';
|
|
1095
1100
|
alink.href = uri + window.btoa(unescape(encodeURIComponent(template)));
|
|
1096
1101
|
alink.download = name + '.xls';
|
|
1097
1102
|
document.body.appendChild(alink);
|
|
@@ -1111,8 +1116,15 @@ const exportXls = function ({ thead = [], data = [], name, numbers }) {
|
|
|
1111
1116
|
* ```
|
|
1112
1117
|
* @return {Array} ['#e6f9ff','#0e91ef',...]
|
|
1113
1118
|
*/
|
|
1114
|
-
const handlerGetThemeCluster = function
|
|
1115
|
-
|
|
1119
|
+
const handlerGetThemeCluster = function(
|
|
1120
|
+
color,
|
|
1121
|
+
mode = 'light',
|
|
1122
|
+
backgroundColor = '#000000'
|
|
1123
|
+
) {
|
|
1124
|
+
return generate(
|
|
1125
|
+
color,
|
|
1126
|
+
mode === 'dark' ? { theme: 'dark', backgroundColor } : {}
|
|
1127
|
+
);
|
|
1116
1128
|
};
|
|
1117
1129
|
|
|
1118
1130
|
/**
|
|
@@ -1181,7 +1193,7 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1181
1193
|
* @author liufan
|
|
1182
1194
|
* @param {Object} data -链接参数
|
|
1183
1195
|
*/
|
|
1184
|
-
|
|
1196
|
+
const JSCallNativeOpenUrl = function(data) {
|
|
1185
1197
|
let u = navigator.userAgent;
|
|
1186
1198
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1187
1199
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
@@ -1198,7 +1210,7 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1198
1210
|
* @author liufan
|
|
1199
1211
|
* @param {Object} data 正文参数
|
|
1200
1212
|
*/
|
|
1201
|
-
|
|
1213
|
+
const openMainBodyFile = function(data) {
|
|
1202
1214
|
let u = navigator.userAgent;
|
|
1203
1215
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1204
1216
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
@@ -1215,45 +1227,62 @@ const JSCallNativeShowNaviBar = function(res) {
|
|
|
1215
1227
|
* @author liufan
|
|
1216
1228
|
* @param {String} url 调整地址
|
|
1217
1229
|
*/
|
|
1218
|
-
|
|
1230
|
+
const openUrl = function(url) {
|
|
1231
|
+
let u = navigator.userAgent;
|
|
1232
|
+
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1233
|
+
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1234
|
+
if (isAndroid) {
|
|
1235
|
+
window.open(url);
|
|
1236
|
+
} else if (isiOS) {
|
|
1237
|
+
window.location.href = url;
|
|
1238
|
+
}
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* openAttachment
|
|
1242
|
+
* @desc:原生app通用打开附件
|
|
1243
|
+
* @date 2023年3月2日
|
|
1244
|
+
* @author liufan
|
|
1245
|
+
* @param {Object} data -附件信息
|
|
1246
|
+
*/
|
|
1247
|
+
const openAttachment = function(data) {
|
|
1248
|
+
if (window.isCh) {
|
|
1249
|
+
window.uexPDF.openOther(data);
|
|
1250
|
+
} else {
|
|
1219
1251
|
let u = navigator.userAgent;
|
|
1220
1252
|
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1221
1253
|
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1222
1254
|
if (isAndroid) {
|
|
1223
|
-
window.
|
|
1255
|
+
window.AndroidWebView.jsOpenAccessory(JSON.stringify(data));
|
|
1224
1256
|
} else if (isiOS) {
|
|
1225
|
-
window.
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
1228
|
-
/**
|
|
1229
|
-
* openAttachment
|
|
1230
|
-
* @desc:原生app通用打开附件
|
|
1231
|
-
* @date 2023年3月2日
|
|
1232
|
-
* @author liufan
|
|
1233
|
-
* @param {Object} data -附件信息
|
|
1234
|
-
*/
|
|
1235
|
-
const openAttachment = function(data) {
|
|
1236
|
-
if (window.isCh) {
|
|
1237
|
-
window.uexPDF.openOther(data);
|
|
1238
|
-
} else {
|
|
1239
|
-
let u = navigator.userAgent;
|
|
1240
|
-
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1241
|
-
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1242
|
-
if (isAndroid) {
|
|
1243
|
-
window.AndroidWebView.jsOpenAccessory(JSON.stringify(data));
|
|
1244
|
-
} else if (isiOS) {
|
|
1245
|
-
window.webkit.messageHandlers.jsOpenAccessory.postMessage(data);
|
|
1246
|
-
}
|
|
1257
|
+
window.webkit.messageHandlers.jsOpenAccessory.postMessage(data);
|
|
1247
1258
|
}
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
const
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* jsGoPayrollIndexAct
|
|
1263
|
+
* @desc:原生app打开工资条页面
|
|
1264
|
+
* @date 2024年1月11日
|
|
1265
|
+
* @author liufan
|
|
1266
|
+
*/
|
|
1267
|
+
const jsGoPayrollIndexAct = function(id) {
|
|
1268
|
+
let u = navigator.userAgent;
|
|
1269
|
+
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; // android终端
|
|
1270
|
+
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
|
|
1271
|
+
if (isAndroid) {
|
|
1272
|
+
window.AndroidWebView.jsGoPayrollIndexAct(id);
|
|
1273
|
+
} else if (isiOS) {
|
|
1274
|
+
window.webkit.messageHandlers.jsGoPayrollIndexAct.postMessage(id);
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* deepClone
|
|
1280
|
+
* @desc:深拷贝
|
|
1281
|
+
* @date 2023年3月2日
|
|
1282
|
+
* @author liufan
|
|
1283
|
+
* @param {Object、Array} target
|
|
1284
|
+
*/
|
|
1285
|
+
const deepClone = target => {
|
|
1257
1286
|
let result;
|
|
1258
1287
|
// 如果当前需要深拷贝的是一个对象的话
|
|
1259
1288
|
if (typeof target === 'object') {
|
|
@@ -1299,6 +1328,21 @@ const exclAttribute = ({ attrs = 'value', data }) => {
|
|
|
1299
1328
|
}
|
|
1300
1329
|
return obj;
|
|
1301
1330
|
};
|
|
1331
|
+
/**
|
|
1332
|
+
* 获取UUID
|
|
1333
|
+
* @desc:generateUUID
|
|
1334
|
+
* @author liufan
|
|
1335
|
+
* @date 2024年1月12日
|
|
1336
|
+
**/
|
|
1337
|
+
const generateUUID = () => {
|
|
1338
|
+
var d = new Date().getTime();
|
|
1339
|
+
var uuid = 'xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
1340
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
|
1341
|
+
d = Math.floor(d / 16);
|
|
1342
|
+
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
|
|
1343
|
+
});
|
|
1344
|
+
return uuid;
|
|
1345
|
+
};
|
|
1302
1346
|
export default {
|
|
1303
1347
|
esEncrypt,
|
|
1304
1348
|
esDecode,
|
|
@@ -1342,5 +1386,7 @@ export default {
|
|
|
1342
1386
|
getTypeName,
|
|
1343
1387
|
replenish,
|
|
1344
1388
|
identical,
|
|
1345
|
-
|
|
1389
|
+
jsGoPayrollIndexAct,
|
|
1390
|
+
exportXls,
|
|
1391
|
+
generateUUID
|
|
1346
1392
|
};
|