wujingjing
2025-01-15 0647fd26414fc8a3ab077d355f50da6e3e36ad63
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();