fix:时间选择器检验错误

This commit is contained in:
zyh
2023-02-27 15:55:01 +08:00
parent d9dd475950
commit 3acc639ed2
2 changed files with 33 additions and 19 deletions

View File

@@ -411,10 +411,11 @@ export default {
this.oldSearchTime[1] = bus.timeFormate(this.oldSearchTime[1])
}
}
// console.log(moment(this.oldSearchTime[0], timeFormatMain).isValid(), moment(this.oldSearchTime[1], timeFormatMain).isValid(), !moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1]))
if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && !moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1])) {
this.oldSearchTimeError[0] = true
this.inputError = this.$t('date.fromGreaterTo')
} else if (moment(this.oldSearchTime[0], timeFormatMain).isValid() && moment(this.oldSearchTime[1], timeFormatMain).isValid() && moment(this.oldSearchTime[0]).isBefore(this.oldSearchTime[1])) {
this.oldSearchTimeError[0] = false
}
},
dateChange () {
@@ -422,7 +423,6 @@ export default {
this.oldSearchTimeError[1] = false
},
setCustomTime (timeGroup, timeRange) {
console.log(timeGroup)
if (timeGroup) {
this.showTime = this.nowTimeType = this.timeData.find(
(item) => item.id == timeGroup.id