Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-customization-system
/
oEshield
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b719d058
authored
Sep 15, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复bug
1 parent
f07a463c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
20 deletions
src/assets/scss/monitor.scss
src/pages/monitor/FenceMapControll.vue
src/pages/monitor/addPoi.vue
src/utils/mapService.js
src/assets/scss/monitor.scss
View file @
b719d05
...
@@ -607,6 +607,10 @@
...
@@ -607,6 +607,10 @@
}
}
// 新增poi 弹框样式
// 新增poi 弹框样式
.map_poi_infowindow_popup
{
width
:
360px
;
}
.map_poi_infowindow_title
{
.map_poi_infowindow_title
{
position
:
relative
;
position
:
relative
;
padding
:
0
10px
10px
10px
;
padding
:
0
10px
10px
10px
;
...
...
src/pages/monitor/FenceMapControll.vue
View file @
b719d05
...
@@ -79,13 +79,14 @@
...
@@ -79,13 +79,14 @@
<
style
scoped
>
<
style
scoped
>
ul
.map-control
{
ul
.map-control
{
position
:
absolute
;
position
:
absolute
;
bottom
:
260px
;
top
:
50%
;
right
:
10px
;
right
:
10px
;
list-style
:
none
;
list-style
:
none
;
padding
:
5px
;
padding
:
5px
;
margin
:
0px
;
margin
:
0px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.1
);
background-color
:
rgba
(
0
,
0
,
0
,
0.1
);
z-index
:
102
;
z-index
:
102
;
transform
:
translateY
(
-50%
);
}
}
.map-control
>
li
{
.map-control
>
li
{
width
:
30px
;
width
:
30px
;
...
...
src/pages/monitor/addPoi.vue
View file @
b719d05
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
placeholder=
"请输入搜索地址"
placeholder=
"请输入搜索地址"
id=
"poiMapSearch"
id=
"poiMapSearch"
size=
"small"
size=
"small"
maxlength=
"20
0
"
maxlength=
"20"
v-model=
"poiMapSearch"
v-model=
"poiMapSearch"
:disabled=
"readonlyStatus"
:disabled=
"readonlyStatus"
>
>
...
@@ -55,7 +55,7 @@
...
@@ -55,7 +55,7 @@
>
>
<div
class=
"form_list"
>
<div
class=
"form_list"
>
<el-form-item
label=
"POI名称:"
prop=
"poiName"
>
<el-form-item
label=
"POI名称:"
prop=
"poiName"
>
<el-input
v-model=
"form.poiName"
></el-input>
<el-input
v-model=
"form.poiName"
maxlength=
"20"
></el-input>
</el-form-item>
</el-form-item>
<el-form-item
label=
"POI类型:"
prop=
"poiType"
>
<el-form-item
label=
"POI类型:"
prop=
"poiType"
>
<el-select
v-model=
"form.poiType"
class=
"small_select"
>
<el-select
v-model=
"form.poiType"
class=
"small_select"
>
...
@@ -66,10 +66,10 @@
...
@@ -66,10 +66,10 @@
</el-form-item>
</el-form-item>
<div
class=
"lnglat_box"
>
<div
class=
"lnglat_box"
>
<el-form-item
label=
"经度:"
prop=
"lng"
>
<el-form-item
label=
"经度:"
prop=
"lng"
>
<el-input
v-model=
"form.lng"
readonly
/>
<el-input
v-model=
"form.lng"
disabled
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"维度:"
prop=
"lat"
>
<el-form-item
label=
"维度:"
prop=
"lat"
>
<el-input
v-model=
"form.lat"
readonly
/>
<el-input
v-model=
"form.lat"
disabled
/>
</el-form-item>
</el-form-item>
</div>
</div>
</div>
</div>
...
@@ -172,6 +172,7 @@ export default {
...
@@ -172,6 +172,7 @@ export default {
"AMap.MassMarks"
,
"AMap.MassMarks"
,
"AMap.MouseTool"
,
"AMap.MouseTool"
,
"AMap.Geocoder"
,
"AMap.Geocoder"
,
"AMap.MassMarks"
,
]);
]);
_this
.
$mapInit
({
plugins
:
plugins
}).
then
((
AMap
)
=>
{
_this
.
$mapInit
({
plugins
:
plugins
}).
then
((
AMap
)
=>
{
_this
.
mapLoading
=
false
;
_this
.
mapLoading
=
false
;
...
@@ -202,6 +203,42 @@ export default {
...
@@ -202,6 +203,42 @@ export default {
});
});
},
},
// 批量添加海量点
addMassMarkers
(
arr
)
{
let
_this
=
this
;
let
markers
=
[];
let
_icon
=
{
type
:
"image"
,
url
:
require
(
"images/poi-marker-default.png"
),
size
:
[
24
,
15
],
anchor
:
new
AMap
.
Pixel
(
4
,
4
),
};
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
let
k
=
arr
[
i
];
let
m
=
k
.
lnglat
.
split
(
","
);
k
.
lng
=
m
[
0
];
k
.
lat
=
m
[
1
];
k
.
lnglat
=
m
;
//k.extData = arr[i];
markers
.
push
(
k
);
}
let
mass
=
new
AMap
.
MassMarks
(
markers
,
{
opacity
:
0.8
,
zIndex
:
111
,
cursor
:
"pointer"
,
style
:
_icon
,
alwaysRender
:
false
,
});
mass
.
on
(
"click"
,
function
(
e
)
{
console
.
log
(
e
);
_this
.
markerEvent
(
e
.
data
);
});
mass
.
setMap
(
_this
.
map
);
},
// 地图右键添加poi点
// 地图右键添加poi点
addPoiMarker
(
options
,
type
)
{
addPoiMarker
(
options
,
type
)
{
let
_this
=
this
;
let
_this
=
this
;
...
@@ -371,7 +408,7 @@ export default {
...
@@ -371,7 +408,7 @@ export default {
let
_this
=
this
;
let
_this
=
this
;
let
_message
=
"确认删除该POI信息吗?"
;
let
_message
=
"确认删除该POI信息吗?"
;
if
(
row
.
poiName
)
{
if
(
row
.
poiName
)
{
_message
=
`确认删除
${
row
.
poiName
}
的
${
row
.
poiTypeStr
}
POI信息吗?`
;
_message
=
`确认删除
【
${
row
.
poiName
}
】的【
${
row
.
poiTypeStr
}
】
POI信息吗?`
;
}
}
showModal
({
showModal
({
message
:
_message
,
message
:
_message
,
...
@@ -393,6 +430,10 @@ export default {
...
@@ -393,6 +430,10 @@ export default {
if
(
!
row
.
id
)
{
if
(
!
row
.
id
)
{
_map
.
remove
(
_this
.
poiMarker
);
_map
.
remove
(
_this
.
poiMarker
);
_InfoWindow
&&
_InfoWindow
.
close
();
_InfoWindow
&&
_InfoWindow
.
close
();
_this
.
form
=
{};
setTimeout
(
function
()
{
_this
.
$refs
.
poiForm
.
clearValidate
();
},
100
);
return
false
;
return
false
;
}
}
_params
.
id
=
row
.
id
;
_params
.
id
=
row
.
id
;
...
@@ -420,15 +461,16 @@ export default {
...
@@ -420,15 +461,16 @@ export default {
GET_POI_TRACK
().
then
((
res
)
=>
{
GET_POI_TRACK
().
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
let
_list
=
res
.
data
||
[];
let
_list
=
res
.
data
||
[];
_list
.
map
((
k
)
=>
{
// _list.map((k) => {
if
(
k
.
lnglat
)
{
// if (k.lnglat) {
let
m
=
k
.
lnglat
.
split
(
","
);
// let m = k.lnglat.split(",");
k
.
lng
=
m
[
0
];
// k.lng = m[0];
k
.
lat
=
m
[
1
];
// k.lat = m[1];
console
.
log
(
k
);
// console.log(k);
_this
.
addPoiMarker
(
k
);
// _this.addPoiMarker(k);
}
// }
});
// });
_this
.
addMassMarkers
(
_list
);
// 编辑页面,如果id存在,则显示对应的marker
// 编辑页面,如果id存在,则显示对应的marker
let
_markerList
=
_this
.
markerList
;
let
_markerList
=
_this
.
markerList
;
...
...
src/utils/mapService.js
View file @
b719d05
...
@@ -56,7 +56,6 @@ MapService.prototype = {
...
@@ -56,7 +56,6 @@ MapService.prototype = {
self
.
type
=
self
.
type
?
0
:
1
;
//0:使用2D地图,1:混合图
self
.
type
=
self
.
type
?
0
:
1
;
//0:使用2D地图,1:混合图
if
(
self
.
type
===
1
)
{
if
(
self
.
type
===
1
)
{
// 构造官方卫星、路网图层
// 构造官方卫星、路网图层
self
.
mixLayers
=
[
self
.
mixLayers
=
[
...
@@ -92,7 +91,7 @@ MapService.prototype = {
...
@@ -92,7 +91,7 @@ MapService.prototype = {
console
.
log
(
result
);
console
.
log
(
result
);
if
(
status
==
'complete'
){
if
(
status
==
'complete'
){
self
.
currentMarker
&&
self
.
map
.
remove
(
self
.
currentMarker
);
self
.
currentMarker
&&
self
.
map
.
remove
(
self
.
currentMarker
);
var
lnglatXY
=
self
.
getLngLat
(
e
.
position
.
lng
,
e
.
position
.
lat
);
var
lnglatXY
=
self
.
getLngLat
(
result
.
position
.
lng
,
result
.
position
.
lat
);
self
.
currentMarker
=
self
.
createMarker
(
lnglatXY
);
self
.
currentMarker
=
self
.
createMarker
(
lnglatXY
);
self
.
setFitView
()
self
.
setFitView
()
}
}
...
@@ -949,11 +948,11 @@ MapService.prototype = {
...
@@ -949,11 +948,11 @@ MapService.prototype = {
// 创建poi信息弹框
// 创建poi信息弹框
createPoiMarkerInfowindow
(
info
){
createPoiMarkerInfowindow
(
info
){
let
infoDiv
=
document
.
createElement
(
'div'
);
let
infoDiv
=
document
.
createElement
(
'div'
);
let
_div
=
`<h3 class="map_poi_infowindow_title">
${
info
.
address
||
'暂无地址'
}
</h3>
let
_div
=
`<
div class="map_poi_infowindow_popup"><
h3 class="map_poi_infowindow_title">
${
info
.
address
||
'暂无地址'
}
</h3>
<div class="map_poi_infowindow_content">
<div class="map_poi_infowindow_content">
<span class="near_address">
${
info
.
near
||
'无'
}${
info
.
near
?
'附近'
:
''
}
</span>
<span class="near_address">
${
info
.
near
||
'无'
}${
info
.
near
?
'附近'
:
''
}
</span>
<button href="javascript:void(0)" class="clear_link" data-poi-delete>删除</button>
<button href="javascript:void(0)" class="clear_link" data-poi-delete>删除</button>
</div>`
;
</div>
</div>
`
;
infoDiv
.
innerHTML
=
_div
;
infoDiv
.
innerHTML
=
_div
;
infoDiv
.
querySelector
(
'[data-poi-delete]'
).
onclick
=
function
(
e
)
{
infoDiv
.
querySelector
(
'[data-poi-delete]'
).
onclick
=
function
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
...
@@ -963,7 +962,7 @@ MapService.prototype = {
...
@@ -963,7 +962,7 @@ MapService.prototype = {
offset
:
new
AMap
.
Pixel
(
12
,
-
5
),
offset
:
new
AMap
.
Pixel
(
12
,
-
5
),
content
:
infoDiv
,
content
:
infoDiv
,
autoMove
:
true
,
autoMove
:
true
,
position
:[
info
.
lng
,
info
.
lat
]
position
:[
info
.
lng
,
info
.
lat
]
,
})
})
return
infoWindow
return
infoWindow
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment