fix(查询组件): 日期过滤组件默认值默认单位建议改成天 #11878

This commit is contained in:
dataeaseShu 2024-09-18 15:17:54 +08:00
parent 8bdc2832dc
commit 81e8db651a
2 changed files with 9 additions and 23 deletions

View File

@ -1326,12 +1326,7 @@ const relativeToCurrentListRange = computed(() => {
}) })
const timeGranularityChange = (val: string) => { const timeGranularityChange = (val: string) => {
if ( curComponent.value.relativeToCurrentType = ['date', 'datetime'].includes(val) ? 'date' : val
['year', 'month', 'date', 'datetime'].indexOf(val) <
['year', 'month', 'date'].indexOf(curComponent.value.relativeToCurrentType)
) {
curComponent.value.relativeToCurrentType = 'year'
}
if (curComponent.value.relativeToCurrent !== 'custom') { if (curComponent.value.relativeToCurrent !== 'custom') {
curComponent.value.relativeToCurrent = relativeToCurrentList.value[0]?.value curComponent.value.relativeToCurrent = relativeToCurrentList.value[0]?.value
} }
@ -1339,19 +1334,10 @@ const timeGranularityChange = (val: string) => {
const timeGranularityMultipleChange = (val: string) => { const timeGranularityMultipleChange = (val: string) => {
handleDialogClick() handleDialogClick()
if ( curComponent.value.relativeToCurrentType = ['daterange', 'datetimerange'].includes(val)
['yearrange', 'monthrange', 'daterange', 'datetimerange'].indexOf(val) < ? 'date'
['year', 'month', 'date'].indexOf(curComponent.value.relativeToCurrentType) : val.split('range')[0]
) { curComponent.value.relativeToCurrentTypeRange = curComponent.value.relativeToCurrentType
curComponent.value.relativeToCurrentType = 'year'
}
if (
['yearrange', 'monthrange', 'daterange', 'datetimerange'].indexOf(val) <
['year', 'month', 'date'].indexOf(curComponent.value.relativeToCurrentTypeRange)
) {
curComponent.value.relativeToCurrentTypeRange = 'year'
}
if (curComponent.value.relativeToCurrentRange !== 'custom') { if (curComponent.value.relativeToCurrentRange !== 'custom') {
curComponent.value.relativeToCurrentRange = relativeToCurrentListRange.value[0]?.value curComponent.value.relativeToCurrentRange = relativeToCurrentListRange.value[0]?.value
} }
@ -1365,10 +1351,10 @@ const timeGranularityMultipleChange = (val: string) => {
relativeToCurrent: 'custom', relativeToCurrent: 'custom',
relativeToCurrentRange: 'custom', relativeToCurrentRange: 'custom',
timeNum: 0, timeNum: 0,
relativeToCurrentType: 'year', relativeToCurrentType: curComponent.value.relativeToCurrentRange,
around: 'f', around: 'f',
timeNumRange: 0, timeNumRange: 0,
relativeToCurrentTypeRange: 'year', relativeToCurrentTypeRange: curComponent.value.relativeToCurrentRange,
aroundRange: 'f' aroundRange: 'f'
} }
} }

View File

@ -33,13 +33,13 @@ const infoFormat = (obj: ComponentInfo) => {
relativeToCurrent: 'custom', relativeToCurrent: 'custom',
required: false, required: false,
timeNum: 0, timeNum: 0,
relativeToCurrentType: 'year', relativeToCurrentType: 'date',
around: 'f', around: 'f',
parametersStart: null, parametersStart: null,
parametersEnd: null, parametersEnd: null,
arbitraryTime: new Date(), arbitraryTime: new Date(),
timeNumRange: 0, timeNumRange: 0,
relativeToCurrentTypeRange: 'year', relativeToCurrentTypeRange: 'date',
aroundRange: 'f', aroundRange: 'f',
arbitraryTimeRange: new Date(), arbitraryTimeRange: new Date(),
auto: false, auto: false,