perf: set default date range to 1 week in HistoryDiagCard

This commit is contained in:
yangsy
2025-09-10 15:49:24 +08:00
parent 27e71fa797
commit 13c558bfc1
12 changed files with 72 additions and 49 deletions

View File

@@ -29,13 +29,13 @@ import type { NdmDeviceResultVO, NdmIcmpLogResultVO, NdmIcmpLogVO, PageParams, P
import { postIcmpLogPage } from '@/apis/requests';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
import { NCard, NPagination, NScrollbar, NTimeline, NTimelineItem, type PaginationProps, type TimelineItemProps } from 'naive-ui';
import { NCard, NPagination, NScrollbar, NTimeline, NTimelineItem, type DatePickerProps, type PaginationProps, type TimelineItemProps } from 'naive-ui';
import { computed, h, reactive, ref, toRefs } from 'vue';
const props = defineProps<{
stationCode: string;
ndmDevice: NdmDeviceResultVO;
dateTimeRange: [number, number];
dateTimeRange: DatePickerProps['value'];
}>();
const { stationCode, ndmDevice, dateTimeRange } = toRefs(props);
@@ -67,9 +67,11 @@ const pagination = reactive<PaginationProps>({
const { mutate: getDeviceIcmpLogList, isPending } = useMutation({
mutationFn: async () => {
if (!dateTimeRange.value) throw new Error('请选择时间范围');
const range = dateTimeRange.value as [number, number];
const id = ndmDevice.value.id;
const createdTime_precisest = dayjs(dateTimeRange.value[0]).format('YYYY-MM-DD HH:mm:ss');
const createdTime_preciseed = dayjs(dateTimeRange.value[1]).format('YYYY-MM-DD HH:mm:ss');
const createdTime_precisest = dayjs(range[0]).format('YYYY-MM-DD HH:mm:ss');
const createdTime_preciseed = dayjs(range[1]).format('YYYY-MM-DD HH:mm:ss');
const restParams: Omit<PageParams<{ id: string }>, 'model' | 'extra'> = {
current: pagination.page ?? 1,
size: pagination.pageSize ?? DEFAULT_PAGE_SIZE,