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 = {
...
@@ -368,7 +368,6 @@ const monitor = {
// 激活位置
// 激活位置
drawMaker
(
data
,
autoOpenLastInfoWindow
,
mapapi
)
{
drawMaker
(
data
,
autoOpenLastInfoWindow
,
mapapi
)
{
console
.
log
(
mapapi
,
'drawMaker'
,
data
)
const
getLngLat
=
mapService
.
getLngLat
(
parseFloat
(
data
.
lng
),
parseFloat
(
data
.
lat
))
const
getLngLat
=
mapService
.
getLngLat
(
parseFloat
(
data
.
lng
),
parseFloat
(
data
.
lat
))
const
marker
=
mapService
.
createCarMarker
(
getLngLat
)
const
marker
=
mapService
.
createCarMarker
(
getLngLat
)
mapapi
.
invoke
(
'addOverlay'
,
marker
)
mapapi
.
invoke
(
'addOverlay'
,
marker
)
...
...
src/utils/replay.js
View file @
2bd9a97
...
@@ -22,6 +22,8 @@ const replay = {
...
@@ -22,6 +22,8 @@ const replay = {
times
:
1
,
times
:
1
,
timeoutIds
:
[],
timeoutIds
:
[],
data
:
[],
data
:
[],
dis
:
[],
distance
:
''
,
markers
:
{},
markers
:
{},
infowins
:
{},
infowins
:
{},
speed
:
1
,
speed
:
1
,
...
@@ -36,24 +38,16 @@ const replay = {
...
@@ -36,24 +38,16 @@ const replay = {
})
})
},
},
init
()
{
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
=
[]
var
replayData
=
[]
console
.
log
(
replay
,
'init'
)
console
.
log
(
replay
,
'init'
)
replay
.
data
.
forEach
(
function
(
item
)
{
replay
.
data
.
reduce
(
function
(
prev
,
item
){
const
lnglat
=
mapService
.
getLngLat
(
item
.
blng
,
item
.
blat
)
// 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
)
replayData
.
push
(
lnglat
)
return
item
})
})
const
self
=
this
const
self
=
this
const
MAP
=
mapService
.
map
const
MAP
=
mapService
.
map
...
@@ -63,8 +57,11 @@ const replay = {
...
@@ -63,8 +57,11 @@ const replay = {
const
line
=
mapapi
.
invoke
(
'Polyline'
,
replayData
,
{
strokeColor
:
'#0b94db'
,
strokeWeight
:
6
})
const
line
=
mapapi
.
invoke
(
'Polyline'
,
replayData
,
{
strokeColor
:
'#0b94db'
,
strokeWeight
:
6
})
replay
.
startMarker
=
mapService
.
createStartMarker
(
p1
,
mapapi
)
replay
.
startMarker
=
mapService
.
createStartMarker
(
p1
,
mapapi
)
replay
.
endMarker
=
mapService
.
createEndMarker
(
p2
,
mapapi
)
replay
.
endMarker
=
mapService
.
createEndMarker
(
p2
,
mapapi
)
replay
.
dis
=
mapapi
.
invoke
(
'getDistance'
,
p1
,
p2
)
/
1000
// 算出轨迹的距离(km)
// replay.dis = mapapi.invoke('getDistance', p1, p2) / 1000 // 算出轨迹的距离(km)
console
.
log
(
replay
.
dis
,
'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
(
'setViewport'
,
replayData
)
mapapi
.
invoke
(
'addOverlay'
,
line
)
mapapi
.
invoke
(
'addOverlay'
,
line
)
mapapi
.
invoke
(
'addOverlay'
,
replay
.
startMarker
)
mapapi
.
invoke
(
'addOverlay'
,
replay
.
startMarker
)
...
@@ -74,7 +71,7 @@ const replay = {
...
@@ -74,7 +71,7 @@ const replay = {
replay
.
navg
=
mapapi
.
invoke
(
'LuShu'
,
replayData
,
{
replay
.
navg
=
mapapi
.
invoke
(
'LuShu'
,
replayData
,
{
defaultContent
:
replay
.
getNavgInfoContent
(
firstItem
),
defaultContent
:
replay
.
getNavgInfoContent
(
firstItem
),
autoView
:
true
,
// 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整
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
)
}),
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随着道路的走向进行旋转
enableRotation
:
true
// 是否设置marker随着道路的走向进行旋转
})
})
...
@@ -89,7 +86,7 @@ const replay = {
...
@@ -89,7 +86,7 @@ const replay = {
const
item
=
replay
.
data
[
self
.
idx
]
const
item
=
replay
.
data
[
self
.
idx
]
mapapi
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
// 设置信息窗口文案
mapapi
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
// 设置信息窗口文案
EventBus
.
$emit
(
'uiMap.replay.currAddress'
,
''
)
EventBus
.
$emit
(
'uiMap.replay.currAddress'
,
''
)
if
(
self
.
idx
>=
replay
.
data
.
length
-
2
)
{
if
(
self
.
idx
>=
replay
.
data
.
length
-
3
)
{
EventBus
.
$emit
(
'uiMap.replay.done'
)
EventBus
.
$emit
(
'uiMap.replay.done'
)
}
}
})
})
...
@@ -186,6 +183,10 @@ const replay = {
...
@@ -186,6 +183,10 @@ const replay = {
// }
// }
// })
// })
},
},
getDistance
(
p1
,
p2
)
{
const
mapapi
=
mapService
.
mapapi
return
mapapi
.
invoke
(
'getDistance'
,
p1
,
p2
);
},
getNavgInfoContent
(
item
)
{
getNavgInfoContent
(
item
)
{
return
`<div class="navg-info-window">
return
`<div class="navg-info-window">
<div class="tit">
${
item
.
time
}
</div>
<div class="tit">
${
item
.
time
}
</div>
...
@@ -358,7 +359,7 @@ const replay = {
...
@@ -358,7 +359,7 @@ const replay = {
},
},
speedEvent
(
idx
,
dis
)
{
speedEvent
(
idx
,
dis
)
{
console
.
log
(
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
let
speed
if
(
dis
>=
100
)
{
// 100公里以上
if
(
dis
>=
100
)
{
// 100公里以上
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
0
])
*
3600
)
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
0
])
*
3600
)
...
@@ -367,6 +368,7 @@ const replay = {
...
@@ -367,6 +368,7 @@ const replay = {
}
else
{
// 10公里以内
}
else
{
// 10公里以内
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
2
])
*
3600
)
speed
=
Math
.
floor
((
dis
/
timeArr
[
idx
][
2
])
*
3600
)
}
}
console
.
log
(
speed
);
return
speed
return
speed
},
},
getSpeed
(
idx
,
dis
)
{
getSpeed
(
idx
,
dis
)
{
...
...
src/views/report/location.vue
View file @
2bd9a97
...
@@ -24,53 +24,59 @@ export default {
...
@@ -24,53 +24,59 @@ export default {
};
};
},
},
created
()
{
created
()
{
if
(
window
.
AMap
)
{
//
if (window.AMap) {
this
.
initMap
();
this
.
initMap
();
}
else
{
//
} else {
remoteLoad
(
`
${
CONSTANT
.
AMAP_URL
}
`
).
then
(()
=>
{
//
remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
remoteLoad
(
`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`
).
then
(
//
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
()
=>
{
//
() => {
this
.
initMap
();
//
this.initMap();
}
//
}
);
//
);
});
//
});
}
//
}
},
},
methods
:
{
methods
:
{
// 初始化地图
// 初始化地图
initMap
()
{
async
initMap
()
{
let
check
=
()
=>
{
this
.
mapapi
=
await
mapService
.
init
(
'map'
,
{
zoom
:
15
})
if
(
this
.
checkLoadedTimeoutId
)
{
window
.
GBMap
=
this
.
mapapi
window
.
clearTimeout
(
this
.
checkLoadedTimeoutId
);
let
o
=
this
.
$route
.
query
;
}
if
(
o
.
sn
)
{
return
setTimeout
(()
=>
{
this
.
getLocation
(
o
.
sn
);
if
(
}
"AMap"
in
window
&&
// let check = () => {
typeof
AMap
.
Map
==
"function"
&&
// if (this.checkLoadedTimeoutId) {
!
this
.
mapObj
// window.clearTimeout(this.checkLoadedTimeoutId);
)
{
// }
window
.
AMap
=
AMap
;
// return setTimeout(() => {
this
.
mapObj
=
mapService
.
init
(
"map"
);
// if (
this
.
isInitMap
=
true
;
// "AMap" in window &&
let
o
=
this
.
$route
.
query
;
// typeof AMap.Map == "function" &&
if
(
o
.
sn
)
{
// !this.mapObj
this
.
getLocation
(
o
.
sn
);
// ) {
// o.blat = o.lat;
// window.AMap = AMap;
// o.blng = o.lng;
// this.mapObj = mapService.init("map");
// this.addLocation(o);
// this.isInitMap = true;
}
// let o = this.$route.query;
}
else
{
// if (o.sn) {
this
.
checkLoadedTimeoutId
=
check
();
// this.getLocation(o.sn);
}
// // o.blat = o.lat;
},
100
);
// // o.blng = o.lng;
};
// // this.addLocation(o);
this
.
checkLoadedTimeoutId
=
check
();
// }
// } else {
// this.checkLoadedTimeoutId = check();
// }
// }, 100);
// };
// this.checkLoadedTimeoutId = check();
},
},
// 添加位置点
// 添加位置点
addLocation
(
row
)
{
addLocation
(
row
)
{
let
drawData
=
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