Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
2ce26d3d
Commit
2ce26d3d
authored
Dec 31, 2025
by
wusiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 概览数据优化
parent
219f633c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
19 deletions
+68
-19
src/views/Dashboard.vue
+68
-19
No files found.
src/views/Dashboard.vue
View file @
2ce26d3d
...
...
@@ -659,22 +659,6 @@ const yesterday = new Date(new Date().setDate(new Date().getDate() - 1))
})
.
replace
(
/
\/
/g
,
'-'
)
const
lastWeek
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
7
))
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
const
lastMonth
=
new
Date
(
new
Date
().
setMonth
(
new
Date
().
getMonth
()
-
1
))
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
// 获取统计数据
const
statisticData
=
ref
<
StatisticData
|
null
>
(
null
)
...
...
@@ -1153,11 +1137,76 @@ const getchartTimes = async (v: string, type: string) => {
// 空数据提示文字
const
generatePeriodText
=
(
timeRange
:
string
):
string
=>
{
if
(
timeRange
===
'0'
)
{
return
`当前周期(
${
yesterday
}
至
${
today
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
const
startTime
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
14
))
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
return
`当前周期(
${
startTime
}
至
${
yesterday
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
}
else
if
(
timeRange
===
'1'
)
{
return
`当前周期(
${
lastWeek
}
至
${
today
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
// 8周前该周周一的日期
const
now
=
new
Date
()
const
eightWeeksAgo
=
new
Date
(
now
.
getTime
()
-
8
*
7
*
24
*
60
*
60
*
1000
)
const
dayOfWeek
=
eightWeeksAgo
.
getDay
()
// 0=周日, 1=周一, ..., 6=周六
const
daysToMonday
=
dayOfWeek
===
0
?
-
6
:
1
-
dayOfWeek
// 如果是周日,往前6天;否则往前到周一
const
mondayDate
=
new
Date
(
eightWeeksAgo
.
getTime
()
+
daysToMonday
*
24
*
60
*
60
*
1000
,
)
const
startTime
=
mondayDate
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
// 上个周日的日期
const
today
=
new
Date
()
const
todayDayOfWeek
=
today
.
getDay
()
// 0=周日, 1=周一, ..., 6=周六
const
daysToLastSunday
=
todayDayOfWeek
===
0
?
-
7
:
-
todayDayOfWeek
// 如果是周日,往前7天;否则往前到上一个周日
const
lastSunday
=
new
Date
(
today
.
getTime
()
+
daysToLastSunday
*
24
*
60
*
60
*
1000
,
)
const
endTime
=
lastSunday
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
return
`当前周期(
${
startTime
}
至
${
endTime
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
}
else
if
(
timeRange
===
'2'
)
{
return
`当前周期(
${
lastMonth
}
至
${
today
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
// 六个月前该月第一天的日期
const
now
=
new
Date
()
const
sixMonthsAgo
=
new
Date
(
now
.
getFullYear
(),
now
.
getMonth
()
-
6
,
1
)
const
startTime
=
sixMonthsAgo
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
// 上一月第一天的日期
const
currentDate
=
new
Date
()
const
lastMonthFirstDay
=
new
Date
(
currentDate
.
getFullYear
(),
currentDate
.
getMonth
()
-
1
,
1
,
)
const
endTime
=
lastMonthFirstDay
.
toLocaleDateString
(
'zh-CN'
,
{
year
:
'numeric'
,
month
:
'2-digit'
,
day
:
'2-digit'
,
})
.
replace
(
/
\/
/g
,
'-'
)
return
`当前周期(
${
startTime
}
至
${
endTime
}
)暂无订单数据\n\n请在订单流转后等待数据更新查看趋势`
}
return
''
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment