Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
耿迪迪
gassafety
Commits
e5ad9395
Commit
e5ad9395
authored
Sep 01, 2021
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化地图模式,优化gis地图
parent
04f12e90
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
16 deletions
+34
-16
gaodeMap.js
gassafety-web/src/utils/gaodeMap.js
+16
-9
gaodeMapView.js
gassafety-web/src/utils/gaodeMapView.js
+12
-7
index.vue
gassafety-web/src/views/device/map/index.vue
+6
-0
No files found.
gassafety-web/src/utils/gaodeMap.js
View file @
e5ad9395
...
...
@@ -88,7 +88,7 @@ class gaodeMap {
// 抽屉点击的时候让infowindow隐藏
if
(
this
.
leftListClick
)
{
console
.
log
(
"moveStart"
)
console
.
log
(
"moveStart"
)
;
this
.
closeInfoWindow
();
}
});
...
...
@@ -330,7 +330,7 @@ class gaodeMap {
}
// 如果是新建状态 不出弹框
if
(
this
.
view
.
targetNum
==
1
)
return
;
console
.
log
(
e
.
target
)
console
.
log
(
e
.
target
)
;
let
options
=
map
.
getStatus
();
options
.
scrollWheel
=
false
;
map
.
setStatus
(
options
);
...
...
@@ -558,6 +558,9 @@ class gaodeMap {
//添加事件
polyline
.
on
(
"mouseover"
,
this
.
polylineMouseOver
);
polyline
.
on
(
"click"
,
this
.
polylineMouseOver
);
polyline
.
on
(
"mousedown"
,
e
=>
{
this
.
polyLinesColorClear
(
polyline
);
});
polyline
.
on
(
"mouseout"
,
e
=>
{
polyline
.
setOptions
({
strokeColor
:
"#2EE7E7"
});
// infoWindow.close();
...
...
@@ -576,14 +579,17 @@ class gaodeMap {
polylineMouseOver
=
e
=>
{
console
.
log
(
e
.
type
);
let
polyline
=
e
.
target
;
// 如果是无状态或者是新建并且是鼠标移入
if
(
this
.
view
.
targetNum
==
0
&&
e
.
type
==
"mouseover"
)
{
polyline
.
setOptions
({
strokeColor
:
"#F7FE38"
});
return
;
}
// 当选择的是新建的时候,线是点不了的
if
(
this
.
lineType
==
1
||
this
.
view
.
targetNum
==
1
)
return
;
if
((
this
.
view
.
targetNum
==
2
||
this
.
view
.
targetNum
==
3
)
&&
e
.
type
==
"mouseover"
){
this
.
polyLinesColorClear
(
polyline
);
}
// 上方导航的高
let
X
=
20
,
Y
=
-
20
;
...
...
@@ -640,9 +646,9 @@ class gaodeMap {
// 如果是戍边浮动出现infowindow 就让窗口在固定的位置出现,这样就不显得乱了
if
(
e
.
type
==
"mouseover"
)
{
const
coordinates
=
polyline
.
getPath
().
map
(
item
=>
{
return
[
item
.
lng
,
item
.
lat
]
})
const
coordinates
=
polyline
.
getPath
().
map
(
item
=>
{
return
[
item
.
lng
,
item
.
lat
];
})
;
// const { coordinates } = polyline.getExtData().lineData;
// 计算出前两个点的中点
const
arr1
=
coordinates
[
0
];
...
...
@@ -669,9 +675,11 @@ class gaodeMap {
// const
};
polyLinesColorClear
()
{
polyLinesColorClear
(
polylines
)
{
this
.
polyLines
.
forEach
(
item
=>
{
item
.
setOptions
({
strokeColor
:
"#2EE7E7"
});
if
(
item
!=
polylines
)
{
item
.
setOptions
({
strokeColor
:
"#2EE7E7"
});
}
});
}
centerNum
(
num1
,
num2
)
{
...
...
@@ -709,7 +717,6 @@ class gaodeMap {
}
// 新建line增加编辑以及右键菜单
closeInfoWindow
()
{
this
.
showInfoWindow
&&
this
.
showInfoWindow
.
close
();
this
.
markerInfoWindow
&&
this
.
markerInfoWindow
.
close
();
}
...
...
gassafety-web/src/utils/gaodeMapView.js
View file @
e5ad9395
...
...
@@ -54,8 +54,8 @@ class gaodeMap {
view
=
null
;
handleInfoWindowOpenFunc
=
null
;
onceFlag
=
false
;
用来判断点击左边抽屉列表的时候移动才消失
leftListClick
=
false
;
//
用来判断点击左边抽屉列表的时候移动才消失
leftListClick
=
false
;
//构造函数中设置中央点默认值
constructor
(
center
)
{
this
.
markers
=
[];
...
...
@@ -902,18 +902,23 @@ class gaodeMap {
infoWindow
.
setOffset
(
new
AMap
.
Pixel
(
X
,
Y
));
}
else
{
infoWindow
.
setOffset
(
new
AMap
.
Pixel
(
20
,
-
20
));
this
.
polyLinesColorClear
(
polyline
);
// polyline.setOptions({ strokeColor: "#F7FE38" });
}
this
.
boxCollision
(
infoWindow
.
dom
);
this
.
showInfoWindow
=
infoWindow
;
// const
};
// 所有的线的颜色归位,如果是报警的,就红色,不是就蓝色
polyLinesColorClear
()
{
polyLinesColorClear
(
polyline
)
{
this
.
polyLines
.
forEach
(
item
=>
{
if
(
item
.
getExtData
().
lineData
.
alarmState
==
1
)
{
item
.
setOptions
({
strokeColor
:
"#ff0000"
});
}
else
{
item
.
setOptions
({
strokeColor
:
"#2EE7E7"
});
if
(
item
!=
polyline
)
{
if
(
item
.
getExtData
().
lineData
.
alarmState
==
1
)
{
item
.
setOptions
({
strokeColor
:
"#ff0000"
});
}
else
{
item
.
setOptions
({
strokeColor
:
"#2EE7E7"
});
}
}
});
}
...
...
gassafety-web/src/views/device/map/index.vue
View file @
e5ad9395
...
...
@@ -389,6 +389,8 @@ export default {
}
// 关闭当前的infowindow
this
.
gaoMap
.
closeInfoWindow
();
// 清除所有线的颜色
this
.
gaoMap
.
polyLinesColorClear
();
this
.
deviceType
=
!
this
.
deviceType
;
this
.
gaoMap
.
mapOperateType
=
"add"
;
...
...
@@ -448,6 +450,8 @@ export default {
}
// 关闭当前的infowindow
this
.
gaoMap
.
closeInfoWindow
();
// 清空管道颜色
this
.
gaoMap
.
polyLinesColorClear
();
this
.
createReset
();
},
deleteDevice
()
{
...
...
@@ -469,6 +473,8 @@ export default {
}
// 关闭当前的infowindow
this
.
gaoMap
.
closeInfoWindow
();
// 清空管道颜色
this
.
gaoMap
.
polyLinesColorClear
();
this
.
createReset
();
},
selectDeviceType
(
val
)
{
...
...
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