|
@@ -107,6 +107,11 @@ export default {
|
|
|
PopupLayout
|
|
|
},
|
|
|
props: {
|
|
|
+ // 最大时间是否可以选择一个未来的时间,默认最大时间为当天
|
|
|
+ endTimeFeature: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
/**
|
|
|
* 是否高亮
|
|
|
*/
|
|
@@ -137,8 +142,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
+ const now = dayjs()
|
|
|
+ const threeYearLater = now.add(3, 'year');
|
|
|
+ const endMaxDate = this.endTimeFeature ? threeYearLater.toDate() : now.toDate()
|
|
|
+ const startMinDate = new Date(2015, 0, 1)
|
|
|
return {
|
|
|
debug: import.meta.env.DEV,
|
|
|
+ conf: {
|
|
|
+ startMinDate: startMinDate,
|
|
|
+ endMaxDate: endMaxDate
|
|
|
+ },
|
|
|
picker: {
|
|
|
type: 'date',
|
|
|
showToolBar: false,
|
|
@@ -153,16 +166,16 @@ export default {
|
|
|
valueStamp: '',
|
|
|
placeholder: '开始时间',
|
|
|
currentDate: new Date(),
|
|
|
- minDate: new Date(2010, 0, 1),
|
|
|
- maxDate: new Date()
|
|
|
+ minDate: startMinDate,
|
|
|
+ maxDate: endMaxDate
|
|
|
},
|
|
|
end: {
|
|
|
value: '',
|
|
|
valueStamp: '',
|
|
|
placeholder: '结束时间',
|
|
|
currentDate: new Date(),
|
|
|
- minDate: new Date(2010, 0, 1),
|
|
|
- maxDate: new Date()
|
|
|
+ minDate: startMinDate,
|
|
|
+ maxDate: endMaxDate
|
|
|
},
|
|
|
popupShow: {
|
|
|
start: false,
|
|
@@ -227,9 +240,9 @@ export default {
|
|
|
}
|
|
|
// 重置最大值和最小值
|
|
|
if (type === 'start') {
|
|
|
- this.end.minDate = new Date(2015, 0, 1)
|
|
|
+ this.end.minDate = this.conf.startMinDate
|
|
|
} else if (type === 'end') {
|
|
|
- this.start.maxDate = new Date()
|
|
|
+ this.start.maxDate = this.conf.endMaxDate
|
|
|
}
|
|
|
if (type === 'start') {
|
|
|
this[type].currentDate = this.startTimeRemap
|