From 9a8a56f6d2cfe0ab9ec9368d58d03d1cf10ade28 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期日, 25 八月 2024 11:22:10 +0800 Subject: [PATCH] ywifont --- src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 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..674e9bd 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue @@ -2,7 +2,7 @@ <div class="flex items-center"> <div class="flex items-center space-x-1"> <div - class="ywicon icon-pre" + class="ywifont ywicon-pre" :class="{ 'cursor-not-allowed': !offsetClickIsAllow, 'cursor-pointer': offsetClickIsAllow }" @click="preDayClick" ></div> @@ -17,13 +17,14 @@ :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> </template> </el-date-picker> <div - class="ywicon icon-next" + class="ywifont ywicon-next" :class="{ 'cursor-not-allowed': !offsetClickIsAllow, 'cursor-pointer': offsetClickIsAllow }" @click="nextDayClick" ></div> @@ -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