From c78f4ef3986302f8a4e08596dc77b0e835ead5d7 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 7 Aug 2024 09:57:31 +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=A5=E6=9C=9F=E8=8C=83=E5=9B=B4=E7=BB=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=E6=B2=A1=E6=9C=89=E6=9C=AC=E6=9C=88?= =?UTF-8?q?=E3=80=81=E6=9C=AC=E5=B9=B4=E7=AD=89=20#11283?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v-query/QueryConditionConfiguration.vue | 10 +++++++--- .../components/editor/filter/auth-tree/RowAuth.vue | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 5 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 a392656ad5..e012f070c5 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -15,7 +15,7 @@ import { storeToRefs } from 'pinia' import { addQueryCriteriaConfig } from './options' import { getCustomTime } from './time-format' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' -import { getThisStart, getLastStart, getAround } from './time-format-dayjs' +import { getThisStart, getLastStart, getAround, getCustomRange } from './time-format-dayjs' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' import { useI18n } from '@/hooks/web/useI18n' import { fieldType } from '@/utils/attr' @@ -725,6 +725,7 @@ const validate = () => { timeNum, relativeToCurrentType, around, + relativeToCurrentRange, timeGranularityMultiple, arbitraryTime, timeGranularity, @@ -735,7 +736,7 @@ const validate = () => { timeType } = ele - const startTime = + let startTime = timeType === 'dynamic' ? getCustomTime( timeNum, @@ -747,7 +748,7 @@ const validate = () => { 'start-config' ) : new Date(ele.defaultValue[0]) - const endTime = + let endTime = timeType === 'dynamic' ? getCustomTime( timeNumRange, @@ -759,6 +760,9 @@ const validate = () => { 'end-config' ) : new Date(ele.defaultValue[1]) + if (!relativeToCurrentRange || relativeToCurrentRange === 'custom') { + ;[startTime, endTime] = getCustomRange(relativeToCurrentRange) + } if (+startTime > +endTime) { ElMessage.error('结束时间必须大于开始时间!') return true diff --git a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue index 540af3aa56..d40e3f2387 100644 --- a/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue +++ b/core/core-frontend/src/views/chart/components/editor/filter/auth-tree/RowAuth.vue @@ -40,7 +40,16 @@ const submit = () => { errorMessage: errorMessage.value }) } -const errorDetected = ({ enumValue, deType, filterType, term, value, name, timeValue }) => { +const errorDetected = ({ + enumValue, + deType, + filterType, + term, + value, + name, + timeValue, + filterTypeTime +}) => { if (!name) { errorMessage.value = t('data_set.cannot_be_empty_') return @@ -64,7 +73,8 @@ const errorDetected = ({ enumValue, deType, filterType, term, value, name, timeV !term.includes('null') && !term.includes('empty') && ['', null, undefined].includes(timeValue) && - deType === 1 + deType === 1 && + filterTypeTime === 'dynamicDate' ) { errorMessage.value = t('chart.filter_value_can_null') return