修正布局,删改无用页面
This commit is contained in:
@@ -121,6 +121,8 @@ const weekdays = ['日', '一', '二', '三', '四', '五', '六']
|
||||
const quickOptions = [
|
||||
{ label: '近7天', value: '7d' },
|
||||
{ label: '近30天', value: '30d' },
|
||||
{ label: '未来7天', value: 'future7d' },
|
||||
{ label: '未来30天', value: 'future30d' },
|
||||
{ label: '本月', value: 'month' },
|
||||
{ label: '上月', value: 'lastMonth' }
|
||||
]
|
||||
@@ -218,12 +220,14 @@ function isToday(year, month, day) {
|
||||
day === today.getDate()
|
||||
}
|
||||
|
||||
// 判断是否是未来日期
|
||||
// 判断是否是未来日期(限制最多选择未来90天)
|
||||
function isFuture(year, month, day) {
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
const maxFuture = new Date(today)
|
||||
maxFuture.setDate(maxFuture.getDate() + 90) // 最多允许选择未来90天
|
||||
const date = new Date(year, month - 1, day)
|
||||
return date > today
|
||||
return date > maxFuture
|
||||
}
|
||||
|
||||
// 切换日期选择器
|
||||
@@ -273,7 +277,7 @@ const selectDate = (day) => {
|
||||
console.log(`[TimeRangePicker] ${pickerType.value === 'start' ? '开始' : '结束'}日期变更:`, day.date)
|
||||
}
|
||||
|
||||
// 应用快捷选项
|
||||
// 应用快捷选项(所有日期计算基于当前真实时间)
|
||||
const applyQuickOption = (value) => {
|
||||
quickSelected.value = value
|
||||
const today = new Date()
|
||||
@@ -281,18 +285,32 @@ const applyQuickOption = (value) => {
|
||||
|
||||
switch (value) {
|
||||
case '7d':
|
||||
// 近7天:以今天为终点,往前推7天
|
||||
startDate = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000)
|
||||
endDate = today
|
||||
break
|
||||
case '30d':
|
||||
// 近30天:以今天为终点,往前推30天
|
||||
startDate = new Date(today.getTime() - 30 * 24 * 60 * 60 * 1000)
|
||||
endDate = today
|
||||
break
|
||||
case 'future7d':
|
||||
// 未来7天:以今天为起点,往后推7天
|
||||
startDate = today
|
||||
endDate = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000)
|
||||
break
|
||||
case 'future30d':
|
||||
// 未来30天:以今天为起点,往后推30天
|
||||
startDate = today
|
||||
endDate = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000)
|
||||
break
|
||||
case 'month':
|
||||
// 本月:当月1号到当月最后一天
|
||||
startDate = new Date(today.getFullYear(), today.getMonth(), 1)
|
||||
endDate = today
|
||||
endDate = new Date(today.getFullYear(), today.getMonth() + 1, 0)
|
||||
break
|
||||
case 'lastMonth':
|
||||
// 上月:上月1号到上月最后一天
|
||||
startDate = new Date(today.getFullYear(), today.getMonth() - 1, 1)
|
||||
endDate = new Date(today.getFullYear(), today.getMonth(), 0)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user