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

@@ -3,14 +3,14 @@ import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, PageParams } from '@
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
import { useMutation } from '@tanstack/vue-query';
import dayjs from 'dayjs';
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type PaginationProps } from 'naive-ui';
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
import { h } from 'vue';
import { reactive, ref, toRefs } from 'vue';
const props = defineProps<{
stationCode: string;
ndmDevice: NdmDeviceResultVO;
dateTimeRange: [number, number];
dateTimeRange: DatePickerProps['value'];
}>();
const { stationCode, ndmDevice, dateTimeRange } = toRefs(props);
@@ -64,9 +64,11 @@ const pagination = reactive<PaginationProps>({
const { mutate: getDeviceAlarmLogList, isPending } = useMutation({
mutationFn: async () => {
if (!dateTimeRange.value) throw new Error('请选择时间范围');
const range = dateTimeRange.value as [number, number];
const deviceId = ndmDevice.value.deviceId;
const alarmDate_ge = dateTimeRange.value[0];
const alarmDate_le = dateTimeRange.value[1];
const alarmDate_ge = range[0];
const alarmDate_le = range[1];
const restParams: Omit<PageParams<{ id: string }>, 'model' | 'extra'> = {
current: pagination.page ?? 1,
size: pagination.pageSize ?? DEFAULT_PAGE_SIZE,