forked from github/dataease
feat(查询组件): 日期查询组件可设置查询的起始日期 #6005
This commit is contained in:
parent
412025fb7f
commit
a3160e5eba
@ -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<DatePickType>(() => {
|
||||
})
|
||||
|
||||
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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user