From 46edc3eefb8d8619e7fe77b4ea48bb2e7d91e5c8 Mon Sep 17 00:00:00 2001 From: vol4tim Date: Tue, 24 Dec 2024 15:25:06 +0400 Subject: [PATCH] fix calendar --- src/components/sensor/SensorPopup.vue | 9 +++++++-- src/views/Main.vue | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/sensor/SensorPopup.vue b/src/components/sensor/SensorPopup.vue index ba998f3..e413888 100644 --- a/src/components/sensor/SensorPopup.vue +++ b/src/components/sensor/SensorPopup.vue @@ -144,7 +144,7 @@ import Copy from "./Copy.vue"; export default { emits: ["close"], - props: ["type", "point"], + props: ["type", "point", "startTime"], components: { Chart, Copy, Bookmark }, data() { return { @@ -152,7 +152,6 @@ export default { measurement: this.type, isShowPath: false, store: useStore(), - start: moment().format("YYYY-MM-DD"), maxDate: moment().format("YYYY-MM-DD"), provider: this.$route.params.provider, rttime: null /* used for realtime view */, @@ -162,6 +161,12 @@ export default { }; }, computed: { + start() { + return this.startTime + ? moment.unix(this.startTime).format("YYYY-MM-DD") + : moment().format("YYYY-MM-DD"); + }, + locale() { return localStorage.getItem("locale") || this.$i18n.locale || "en"; }, diff --git a/src/views/Main.vue b/src/views/Main.vue index b4355d8..4b9b42f 100755 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -16,6 +16,7 @@ @modal="handlerModal" @close="handlerClose" @history="handlerHistoryLog" + :startTime="start" /> @@ -87,6 +88,8 @@ export default { timeout: 5000, maximumAge: 0, }, + start: null, + end: null, }; }, computed: { @@ -116,6 +119,8 @@ export default { }, methods: { async handlerHistory({ start, end }) { + this.start = start; + this.end = end; this.status = "history"; this.providerObj.watch(null); this.handlerClose();