From 0647fd26414fc8a3ab077d355f50da6e3e36ad63 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 15 一月 2025 17:40:57 +0800 Subject: [PATCH] 实现原本功能 --- src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue | 38 ++++++++++++++++++++++++++++++++------ 1 files changed, 32 insertions(+), 6 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 96d24d5..ef234c6 100644 --- a/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue +++ b/src/components/chat/chatComponents/summaryCom/components/recordSet/components/TimeRange.vue @@ -33,12 +33,19 @@ <div class="ml-2 inline-flex items-center space-x-2 text-[14px]"> <div @click="quickPickRangeClick(parseInt(item))" - class="border border-solid rounded-md px-2 cursor-pointer" - :class="{ 'bg-[#1677ff]': parseInt(item) === quickPickValue, 'text-white': parseInt(item) === quickPickValue }" - v-for="item in Object.keys(timeRangeEnumMapTitle)" + class="border border-solid rounded-md px-2 py-1 cursor-pointer" + :class="{ + 'bg-[#1677ff]': parseInt(item) === quickPickValue, + 'text-white': parseInt(item) === quickPickValue, + 'bg-[#f5f7fa]': disabled, + 'text-[#a9acb3]': disabled, + 'border-[#dcdfe6]': disabled, + '!cursor-not-allowed': disabled, + }" + v-for="item in Object.keys(timeRangeMapTitle)" :key="item" > - {{ timeRangeEnumMapTitle[item] }} + {{ timeRangeMapTitle[item] }} </div> </div> </div> @@ -49,8 +56,8 @@ import { definePropType } from 'element-plus/es/utils/vue/props/runtime'; import { ref, type PropType, computed, watch, nextTick } from 'vue'; import type { TimeRangeParam } from '../types'; -import type { TimeRangeEnum } from './types'; -import { timeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; +import { TimeRangeEnum, TimeStepValue, monthTimeRangeEnumMapTitle } from './types'; +import { dayTimeRangeEnumMapTitle, timeRangeEnumMapValue } from './types'; import { CURRENT_DAY, DEFAULT_FORMATS_DATE, @@ -61,6 +68,7 @@ } 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({ @@ -72,6 +80,19 @@ default: false, }, }); + +const getRangeMapTitle = (timeStep: TimeStepValue) => { + switch (timeStep) { + case TimeStepValue.Day: + return dayTimeRangeEnumMapTitle; + case TimeStepValue.Month: + return monthTimeRangeEnumMapTitle; + default: + return dayTimeRangeEnumMapTitle; + } +}; + +const timeRangeMapTitle = getRangeMapTitle(props.data?.origin?.time_step); const dateValue = defineModel({ type: definePropType<[string, string]>(Array), }); @@ -92,6 +113,7 @@ }; const quickPickValue = ref<TimeRangeEnum>(null); const quickPickRangeClick = (val: TimeRangeEnum) => { + if (props.disabled) return; if (quickPickValue.value === val) return; quickPickValue.value = val; @@ -101,6 +123,8 @@ const offsetClickIsAllow = computed(() => !!dateValue.value && !props.disabled); const preDayClick = () => { + if (props.disabled) return; + if (!dateValue.value) return; dateValue.value[0] = moment(dateValue.value[0]).subtract(1, 'day').format('YYYY-MM-DD HH:mm:ss'); dateChange(); @@ -109,6 +133,8 @@ }; const nextDayClick = () => { + if (props.disabled) return; + if (!dateValue.value) return; dateValue.value[1] = moment(dateValue.value[1]).add(1, 'day').format('YYYY-MM-DD HH:mm:ss'); dateChange(); -- Gitblit v1.9.3