@kyfe/fms-vue2-components 0.0.2 → 0.0.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/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,66 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-calendar
|
|
3
|
+
:default-date="currentDate"
|
|
4
|
+
:poppable="false"
|
|
5
|
+
:show-confirm="false"
|
|
6
|
+
:show-title="false"
|
|
7
|
+
:show-subtitle="false"
|
|
8
|
+
:min-date="currentMin"
|
|
9
|
+
:max-date="currentMax"
|
|
10
|
+
:lazy-render="false"
|
|
11
|
+
row-height="50"
|
|
12
|
+
type="single"
|
|
13
|
+
@select="handleSelect"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { formatToDate, formatToString } from './utils'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: 'date-select',
|
|
22
|
+
props: {
|
|
23
|
+
defaultValue: {
|
|
24
|
+
type: [Date, String, Number],
|
|
25
|
+
default: new Date()
|
|
26
|
+
},
|
|
27
|
+
min: [String, Number, Date],
|
|
28
|
+
max: [String, Number, Date]
|
|
29
|
+
},
|
|
30
|
+
data () {
|
|
31
|
+
return {
|
|
32
|
+
currentDate: null,
|
|
33
|
+
currentMin: new Date(),
|
|
34
|
+
currentMax: new Date()
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
created () {
|
|
38
|
+
this.init()
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
init () {
|
|
42
|
+
this.currentDate = formatToDate(this.defaultValue)
|
|
43
|
+
if (!this.min) {
|
|
44
|
+
let _date = new Date()
|
|
45
|
+
let y = _date.getFullYear()
|
|
46
|
+
let m = _date.getMonth() + 1
|
|
47
|
+
this.currentMin = (m - 6) < 1 ? new Date(y - 1, 12 + m - 5, 1) : new Date(y, m - 5, 1)
|
|
48
|
+
} else {
|
|
49
|
+
this.currentMin = formatToDate(this.min)
|
|
50
|
+
}
|
|
51
|
+
if (!this.max) {
|
|
52
|
+
let _date = new Date()
|
|
53
|
+
let y = _date.getFullYear()
|
|
54
|
+
let m = _date.getMonth() + 1
|
|
55
|
+
this.currentMax = (m + 6) > 12 ? new Date(y + 1, m + 6 - 12, 0) : new Date(y, m + 6, 0)
|
|
56
|
+
} else {
|
|
57
|
+
this.currentMax = formatToDate(this.max)
|
|
58
|
+
}
|
|
59
|
+
this.handleSelect(this.currentDate)
|
|
60
|
+
},
|
|
61
|
+
handleSelect (e) {
|
|
62
|
+
this.$emit('select', {date: e, str: formatToString(e)})
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ks-date-week-month-picker">
|
|
3
|
+
<div class="ks-date-week-month-picker__header">
|
|
4
|
+
<div class="ks-date-week-month-picker__header-btn">
|
|
5
|
+
<van-button
|
|
6
|
+
:class="{'ks-date-week-month-picker__header-btn__action': currentType === 'date'}"
|
|
7
|
+
round
|
|
8
|
+
@click="handleChangeType('date')"
|
|
9
|
+
>
|
|
10
|
+
日期选择
|
|
11
|
+
</van-button>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="ks-date-week-month-picker__header-btn">
|
|
14
|
+
<van-button
|
|
15
|
+
:class="{'ks-date-week-month-picker__header-btn__action': currentType === 'week'}"
|
|
16
|
+
round
|
|
17
|
+
@click="handleChangeType('week')"
|
|
18
|
+
>
|
|
19
|
+
周选择
|
|
20
|
+
</van-button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="ks-date-week-month-picker__header-btn">
|
|
23
|
+
<van-button
|
|
24
|
+
:class="{'ks-date-week-month-picker__header-btn__action': currentType === 'month'}"
|
|
25
|
+
round
|
|
26
|
+
@click="handleChangeType('month')"
|
|
27
|
+
>
|
|
28
|
+
月份选择
|
|
29
|
+
</van-button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="ks-date-week-month-picker__body">
|
|
33
|
+
<component
|
|
34
|
+
ref="com"
|
|
35
|
+
:is="currentCom"
|
|
36
|
+
v-bind="$attrs"
|
|
37
|
+
@select="handleSelect"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import {
|
|
45
|
+
DateSelect,
|
|
46
|
+
MonthSelect,
|
|
47
|
+
WeekSelect
|
|
48
|
+
} from './index'
|
|
49
|
+
import { typeToSelectotMap } from './utils'
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
name: 'date-week-month',
|
|
53
|
+
components: {
|
|
54
|
+
DateSelect,
|
|
55
|
+
MonthSelect,
|
|
56
|
+
WeekSelect
|
|
57
|
+
},
|
|
58
|
+
data () {
|
|
59
|
+
return {
|
|
60
|
+
currentType: 'date'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
computed: {
|
|
64
|
+
currentCom () {
|
|
65
|
+
return typeToSelectotMap[this.currentType]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
init () {
|
|
70
|
+
this.$refs.com.init()
|
|
71
|
+
},
|
|
72
|
+
handleChangeType (e) {
|
|
73
|
+
this.currentType = e
|
|
74
|
+
this.$emit('change-type', e)
|
|
75
|
+
this.$nextTick(() => {
|
|
76
|
+
this.init()
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
handleSelect (e) {
|
|
80
|
+
this.$emit('select', e, this.currentType)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style lang="less">
|
|
87
|
+
.ks-date-week-month-picker {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: 0;
|
|
92
|
+
bottom: 0;
|
|
93
|
+
left: 0;
|
|
94
|
+
right: 0;
|
|
95
|
+
&__header {
|
|
96
|
+
height: 62px;
|
|
97
|
+
display: flex;
|
|
98
|
+
box-shadow: 0 3px 10px 0 rgba(235,235,235,0.30);
|
|
99
|
+
&-btn {
|
|
100
|
+
flex: 1;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
.van-button--normal {
|
|
105
|
+
font-size: 14px;
|
|
106
|
+
color: #2F2F2F;
|
|
107
|
+
}
|
|
108
|
+
.van-button--default {
|
|
109
|
+
background-color: #F3F4F6;
|
|
110
|
+
border-color: #F3F4F6;
|
|
111
|
+
}
|
|
112
|
+
&__action {
|
|
113
|
+
background-color: #F1F0FE !important;
|
|
114
|
+
border-color: rgba(121,114,254,0.30) !important;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
&__body {
|
|
119
|
+
flex: 1;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
position: relative;
|
|
122
|
+
> .van-calendar, > .van-calendar__body {
|
|
123
|
+
position: absolute;
|
|
124
|
+
bottom: 0;
|
|
125
|
+
top: 0;
|
|
126
|
+
left: 0;
|
|
127
|
+
right: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// export { default as DateSelect } from './date-select.vue'
|
|
2
|
+
// export { default as DateRangeSelect } from './date-range-select.vue'
|
|
3
|
+
// export { default as MonthSelect } from './month-select.vue'
|
|
4
|
+
// export { default as MonthRangeSelect } from './month-range-select.vue'
|
|
5
|
+
// export { default as WeekSelect } from './week-select.vue'
|
|
6
|
+
// export { default as QuarterSelect } from './quarter-select.vue'
|
|
7
|
+
// export { default as DateWeekMonth } from './date-week-month.vue'
|
|
8
|
+
// export { default as DatePickerBottom } from './date-picker-bottom.vue'
|
|
9
|
+
// export { default as DatePickerTop } from './date-picker-top.vue'
|
|
10
|
+
// export { default as DatePickerRight } from './date-picker-right.vue'
|
|
11
|
+
// export { default as DatePickerDropdown } from './date-picker-dropdown.vue'
|
|
12
|
+
// export { default } from './date-picker.js'
|
|
13
|
+
|
|
14
|
+
const dateSelect = () => import( /* webpackChunkName: "date-select" */ './date-select.vue')
|
|
15
|
+
const dateRangeSelect = () => import( /* webpackChunkName: "date-range-select" */ './date-range-select.vue')
|
|
16
|
+
const monthSelect = () => import( /* webpackChunkName: "month-select" */ './month-select.vue')
|
|
17
|
+
const monthRangeSelect = () => import( /* webpackChunkName: "month-range-select" */ './month-range-select.vue')
|
|
18
|
+
|
|
19
|
+
const weekSelect = () => import( /* webpackChunkName: "week-select" */ './week-select.vue')
|
|
20
|
+
const quarterSelect = () => import( /* webpackChunkName: "quarter-select" */ './quarter-select.vue')
|
|
21
|
+
const dateWeekMonth = () => import( /* webpackChunkName: "date-week-month" */ './date-week-month.vue')
|
|
22
|
+
const datePickerBottom = () => import( /* webpackChunkName: "date-picker-bottom" */ './date-picker-bottom.vue')
|
|
23
|
+
const datePickerTop = () => import( /* webpackChunkName: "date-picker-top" */ './date-picker-top.vue')
|
|
24
|
+
const datePickerRight = () => import( /* webpackChunkName: "date-picker-right" */ './date-picker-right.vue')
|
|
25
|
+
const datePickerDropdown = () => import( /* webpackChunkName: "date-picker-dropdown" */ './date-picker-dropdown.vue')
|
|
26
|
+
|
|
27
|
+
export { default } from './date-picker.js'
|
|
28
|
+
export const DateSelect = dateSelect
|
|
29
|
+
export const DateRangeSelect = dateRangeSelect
|
|
30
|
+
export const MonthSelect = monthSelect
|
|
31
|
+
export const MonthRangeSelect = monthRangeSelect
|
|
32
|
+
export const WeekSelect = weekSelect
|
|
33
|
+
export const QuarterSelect = quarterSelect
|
|
34
|
+
export const DateWeekMonth = dateWeekMonth
|
|
35
|
+
export const DatePickerBottom = datePickerBottom
|
|
36
|
+
export const DatePickerTop = datePickerTop
|
|
37
|
+
export const DatePickerRight = datePickerRight
|
|
38
|
+
export const DatePickerDropdown = datePickerDropdown
|
|
39
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { typeToSelectotMap } from './utils'
|
|
2
|
+
import {
|
|
3
|
+
DateSelect,
|
|
4
|
+
DateRangeSelect,
|
|
5
|
+
MonthSelect,
|
|
6
|
+
MonthRangeSelect,
|
|
7
|
+
WeekSelect,
|
|
8
|
+
QuarterSelect,
|
|
9
|
+
DateWeekMonth
|
|
10
|
+
} from './index'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
components: {
|
|
14
|
+
DateSelect,
|
|
15
|
+
DateRangeSelect,
|
|
16
|
+
MonthSelect,
|
|
17
|
+
MonthRangeSelect,
|
|
18
|
+
WeekSelect,
|
|
19
|
+
QuarterSelect,
|
|
20
|
+
DateWeekMonth
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
value: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
type: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'date'
|
|
30
|
+
},
|
|
31
|
+
showConfirm: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
data () {
|
|
37
|
+
return {
|
|
38
|
+
currentCom: null,
|
|
39
|
+
currentSelectedValue: null,
|
|
40
|
+
startText: '',
|
|
41
|
+
endText: ''
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
init () {
|
|
46
|
+
this.currentCom = typeToSelectotMap[this.type]
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
this.$nextTick(() => {
|
|
49
|
+
this.$refs.selector && this.$refs.selector.init()
|
|
50
|
+
})
|
|
51
|
+
}, 100)
|
|
52
|
+
},
|
|
53
|
+
handleOpenPopup () {
|
|
54
|
+
this.init()
|
|
55
|
+
},
|
|
56
|
+
handleClosePopup (e) {
|
|
57
|
+
this.$emit('input', e)
|
|
58
|
+
this.currentCom = null
|
|
59
|
+
this.currentSelectedValue = null
|
|
60
|
+
this.startText = ''
|
|
61
|
+
this.endText = ''
|
|
62
|
+
},
|
|
63
|
+
handleSelect (e, type = this.type) {
|
|
64
|
+
this.$emit('select', e)
|
|
65
|
+
this.currentSelectedValue = e
|
|
66
|
+
if (this.type === 'dateweekmonth') {
|
|
67
|
+
this.dateweekmonthType = type
|
|
68
|
+
}
|
|
69
|
+
if (type === 'week') {
|
|
70
|
+
this.startText = `${e.year}年 ${e.num < 10 ? '0' + e.num : e.num}周(${e.week.startDayStr}~${e.week.endDayStr})`
|
|
71
|
+
} else if (type === 'quarter') {
|
|
72
|
+
this.startText = `${e.year}年 ${e.cn}`
|
|
73
|
+
} else if (type === 'month' || type === 'date') {
|
|
74
|
+
this.startText = e.str
|
|
75
|
+
} else if (type === 'monthrange' || type === 'daterange') {
|
|
76
|
+
this.startText = e.str[0]
|
|
77
|
+
this.endText = e.str[1]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
handleConfirm () {
|
|
81
|
+
this.$emit('confirm', this.currentSelectedValue)
|
|
82
|
+
// this.handleClosePopup(false)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
: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
|
+
methods: {
|
|
72
|
+
init () {
|
|
73
|
+
this.currentMin = this.min ? +foramtToMonth(this.min) : null
|
|
74
|
+
this.currentMax = this.max ? +foramtToMonth(this.max) : null
|
|
75
|
+
if (this.defaultValue.length === 2) {
|
|
76
|
+
let _start = foramtToMonth(this.defaultValue[0])
|
|
77
|
+
let _end = foramtToMonth(this.defaultValue[1])
|
|
78
|
+
if (_start && _end) {
|
|
79
|
+
this.currentStart = _start
|
|
80
|
+
let monthStr = formatToString(_end, 'month')
|
|
81
|
+
let arr = monthStr.split('/')
|
|
82
|
+
this.handleSelect(arr[0], arr[1], false)
|
|
83
|
+
} else if (_start && !_end) {
|
|
84
|
+
let monthStr = formatToString(_start, 'month')
|
|
85
|
+
let arr = monthStr.split('/')
|
|
86
|
+
this.handleSelect(arr[0], arr[1], false)
|
|
87
|
+
}
|
|
88
|
+
this.scrollInto()
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
scrollInto () {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
if (this.currentMonth) {
|
|
94
|
+
let top = this.$el.querySelector('.van-calendar__day--start')
|
|
95
|
+
this.$refs.body && (this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0)
|
|
96
|
+
}
|
|
97
|
+
}, 240)
|
|
98
|
+
},
|
|
99
|
+
handleSelect (y, m, disabled) {
|
|
100
|
+
if (!disabled) {
|
|
101
|
+
let _month = foramtToMonth(`${y}/${m}`)
|
|
102
|
+
if (this.currentStart && !this.currentEnd && +this.currentStart <= +_month) {
|
|
103
|
+
this.currentEnd = _month
|
|
104
|
+
this.$emit('select', {
|
|
105
|
+
date: [this.currentStart, this.currentEnd],
|
|
106
|
+
str: [formatToString(this.currentStart, 'month'), formatToString(this.currentEnd, 'month')]
|
|
107
|
+
})
|
|
108
|
+
} else {
|
|
109
|
+
this.currentEnd = null
|
|
110
|
+
this.currentStart = _month
|
|
111
|
+
this.$emit('select', {
|
|
112
|
+
date: [this.currentStart, null],
|
|
113
|
+
str: [formatToString(this.currentStart, 'month'), '']
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
</script>
|
|
121
|
+
|
|
122
|
+
<style lang="less">
|
|
123
|
+
.ks-month__day {
|
|
124
|
+
width: 16.666%;
|
|
125
|
+
height: 50px;
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
+
methods: {
|
|
51
|
+
init () {
|
|
52
|
+
this.currentMonth = foramtToMonth(this.defaultValue)
|
|
53
|
+
console.log('this.currentMonth111', this.currentMonth)
|
|
54
|
+
this.currentMin = this.min ? +foramtToMonth(this.min) : null
|
|
55
|
+
this.currentMax = this.max ? +foramtToMonth(this.max) : null
|
|
56
|
+
let monthStr = formatToString(this.currentMonth, 'month')
|
|
57
|
+
let arr = monthStr.split('/')
|
|
58
|
+
this.handleSelect(arr[0], arr[1], false)
|
|
59
|
+
this.scrollInto()
|
|
60
|
+
},
|
|
61
|
+
scrollInto () {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
if (this.currentMonth) {
|
|
64
|
+
let top = this.$el.querySelector('.van-calendar__selected-day')
|
|
65
|
+
this.$refs.body && (this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0)
|
|
66
|
+
}
|
|
67
|
+
}, 240)
|
|
68
|
+
},
|
|
69
|
+
handleSelect (y, m, disabled) {
|
|
70
|
+
if (!disabled) {
|
|
71
|
+
this.currentMonth = foramtToMonth(`${y}/${m}`)
|
|
72
|
+
this.$emit("select", { date: this.currentMonth, str: formatToString(this.currentMonth, 'month') })
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<style lang="less">
|
|
80
|
+
.ks-month__day {
|
|
81
|
+
width: 16.666%;
|
|
82
|
+
height: 50px;
|
|
83
|
+
// .van-calendar__day--start::after, .van-calendar__day--end::after {
|
|
84
|
+
// width: !important;
|
|
85
|
+
// }
|
|
86
|
+
}
|
|
87
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
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-quarter__day"
|
|
10
|
+
v-for="(value, key) of cnQuarters"
|
|
11
|
+
:key="key"
|
|
12
|
+
@click="handleSelect(y, key)">
|
|
13
|
+
<div :class="{'ks-quarter__selected-day': String(y) === String(currentYear) && String(key) === String(currentQuarter)}">
|
|
14
|
+
{{value}}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
import { getRangeYears } from './utils'
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: 'quarter-select',
|
|
27
|
+
props: {
|
|
28
|
+
defaultValue: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: (function () {
|
|
31
|
+
let _quarters = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4]
|
|
32
|
+
let _date = new Date()
|
|
33
|
+
let y = _date.getFullYear()
|
|
34
|
+
let m = _date.getMonth()
|
|
35
|
+
return `${y}-${_quarters[m]}`
|
|
36
|
+
}())
|
|
37
|
+
},
|
|
38
|
+
yearRange: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => ([new Date().getFullYear() - 2, new Date().getFullYear()])
|
|
41
|
+
},
|
|
42
|
+
horizontal: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data () {
|
|
48
|
+
return {
|
|
49
|
+
years: getRangeYears(this.yearRange),
|
|
50
|
+
cnQuarters: {
|
|
51
|
+
'1': '一季度',
|
|
52
|
+
'2': '二季度',
|
|
53
|
+
'3': '三季度',
|
|
54
|
+
'4': '四季度'
|
|
55
|
+
},
|
|
56
|
+
currentYear: null,
|
|
57
|
+
currentQuarter: null
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
methods: {
|
|
61
|
+
init () {
|
|
62
|
+
let arr = this.defaultValue.split('-')
|
|
63
|
+
this.handleSelect(arr[0], arr[1])
|
|
64
|
+
this.scrollInto()
|
|
65
|
+
},
|
|
66
|
+
scrollInto () {
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
let top = this.$el.querySelector('.ks-quarte__selected-day')
|
|
69
|
+
this.$refs.body && (this.$refs.body.scrollTop = top ? top.getBoundingClientRect().top - 100 : 0)
|
|
70
|
+
}, 240)
|
|
71
|
+
},
|
|
72
|
+
handleSelect (y, q) {
|
|
73
|
+
this.currentYear = y
|
|
74
|
+
this.currentQuarter = q
|
|
75
|
+
this.$emit('select', { year: y, quarter: q, cn: this.cnQuarters[q] })
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="less">
|
|
82
|
+
.ks-quarter__day {
|
|
83
|
+
width: 25%;
|
|
84
|
+
height: 74px;
|
|
85
|
+
}
|
|
86
|
+
.ks-quarter__selected-day {
|
|
87
|
+
height: 32px;
|
|
88
|
+
line-height: 32px;
|
|
89
|
+
font-size: 14px;
|
|
90
|
+
background-color: #7972fe;
|
|
91
|
+
color: #fff;
|
|
92
|
+
padding: 0 16px;
|
|
93
|
+
border-radius: 999px;
|
|
94
|
+
}
|
|
95
|
+
</style>
|