Commit 3a34407e by wangzhihui

Merge branch 'SAAS+V4.55.0-0730' of http://192.168.3.233:8090/saas_plus/dj-car-l…

…ife-system into SAAS+V4.55.0-0730
2 parents 01c68393 eae98458
......@@ -146,17 +146,25 @@ export default {
},
methods: {
setDefaultDateRange() {
const now = new Date()
// 本月第一天
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1)
firstDay.setHours(0, 0, 0, 0)
const now = new Date() // 今天,例如 2025-08-01
// 1. 计算 "昨天"
const yesterday = new Date(now)
yesterday.setDate(yesterday.getDate() - 1)
yesterday.setHours(23, 59, 0, 0)
yesterday.setDate(yesterday.getDate() - 1) // yesterday = 2025-07-31
// 2. 计算 "昨天所在月份的第一天"
// 使用 yesterday 的年份和月份,日期设为 1
const firstDayOfYesterdayMonth = new Date(yesterday.getFullYear(), yesterday.getMonth(), 1)
firstDayOfYesterdayMonth.setHours(0, 0, 0, 0) // 确保时间是 00:00:00
// 3. 设置 "昨天" 的时间到 23:59
yesterday.setHours(23, 59, 0, 0) // 设置为 23:59:00 (秒=0, 毫秒=0)
this.form.dateRange = [firstDay, yesterday]
// 4. 格式化并赋值 (关键!必须是字符串数组)
this.form.dateRange = [
firstDayOfYesterdayMonth, // "2025-07-01 00:00"
yesterday // "2025-07-31 23:59"
]
},
handleDateRangeChange(value) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!