fix(查询组件): 时间查询组件设置动态日期本月的默认值则查询报错 #14445

This commit is contained in:
dataeaseShu 2025-01-02 10:09:28 +08:00 committed by fit2cloud-chenyw
parent c430323f88
commit 73e80dfc94
2 changed files with 10 additions and 4 deletions

View File

@ -2062,8 +2062,11 @@ const timeGranularityChange = (val: string) => {
}
const handleTimeTypeChange = () => {
timeGranularityChange(curComponent.value.timeGranularity)
timeGranularityMultipleChange(curComponent.value.timeGranularityMultiple)
if (curComponent.value.displayType === '1') {
timeGranularityChange(curComponent.value.timeGranularity)
} else {
timeGranularityMultipleChange(curComponent.value.timeGranularityMultiple)
}
}
const timeGranularityMultipleChange = (val: string) => {

View File

@ -17,9 +17,12 @@ function getThisMonth() {
return new Date(`${date.getFullYear()}/${date.getMonth() + 1}`)
}
function getLastStart(val = 'month' as ManipulateType) {
return new Date(dayjs().subtract(1, val).startOf(val).format('YYYY/MM/DD HH:mm:ss'))
}
function getLastMonth() {
const date = new Date()
return new Date(`${date.getFullYear()}/${date.getMonth()}`)
return getLastStart()
}
function getNextMonth() {