@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
|
File without changes
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ks-date-picker ks-daterange-select">
|
|
3
|
+
<van-calendar class="ks-daterange-select"
|
|
4
|
+
:class="canelFlag ? 'ks-daterange-select-canel' : ''"
|
|
5
|
+
ref="calendar"
|
|
6
|
+
:default-date="currentDate"
|
|
7
|
+
:poppable="false"
|
|
8
|
+
:show-confirm="false"
|
|
9
|
+
:show-title="false"
|
|
10
|
+
:show-subtitle="false"
|
|
11
|
+
:min-date="currentMin"
|
|
12
|
+
:max-date="currentMax"
|
|
13
|
+
:lazy-render="false"
|
|
14
|
+
:allow-same-day="true"
|
|
15
|
+
:formatter="formatter"
|
|
16
|
+
row-height="44"
|
|
17
|
+
type="range"
|
|
18
|
+
@select="handleSelect" />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import { formatToDate, formatToString } from './utils'
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: 'date-range-select',
|
|
28
|
+
props: {
|
|
29
|
+
defaultValue: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => ([])
|
|
32
|
+
},
|
|
33
|
+
formatter: [Function, Object],
|
|
34
|
+
min: [String, Number, Date],
|
|
35
|
+
max: [String, Number, Date]
|
|
36
|
+
},
|
|
37
|
+
data () {
|
|
38
|
+
return {
|
|
39
|
+
currentDate: [],
|
|
40
|
+
currentMin: new Date(),
|
|
41
|
+
currentMax: new Date(),
|
|
42
|
+
canelFlag: true,
|
|
43
|
+
scrollTop: 0
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
mounted () {
|
|
47
|
+
this.init()
|
|
48
|
+
},
|
|
49
|
+
mounted () {
|
|
50
|
+
// this.reset([new Date(), new Date()])
|
|
51
|
+
},
|
|
52
|
+
methods: {
|
|
53
|
+
init () {
|
|
54
|
+
if (this.defaultValue.length) {
|
|
55
|
+
this.currentDate = [formatToDate(this.defaultValue[0]), formatToDate(this.defaultValue[1])]
|
|
56
|
+
}
|
|
57
|
+
if (!this.min) {
|
|
58
|
+
let _date = new Date()
|
|
59
|
+
let y = _date.getFullYear()
|
|
60
|
+
let m = _date.getMonth() + 1
|
|
61
|
+
this.currentMin = (m - 6) < 1 ? new Date(y - 1, 12 + m - 5, 1) : new Date(y, m - 5, 1)
|
|
62
|
+
} else {
|
|
63
|
+
this.currentMin = formatToDate(this.min)
|
|
64
|
+
}
|
|
65
|
+
if (!this.max) {
|
|
66
|
+
let _date = new Date()
|
|
67
|
+
let y = _date.getFullYear()
|
|
68
|
+
let m = _date.getMonth() + 1
|
|
69
|
+
this.currentMax = (m + 6) > 12 ? new Date(y + 1, m + 6 - 12, 0) : new Date(y, m + 6, 0)
|
|
70
|
+
} else {
|
|
71
|
+
this.currentMax = formatToDate(this.max)
|
|
72
|
+
}
|
|
73
|
+
this.scrollToView()
|
|
74
|
+
},
|
|
75
|
+
handleSelect (e) {
|
|
76
|
+
this.$emit('select', { date: e, str: [formatToString(e[0]), formatToString(e[1])] })
|
|
77
|
+
this.canelFlag = false
|
|
78
|
+
|
|
79
|
+
},
|
|
80
|
+
scrollToView () {
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
this.$nextTick(() => {
|
|
83
|
+
this.autoScroll()
|
|
84
|
+
})
|
|
85
|
+
}, 30);
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* @description 初始化时自动往上滚动 用于解决ios部分机型初始化日历时白屏问题
|
|
89
|
+
*/
|
|
90
|
+
autoScroll () {
|
|
91
|
+
const scrollTop = this.$refs && this.$refs.calendar.$refs.body.scrollTop
|
|
92
|
+
this.scrollTop = scrollTop > 2 ? scrollTop : this.scrollTop
|
|
93
|
+
this.$refs.calendar.$refs.body.scrollTop = this.scrollTop - 2
|
|
94
|
+
},
|
|
95
|
+
// 滚动到某个日期
|
|
96
|
+
scrollToDate (date) {
|
|
97
|
+
console.log('scrollToDate date :>> ', date);
|
|
98
|
+
this.$refs && this.$refs['calendar'].scrollToDate(date)
|
|
99
|
+
},
|
|
100
|
+
// 重置
|
|
101
|
+
reset (date = null) {
|
|
102
|
+
this.$refs.calendar.defaultDate = [
|
|
103
|
+
new Date(),
|
|
104
|
+
new Date()
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
this.$refs && this.$refs['calendar'].reset(date)
|
|
108
|
+
},
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style lang="less">
|
|
115
|
+
@import url("./style.less");
|
|
116
|
+
.ks-daterange-select {
|
|
117
|
+
height: 100%;
|
|
118
|
+
.van-calendar__day {
|
|
119
|
+
margin: 3px 0;
|
|
120
|
+
}
|
|
121
|
+
.van-calendar__day--middle {
|
|
122
|
+
color: #7972fe !important;
|
|
123
|
+
&::after {
|
|
124
|
+
top: 0 !important;
|
|
125
|
+
bottom: 0 !important;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
.van-calendar__day--start,
|
|
129
|
+
.van-calendar__day--end {
|
|
130
|
+
margin-left: calc((14.285% - 44px) / 2);
|
|
131
|
+
margin-right: calc((14.285% - 44px) / 2);
|
|
132
|
+
}
|
|
133
|
+
.van-calendar__day--start-end {
|
|
134
|
+
margin-left: calc((14.285% - 54px) / 2);
|
|
135
|
+
margin-right: calc((14.285% - 54px) / 2);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
.ks-daterange-select-canel {
|
|
139
|
+
.van-calendar__day--start,
|
|
140
|
+
.van-calendar__day--end {
|
|
141
|
+
margin-left: calc((14.285% - 44px) / 2);
|
|
142
|
+
margin-right: calc((14.285% - 44px) / 2);
|
|
143
|
+
background-color: transparent;
|
|
144
|
+
color: #333;
|
|
145
|
+
}
|
|
146
|
+
.van-calendar__day--start-end {
|
|
147
|
+
margin-left: calc((14.285% - 54px) / 2);
|
|
148
|
+
margin-right: calc((14.285% - 54px) / 2);
|
|
149
|
+
background-color: transparent;
|
|
150
|
+
color: #333;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import HrSingleChoose from '../../hr-single-choose/index.js'
|
|
3
|
+
import dayjs from 'dayjs'
|
|
4
|
+
import DateSelect from './date-select.vue'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
name: 'HrDateFilter',
|
|
8
|
+
props: {
|
|
9
|
+
visible: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default () {
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
bottom: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default () {
|
|
18
|
+
return 0
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
height: {
|
|
22
|
+
type: Number,
|
|
23
|
+
default () {
|
|
24
|
+
return 518
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
position: {
|
|
28
|
+
type: String,
|
|
29
|
+
default () {
|
|
30
|
+
return 'bottom' // top
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
getContainer: {
|
|
34
|
+
type: String,
|
|
35
|
+
default () {
|
|
36
|
+
return ''
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
components: {
|
|
42
|
+
DateSelect
|
|
43
|
+
},
|
|
44
|
+
data () {
|
|
45
|
+
let today = dayjs().format('YYYY-MM-DD')
|
|
46
|
+
return {
|
|
47
|
+
list: [
|
|
48
|
+
{
|
|
49
|
+
label: '近7天',
|
|
50
|
+
value: 10,
|
|
51
|
+
ect: [dayjs().subtract(7, 'days').format('YYYY-MM-DD'), today]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: '近30天',
|
|
55
|
+
value: 20,
|
|
56
|
+
ect: [dayjs().subtract(30, 'days').format('YYYY-MM-DD'), today]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: '近90天',
|
|
60
|
+
value: 90,
|
|
61
|
+
ect: [dayjs().subtract(90, 'days').format('YYYY-MM-DD'), today]
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
minDate: new Date(2019, 5, 1),
|
|
65
|
+
defaultDate: [today, today],
|
|
66
|
+
currentDate: [],
|
|
67
|
+
top: 0,
|
|
68
|
+
checkValue: 0,
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
mounted () {
|
|
72
|
+
this.init()
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
init () {
|
|
76
|
+
this.initState()
|
|
77
|
+
},
|
|
78
|
+
initState () {
|
|
79
|
+
this.initTop()
|
|
80
|
+
this.initDatetimePicker()
|
|
81
|
+
},
|
|
82
|
+
initTop () {
|
|
83
|
+
if (this.getContainer) {
|
|
84
|
+
const doc = document.querySelector(this.getContainer)
|
|
85
|
+
const top = doc.getBoundingClientRect().top
|
|
86
|
+
const height = doc.offsetHeight
|
|
87
|
+
this.top = top + (this.position === 'bottom' ? height : 0)
|
|
88
|
+
} else {
|
|
89
|
+
this.top = 0
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
initDatetimePicker () {
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
this.$refs['datetimePicker'] && (this.$refs['datetimePicker'].canelFlag = false)
|
|
95
|
+
this.$refs['datetimePicker'] && this.$refs['datetimePicker'].init()
|
|
96
|
+
}, 0)
|
|
97
|
+
},
|
|
98
|
+
select (item) {
|
|
99
|
+
console.log(item)
|
|
100
|
+
},
|
|
101
|
+
formatter (dateObj) {
|
|
102
|
+
const [curYear, curMonth, curDay] = dayjs().format('YYYY-MM-DD').split('-')
|
|
103
|
+
const year = dateObj.date.getFullYear()
|
|
104
|
+
const month = dateObj.date.getMonth() + 1
|
|
105
|
+
const day = dateObj.date.getDate()
|
|
106
|
+
const flag = +curYear === year && +curMonth === month && +curDay === day
|
|
107
|
+
const text = '今天', className = 'van-calendar__day--today'
|
|
108
|
+
flag && (dateObj = { ...dateObj, text, className })
|
|
109
|
+
|
|
110
|
+
return dateObj
|
|
111
|
+
},
|
|
112
|
+
onChange (val) {
|
|
113
|
+
let { str } = val
|
|
114
|
+
this.currentDate = str
|
|
115
|
+
},
|
|
116
|
+
clearDate () {
|
|
117
|
+
this.currentDate = [null, null]
|
|
118
|
+
this.checkValue = -1
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
this.$refs['datetimePicker'].canelFlag = false
|
|
121
|
+
this.$refs['datetimePicker'].init()
|
|
122
|
+
}, 0)
|
|
123
|
+
this.$emit('submit', this.currentDate)
|
|
124
|
+
},
|
|
125
|
+
submitDate () {
|
|
126
|
+
// this.checkValue = -1
|
|
127
|
+
this.$emit('submit', this.currentDate)
|
|
128
|
+
},
|
|
129
|
+
selectShortcut (item) {
|
|
130
|
+
console.log(this.checkValue)
|
|
131
|
+
this.currentDate = item.ect
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
this.$refs['datetimePicker'].canelFlag = false
|
|
134
|
+
this.$refs['datetimePicker'].init()
|
|
135
|
+
}, 0)
|
|
136
|
+
this.$emit('submit', this.currentDate)
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
render () {
|
|
140
|
+
return <div class="hr-date-filter" style={{
|
|
141
|
+
top: `${this.top}px`,
|
|
142
|
+
bottom: `${this.bottom}px`,
|
|
143
|
+
display: this.visible ? 'block' : 'none'
|
|
144
|
+
}}>
|
|
145
|
+
<ks-popup
|
|
146
|
+
position="top"
|
|
147
|
+
value={this.visible}
|
|
148
|
+
onInput={(value) => {
|
|
149
|
+
this.$emit('input', value)
|
|
150
|
+
}}>
|
|
151
|
+
<div class="filter-content" style={{
|
|
152
|
+
height: `${this.height}px`
|
|
153
|
+
}}>
|
|
154
|
+
<div class="content-shortcut">
|
|
155
|
+
<HrSingleChoose checkValue={this.checkValue} list={this.list} onSelect={this.selectShortcut} />
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div class="content-date">
|
|
159
|
+
<DateSelect ref="datetimePicker"
|
|
160
|
+
min={this.minDate}
|
|
161
|
+
formatter={this.formatter}
|
|
162
|
+
defaultValue={this.currentDate.length ? this.currentDate : this.defaultDate}
|
|
163
|
+
onSelect={this.onChange} />
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div class="content-button">
|
|
167
|
+
<div class="button-reset">
|
|
168
|
+
<ks-button type="primary"
|
|
169
|
+
plain
|
|
170
|
+
hairline
|
|
171
|
+
disabled={!this.currentDate[1]}
|
|
172
|
+
onClick={this.clearDate}
|
|
173
|
+
size="large">重置</ks-button>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="button-confirm">
|
|
176
|
+
<ks-button type="primary"
|
|
177
|
+
disabled={!this.currentDate[1]}
|
|
178
|
+
onClick={this.submitDate}
|
|
179
|
+
size="large">确定</ks-button>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
</div>
|
|
184
|
+
</ks-popup>
|
|
185
|
+
</div>
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<style scoped lang="less">
|
|
191
|
+
span,
|
|
192
|
+
div {
|
|
193
|
+
box-sizing: border-box;
|
|
194
|
+
}
|
|
195
|
+
.hr-date-filter {
|
|
196
|
+
position: fixed;
|
|
197
|
+
top: 100px;
|
|
198
|
+
bottom: 0;
|
|
199
|
+
left: 0;
|
|
200
|
+
width: 100%;
|
|
201
|
+
z-index: 2003;
|
|
202
|
+
// background: rgba(0, 0, 0, 0.4);
|
|
203
|
+
overflow: hidden;
|
|
204
|
+
/deep/.van-overlay,
|
|
205
|
+
.van-popup {
|
|
206
|
+
position: absolute;
|
|
207
|
+
}
|
|
208
|
+
.van-popup {
|
|
209
|
+
border-radius: 0px 0px 12px 12px;
|
|
210
|
+
}
|
|
211
|
+
.filter-content {
|
|
212
|
+
height: 518px;
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
background: #fff;
|
|
216
|
+
border-radius: 0px 0px 12px 12px;
|
|
217
|
+
.content-shortcut {
|
|
218
|
+
padding: 12px 16px;
|
|
219
|
+
height: 64px;
|
|
220
|
+
}
|
|
221
|
+
.content-date {
|
|
222
|
+
// height: 390px;
|
|
223
|
+
flex: 1;
|
|
224
|
+
min-height: 0;
|
|
225
|
+
}
|
|
226
|
+
.content-button {
|
|
227
|
+
height: 64px;
|
|
228
|
+
display: flex;
|
|
229
|
+
padding: 8px 16px 16px;
|
|
230
|
+
border-radius: 0px 0px 12px 12px;
|
|
231
|
+
display: flex;
|
|
232
|
+
.button-reset {
|
|
233
|
+
margin-right: 12px;
|
|
234
|
+
flex: 1;
|
|
235
|
+
}
|
|
236
|
+
.button-confirm {
|
|
237
|
+
// margin-left: 6px;
|
|
238
|
+
flex: 1;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
</style>
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
|
|
14
|
+
&-split {
|
|
15
|
+
color: @day-text-color;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-end-not {
|
|
19
|
+
color: #ddd;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.footer-btn () {
|
|
24
|
+
height: 62px;
|
|
25
|
+
padding: 16px 16px 0 16px;
|
|
26
|
+
box-shadow: 0 0 4px 0 rgba(158, 155, 218, 0.22);
|
|
27
|
+
z-index: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 公共样式
|
|
31
|
+
.ks-date-picker {
|
|
32
|
+
&__body {
|
|
33
|
+
flex: 1;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
height: 100%;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 覆盖vant样式
|
|
41
|
+
.ks-date-picker {
|
|
42
|
+
.van-calendar__body {
|
|
43
|
+
height: 100%;
|
|
44
|
+
flex: 1;
|
|
45
|
+
overflow: auto;
|
|
46
|
+
-webkit-overflow-scrolling: touch;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.van-calendar__month-title {
|
|
50
|
+
height: 40px;
|
|
51
|
+
line-height: 40px;
|
|
52
|
+
color: @day-text-color;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.van-calendar__day {
|
|
56
|
+
color: @day-text-color;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.van-calendar__selected-day,
|
|
60
|
+
.van-calendar__day--start,
|
|
61
|
+
.van-calendar__day--end {
|
|
62
|
+
color: @selected-text-color;
|
|
63
|
+
background-color: @selected-bgcolor;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
width: 44px;
|
|
66
|
+
height: 44px;
|
|
67
|
+
line-height: 44px;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.van-calendar__day--start-end {
|
|
74
|
+
color: @selected-text-color;
|
|
75
|
+
background-color: @selected-bgcolor;
|
|
76
|
+
width: 54px;
|
|
77
|
+
height: 44px;
|
|
78
|
+
line-height: 44px;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
position: relative;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.van-calendar__day--middle:after {
|
|
86
|
+
top: 3px;
|
|
87
|
+
bottom: 3px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.van-calendar__day--start,
|
|
91
|
+
.van-calendar__day--end {
|
|
92
|
+
position: relative;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.van-calendar__day--start::after {
|
|
96
|
+
position: absolute;
|
|
97
|
+
left: 50%;
|
|
98
|
+
top: 0;
|
|
99
|
+
bottom: 0;
|
|
100
|
+
width: 85%;
|
|
101
|
+
content: " ";
|
|
102
|
+
background-color: rgba(121, 114, 254, .1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.van-calendar__day--end::after {
|
|
106
|
+
position: absolute;
|
|
107
|
+
right: 50%;
|
|
108
|
+
top: 0;
|
|
109
|
+
bottom: 0;
|
|
110
|
+
width: 85%;
|
|
111
|
+
content: " ";
|
|
112
|
+
background-color: rgba(121, 114, 254, .1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.van-calendar__bottom-info {
|
|
116
|
+
font-size: 10px;
|
|
117
|
+
line-height: 10px;
|
|
118
|
+
font-weight: 300;
|
|
119
|
+
bottom: 3px;
|
|
120
|
+
position: absolute;
|
|
121
|
+
right: 0;
|
|
122
|
+
left: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.van-calendar__confirm {
|
|
126
|
+
height: 44px;
|
|
127
|
+
line-height: 44px;
|
|
128
|
+
margin-top: 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -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
|
+
}
|