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
d1293d60
Commit
d1293d60
authored
Jun 25, 2025
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add:po2 guan2
parent
e099e99f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
index.vue
src/views/dataMonitor/jrx/history/index.vue
+54
-0
No files found.
src/views/dataMonitor/jrx/history/index.vue
View file @
d1293d60
...
...
@@ -231,6 +231,12 @@ export default {
// 加载 guan.png
this
.
guanImage
=
new
Image
();
this
.
guanImage
.
src
=
require
(
"
@/assets/images/jrx/guan0.png
"
);
// 加载 guan1.png
this
.
guanImage1
=
new
Image
();
this
.
guanImage1
.
src
=
require
(
"
@/assets/images/jrx/guan1.png
"
);
// 加载 guan2.png
this
.
guanImage2
=
new
Image
();
this
.
guanImage2
.
src
=
require
(
"
@/assets/images/jrx/guan2.png
"
);
// 等待所有图片加载完成
Promise
.
all
([
...
...
@@ -238,6 +244,9 @@ export default {
new
Promise
((
resolve
)
=>
(
this
.
waterImage
.
onload
=
resolve
)),
new
Promise
((
resolve
)
=>
(
this
.
poImage
.
onload
=
resolve
)),
new
Promise
((
resolve
)
=>
(
this
.
guanImage
.
onload
=
resolve
)),
new
Promise
((
resolve
)
=>
(
this
.
guanImage1
.
onload
=
resolve
)),
new
Promise
((
resolve
)
=>
(
this
.
guanImage2
.
onload
=
resolve
)),
])
.
then
(()
=>
{
// 所有图片加载完成后绘制
...
...
@@ -274,6 +283,22 @@ export default {
);
this
.
ctx
.
restore
();
// 新增:第二张po.png(在第一张上方叠加)
this
.
ctx
.
save
();
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
const
secondPoWidth
=
879
-
250
;
// 宽度减少100px
const
secondPoHeight
=
150
;
// 高度保持不变
const
secondPoY
=
(
this
.
canvas
.
height
-
150
)
-
secondPoHeight
;
// Y坐标:第一张顶部位置(原Y坐标 - 自身高度)
this
.
ctx
.
drawImage
(
this
.
poImage
,
0
,
// X轴保持0
secondPoY
,
// Y轴为第一张顶部位置
secondPoWidth
,
// 新宽度
secondPoHeight
// 保持高度
);
this
.
ctx
.
restore
();
// 3. 绘制 guan0.png(po.png 右侧中间,上层)
this
.
ctx
.
save
();
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
...
...
@@ -292,6 +317,35 @@ export default {
);
this
.
ctx
.
restore
();
/**
* canvas绘画原则。坐标轴从左上角开始画,y轴要从上往下找y轴的起始原点。
* canvasWidth:this.canvas.height // 画布的宽度(目前为600)
* poHeight:150px // 每个坡的高度
* guanPaddingTop:30px // 每个管孔距离对应层级坡顶部的距离
drawImage:(imgsrc, 起始x,起始y,绘画宽度距离, 绘画高度距离)
*/
// 新增:第二张guanImage(在第一张基础上叠加)
this
.
ctx
.
save
();
this
.
ctx
.
setTransform
(
1
,
0
,
0
,
1
,
0
,
0
);
const
canvasHeight
=
this
.
canvas
.
height
const
secondGuanX
=
secondPoWidth
-
150
;
// x轴:原宽度值(6px)-250px
const
secondGuanY
=
this
.
canvas
.
height
-
135.5
;
// y轴:原高度值(121px)
this
.
ctx
.
drawImage
(
this
.
guanImage
,
secondGuanX
,
// 新x坐标
secondPoY
+
30
,
// 新y坐标
6
,
// 保持宽度6px
secondPoY
/
1.5
// 保持高度121px
);
console
.
log
((
secondPoY
/
2
),
'
(secondPoY/2)
'
)
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