Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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-progress
Commits
c4cb4965
Commit
c4cb4965
authored
Feb 28, 2022
by
纪泽龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加label
parent
c42ae474
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
57 deletions
+32
-57
all.scss
gassafetyprogress-web/src/assets/styles/all.scss
+13
-4
map.js
gassafetyprogress-web/src/utils/mapClass/map.js
+19
-53
No files found.
gassafetyprogress-web/src/assets/styles/all.scss
View file @
c4cb4965
...
...
@@ -613,8 +613,17 @@
// overflow-y: none !important;
}
.amap-info
{
}
// map里的label
.amap-info
{
position
:
fixed
!
important
;
z-index
:
999
!
important
;
}
}
.amap-marker-label
{
background-color
:
rgba
(
9
,
18
,
32
,
0
.6
)
!
important
;
color
:
#fff
!
important
;
border
:none
!
important
;
padding
:
10px
;
}
gassafetyprogress-web/src/utils/mapClass/map.js
View file @
c4cb4965
/*
* @Author: your name
* @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-02-2
6 23:40:59
* @LastEditTime: 2022-02-2
8 10:25:45
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js
...
...
@@ -255,6 +255,10 @@ export class EditorMap {
icon
,
position
:
[
lng
,
lat
],
extData
:
deviceData
,
// label:{
// content:123,
// direction:"top",
// }
});
// device.hide();
// 如果没有有这个公司的数组,就创建,有就直接push
...
...
@@ -278,6 +282,18 @@ export class EditorMap {
// 3是删除操作
}
});
device
.
on
(
"mouseover"
,(
e
)
=>
{
const
target
=
e
.
target
;
const
data
=
target
.
getExtData
();
console
.
log
(
data
)
const
name
=
data
.
nickName
||
data
.
deviceName
||
data
.
videoName
||
data
.
stationName
target
.
setLabel
({
content
:
name
,
direction
:
"top"
})
})
device
.
on
(
"mouseout"
,(
e
)
=>
{
const
target
=
e
.
target
;
const
data
=
target
.
getExtData
();
target
.
setLabel
({
content
:
""
})
})
}
/** 点击marker出现infowindow
* @description:
...
...
@@ -442,7 +458,7 @@ export class EditorMap {
if
(
!
this
.
infowindow
)
return
;
this
.
infowindow
.
close
();
}
// 设备以及公司过滤
allfilter
(
companyArr
,
typeArr
)
{
for
(
let
pipeItem
in
this
.
pipeArr
)
{
this
.
pipeArr
[
pipeItem
].
forEach
((
pipe
)
=>
{
...
...
@@ -472,57 +488,7 @@ export class EditorMap {
});
}
}
// 根据公司过滤是否显示 公司由一个数组传过来
companyFilter
(
companyArr
)
{
for
(
let
pipeItem
in
this
.
pipeArr
)
{
this
.
pipeArr
[
pipeItem
].
forEach
((
pipe
)
=>
{
const
data
=
pipe
.
getExtData
();
if
(
companyArr
.
indexOf
(
data
.
companyType
+
""
)
>=
0
)
{
pipe
.
show
();
}
else
{
pipe
.
hide
();
}
});
}
for
(
let
deviceItem
in
this
.
allDevice
)
{
this
.
allDevice
[
deviceItem
].
forEach
((
device
)
=>
{
const
data
=
device
.
getExtData
();
// 燃气没有公司,所以没有device.companyType不收到公司的控制
const
companyHas
=
companyArr
.
indexOf
(
data
.
companyType
+
""
)
>=
0
;
// 必须设备存在数组里,才会显示设备 !data.companyType代表用户不受公司制约
if
(
companyHas
||
!
data
.
companyType
)
{
device
.
show
();
}
else
{
device
.
hide
();
}
});
}
}
// 根据设备类型隐藏展示
iconTypeFilter
(
typeArr
)
{
for
(
let
deviceItem
in
this
.
allDevice
)
{
this
.
allDevice
[
deviceItem
].
forEach
((
device
)
=>
{
if
(
typeArr
.
indexOf
(
deviceItem
+
""
)
>=
0
)
{
device
.
show
();
}
else
{
device
.
hide
();
}
});
}
}
// 公司改变,先调用设备方法,在调用公司方法
companyChange
(
companyArr
,
typeArr
)
{
this
.
iconTypeFilter
(
typeArr
);
this
.
companyFilter
(
companyArr
);
}
// 设备选择,先调用公司方法,在调用设备方法覆盖
deviceChange
(
companyArr
,
typeArr
)
{
this
.
companyFilter
(
companyArr
);
this
.
iconTypeFilter
(
typeArr
);
}
// 卫星图切换
satellite
=
null
;
changeMap
(
bool
)
{
...
...
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