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 debf92b1
authored
Dec 10, 2025
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'bugfix_change_map_2025-12-05' into 'master'
开发提测合并 See merge request
!53
2 parents
579ff903
a094dff3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
53 deletions
src/assets/scss/map.scss
src/assets/scss/monitor.scss
src/pages/monitor/zoneCar.vue
src/utils/mapBService.js
src/utils/replay.js
src/assets/scss/map.scss
View file @
debf92b
...
...
@@ -43,7 +43,7 @@ h3.uimap-info-title{
background-color
:
#fff
;
border-radius
:
4px
;
border
:
1px
solid
#eee
;
//
border: 1px solid #eee;
.tit
{
padding
:
10px
15px
;
}
...
...
src/assets/scss/monitor.scss
View file @
debf92b
...
...
@@ -684,4 +684,7 @@
}
.BMap_bubble_top
{
height
:
7px
!
important
;
}
\ No newline at end of file
}
// .BMap_bubble_bottom ~ img {
// top: 84px !important;
// }
src/pages/monitor/zoneCar.vue
View file @
debf92b
...
...
@@ -228,12 +228,12 @@ export default {
},
methods
:
{
async
initBMap
()
{
console
.
log
(
11111111111
);
//
console.log(11111111111);
this
.
mapObj
=
await
mapService
.
init
(
"map"
);
this
.
mapLoading
=
false
;
window
.
AMap
=
this
.
mapObj
;
AMap
.
invoke
(
"LocalCity"
,
(
res
)
=>
{
AMap
.
invoke
(
'panTo'
,
res
.
center
)
AMap
.
invoke
(
"panTo"
,
res
.
center
);
});
this
.
autoComplete
=
AMap
.
invoke
(
"Autocomplete"
,
{
input
:
"tipInput"
,
...
...
@@ -241,7 +241,7 @@ export default {
AMap
.
invoke
(
"autocompleteShow"
);
AMap
.
invoke
(
"autocompleteAddEventListener"
,
"onconfirm"
,
(
e
)
=>
{
this
.
poi
=
e
.
item
.
value
;
this
.
$set
(
this
.
form
,
"address"
,
this
.
poi
.
address
);
this
.
$set
(
this
.
form
,
"address"
,
this
.
poi
.
address
||
""
);
this
.
$refs
.
addressInput
.
focus
();
});
...
...
@@ -303,7 +303,7 @@ export default {
{
isOpen
:
true
,
// 是否开启绘制模式
enableDrawingTool
:
false
,
enableCalculate
:
true
,
// 绘制是否进行测距测面
//
enableCalculate: true, // 绘制是否进行测距测面
enableSorption
:
true
,
// 是否开启边界吸附功能
sorptiondistance
:
20
,
// 边界吸附距离
circleOptions
:
styleOptions
,
// 圆的样式
...
...
@@ -382,7 +382,7 @@ export default {
southWest
.
lat
,
northEast
.
lng
);
// 南到北的距离
console
.
log
(
width
,
height
);
//
console.log(width, height);
this
.
rectangleHeight
=
width
.
toFixed
(
0
);
this
.
rectangleWidth
=
height
.
toFixed
(
0
);
},
...
...
@@ -557,7 +557,7 @@ export default {
let m = o.gpsLocation || {};
o.lng = m.blng;
o.lat = m.blat;
o.address = m.address;
o.address = m.address
|| ""
;
o.type = 2;
o.time = m.dateTime;
o.standNo = item.standNo || item.vin;
...
...
@@ -565,17 +565,43 @@ export default {
arr.push(o);
_this.location = o;
});
_this.addMarkers(arr);
_this.addMarkers(arr
, false
);
});
});
},
// 将坐标转换封装为返回 Promise 的函数
convertCoordinate(item) {
item = item.split(",");
return new Promise((resolve) => {
AMap.invoke(
"Convertor",
[AMap.invoke("Point", item[0], item[1])],
5,
3,
(res) => {
const convertedPoint = res.points.length ? res.points[0] : item;
resolve(convertedPoint);
}
);
});
},
AMapPoint2BMapPoint(AMapPoint, callback) {
AMap.invoke(
"Convertor",
[AMap.invoke("Point", AMapPoint.lng, AMapPoint.lat)],
3,
5,
(res) => {
const convertedPoint = res.points.length ? res.points[0] : item;
callback(convertedPoint);
}
);
},
// 区域查车
async getAreaLocation() {
let _this = this;
let params = this.getParams();
let _options = this.$route.query;
console.log(_options);
if (!_this.rectangle) {
showToast({
...
...
@@ -586,7 +612,7 @@ export default {
_this.deviceList = [];
if (_this.mapMass) {
AMap.invoke("clearOverlays");
//
AMap.invoke("clearOverlays");
_this.mapMass = null;
}
if (_options.type != "full") {
...
...
@@ -596,6 +622,10 @@ export default {
_this.loading = true;
delete params.paths;
let left = await this.convertCoordinate(params.leftLngLat);
let right = await this.convertCoordinate(params.rightLngLat);
params.leftLngLat = `
$
{
left
.
lng
}
,
${
left
.
lat
}
`
;
params
.
rightLngLat
=
`
${
right
.
lng
}
,
${
right
.
lat
}
`
;
let
res
=
await
GER_REGIONAL_SEARCH
(
params
);
console
.
log
(
res
,
"res"
);
_this
.
loading
=
false
;
...
...
@@ -608,7 +638,7 @@ export default {
let
list
=
res
.
data
||
[];
_this
.
deviceList
=
list
;
_this
.
hideFooter
=
false
;
_this.addMarkers(list);
_this
.
addMarkers
(
list
,
true
);
},
// 在地图上画行政区域
...
...
@@ -616,23 +646,30 @@ export default {
EventBus
.
$emit
(
"uiMap.fence.drawDistrict"
,
areaCode
);
},
// 添加海量点 (MassMarks方式)
addMarkers(arr) {
addMarkers
(
arr
,
isTranslate
)
{
let
_this
=
this
;
let
markers
=
[];
console.log(arr);
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
let
k
=
arr
[
i
];
console.log(k);
let
lnglat
=
mapService
.
getLngLat
(
k
.
lng
,
k
.
lat
);
let marker = mapService.createCarMarker(lnglat);
markers.push(marker);
AMap.invoke("addOverlay", marker);
AMap.invoke("panTo", lnglat);
AMap.invoke("markerAddEventListener", "click", (e) => {
console.log(e);
let infoWindow = mapService.createAraeInfowindow(k);
AMap.invoke("mapOpenInfoWindow", infoWindow, e.target.getPosition());
});
if
(
isTranslate
)
{
this
.
AMapPoint2BMapPoint
(
lnglat
,
(
translateLngLat
)
=>
{
//写死了 高德地图转百度地图 TODO: 动态判断
let
marker
=
_this
.
_createMarker
(
translateLngLat
,
k
);
markers
.
push
(
marker
);
// let marker = mapService.createCarMarker(carPoint);
// markers.push(marker);
// AMap.invoke("addOverlay", marker);
// AMap.invoke("panTo", lnglat);
// AMap.invoke("markerAddEventListener", "click", (e) => {
// console.log(e);
// let infoWindow = mapService.createAraeInfowindow(k);
// AMap.invoke("mapOpenInfoWindow", infoWindow, e.target.getPosition());
// });
});
}
else
{
let
marker
=
_this
.
_createMarker
(
lnglat
,
k
);
markers
.
push
(
marker
);
}
}
this
.
drawDone
=
true
;
// if (arr && arr.length < 10) {
...
...
@@ -641,12 +678,23 @@ export default {
this
.
mapMass
=
markers
;
},
_createMarker
(
lngLat
,
dataInfo
)
{
let
marker
=
mapService
.
createCarMarker
(
lngLat
);
AMap
.
invoke
(
"addOverlay"
,
marker
);
AMap
.
invoke
(
"panTo"
,
lngLat
);
AMap
.
invoke
(
"markerAddEventListener"
,
"click"
,
(
e
)
=>
{
let
infoWindow
=
mapService
.
createAraeInfowindow
(
dataInfo
);
AMap
.
invoke
(
"mapOpenInfoWindow"
,
infoWindow
,
e
.
target
.
getPosition
());
});
return
marker
;
},
// 全屏状态下,根据参数初始化页面
initPage
(
query
)
{
console
.
log
(
query
);
this
.
menuId
=
query
.
menuId
;
if
(
query
.
address
)
{
this.$set(this.form, "address", query.address);
this
.
$set
(
this
.
form
,
"address"
,
query
.
address
||
""
);
}
if
(
query
.
sn
)
{
this
.
$set
(
this
.
form
,
"sn"
,
query
.
sn
);
...
...
@@ -668,7 +716,7 @@ export default {
this
.
drawRectangle
(
query
);
this
.
getAreaLocation
();
this.autoComplete.setInputValue(this.form.address);
this
.
autoComplete
.
setInputValue
(
this
.
form
.
address
||
""
);
},
// 绘画矩形
...
...
@@ -787,4 +835,4 @@ export default {
</
script
>
<
style
lang=
"scss"
scoped
>
@import
"../../assets/scss/zoneCar.scss"
;
</
style
>
\ No newline at end of file
</
style
>
src/utils/mapBService.js
View file @
debf92b
...
...
@@ -279,7 +279,6 @@ MapService.prototype = {
return
Circle
},
createInfoWindow
(
marker
,
map
,
div
,
isInfoOpen
,
isInfoAutoMove
)
{
console
.
log
(
div
,
'div'
)
var
self
=
this
;
var
infoWindow
=
self
.
map
.
invoke
(
'InfoWindow'
,
div
,{
enableAutoPan
:
!!
isInfoAutoMove
...
...
src/utils/replay.js
View file @
debf92b
...
...
@@ -60,30 +60,45 @@ const replay = {
replay
.
distance
=
replay
.
dis
.
reduce
(
function
(
prev
,
cur
,
index
,
arr
)
{
return
prev
+
cur
;
});
replay
.
distance
=
replay
.
distance
/
1000
//算出轨迹的距离(km)
const
firstItem
=
replay
.
data
[
0
];
replay
.
navg
=
AMap
.
invoke
(
'LuShu'
,
replayData
,
{
defaultContent
:
replay
.
getNavgInfoContent
(
firstItem
),
autoView
:
true
,
// 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整
speed
:
replay
.
getSpeed
(
replay
.
speed
,
replay
.
distance
),
icon
:
AMap
.
invoke
(
'Icon'
,
'https://e-shield-old.glsx.com.cn/images/icon_car.png'
,
AMap
.
invoke
(
'Size'
,
36
,
22
),{
anchor
:
AMap
.
invoke
(
'Size'
,
18
,
11
)
}),
enableRotation
:
true
,
// 是否设置marker随着道路的走向进行旋转
})
AMap
.
invoke
(
'lushuStart'
)
//开始
// AMap.invoke('lushuStop') //停止
// AMap.invoke('lushuPause') //暂停
// AMap.invoke('lushuShowInfoWindow') //打开信息窗口
EventBus
.
$emit
(
'uiMap.replay.initDone'
)
AMap
.
invoke
(
'lushuAddEventListener'
,
'move'
,
(
e
)
=>
{
this
.
idx
=
e
.
target
.
i
;
let
lnglat
=
replayData
[
this
.
idx
]
let
item
=
replay
.
data
[
this
.
idx
]
AMap
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
//设置信息窗口文案
EventBus
.
$emit
(
'uiMap.replay.currAddress'
,
''
);
if
(
this
.
idx
>=
replay
.
data
.
length
-
3
){
EventBus
.
$emit
(
'uiMap.replay.done'
);
}
});
console
.
log
(
replay
.
distance
,
9999999
)
if
(
replay
.
distance
){
replay
.
distance
=
replay
.
distance
/
1000
//算出轨迹的距离(km)
const
firstItem
=
replay
.
data
[
0
];
replay
.
navg
=
AMap
.
invoke
(
'LuShu'
,
replayData
,
{
defaultContent
:
replay
.
getNavgInfoContent
(
firstItem
),
autoView
:
true
,
// 是否开启自动视野调整,如果开启那么路书在运动过程中会根据视野自动调整
speed
:
replay
.
getSpeed
(
replay
.
speed
,
replay
.
distance
),
icon
:
AMap
.
invoke
(
'Icon'
,
'https://e-shield-old.glsx.com.cn/images/icon_car.png'
,
AMap
.
invoke
(
'Size'
,
36
,
22
),{
anchor
:
AMap
.
invoke
(
'Size'
,
18
,
11
)
}),
enableRotation
:
true
,
// 是否设置marker随着道路的走向进行旋转
})
AMap
.
invoke
(
'lushuStart'
)
//开始
// AMap.invoke('lushuStop') //停止
// AMap.invoke('lushuPause') //暂停
// AMap.invoke('lushuShowInfoWindow') //打开信息窗口
EventBus
.
$emit
(
'uiMap.replay.initDone'
)
AMap
.
invoke
(
'lushuAddEventListener'
,
'move'
,
(
e
)
=>
{
this
.
idx
=
e
.
target
.
i
;
let
lnglat
=
replayData
[
this
.
idx
]
let
item
=
replay
.
data
[
this
.
idx
]
AMap
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
//设置信息窗口文案
EventBus
.
$emit
(
'uiMap.replay.currAddress'
,
''
);
if
(
this
.
idx
>=
replay
.
data
.
length
-
3
){
EventBus
.
$emit
(
'uiMap.replay.done'
);
}
});
}
else
{
//距离为0时,单独处理
const
item
=
replay
.
data
[
replay
.
data
.
length
-
1
];
AMap
.
invoke
(
'clearOverlays'
);
replay
.
Marker
=
mapService
.
createCarMarker
(
p2
,
AMap
);
let
infowindow
=
mapService
.
createInfoWindow
(
replay
.
Marker
,
AMap
,
replay
.
getNavgInfoContent
(
item
))
AMap
.
invoke
(
'addOverlay'
,
replay
.
Marker
)
AMap
.
invoke
(
"mapOpenInfoWindow"
,
infowindow
,
p2
)
EventBus
.
$emit
(
'uiMap.replay.initDone'
)
EventBus
.
$emit
(
'uiMap.replay.done'
);
}
},
getDistance
(
p1
,
p2
)
{
...
...
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