From a3160e5eba929c1f8776c83d4831db7b6944ee3d Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Tue, 19 Mar 2024 17:47:44 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6):=20?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6=E5=8F=AF?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=9F=A5=E8=AF=A2=E7=9A=84=E8=B5=B7=E5=A7=8B?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=20#6005?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v-query/DynamicTimeFiltering.vue | 19 +++++++++++++++++-- .../v-query/DynamicTimeRangeFiltering.vue | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/custom-component/v-query/DynamicTimeFiltering.vue b/core/core-frontend/src/custom-component/v-query/DynamicTimeFiltering.vue index 6c0e156fc1..952d905aea 100644 --- a/core/core-frontend/src/custom-component/v-query/DynamicTimeFiltering.vue +++ b/core/core-frontend/src/custom-component/v-query/DynamicTimeFiltering.vue @@ -40,10 +40,18 @@ const props = defineProps({ const { config } = toRefs(props) const timeConfig = computed(() => { - const { relativeToCurrent, intervalType, timeNum, relativeToCurrentType, around } = config.value + const { + relativeToCurrent, + regularOrTrends, + intervalType, + timeNum, + relativeToCurrentType, + around + } = config.value return { relativeToCurrent, timeNum, + regularOrTrends, intervalType, relativeToCurrentType, around, @@ -69,7 +77,14 @@ const timeInterval = computed(() => { }) const init = () => { - const { relativeToCurrent, timeNum, relativeToCurrentType, around } = timeConfig.value + const { relativeToCurrent, regularOrTrends, timeNum, relativeToCurrentType, around } = + timeConfig.value + if (regularOrTrends === 'fixed') { + if (!!config.value.regularOrTrendsValue && !Array.isArray(config.value.regularOrTrendsValue)) + return + config.value.regularOrTrendsValue = new Date() + return + } if (relativeToCurrent === 'custom') { config.value.regularOrTrendsValue = getAround( relativeToCurrentType, diff --git a/core/core-frontend/src/custom-component/v-query/DynamicTimeRangeFiltering.vue b/core/core-frontend/src/custom-component/v-query/DynamicTimeRangeFiltering.vue index 70504ba5da..4a8630f3e7 100644 --- a/core/core-frontend/src/custom-component/v-query/DynamicTimeRangeFiltering.vue +++ b/core/core-frontend/src/custom-component/v-query/DynamicTimeRangeFiltering.vue @@ -51,6 +51,7 @@ const timeConfig = computed(() => { relativeToCurrentType, around, intervalType, + regularOrTrends, timeGranularity, timeNumRange, relativeToCurrentTypeRange, @@ -61,6 +62,7 @@ const timeConfig = computed(() => { relativeToCurrentType, around, intervalType, + regularOrTrends, timeGranularity, timeNumRange, relativeToCurrentTypeRange, @@ -89,11 +91,25 @@ const init = () => { timeNum, relativeToCurrentType, around, + regularOrTrends, timeNumRange, relativeToCurrentTypeRange, aroundRange } = timeConfig.value + if (regularOrTrends === 'fixed') { + if ( + Array.isArray(config.value.regularOrTrendsValue) && + !!config.value.regularOrTrendsValue.length + ) + return + config.value.regularOrTrendsValue = [ + getAround(relativeToCurrentTypeRange, 'add', 0), + getAround(relativeToCurrentTypeRange, 'add', 1) + ] + return + } + const startTime = getAround(relativeToCurrentType, around === 'f' ? 'subtract' : 'add', timeNum) const endTime = getAround( relativeToCurrentTypeRange,