perf: set default date range to 1 week in HistoryDiagCard
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis/models';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect } from 'naive-ui';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
@@ -16,7 +16,7 @@ const props = defineProps<{
|
||||
const { stationCode, ndmSecurityBox } = toRefs(props);
|
||||
|
||||
const searchFields = reactive({
|
||||
dateTimeRange: [0, 0] as [number, number],
|
||||
dateTimeRange: undefined as DatePickerProps['value'],
|
||||
});
|
||||
|
||||
type DeviceStatusHistoryDiagCardInst = InstanceType<typeof DeviceStatusHistoryDiagCard> | null;
|
||||
@@ -39,8 +39,8 @@ const loading = computed(() => {
|
||||
onMounted(() => {
|
||||
const now = dayjs();
|
||||
const todayEnd = now.endOf('date');
|
||||
const seasonAgo = now.subtract(3, 'month').startOf('date');
|
||||
searchFields.dateTimeRange = [seasonAgo.valueOf(), todayEnd.valueOf()];
|
||||
const weekAgo = now.subtract(1, 'week').startOf('date');
|
||||
searchFields.dateTimeRange = [weekAgo.valueOf(), todayEnd.valueOf()];
|
||||
refreshData();
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user