我的消息开发
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/* 查询条件有时间范围的 混入方法 */
|
||||
import moment from 'moment'
|
||||
export const RangeDateMixin = {
|
||||
data() {
|
||||
return {
|
||||
dateKeyObj: {
|
||||
beginKey: 'startTime',
|
||||
endKey: 'endTime'
|
||||
},
|
||||
rangeDateFormat: {
|
||||
begin: 'YYYY-MM-DD HH:mm:ss',
|
||||
end: 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
disabledStartDate(startValue) {
|
||||
const endValue = this.queryParam[this.dateKeyObj.endKey] && moment(this.queryParam[this.dateKeyObj.endKey], this.rangeDateFormat.end)
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
return startValue.valueOf() > endValue.valueOf()
|
||||
},
|
||||
|
||||
disabledEndDate(endValue) {
|
||||
const startValue = this.queryParam[this.dateKeyObj.beginKey] && moment(this.queryParam[this.dateKeyObj.beginKey], this.rangeDateFormat.begin)
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
return startValue.valueOf() > endValue.valueOf()
|
||||
},
|
||||
disabledDateBeforeToday(current) {
|
||||
return current < moment().subtract(1, 'day') // 当天之前的不可选,不包括当天
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user