eoss-mobiles 0.4.2 → 0.4.4
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 +206 -2
- package/lib/eoss-mobile.common.js +1213 -926
- package/lib/flow-btn.js +206 -2
- package/lib/flow-list.js +206 -2
- package/lib/flow.js +214 -10
- package/lib/form.js +957 -874
- package/lib/index.js +1 -1
- package/lib/picker.js +206 -2
- package/lib/radio.js +211 -7
- package/lib/retrial-auth.js +206 -2
- package/lib/selector.js +234 -30
- package/lib/table-column.js +206 -2
- package/lib/table.js +206 -2
- package/lib/theme-chalk/fonts/iconfont.scss +98 -98
- package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
- package/lib/uploader.js +206 -2
- package/lib/utils/util.js +206 -2
- package/package.json +1 -1
- package/packages/action-sheet/index.js +5 -5
- package/packages/action-sheet/src/main.vue +32 -32
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +15 -15
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +80 -80
- package/packages/calendar/index.js +5 -5
- package/packages/calendar/src/main.vue +34 -34
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +39 -39
- package/packages/cell/index.js +5 -5
- package/packages/cell/src/main.vue +77 -77
- package/packages/checkbox/index.js +5 -5
- package/packages/checkbox/src/main.vue +232 -232
- package/packages/circle/index.js +5 -5
- package/packages/circle/src/main.vue +27 -27
- package/packages/count-down/index.js +5 -5
- package/packages/count-down/src/main.vue +27 -27
- package/packages/date/index.js +5 -5
- package/packages/date/src/date-time.vue +290 -290
- package/packages/date/src/main.vue +401 -401
- package/packages/empty/index.js +5 -5
- package/packages/empty/src/main.vue +16 -16
- package/packages/esign/index.js +5 -5
- package/packages/esign/src/main.vue +144 -144
- package/packages/field/index.js +5 -5
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/components/Circulate.vue +595 -595
- package/packages/flow/src/components/Handle.vue +2404 -2404
- package/packages/flow/src/components/Message.vue +208 -208
- package/packages/flow/src/components/ProcessSettings.vue +342 -342
- package/packages/flow/src/components/supervise.vue +139 -139
- package/packages/flow/src/flowMix.js +288 -288
- package/packages/flow/src/main.vue +116 -116
- package/packages/flow-btn/index.js +5 -5
- package/packages/flow-btn/src/main.vue +494 -494
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +248 -248
- package/packages/form/index.js +5 -5
- package/packages/form/src/CustomCard.vue +201 -201
- package/packages/form/src/main.vue +369 -351
- package/packages/grid/index.js +5 -5
- package/packages/grid/src/main.vue +486 -486
- package/packages/grid-item/index.js +5 -5
- package/packages/grid-item/src/main.vue +16 -16
- package/packages/image/index.js +5 -5
- package/packages/image/src/main.vue +12 -12
- package/packages/image-preview/index.js +5 -5
- package/packages/list/index.js +5 -5
- package/packages/list/src/main.vue +32 -32
- package/packages/loading/index.js +5 -5
- package/packages/loading/src/main.vue +19 -19
- package/packages/nav-bar/index.js +5 -5
- package/packages/nav-bar/src/main.vue +24 -24
- package/packages/notice-bar/index.js +5 -5
- package/packages/notice-bar/src/main.vue +15 -15
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +73 -73
- package/packages/picker/index.js +5 -5
- package/packages/popover/index.js +5 -5
- package/packages/popover/src/main.vue +32 -32
- package/packages/popup/index.js +5 -5
- package/packages/popup/src/main.vue +27 -27
- package/packages/pull-refresh/index.js +5 -5
- package/packages/pull-refresh/src/main.vue +31 -31
- package/packages/radio/index.js +5 -5
- package/packages/radio/src/main.vue +179 -179
- package/packages/rate/index.js +5 -5
- package/packages/rate/src/main.vue +26 -26
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +257 -257
- package/packages/search/index.js +5 -5
- package/packages/search/src/main.vue +39 -39
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +186 -186
- package/packages/selector/src/selector-tree.vue +1117 -1117
- package/packages/selector/src/tree.vue +405 -405
- package/packages/skeleton/index.js +5 -5
- package/packages/skeleton/src/main.vue +17 -17
- package/packages/stepper/index.js +5 -5
- package/packages/stepper/src/main.vue +25 -25
- package/packages/swipe/index.js +5 -5
- package/packages/swipe/src/main.vue +42 -42
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +38 -38
- package/packages/tab/index.js +5 -5
- package/packages/tab/src/main.vue +16 -16
- package/packages/table/index.js +5 -5
- package/packages/table/src/main.vue +1006 -1006
- package/packages/table-column/index.js +5 -5
- package/packages/table-column/src/main.vue +931 -931
- package/packages/table-column/src/mixins/table.js +12 -12
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +34 -34
- package/packages/tag/index.js +5 -5
- package/packages/tag/src/main.vue +16 -16
- package/packages/theme-chalk/gulpfile.js +25 -0
- package/packages/theme-chalk/src/base.scss +195 -195
- package/packages/theme-chalk/src/button-group.scss +25 -25
- package/packages/theme-chalk/src/button.scss +2 -2
- package/packages/theme-chalk/src/calendar.scss +11 -11
- package/packages/theme-chalk/src/cascader.scss +11 -11
- package/packages/theme-chalk/src/cell.scss +14 -14
- package/packages/theme-chalk/src/checkbox.scss +9 -9
- package/packages/theme-chalk/src/circle.scss +6 -6
- package/packages/theme-chalk/src/common/var.scss +1525 -1525
- package/packages/theme-chalk/src/esign.scss +51 -51
- package/packages/theme-chalk/src/field.scss +98 -98
- package/packages/theme-chalk/src/flow-btn.scss +99 -99
- package/packages/theme-chalk/src/flow-list.scss +122 -122
- package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
- package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
- package/packages/theme-chalk/src/grid-item.scss +16 -16
- package/packages/theme-chalk/src/grid.scss +46 -46
- package/packages/theme-chalk/src/icon.scss +1661 -1661
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/navbar.scss +5 -5
- package/packages/theme-chalk/src/pagination.scss +12 -12
- package/packages/theme-chalk/src/picker.scss +31 -31
- package/packages/theme-chalk/src/radio.scss +6 -6
- package/packages/theme-chalk/src/retrial-auth.scss +28 -28
- package/packages/theme-chalk/src/selector.scss +247 -247
- package/packages/theme-chalk/src/stepper.scss +9 -9
- package/packages/theme-chalk/src/switch.scss +5 -5
- package/packages/theme-chalk/src/table.scss +86 -86
- package/packages/theme-chalk/src/tabs.scss +31 -31
- package/packages/theme-chalk/src/tag.scss +12 -12
- package/packages/theme-chalk/src/theme.scss +1 -1
- package/packages/theme-chalk/src/tree.scss +127 -127
- package/packages/uploader/index.js +5 -5
- package/src/config/api.js +190 -190
- package/src/index.js +1 -1
- package/src/utils/axios.js +217 -217
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +106 -106
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/src/utils/util.js +287 -66
- package/CHANGELOG.md +0 -95
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +0 -1
- package/packages/theme-chalk/lib/button-group.css +0 -1
- package/packages/theme-chalk/lib/button.css +0 -1
- package/packages/theme-chalk/lib/calendar.css +0 -1
- package/packages/theme-chalk/lib/cascader.css +0 -1
- package/packages/theme-chalk/lib/cell.css +0 -1
- package/packages/theme-chalk/lib/checkbox.css +0 -1
- package/packages/theme-chalk/lib/circle.css +0 -1
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/esign.css +0 -1
- package/packages/theme-chalk/lib/field.css +0 -1
- package/packages/theme-chalk/lib/flow-btn.css +0 -1
- package/packages/theme-chalk/lib/flow-list-task-read.css +0 -1
- package/packages/theme-chalk/lib/flow-list.css +0 -1
- package/packages/theme-chalk/lib/flow.css +0 -1
- package/packages/theme-chalk/lib/fonts/iconfont.scss +0 -98
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont1.scss +0 -90
- package/packages/theme-chalk/lib/form.css +0 -1
- package/packages/theme-chalk/lib/grid-item.css +0 -1
- package/packages/theme-chalk/lib/grid.css +0 -1
- package/packages/theme-chalk/lib/icon.css +0 -1
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/image.css +0 -0
- package/packages/theme-chalk/lib/index.css +0 -1
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +0 -1
- package/packages/theme-chalk/lib/notice-bar.css +0 -0
- package/packages/theme-chalk/lib/pagination.css +0 -1
- package/packages/theme-chalk/lib/picker.css +0 -1
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/pull-refresh.css +0 -0
- package/packages/theme-chalk/lib/radio.css +0 -1
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/retrial-auth.css +0 -1
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +0 -1
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +0 -1
- package/packages/theme-chalk/lib/swipe.css +0 -0
- package/packages/theme-chalk/lib/switch.css +0 -1
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +0 -1
- package/packages/theme-chalk/lib/tabs.css +0 -1
- package/packages/theme-chalk/lib/tag.css +0 -1
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +0 -1
- package/packages/theme-chalk/lib/uploader.css +0 -0
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: "iconfont"; /* Project id 4360523 */
|
|
3
|
-
src: url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.woff2?t=1704791048889') format('woff2'),
|
|
4
|
-
url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.woff?t=1704791048889') format('woff'),
|
|
5
|
-
url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.ttf?t=1704791048889') format('truetype');
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.iconfont {
|
|
9
|
-
font-family: "iconfont" !important;
|
|
10
|
-
font-size: 16px;
|
|
11
|
-
font-style: normal;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.icon-em-more:before {
|
|
17
|
-
content: "\e646";
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.icon-youjiantou:before {
|
|
21
|
-
content: "\e622";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.icon-shoucang:before {
|
|
25
|
-
content: "\e600";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.icon-ziguanshujufuwu:before {
|
|
29
|
-
content: "\e618";
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.icon-fuwenbenkuang:before {
|
|
33
|
-
content: "\e66f";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.icon-gongdanguanlian:before {
|
|
37
|
-
content: "\e66d";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.icon-riqi_rili:before {
|
|
41
|
-
content: "\e648";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.icon-fuwenben:before {
|
|
45
|
-
content: "\e718";
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.icon-a-gaizhang3:before {
|
|
49
|
-
content: "\eba4";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.icon-quan:before {
|
|
53
|
-
content: "\e63a";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.icon-gou:before {
|
|
57
|
-
content: "\e8bd";
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.icon-fujian:before {
|
|
61
|
-
content: "\e651";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.icon-ziyuan:before {
|
|
65
|
-
content: "\e60d";
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.icon-duoxuanxuanzhong:before {
|
|
69
|
-
content: "\e62c";
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.icon-saoma:before {
|
|
73
|
-
content: "\e621";
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.icon-jiayonghu:before {
|
|
77
|
-
content: "\e617";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.icon-bumenguanli:before {
|
|
81
|
-
content: "\e60c";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.icon-shuzi:before {
|
|
85
|
-
content: "\e640";
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.icon-dingwei:before {
|
|
89
|
-
content: "\ee33";
|
|
90
|
-
}
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont"; /* Project id 4360523 */
|
|
3
|
+
src: url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.woff2?t=1704791048889') format('woff2'),
|
|
4
|
+
url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.woff?t=1704791048889') format('woff'),
|
|
5
|
+
url('//at.alicdn.com/t/c/font_4360523_ph4qmmcd8ze.ttf?t=1704791048889') format('truetype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iconfont {
|
|
9
|
+
font-family: "iconfont" !important;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
font-style: normal;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.icon-em-more:before {
|
|
17
|
+
content: "\e646";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.icon-youjiantou:before {
|
|
21
|
+
content: "\e622";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.icon-shoucang:before {
|
|
25
|
+
content: "\e600";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.icon-ziguanshujufuwu:before {
|
|
29
|
+
content: "\e618";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.icon-fuwenbenkuang:before {
|
|
33
|
+
content: "\e66f";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.icon-gongdanguanlian:before {
|
|
37
|
+
content: "\e66d";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.icon-riqi_rili:before {
|
|
41
|
+
content: "\e648";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.icon-fuwenben:before {
|
|
45
|
+
content: "\e718";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.icon-a-gaizhang3:before {
|
|
49
|
+
content: "\eba4";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.icon-quan:before {
|
|
53
|
+
content: "\e63a";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.icon-gou:before {
|
|
57
|
+
content: "\e8bd";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.icon-fujian:before {
|
|
61
|
+
content: "\e651";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.icon-ziyuan:before {
|
|
65
|
+
content: "\e60d";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.icon-duoxuanxuanzhong:before {
|
|
69
|
+
content: "\e62c";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.icon-saoma:before {
|
|
73
|
+
content: "\e621";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.icon-jiayonghu:before {
|
|
77
|
+
content: "\e617";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.icon-bumenguanli:before {
|
|
81
|
+
content: "\e60c";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.icon-shuzi:before {
|
|
85
|
+
content: "\e640";
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.icon-dingwei:before {
|
|
89
|
+
content: "\ee33";
|
|
90
|
+
}
|
package/lib/uploader.js
CHANGED
|
@@ -1456,8 +1456,11 @@ var toFunction = function toFunction(str) {
|
|
|
1456
1456
|
if (str.indexOf('=>') > -1) {
|
|
1457
1457
|
var renders = str.split('=>');
|
|
1458
1458
|
var args = renders[0].replace('(', '').replace(')', '').split(',');
|
|
1459
|
+
var fnStr = renders[1].trim()
|
|
1459
1460
|
// eslint-disable-next-line no-control-regex
|
|
1460
|
-
|
|
1461
|
+
.replace(new RegExp('\n', 'gm'), '')
|
|
1462
|
+
// eslint-disable-next-line no-control-regex
|
|
1463
|
+
.replace(new RegExp('\t', 'gm'), '').replace(new RegExp('^\\{+|\\}+$', 'g'), '');
|
|
1461
1464
|
var fn = void 0;
|
|
1462
1465
|
if (args.length) {
|
|
1463
1466
|
fn = new (Function.prototype.bind.apply(Function, [null].concat(args, [fnStr])))();
|
|
@@ -1470,6 +1473,200 @@ var toFunction = function toFunction(str) {
|
|
|
1470
1473
|
return eval(str);
|
|
1471
1474
|
}
|
|
1472
1475
|
};
|
|
1476
|
+
|
|
1477
|
+
/**
|
|
1478
|
+
* calculateNetworkDays
|
|
1479
|
+
* @desc 工作日天数
|
|
1480
|
+
* @desc 计算两个日期之间的工作日天数,可以排除周末和指定的假期
|
|
1481
|
+
* @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
|
|
1482
|
+
* @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
|
|
1483
|
+
* @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
|
|
1484
|
+
* @return {number} 工作日天数
|
|
1485
|
+
**/
|
|
1486
|
+
var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
|
|
1487
|
+
var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1488
|
+
|
|
1489
|
+
if (typeof start_date !== 'string' || typeof end_date !== 'string') {
|
|
1490
|
+
throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
var startDateObj = new Date(start_date);
|
|
1494
|
+
var endDateObj = new Date(end_date);
|
|
1495
|
+
|
|
1496
|
+
if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
|
|
1497
|
+
throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
if (startDateObj > endDateObj) {
|
|
1501
|
+
throw new Error('Start date should be earlier than or equal to end date.');
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
var workdays = 0;
|
|
1505
|
+
|
|
1506
|
+
// Iterate through each day in the date range
|
|
1507
|
+
|
|
1508
|
+
var _loop = function _loop(currentDate) {
|
|
1509
|
+
// Check if the current day is a weekend (Saturday or Sunday)
|
|
1510
|
+
var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
|
|
1511
|
+
|
|
1512
|
+
// Check if the current day is a holiday
|
|
1513
|
+
var isHoliday = holidays.some(function (holiday) {
|
|
1514
|
+
var holidayDate = new Date(holiday);
|
|
1515
|
+
return currentDate.toDateString() === holidayDate.toDateString();
|
|
1516
|
+
});
|
|
1517
|
+
|
|
1518
|
+
// If it's a workday (not a weekend or holiday), increment the workdays count
|
|
1519
|
+
if (!isWeekend && !isHoliday) {
|
|
1520
|
+
workdays++;
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
|
|
1525
|
+
_loop(currentDate);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
return workdays;
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
* chunkToChinese
|
|
1533
|
+
* @desc 将四位数的整数转换为中文大写
|
|
1534
|
+
* @param {number} chunk - 数字
|
|
1535
|
+
**/
|
|
1536
|
+
function chunkToChinese(chunk) {
|
|
1537
|
+
var numberToChinese = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
|
|
1538
|
+
var capitalDigits = ['', '拾', '佰', '仟'];
|
|
1539
|
+
|
|
1540
|
+
var result = '';
|
|
1541
|
+
var digitIndex = 0;
|
|
1542
|
+
|
|
1543
|
+
while (chunk > 0) {
|
|
1544
|
+
var digit = chunk % 10;
|
|
1545
|
+
if (digit > 0) {
|
|
1546
|
+
result = numberToChinese[digit] + capitalDigits[digitIndex] + result;
|
|
1547
|
+
} else {
|
|
1548
|
+
// 当前数字是零,需要判断是否需要添加零
|
|
1549
|
+
if (result.charAt(0) !== '零') {
|
|
1550
|
+
result = '零' + result;
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
chunk = Math.floor(chunk / 10);
|
|
1554
|
+
digitIndex++;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
return result;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* concatenate
|
|
1562
|
+
* @desc 指定连接符合并文本
|
|
1563
|
+
* @desc 使用指定的连接符合并文本字符串
|
|
1564
|
+
* @author SuTao
|
|
1565
|
+
* @date 2023年12月14日
|
|
1566
|
+
* @param {string} separator - 指定的连接符
|
|
1567
|
+
* @param {...string} strings - 多个文本字符串
|
|
1568
|
+
* @return {string} 合并后的字符串
|
|
1569
|
+
**/
|
|
1570
|
+
var concatenate = function concatenate(separator) {
|
|
1571
|
+
for (var _len = arguments.length, strings = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1572
|
+
strings[_key - 1] = arguments[_key];
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
if (typeof separator !== 'string' || !strings.every(function (str) {
|
|
1576
|
+
return typeof str === 'string';
|
|
1577
|
+
})) {
|
|
1578
|
+
throw new Error('Invalid input. Please provide a valid separator and valid strings.');
|
|
1579
|
+
}
|
|
1580
|
+
return strings.join(separator);
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
* dateAddDays
|
|
1585
|
+
* @desc 加减日期天数
|
|
1586
|
+
* @desc 在给定的日期上加上或减去指定的天数
|
|
1587
|
+
* @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
|
|
1588
|
+
* @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
|
|
1589
|
+
* @return {string} 计算后的日期字符串
|
|
1590
|
+
**/
|
|
1591
|
+
var dateAddDays = function dateAddDays(start_date, days) {
|
|
1592
|
+
if (typeof start_date !== 'string' || !Number.isInteger(days)) {
|
|
1593
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days.");
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
var startDateObj = new Date(start_date);
|
|
1597
|
+
if (isNaN(startDateObj.getTime())) {
|
|
1598
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
var resultDateObj = new Date(startDateObj);
|
|
1602
|
+
resultDateObj.setDate(resultDateObj.getDate() + days);
|
|
1603
|
+
|
|
1604
|
+
var resultYear = resultDateObj.getFullYear();
|
|
1605
|
+
var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
|
|
1606
|
+
var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
|
|
1607
|
+
|
|
1608
|
+
return resultYear + '-' + resultMonth + '-' + resultDay;
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* dateDiff
|
|
1613
|
+
* @desc 计算两个日期之间的差距
|
|
1614
|
+
* @author SuTao
|
|
1615
|
+
* @date 2023年12月14日
|
|
1616
|
+
* @param {String} start_date - 起始日期字符串
|
|
1617
|
+
* @param {String} end_date - 结束日期字符串
|
|
1618
|
+
* @param {String} [unit] - 计算的时间单位 ("y", "M", "d", "h", "m", "s")
|
|
1619
|
+
* @return {Number} 两个日期之间的差距
|
|
1620
|
+
**/
|
|
1621
|
+
var dateDiff = function dateDiff(start_date, end_date, unit) {
|
|
1622
|
+
// Assuming date strings are in "YYYY-MM-DD" format
|
|
1623
|
+
var startDate = new Date(start_date);
|
|
1624
|
+
var endDate = new Date(end_date);
|
|
1625
|
+
|
|
1626
|
+
// Calculate the difference in milliseconds
|
|
1627
|
+
var timeDifference = endDate - startDate;
|
|
1628
|
+
|
|
1629
|
+
// Convert milliseconds to the specified unit
|
|
1630
|
+
unit = unit || 'd'; // Set default unit to "d"
|
|
1631
|
+
|
|
1632
|
+
switch (unit) {
|
|
1633
|
+
case 'y':
|
|
1634
|
+
return endDate.getFullYear() - startDate.getFullYear();
|
|
1635
|
+
case 'M':
|
|
1636
|
+
return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
|
|
1637
|
+
case 'd':
|
|
1638
|
+
return Math.floor(timeDifference / (1000 * 60 * 60 * 24));
|
|
1639
|
+
case 'h':
|
|
1640
|
+
return Math.floor(timeDifference / (1000 * 60 * 60));
|
|
1641
|
+
case 'm':
|
|
1642
|
+
return Math.floor(timeDifference / (1000 * 60));
|
|
1643
|
+
case 's':
|
|
1644
|
+
return Math.floor(timeDifference / 1000);
|
|
1645
|
+
default:
|
|
1646
|
+
throw new Error("Invalid unit. Supported units are 'y', 'M', 'd', 'h', 'm', 's'.");
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* dayOfMonth
|
|
1652
|
+
* @desc 当月第几天
|
|
1653
|
+
* @desc 返回给定日期是所在月的第几天
|
|
1654
|
+
* @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
|
|
1655
|
+
* @return {number} 当月的第几天
|
|
1656
|
+
**/
|
|
1657
|
+
var dayOfMonth = function dayOfMonth(date) {
|
|
1658
|
+
if (typeof date !== 'string') {
|
|
1659
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
var dateObj = new Date(date);
|
|
1663
|
+
if (isNaN(dateObj.getTime())) {
|
|
1664
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
return dateObj.getDate();
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1473
1670
|
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
1474
1671
|
esEncrypt: esEncrypt,
|
|
1475
1672
|
esDecode: esDecode,
|
|
@@ -1517,7 +1714,14 @@ var toFunction = function toFunction(str) {
|
|
|
1517
1714
|
exportXls: exportXls,
|
|
1518
1715
|
generateUUID: generateUUID,
|
|
1519
1716
|
uuid: uuid,
|
|
1520
|
-
toFunction: toFunction
|
|
1717
|
+
toFunction: toFunction,
|
|
1718
|
+
toFixed: toFixed,
|
|
1719
|
+
calculateNetworkDays: calculateNetworkDays,
|
|
1720
|
+
chunkToChinese: chunkToChinese,
|
|
1721
|
+
concatenate: concatenate,
|
|
1722
|
+
dateAddDays: dateAddDays,
|
|
1723
|
+
dateDiff: dateDiff,
|
|
1724
|
+
dayOfMonth: dayOfMonth
|
|
1521
1725
|
});
|
|
1522
1726
|
|
|
1523
1727
|
/***/ }),
|
package/lib/utils/util.js
CHANGED
|
@@ -1367,8 +1367,11 @@ var toFunction = function toFunction(str) {
|
|
|
1367
1367
|
if (str.indexOf('=>') > -1) {
|
|
1368
1368
|
var renders = str.split('=>');
|
|
1369
1369
|
var args = renders[0].replace('(', '').replace(')', '').split(',');
|
|
1370
|
+
var fnStr = renders[1].trim()
|
|
1370
1371
|
// eslint-disable-next-line no-control-regex
|
|
1371
|
-
|
|
1372
|
+
.replace(new RegExp('\n', 'gm'), '')
|
|
1373
|
+
// eslint-disable-next-line no-control-regex
|
|
1374
|
+
.replace(new RegExp('\t', 'gm'), '').replace(new RegExp('^\\{+|\\}+$', 'g'), '');
|
|
1372
1375
|
var fn = void 0;
|
|
1373
1376
|
if (args.length) {
|
|
1374
1377
|
fn = new (Function.prototype.bind.apply(Function, [null].concat(args, [fnStr])))();
|
|
@@ -1381,6 +1384,200 @@ var toFunction = function toFunction(str) {
|
|
|
1381
1384
|
return eval(str);
|
|
1382
1385
|
}
|
|
1383
1386
|
};
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* calculateNetworkDays
|
|
1390
|
+
* @desc 工作日天数
|
|
1391
|
+
* @desc 计算两个日期之间的工作日天数,可以排除周末和指定的假期
|
|
1392
|
+
* @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
|
|
1393
|
+
* @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
|
|
1394
|
+
* @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
|
|
1395
|
+
* @return {number} 工作日天数
|
|
1396
|
+
**/
|
|
1397
|
+
var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
|
|
1398
|
+
var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1399
|
+
|
|
1400
|
+
if (typeof start_date !== 'string' || typeof end_date !== 'string') {
|
|
1401
|
+
throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
var startDateObj = new Date(start_date);
|
|
1405
|
+
var endDateObj = new Date(end_date);
|
|
1406
|
+
|
|
1407
|
+
if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
|
|
1408
|
+
throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
if (startDateObj > endDateObj) {
|
|
1412
|
+
throw new Error('Start date should be earlier than or equal to end date.');
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
var workdays = 0;
|
|
1416
|
+
|
|
1417
|
+
// Iterate through each day in the date range
|
|
1418
|
+
|
|
1419
|
+
var _loop = function _loop(currentDate) {
|
|
1420
|
+
// Check if the current day is a weekend (Saturday or Sunday)
|
|
1421
|
+
var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
|
|
1422
|
+
|
|
1423
|
+
// Check if the current day is a holiday
|
|
1424
|
+
var isHoliday = holidays.some(function (holiday) {
|
|
1425
|
+
var holidayDate = new Date(holiday);
|
|
1426
|
+
return currentDate.toDateString() === holidayDate.toDateString();
|
|
1427
|
+
});
|
|
1428
|
+
|
|
1429
|
+
// If it's a workday (not a weekend or holiday), increment the workdays count
|
|
1430
|
+
if (!isWeekend && !isHoliday) {
|
|
1431
|
+
workdays++;
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
|
|
1436
|
+
_loop(currentDate);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
return workdays;
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* chunkToChinese
|
|
1444
|
+
* @desc 将四位数的整数转换为中文大写
|
|
1445
|
+
* @param {number} chunk - 数字
|
|
1446
|
+
**/
|
|
1447
|
+
function chunkToChinese(chunk) {
|
|
1448
|
+
var numberToChinese = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
|
|
1449
|
+
var capitalDigits = ['', '拾', '佰', '仟'];
|
|
1450
|
+
|
|
1451
|
+
var result = '';
|
|
1452
|
+
var digitIndex = 0;
|
|
1453
|
+
|
|
1454
|
+
while (chunk > 0) {
|
|
1455
|
+
var digit = chunk % 10;
|
|
1456
|
+
if (digit > 0) {
|
|
1457
|
+
result = numberToChinese[digit] + capitalDigits[digitIndex] + result;
|
|
1458
|
+
} else {
|
|
1459
|
+
// 当前数字是零,需要判断是否需要添加零
|
|
1460
|
+
if (result.charAt(0) !== '零') {
|
|
1461
|
+
result = '零' + result;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
chunk = Math.floor(chunk / 10);
|
|
1465
|
+
digitIndex++;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
return result;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* concatenate
|
|
1473
|
+
* @desc 指定连接符合并文本
|
|
1474
|
+
* @desc 使用指定的连接符合并文本字符串
|
|
1475
|
+
* @author SuTao
|
|
1476
|
+
* @date 2023年12月14日
|
|
1477
|
+
* @param {string} separator - 指定的连接符
|
|
1478
|
+
* @param {...string} strings - 多个文本字符串
|
|
1479
|
+
* @return {string} 合并后的字符串
|
|
1480
|
+
**/
|
|
1481
|
+
var concatenate = function concatenate(separator) {
|
|
1482
|
+
for (var _len = arguments.length, strings = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1483
|
+
strings[_key - 1] = arguments[_key];
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
if (typeof separator !== 'string' || !strings.every(function (str) {
|
|
1487
|
+
return typeof str === 'string';
|
|
1488
|
+
})) {
|
|
1489
|
+
throw new Error('Invalid input. Please provide a valid separator and valid strings.');
|
|
1490
|
+
}
|
|
1491
|
+
return strings.join(separator);
|
|
1492
|
+
};
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* dateAddDays
|
|
1496
|
+
* @desc 加减日期天数
|
|
1497
|
+
* @desc 在给定的日期上加上或减去指定的天数
|
|
1498
|
+
* @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
|
|
1499
|
+
* @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
|
|
1500
|
+
* @return {string} 计算后的日期字符串
|
|
1501
|
+
**/
|
|
1502
|
+
var dateAddDays = function dateAddDays(start_date, days) {
|
|
1503
|
+
if (typeof start_date !== 'string' || !Number.isInteger(days)) {
|
|
1504
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days.");
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
var startDateObj = new Date(start_date);
|
|
1508
|
+
if (isNaN(startDateObj.getTime())) {
|
|
1509
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
var resultDateObj = new Date(startDateObj);
|
|
1513
|
+
resultDateObj.setDate(resultDateObj.getDate() + days);
|
|
1514
|
+
|
|
1515
|
+
var resultYear = resultDateObj.getFullYear();
|
|
1516
|
+
var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
|
|
1517
|
+
var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
|
|
1518
|
+
|
|
1519
|
+
return resultYear + '-' + resultMonth + '-' + resultDay;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* dateDiff
|
|
1524
|
+
* @desc 计算两个日期之间的差距
|
|
1525
|
+
* @author SuTao
|
|
1526
|
+
* @date 2023年12月14日
|
|
1527
|
+
* @param {String} start_date - 起始日期字符串
|
|
1528
|
+
* @param {String} end_date - 结束日期字符串
|
|
1529
|
+
* @param {String} [unit] - 计算的时间单位 ("y", "M", "d", "h", "m", "s")
|
|
1530
|
+
* @return {Number} 两个日期之间的差距
|
|
1531
|
+
**/
|
|
1532
|
+
var dateDiff = function dateDiff(start_date, end_date, unit) {
|
|
1533
|
+
// Assuming date strings are in "YYYY-MM-DD" format
|
|
1534
|
+
var startDate = new Date(start_date);
|
|
1535
|
+
var endDate = new Date(end_date);
|
|
1536
|
+
|
|
1537
|
+
// Calculate the difference in milliseconds
|
|
1538
|
+
var timeDifference = endDate - startDate;
|
|
1539
|
+
|
|
1540
|
+
// Convert milliseconds to the specified unit
|
|
1541
|
+
unit = unit || 'd'; // Set default unit to "d"
|
|
1542
|
+
|
|
1543
|
+
switch (unit) {
|
|
1544
|
+
case 'y':
|
|
1545
|
+
return endDate.getFullYear() - startDate.getFullYear();
|
|
1546
|
+
case 'M':
|
|
1547
|
+
return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
|
|
1548
|
+
case 'd':
|
|
1549
|
+
return Math.floor(timeDifference / (1000 * 60 * 60 * 24));
|
|
1550
|
+
case 'h':
|
|
1551
|
+
return Math.floor(timeDifference / (1000 * 60 * 60));
|
|
1552
|
+
case 'm':
|
|
1553
|
+
return Math.floor(timeDifference / (1000 * 60));
|
|
1554
|
+
case 's':
|
|
1555
|
+
return Math.floor(timeDifference / 1000);
|
|
1556
|
+
default:
|
|
1557
|
+
throw new Error("Invalid unit. Supported units are 'y', 'M', 'd', 'h', 'm', 's'.");
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* dayOfMonth
|
|
1563
|
+
* @desc 当月第几天
|
|
1564
|
+
* @desc 返回给定日期是所在月的第几天
|
|
1565
|
+
* @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
|
|
1566
|
+
* @return {number} 当月的第几天
|
|
1567
|
+
**/
|
|
1568
|
+
var dayOfMonth = function dayOfMonth(date) {
|
|
1569
|
+
if (typeof date !== 'string') {
|
|
1570
|
+
throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
var dateObj = new Date(date);
|
|
1574
|
+
if (isNaN(dateObj.getTime())) {
|
|
1575
|
+
throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
return dateObj.getDate();
|
|
1579
|
+
};
|
|
1580
|
+
|
|
1384
1581
|
exports.default = {
|
|
1385
1582
|
esEncrypt: esEncrypt,
|
|
1386
1583
|
esDecode: esDecode,
|
|
@@ -1428,5 +1625,12 @@ exports.default = {
|
|
|
1428
1625
|
exportXls: exportXls,
|
|
1429
1626
|
generateUUID: generateUUID,
|
|
1430
1627
|
uuid: uuid,
|
|
1431
|
-
toFunction: toFunction
|
|
1628
|
+
toFunction: toFunction,
|
|
1629
|
+
toFixed: toFixed,
|
|
1630
|
+
calculateNetworkDays: calculateNetworkDays,
|
|
1631
|
+
chunkToChinese: chunkToChinese,
|
|
1632
|
+
concatenate: concatenate,
|
|
1633
|
+
dateAddDays: dateAddDays,
|
|
1634
|
+
dateDiff: dateDiff,
|
|
1635
|
+
dayOfMonth: dayOfMonth
|
|
1432
1636
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EmActionSheet from './src/main';
|
|
2
|
-
|
|
3
|
-
EmActionSheet.install = Vue => Vue.component(EmActionSheet.name, EmActionSheet);
|
|
4
|
-
|
|
5
|
-
export default EmActionSheet;
|
|
1
|
+
import EmActionSheet from './src/main';
|
|
2
|
+
|
|
3
|
+
EmActionSheet.install = Vue => Vue.component(EmActionSheet.name, EmActionSheet);
|
|
4
|
+
|
|
5
|
+
export default EmActionSheet;
|