From 8e6eecb176f29ebd351ac7ddbfd2de5365fda79f Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期一, 29 七月 2024 11:24:31 +0800 Subject: [PATCH] 曲线查询 bug --- src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue index 961eb9d..78a2c38 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue @@ -17,6 +17,7 @@ :disabled-date="disabledDate" :clearable="false" :disabled="disabled" + @change="datePickerChange" > <template v-for="(value, name) in $slots" #[name]="slotData"> <slot :name="name" v-bind="slotData || {}"></slot> @@ -47,7 +48,7 @@ import { ElDatePicker } from 'element-plus'; import { definePropType } from 'element-plus/es/utils/vue/props/runtime'; import { ref, type PropType, computed, watch } from 'vue'; -import type { TimestampParam } from '../types'; +import type { TimeRangeParam } from '../types'; import type { TimeRangeEnum } from './types'; import { timeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; import { @@ -64,7 +65,7 @@ const valueFormat = DEFAULT_FORMATS_DATE + ' ' + DEFAULT_FORMATS_TIME; const props = defineProps({ data: { - type: Object as PropType<TimestampParam>, + type: Object as PropType<TimeRangeParam>, }, disabled: { type: Boolean, @@ -95,6 +96,10 @@ const disabledDate = (date: Date) => { return date > CURRENT_DAY; }; + +const resetQuickPickValue = () =>{ + quickPickValue.value = null; +} const quickPickValue = ref<TimeRangeEnum>(null); const quickPickRangeClick = (val: TimeRangeEnum) => { if (quickPickValue.value === val) return; @@ -108,12 +113,19 @@ if (!dateValue.value) return; dateValue.value[0] = moment(dateValue.value[0]).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); dateValue.value = [...dateValue.value]; + resetQuickPickValue(); + }; const nextDayClick = () => { if (!dateValue.value) return; dateValue.value[1] = moment(dateValue.value[1]).add(1, 'day').format('YYYY-MM-DD HH:mm:ss'); dateValue.value = [...dateValue.value]; + resetQuickPickValue(); +}; + +const datePickerChange = (va) => { + resetQuickPickValue(); }; watch( @@ -122,6 +134,10 @@ emit('change', val); } ); + +defineExpose({ + formatDateValue +}) </script> <style scoped lang="scss"> :deep(.el-date-editor .el-range__close-icon--hidden) { -- Gitblit v1.9.3