From 4e394d1f4ed0928d5498083621966aba390a7642 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 05 三月 2025 16:05:15 +0800 Subject: [PATCH] 图表查询 --- src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue | 34 ++++++++++++++++++++++++---------- 1 files changed, 24 insertions(+), 10 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 ef234c6..29ab49d 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue @@ -15,7 +15,7 @@ :value-format="valueFormat" :format="DEFAULT_FORMATS_DATE" :disabled-date="disabledDate" - :clearable="false" + :clearable="true" :disabled="disabled" @change="datePickerChange" > @@ -54,21 +54,19 @@ <script setup lang="ts"> import { ElDatePicker } from 'element-plus'; import { definePropType } from 'element-plus/es/utils/vue/props/runtime'; -import { ref, type PropType, computed, watch, nextTick } from 'vue'; +import moment from 'moment'; +import { computed, nextTick, onMounted, ref, type PropType } from 'vue'; import type { TimeRangeParam } from '../types'; -import { TimeRangeEnum, TimeStepValue, monthTimeRangeEnumMapTitle } from './types'; -import { dayTimeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; +import type { TimeRangeEnum } from './types'; +import { TimeStepValue, dayTimeRangeEnumMapTitle, monthTimeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; import { CURRENT_DAY, DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_TIME, END_PLACEHOLDER, - RANGE_SEPARATOR, START_PLACEHOLDER, } from '/@/components/form/datepicker/constants'; import { formatDate } from '/@/utils/formatTime'; -import moment from 'moment'; -import { isSharePage } from '/@/stores/chatRoom'; const valueFormat = DEFAULT_FORMATS_DATE + ' ' + DEFAULT_FORMATS_TIME; const props = defineProps({ @@ -78,6 +76,10 @@ disabled: { type: Boolean, default: false, + }, + quickActive: { + type: Number as PropType<TimeRangeEnum>, + required: false, }, }); @@ -100,6 +102,9 @@ const dateChange = () => { nextTick(() => { + if (dateValue.value?.[1]) { + dateValue.value[1] = dateValue.value[1].slice(0, 10) + ' 23:59:59'; + } emit('change', dateValue.value); }); }; @@ -112,12 +117,17 @@ quickPickValue.value = null; }; const quickPickValue = ref<TimeRangeEnum>(null); + +const pickQuickRange = (val: TimeRangeEnum) => { + // if(val==undefined) return; + quickPickValue.value = val; + dateValue.value = timeRangeEnumMapValue[val]().map((item) => formatDate(item)) as [string, string]; +}; const quickPickRangeClick = (val: TimeRangeEnum) => { if (props.disabled) return; if (quickPickValue.value === val) return; - quickPickValue.value = val; - dateValue.value = timeRangeEnumMapValue[val]().map((item) => formatDate(item)) as [string, string]; + pickQuickRange(val); dateChange(); }; @@ -146,7 +156,11 @@ resetQuickPickValue(); dateChange(); }; - +onMounted(() => { + if(props.quickActive !=null){ + pickQuickRange(props.quickActive); + } +}); defineExpose({ formatDateValue: dateValue, }); -- Gitblit v1.9.3