Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JINRUN-DP
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xinzhedeai
JINRUN-DP
Commits
6af0cd91
Commit
6af0cd91
authored
Dec 19, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡掉预警
parent
108eeb65
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
21 deletions
+47
-21
index-dp.ts
src/api/index-dp.ts
+3
-0
RightAiWarning.vue
src/components/MineMonitor/RightAiWarning.vue
+44
-21
No files found.
src/api/index-dp.ts
View file @
6af0cd91
...
@@ -46,6 +46,9 @@ export const getEnvironmentData = async (): Promise<any> => await axios.get('/ho
...
@@ -46,6 +46,9 @@ export const getEnvironmentData = async (): Promise<any> => await axios.get('/ho
// 获取在线数据接口
// 获取在线数据接口
export
const
getOnlineData
=
async
():
Promise
<
any
>
=>
await
axios
.
get
(
'
/home/online/data
'
);
export
const
getOnlineData
=
async
():
Promise
<
any
>
=>
await
axios
.
get
(
'
/home/online/data
'
);
// 获取车辆日志列表接口
export
const
getCarLogList
=
async
():
Promise
<
any
>
=>
await
axios
.
get
(
'
home/car/log
'
);
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
// export const getOnlineAlarmList = async (): Promise<any> => await axios.get('/home/online/alarm/list');
...
...
src/components/MineMonitor/RightAiWarning.vue
View file @
6af0cd91
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
></canvas>
></canvas>
<div
class=
"legend-container"
>
<div
class=
"legend-container"
>
<div
v-for=
"(item, index) in chartData"
:key=
"index"
class=
"legend-item"
>
<div
v-for=
"(item, index) in chartData"
:key=
"index"
class=
"legend-item"
>
<div
class=
"color-block"
:style=
"
{ backgroundColor: item.color }">
</div>
<div
class=
"color-block"
:style=
"
{ backgroundColor: item.color
|| 'fff'
}">
</div>
<div
class=
"legend-text"
>
<div
class=
"legend-text"
>
<span
class=
"legend-name"
>
{{
item
.
name
}}
</span>
<span
class=
"legend-name"
>
{{
item
.
name
}}
</span>
<span
class=
"legend-value"
:style=
"`color: $
{item.color}`">
{{
item
.
value
}}
</span>
<span
class=
"legend-value"
:style=
"`color: $
{item.color}`">
{{
item
.
value
}}
</span>
...
@@ -23,7 +23,19 @@
...
@@ -23,7 +23,19 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
onMounted
,
watch
}
from
'
vue
'
;
import
{
ref
,
onMounted
,
onBeforeUnmount
,
nextTick
}
from
'
vue
'
import
{
getCarLogList
}
from
'
@/api/index-dp
'
;
import
{
useMessage
}
from
'
naive-ui
'
;
const
message
=
useMessage
();
// 1. 定义 TS 类型接口
// 1. 定义 TS 类型接口
interface
ChartDataItem
{
interface
ChartDataItem
{
...
@@ -38,12 +50,12 @@ interface RingLayer {
...
@@ -38,12 +50,12 @@ interface RingLayer {
}
}
// 2. 核心配置与数据(5个类别)
// 2. 核心配置与数据(5个类别)
const
chartData
:
ChartDataItem
[]
=
[
var
chartData
:
ChartDataItem
[]
=
[
{
name
:
'
疲劳驾驶
'
,
value
:
10
,
color
:
'
#409EFF
'
},
//
{ name: '疲劳驾驶', value: 10, color: '#409EFF' },
{
name
:
'
违规打电话
'
,
value
:
15
,
color
:
'
#52C41A
'
},
//
{ name: '违规打电话', value: 15, color: '#52C41A' },
{
name
:
'
违规抽烟
'
,
value
:
0
,
color
:
'
#FAAD14
'
},
//
{ name: '违规抽烟', value: 0, color: '#FAAD14' },
{
name
:
'
左顾右盼
'
,
value
:
2
,
color
:
'
#FA8C16
'
},
//
{ name: '左顾右盼', value: 2, color: '#FA8C16' },
{
name
:
'
人脸丢失
'
,
value
:
0
,
color
:
'
#F5222D
'
},
//
{ name: '人脸丢失', value: 0, color: '#F5222D' },
];
];
// 调整环形图层尺寸以适应新的 canvas 尺寸,增大环间距离
// 调整环形图层尺寸以适应新的 canvas 尺寸,增大环间距离
...
@@ -137,22 +149,33 @@ const drawChart = () => {
...
@@ -137,22 +149,33 @@ const drawChart = () => {
// 5. 挂载后初始化图表(DOM 渲染完成后执行)
// 5. 挂载后初始化图表(DOM 渲染完成后执行)
onMounted
(()
=>
{
onMounted
(()
=>
{
getCarLogList
().
then
((
response
)
=>
{
if
(
response
.
data
.
code
==
200
)
{
chartData
=
response
.
data
.
data
.
map
((
item
)
=>
({
name
:
item
.
name
,
value
:
item
.
count
*
1
,
color
:
item
.
color
}))
console
.
log
(
'
*****************************
'
,
chartData
)
console
.
log
(
'
Component mounted, attempting to draw chart
'
);
console
.
log
(
'
Component mounted, attempting to draw chart
'
);
// 使用 nextTick 确保 DOM 已完全渲染
// 使用 nextTick 确保 DOM 已完全渲染
setTimeout
(()
=>
{
nextTick
(()
=>
{
drawChart
();
drawChart
();
},
0
);
});
}
else
{
message
.
error
(
response
.
data
.
msg
)
}
})
});
});
// 可选:监听数据变化重新绘制(如需动态更新数据可启用)
//
//
可选:监听数据变化重新绘制(如需动态更新数据可启用)
watch
([()
=>
chartData
],
()
=>
{
//
watch([() => chartData], () => {
drawChart
();
//
drawChart();
},
{
deep
:
true
});
//
}, { deep: true });
// 导出绘制函数以便外部调用
defineExpose
({
drawChart
});
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
...
...
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