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 f2c505fc
authored
Mar 27, 2024
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复
1 parent
2ae3083e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
60 deletions
src/pages/monitor/alarmAnalysis.vue
src/pages/monitor/monitor.vue
src/utils/mapService.js
src/pages/monitor/alarmAnalysis.vue
View file @
f2c505f
...
@@ -186,7 +186,7 @@ export default {
...
@@ -186,7 +186,7 @@ export default {
initMap
()
{
initMap
()
{
let
check
=
()
=>
{
let
check
=
()
=>
{
this
.
checkMapLoaded
&&
window
.
clearTimeout
(
this
.
checkMapLoaded
);
this
.
checkMapLoaded
&&
window
.
clearTimeout
(
this
.
checkMapLoaded
);
return
this
.
$nextTick
(()
=>
{
return
setTimeout
(()
=>
{
if
(
if
(
"AMap"
in
window
&&
"AMap"
in
window
&&
typeof
AMap
.
Map
==
"function"
&&
typeof
AMap
.
Map
==
"function"
&&
...
@@ -194,10 +194,8 @@ export default {
...
@@ -194,10 +194,8 @@ export default {
)
{
)
{
window
.
AMap
=
AMap
;
window
.
AMap
=
AMap
;
this
.
mapObj
=
mapService
.
init
(
"map"
);
this
.
mapObj
=
mapService
.
init
(
"map"
);
//this.bindEvent();
this
.
isInitMap
=
true
;
this
.
isInitMap
=
true
;
this
.
getStayPointList
(
this
.
vehicleId
)
this
.
getStayPointList
(
this
.
vehicleId
)
// this.drawPoi()
}
else
{
}
else
{
this
.
checkMapLoaded
=
check
();
this
.
checkMapLoaded
=
check
();
}
}
...
...
src/pages/monitor/monitor.vue
View file @
f2c505f
...
@@ -657,8 +657,6 @@ export default {
...
@@ -657,8 +657,6 @@ export default {
)
{
)
{
window
.
AMap
=
AMap
;
window
.
AMap
=
AMap
;
this
.
mapObj
=
mapService
.
init
(
"map"
);
this
.
mapObj
=
mapService
.
init
(
"map"
);
//this.bindEvent();
this
.
isInitMap
=
true
;
this
.
isInitMap
=
true
;
if
(
this
.
$route
.
query
.
snArr
)
{
if
(
this
.
$route
.
query
.
snArr
)
{
let
routeQuery
=
JSON
.
parse
(
this
.
$route
.
query
.
snArr
);
let
routeQuery
=
JSON
.
parse
(
this
.
$route
.
query
.
snArr
);
...
...
src/utils/mapService.js
View file @
f2c505f
...
@@ -270,73 +270,72 @@ MapService.prototype = {
...
@@ -270,73 +270,72 @@ MapService.prototype = {
fillOpacity
:
1
fillOpacity
:
1
});
});
},
},
// createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
// var infoWindow = new AMap.InfoWindow({
// offset: new AMap.Pixel(0, 0),
// content: div,
// autoMove: !!isInfoAutoMove
// });
// marker.infoWindow = infoWindow;
// // var clipboard = new ClipboardJS(div.querySelector('.copy-btn'));
// if (clipboard) {
// clipboard.destroy();
// }
// clipboard = new ClipboardJS('.copy-btn', {
// text: function(trigger) {
// return trigger.getAttribute('aria-label');
// }
// })
// clipboard.on('success', function(e) {
// e.clearSelection();
// EventBus.$emit('uiMap.copySuccess');
// });
// clipboard.on('error', function(e) {
// });
// if (isInfoOpen) {
// infoWindow.open(map, marker.getPosition());
// }
// //给Marker绑定单击事件
// marker.on('click', markerClick);
// function markerClick(e) {
// //infoWindow.setContent(e.target.content);
// infoWindow.open(map, e.target.getPosition());
// }
// return infoWindow;
// },
createInfoWindow
(
marker
,
map
,
div
,
isInfoOpen
,
isInfoAutoMove
)
{
createInfoWindow
(
marker
,
map
,
div
,
isInfoOpen
,
isInfoAutoMove
)
{
var
infoWindow
=
new
AMap
.
InfoWindow
({
var
infoWindow
=
new
AMap
.
InfoWindow
({
offset
:
new
AMap
.
Pixel
(
0
,
0
),
offset
:
new
AMap
.
Pixel
(
0
,
0
),
content
:
div
,
content
:
div
,
autoMove
:
!!
isInfoAutoMove
,
autoMove
:
!!
isInfoAutoMove
})
})
;
marker
.
infoWindow
=
infoWindow
marker
.
infoWindow
=
infoWindow
;
var
clipboard
=
new
ClipboardJS
(
div
.
querySelector
(
'.copy-btn'
))
// var clipboard = new ClipboardJS(div.querySelector('.copy-btn'));
clipboard
.
on
(
'success'
,
function
(
e
)
{
if
(
clipboard
)
{
e
.
clearSelection
()
clipboard
.
destroy
();
EventBus
.
$emit
(
'uiMap.copySuccess'
)
}
})
clipboard
=
new
ClipboardJS
(
'.copy-btn'
,
{
clipboard
.
on
(
'error'
,
function
(
e
)
{
text
:
function
(
trigger
)
{
console
.
error
(
'Action:'
,
e
.
action
)
return
trigger
.
getAttribute
(
'aria-label'
);
console
.
error
(
'Trigger:'
,
e
.
trigger
)
}
})
})
clipboard
.
on
(
'success'
,
function
(
e
)
{
e
.
clearSelection
();
EventBus
.
$emit
(
'uiMap.copySuccess'
);
});
clipboard
.
on
(
'error'
,
function
(
e
)
{
});
if
(
isInfoOpen
)
{
if
(
isInfoOpen
)
{
infoWindow
.
open
(
map
,
marker
.
getPosition
())
infoWindow
.
open
(
map
,
marker
.
getPosition
());
}
}
//给Marker绑定单击事件
//给Marker绑定单击事件
marker
.
on
(
'click'
,
markerClick
)
marker
.
on
(
'click'
,
markerClick
)
;
function
markerClick
(
e
)
{
function
markerClick
(
e
)
{
//infoWindow.setContent(e.target.content);
//infoWindow.setContent(e.target.content);
infoWindow
.
open
(
map
,
e
.
target
.
getPosition
())
infoWindow
.
open
(
map
,
e
.
target
.
getPosition
());
}
}
return
infoWindow
return
infoWindow
;
},
},
// createInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
// var infoWindow = new AMap.InfoWindow({
// offset: new AMap.Pixel(0, 0),
// content: div,
// autoMove: !!isInfoAutoMove,
// })
// marker.infoWindow = infoWindow
// var clipboard = new ClipboardJS(div.querySelector('.copy-btn'))
// clipboard.on('success', function (e) {
// e.clearSelection()
// EventBus.$emit('uiMap.copySuccess')
// })
// clipboard.on('error', function (e) {
// console.error('Action:', e.action)
// console.error('Trigger:', e.trigger)
// })
// if (isInfoOpen) {
// infoWindow.open(map, marker.getPosition())
// }
// //给Marker绑定单击事件
// marker.on('click', markerClick)
// function markerClick(e) {
// //infoWindow.setContent(e.target.content);
// infoWindow.open(map, e.target.getPosition())
// }
// return infoWindow
// },
// 初始化复制事件
// 初始化复制事件
initCopyEvent
()
{
initCopyEvent
()
{
var
clipboard
=
new
ClipboardJS
(
'.copy-btn'
,
{
var
clipboard
=
new
ClipboardJS
(
'.copy-btn'
,
{
...
@@ -596,7 +595,15 @@ MapService.prototype = {
...
@@ -596,7 +595,15 @@ MapService.prototype = {
var
self
=
this
;
var
self
=
this
;
var
infoDiv
=
document
.
createElement
(
'div'
);
var
infoDiv
=
document
.
createElement
(
'div'
);
infoDiv
.
innerHTML
=
self
.
createLocationInfo
(
info
);
infoDiv
.
innerHTML
=
self
.
createLocationInfo
(
info
);
// let addressCopyBtn = infoDiv.querySelector('[address-copy]');
let
addressCopyBtn
=
new
ClipboardJS
(
infoDiv
.
querySelector
(
'.address-copy'
));
console
.
log
(
addressCopyBtn
,
'addressCopyBtn'
);
addressCopyBtn
.
on
(
'success'
,
function
(
e
)
{
e
.
clearSelection
();
EventBus
.
$emit
(
'uiMap.copySuccess'
);
});
addressCopyBtn
.
on
(
'error'
,
function
(
e
)
{
});
return
this
.
createInfoWindow
(
marker
,
map
,
infoDiv
);
return
this
.
createInfoWindow
(
marker
,
map
,
infoDiv
);
},
},
bindResidentInfoWindow
(
marker
,
map
,
info
)
{
bindResidentInfoWindow
(
marker
,
map
,
info
)
{
...
@@ -862,7 +869,7 @@ MapService.prototype = {
...
@@ -862,7 +869,7 @@ MapService.prototype = {
<div class="map-infowindow-ct">
<div class="map-infowindow-ct">
<p><i class="icon icon-info_time"></i> 停留时间: <span class="des">
${
info
.
begintime
}
</span></p>
<p><i class="icon icon-info_time"></i> 停留时间: <span class="des">
${
info
.
begintime
}
</span></p>
<p><i class="icon icon-info_location"></i> 停留地址: <span class="des adr" >
${
info
.
transferAddress
}
</span>
<p><i class="icon icon-info_location"></i> 停留地址: <span class="des adr" >
${
info
.
transferAddress
}
</span>
<a class="copy-btn
"
data-clipboard-text="
${
info
.
transferAddress
}
"><i class="icon icon-info_copy"></i></a>
<a class="copy-btn
address-copy" id="address-copy" address-copy
data-clipboard-text="
${
info
.
transferAddress
}
"><i class="icon icon-info_copy"></i></a>
</p>
</p>
<p><i class="icon icon-info_stop"></i> 停留时长: <span class="des">
${
info
.
duration
}
</span></p>
<p><i class="icon icon-info_stop"></i> 停留时长: <span class="des">
${
info
.
duration
}
</span></p>
</div>`
;
</div>`
;
...
@@ -1029,7 +1036,7 @@ MapService.prototype = {
...
@@ -1029,7 +1036,7 @@ MapService.prototype = {
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