feat: 添加日期快捷选择功能并更新多个组件以使用新选择器

This commit is contained in:
TsMask
2025-07-04 15:14:13 +08:00
parent 8990fa8dee
commit edd3865094
6 changed files with 69 additions and 84 deletions

View File

@@ -24,6 +24,7 @@ import PQueue from 'p-queue';
import { listTenant } from '@/api/system/tenant';
import { useClipboard } from '@vueuse/core';
import dayjs, { type Dayjs } from 'dayjs';
import { dayjsRanges } from '@/hooks/useRangePicker';
const { copy } = useClipboard({ legacy: true });
const { t } = useI18n();
const { getDict } = useDictStore();
@@ -52,21 +53,6 @@ let queryRangePicker = ref<[Dayjs, Dayjs] | undefined>([
dayjs().startOf('hour'),
dayjs().endOf('hour'),
]);
/**时间范围 */
let rangePickerPresets = ref([
{
label: 'Now hour',
value: [dayjs().startOf('hour'), dayjs().endOf('hour')],
},
{ label: 'Today', value: [dayjs().startOf('day'), dayjs().endOf('day')] },
{
label: 'Yesterday',
value: [
dayjs().subtract(1, 'day').startOf('day'),
dayjs().subtract(1, 'day').endOf('day'),
],
},
]);
/**查询参数 */
let queryParams = reactive({
@@ -648,7 +634,7 @@ onBeforeUnmount(() => {
>
<a-range-picker
v-model:value="queryRangePicker"
:presets="rangePickerPresets"
:presets="dayjsRanges()"
:bordered="true"
:allow-clear="false"
style="width: 100%"