Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
V3-TailingPond
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
V3-TailingPond
Commits
c3989c8e
Commit
c3989c8e
authored
Jun 25, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:警戒线
parent
d1293d60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
index.vue
src/views/dataMonitor/jrx/history/index.vue
+42
-1
No files found.
src/views/dataMonitor/jrx/history/index.vue
View file @
c3989c8e
...
...
@@ -258,6 +258,15 @@ export default {
},
/** 绘制所有图片(背景图 + 新增图片) */
/**
* 实现:1.绘制背景图(原有逻辑)1
* 2.绘制 water.png(居中)1
* 3.动态绘制 po.png(根据后端返回数据数组个数遍历)
* 4.绘制 guan0.png(根据后端返回数据数组个数遍历)
* 5.绘制 警戒线(4条线,分别对应是个数组,每个坡都有对应的坐标点)
* 6.超过4个po,要动态变换画布高度。
*/
drawAllImages
()
{
// 1. 绘制背景图(原有逻辑)
this
.
ctx
.
save
();
// 保存当前变换状态
...
...
@@ -339,13 +348,45 @@ export default {
secondGuanX
,
// 新x坐标
secondPoY
+
30
,
// 新y坐标
6
,
// 保持宽度6px
secondPoY
/
1.5
// 保持高度121px
200
//
secondPoY/1.5 // 保持高度121px
);
console
.
log
((
secondPoY
/
2
),
'
(secondPoY/2)
'
)
this
.
ctx
.
restore
();
// 新增:绘制红色连接线(关键修改)
this
.
ctx
.
save
();
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
// 恢复默认坐标系(原点在左上角)
this
.
ctx
.
strokeStyle
=
"
red
"
;
// 设置线颜色为红色
this
.
ctx
.
lineWidth
=
2
;
// 设置线宽
this
.
ctx
.
beginPath
();
// 开始路径
// 第一坐标点:第一个guanImage的x,y=guanY+30
this
.
ctx
.
moveTo
(
guanX
,
(
guanY
+
100
));
// 第二坐标点:第二个guanImage的x,y=secondGuanY+30+150
this
.
ctx
.
lineTo
(
secondGuanX
,
secondGuanY
+
50
);
// 新增:第三坐标点(示例坐标,需根据实际业务调整)
const
thirdX
=
secondGuanX
-
100
;
// 假设第三个点x坐标在第二个点基础上右移100px
const
thirdY
=
secondGuanY
-
10
;
// 假设第三个点y坐标在第二个点基础上下移80px(根据实际需求调整)
this
.
ctx
.
lineTo
(
thirdX
,
thirdY
);
this
.
ctx
.
stroke
();
// 描边绘制
this
.
ctx
.
restore
();
// 新增:绘制红色连接线(关键修改)
this
.
ctx
.
save
();
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
// 恢复默认坐标系(原点在左上角)
this
.
ctx
.
strokeStyle
=
"
yellow
"
;
// 设置线颜色为红色
this
.
ctx
.
lineWidth
=
2
;
// 设置线宽
this
.
ctx
.
beginPath
();
// 开始路径
// 第一坐标点:第一个guanImage的x,y=guanY+30
this
.
ctx
.
moveTo
(
guanX
,
(
guanY
+
100
-
20
));
// 第二坐标点:第二个guanImage的x,y=secondGuanY+30+150
this
.
ctx
.
lineTo
(
secondGuanX
,
secondGuanY
+
50
-
20
);
this
.
ctx
.
stroke
();
// 描边绘制
this
.
ctx
.
restore
();
// 2. 绘制 water.png(临时恢复默认坐标系,避免翻转)
this
.
ctx
.
save
();
// 保存当前变换状态
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
// 恢复默认变换(不翻转)
...
...
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