Merge pull request #9309 from dataease/pr@dev@feat_jump-time
feat(图表): 跳转支持关联时间过滤组件同时日期类型字段跳转支持绑定跳转目标的日期字段并产生联动效果 #8661
This commit is contained in:
commit
573e70782f
@ -481,6 +481,10 @@ const data = {
|
||||
if (element.options.manualModify) {
|
||||
element.options.manualModify = false
|
||||
}
|
||||
// 去掉动态时间
|
||||
if (element.options.attrs?.default?.isDynamic) {
|
||||
element.options.attrs.default.isDynamic = false
|
||||
}
|
||||
// 去掉首选项
|
||||
if (element.options?.attrs?.selectFirst) {
|
||||
element.options.attrs.selectFirst = false
|
||||
|
||||
@ -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 time = new Date(timestamp)
|
||||
return [
|
||||
@ -50,3 +63,20 @@ const getMinuteEnd = timestamp => {
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@ -478,7 +478,7 @@ export default {
|
||||
completeSingle: false // 当匹配只有一项的时候是否自动补全
|
||||
}
|
||||
},
|
||||
widgetSubjectsFilter: ['textSelectWidget', 'textSelectGridWidget', 'textInputWidget', 'textSelectTreeWidget', 'numberSelectWidget', 'numberSelectGridWidget'],
|
||||
widgetSubjectsFilter: ['timeYearWidget', 'timeMonthWidget', 'timeDateWidget', 'textSelectWidget', 'textSelectGridWidget', 'textInputWidget', 'textSelectTreeWidget', 'numberSelectWidget', 'numberSelectGridWidget'],
|
||||
widgetSubjectsTrans: {
|
||||
timeYearWidget: '年份过滤组件',
|
||||
timeMonthWidget: '年月过滤组件',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user