fix(查询组件): 过滤组件日期动态时间月底过滤与实际结果不一致

This commit is contained in:
dataeaseShu
2025-03-11 10:04:39 +08:00
committed by xuwei-fit2cloud
parent e800b6f6db
commit 54c0da7150
2 changed files with 13 additions and 10 deletions

View File

@@ -456,7 +456,8 @@ defineExpose({
</el-popover>
<span
v-if="
curComponent.timeRange.intervalType !== 'none' || curComponent.timeRange.dynamicWindow
curComponent.timeRange &&
(curComponent.timeRange.intervalType !== 'none' || curComponent.timeRange.dynamicWindow)
"
class="config-flag range-filter-time-flag"
>{{ t('v_query.configured') }}</span

View File

@@ -1,5 +1,6 @@
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import dayjs from 'dayjs'
import { getDynamicRange, getCustomTime } from '@/custom-component/v-query/time-format'
import { getCustomRange } from '@/custom-component/v-query/time-format-dayjs'
const dvMainStore = dvMainStoreWithOut()
@@ -58,23 +59,24 @@ export const getRange = (selectValue, timeGranularity) => {
}
}
const getYearEnd = timestamp => {
const time = new Date(timestamp)
return [
+new Date(time.getFullYear(), 0, 1),
+new Date(time.getFullYear(), 11, 31) + 60 * 1000 * 60 * 24 - 1000
+new Date(dayjs(timestamp).startOf('year').format('YYYY/MM/DD HH:mm:ss')),
+new Date(dayjs(timestamp).endOf('year').format('YYYY/MM/DD HH:mm:ss'))
]
}
const getMonthEnd = timestamp => {
const time = new Date(timestamp)
const date = new Date(time.getFullYear(), time.getMonth(), 1)
date.setDate(1)
date.setMonth(date.getMonth() + 1)
return [+new Date(time.getFullYear(), time.getMonth(), 1), +new Date(date.getTime() - 1000)]
return [
+new Date(dayjs(timestamp).startOf('month').format('YYYY/MM/DD HH:mm:ss')),
+new Date(dayjs(timestamp).endOf('month').format('YYYY/MM/DD HH:mm:ss'))
]
}
const getDayEnd = timestamp => {
return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 * 60 * 24 - 1000]
return [
+new Date(dayjs(timestamp).startOf('day').format('YYYY/MM/DD HH:mm:ss')),
+new Date(dayjs(timestamp).endOf('day').format('YYYY/MM/DD HH:mm:ss'))
]
}
const getFieldId = (arr, result) => {