fix: 修复报告Box侧滑Time limit 为 customize,时间限制错误问题

This commit is contained in:
@changcode
2022-10-19 17:19:39 +08:00
parent 53fc6475e2
commit 5767fe896b

View File

@@ -74,8 +74,9 @@
size="small"
:format="dateFormat"
:disabled="!!editObject.id"
:disabled-date="disabledDate"
:disabled-date="startDisabledDate"
@change="startTimeChang"
@focus="startFocus"
prefix-icon="cn-icon cn-icon-shijian"
type="datetime"
placeholder=" "
@@ -93,8 +94,9 @@
size="small"
:format="dateFormat"
:disabled="!!editObject.id"
:disabled-date="disabledDate"
:disabled-date="endDisabledDate"
@change="endTimeChange"
@focus="endFocus"
prefix-icon="cn-icon cn-icon-shijian"
type="datetime"
placeholder=" "
@@ -313,27 +315,53 @@ export default {
setup () {
const startTime = ref('')
const endTime = ref('')
const focus = ref('')
const focusDate = ref('')
function endTimeChange (val) {
endTime.value = val
}
function startTimeChang (val) {
startTime.value = val
}
const disabledDate = (time) => {
function startFocus (val) {
focus.value = val.target.value
}
function endFocus (val) {
focusDate.value = val.target.value
}
const endDisabledDate = (time) => {
if (time.getTime() > new Date()) {
return true
}
if (startTime.value != '' && startTime.value > time) {
return true
}
if (focusDate.value != '' && endTime.value > time) {
return false
} else if (endTime.value != '' && endTime.value < time) {
return true
}
}
const startDisabledDate = (time) => {
if (time.getTime() > new Date()) {
return true
}
if (focus.value != '' && startTime.value > time) {
return false
} else if (startTime.value != '' && startTime.value > time) {
return true
}
if (endTime.value != '' && endTime.value < time) {
return true
}
}
return {
disabledDate,
endDisabledDate,
startDisabledDate,
startTimeChang,
endTimeChange
endTimeChange,
startFocus,
endFocus
}
},
data () {