Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3a60fed0
authored
Aug 01, 2025
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复下载报表弹窗默认时间问题
1 parent
4dbe9a10
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
src/views/systemConfig/downloadReportManage/components/dateChooseDialog.vue
src/views/systemConfig/downloadReportManage/components/dateChooseDialog.vue
View file @
3a60fed
...
@@ -146,17 +146,25 @@ export default {
...
@@ -146,17 +146,25 @@ export default {
},
},
methods
:
{
methods
:
{
setDefaultDateRange
()
{
setDefaultDateRange
()
{
const
now
=
new
Date
()
const
now
=
new
Date
()
// 今天,例如 2025-08-01
// 本月第一天
const
firstDay
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
(),
1
)
firstDay
.
setHours
(
0
,
0
,
0
,
0
)
// 1. 计算 "昨天"
const
yesterday
=
new
Date
(
now
)
const
yesterday
=
new
Date
(
now
)
yesterday
.
setDate
(
yesterday
.
getDate
()
-
1
)
yesterday
.
setDate
(
yesterday
.
getDate
()
-
1
)
// yesterday = 2025-07-31
yesterday
.
setHours
(
23
,
59
,
0
,
0
)
this
.
form
.
dateRange
=
[
firstDay
,
yesterday
]
// 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)
// 4. 格式化并赋值 (关键!必须是字符串数组)
this
.
form
.
dateRange
=
[
firstDayOfYesterdayMonth
,
// "2025-07-01 00:00"
yesterday
// "2025-07-31 23:59"
]
},
},
handleDateRangeChange
(
value
)
{
handleDateRangeChange
(
value
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment