Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4ffe89c8
authored
Mar 02, 2026
by
Jony.L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏数据:API请求趋势、订单管理、服务能力、用户管理真实数据
parent
84548daa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
30 deletions
+50
-30
src/api/Home/count/index.ts
+6
-0
src/api/compute/resourcespu/index.ts
+0
-1
src/views/Home/ComputeResource.vue
+6
-1
src/views/Home/Home.vue
+36
-20
src/views/Home/apiEchart.vue
+2
-8
No files found.
src/api/Home/count/index.ts
View file @
4ffe89c8
...
...
@@ -39,3 +39,9 @@ export const getOverallSituation = async () => {
})
}
export
const
getAllDashboardData
=
async
()
=>
{
return
await
request
.
get
({
url
:
`/index/count/getAllDashboardData`
})
}
src/api/compute/resourcespu/index.ts
View file @
4ffe89c8
...
...
@@ -23,7 +23,6 @@ export interface ResourceSpu {
source
?:
string
;
// 算力来源
picUrl
?:
string
;
// 商品封面图
sliderPicUrls
?:
string
;
// 商品轮播图地址,以逗号分隔,最多15张
stock
?:
number
;
// 总库存数量
sales
?:
number
;
// 商品销量
status
?:
number
;
// 状态(0 下架,1 上架,2 回收)
}
...
...
src/views/Home/ComputeResource.vue
View file @
4ffe89c8
...
...
@@ -11,6 +11,7 @@
<
script
setup
>
import
{
ref
,
watch
,
onMounted
,
onBeforeUnmount
,
inject
}
from
'vue'
import
{
DICT_TYPE
,
getDictLabel
}
from
'@/utils/dict'
import
*
as
echarts
from
'echarts/core'
import
{
TitleComponent
,
TooltipComponent
,
LegendComponent
}
from
'echarts/components'
import
{
PieChart
}
from
'echarts/charts'
...
...
@@ -36,7 +37,11 @@ const datasets = ref({
const
fetchComputeDistribution
=
()
=>
{
const
data
=
dashboardData
.
value
.
computeDistribution
||
{
gpu
:
[],
source
:
[],
resource
:
[]
}
datasets
.
value
.
gpu
=
data
.
gpu
||
[]
datasets
.
value
.
source
=
data
.
source
||
[]
// 转换算力来源key为中文标签
datasets
.
value
.
source
=
(
data
.
source
||
[]).
map
(
item
=>
({
name
:
getDictLabel
(
DICT_TYPE
.
COMPUTE_RESOURCE_SOURCE
,
item
.
name
)
||
item
.
name
,
value
:
item
.
value
}))
datasets
.
value
.
resource
=
data
.
resource
||
[]
}
...
...
src/views/Home/Home.vue
View file @
4ffe89c8
...
...
@@ -230,29 +230,45 @@ const fetchAllMockData = async () => {
// 获取真实数据
const
fetchRealData
=
async
()
=>
{
try
{
// 并行调用所有真实数据接口
const
[
overallRes
,
apiCallsRes
,
usersRes
]
=
await
Promise
.
all
([
IndexCountApi
.
getOverallSituation
(),
IndexCountApi
.
getApiCallsData
(
'm'
),
IndexCountApi
.
getUsersData
(
'd'
)
])
// 总体态势数据
if
(
overallRes
)
{
dashboardData
.
value
.
overallSituation
=
overallRes
}
// 调用统一接口获取所有数据
const
res
=
await
IndexCountApi
.
getAllDashboardData
()
// API 调用趋势
if
(
Array
.
isArray
(
apiCallsRes
))
{
dashboardData
.
value
.
apiCalls
=
apiCallsRes
}
if
(
res
)
{
// 总体态势数据
if
(
res
.
overallSituation
)
{
dashboardData
.
value
.
overallSituation
=
res
.
overallSituation
}
// 用户数据
if
(
Array
.
isArray
(
usersRes
))
{
dashboardData
.
value
.
users
=
usersRes
}
// API 调用趋势(Map格式,包含d/m/y三个维度)
if
(
res
.
apiCalls
)
{
dashboardData
.
value
.
apiCalls
=
res
.
apiCalls
}
// 算力资源分布
if
(
res
.
computeDistribution
)
{
dashboardData
.
value
.
computeDistribution
=
res
.
computeDistribution
}
// TODO: 算力分布和服务能力数据的真实接口待实现
// 用户数据(Map格式,包含d/m/y三个维度)
if
(
res
.
users
)
{
dashboardData
.
value
.
users
=
res
.
users
}
// 订单数据(Map格式,包含d/m/y三个维度)
if
(
res
.
orders
)
{
dashboardData
.
value
.
orders
=
res
.
orders
}
// 服务能力数据
if
(
res
.
serviceCapability
)
{
dashboardData
.
value
.
serviceCapability
=
res
.
serviceCapability
}
// 轮播数据
if
(
res
.
carouselItems
)
{
dashboardData
.
value
.
carouselItems
=
res
.
carouselItems
}
}
}
catch
(
error
)
{
console
.
error
(
'获取真实数据失败:'
,
error
)
}
...
...
src/views/Home/apiEchart.vue
View file @
4ffe89c8
...
...
@@ -128,14 +128,8 @@ const getChartData = () => {
return
{
x
:
[],
y
:
[]
}
}
// 根据数据格式转换为图表数据
// apiCalls[d/m/y] 格式: [{countDate: "2025-01-01", callsCount: 1202}, ...]
const
x
=
data
.
map
(
item
=>
{
const
date
=
new
Date
(
item
.
countDate
)
const
m
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
)
const
d
=
String
(
date
.
getDate
()).
padStart
(
2
,
'0'
)
return
`
${
m
}
-
${
d
}
`
})
// 直接使用后端返回的 countDate
const
x
=
data
.
map
(
item
=>
item
.
countDate
)
const
y
=
data
.
map
(
item
=>
item
.
callsCount
)
return
{
x
,
y
}
...
...
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