diff --git a/core/frontend/src/store/index.js b/core/frontend/src/store/index.js index dcc237eb76..a0fa4c2a1b 100644 --- a/core/frontend/src/store/index.js +++ b/core/frontend/src/store/index.js @@ -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 diff --git a/core/frontend/src/utils/timeUitils.js b/core/frontend/src/utils/timeUitils.js index 1e28837e2f..4a94c8dad7 100644 --- a/core/frontend/src/utils/timeUitils.js +++ b/core/frontend/src/utils/timeUitils.js @@ -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) +} + diff --git a/core/frontend/src/views/panel/linkJumpSet/index.vue b/core/frontend/src/views/panel/linkJumpSet/index.vue index 93623e8c33..38fa1c1270 100644 --- a/core/frontend/src/views/panel/linkJumpSet/index.vue +++ b/core/frontend/src/views/panel/linkJumpSet/index.vue @@ -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: '年月过滤组件',