fusions-ui 1.2.3 → 1.2.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/components/fu-avatar/fu-avatar.vue +4 -2
- package/components/fu-avatar/props.js +52 -15
- package/components/fu-avatar-group/fu-avatar-group.vue +3 -2
- package/components/fu-avatar-group/props.js +31 -9
- package/components/fu-badge/fu-badge.vue +8 -14
- package/components/fu-badge/props.js +56 -16
- package/components/fu-banner-arc/fu-banner-arc.vue +4 -5
- package/components/fu-banner-arc/props.js +15 -4
- package/components/fu-button/fu-button.vue +18 -19
- package/components/fu-button/props.js +108 -35
- package/components/fu-cell/fu-cell.vue +9 -8
- package/components/fu-cell-group/fu-cell-group.vue +2 -1
- package/components/fu-cell-group/props.js +7 -2
- package/components/fu-checkbox/fu-checkbox.vue +5 -4
- package/components/fu-checkbox/props.js +51 -14
- package/components/fu-code-input/fu-code-input.vue +10 -6
- package/components/fu-code-input/props.js +66 -17
- package/components/fu-code-verify/fu-code-verify.vue +9 -5
- package/components/fu-code-verify/props.js +64 -17
- package/components/fu-collapse/fu-collapse.vue +10 -3
- package/components/fu-collapse/props.js +9 -3
- package/components/fu-collapse-item/fu-collapse-item.vue +45 -31
- package/components/fu-collapse-item/props.js +49 -16
- package/components/fu-countdown/fu-countdown.vue +2 -1
- package/components/fu-countdown/props.js +15 -4
- package/components/fu-datetime-picker/fu-datetime-picker.vue +6 -5
- package/components/fu-datetime-picker/props.js +91 -25
- package/components/fu-form/fu-form.vue +2 -1
- package/components/fu-form/props.js +34 -6
- package/components/fu-form-item/fu-form-item.vue +46 -56
- package/components/fu-form-item/props.js +34 -7
- package/components/fu-grid/fu-grid.vue +16 -17
- package/components/fu-grid/props.js +20 -5
- package/components/fu-grid-item/fu-grid-item.vue +31 -35
- package/components/fu-grid-item/props.js +11 -3
- package/components/fu-icon/fu-icon.vue +107 -0
- package/components/fu-icon/icon.css +584 -0
- package/components/{fu-icons/icons.js → fu-icon/icon.js} +1031 -1031
- package/components/{fu-icons/fuicons.ttf → fu-icon/icon.ttf} +0 -0
- package/components/fu-icon/props.js +55 -0
- package/components/fu-image/fu-image.vue +15 -10
- package/components/fu-image/props.js +69 -18
- package/components/fu-index-anchor/fu-index-anchor.vue +6 -5
- package/components/fu-index-anchor/props.js +20 -6
- package/components/fu-index-item/fu-index-item.vue +4 -4
- package/components/fu-index-list/fu-index-list.vue +9 -9
- package/components/fu-index-list/props.js +19 -6
- package/components/fu-input/fu-input.vue +54 -68
- package/components/fu-input/props.js +145 -53
- package/components/fu-keyboard/fu-keyboard.vue +19 -9
- package/components/fu-keyboard/keyboard-car.vue +33 -22
- package/components/fu-keyboard/keyboard-number.vue +17 -9
- package/components/fu-keyboard/props.js +66 -17
- package/components/fu-line/fu-line.vue +17 -13
- package/components/fu-line/props.js +30 -5
- package/components/fu-link/fu-link.vue +14 -8
- package/components/fu-link/props.js +22 -7
- package/components/fu-loading/fu-loading.vue +32 -27
- package/components/fu-loading/props.js +28 -8
- package/components/fu-loading-more/fu-loading-more.vue +19 -23
- package/components/fu-loading-more/props.js +27 -13
- package/components/fu-modal/fu-modal.vue +11 -6
- package/components/fu-modal/props.js +61 -17
- package/components/{fu-nav-bar/fu-nav-bar.vue → fu-navbar/fu-navbar.vue} +37 -44
- package/components/fu-notice-bar/fu-notice-bar.vue +10 -8
- package/components/fu-notice-bar/notice-column.vue +187 -122
- package/components/fu-notice-bar/notice-row.vue +85 -28
- package/components/fu-notice-bar/props.js +83 -22
- package/components/fu-number-box/fu-number-box.vue +26 -28
- package/components/fu-number-box/props.js +37 -11
- package/components/fu-parse/fu-parse.vue +0 -1
- package/components/fu-picker/fu-picker.vue +22 -17
- package/components/fu-picker/props.js +70 -19
- package/components/fu-popup/fu-popup.vue +39 -44
- package/components/fu-popup/props.js +34 -9
- package/components/fu-progress/fu-progress.vue +3 -2
- package/components/fu-progress/props.js +36 -9
- package/components/fu-rate/fu-rate.vue +40 -32
- package/components/fu-rate/props.js +47 -13
- package/components/fu-read-more/fu-read-more.vue +19 -14
- package/components/fu-read-more/props.js +68 -46
- package/components/fu-ribbon/fu-ribbon.vue +8 -7
- package/components/fu-ribbon/props.js +15 -4
- package/components/fu-scroll-list/fu-scroll-list.vue +18 -34
- package/components/fu-scroll-list/props.js +19 -10
- package/components/fu-search/fu-search.vue +13 -18
- package/components/fu-search/props.js +69 -17
- package/components/fu-section/fu-section.vue +19 -22
- package/components/fu-section/props.js +30 -4
- package/components/fu-sign-board/fu-sign-board.vue +18 -3
- package/components/fu-sign-board/props.js +15 -5
- package/components/fu-skeleton/fu-skeleton.vue +8 -12
- package/components/fu-skeleton/props.js +15 -4
- package/components/fu-steps/fu-steps.vue +3 -2
- package/components/fu-steps/props.js +23 -7
- package/components/fu-steps-item/fu-steps-item.vue +3 -3
- package/components/fu-steps-item/props.js +15 -5
- package/components/fu-sticky/fu-sticky.vue +3 -3
- package/components/fu-sticky/props.js +21 -7
- package/components/fu-subsection/fu-subsection.vue +29 -22
- package/components/fu-subsection/props.js +40 -10
- package/components/fu-swipe-action-item/bindingx.js +1 -1
- package/components/fu-swipe-action-item/fu-swipe-action-item.vue +134 -123
- package/components/fu-swipe-action-item/mpwxs.js +1 -1
- package/components/fu-swipe-action-item/props.js +22 -6
- package/components/fu-swiper/fu-swiper.vue +26 -24
- package/components/fu-swiper/props.js +80 -24
- package/components/fu-switch/fu-switch.vue +20 -12
- package/components/fu-switch/props.js +48 -13
- package/components/fu-tabs/fu-tabs.vue +36 -33
- package/components/fu-tabs/props.js +46 -13
- package/components/fu-tag/fu-tag.vue +24 -21
- package/components/fu-tag/props.js +63 -17
- package/components/fu-text/fu-text.vue +72 -33
- package/components/fu-text/props.js +85 -27
- package/components/fu-text/value.js +6 -6
- package/components/fu-textarea/fu-textarea.vue +13 -17
- package/components/fu-textarea/props.js +103 -30
- package/components/fu-timeaxis/fu-timeaxis.vue +1 -1
- package/components/fu-timeaxis-item/fu-timeaxis-item.vue +8 -4
- package/components/fu-transition/fu-transition.vue +48 -49
- package/components/fu-transition/props.js +21 -0
- package/components/fu-upload/fu-upload.vue +3 -1
- package/components/fu-upload/props.js +67 -19
- package/components/fu-upload/upload-file.vue +31 -18
- package/components/fu-upload/upload-image.vue +37 -19
- package/components/fu-vtabs/fu-vtabs.vue +6 -4
- package/components/fu-vtabs/props.js +50 -15
- package/components/fu-waterfall/fu-waterfall.vue +11 -9
- package/components/fu-waterfall/props.js +37 -15
- package/index.js +17 -24
- package/index.scss +9 -7
- package/libs/config/config.js +16 -9
- package/libs/function/applyEven.js +9 -9
- package/libs/function/check.js +81 -89
- package/libs/function/{index.js → common.js} +5 -5
- package/libs/function/message.js +0 -27
- package/libs/mixin/mixin.js +26 -21
- package/libs/{utils/min.router.config.js → route/min.route.config.js} +7 -7
- package/libs/{utils/router.config.js → route/route.config.js} +10 -11
- package/libs/{css/main.scss → style/common.scss} +50 -87
- package/libs/style/style.h5.scss +8 -0
- package/libs/style/style.mp.scss +15 -0
- package/package.json +1 -1
- package/components/fu-calendar/calendar-item.vue +0 -214
- package/components/fu-calendar/calendar.js +0 -546
- package/components/fu-calendar/fu-calendar.vue +0 -536
- package/components/fu-calendar/i18n/en.json +0 -12
- package/components/fu-calendar/i18n/index.js +0 -8
- package/components/fu-calendar/i18n/zh-Hans.json +0 -12
- package/components/fu-calendar/i18n/zh-Hant.json +0 -12
- package/components/fu-calendar/util.js +0 -360
- package/components/fu-date-picker/calendar-item.vue +0 -177
- package/components/fu-date-picker/calendar.vue +0 -917
- package/components/fu-date-picker/fu-date-picker.vue +0 -1069
- package/components/fu-date-picker/i18n/en.json +0 -22
- package/components/fu-date-picker/i18n/index.js +0 -8
- package/components/fu-date-picker/i18n/zh-Hans.json +0 -22
- package/components/fu-date-picker/i18n/zh-Hant.json +0 -22
- package/components/fu-date-picker/props.js +0 -68
- package/components/fu-date-picker/time-picker.vue +0 -924
- package/components/fu-date-picker/util.js +0 -419
- package/components/fu-icons/fu-icons.vue +0 -102
- package/components/fu-icons/fuicons.css +0 -585
- package/components/fu-landscape/fu-landscape.vue +0 -167
- package/components/fu-landscape/props.js +0 -64
- package/components/fu-tabbar/fu-tabbar.vue +0 -333
- package/components/fu-tabbar/props.js +0 -78
- package/libs/css/style.h5.scss +0 -35
- package/libs/css/style.mp.scss +0 -50
- package/libs/utils/util.js +0 -58
- /package/components/{fu-nav-bar → fu-navbar}/props.js +0 -0
- /package/components/{fu-nav-bar → fu-navbar}/status-bar.vue +0 -0
- /package/{components/fu-datetime-picker → libs/function}/dayjs.js +0 -0
- /package/libs/{css → style}/color.scss +0 -0
- /package/libs/{css/component.scss → style/components.scss} +0 -0
|
@@ -1,1069 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="fu-date">
|
|
3
|
-
<view class="fu-date-editor" @click="open" v-if="!insert">
|
|
4
|
-
<slot>
|
|
5
|
-
<view
|
|
6
|
-
class="fu-date-editor--x"
|
|
7
|
-
:class="{'fu-date-editor--x__disabled': disabled,'fu-date-x--border': border}">
|
|
8
|
-
<view class="fu-date-x fu-date-single" v-if="!isRange">
|
|
9
|
-
<fu-icons class="icon-calendar" name="calendar" color="#c0c4cc" size="22"></fu-icons>
|
|
10
|
-
<view class="fu-date__x-input">{{ displayValue || singlePlaceholderText }}</view>
|
|
11
|
-
</view>
|
|
12
|
-
|
|
13
|
-
<view class="fu-date-x fu-date-range" v-else>
|
|
14
|
-
<fu-icons class="icon-calendar" name="calendar" color="#c0c4cc" size="22"></fu-icons>
|
|
15
|
-
<view class="fu-date__x-input text-center">
|
|
16
|
-
{{ displayRangeValue.startDate || startPlaceholderText }}
|
|
17
|
-
</view>
|
|
18
|
-
|
|
19
|
-
<view class="range-separator">{{ rangeSeparator }}</view>
|
|
20
|
-
|
|
21
|
-
<view class="fu-date__x-input text-center">
|
|
22
|
-
{{ displayRangeValue.endDate || endPlaceholderText }}
|
|
23
|
-
</view>
|
|
24
|
-
</view>
|
|
25
|
-
|
|
26
|
-
<view class="fu-date__icon-clear" @click.stop="clear" v-if="showClearIcon">
|
|
27
|
-
<fu-icons name="close-fill" color="#c0c4cc" size="22"></fu-icons>
|
|
28
|
-
</view>
|
|
29
|
-
</view>
|
|
30
|
-
</slot>
|
|
31
|
-
</view>
|
|
32
|
-
|
|
33
|
-
<view class="fu-date-mask--pc" @click="close" v-show="!insert && pickerVisible"></view>
|
|
34
|
-
|
|
35
|
-
<view ref="datePicker" class="fu-date-picker__container" v-if="!isPhone" v-show="pickerVisible">
|
|
36
|
-
<view class="fu-date-single--x" :style="pickerPositionStyle" v-if="!isRange">
|
|
37
|
-
<view class="fu-popper__arrow"></view>
|
|
38
|
-
|
|
39
|
-
<view class="fu-date-changed popup-x-header" v-if="hasTime">
|
|
40
|
-
<input
|
|
41
|
-
v-model="inputDate"
|
|
42
|
-
class="fu-date__input text-center"
|
|
43
|
-
type="text"
|
|
44
|
-
:placeholder="selectDateText" />
|
|
45
|
-
|
|
46
|
-
<time-picker
|
|
47
|
-
v-model="pickerTime"
|
|
48
|
-
type="time"
|
|
49
|
-
:border="false"
|
|
50
|
-
:disabled="!inputDate"
|
|
51
|
-
:start="timepickerStartTime"
|
|
52
|
-
:end="timepickerEndTime"
|
|
53
|
-
:hideSecond="hideSecond"
|
|
54
|
-
style="width: 100%;">
|
|
55
|
-
<input
|
|
56
|
-
class="fu-date__input text-center"
|
|
57
|
-
v-model="pickerTime"
|
|
58
|
-
type="text"
|
|
59
|
-
:placeholder="selectTimeText"
|
|
60
|
-
:disabled="!inputDate" />
|
|
61
|
-
</time-picker>
|
|
62
|
-
</view>
|
|
63
|
-
|
|
64
|
-
<Calendar
|
|
65
|
-
ref="pcSingle"
|
|
66
|
-
:showMonth="false"
|
|
67
|
-
:start-date="calendarRange.startDate"
|
|
68
|
-
:end-date="calendarRange.endDate"
|
|
69
|
-
:date="calendarDate"
|
|
70
|
-
@change="singleChange"
|
|
71
|
-
:default-value="defaultValue"
|
|
72
|
-
style="padding: 0 8px;" />
|
|
73
|
-
|
|
74
|
-
<view class="popup-x-footer" v-if="hasTime">
|
|
75
|
-
<text class="confirm-text" @click="confirmSingleChange">{{ okText }}</text>
|
|
76
|
-
</view>
|
|
77
|
-
</view>
|
|
78
|
-
|
|
79
|
-
<view class="fu-date-range--x" :style="pickerPositionStyle" v-else>
|
|
80
|
-
<view class="fu-popper__arrow"></view>
|
|
81
|
-
<view v-if="hasTime" class="popup-x-header fu-date-changed">
|
|
82
|
-
<view class="popup-x-header--datetime">
|
|
83
|
-
<input
|
|
84
|
-
class="fu-date__input fu-date-range__input"
|
|
85
|
-
v-model="tempRange.startDate"
|
|
86
|
-
type="text"
|
|
87
|
-
:placeholder="startDateText" />
|
|
88
|
-
|
|
89
|
-
<time-picker
|
|
90
|
-
v-model="tempRange.startTime"
|
|
91
|
-
type="time"
|
|
92
|
-
:start="timepickerStartTime"
|
|
93
|
-
:border="false"
|
|
94
|
-
:disabled="!tempRange.startDate"
|
|
95
|
-
:hideSecond="hideSecond">
|
|
96
|
-
<input
|
|
97
|
-
class="fu-date__input fu-date-range__input"
|
|
98
|
-
v-model="tempRange.startTime"
|
|
99
|
-
type="text"
|
|
100
|
-
:placeholder="startTimeText"
|
|
101
|
-
:disabled="!tempRange.startDate" />
|
|
102
|
-
</time-picker>
|
|
103
|
-
</view>
|
|
104
|
-
|
|
105
|
-
<fu-icons name="arrow-right" color="#999" style="line-height: 40px;"></fu-icons>
|
|
106
|
-
|
|
107
|
-
<view class="popup-x-header--datetime">
|
|
108
|
-
<input
|
|
109
|
-
class="fu-date__input fu-date-range__input"
|
|
110
|
-
v-model="tempRange.endDate"
|
|
111
|
-
type="text"
|
|
112
|
-
:placeholder="endDateText" />
|
|
113
|
-
|
|
114
|
-
<time-picker
|
|
115
|
-
v-model="tempRange.endTime"
|
|
116
|
-
type="time"
|
|
117
|
-
:end="timepickerEndTime"
|
|
118
|
-
:border="false"
|
|
119
|
-
:disabled="!tempRange.endDate"
|
|
120
|
-
:hideSecond="hideSecond">
|
|
121
|
-
<input
|
|
122
|
-
class="fu-date__input fu-date-range__input"
|
|
123
|
-
v-model="tempRange.endTime"
|
|
124
|
-
type="text"
|
|
125
|
-
:placeholder="endTimeText"
|
|
126
|
-
:disabled="!tempRange.endDate" />
|
|
127
|
-
</time-picker>
|
|
128
|
-
</view>
|
|
129
|
-
</view>
|
|
130
|
-
|
|
131
|
-
<view class="popup-x-body">
|
|
132
|
-
<Calendar
|
|
133
|
-
ref="left"
|
|
134
|
-
:showMonth="false"
|
|
135
|
-
:start-date="calendarRange.startDate"
|
|
136
|
-
:end-date="calendarRange.endDate"
|
|
137
|
-
:range="true"
|
|
138
|
-
:pleStatus="endMultipleStatus"
|
|
139
|
-
@change="leftChange"
|
|
140
|
-
@firstEnterCale="updateRightCale"
|
|
141
|
-
style="padding: 0 8px;" />
|
|
142
|
-
<Calendar
|
|
143
|
-
ref="right"
|
|
144
|
-
:showMonth="false"
|
|
145
|
-
:start-date="calendarRange.startDate"
|
|
146
|
-
:end-date="calendarRange.endDate"
|
|
147
|
-
:range="true"
|
|
148
|
-
@change="rightChange"
|
|
149
|
-
:pleStatus="startMultipleStatus"
|
|
150
|
-
@firstEnterCale="updateLeftCale"
|
|
151
|
-
style="padding: 0 8px;border-left: 1px solid #F1F1F1;" />
|
|
152
|
-
</view>
|
|
153
|
-
|
|
154
|
-
<view class="popup-x-footer" v-if="hasTime">
|
|
155
|
-
<text @click="clear">{{ clearText }}</text>
|
|
156
|
-
<text class="confirm-text" @click="confirmRangeChange">{{ okText }}</text>
|
|
157
|
-
</view>
|
|
158
|
-
</view>
|
|
159
|
-
</view>
|
|
160
|
-
|
|
161
|
-
<Calendar
|
|
162
|
-
ref="mobile"
|
|
163
|
-
:clearDate="false"
|
|
164
|
-
:date="calendarDate"
|
|
165
|
-
:defTime="mobileCalendarTime"
|
|
166
|
-
:start-date="calendarRange.startDate"
|
|
167
|
-
:end-date="calendarRange.endDate"
|
|
168
|
-
:selectableTimes="mobSelectableTime"
|
|
169
|
-
:startPlaceholder="startPlaceholder"
|
|
170
|
-
:endPlaceholder="endPlaceholder"
|
|
171
|
-
:default-value="defaultValue"
|
|
172
|
-
:pleStatus="endMultipleStatus"
|
|
173
|
-
:showMonth="false"
|
|
174
|
-
:range="isRange"
|
|
175
|
-
:hasTime="hasTime"
|
|
176
|
-
:insert="insert"
|
|
177
|
-
:hideSecond="hideSecond"
|
|
178
|
-
@confirm="mobileChange"
|
|
179
|
-
@maskClose="close"
|
|
180
|
-
v-if="isPhone" />
|
|
181
|
-
</view>
|
|
182
|
-
</template>
|
|
183
|
-
<script>
|
|
184
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
185
|
-
import props from './props.js'
|
|
186
|
-
import Calendar from './calendar.vue'
|
|
187
|
-
import TimePicker from './time-picker.vue'
|
|
188
|
-
import { initVueI18n } from '@dcloudio/uni-i18n'
|
|
189
|
-
import i18nMessages from './i18n/index.js'
|
|
190
|
-
import {
|
|
191
|
-
getDateTime,
|
|
192
|
-
getDate,
|
|
193
|
-
getTime,
|
|
194
|
-
getDefaultSecond,
|
|
195
|
-
dateCompare,
|
|
196
|
-
checkDate,
|
|
197
|
-
fixIosDateFormat
|
|
198
|
-
} from './util'
|
|
199
|
-
/**
|
|
200
|
-
* DatePicker 时间选择器
|
|
201
|
-
* @description 同时支持 PC 和移动端使用日历选择日期和日期范围
|
|
202
|
-
* @property {String} mode = [date|daterange|datetime|datetimerange] 选择器类型
|
|
203
|
-
* @value date 日期
|
|
204
|
-
* @value daterange 日期范围
|
|
205
|
-
* @value datetime 日期时间
|
|
206
|
-
* @value datetimerange 日期时间范围
|
|
207
|
-
* @property {String|Number|Array|Date} value 绑定值
|
|
208
|
-
* @property {String} placeholder 单选择时的占位内容
|
|
209
|
-
* @property {String} start 最小值,可以使用日期的字符串(String)、时间戳(Number)
|
|
210
|
-
* @property {String} end 终止时间
|
|
211
|
-
* @property {String} returnType 返回值格式(默认 string)
|
|
212
|
-
* @value timestamp 时间戳格式
|
|
213
|
-
* @value string 字符串格式
|
|
214
|
-
* @value date 日期格式
|
|
215
|
-
* @property {String} startPlaceholder 范围选择时开始日期的占位内容
|
|
216
|
-
* @property {String} endPlaceholder 范围选择时结束日期的占位内容
|
|
217
|
-
* @property {String} rangeSeparator 选择范围时的分隔符
|
|
218
|
-
* @property {Boolean} border = [true|false] 是否有边框
|
|
219
|
-
* @property {Boolean} disabled = [true|false] 是否禁用
|
|
220
|
-
* @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用)
|
|
221
|
-
* @property {String} defaultValue 选择器打开时默认显示的时间
|
|
222
|
-
* @event {Function} change 确定日期时触发的事件
|
|
223
|
-
* @event {Function} maskClick 点击遮罩层触发的事件
|
|
224
|
-
* @event {Function} open 打开弹出层
|
|
225
|
-
* @event {Function} close 关闭弹出层
|
|
226
|
-
* @event {Function} clear 清除上次选中的状态和值
|
|
227
|
-
**/
|
|
228
|
-
export default {
|
|
229
|
-
name: 'FuDatePicker',
|
|
230
|
-
mixins: [mpMixin, props],
|
|
231
|
-
emits: ['change', 'maskClick', 'open', 'close', 'clear', 'input', 'update:modelValue'],
|
|
232
|
-
components: {
|
|
233
|
-
Calendar,
|
|
234
|
-
TimePicker
|
|
235
|
-
},
|
|
236
|
-
data() {
|
|
237
|
-
return {
|
|
238
|
-
isRange: false,
|
|
239
|
-
hasTime: false,
|
|
240
|
-
displayValue: '',
|
|
241
|
-
inputDate: '',
|
|
242
|
-
calendarDate: '',
|
|
243
|
-
pickerTime: '',
|
|
244
|
-
calendarRange: {
|
|
245
|
-
startDate: '',
|
|
246
|
-
startTime: '',
|
|
247
|
-
endDate: '',
|
|
248
|
-
endTime: ''
|
|
249
|
-
},
|
|
250
|
-
displayRangeValue: {
|
|
251
|
-
startDate: '',
|
|
252
|
-
endDate: '',
|
|
253
|
-
},
|
|
254
|
-
tempRange: {
|
|
255
|
-
startDate: '',
|
|
256
|
-
startTime: '',
|
|
257
|
-
endDate: '',
|
|
258
|
-
endTime: ''
|
|
259
|
-
},
|
|
260
|
-
// 左右日历同步数据
|
|
261
|
-
startMultipleStatus: {
|
|
262
|
-
before: '',
|
|
263
|
-
after: '',
|
|
264
|
-
data: [],
|
|
265
|
-
fulldate: ''
|
|
266
|
-
},
|
|
267
|
-
endMultipleStatus: {
|
|
268
|
-
before: '',
|
|
269
|
-
after: '',
|
|
270
|
-
data: [],
|
|
271
|
-
fulldate: ''
|
|
272
|
-
},
|
|
273
|
-
pickerVisible: false,
|
|
274
|
-
pickerPositionStyle: null,
|
|
275
|
-
isEmitValue: false,
|
|
276
|
-
isPhone: false,
|
|
277
|
-
isFirstShow: true,
|
|
278
|
-
i18nT: () => {}
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
computed: {
|
|
282
|
-
timepickerStartTime() {
|
|
283
|
-
const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate;
|
|
284
|
-
return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : '';
|
|
285
|
-
},
|
|
286
|
-
timepickerEndTime() {
|
|
287
|
-
const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate;
|
|
288
|
-
return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : '';
|
|
289
|
-
},
|
|
290
|
-
mobileCalendarTime() {
|
|
291
|
-
const timeRange = {
|
|
292
|
-
start: this.tempRange.startTime,
|
|
293
|
-
end: this.tempRange.endTime
|
|
294
|
-
};
|
|
295
|
-
return this.isRange ? timeRange : this.pickerTime
|
|
296
|
-
},
|
|
297
|
-
mobSelectableTime() {
|
|
298
|
-
return {
|
|
299
|
-
start: this.calendarRange.startTime,
|
|
300
|
-
end: this.calendarRange.endTime
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
datePopupWidth() {
|
|
304
|
-
return this.isRange ? 653 : 301
|
|
305
|
-
},
|
|
306
|
-
/**
|
|
307
|
-
* for i18n
|
|
308
|
-
*/
|
|
309
|
-
singlePlaceholderText() {
|
|
310
|
-
return this.placeholder || (this.mode === 'date' ? this.selectDateText : this.selectDateTimeText)
|
|
311
|
-
},
|
|
312
|
-
startPlaceholderText() {
|
|
313
|
-
return this.startPlaceholder || this.startDateText
|
|
314
|
-
},
|
|
315
|
-
endPlaceholderText() {
|
|
316
|
-
return this.endPlaceholder || this.endDateText
|
|
317
|
-
},
|
|
318
|
-
selectDateText() {
|
|
319
|
-
return this.i18nT("fu-datetime-picker.selectDate")
|
|
320
|
-
},
|
|
321
|
-
selectDateTimeText() {
|
|
322
|
-
return this.i18nT("fu-datetime-picker.selectDateTime")
|
|
323
|
-
},
|
|
324
|
-
selectTimeText() {
|
|
325
|
-
return this.i18nT("fu-datetime-picker.selectTime")
|
|
326
|
-
},
|
|
327
|
-
startDateText() {
|
|
328
|
-
return this.startPlaceholder || this.i18nT("fu-datetime-picker.startDate")
|
|
329
|
-
},
|
|
330
|
-
startTimeText() {
|
|
331
|
-
return this.i18nT("fu-datetime-picker.startTime")
|
|
332
|
-
},
|
|
333
|
-
endDateText() {
|
|
334
|
-
return this.endPlaceholder || this.i18nT("fu-datetime-picker.endDate")
|
|
335
|
-
},
|
|
336
|
-
endTimeText() {
|
|
337
|
-
return this.i18nT("fu-datetime-picker.endTime")
|
|
338
|
-
},
|
|
339
|
-
okText() {
|
|
340
|
-
return this.i18nT("fu-datetime-picker.ok")
|
|
341
|
-
},
|
|
342
|
-
clearText() {
|
|
343
|
-
return this.i18nT("fu-datetime-picker.clear")
|
|
344
|
-
},
|
|
345
|
-
showClearIcon() {
|
|
346
|
-
return this.clearIcon && !this.disabled && (this.displayValue || (this.displayRangeValue.startDate && this.displayRangeValue.endDate))
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
created() {
|
|
350
|
-
this.initI18nT()
|
|
351
|
-
this.platform()
|
|
352
|
-
},
|
|
353
|
-
methods: {
|
|
354
|
-
initI18nT() {
|
|
355
|
-
const vueI18n = initVueI18n(i18nMessages);
|
|
356
|
-
this.i18nT = vueI18n.t;
|
|
357
|
-
},
|
|
358
|
-
|
|
359
|
-
initPicker(newVal) {
|
|
360
|
-
if ((!newVal && !this.defaultValue) || Array.isArray(newVal) && !newVal.length) {
|
|
361
|
-
this.$nextTick(() => {
|
|
362
|
-
this.clear(false)
|
|
363
|
-
})
|
|
364
|
-
return
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
if (!Array.isArray(newVal) && !this.isRange) {
|
|
368
|
-
if (newVal) {
|
|
369
|
-
this.displayValue = this.inputDate = this.calendarDate = getDate(newVal)
|
|
370
|
-
if (this.hasTime) {
|
|
371
|
-
this.pickerTime = getTime(newVal, this.hideSecond);
|
|
372
|
-
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
|
|
373
|
-
}
|
|
374
|
-
} else if (this.defaultValue) {
|
|
375
|
-
this.inputDate = this.calendarDate = getDate(this.defaultValue);
|
|
376
|
-
if (this.hasTime) {
|
|
377
|
-
this.pickerTime = getTime(this.defaultValue, this.hideSecond);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
const [before, after] = newVal;
|
|
382
|
-
if (!before && !after) return
|
|
383
|
-
const beforeDate = getDate(before)
|
|
384
|
-
const beforeTime = getTime(before, this.hideSecond)
|
|
385
|
-
|
|
386
|
-
const afterDate = getDate(after)
|
|
387
|
-
const afterTime = getTime(after, this.hideSecond)
|
|
388
|
-
const startDate = beforeDate;
|
|
389
|
-
const endDate = afterDate;
|
|
390
|
-
this.displayRangeValue.startDate = this.tempRange.startDate = startDate
|
|
391
|
-
this.displayRangeValue.endDate = this.tempRange.endDate = endDate
|
|
392
|
-
|
|
393
|
-
if (this.hasTime) {
|
|
394
|
-
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
|
|
395
|
-
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
|
|
396
|
-
this.tempRange.startTime = beforeTime
|
|
397
|
-
this.tempRange.endTime = afterTime
|
|
398
|
-
}
|
|
399
|
-
const defaultRange = {
|
|
400
|
-
before: beforeDate,
|
|
401
|
-
after: afterDate
|
|
402
|
-
};
|
|
403
|
-
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
|
|
404
|
-
which: 'right'
|
|
405
|
-
});
|
|
406
|
-
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
|
|
407
|
-
which: 'left'
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
updateLeftCale(e) {
|
|
413
|
-
const left = this.$refs.left;
|
|
414
|
-
// 设置范围选
|
|
415
|
-
left.cale.setHoverMultiple(e.after)
|
|
416
|
-
left.setDate(this.$refs.left.nowDate.fullDate)
|
|
417
|
-
},
|
|
418
|
-
|
|
419
|
-
updateRightCale(e) {
|
|
420
|
-
const right = this.$refs.right;
|
|
421
|
-
// 设置范围选
|
|
422
|
-
right.cale.setHoverMultiple(e.after)
|
|
423
|
-
right.setDate(this.$refs.right.nowDate.fullDate)
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
platform() {
|
|
427
|
-
if (typeof navigator !== "undefined") {
|
|
428
|
-
this.isPhone = navigator.userAgent.toLowerCase().indexOf('mobile') !== -1
|
|
429
|
-
return
|
|
430
|
-
}
|
|
431
|
-
const { windowWidth } = uni.getSystemInfoSync();
|
|
432
|
-
this.isPhone = windowWidth <= 500;
|
|
433
|
-
this.windowWidth = windowWidth;
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
-
open() {
|
|
437
|
-
if (this.disabled) return
|
|
438
|
-
this.platform()
|
|
439
|
-
if (this.isPhone) {
|
|
440
|
-
setTimeout(() => {
|
|
441
|
-
this.$refs.mobile.open()
|
|
442
|
-
}, 0);
|
|
443
|
-
return
|
|
444
|
-
}
|
|
445
|
-
this.pickerPositionStyle = {
|
|
446
|
-
top: '10px'
|
|
447
|
-
};
|
|
448
|
-
const dateEditor = uni.createSelectorQuery().in(this).select(".fu-date-editor");
|
|
449
|
-
dateEditor.boundingClientRect(rect => {
|
|
450
|
-
if (this.windowWidth - rect.left < this.datePopupWidth) {
|
|
451
|
-
this.pickerPositionStyle.right = 0;
|
|
452
|
-
}
|
|
453
|
-
}).exec()
|
|
454
|
-
setTimeout(() => {
|
|
455
|
-
this.pickerVisible = !this.pickerVisible;
|
|
456
|
-
if (!this.isPhone && this.isRange && this.isFirstShow) {
|
|
457
|
-
this.isFirstShow = false;
|
|
458
|
-
const {
|
|
459
|
-
startDate,
|
|
460
|
-
endDate
|
|
461
|
-
} = this.calendarRange;
|
|
462
|
-
if (startDate && endDate) {
|
|
463
|
-
if (this.diffDate(startDate, endDate) < 30) {
|
|
464
|
-
this.$refs.right.changeMonth('pre')
|
|
465
|
-
}
|
|
466
|
-
} else {
|
|
467
|
-
this.$refs.right.changeMonth('next')
|
|
468
|
-
if (this.isPhone) {
|
|
469
|
-
this.$refs.right.cale.lastHover = false;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
}, 50)
|
|
475
|
-
},
|
|
476
|
-
|
|
477
|
-
close() {
|
|
478
|
-
setTimeout(() => {
|
|
479
|
-
this.pickerVisible = false;
|
|
480
|
-
this.$emit('maskClick', this.value)
|
|
481
|
-
this.$refs.mobile && this.$refs.mobile.close()
|
|
482
|
-
}, 20)
|
|
483
|
-
},
|
|
484
|
-
|
|
485
|
-
setEmit(value) {
|
|
486
|
-
if (this.returnType === "timestamp" || this.returnType === "date") {
|
|
487
|
-
if (!Array.isArray(value)) {
|
|
488
|
-
if (!this.hasTime) {
|
|
489
|
-
value = value + ' ' + '00:00:00';
|
|
490
|
-
}
|
|
491
|
-
value = this.createTimestamp(value)
|
|
492
|
-
if (this.returnType === "date") {
|
|
493
|
-
value = new Date(value)
|
|
494
|
-
}
|
|
495
|
-
} else {
|
|
496
|
-
if (!this.hasTime) {
|
|
497
|
-
value[0] = value[0] + ' ' + '00:00:00';
|
|
498
|
-
value[1] = value[1] + ' ' + '00:00:00';
|
|
499
|
-
}
|
|
500
|
-
value[0] = this.createTimestamp(value[0])
|
|
501
|
-
value[1] = this.createTimestamp(value[1])
|
|
502
|
-
if (this.returnType === "date") {
|
|
503
|
-
value[0] = new Date(value[0])
|
|
504
|
-
value[1] = new Date(value[1])
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
this.$emit('update:modelValue', value)
|
|
510
|
-
this.$emit('input', value)
|
|
511
|
-
this.$emit('change', value)
|
|
512
|
-
this.isEmitValue = true
|
|
513
|
-
},
|
|
514
|
-
|
|
515
|
-
createTimestamp(date) {
|
|
516
|
-
date = fixIosDateFormat(date)
|
|
517
|
-
return Date.parse(new Date(date))
|
|
518
|
-
},
|
|
519
|
-
|
|
520
|
-
singleChange(e) {
|
|
521
|
-
this.calendarDate = this.inputDate = e.fulldate
|
|
522
|
-
if (this.hasTime) return
|
|
523
|
-
this.confirmSingleChange()
|
|
524
|
-
},
|
|
525
|
-
|
|
526
|
-
confirmSingleChange() {
|
|
527
|
-
if (!checkDate(this.inputDate)) {
|
|
528
|
-
const now = new Date()
|
|
529
|
-
this.calendarDate = this.inputDate = getDate(now)
|
|
530
|
-
this.pickerTime = getTime(now, this.hideSecond)
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
let startLaterInputDate = false;
|
|
534
|
-
let startDate, startTime
|
|
535
|
-
if (this.start) {
|
|
536
|
-
let startString = this.start;
|
|
537
|
-
if (typeof this.start === 'number') {
|
|
538
|
-
startString = getDateTime(this.start, this.hideSecond)
|
|
539
|
-
}
|
|
540
|
-
[startDate, startTime] = startString.split(' ')
|
|
541
|
-
if (this.start && !dateCompare(startDate, this.inputDate)) {
|
|
542
|
-
startLaterInputDate = true;
|
|
543
|
-
this.inputDate = startDate;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
let endEarlierInputDate = false;
|
|
548
|
-
let endDate, endTime
|
|
549
|
-
if (this.end) {
|
|
550
|
-
let endString = this.end
|
|
551
|
-
if (typeof this.end === 'number') {
|
|
552
|
-
endString = getDateTime(this.end, this.hideSecond)
|
|
553
|
-
}
|
|
554
|
-
[endDate, endTime] = endString.split(' ')
|
|
555
|
-
if (this.end && !dateCompare(this.inputDate, endDate)) {
|
|
556
|
-
endEarlierInputDate = true;
|
|
557
|
-
this.inputDate = endDate;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
if (this.hasTime) {
|
|
561
|
-
if (startLaterInputDate) {
|
|
562
|
-
this.pickerTime = startTime || getDefaultSecond(this.hideSecond)
|
|
563
|
-
}
|
|
564
|
-
if (endEarlierInputDate) {
|
|
565
|
-
this.pickerTime = endTime || getDefaultSecond(this.hideSecond)
|
|
566
|
-
}
|
|
567
|
-
if (!this.pickerTime) {
|
|
568
|
-
this.pickerTime = getTime(Date.now(), this.hideSecond)
|
|
569
|
-
}
|
|
570
|
-
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
|
|
571
|
-
} else {
|
|
572
|
-
this.displayValue = this.inputDate;
|
|
573
|
-
}
|
|
574
|
-
this.setEmit(this.displayValue)
|
|
575
|
-
this.pickerVisible = false;
|
|
576
|
-
},
|
|
577
|
-
|
|
578
|
-
leftChange(e) {
|
|
579
|
-
const {
|
|
580
|
-
before,
|
|
581
|
-
after
|
|
582
|
-
} = e.range;
|
|
583
|
-
this.rangeChange(before, after)
|
|
584
|
-
const obj = {
|
|
585
|
-
before: e.range.before,
|
|
586
|
-
after: e.range.after,
|
|
587
|
-
data: e.range.data,
|
|
588
|
-
fulldate: e.fulldate
|
|
589
|
-
};
|
|
590
|
-
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj)
|
|
591
|
-
},
|
|
592
|
-
|
|
593
|
-
rightChange(e) {
|
|
594
|
-
const {
|
|
595
|
-
before,
|
|
596
|
-
after
|
|
597
|
-
} = e.range;
|
|
598
|
-
this.rangeChange(before, after)
|
|
599
|
-
const obj = {
|
|
600
|
-
before: e.range.before,
|
|
601
|
-
after: e.range.after,
|
|
602
|
-
data: e.range.data,
|
|
603
|
-
fulldate: e.fulldate
|
|
604
|
-
};
|
|
605
|
-
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj)
|
|
606
|
-
},
|
|
607
|
-
|
|
608
|
-
mobileChange(e) {
|
|
609
|
-
if (this.isRange) {
|
|
610
|
-
const {
|
|
611
|
-
before,
|
|
612
|
-
after
|
|
613
|
-
} = e.range;
|
|
614
|
-
|
|
615
|
-
if (!before || !after) return
|
|
616
|
-
|
|
617
|
-
this.handleStartAndEnd(before, after, true)
|
|
618
|
-
if (this.hasTime) {
|
|
619
|
-
const {
|
|
620
|
-
startTime,
|
|
621
|
-
endTime
|
|
622
|
-
} = e.timeRange;
|
|
623
|
-
this.tempRange.startTime = startTime;
|
|
624
|
-
this.tempRange.endTime = endTime;
|
|
625
|
-
}
|
|
626
|
-
this.confirmRangeChange()
|
|
627
|
-
} else {
|
|
628
|
-
if (this.hasTime) {
|
|
629
|
-
this.displayValue = e.fulldate + ' ' + e.time;
|
|
630
|
-
} else {
|
|
631
|
-
this.displayValue = e.fulldate;
|
|
632
|
-
}
|
|
633
|
-
this.setEmit(this.displayValue)
|
|
634
|
-
}
|
|
635
|
-
this.$refs.mobile.close()
|
|
636
|
-
},
|
|
637
|
-
|
|
638
|
-
rangeChange(before, after) {
|
|
639
|
-
if (!(before && after)) return
|
|
640
|
-
this.handleStartAndEnd(before, after, true)
|
|
641
|
-
if (this.hasTime) return
|
|
642
|
-
this.confirmRangeChange()
|
|
643
|
-
},
|
|
644
|
-
|
|
645
|
-
confirmRangeChange() {
|
|
646
|
-
if (!this.tempRange.startDate || !this.tempRange.endDate) {
|
|
647
|
-
this.pickerVisible = false;
|
|
648
|
-
return
|
|
649
|
-
}
|
|
650
|
-
if (!checkDate(this.tempRange.startDate)) {
|
|
651
|
-
this.tempRange.startDate = getDate(Date.now())
|
|
652
|
-
}
|
|
653
|
-
if (!checkDate(this.tempRange.endDate)) {
|
|
654
|
-
this.tempRange.endDate = getDate(Date.now())
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
let start, end
|
|
658
|
-
|
|
659
|
-
let startDateLaterRangeStartDate = false;
|
|
660
|
-
let startDateLaterRangeEndDate = false;
|
|
661
|
-
let startDate, startTime
|
|
662
|
-
if (this.start) {
|
|
663
|
-
let startString = this.start;
|
|
664
|
-
if (typeof this.start === 'number') {
|
|
665
|
-
startString = getDateTime(this.start, this.hideSecond)
|
|
666
|
-
}
|
|
667
|
-
[startDate, startTime] = startString.split(' ')
|
|
668
|
-
if (this.start && !dateCompare(this.start, this.tempRange.startDate)) {
|
|
669
|
-
startDateLaterRangeStartDate = true
|
|
670
|
-
this.tempRange.startDate = startDate
|
|
671
|
-
}
|
|
672
|
-
if (this.start && !dateCompare(this.start, this.tempRange.endDate)) {
|
|
673
|
-
startDateLaterRangeEndDate = true
|
|
674
|
-
this.tempRange.endDate = startDate
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
let endDateEarlierRangeStartDate = false
|
|
678
|
-
let endDateEarlierRangeEndDate = false
|
|
679
|
-
let endDate, endTime
|
|
680
|
-
if (this.end) {
|
|
681
|
-
let endString = this.end
|
|
682
|
-
if (typeof this.end === 'number') {
|
|
683
|
-
endString = getDateTime(this.end, this.hideSecond)
|
|
684
|
-
}
|
|
685
|
-
[endDate, endTime] = endString.split(' ')
|
|
686
|
-
|
|
687
|
-
if (this.end && !dateCompare(this.tempRange.startDate, this.end)) {
|
|
688
|
-
endDateEarlierRangeStartDate = true;
|
|
689
|
-
this.tempRange.startDate = endDate;
|
|
690
|
-
}
|
|
691
|
-
if (this.end && !dateCompare(this.tempRange.endDate, this.end)) {
|
|
692
|
-
endDateEarlierRangeEndDate = true
|
|
693
|
-
this.tempRange.endDate = endDate;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
if (!this.hasTime) {
|
|
697
|
-
start = this.displayRangeValue.startDate = this.tempRange.startDate
|
|
698
|
-
end = this.displayRangeValue.endDate = this.tempRange.endDate
|
|
699
|
-
} else {
|
|
700
|
-
if (startDateLaterRangeStartDate) {
|
|
701
|
-
this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond)
|
|
702
|
-
} else if (endDateEarlierRangeStartDate) {
|
|
703
|
-
this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond)
|
|
704
|
-
}
|
|
705
|
-
if (!this.tempRange.startTime) {
|
|
706
|
-
this.tempRange.startTime = getTime(Date.now(), this.hideSecond)
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
if (startDateLaterRangeEndDate) {
|
|
710
|
-
this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond)
|
|
711
|
-
} else if (endDateEarlierRangeEndDate) {
|
|
712
|
-
this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond)
|
|
713
|
-
}
|
|
714
|
-
if (!this.tempRange.endTime) {
|
|
715
|
-
this.tempRange.endTime = getTime(Date.now(), this.hideSecond)
|
|
716
|
-
}
|
|
717
|
-
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`
|
|
718
|
-
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`
|
|
719
|
-
}
|
|
720
|
-
if (!dateCompare(start, end)) {
|
|
721
|
-
[start, end] = [end, start]
|
|
722
|
-
}
|
|
723
|
-
this.displayRangeValue.startDate = start
|
|
724
|
-
this.displayRangeValue.endDate = end
|
|
725
|
-
const displayRange = [start, end]
|
|
726
|
-
this.setEmit(displayRange)
|
|
727
|
-
this.pickerVisible = false
|
|
728
|
-
},
|
|
729
|
-
|
|
730
|
-
handleStartAndEnd(before, after, temp = false) {
|
|
731
|
-
if (!(before && after)) return
|
|
732
|
-
|
|
733
|
-
const mode = temp ? 'tempRange' : 'range'
|
|
734
|
-
const isStartEarlierEnd = dateCompare(before, after)
|
|
735
|
-
this[mode].startDate = isStartEarlierEnd ? before : after;
|
|
736
|
-
this[mode].endDate = isStartEarlierEnd ? after : before;
|
|
737
|
-
},
|
|
738
|
-
|
|
739
|
-
/**
|
|
740
|
-
* 比较时间大小
|
|
741
|
-
*/
|
|
742
|
-
dateCompare(startDate, endDate) {
|
|
743
|
-
// 计算截止时间
|
|
744
|
-
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
|
|
745
|
-
// 计算详细项的截止时间
|
|
746
|
-
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
|
|
747
|
-
return startDate <= endDate
|
|
748
|
-
},
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* 比较时间差
|
|
752
|
-
*/
|
|
753
|
-
diffDate(startDate, endDate) {
|
|
754
|
-
// 计算截止时间
|
|
755
|
-
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
|
|
756
|
-
// 计算详细项的截止时间
|
|
757
|
-
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
|
|
758
|
-
const diff = (endDate - startDate) / (24 * 60 * 60 * 1000)
|
|
759
|
-
return Math.abs(diff)
|
|
760
|
-
},
|
|
761
|
-
|
|
762
|
-
clear(needEmit = true) {
|
|
763
|
-
if (!this.isRange) {
|
|
764
|
-
this.displayValue = '';
|
|
765
|
-
this.inputDate = '';
|
|
766
|
-
this.pickerTime = '';
|
|
767
|
-
if (this.isPhone) {
|
|
768
|
-
this.$refs.mobile && this.$refs.mobile.clearCalender()
|
|
769
|
-
} else {
|
|
770
|
-
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender()
|
|
771
|
-
}
|
|
772
|
-
if (needEmit) {
|
|
773
|
-
this.$emit('change', '')
|
|
774
|
-
this.$emit('input', '')
|
|
775
|
-
this.$emit('update:modelValue', '')
|
|
776
|
-
}
|
|
777
|
-
} else {
|
|
778
|
-
this.displayRangeValue.startDate = '';
|
|
779
|
-
this.displayRangeValue.endDate = '';
|
|
780
|
-
this.tempRange.startDate = '';
|
|
781
|
-
this.tempRange.startTime = '';
|
|
782
|
-
this.tempRange.endDate = '';
|
|
783
|
-
this.tempRange.endTime = '';
|
|
784
|
-
if (this.isPhone) {
|
|
785
|
-
this.$refs.mobile && this.$refs.mobile.clearCalender()
|
|
786
|
-
} else {
|
|
787
|
-
this.$refs.left && this.$refs.left.clearCalender()
|
|
788
|
-
this.$refs.right && this.$refs.right.clearCalender()
|
|
789
|
-
this.$refs.right && this.$refs.right.changeMonth('next')
|
|
790
|
-
}
|
|
791
|
-
if (needEmit) {
|
|
792
|
-
this.$emit('change', [])
|
|
793
|
-
this.$emit('input', [])
|
|
794
|
-
this.$emit('update:modelValue', [])
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
},
|
|
799
|
-
watch: {
|
|
800
|
-
mode: {
|
|
801
|
-
immediate: true,
|
|
802
|
-
handler(newVal) {
|
|
803
|
-
this.hasTime = newVal.indexOf('time') !== -1;
|
|
804
|
-
this.isRange = newVal.indexOf('range') !== -1;
|
|
805
|
-
}
|
|
806
|
-
},
|
|
807
|
-
// #ifndef VUE3
|
|
808
|
-
value: {
|
|
809
|
-
immediate: true,
|
|
810
|
-
handler(newVal) {
|
|
811
|
-
if (this.isEmitValue) {
|
|
812
|
-
this.isEmitValue = false;
|
|
813
|
-
return
|
|
814
|
-
}
|
|
815
|
-
this.initPicker(newVal)
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
// #endif
|
|
819
|
-
// #ifdef VUE3
|
|
820
|
-
modelValue: {
|
|
821
|
-
immediate: true,
|
|
822
|
-
handler(newVal) {
|
|
823
|
-
if (this.isEmitValue) {
|
|
824
|
-
this.isEmitValue = false;
|
|
825
|
-
return
|
|
826
|
-
}
|
|
827
|
-
this.initPicker(newVal)
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
// #endif
|
|
831
|
-
start: {
|
|
832
|
-
immediate: true,
|
|
833
|
-
handler(newVal) {
|
|
834
|
-
if (!newVal) return
|
|
835
|
-
this.calendarRange.startDate = getDate(newVal);
|
|
836
|
-
if (this.hasTime) {
|
|
837
|
-
this.calendarRange.startTime = getTime(newVal);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
},
|
|
841
|
-
end: {
|
|
842
|
-
immediate: true,
|
|
843
|
-
handler(newVal) {
|
|
844
|
-
if (!newVal) return
|
|
845
|
-
this.calendarRange.endDate = getDate(newVal);
|
|
846
|
-
if (this.hasTime) {
|
|
847
|
-
this.calendarRange.endTime = getTime(newVal, this.hideSecond);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
},
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
</script>
|
|
854
|
-
|
|
855
|
-
<style lang="scss" scoped>
|
|
856
|
-
@import '../../libs/css/component.scss';
|
|
857
|
-
@import '../../libs/css/color.scss';
|
|
858
|
-
|
|
859
|
-
.fu-date {
|
|
860
|
-
width: 100%;
|
|
861
|
-
flex: 1;
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
.fu-date-x {
|
|
865
|
-
@include flex(row);
|
|
866
|
-
align-items: center;
|
|
867
|
-
justify-content: center;
|
|
868
|
-
border-radius: 4px;
|
|
869
|
-
background-color: #ffffff;
|
|
870
|
-
color: #666666;
|
|
871
|
-
font-size: 14px;
|
|
872
|
-
flex: 1;
|
|
873
|
-
|
|
874
|
-
.icon-calendar {
|
|
875
|
-
padding-left: 3px;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
.range-separator {
|
|
879
|
-
height: 40px;
|
|
880
|
-
/* #ifndef MP */
|
|
881
|
-
padding: 0 2px;
|
|
882
|
-
/* #endif */
|
|
883
|
-
line-height: 40px;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
.fu-date-x--border {
|
|
888
|
-
box-sizing: border-box;
|
|
889
|
-
border-radius: 4px;
|
|
890
|
-
border: 1px solid #e5e5e5;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
.fu-date-editor--x {
|
|
894
|
-
@include flex;
|
|
895
|
-
align-items: center;
|
|
896
|
-
position: relative;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
.fu-date-editor--x .fu-date__icon-clear {
|
|
900
|
-
padding-right: 3px;
|
|
901
|
-
@include flex;
|
|
902
|
-
align-items: center;
|
|
903
|
-
/* #ifdef H5 */
|
|
904
|
-
cursor: pointer;
|
|
905
|
-
/* #endif */
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
.fu-date__x-input {
|
|
909
|
-
width: auto;
|
|
910
|
-
height: 40px;
|
|
911
|
-
/* #ifndef MP */
|
|
912
|
-
padding-left: 5px;
|
|
913
|
-
/* #endif */
|
|
914
|
-
position: relative;
|
|
915
|
-
flex: 1;
|
|
916
|
-
line-height: 40px;
|
|
917
|
-
font-size: 14px;
|
|
918
|
-
overflow: hidden;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
.text-center {
|
|
922
|
-
text-align: center;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
.fu-date__input {
|
|
926
|
-
height: 40px;
|
|
927
|
-
width: 100%;
|
|
928
|
-
line-height: 40px;
|
|
929
|
-
font-size: 14px;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
.fu-date-range__input {
|
|
933
|
-
text-align: center;
|
|
934
|
-
max-width: 142px;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
.fu-date-picker__container {
|
|
938
|
-
position: relative;
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
.fu-date-mask--pc {
|
|
942
|
-
position: fixed;
|
|
943
|
-
bottom: 0px;
|
|
944
|
-
top: 0px;
|
|
945
|
-
left: 0px;
|
|
946
|
-
right: 0px;
|
|
947
|
-
background-color: rgba(0, 0, 0, 0);
|
|
948
|
-
transition-duration: 0.3s;
|
|
949
|
-
z-index: 996;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
.fu-date-single--x {
|
|
953
|
-
background-color: #ffffff;
|
|
954
|
-
position: absolute;
|
|
955
|
-
top: 0;
|
|
956
|
-
z-index: 999;
|
|
957
|
-
border: 1px solid #EBEEF5;
|
|
958
|
-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
959
|
-
border-radius: 4px;
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
.fu-date-range--x {
|
|
963
|
-
background-color: #ffffff;
|
|
964
|
-
position: absolute;
|
|
965
|
-
top: 0;
|
|
966
|
-
z-index: 999;
|
|
967
|
-
border: 1px solid #EBEEF5;
|
|
968
|
-
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
969
|
-
border-radius: 4px;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
.fu-date-editor--x__disabled {
|
|
973
|
-
opacity: 0.4;
|
|
974
|
-
cursor: default;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
.fu-date-editor--logo {
|
|
978
|
-
width: 16px;
|
|
979
|
-
height: 16px;
|
|
980
|
-
vertical-align: middle;
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
/* 添加时间 */
|
|
984
|
-
.popup-x-header {
|
|
985
|
-
@include flex(row);
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
.popup-x-header--datetime {
|
|
989
|
-
@include flex(row);
|
|
990
|
-
flex: 1;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
.popup-x-body {
|
|
994
|
-
@include flex;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
.popup-x-footer {
|
|
998
|
-
padding: 0 15px;
|
|
999
|
-
border-top-color: #F1F1F1;
|
|
1000
|
-
border-top-style: solid;
|
|
1001
|
-
border-top-width: 1px;
|
|
1002
|
-
line-height: 40px;
|
|
1003
|
-
text-align: right;
|
|
1004
|
-
color: #666;
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
.popup-x-footer text:hover {
|
|
1008
|
-
color: $fu-primary;
|
|
1009
|
-
cursor: pointer;
|
|
1010
|
-
opacity: 0.8;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
.popup-x-footer .confirm-text {
|
|
1014
|
-
margin-left: 20px;
|
|
1015
|
-
color: $fu-primary;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
.fu-date-changed {
|
|
1019
|
-
text-align: center;
|
|
1020
|
-
color: #333;
|
|
1021
|
-
border-bottom-color: #F1F1F1;
|
|
1022
|
-
border-bottom-style: solid;
|
|
1023
|
-
border-bottom-width: 1px;
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
.fu-date-changed--time text {
|
|
1027
|
-
height: 50px;
|
|
1028
|
-
line-height: 50px;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
.fu-date-changed .fu-date-changed--time {
|
|
1032
|
-
flex: 1;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
.fu-date-changed--time-date {
|
|
1036
|
-
color: #333;
|
|
1037
|
-
opacity: 0.6;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
.mr-50 {
|
|
1041
|
-
margin-right: 50px;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
/* picker 弹出层通用的指示小三角, 扩展至上下左右方向定位 */
|
|
1045
|
-
.fu-popper__arrow,
|
|
1046
|
-
.fu-popper__arrow::after {
|
|
1047
|
-
position: absolute;
|
|
1048
|
-
display: block;
|
|
1049
|
-
width: 0;
|
|
1050
|
-
height: 0;
|
|
1051
|
-
border: 6px solid transparent;
|
|
1052
|
-
border-top-width: 0;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
.fu-popper__arrow {
|
|
1056
|
-
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
|
1057
|
-
top: -6px;
|
|
1058
|
-
left: 10%;
|
|
1059
|
-
margin-right: 3px;
|
|
1060
|
-
border-bottom-color: #EBEEF5;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
.fu-popper__arrow::after {
|
|
1064
|
-
content: " ";
|
|
1065
|
-
top: 1px;
|
|
1066
|
-
margin-left: -6px;
|
|
1067
|
-
border-bottom-color: #ffffff;
|
|
1068
|
-
}
|
|
1069
|
-
</style>
|