diff --git a/src/components/form/datePicker/index.vue b/src/components/form/datePicker/index.vue
index 7216ba7..ee66a44 100644
--- a/src/components/form/datePicker/index.vue
+++ b/src/components/form/datePicker/index.vue
@@ -20,6 +20,7 @@
value-format="YYYY-MM-DD"
:shortcuts="shortcuts"
/>
+
当前
@@ -35,7 +36,7 @@ interface Props {
theCurrentTime?: boolean
initialInterval?: number
initialTimeValue?: any
- timeKeyList?: string[] //日期下拉
+ timeKeyList?: string[] //日期下拉
}
const props = withDefaults(defineProps(), {
@@ -97,11 +98,8 @@ const filteredTimeOptions = computed(() => {
if (!props.timeKeyList || props.timeKeyList.length === 0) {
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(() => {
@@ -143,6 +141,11 @@ const emitChange = () => {
timeValue: timeValue.value,
timeFlag: timeFlag.value
})
+
+ // preClick 操作后不执行按钮状态检查
+ if (!isUserAction) {
+ checkButtonStatus()
+ }
})
}
// 选择时间范围
@@ -186,8 +189,17 @@ const timeChange = (e: number) => {
emitChange()
}
-// 添加按钮状态检查方法
-const checkButtonStatus = () => {
+// 添加一个标志来跟踪是否由用户操作触发
+let isUserAction = true
+
+// 修改 checkButtonStatus 方法
+const checkButtonStatus = (forceEnable = false) => {
+ // 如果是强制启用,则直接启用
+ if (forceEnable) {
+ preDisabled.value = false
+ return
+ }
+
if (timeValue.value && timeValue.value.length >= 2) {
const endTime = timeValue.value[1]
const currentDate = window.XEUtils.toDateString(new Date(), 'yyyy-MM-dd')
@@ -270,8 +282,10 @@ const preClick = () => {
// var temp = NowgetEndTime()
// timeStatus(temp, endTime)
- // 触发 change 事件
+ // 触发 change 事件,但临时标记为用户操作
+ isUserAction = true
emitChange()
+ isUserAction = false
}
//下一个
const next = () => {