@kyfe/fms-vue2-components 0.0.3 → 0.0.5
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/dist/assets/css/fms-ks-clamp-text.css +1 -0
- package/dist/assets/css/fms-ks-components.css +1 -0
- package/dist/assets/css/fms-ks-popover.css +1 -0
- package/dist/assets/css/fms-ks-search-tips-new.css +1 -0
- package/dist/assets/css/fms-ks-search-tips.css +1 -0
- package/dist/assets/css/fms-ks-select-box.css +1 -0
- package/dist/assets/css/fms-ks-select.css +1 -0
- package/dist/date-picker-bottom.17e75dc0.js +45 -0
- package/dist/date-picker-dropdown.1d8e9f00.js +34 -0
- package/dist/date-picker-right.b939e886.js +23 -0
- package/dist/date-picker-top.c38046f7.js +23 -0
- package/dist/date-range-select.647edaf6.js +69 -0
- package/dist/date-select.96eb3a9d.js +60 -0
- package/dist/date-week-month.169b98bc.js +57 -0
- package/dist/datetime-popup/index.js +411 -0
- package/dist/filter.c93f4ddb.js +45 -0
- package/dist/fms-copy-box/index.js +1 -1
- package/dist/fms-ks-block-title/index.js +38 -0
- package/dist/fms-ks-block-title/style.css +1 -0
- package/dist/fms-ks-clamp-text/index.js +9 -0
- package/dist/fms-ks-clamp-text.24eb5e8d.js +53 -0
- package/dist/fms-ks-components/index.js +9 -0
- package/dist/fms-ks-components.a5d9329b.js +4392 -0
- package/dist/fms-ks-decrypt/index.js +2 -2
- package/dist/fms-ks-decrypt.2f88e659.js +312 -0
- package/dist/fms-ks-file-upload/index.js +32 -31
- package/dist/fms-ks-file-upload/style.css +1 -1
- package/dist/fms-ks-form-grid/index.js +101 -0
- package/dist/fms-ks-form-grid/style.css +1 -0
- package/dist/fms-ks-more-lines/index.js +31 -0
- package/dist/fms-ks-more-lines/style.css +1 -0
- package/dist/fms-ks-page-popup/index.js +68 -0
- package/dist/fms-ks-page-popup/style.css +1 -0
- package/dist/fms-ks-picker/index.js +9 -0
- package/dist/fms-ks-picker.766b55f9.js +61 -0
- package/dist/fms-ks-popover/index.js +9 -0
- package/dist/fms-ks-popover.55ab4b82.js +95 -0
- package/dist/fms-ks-search-tips/index.js +9 -0
- package/dist/fms-ks-search-tips-new/index.js +9 -0
- package/dist/fms-ks-search-tips-new.7d08f710.js +125 -0
- package/dist/fms-ks-search-tips.d36859c3.js +142 -0
- package/dist/fms-ks-select/index.js +9 -0
- package/dist/fms-ks-select-box/index.js +9 -0
- package/dist/fms-ks-select-box.a00f0f08.js +43 -0
- package/dist/fms-ks-select.59416fd8.js +157 -0
- package/dist/fms-ks-warn-drawer/index.js +37 -0
- package/dist/fms-ks-warn-drawer/style.css +1 -0
- package/dist/fms-scroll-list/index.js +3 -1
- package/dist/index.js +30 -30
- package/dist/mixin.f4bc60f0.js +59 -0
- package/dist/month-range-select.374653da.js +97 -0
- package/dist/month-select.30ae7335.js +71 -0
- package/dist/oa-datetime-picker-new/style.css +1 -0
- package/dist/quarter-select.b6256880.js +73 -0
- package/dist/utils.159fba19.js +64 -0
- package/dist/week-select.27efca5c.js +70 -0
- package/package.json +31 -31
- package/src/assets/images/attachment/icon_default.svg +23 -0
- package/src/assets/images/attachment/icon_default_new.png +0 -0
- package/src/assets/images/attachment/icon_excel.svg +20 -0
- package/src/assets/images/attachment/icon_excel_new.png +0 -0
- package/src/assets/images/attachment/icon_file.png +0 -0
- package/src/assets/images/attachment/icon_pdf_new.png +0 -0
- package/src/assets/images/attachment/icon_ppt.svg +20 -0
- package/src/assets/images/attachment/icon_ppt_new.png +0 -0
- package/src/assets/images/attachment/icon_preview_file.png +0 -0
- package/src/assets/images/attachment/icon_txt.png +0 -0
- package/src/assets/images/attachment/icon_word.svg +19 -0
- package/src/assets/images/attachment/icon_word_new.png +0 -0
- package/src/assets/images/attachment/icon_xmind.png +0 -0
- package/src/assets/images/icon-arrow.png +0 -0
- package/src/assets/images/icon-forewarning.svg +1 -0
- package/src/components/date-picker/index.vue +205 -0
- package/src/components/datetime-picker-general/index.vue +161 -0
- package/src/components/datetime-popup/date-picker.js +217 -0
- package/src/components/datetime-popup/index.js +37 -0
- package/src/components/datetime-popup/index.vue +111 -0
- package/src/components/datetime-popup/mixin.js +125 -0
- package/src/components/datetime-popup/time-picker.js +102 -0
- package/src/components/datetime-popup/utils.js +124 -0
- package/src/components/datetime-popup//347/244/272/344/276/213/345/233/276.png +0 -0
- package/src/components/decrypt/README.md +0 -0
- package/src/components/decrypt/index.vue +73 -0
- package/src/components/fms-ks-block-title/fms-ks-block-title.vue +75 -0
- package/src/components/fms-ks-block-title/index.js +7 -0
- package/src/components/fms-ks-block-title//346/240/207/351/242/230.md +0 -0
- package/src/components/fms-ks-clamp-text/fms-ks-clamp-text.vue +66 -0
- package/src/components/fms-ks-clamp-text/images/icon-clamp.png +0 -0
- package/src/components/fms-ks-clamp-text/index.js +7 -0
- package/src/components/fms-ks-clamp-text//346/226/207/346/234/254/346/224/266/350/265/267/345/261/225/345/274/200.md +0 -0
- package/src/components/fms-ks-components/fms-ks-components.vue +699 -0
- package/src/components/fms-ks-components/index.js +7 -0
- package/src/components/fms-ks-components/money-directive.js +73 -0
- package/src/components/fms-ks-components//350/241/250/345/215/225/351/205/215/347/275/256/347/273/204/344/273/266/350/257/264/346/230/216.md +10 -0
- package/src/components/fms-ks-file-upload/fms-ks-file-upload.vue +8 -1
- package/src/components/fms-ks-form-grid/fields-conversion.js +107 -0
- package/src/components/fms-ks-form-grid/fms-ks-form-grid.vue +127 -0
- package/src/components/fms-ks-form-grid/index.js +7 -0
- package/src/components/fms-ks-more-lines/fms-ks-more-lines.vue +108 -0
- package/src/components/fms-ks-more-lines/index.js +7 -0
- package/src/components/fms-ks-more-lines//346/233/264/345/244/232.md +0 -0
- package/src/components/fms-ks-page-popup/fms-ks-page-popup.vue +153 -0
- package/src/components/fms-ks-page-popup/index.js +7 -0
- package/src/components/fms-ks-page-popup//345/274/271/345/207/272/345/261/202.md +0 -0
- package/src/components/fms-ks-picker/fms-ks-picker.vue +67 -0
- package/src/components/fms-ks-picker/index.js +7 -0
- package/src/components/fms-ks-picker//351/200/211/346/213/251/345/274/271/345/207/272/345/261/202.md +0 -0
- package/src/components/fms-ks-popover/click-outside.js +68 -0
- package/src/components/fms-ks-popover/fms-ks-popover.vue +89 -0
- package/src/components/fms-ks-popover/index.js +7 -0
- package/src/components/fms-ks-popover//345/274/271/345/207/272/345/261/202.md +0 -0
- package/src/components/fms-ks-search-tips/fms-ks-search-tips.vue +296 -0
- package/src/components/fms-ks-search-tips/index.js +7 -0
- package/src/components/fms-ks-search-tips//350/277/234/347/250/213/346/220/234/347/264/242.md +118 -0
- package/src/components/fms-ks-search-tips-new/fms-ks-search-tips-new.vue +242 -0
- package/src/components/fms-ks-search-tips-new/index.js +7 -0
- package/src/components/fms-ks-search-tips-new/style.less +137 -0
- package/src/components/fms-ks-search-tips-new//350/277/234/347/250/213/346/220/234/347/264/242-/346/226/260.md +118 -0
- package/src/components/fms-ks-select/fms-ks-select.vue +421 -0
- package/src/components/fms-ks-select/index.js +7 -0
- package/src/components/fms-ks-select//351/200/211/346/213/251/346/241/206.md +0 -0
- package/src/components/fms-ks-select-box/fms-ks-select-box.vue +84 -0
- package/src/components/fms-ks-select-box/index.js +7 -0
- package/src/components/fms-ks-select-box//344/270/215/351/234/200/350/246/201popup/347/232/204select.md +0 -0
- package/src/components/fms-ks-warn-drawer/fms-ks-warn-drawer.vue +111 -0
- package/src/components/fms-ks-warn-drawer/index.js +7 -0
- package/src/components/fms-ks-warn-drawer//351/242/204/350/255/246/346/217/220/347/244/272.md +0 -0
- package/src/components/ks-decrypt/README.md +140 -0
- package/src/components/ks-decrypt/index.vue +155 -0
- package/src/components/ks-popover/index.vue +483 -0
- package/src/components/ks-popover/mixin.js +28 -0
- package/src/components/ks-popover/utils.js +60 -0
- package/src/components/oa-datetime-picker/index.vue +169 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/README.md +21 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-picker-bottom.vue +121 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-picker-dropdown.vue +78 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-picker-right.vue +86 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-picker-top.vue +82 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-picker.js +12 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-range-select.vue +106 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-select.vue +66 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/date-week-month.vue +131 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/index.js +39 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/mixin.js +85 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/month-range-select.vue +127 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/month-select.vue +87 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/quarter-select.vue +95 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/style.less +117 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/utils.js +109 -0
- package/src/components/oa-datetime-picker-new/components/date-picker/week-select.vue +100 -0
- package/src/components/oa-datetime-picker-new/index.vue +212 -0
- package/src/index.js +8 -2
- package/vite.config.js +12 -1
- package/dist/fms-ks-decrypt.bcc12f44.js +0 -335
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@title-color: #7972FE;
|
|
2
|
+
@day-text-color: #333;
|
|
3
|
+
@selected-bgcolor: #7972FE;
|
|
4
|
+
@selected-text-color: #fff;
|
|
5
|
+
|
|
6
|
+
// mixin
|
|
7
|
+
.header-title-text (@height: 40px) {
|
|
8
|
+
text-align: center;
|
|
9
|
+
height: @height;
|
|
10
|
+
line-height: @height;
|
|
11
|
+
font-size: 14px;
|
|
12
|
+
color: @title-color;
|
|
13
|
+
&-split {
|
|
14
|
+
color: @day-text-color;
|
|
15
|
+
}
|
|
16
|
+
&-end-not {
|
|
17
|
+
color: #ddd;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.footer-btn () {
|
|
21
|
+
height: 62px;
|
|
22
|
+
padding: 16px 16px 0 16px;
|
|
23
|
+
box-shadow: 0 0 4px 0 rgba(158,155,218,0.22);
|
|
24
|
+
z-index: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 公共样式
|
|
28
|
+
.ks-date-picker {
|
|
29
|
+
&__body {
|
|
30
|
+
flex: 1;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
height: 100%;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 覆盖vant样式
|
|
38
|
+
.ks-date-picker {
|
|
39
|
+
.van-calendar__body {
|
|
40
|
+
height: 100%;
|
|
41
|
+
flex: 1;
|
|
42
|
+
overflow: auto;
|
|
43
|
+
-webkit-overflow-scrolling: touch;
|
|
44
|
+
}
|
|
45
|
+
.van-calendar__month-title {
|
|
46
|
+
height: 40px;
|
|
47
|
+
line-height: 40px;
|
|
48
|
+
color: @day-text-color;
|
|
49
|
+
}
|
|
50
|
+
.van-calendar__day {
|
|
51
|
+
color: @day-text-color;
|
|
52
|
+
&.van-calendar__day--disabled {
|
|
53
|
+
color: #ccc;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
.van-calendar__selected-day, .van-calendar__day--start, .van-calendar__day--end {
|
|
57
|
+
color: @selected-text-color;
|
|
58
|
+
background-color: @selected-bgcolor;
|
|
59
|
+
border-radius: 50%;
|
|
60
|
+
width: 44px;
|
|
61
|
+
height: 44px;
|
|
62
|
+
line-height: 44px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
}
|
|
67
|
+
.van-calendar__day--start-end {
|
|
68
|
+
color: @selected-text-color;
|
|
69
|
+
background-color: @selected-bgcolor;
|
|
70
|
+
width: 54px;
|
|
71
|
+
height: 44px;
|
|
72
|
+
line-height: 44px;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
.van-calendar__day--middle:after {
|
|
79
|
+
top: 3px;
|
|
80
|
+
bottom: 3px;
|
|
81
|
+
}
|
|
82
|
+
.van-calendar__day--start, .van-calendar__day--end {
|
|
83
|
+
position: relative;
|
|
84
|
+
}
|
|
85
|
+
.van-calendar__day--start::after {
|
|
86
|
+
position: absolute;
|
|
87
|
+
left: 50%;
|
|
88
|
+
top: 0;
|
|
89
|
+
bottom: 0;
|
|
90
|
+
width: 85%;
|
|
91
|
+
content: " ";
|
|
92
|
+
background-color: rgba(121,114,254,.1);
|
|
93
|
+
}
|
|
94
|
+
.van-calendar__day--end::after {
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 50%;
|
|
97
|
+
top: 0;
|
|
98
|
+
bottom: 0;
|
|
99
|
+
width: 85%;
|
|
100
|
+
content: " ";
|
|
101
|
+
background-color: rgba(121,114,254,.1);
|
|
102
|
+
}
|
|
103
|
+
.van-calendar__bottom-info {
|
|
104
|
+
font-size: 10px;
|
|
105
|
+
line-height: 10px;
|
|
106
|
+
font-weight: 300;
|
|
107
|
+
bottom: 3px;
|
|
108
|
+
position: absolute;
|
|
109
|
+
right: 0;
|
|
110
|
+
left: 0;
|
|
111
|
+
}
|
|
112
|
+
.van-calendar__confirm {
|
|
113
|
+
height: 44px;
|
|
114
|
+
line-height: 44px;
|
|
115
|
+
margin-top: 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// 时间对象格式为文本格式
|
|
2
|
+
export const formatToString = (date, type) => {
|
|
3
|
+
if (!date) {
|
|
4
|
+
return null
|
|
5
|
+
}
|
|
6
|
+
let _date = new Date(date)
|
|
7
|
+
let y = _date.getFullYear()
|
|
8
|
+
let m = _date.getMonth() + 1
|
|
9
|
+
m = m < 10 ? '0' + m : m
|
|
10
|
+
let d = _date.getDate()
|
|
11
|
+
d = d < 10 ? '0' + d : d
|
|
12
|
+
return type === 'month' ? `${y}/${m}` : `${y}/${m}/${d}`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const formatToDate = (date) => {
|
|
16
|
+
if (!date) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
if (typeof date === 'string') {
|
|
20
|
+
date = date.replace(/-/g, "/")
|
|
21
|
+
return new Date(date)
|
|
22
|
+
} else {
|
|
23
|
+
return new Date(date)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const foramtToMonth = (date) => {
|
|
28
|
+
if (!date) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
let _date = null
|
|
32
|
+
if (typeof date === 'string') {
|
|
33
|
+
let arr = date.replace(/-/g, "/").split('/')
|
|
34
|
+
_date = new Date(`${arr[0]}/${arr[1]}/01`)
|
|
35
|
+
} else {
|
|
36
|
+
let d = new Date(date)
|
|
37
|
+
_date = new Date(`${d.getFullYear()}/${d.getMonth() + 1}/01`)
|
|
38
|
+
}
|
|
39
|
+
return _date
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 生成年的区间
|
|
44
|
+
* @param {*} arr
|
|
45
|
+
*/
|
|
46
|
+
export const getRangeYears = (arr) => {
|
|
47
|
+
let num = arr[1]
|
|
48
|
+
let years = []
|
|
49
|
+
while (num >= arr[0]) {
|
|
50
|
+
years.unshift(num)
|
|
51
|
+
num = num - 1
|
|
52
|
+
}
|
|
53
|
+
return years
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 生成所有年的星期
|
|
59
|
+
* @param {*} arr
|
|
60
|
+
* @param {*} firstDayOfWeek
|
|
61
|
+
*/
|
|
62
|
+
export const getYearsAndWeeks = (arr, firstDayOfWeek) => {
|
|
63
|
+
let years = getRangeYears(arr)
|
|
64
|
+
const getAYearWeeks = (year) => {
|
|
65
|
+
let weeks = []
|
|
66
|
+
let _date = new Date(year, 11, 31)
|
|
67
|
+
let _day = _date.getDay() - firstDayOfWeek + 1
|
|
68
|
+
let _start = new Date(year, 11, 31 - _day)
|
|
69
|
+
let _end = new Date(year + 1, 0, 6 - _day)
|
|
70
|
+
const f = (date) => {
|
|
71
|
+
let y = date.getFullYear()
|
|
72
|
+
let m = date.getMonth() + 1
|
|
73
|
+
let d = date.getDate()
|
|
74
|
+
return [
|
|
75
|
+
`${y}/${m}/${d}`,
|
|
76
|
+
`${String(m).length > 1 ? m : '0' + m}/${String(d).length > 1 ? d : '0' + d}`
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
while (_end.getFullYear() >= year) {
|
|
80
|
+
let _startArr = f(_start)
|
|
81
|
+
let _endArr = f(_end)
|
|
82
|
+
weeks.unshift({
|
|
83
|
+
startDay: new Date(_startArr[0]),
|
|
84
|
+
startDayStr: _startArr[1],
|
|
85
|
+
endDay: new Date(_endArr[0]),
|
|
86
|
+
endDayStr: _endArr[1]
|
|
87
|
+
})
|
|
88
|
+
_start.setDate(_start.getDate() - 7)
|
|
89
|
+
_end.setDate(_end.getDate() - 7)
|
|
90
|
+
}
|
|
91
|
+
return weeks
|
|
92
|
+
}
|
|
93
|
+
return years.map(year => {
|
|
94
|
+
return {
|
|
95
|
+
year,
|
|
96
|
+
weeks: getAYearWeeks(year)
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const typeToSelectotMap = {
|
|
102
|
+
'date': 'DateSelect',
|
|
103
|
+
'daterange': 'DateRangeSelect',
|
|
104
|
+
'month': 'MonthSelect',
|
|
105
|
+
'monthrange': 'MonthRangeSelect',
|
|
106
|
+
'week': 'WeekSelect',
|
|
107
|
+
'quarter': 'QuarterSelect',
|
|
108
|
+
'dateweekmonth': 'DateWeekMonth'
|
|
109
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="van-calendar__body"
|
|
3
|
+
ref="body">
|
|
4
|
+
<div class="van-calendar__month"
|
|
5
|
+
v-for="y of years"
|
|
6
|
+
:key="y.year">
|
|
7
|
+
<div class="van-calendar__month-title">{{ y.year }}年</div>
|
|
8
|
+
<div class="van-calendar__days">
|
|
9
|
+
<div class="van-calendar__day ks-week__day"
|
|
10
|
+
v-for="(w, i) of y.weeks"
|
|
11
|
+
:key="i"
|
|
12
|
+
:class="{'ks-week__selected-day': y.year === currentYear && (i + 1) === currentWeek}"
|
|
13
|
+
@click="handleSelect(y.year, i + 1, w)">
|
|
14
|
+
<div>{{String(i + 1).length > 1 ? i + 1 : '0' + (i + 1)}}周({{w.startDayStr}}~{{w.endDayStr}})</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { getYearsAndWeeks } from './utils'
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
name: 'week-select',
|
|
26
|
+
props: {
|
|
27
|
+
defaultValue: {
|
|
28
|
+
type: [Date, String, Number],
|
|
29
|
+
default: new Date()
|
|
30
|
+
},
|
|
31
|
+
yearRange: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => ([new Date().getFullYear() - 2, new Date().getFullYear()])
|
|
34
|
+
},
|
|
35
|
+
horizontal: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
firstDayOfWeek: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 1,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
data () {
|
|
45
|
+
return {
|
|
46
|
+
years: getYearsAndWeeks(this.yearRange, this.firstDayOfWeek),
|
|
47
|
+
currentYear: null,
|
|
48
|
+
currentWeek: null,
|
|
49
|
+
currentStart: null,
|
|
50
|
+
currentEnd: null,
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
init () {
|
|
55
|
+
let _date = new Date(this.defaultValue)
|
|
56
|
+
let y = _date.getFullYear()
|
|
57
|
+
let _year = this.years.find(item => item.year === y)
|
|
58
|
+
let _index = _year.weeks.findIndex(item => +item.startDay <= +_date && +item.endDay >= +_date)
|
|
59
|
+
let _week = _year.weeks[_index]
|
|
60
|
+
this.handleSelect(y, _index + 1, _week)
|
|
61
|
+
this.scrollInto()
|
|
62
|
+
},
|
|
63
|
+
scrollInto () {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
let top = this.$el.querySelector('.ks-week__selected-day')
|
|
66
|
+
this.$refs.body && (this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0)
|
|
67
|
+
}, 240)
|
|
68
|
+
},
|
|
69
|
+
handleSelect (y, w, week) {
|
|
70
|
+
this.currentYear = y
|
|
71
|
+
this.currentWeek = w
|
|
72
|
+
this.currentStart = week.startDay
|
|
73
|
+
this.currentEnd = week.endDay
|
|
74
|
+
this.$emit('select', { year: y, week, num: w })
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<style lang="less">
|
|
81
|
+
.ks-week__day {
|
|
82
|
+
width: 50%;
|
|
83
|
+
height: 44px;
|
|
84
|
+
}
|
|
85
|
+
.ks-week__selected-day {
|
|
86
|
+
color: #7972fe !important;
|
|
87
|
+
position: relative;
|
|
88
|
+
&::after {
|
|
89
|
+
font: normal normal normal 14px/1 "vant-icon";
|
|
90
|
+
font-size: 12px;
|
|
91
|
+
text-rendering: auto;
|
|
92
|
+
-webkit-font-smoothing: antialiased;
|
|
93
|
+
content: "\F0C8";
|
|
94
|
+
display: inline-block;
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 4px;
|
|
97
|
+
top: 16px;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// 新的日期选择组件
|
|
2
|
+
// 替换为日历格式的新UI日期组件
|
|
3
|
+
<template>
|
|
4
|
+
<div class="oa-datetime-picker">
|
|
5
|
+
<van-field readonly
|
|
6
|
+
name="datetimePicker"
|
|
7
|
+
input-align="right"
|
|
8
|
+
error-message-align="right"
|
|
9
|
+
:required="required"
|
|
10
|
+
:rules="[{ required: required, message: `请选择${label}` }]"
|
|
11
|
+
:value="displayValue"
|
|
12
|
+
:label="label"
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
:placeholder="placeholder"
|
|
15
|
+
@click="show">
|
|
16
|
+
<template #label>
|
|
17
|
+
<slot name="label"/>
|
|
18
|
+
</template>
|
|
19
|
+
</van-field>
|
|
20
|
+
<!-- 替换为全新的日期组件-日历形式,没法选择时间 -->
|
|
21
|
+
<date-picker :type="type"
|
|
22
|
+
v-model="showPicker"
|
|
23
|
+
:min="minDate||min"
|
|
24
|
+
:max="maxDate||max"
|
|
25
|
+
:formatter="formatter"
|
|
26
|
+
:defaultValue="defaultDate"
|
|
27
|
+
@confirm="onConfirm"
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
@cancel="showPicker = false"
|
|
30
|
+
ref="dp" />
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import moment from 'dayjs'
|
|
36
|
+
import DatePicker from './components/date-picker'
|
|
37
|
+
|
|
38
|
+
const DEFAULT_FORMATS = {
|
|
39
|
+
month: 'YYYY/MM',
|
|
40
|
+
date: 'YYYY/MM/DD',
|
|
41
|
+
daterange: 'YYYY-MM-DD',
|
|
42
|
+
// datetime: 'YYYY/MM/DD HH:mm',
|
|
43
|
+
// months: 'yyyy-MM',
|
|
44
|
+
// time: 'HH:mm:ss',
|
|
45
|
+
// week: 'yyyywWW',
|
|
46
|
+
// timerange: 'HH:mm:ss',
|
|
47
|
+
// monthrange: 'yyyy-MM',
|
|
48
|
+
// datetimerange: 'yyyy-MM-dd HH:mm:ss',
|
|
49
|
+
// year: 'yyyy',
|
|
50
|
+
// years: 'yyyy'
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const formatAsFormatAndType = (value, customFormat, type) => {
|
|
54
|
+
if (!value) return null
|
|
55
|
+
const format = customFormat || DEFAULT_FORMATS[type]
|
|
56
|
+
return momentFormatUtil(value, format)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const momentFormatUtil = (value, format) => {
|
|
60
|
+
return moment(value).format(format)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
name: 'oa-datetime-picker',
|
|
65
|
+
props: {
|
|
66
|
+
type: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'date'
|
|
69
|
+
},
|
|
70
|
+
value: [String, Number],
|
|
71
|
+
label: String,
|
|
72
|
+
placeholder: String,
|
|
73
|
+
required: Boolean,
|
|
74
|
+
disabled: Boolean,
|
|
75
|
+
minDate: String,
|
|
76
|
+
maxDate: String,
|
|
77
|
+
min: String,
|
|
78
|
+
max: String,
|
|
79
|
+
// 提交的数据格式是否需要为时间戳
|
|
80
|
+
isTimestamp: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
displayFormat: String // 显示的格式
|
|
85
|
+
},
|
|
86
|
+
computed: {
|
|
87
|
+
// 用于页面显示的值
|
|
88
|
+
displayValue () {
|
|
89
|
+
if (this.type === 'daterange' && Array.isArray(this.value)) {
|
|
90
|
+
if (this.value.length !== 2) return ''
|
|
91
|
+
const start = formatAsFormatAndType(this.value[0], this.displayFormat, this.type)
|
|
92
|
+
const end = formatAsFormatAndType(this.value[1], this.displayFormat, this.type)
|
|
93
|
+
return `${start} ~ ${end}`
|
|
94
|
+
}
|
|
95
|
+
return formatAsFormatAndType(this.parsedValue, this.displayFormat, this.type)
|
|
96
|
+
},
|
|
97
|
+
// 兜底逻辑,支持更多的传入类型,不至于报错
|
|
98
|
+
parsedValue () {
|
|
99
|
+
if (!this.value) return this.value
|
|
100
|
+
// 兼容问题:这里不要用new Date(),IOS机型如果传入'2020-01',会变成invalid date
|
|
101
|
+
// return new Date(this.value)
|
|
102
|
+
return moment(this.value)
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
components: { DatePicker },
|
|
106
|
+
data () {
|
|
107
|
+
return {
|
|
108
|
+
showPicker: false,
|
|
109
|
+
timeVal: new Date()
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
methods: {
|
|
113
|
+
show () {
|
|
114
|
+
// 禁用选择
|
|
115
|
+
if (this.disabled) {
|
|
116
|
+
return false
|
|
117
|
+
}
|
|
118
|
+
this.defaultDate = this.parsedValue || new Date()
|
|
119
|
+
this.showPicker = true
|
|
120
|
+
if (this.type === 'daterange') {
|
|
121
|
+
// 当为日期范围时,默认定位到当天日期
|
|
122
|
+
let timer = setInterval(() => {
|
|
123
|
+
let selector = this.$refs.dp.$refs.selector
|
|
124
|
+
if (selector) {
|
|
125
|
+
let currentDate = [new Date(), new Date()]
|
|
126
|
+
if (Array.isArray(this.value) && this.value.length === 2) {
|
|
127
|
+
currentDate = [
|
|
128
|
+
new Date(this.value[0]),
|
|
129
|
+
new Date(this.value[1]),
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
selector.currentDate = currentDate
|
|
133
|
+
clearInterval(timer)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
// 3秒后强制终止轮询
|
|
137
|
+
setTimeout(() => {
|
|
138
|
+
clearInterval(timer)
|
|
139
|
+
}, 3000)
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
formatter (type, val) {
|
|
143
|
+
if (type === 'year') {
|
|
144
|
+
return `${val}年`
|
|
145
|
+
} else if (type === 'month') {
|
|
146
|
+
return `${val}月`
|
|
147
|
+
} else if (type === 'day') {
|
|
148
|
+
return `${val}日`
|
|
149
|
+
} else if (type === 'hour') {
|
|
150
|
+
return `${val}时`
|
|
151
|
+
} else if (type === 'minute') {
|
|
152
|
+
return `${val}分`
|
|
153
|
+
}
|
|
154
|
+
return val
|
|
155
|
+
},
|
|
156
|
+
onConfirm (val) {
|
|
157
|
+
console.log('onConfirm---', val)
|
|
158
|
+
this.timeVal = val.date
|
|
159
|
+
// 恢复之前的日期格式
|
|
160
|
+
let formatMap = [
|
|
161
|
+
{
|
|
162
|
+
label: 'month',
|
|
163
|
+
value: 'YYYY-MM'
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
label: 'date',
|
|
167
|
+
value: 'YYYY-MM-DD'
|
|
168
|
+
},
|
|
169
|
+
// {
|
|
170
|
+
// label: 'datetime',
|
|
171
|
+
// value: 'YYYY-MM-DD HH:mm'
|
|
172
|
+
// }
|
|
173
|
+
]
|
|
174
|
+
if (this.type === 'daterange' && Array.isArray(this.timeVal)) {
|
|
175
|
+
let arr = []
|
|
176
|
+
if (this.timeVal.every(val => val)) {
|
|
177
|
+
const start = momentFormatUtil(this.timeVal[0], 'YYYY-MM-DD')
|
|
178
|
+
const end = momentFormatUtil(this.timeVal[1], 'YYYY-MM-DD')
|
|
179
|
+
arr = [start, end]
|
|
180
|
+
}
|
|
181
|
+
this.showPicker = false
|
|
182
|
+
this.$emit('input', arr)
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
let format = formatMap.find(t => t.label === this.type) || {}
|
|
186
|
+
console.log('format---', format, this.timeVal, format.value)
|
|
187
|
+
// 这里不要修改父组件传进来的值,this.value
|
|
188
|
+
const newValue = momentFormatUtil(this.timeVal, format ? format.value : 'YYYY-MM-DD')
|
|
189
|
+
console.log('newValue', newValue)
|
|
190
|
+
this.showPicker = false
|
|
191
|
+
this.$emit('input', this.isTimestamp ? new Date(newValue).getTime() : newValue)
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
}
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<style scoped lang="less">
|
|
198
|
+
.oa-datetime-picker {
|
|
199
|
+
.van-cell:after {
|
|
200
|
+
position: absolute;
|
|
201
|
+
content: " ";
|
|
202
|
+
pointer-events: none;
|
|
203
|
+
right: 0;
|
|
204
|
+
bottom: 0;
|
|
205
|
+
left: 16px;
|
|
206
|
+
right: 16px;
|
|
207
|
+
border-bottom: 1px solid #d9d9d9;
|
|
208
|
+
-webkit-transform: scaleY(0.5);
|
|
209
|
+
transform: scaleY(0.5);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import FmsKsDecrypt from './components/fms-ks-decrypt/index'
|
|
|
5
5
|
import FmsKsFileUpload from './components/fms-ks-file-upload/index'
|
|
6
6
|
import FmsKsFileView from './components/fms-ks-file-view/index'
|
|
7
7
|
import FmsScrollList from './components/fms-scroll-list/index'
|
|
8
|
+
import FmsKsFormGrid from './components/fms-ks-form-grid'
|
|
9
|
+
import FmsKsSearchTips from './components/fms-ks-search-tips'
|
|
8
10
|
|
|
9
11
|
const components = [
|
|
10
12
|
FmsCopyBox,
|
|
@@ -12,7 +14,9 @@ const components = [
|
|
|
12
14
|
FmsKsDecrypt,
|
|
13
15
|
FmsKsFileUpload,
|
|
14
16
|
FmsKsFileView,
|
|
15
|
-
FmsScrollList
|
|
17
|
+
FmsScrollList,
|
|
18
|
+
FmsKsFormGrid,
|
|
19
|
+
FmsKsSearchTips
|
|
16
20
|
]
|
|
17
21
|
|
|
18
22
|
const install = function(Vue) {
|
|
@@ -28,7 +32,9 @@ export {
|
|
|
28
32
|
FmsKsDecrypt,
|
|
29
33
|
FmsKsFileUpload,
|
|
30
34
|
FmsKsFileView,
|
|
31
|
-
FmsScrollList
|
|
35
|
+
FmsScrollList,
|
|
36
|
+
FmsKsFormGrid,
|
|
37
|
+
FmsKsSearchTips
|
|
32
38
|
}
|
|
33
39
|
// 全量导出
|
|
34
40
|
export default {
|
package/vite.config.js
CHANGED
|
@@ -25,11 +25,22 @@ const getComponentEntries = () => {
|
|
|
25
25
|
|
|
26
26
|
export default defineConfig({
|
|
27
27
|
plugins: [
|
|
28
|
-
vueJsx(),
|
|
29
28
|
vue(),
|
|
29
|
+
vueJsx({
|
|
30
|
+
// 添加以下配置处理 .js 文件中的 JSX
|
|
31
|
+
include: /\.[jt]sx?$/, // 处理 .js 和 .jsx、.vue 文件
|
|
32
|
+
exclude: [/node_modules/] // 排除 node_modules
|
|
33
|
+
}),
|
|
30
34
|
libcss(),
|
|
31
35
|
libInjectCss()
|
|
32
36
|
],
|
|
37
|
+
// 添加以下优化配置
|
|
38
|
+
optimizeDeps: {
|
|
39
|
+
include: [
|
|
40
|
+
'**/*.js', // 显式包含 .js 文件
|
|
41
|
+
'**/*.jsx', // 包含 .jsx 文件
|
|
42
|
+
]
|
|
43
|
+
},
|
|
33
44
|
resolve: {
|
|
34
45
|
alias: {
|
|
35
46
|
'@': './src',
|