From 73e80dfc94338280fd26fd35be2093f56867a5c1 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 2 Jan 2025 10:09:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6):=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8A=A8=E6=80=81=E6=97=A5=E6=9C=9F=E6=9C=AC=E6=9C=88?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E5=80=BC=E5=88=99=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=8A=A5=E9=94=99=20#14445?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v-query/QueryConditionConfiguration.vue | 7 +++++-- .../src/custom-component/v-query/time-format.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue index 55ff3cacdd..470b5fdb6c 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -2062,8 +2062,11 @@ const timeGranularityChange = (val: string) => { } const handleTimeTypeChange = () => { - timeGranularityChange(curComponent.value.timeGranularity) - timeGranularityMultipleChange(curComponent.value.timeGranularityMultiple) + if (curComponent.value.displayType === '1') { + timeGranularityChange(curComponent.value.timeGranularity) + } else { + timeGranularityMultipleChange(curComponent.value.timeGranularityMultiple) + } } const timeGranularityMultipleChange = (val: string) => { diff --git a/core/core-frontend/src/custom-component/v-query/time-format.ts b/core/core-frontend/src/custom-component/v-query/time-format.ts index 78aec5b255..fbfd43378f 100644 --- a/core/core-frontend/src/custom-component/v-query/time-format.ts +++ b/core/core-frontend/src/custom-component/v-query/time-format.ts @@ -17,9 +17,12 @@ function getThisMonth() { return new Date(`${date.getFullYear()}/${date.getMonth() + 1}`) } +function getLastStart(val = 'month' as ManipulateType) { + return new Date(dayjs().subtract(1, val).startOf(val).format('YYYY/MM/DD HH:mm:ss')) +} + function getLastMonth() { - const date = new Date() - return new Date(`${date.getFullYear()}/${date.getMonth()}`) + return getLastStart() } function getNextMonth() {