修改"下一个"按钮的状态
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
:shortcuts="shortcuts"
|
:shortcuts="shortcuts"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<el-button :disabled="backDisabled" type="primary" :icon="DArrowLeft" @click="preClick"></el-button>
|
<el-button :disabled="backDisabled" type="primary" :icon="DArrowLeft" @click="preClick"></el-button>
|
||||||
<el-button type="primary" :icon="VideoPause" @click="nowTime">当前</el-button>
|
<el-button type="primary" :icon="VideoPause" @click="nowTime">当前</el-button>
|
||||||
<el-button :disabled="preDisabled" type="primary" :icon="DArrowRight" @click="next"></el-button>
|
<el-button :disabled="preDisabled" type="primary" :icon="DArrowRight" @click="next"></el-button>
|
||||||
@@ -35,7 +36,7 @@ interface Props {
|
|||||||
theCurrentTime?: boolean
|
theCurrentTime?: boolean
|
||||||
initialInterval?: number
|
initialInterval?: number
|
||||||
initialTimeValue?: any
|
initialTimeValue?: any
|
||||||
timeKeyList?: string[] //日期下拉
|
timeKeyList?: string[] //日期下拉
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
@@ -97,11 +98,8 @@ const filteredTimeOptions = computed(() => {
|
|||||||
if (!props.timeKeyList || props.timeKeyList.length === 0) {
|
if (!props.timeKeyList || props.timeKeyList.length === 0) {
|
||||||
return timeOptions.value
|
return timeOptions.value
|
||||||
}
|
}
|
||||||
|
|
||||||
return timeOptions.value.filter((option: any) =>
|
|
||||||
props.timeKeyList.includes(option.value.toString())
|
|
||||||
)
|
|
||||||
|
|
||||||
|
return timeOptions.value.filter((option: any) => props.timeKeyList.includes(option.value.toString()))
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -143,6 +141,11 @@ const emitChange = () => {
|
|||||||
timeValue: timeValue.value,
|
timeValue: timeValue.value,
|
||||||
timeFlag: timeFlag.value
|
timeFlag: timeFlag.value
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// preClick 操作后不执行按钮状态检查
|
||||||
|
if (!isUserAction) {
|
||||||
|
checkButtonStatus()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 选择时间范围
|
// 选择时间范围
|
||||||
@@ -186,8 +189,17 @@ const timeChange = (e: number) => {
|
|||||||
emitChange()
|
emitChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加按钮状态检查方法
|
// 添加一个标志来跟踪是否由用户操作触发
|
||||||
const checkButtonStatus = () => {
|
let isUserAction = true
|
||||||
|
|
||||||
|
// 修改 checkButtonStatus 方法
|
||||||
|
const checkButtonStatus = (forceEnable = false) => {
|
||||||
|
// 如果是强制启用,则直接启用
|
||||||
|
if (forceEnable) {
|
||||||
|
preDisabled.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (timeValue.value && timeValue.value.length >= 2) {
|
if (timeValue.value && timeValue.value.length >= 2) {
|
||||||
const endTime = timeValue.value[1]
|
const endTime = timeValue.value[1]
|
||||||
const currentDate = window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd')
|
const currentDate = window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd')
|
||||||
@@ -270,8 +282,10 @@ const preClick = () => {
|
|||||||
// var temp = NowgetEndTime()
|
// var temp = NowgetEndTime()
|
||||||
// timeStatus(temp, endTime)
|
// timeStatus(temp, endTime)
|
||||||
|
|
||||||
// 触发 change 事件
|
// 触发 change 事件,但临时标记为用户操作
|
||||||
|
isUserAction = true
|
||||||
emitChange()
|
emitChange()
|
||||||
|
isUserAction = false
|
||||||
}
|
}
|
||||||
//下一个
|
//下一个
|
||||||
const next = () => {
|
const next = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user