Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
oms-tiger-shield
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 2bd9a974
authored
Jan 22, 2025
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'change_map' into 'master'
上线合并 See merge request
!80
2 parents
a7991b77
10252e5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
59 deletions
src/utils/monitor.js
src/utils/replay.js
src/views/report/location.vue
src/utils/monitor.js
View file @
2bd9a97
...
...
@@ -368,7 +368,6 @@ const monitor = {
// 激活位置
drawMaker
(
data
,
autoOpenLastInfoWindow
,
mapapi
)
{
console
.
log
(
mapapi
,
'drawMaker'
,
data
)
const
getLngLat
=
mapService
.
getLngLat
(
parseFloat
(
data
.
lng
),
parseFloat
(
data
.
lat
))
const
marker
=
mapService
.
createCarMarker
(
getLngLat
)
mapapi
.
invoke
(
'addOverlay'
,
marker
)
...
...
src/utils/replay.js
View file @
2bd9a97
...
...
@@ -22,6 +22,8 @@ const replay = {
times
:
1
,
timeoutIds
:
[],
data
:
[],
dis
:
[],
distance
:
''
,
markers
:
{},
infowins
:
{},
speed
:
1
,
...
...
@@ -36,24 +38,16 @@ const replay = {
})
},
init
()
{
// if (!replay.pathSPromise) {
// replay.pathSPromise = new Promise(function (resolve, reject) {
// AMapUI.load(['ui/misc/PathSimplifier'], function (PathSimplifier) {
// if (!PathSimplifier.supportCanvas) {
// alert('当前环境不支持 Canvas!')
// return
// }
// replay.PathS = PathSimplifier
// resolve()
// })
// })
// }
var
replayData
=
[]
console
.
log
(
replay
,
'init'
)
replay
.
data
.
forEach
(
function
(
item
)
{
const
lnglat
=
mapService
.
getLngLat
(
item
.
blng
,
item
.
blat
)
replay
.
data
.
reduce
(
function
(
prev
,
item
){
// const lnglat = mapService.getLngLat(item.blng, item.blat)
// replayData.push(lnglat)
let
prevLnglat
=
mapService
.
getLngLat
(
prev
.
blng
,
prev
.
blat
)
let
lnglat
=
mapService
.
getLngLat
(
item
.
blng
,
item
.
blat
)
replay
.
dis
.
push
(
replay
.
getDistance
(
prevLnglat
,
lnglat
))
replayData
.
push
(
lnglat
)
return
item
})
const
self
=
this
const
MAP
=
mapService
.
map
...
...
@@ -63,8 +57,11 @@ const replay = {
const
line
=
mapapi
.
invoke
(
'Polyline'
,
replayData
,
{
strokeColor
:
'#0b94db'
,
strokeWeight
:
6
})
replay
.
startMarker
=
mapService
.
createStartMarker
(
p1
,
mapapi
)
replay
.
endMarker
=
mapService
.
createEndMarker
(
p2
,
mapapi
)
replay
.
dis
=
mapapi
.
invoke
(
'getDistance'
,
p1
,
p2
)
/
1000
// 算出轨迹的距离(km)
console
.
log
(
replay
.
dis
,
'km'
)
// replay.dis = mapapi.invoke('getDistance', p1, p2) / 1000 // 算出轨迹的距离(km)
replay
.
distance
=
replay
.
dis
.
reduce
(
function
(
prev
,
cur
,
index
,
arr
)
{
return
prev
+
cur
;
});
// console.log(replay.dis, 'km')
mapapi
.
invoke
(
'setViewport'
,
replayData
)
mapapi
.
invoke
(
'addOverlay'
,
line
)
mapapi
.
invoke
(
'addOverlay'
,
replay
.
startMarker
)
...
...
@@ -74,7 +71,7 @@ const replay = {
replay
.
navg
=
mapapi
.
invoke
(
'LuShu'
,
replayData
,
{
defaultContent
:
replay
.
getNavgInfoContent
(
firstItem
),
autoView
:
true
,
// 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整
speed
:
replay
.
getSpeed
(
replay
.
speed
,
replay
.
dis
),
speed
:
replay
.
getSpeed
(
replay
.
speed
,
replay
.
dis
tance
/
1000
),
icon
:
mapapi
.
invoke
(
'Icon'
,
'https://e-shield-old.glsx.com.cn/images/icon_car.png'
,
mapapi
.
invoke
(
'Size'
,
36
,
22
),
{
anchor
:
mapapi
.
invoke
(
'Size'
,
18
,
11
)
}),
enableRotation
:
true
// 是否设置marker随着道路的走向进行旋转
})
...
...
@@ -89,7 +86,7 @@ const replay = {
const
item
=
replay
.
data
[
self
.
idx
]
mapapi
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
// 设置信息窗口文案
EventBus
.
$emit
(
'uiMap.replay.currAddress'
,
''
)
if
(
self
.
idx
>=
replay
.
data
.
length
-
2
)
{
if
(
self
.
idx
>=
replay
.
data
.
length
-
3
)
{
EventBus
.
$emit
(
'uiMap.replay.done'
)
}
})
...
...
@@ -186,6 +183,10 @@ const replay = {
// }
// })
},
getDistance
(
p1
,
p2
)
{
const
mapapi
=
mapService
.
mapapi
return
mapapi
.
invoke
(
'getDistance'
,
p1
,
p2
);
},
getNavgInfoContent
(
item
)
{
return
`<div class="navg-info-window">
<div class="tit">
${
item
.
time
}
</div>
...
...
@@ -358,7 +359,7 @@ const replay = {
},
speedEvent
(
idx
,
dis
)
{
console
.
log
(
idx
,
dis
)
const
timeArr
=
[[
40
,
30
,
16
],
[
30
,
20
,
12
],
[
20
,
12
,
8
],
[
10
,
6
,
4
],
[
5
,
3
,
2
]]
// 慢 正常 快 很快
const
timeArr
=
[[
40
,
30
,
16
],
[
30
,
20
,
12
],
[
20
,
12
,
8
],
[
10
,
6
,
4
],
[
5
,
3
,
2
]]
// 慢 正常 快 很快
极快
let
speed
if
(
dis
>=
100
)
{
// 100公里以上
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
0
])
*
3600
)
...
...
@@ -367,6 +368,7 @@ const replay = {
}
else
{
// 10公里以内
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
2
])
*
3600
)
}
console
.
log
(
speed
);
return
speed
},
getSpeed
(
idx
,
dis
)
{
...
...
src/views/report/location.vue
View file @
2bd9a97
...
...
@@ -24,53 +24,59 @@ export default {
};
},
created
()
{
if
(
window
.
AMap
)
{
//
if (window.AMap) {
this
.
initMap
();
}
else
{
remoteLoad
(
`
${
CONSTANT
.
AMAP_URL
}
`
).
then
(()
=>
{
remoteLoad
(
`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`
).
then
(
()
=>
{
this
.
initMap
();
}
);
});
}
//
} else {
//
remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
//
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
//
() => {
//
this.initMap();
//
}
//
);
//
});
//
}
},
methods
:
{
// 初始化地图
initMap
()
{
let
check
=
()
=>
{
if
(
this
.
checkLoadedTimeoutId
)
{
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
}
return
setTimeout
(()
=>
{
if
(
"AMap"
in
window
&&
typeof
AMap
.
Map
==
"function"
&&
!
this
.
mapObj
)
{
window
.
AMap
=
AMap
;
this
.
mapObj
=
mapService
.
init
(
"map"
);
this
.
isInitMap
=
true
;
let
o
=
this
.
$route
.
query
;
if
(
o
.
sn
)
{
this
.
getLocation
(
o
.
sn
);
// o.blat = o.lat;
// o.blng = o.lng;
// this.addLocation(o);
}
}
else
{
this
.
checkLoadedTimeoutId
=
check
();
}
},
100
);
};
this
.
checkLoadedTimeoutId
=
check
();
async
initMap
()
{
this
.
mapapi
=
await
mapService
.
init
(
'map'
,
{
zoom
:
15
})
window
.
GBMap
=
this
.
mapapi
let
o
=
this
.
$route
.
query
;
if
(
o
.
sn
)
{
this
.
getLocation
(
o
.
sn
);
}
// let check = () => {
// if (this.checkLoadedTimeoutId) {
// window.clearTimeout(this.checkLoadedTimeoutId);
// }
// return setTimeout(() => {
// if (
// "AMap" in window &&
// typeof AMap.Map == "function" &&
// !this.mapObj
// ) {
// window.AMap = AMap;
// this.mapObj = mapService.init("map");
// this.isInitMap = true;
// let o = this.$route.query;
// if (o.sn) {
// this.getLocation(o.sn);
// // o.blat = o.lat;
// // o.blng = o.lng;
// // this.addLocation(o);
// }
// } else {
// this.checkLoadedTimeoutId = check();
// }
// }, 100);
// };
// this.checkLoadedTimeoutId = check();
},
// 添加位置点
addLocation
(
row
)
{
let
drawData
=
row
;
EventBus
.
$emit
(
"uiMap.monitor.drawMaker"
,
drawData
,
true
);
EventBus
.
$emit
(
"uiMap.monitor.drawMaker"
,
drawData
,
true
,
this
.
mapapi
);
},
// 获取位置信息
...
...
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