<DatePicker
type="datetimerange"
:clearable="false"
:options="options"
:value='changeTime'
placement="bottom-end"
format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"
style="width: 200px"
@on-change='tiemChange'></DatePicker>
data () {
return {
changeTime: [getDate('yyyy-MM-dd 00:00:00'), getDate('yyyy-MM-dd 23:59:59')],
options: {
disabledDate (date) {
return date && date.valueOf() > Date.now()
}
},
}
}
// 选择日期变化
tiemChange (event) {
event[1] = event[1].replace(/00:00:00/, '23:59:59')
const day = Math.floor((getTime(event[1]) - getTime(event[0])) / 86400000)
if (day > 30) {
// this.changeTime = [getDate('yyyy-MM-dd 00:00:00'), getDate('yyyy-MM-dd 23:59:59')]
return this.$Message.error('日期范围最大选择30天')
} else {
this.changeTime = event
this.getTableList(1)
}
},