forked from github/dataease
fix(查询组件): 日期范围组件,默认值没有本月、本年等 #11283
This commit is contained in:
parent
66dc4aadaa
commit
c78f4ef398
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user