init duration

This commit is contained in:
Fine 2025-05-15 10:06:30 +08:00
parent 3ecf2afa1c
commit 5394e1eca8
2 changed files with 9 additions and 6 deletions

View File

@ -86,7 +86,7 @@ limitations under the License. -->
<script lang="ts" setup>
import { Themes } from "@/constants/data";
import router from "@/router";
import { useAppStoreWithOut } from "@/store/modules/app";
import { useAppStoreWithOut, InitializationDurationRow } from "@/store/modules/app";
import { useDashboardStore } from "@/store/modules/dashboard";
import type { DashboardItem } from "@/types/dashboard";
import timeFormat from "@/utils/timeFormat";
@ -154,6 +154,7 @@ limitations under the License. -->
day: appStore.metricsTTL.day,
});
}
appStore.setDuration(InitializationDurationRow);
}
function handleChangeTheme() {

View File

@ -43,14 +43,16 @@ interface AppState {
recordsTTL: Recordable<RecordsTTL>;
}
export const InitializationDurationRow = {
start: new Date(new Date().getTime() - 1800000),
end: new Date(),
step: TimeType.MINUTE_TIME,
};
export const appStore = defineStore({
id: "app",
state: (): AppState => ({
durationRow: {
start: new Date(new Date().getTime() - 1800000),
end: new Date(),
step: TimeType.MINUTE_TIME,
},
durationRow: InitializationDurationRow,
utc: "",
utcHour: 0,
utcMin: 0,