@kyfe/hroa-ui 1.0.4 → 1.0.6
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/hroa-ui.common.js +5345 -271
- package/dist/hroa-ui.css +1 -1
- package/dist/hroa-ui.umd.js +5345 -271
- package/dist/hroa-ui.umd.min.js +2 -2
- package/dist/img/header.7e31b1d5.png +0 -0
- package/lib/getJsModule/index.css +1 -1
- package/lib/getJsModule/index.js +2 -2
- package/lib/hr-add-list/index.js +1 -1
- package/lib/hr-bottom-button/index.js +1 -1
- package/lib/hr-breadcrumb/index.js +1 -1
- package/lib/hr-button/index.js +1 -1
- package/lib/hr-checkbox/index.css +1 -0
- package/lib/hr-checkbox/index.js +1 -0
- package/lib/hr-checkbox-group/index.css +1 -0
- package/lib/hr-checkbox-group/index.js +1 -0
- package/lib/hr-clipboard/index.js +1 -1
- package/lib/hr-collapse-card/index.css +1 -0
- package/lib/hr-collapse-card/index.js +1 -0
- package/lib/hr-condition-filtrate/index.js +1 -1
- package/lib/hr-condition-filtrate-popup/index.js +1 -1
- package/lib/hr-date-filter/index.css +1 -0
- package/lib/hr-date-filter/index.js +1 -0
- package/lib/hr-dropdown-date/index.css +1 -0
- package/lib/hr-dropdown-date/index.js +1 -0
- package/lib/hr-elasticity-box/index.js +1 -1
- package/lib/hr-elasticity-box-item/index.js +1 -1
- package/lib/hr-emotional-picture/index.js +1 -1
- package/lib/hr-employee-choose/index.js +1 -1
- package/lib/hr-file-list/index.css +1 -1
- package/lib/hr-file-list/index.js +1 -1
- package/lib/hr-full-screen/index.css +1 -0
- package/lib/hr-full-screen/index.js +1 -0
- package/lib/hr-img-list/index.js +1 -1
- package/lib/hr-info-card/index.js +1 -1
- package/lib/hr-information/index.css +1 -1
- package/lib/hr-information/index.js +1 -1
- package/lib/hr-license-plate-number/index.js +1 -1
- package/lib/hr-module-card/index.js +1 -1
- package/lib/hr-multiterm-choose/index.css +1 -1
- package/lib/hr-multiterm-choose/index.js +1 -1
- package/lib/hr-no-data/index.js +1 -1
- package/lib/hr-notice-bar/index.js +1 -1
- package/lib/hr-notification-dialog/index.css +1 -0
- package/lib/hr-notification-dialog/index.js +1 -0
- package/lib/hr-open-ks/index.js +1 -1
- package/lib/hr-pager/index.css +1 -1
- package/lib/hr-pager/index.js +1 -1
- package/lib/hr-popup/index.js +1 -1
- package/lib/hr-preview-file/index.js +1 -1
- package/lib/hr-radiobox/index.css +1 -0
- package/lib/hr-radiobox/index.js +1 -0
- package/lib/hr-radiobox-group/index.css +1 -0
- package/lib/hr-radiobox-group/index.js +1 -0
- package/lib/hr-rate/index.js +1 -1
- package/lib/hr-reason-textarea/index.js +1 -1
- package/lib/hr-search-input/index.js +1 -1
- package/lib/hr-search-tips/index.css +1 -0
- package/lib/hr-search-tips/index.js +9 -0
- package/lib/hr-select/index.js +1 -1
- package/lib/hr-select-list/index.js +1 -1
- package/lib/hr-single-choose/index.css +1 -1
- package/lib/hr-single-choose/index.js +1 -1
- package/lib/hr-slide-pager/index.css +1 -1
- package/lib/hr-slide-pager/index.js +1 -1
- package/lib/hr-sort/index.js +1 -1
- package/lib/hr-stack-image/index.js +1 -1
- package/lib/hr-tab-nav/index.css +1 -1
- package/lib/hr-tab-nav/index.js +1 -1
- package/lib/hr-time-picker/index.css +1 -0
- package/lib/hr-time-picker/index.js +1 -0
- package/lib/hr-view-item/index.js +1 -1
- package/lib/hr-virtual-list/index.css +1 -0
- package/lib/hr-virtual-list/index.js +1 -0
- package/lib/img/header.7e31b1d5.png +0 -0
- package/lib/index/index.css +1 -1
- package/lib/index/index.js +2 -2
- package/lib/utils/index.js +1 -1
- package/package.json +7 -3
- package/packages/hr-checkbox/index.js +8 -0
- package/packages/hr-checkbox/src/active-icon.png +0 -0
- package/packages/hr-checkbox/src/checkbox-group.vue +74 -0
- package/packages/hr-checkbox/src/checkbox.vue +226 -0
- package/packages/hr-checkbox/src/data.js +46 -0
- package/packages/hr-checkbox//345/244/215/351/200/211/346/241/206-/345/215/225/351/200/211/346/241/206.md +0 -0
- package/packages/hr-checkbox-group/index.js +8 -0
- package/packages/hr-collapse-card/index.js +3 -0
- package/packages/hr-collapse-card/src/images/icon_up.png +0 -0
- package/packages/hr-collapse-card/src/index.vue +151 -0
- package/packages/hr-collapse-card//346/212/230/345/217/240/345/215/241/347/211/207.md +0 -0
- package/packages/hr-date-filter/index.js +7 -0
- package/packages/hr-date-filter/src/date-select.vue +153 -0
- package/packages/hr-date-filter/src/index.vue +243 -0
- package/packages/hr-date-filter/src/style.less +130 -0
- package/packages/hr-date-filter/src/utils.js +109 -0
- package/packages/hr-dropdown-date/index.js +7 -0
- package/packages/hr-dropdown-date/src/calendar/calendar.js +128 -0
- package/packages/hr-dropdown-date/src/calendar/calendar.vue +485 -0
- package/packages/hr-dropdown-date/src/calendar/images/arrow@3x.png +0 -0
- package/packages/hr-dropdown-date/src/calendar/index.js +5 -0
- package/packages/hr-dropdown-date/src/date-picker/date-range-select.vue +92 -0
- package/packages/hr-dropdown-date/src/date-picker/month-range-select.vue +128 -0
- package/packages/hr-dropdown-date/src/date-picker/month-select.vue +98 -0
- package/packages/hr-dropdown-date/src/date-picker/style.less +120 -0
- package/packages/hr-dropdown-date/src/date-picker/utils.js +109 -0
- package/packages/hr-dropdown-date/src/index.vue +482 -0
- package/packages/hr-dropdown-date/src/week.js +194 -0
- package/packages/hr-file-list/src/index.vue +2 -2
- package/packages/hr-full-screen/index.js +7 -0
- package/packages/hr-full-screen/src/index.vue +117 -0
- package/packages/hr-information/src/index.vue +1 -0
- package/packages/hr-multiterm-choose/src/index.vue +4 -5
- package/packages/hr-notification-dialog/images/header.png +0 -0
- package/packages/hr-notification-dialog/index.js +7 -0
- package/packages/hr-notification-dialog/src/index.vue +293 -0
- package/packages/hr-notification-dialog//345/274/271/347/252/227/346/217/220/347/244/272/347/273/204/344/273/266.md +0 -0
- package/packages/hr-pager/index.js +1 -1
- package/packages/hr-pager/src/index.vue +34 -9
- package/packages/hr-radiobox/index.js +8 -0
- package/packages/hr-radiobox/src/data.js +46 -0
- package/packages/hr-radiobox/src/radiobox-group.vue +64 -0
- package/packages/hr-radiobox/src/radiobox.vue +191 -0
- package/packages/hr-radiobox-group/index.js +8 -0
- package/packages/hr-search-tips/index.js +3 -0
- package/packages/hr-search-tips/src/index.vue +213 -0
- package/packages/hr-search-tips//350/277/234/347/250/213/346/250/241/347/263/212/346/220/234/347/264/242.md +0 -0
- package/packages/hr-single-choose/src/index.vue +4 -5
- package/packages/hr-slide-pager/src/index.vue +3 -10
- package/packages/hr-tab-nav/src/index.vue +79 -4
- package/packages/hr-time-picker/index.js +3 -0
- package/packages/hr-time-picker/src/index.vue +85 -0
- package/packages/hr-time-picker//346/227/266/351/227/264/351/200/211/346/213/251/345/231/250.md +0 -0
- package/packages/hr-virtual-list/index.js +7 -0
- package/packages/hr-virtual-list/src/cc-item.vue +105 -0
- package/packages/hr-virtual-list/src/index.vue +227 -0
- package/packages/hr-virtual-list//350/231/232/346/213/237/345/210/227/350/241/250.md +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="van-calendar__body ks-date-picker"
|
|
3
|
+
ref="body">
|
|
4
|
+
<div class="van-calendar__month"
|
|
5
|
+
v-for="y of years"
|
|
6
|
+
:key="y">
|
|
7
|
+
<div class="van-calendar__month-title">{{y}}年</div>
|
|
8
|
+
<div class="van-calendar__days">
|
|
9
|
+
<div class="van-calendar__day ks-month__day"
|
|
10
|
+
v-for="m of months"
|
|
11
|
+
:key="m"
|
|
12
|
+
:class="{
|
|
13
|
+
'van-calendar__day--disabled': (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax)
|
|
14
|
+
}"
|
|
15
|
+
@click="handleSelect(y, m, (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax))">
|
|
16
|
+
<div :class="{
|
|
17
|
+
'van-calendar__day--start': +currentStart === +new Date(`${y}/${m}/1`) && +currentEnd !== +new Date(`${y}/${m}/1`),
|
|
18
|
+
'van-calendar__day--end': +currentEnd === +new Date(`${y}/${m}/1`) && +currentStart !== +new Date(`${y}/${m}/1`),
|
|
19
|
+
'van-calendar__day--middle': +currentStart < +new Date(`${y}/${m}/1`) && +currentEnd > +new Date(`${y}/${m}/1`),
|
|
20
|
+
'van-calendar__day--start-end': +currentStart === +new Date(`${y}/${m}/1`) && +currentEnd === +new Date(`${y}/${m}/1`)
|
|
21
|
+
}">
|
|
22
|
+
{{m}}月
|
|
23
|
+
<div v-if="+currentStart === +new Date(`${y}/${m}/1`) || +currentEnd === +new Date(`${y}/${m}/1`)"
|
|
24
|
+
class="van-calendar__bottom-info">
|
|
25
|
+
{{
|
|
26
|
+
+currentStart === +new Date(`${y}/${m}/1`) && +currentEnd === +new Date(`${y}/${m}/1`)
|
|
27
|
+
? '开始/结束'
|
|
28
|
+
: +currentStart === +new Date(`${y}/${m}/1`) && +currentEnd !== +new Date(`${y}/${m}/1`)
|
|
29
|
+
? '开始'
|
|
30
|
+
: '结束'
|
|
31
|
+
}}
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
import { getRangeYears, foramtToMonth, formatToString } from './utils'
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: 'month-range-select',
|
|
45
|
+
props: {
|
|
46
|
+
defaultValue: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => ([])
|
|
49
|
+
},
|
|
50
|
+
yearRange: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [new Date().getFullYear() - 5, new Date().getFullYear()],
|
|
53
|
+
},
|
|
54
|
+
horizontal: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
min: [String, Number, Date],
|
|
59
|
+
max: [String, Number, Date]
|
|
60
|
+
},
|
|
61
|
+
data () {
|
|
62
|
+
return {
|
|
63
|
+
years: getRangeYears(this.yearRange),
|
|
64
|
+
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
65
|
+
currentStart: null,
|
|
66
|
+
currentEnd: null,
|
|
67
|
+
currentMin: null,
|
|
68
|
+
currentMax: null
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
created () {
|
|
72
|
+
this.init()
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
init () {
|
|
76
|
+
this.currentMin = this.min ? +foramtToMonth(this.min) : null
|
|
77
|
+
this.currentMax = this.max ? +foramtToMonth(this.max) : null
|
|
78
|
+
if (this.defaultValue.length === 2) {
|
|
79
|
+
this.currentStart = foramtToMonth(this.defaultValue[0])
|
|
80
|
+
this.currentEnd = foramtToMonth(this.defaultValue[1])
|
|
81
|
+
}
|
|
82
|
+
this.scrollInto()
|
|
83
|
+
},
|
|
84
|
+
scrollInto () {
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
if (this.defaultValue.length === 2) {
|
|
87
|
+
let top = this.$el.querySelector('.van-calendar__day--start') || this.$el.querySelector('.van-calendar__day--start-end')
|
|
88
|
+
this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top + 80 : 0
|
|
89
|
+
} else {
|
|
90
|
+
if (this.$refs.body) {
|
|
91
|
+
this.$refs.body.scrollTop = 999
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, 200)
|
|
95
|
+
},
|
|
96
|
+
handleSelect (y, m, disabled) {
|
|
97
|
+
if (!disabled) {
|
|
98
|
+
let _month = foramtToMonth(`${y}/${m}`)
|
|
99
|
+
if (this.currentStart && !this.currentEnd && +this.currentStart <= +_month) {
|
|
100
|
+
this.currentEnd = _month
|
|
101
|
+
this.$emit('select', {
|
|
102
|
+
date: [this.currentStart, this.currentEnd],
|
|
103
|
+
str: [formatToString(this.currentStart, 'month'), formatToString(this.currentEnd, 'month')]
|
|
104
|
+
})
|
|
105
|
+
} else {
|
|
106
|
+
this.currentEnd = null
|
|
107
|
+
this.currentStart = _month
|
|
108
|
+
this.$emit('select', {
|
|
109
|
+
date: [this.currentStart, null],
|
|
110
|
+
str: [formatToString(this.currentStart, 'month'), '']
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style lang="less">
|
|
120
|
+
@import url("./style.less");
|
|
121
|
+
.van-calendar__body {
|
|
122
|
+
height: 100%;
|
|
123
|
+
}
|
|
124
|
+
.ks-month__day {
|
|
125
|
+
width: 16.666%;
|
|
126
|
+
height: 50px;
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
@@ -0,0 +1,98 @@
|
|
|
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">
|
|
7
|
+
<div class="van-calendar__month-title">{{ y }}年</div>
|
|
8
|
+
<div class="van-calendar__days">
|
|
9
|
+
<div class="van-calendar__day ks-month__day"
|
|
10
|
+
v-for="m of months"
|
|
11
|
+
:class="{'van-calendar__day--disabled': (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax)}"
|
|
12
|
+
:key="m"
|
|
13
|
+
@click="handleSelect(y, m, (currentMin && +new Date(`${y}/${m}/1`) < currentMin) || (currentMax && +new Date(`${y}/${m}/1`) > currentMax))">
|
|
14
|
+
<div :class="{'van-calendar__selected-day': +currentMonth === +new Date(`${y}/${m}/1`)}">{{ m }}月</div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
<script>
|
|
21
|
+
import { getRangeYears, foramtToMonth, formatToString } from './utils'
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
name: "month-select",
|
|
25
|
+
props: {
|
|
26
|
+
defaultValue: {
|
|
27
|
+
type: [Date, String, Number],
|
|
28
|
+
default: new Date()
|
|
29
|
+
},
|
|
30
|
+
yearRange: {
|
|
31
|
+
type: Array,
|
|
32
|
+
default: () => [new Date().getFullYear() - 5, new Date().getFullYear()],
|
|
33
|
+
},
|
|
34
|
+
horizontal: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
min: [String, Number, Date],
|
|
39
|
+
max: [String, Number, Date]
|
|
40
|
+
},
|
|
41
|
+
data () {
|
|
42
|
+
return {
|
|
43
|
+
years: getRangeYears(this.yearRange),
|
|
44
|
+
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
45
|
+
currentMonth: null,
|
|
46
|
+
currentMin: null,
|
|
47
|
+
currentMax: null
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
created () {
|
|
51
|
+
this.init()
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
init () {
|
|
55
|
+
this.currentMonth = foramtToMonth(this.defaultValue)
|
|
56
|
+
console.log('this.currentMonth111', this.currentMonth)
|
|
57
|
+
this.currentMin = this.min ? +foramtToMonth(this.min) : null
|
|
58
|
+
this.currentMax = this.max ? +foramtToMonth(this.max) : null
|
|
59
|
+
// let monthStr = formatToString(this.currentMonth, 'month')
|
|
60
|
+
// let arr = monthStr.split('/')
|
|
61
|
+
// this.handleSelect(arr[0], arr[1], false)
|
|
62
|
+
this.scrollInto()
|
|
63
|
+
},
|
|
64
|
+
scrollInto () {
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
if (this.currentMonth) {
|
|
67
|
+
let top = this.$el.querySelector('.van-calendar__selected-day')
|
|
68
|
+
this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top + 100 : 0
|
|
69
|
+
} else {
|
|
70
|
+
if (this.$refs.body) {
|
|
71
|
+
this.$refs.body.scrollTop = 999
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, 200)
|
|
75
|
+
},
|
|
76
|
+
handleSelect (y, m, disabled) {
|
|
77
|
+
if (!disabled) {
|
|
78
|
+
this.currentMonth = foramtToMonth(`${y}/${m}`)
|
|
79
|
+
this.$emit("select", { date: this.currentMonth, str: formatToString(this.currentMonth, 'month') })
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style lang="less" scoped>
|
|
87
|
+
.van-calendar__body {
|
|
88
|
+
height: 100%;
|
|
89
|
+
}
|
|
90
|
+
.ks-month__day {
|
|
91
|
+
width: 16.666%;
|
|
92
|
+
height: 50px;
|
|
93
|
+
}
|
|
94
|
+
.van-calendar__selected-day {
|
|
95
|
+
color: #fff;
|
|
96
|
+
background-color: #7972fe;
|
|
97
|
+
}
|
|
98
|
+
</style>
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
}
|
|
53
|
+
.van-calendar__selected-day, .van-calendar__day--start, .van-calendar__day--end {
|
|
54
|
+
color: @selected-text-color;
|
|
55
|
+
background-color: @selected-bgcolor;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
width: 44px;
|
|
58
|
+
height: 44px;
|
|
59
|
+
line-height: 44px;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.van-calendar__day--start-end {
|
|
66
|
+
color: @selected-text-color;
|
|
67
|
+
background-color: @selected-bgcolor;
|
|
68
|
+
width: 54px;
|
|
69
|
+
height: 44px;
|
|
70
|
+
line-height: 44px;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
position: relative;
|
|
75
|
+
}
|
|
76
|
+
.van-calendar__day--middle:after {
|
|
77
|
+
top: 3px;
|
|
78
|
+
bottom: 3px;
|
|
79
|
+
}
|
|
80
|
+
.van-calendar__day--start, .van-calendar__day--end {
|
|
81
|
+
position: relative;
|
|
82
|
+
}
|
|
83
|
+
.van-calendar__day--start::after {
|
|
84
|
+
position: absolute;
|
|
85
|
+
left: 50%;
|
|
86
|
+
top: 0;
|
|
87
|
+
bottom: 0;
|
|
88
|
+
width: 85%;
|
|
89
|
+
content: " ";
|
|
90
|
+
background-color: rgba(121,114,254,.1);
|
|
91
|
+
}
|
|
92
|
+
.van-calendar__day--end::after {
|
|
93
|
+
position: absolute;
|
|
94
|
+
right: 50%;
|
|
95
|
+
top: 0;
|
|
96
|
+
bottom: 0;
|
|
97
|
+
width: 85%;
|
|
98
|
+
content: " ";
|
|
99
|
+
background-color: rgba(121,114,254,.1);
|
|
100
|
+
}
|
|
101
|
+
.van-calendar__bottom-info {
|
|
102
|
+
font-size: 10px;
|
|
103
|
+
line-height: 10px;
|
|
104
|
+
font-weight: 300;
|
|
105
|
+
bottom: 3px;
|
|
106
|
+
position: absolute;
|
|
107
|
+
right: 0;
|
|
108
|
+
left: 0;
|
|
109
|
+
}
|
|
110
|
+
.van-calendar__confirm {
|
|
111
|
+
height: 44px;
|
|
112
|
+
line-height: 44px;
|
|
113
|
+
margin-top: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.van-calendar__day--disabled {
|
|
117
|
+
color: #c8c9cc;
|
|
118
|
+
cursor: default;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -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
|
+
}
|