Merge pull request #9309 from dataease/pr@dev@feat_jump-time

feat(图表): 跳转支持关联时间过滤组件同时日期类型字段跳转支持绑定跳转目标的日期字段并产生联动效果 #8661
This commit is contained in:
王嘉豪 2024-04-24 17:51:53 +08:00 committed by GitHub
commit 573e70782f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 35 additions and 1 deletions

View File

@ -481,6 +481,10 @@ const data = {
if (element.options.manualModify) { if (element.options.manualModify) {
element.options.manualModify = false element.options.manualModify = false
} }
// 去掉动态时间
if (element.options.attrs?.default?.isDynamic) {
element.options.attrs.default.isDynamic = false
}
// 去掉首选项 // 去掉首选项
if (element.options?.attrs?.selectFirst) { if (element.options?.attrs?.selectFirst) {
element.options.attrs.selectFirst = false element.options.attrs.selectFirst = false

View File

@ -22,6 +22,19 @@ export const getRange = (selectValue, timeGranularity) => {
} }
} }
export const getTimeBegin = (selectValue, timeGranularity) => {
switch (timeGranularity) {
case 'year':
return getYearEnd(selectValue)
case 'month':
return getMonthEnd(selectValue)
case 'date':
return getDayEnd(selectValue)
default:
return selectValue
}
}
const getYearEnd = timestamp => { const getYearEnd = timestamp => {
const time = new Date(timestamp) const time = new Date(timestamp)
return [ return [
@ -50,3 +63,20 @@ const getMinuteEnd = timestamp => {
return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 - 1000] return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 - 1000]
} }
const getYearBegin = timestamp => {
const time = new Date(timestamp)
return +new Date(time.getFullYear(), 0, 1)
}
const getMonthBegin = 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)
}
const getDayBegin = timestamp => {
return +new Date(timestamp)
}

View File

@ -478,7 +478,7 @@ export default {
completeSingle: false // completeSingle: false //
} }
}, },
widgetSubjectsFilter: ['textSelectWidget', 'textSelectGridWidget', 'textInputWidget', 'textSelectTreeWidget', 'numberSelectWidget', 'numberSelectGridWidget'], widgetSubjectsFilter: ['timeYearWidget', 'timeMonthWidget', 'timeDateWidget', 'textSelectWidget', 'textSelectGridWidget', 'textInputWidget', 'textSelectTreeWidget', 'numberSelectWidget', 'numberSelectGridWidget'],
widgetSubjectsTrans: { widgetSubjectsTrans: {
timeYearWidget: '年份过滤组件', timeYearWidget: '年份过滤组件',
timeMonthWidget: '年月过滤组件', timeMonthWidget: '年月过滤组件',