wujingjing
2024-07-29 8e6eecb176f29ebd351ac7ddbfd2de5365fda79f
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) {