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 1bb82ffc
authored
Apr 28, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复勾选问题
1 parent
0d8c37a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
144 additions
and
157 deletions
src/pages/monitor/monitor.vue
src/utils/mapService.js
src/utils/mapgeo.js
src/utils/monitor.js
src/pages/monitor/monitor.vue
View file @
1bb82ff
...
...
@@ -316,21 +316,19 @@ export default {
},
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
//console.log(data, checked, indeterminate);
console
.
log
(
checked
);
if
(
checked
)
{
//console.log(this.$refs.tree.getNode(data))
let
node
=
this
.
$refs
.
tree
.
getNode
(
data
);
//
let node = this.$refs.tree.getNode(data);
//this.getAllChild(node)
//this.$refs.tree.store.defaultExpandAll = true
//this.$refs.tree.setCheckedKeys(['u8121'])
}
this
.
isTreeChecked
=
checked
;
this
.
expandedKeys
=
[];
//
this.expandedKeys = [];
},
// 勾选树
handleCheck
(
data
,
node
)
{
console
.
log
(
"node"
,
data
);
let
list
=
this
.
monitorList
.
itemArr
;
// 最多同时监控100台数据
...
...
@@ -390,12 +388,14 @@ export default {
params
=
{
uId
:
data
.
id
};
}
console
.
log
(
'勾选树:'
,
data
)
params
.
termType
=
this
.
searchType
;
params
.
term
=
this
.
searchText
;
this
.
treeLoading
=
true
;
action
(
params
).
then
((
res
)
=>
{
this
.
treeLoading
=
false
;
let
list
=
res
.
data
||
[];
let
cList
=
this
.
monitorList
.
itemArr
||
[];
// 最多创建100个设备监听
...
...
@@ -437,7 +437,8 @@ export default {
if
(
data
.
children
!==
undefined
)
{
data
.
children
.
forEach
((
item
,
i
)
=>
{
this
.
$refs
.
tree
.
setChecked
(
item
,
false
,
true
);
//this.$refs.tree.setChecked(item, false, true);
this
.
checkedKeys
.
push
(
item
.
id
)
});
}
}
...
...
@@ -750,7 +751,7 @@ export default {
console
.
log
(
'keys'
,
keys
)
//_this.$refs.tree.setCheckedKeys(keys);
_this
.
checkedKeys
.
push
(
item
.
id
);
console
.
log
(
_this
.
checkedKeys
)
console
.
log
(
'勾选key:'
,
_this
.
checkedKeys
)
this
.
addMonitor
({
sn
:
item
.
label
,
name
:
item
.
label1
,
...
...
@@ -761,7 +762,9 @@ export default {
sourceType
:
item
.
source
,
});
}
else
{
console
.
log
(
'展开节点'
,
item
)
this
.
expandedKeys
.
push
(
item
.
id
);
console
.
log
(
this
.
expandedKeys
)
}
if
(
item
.
children
&&
item
.
children
.
length
)
{
this
.
expandTreeItems
(
...
...
@@ -873,7 +876,6 @@ export default {
obj
.
count
++
;
obj
.
itemArr
.
unshift
(
item
.
sn
);
}
console
.
log
(
obj
.
itemArr
);
this
.
getPositionData
();
},
// standNoMonitor(item){
...
...
@@ -914,14 +916,12 @@ export default {
});
let
arr
=
this
.
monitorList
.
itemArr
||
[];
console
.
log
(
arr
.
length
);
filterList
.
forEach
((
item
)
=>
{
item
.
eLocateType
=
"gpsLocation"
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
.
count
++
;
arr
.
unshift
(
item
.
sn
);
});
console
.
log
(
arr
);
this
.
$set
(
this
.
monitorList
,
"itemArr"
,
arr
);
this
.
getPositionData
();
}
...
...
@@ -934,24 +934,19 @@ export default {
if
(
obj
[
item
.
sn
])
{
delete
obj
[
item
.
sn
];
}
console
.
log
(
list
);
this
.
monitorList
.
itemArr
=
list
.
filter
((
k
)
=>
k
!=
item
.
sn
);
//this.monitorList.itemArr.splice(this.monitorList.itemArr.indexOf(item.sn||item), 1)
this
.
monitorList
=
Object
.
assign
({},
obj
);
if
(
this
.
monitorList
.
count
>
0
)
{
this
.
monitorList
.
count
--
;
}
console
.
log
(
item
);
EventBus
.
$emit
(
"uiMap.monitor.destroy"
,
`
${
item
.
sn
||
item
}
:
${
item
.
source
||
item
}
`
);
//console.log(this.monitorList);
if
(
ifUpdateTreeKeys
)
{
console
.
log
(
item
);
let
checkedKeys
=
this
.
$refs
.
tree
.
getCheckedKeys
();
let
arr
=
checkedKeys
.
filter
((
id
)
=>
id
!==
item
.
id
);
//console.log(arr);
this
.
$refs
.
tree
.
setCheckedKeys
(
arr
);
}
},
...
...
@@ -959,12 +954,10 @@ export default {
// 批量删除 监控列表
removeMonitorByGroup
(
arr
)
{
let
_this
=
this
;
console
.
log
(
arr
);
let
o
=
this
.
monitorList
;
o
.
itemArr
=
[];
arr
.
forEach
((
item
)
=>
{
let
n
=
o
[
item
.
sn
||
item
];
console
.
log
(
n
);
if
(
n
)
{
_this
.
removeMonitor
(
n
);
}
...
...
@@ -981,7 +974,6 @@ export default {
/* let _this = this;
arr = arr.filter((item)=>this.monitorList[item.sn]); */
let
snStr
=
this
.
monitorList
.
itemArr
.
join
(
","
);
//arr.map((item)=>item.sn).join(',');
console
.
log
(
snStr
)
if
(
!
snStr
)
return
;
if
(
this
.
resetRefreshCount
||
this
.
remainSearchSnStr
!=
snStr
)
{
this
.
refreshCount
=
1
;
...
...
@@ -1038,7 +1030,6 @@ export default {
},
filterGpsBase
(
item
)
{
//item.bsLocation = {}
console
.
log
(
item
);
let
gpsLocation
=
item
.
gpsLocation
;
let
bsLocation
=
item
.
bsLocation
;
/* 如果基站,gps其中一个没数据,自动切换到另一个,如果都没有eLocateType为null */
...
...
@@ -1136,8 +1127,6 @@ export default {
// 展示更多
showMore
(
node
,
data
)
{
let
o
=
this
.
treeDataList
[
"u"
+
data
.
parentId
];
console
.
log
(
node
);
console
.
log
(
o
);
// 不存在
if
(
!
o
||
o
.
length
<=
0
)
{
return
false
;
...
...
@@ -1154,8 +1143,6 @@ export default {
// 加载下一页
loadNext
(
node
,
data
)
{
console
.
log
(
node
);
console
.
log
(
data
);
let
_this
=
this
;
let
id
=
"u"
+
node
.
data
.
parentId
;
let
pageNumber
=
this
.
pageSizeList
[
id
];
...
...
src/utils/mapService.js
View file @
1bb82ff
...
...
@@ -256,8 +256,7 @@ MapService.prototype = {
EventBus
.
$emit
(
'uiMap.copySuccess'
);
});
clipboard
.
on
(
'error'
,
function
(
e
)
{
console
.
error
(
'Action:'
,
e
.
action
);
console
.
error
(
'Trigger:'
,
e
.
trigger
);
});
if
(
isInfoOpen
)
{
...
...
@@ -276,7 +275,6 @@ MapService.prototype = {
// 车辆监控-查看位置点
bindMonitorInfoWindow
:
function
(
marker
,
map
,
info
,
isInfoOpen
,
isInfoAutoMove
)
{
console
.
log
(
info
)
var
self
=
this
;
var
infoDiv
=
document
.
createElement
(
'div'
);
infoDiv
.
innerHTML
=
self
.
createMonitorInfo
(
info
);
...
...
@@ -316,7 +314,6 @@ MapService.prototype = {
}
baseBtn
&&
(
baseBtn
.
onclick
=
function
(
e
)
{
console
.
log
(
info
)
if
(
info
.
eLocateType
===
'bsLocation'
)
return
;
info
.
eLocateType
=
'bsLocation'
eLocation
=
info
[
info
.
eLocateType
];
...
...
@@ -434,7 +431,6 @@ MapService.prototype = {
}
}
console
.
log
(
historyBtn
)
const
snSourceType
=
`
${
info
.
sn
}
:
${
info
.
isSource
}
`
/* EventBus.$on(`uiMap.monitor.changeStatus.${snSourceType}`, (status)=>{
...
...
@@ -552,7 +548,6 @@ MapService.prototype = {
let
queryCode
=
`sn=
${
info
.
sn
}
&name=
${
encodeURI
(
info
.
name
)}
&standno=
${
info
.
standNo
}
`
;
var
_html
=
`<h3 class="map-infowindow-title">
${
info
.
name
}
/
${
info
.
standNo
}
</h3>`
;
_html
+=
`<div class="map-infowindow-ct map_info_window">`
;
console
.
log
(
zhongliType
);
if
(
zhongliType
==
'yes'
)
{
_html
+=
`<div>`
;
if
(
info
.
shopName
)
{
...
...
@@ -574,7 +569,6 @@ MapService.prototype = {
let
list
=
vue
.
prototype
.
$parentCommon
.
getAuthData
();
let
o
=
list
.
find
(
k
=>
k
.
origin
.
permissionTag
==
'oEshield_monitor_store_name'
);
let
n
=
list
.
find
(
k
=>
k
.
origin
.
permissionTag
==
'oEshield_monitor_plate_number'
);
console
.
log
(
list
)
if
(
o
&&
info
.
shopName
)
{
_html
+=
`<p><i class="icon_info_shop"></i> 店面名称: <span class="des">
${
info
.
shopName
||
'--'
}
</span></p>`
;
}
...
...
@@ -822,7 +816,6 @@ MapService.prototype = {
content
:
div
,
autoMove
:
!!
isInfoAutoMove
,
})
console
.
log
(
infoWindow
)
marker
.
infoWindow
=
infoWindow
if
(
isInfoOpen
)
{
infoWindow
.
open
(
map
,
marker
.
getPosition
())
...
...
src/utils/mapgeo.js
View file @
1bb82ff
...
...
@@ -12,7 +12,6 @@ const MAPGEO = {
})
},
transferAddressByGroup
(
obj
,
cb
){
console
.
log
(
this
.
geocoder
)
if
(
!
this
.
geocoder
){
this
.
getGeocoder
().
then
(()
=>
{
this
.
transfer
(
obj
,
cb
)
...
...
@@ -22,7 +21,6 @@ const MAPGEO = {
}
},
transfer
(
obj
,
cb
){
console
.
log
(
obj
.
data
)
const
data
=
obj
.
data
;
obj
.
len
=
data
.
length
;
obj
.
times
=
obj
.
len
>
20
?
Math
.
ceil
(
obj
.
len
/
20
):
1
;
...
...
@@ -49,13 +47,11 @@ const MAPGEO = {
const
timeoutId
=
window
.
setTimeout
(()
=>
{
MAPGEO
.
geocoder
.
getAddress
(
arr
,
function
(
status
,
result
)
{
console
.
log
(
result
)
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
//获取地址成功
result
.
regeocodes
.
forEach
((
item
,
idx
)
=>
{
data
[
initIdx
+
idx
].
transferAddress
=
item
.
formattedAddress
;
obj
.
totalNum
++
;
});
console
.
log
(
obj
.
totalNum
+
'----'
+
obj
.
realNum
)
if
(
obj
.
totalNum
===
obj
.
realNum
){
cb
&&
cb
(
data
)
//ifPlay && obj.init(data)
...
...
src/utils/monitor.js
View file @
1bb82ff
...
...
@@ -2,8 +2,8 @@ import EventBus from '../event-bus'
import
mapService
from
'./mapService.js'
import
MAPGEO
from
'./mapgeo'
import
{
Message
}
from
"element-ui"
;
import
{
services
}
from
'../api'
const
MONITOR_SERVICE
=
services
.
monitor
;
import
{
services
}
from
'../api'
const
MONITOR_SERVICE
=
services
.
monitor
;
//车辆监控
const
monitor
=
{
...
...
@@ -15,26 +15,35 @@ const monitor = {
isCompare
:
false
,
compareLine
:
null
,
compareText
:
null
,
bindEvent
(){
EventBus
.
$on
(
'uiMap.monitor.draw'
,
(
data
,
autoOpenLastInfoWindow
)
=>
{
bindEvent
()
{
EventBus
.
$on
(
'uiMap.monitor.draw'
,
(
data
,
autoOpenLastInfoWindow
)
=>
{
this
.
draw
(
data
,
autoOpenLastInfoWindow
);
});
EventBus
.
$on
(
'uiMap.monitor.destroy'
,
(
snSourceType
)
=>
{
EventBus
.
$on
(
'uiMap.monitor.destroy'
,
(
snSourceType
)
=>
{
const
MAP
=
mapService
.
map
;
if
(
snSourceType
){
MAP
.
remove
(
this
.
markers
[
snSourceType
])
MAP
.
remove
(
this
.
infowins
[
snSourceType
])
if
(
snSourceType
)
{
if
(
this
.
markers
[
snSourceType
])
{
MAP
.
remove
(
this
.
markers
[
snSourceType
])
}
if
(
this
.
infowins
[
snSourceType
])
{
MAP
.
remove
(
this
.
infowins
[
snSourceType
])
}
delete
this
.
markers
[
snSourceType
];
delete
this
.
infowins
[
snSourceType
];
EventBus
.
$off
(
`uiMap.monitor.changeStatus.
${
snSourceType
}
`
)
}
else
{
for
(
let
snSourceType
in
this
.
markers
){
MAP
.
remove
(
this
.
markers
[
snSourceType
])
}
else
{
for
(
let
snSourceType
in
this
.
markers
)
{
if
(
this
.
markers
[
snSourceType
])
{
MAP
.
remove
(
this
.
markers
[
snSourceType
])
}
}
for
(
let
snSourceType
in
this
.
infowins
){
MAP
.
remove
(
this
.
infowins
[
snSourceType
])
EventBus
.
$off
(
`uiMap.monitor.changeStatus.
${
snSourceType
}
`
)
for
(
let
snSourceType
in
this
.
infowins
)
{
if
(
this
.
markers
[
snSourceType
])
{
MAP
.
remove
(
this
.
infowins
[
snSourceType
])
EventBus
.
$off
(
`uiMap.monitor.changeStatus.
${
snSourceType
}
`
)
}
}
this
.
markers
=
{};
this
.
infowins
=
{};
...
...
@@ -44,49 +53,49 @@ const monitor = {
}
});
EventBus
.
$on
(
'uiMap.monitor.compareDestroy'
,
()
=>
{
EventBus
.
$on
(
'uiMap.monitor.compareDestroy'
,
()
=>
{
this
.
compareDestroy
()
})
EventBus
.
$on
(
'uiMap.monitor.changeSourceType'
,
(
sourceType
)
=>
{
EventBus
.
$on
(
'uiMap.monitor.changeSourceType'
,
(
sourceType
)
=>
{
const
MAP
=
mapService
.
map
;
let
rourceReg
=
/^
\d
+
\:(\d)
$/
;
if
(
sourceType
===
''
)
{
for
(
let
snSourceType
in
this
.
markers
)
{
if
(
sourceType
===
''
)
{
for
(
let
snSourceType
in
this
.
markers
)
{
this
.
markers
[
snSourceType
].
show
();
}
}
else
{
}
else
{
for
(
let
snSourceType
in
this
.
markers
)
{
for
(
let
snSourceType
in
this
.
markers
)
{
let
execResult
=
rourceReg
.
exec
(
snSourceType
);
if
(
execResult
)
{
if
(
execResult
[
1
]
===
sourceType
)
{
if
(
execResult
)
{
if
(
execResult
[
1
]
===
sourceType
)
{
this
.
markers
[
snSourceType
].
show
();
}
else
{
}
else
{
this
.
markers
[
snSourceType
].
hide
();
}
}
}
for
(
let
snSourceType
in
this
.
infowins
)
{
for
(
let
snSourceType
in
this
.
infowins
)
{
this
.
infowins
[
snSourceType
].
close
();
}
}
});
EventBus
.
$on
(
'uiMap.monitor.openInfoWindow'
,
(
snSourceType
)
=>
{
if
(
this
.
markers
[
snSourceType
])
{
EventBus
.
$on
(
'uiMap.monitor.openInfoWindow'
,
(
snSourceType
)
=>
{
if
(
this
.
markers
[
snSourceType
])
{
const
MAP
=
mapService
.
map
;
const
lnglat
=
this
.
markers
[
snSourceType
].
getPosition
();
this
.
infowins
[
snSourceType
].
open
(
MAP
,
lnglat
);
MAP
.
setZoomAndCenter
(
MAP
.
getZoom
(),
lnglat
);
}
});
EventBus
.
$on
(
'uiMap.monitor.changeELocate'
,
(
item
)
=>
{
EventBus
.
$on
(
'uiMap.monitor.changeELocate'
,
(
item
)
=>
{
const
snSourceType
=
`
${
item
.
sn
}
:
${
item
.
isSource
}
`
let
eLocation
=
item
[
item
.
eLocateType
];
if
(
this
.
markers
[
snSourceType
])
{
if
(
this
.
markers
[
snSourceType
])
{
this
.
markers
[
snSourceType
].
setPosition
(
mapService
.
getLngLat
(
parseFloat
(
eLocation
.
elng
),
parseFloat
(
eLocation
.
elat
)));
this
.
infowins
[
snSourceType
].
setPosition
(
mapService
.
getLngLat
(
parseFloat
(
eLocation
.
elng
),
parseFloat
(
eLocation
.
elat
)));
}
...
...
@@ -94,29 +103,29 @@ const monitor = {
this
.
isCompare
&&
this
.
compareLocation
()
})
EventBus
.
$on
(
'uiMap.monitor.compareLocation'
,
(
data
)
=>
{
EventBus
.
$on
(
'uiMap.monitor.compareLocation'
,
(
data
)
=>
{
this
.
compareDestroy
()
this
.
isCompare
=
true
});
EventBus
.
$on
(
'uiMap.monitor.wifiLocate'
,
(
data
)
=>
{
EventBus
.
$emit
(
'uiMap.monitor.terminate'
);
const
{
info
,
infoDiv
,
gpsBtn
,
baseBtn
,
wifiBtn
}
=
data
const
{
info
,
infoDiv
,
gpsBtn
,
baseBtn
,
wifiBtn
}
=
data
MONITOR_SERVICE
.
getWifiLocationBySn
({
apType
:
5
,
sn
:
info
.
sn
}).
then
((
res
)
=>
{
if
(
res
.
returnCode
==
0
)
{
}).
then
((
res
)
=>
{
if
(
res
.
returnCode
==
0
)
{
const
data
=
res
.
data
if
(
data
)
{
const
transferObj
=
{
elat
:
data
.
wifiLat
,
elng
:
data
.
wifiLng
}
MAPGEO
.
transferAddressByGroup
({
data
:
[
transferObj
]},
()
=>
{
if
(
data
)
{
const
transferObj
=
{
elat
:
data
.
wifiLat
,
elng
:
data
.
wifiLng
}
MAPGEO
.
transferAddressByGroup
({
data
:
[
transferObj
]
},
()
=>
{
infoDiv
.
querySelector
(
'[data-transferAddress]'
).
textContent
=
transferObj
.
transferAddress
;
infoDiv
.
querySelector
(
'[data-time]'
).
textContent
=
data
.
lastReportTime
;
})
const
snSourceType
=
`
${
info
.
sn
}
:
${
info
.
isSource
}
`
if
(
this
.
markers
[
snSourceType
])
{
if
(
this
.
markers
[
snSourceType
])
{
this
.
markers
[
snSourceType
].
setPosition
(
mapService
.
getLngLat
(
parseFloat
(
transferObj
.
elng
),
parseFloat
(
transferObj
.
elat
)));
this
.
infowins
[
snSourceType
].
setPosition
(
mapService
.
getLngLat
(
parseFloat
(
transferObj
.
elng
),
parseFloat
(
transferObj
.
elat
)));
}
...
...
@@ -124,8 +133,8 @@ const monitor = {
baseBtn
&&
baseBtn
.
classList
.
remove
(
'el-button--primary'
);
wifiBtn
&&
wifiBtn
.
classList
.
add
(
'el-button--primary'
);
info
.
eLocateType
=
'wifi'
}
else
{
}
else
{
Message
({
type
:
'info'
,
message
:
'暂无wifi数据'
...
...
@@ -136,102 +145,104 @@ const monitor = {
})
}),
// 激活位置点
EventBus
.
$on
(
"uiMap.monitor.drawMaker"
,
this
.
drawMaker
);
// 激活位置点
EventBus
.
$on
(
"uiMap.monitor.drawMaker"
,
this
.
drawMaker
);
},
draw
(
data
,
autoOpenLastInfoWindow
){
draw
(
data
,
autoOpenLastInfoWindow
)
{
const
MAP
=
mapService
.
map
;
this
.
data
=
data
;
const
transferObj
=
[]
data
.
forEach
((
item
)
=>
{
if
(
item
.
gpsLocation
&&
item
.
gpsLocation
.
elat
&&
item
.
gpsLocation
.
elng
)
{
const
transferObj
=
[]
data
.
forEach
((
item
)
=>
{
if
(
item
.
gpsLocation
&&
item
.
gpsLocation
.
elat
&&
item
.
gpsLocation
.
elng
)
{
transferObj
.
push
(
item
.
gpsLocation
)
}
if
(
item
.
bsLocation
&&
item
.
bsLocation
.
elat
&&
item
.
bsLocation
.
elng
)
{
if
(
item
.
bsLocation
&&
item
.
bsLocation
.
elat
&&
item
.
bsLocation
.
elng
)
{
transferObj
.
push
(
item
.
bsLocation
)
}
})
MAPGEO
.
transferAddressByGroup
({
data
:
transferObj
},
()
=>
{
this
.
data
.
forEach
((
item
,
idx
)
=>
{
MAPGEO
.
transferAddressByGroup
({
data
:
transferObj
},
()
=>
{
this
.
data
.
forEach
((
item
,
idx
)
=>
{
let
eLocation
=
item
[
item
.
eLocateType
];
if
(
!
eLocation
.
elng
&&
!
eLocation
.
elat
)
return
;
if
(
!
eLocation
.
elng
&&
!
eLocation
.
elat
)
return
;
let
isInfoOpen
=
false
;
let
tag
=
`
${
item
.
sn
}
:
${
item
.
isSource
}
`
;
if
(
this
.
infowins
[
tag
]
&&
this
.
infowins
[
tag
].
getIsOpen
())
{
if
(
this
.
infowins
[
tag
]
&&
this
.
infowins
[
tag
].
getIsOpen
())
{
isInfoOpen
=
true
;
}
let
infoWindow
;
let
snSourceType
=
`
${
item
.
sn
}
:
${
item
.
isSource
}
`
if
(
this
.
markers
[
tag
])
{
if
(
this
.
markers
[
tag
])
{
this
.
markers
[
tag
].
setPosition
(
mapService
.
getLngLat
(
parseFloat
(
eLocation
.
elng
),
parseFloat
(
eLocation
.
elat
)));
//this.infowins[tag].setPosition(mapService.getLngLat(parseFloat(eLocation.elng), parseFloat(eLocation.elat)));
//infoWindow = mapService.bindMonitorInfoWindow(this.markers[tag], MAP, item, isInfoOpen);
this
.
infowins
[
tag
]
=
mapService
.
bindMonitorInfoWindow
(
this
.
markers
[
tag
],
MAP
,
item
,
isInfoOpen
,
this
.
isCompare
?
true
:
false
);
this
.
infowins
[
tag
]
=
mapService
.
bindMonitorInfoWindow
(
this
.
markers
[
tag
],
MAP
,
item
,
isInfoOpen
,
this
.
isCompare
?
true
:
false
);
EventBus
.
$emit
(
`uiMap.monitor.changeStatus.
${
snSourceType
}
`
)
}
else
{
}
else
{
this
.
infowins
[
tag
]
&&
MAP
.
remove
(
this
.
infowins
[
tag
]);
let
marker
=
mapService
.
createCarMarker
([
parseFloat
(
eLocation
.
elng
),
parseFloat
(
eLocation
.
elat
)],
MAP
);
infoWindow
=
mapService
.
bindMonitorInfoWindow
(
marker
,
MAP
,
item
,
isInfoOpen
,
this
.
isCompare
?
true
:
false
);
infoWindow
=
mapService
.
bindMonitorInfoWindow
(
marker
,
MAP
,
item
,
isInfoOpen
,
this
.
isCompare
?
true
:
false
);
this
.
markers
[
tag
]
=
marker
;
this
.
infowins
[
tag
]
=
infoWindow
;
}
if
(
item
.
alarmModelList
&&
item
.
alarmModelList
.
length
)
{
if
(
item
.
alarmModelList
&&
item
.
alarmModelList
.
length
)
{
mapService
.
setAlarmIcon
(
this
.
markers
[
tag
])
}
else
{
}
else
{
mapService
.
setDefaultIcon
(
this
.
markers
[
tag
])
}
if
(
autoOpenLastInfoWindow
&&
idx
===
0
)
{
if
(
autoOpenLastInfoWindow
&&
idx
===
0
)
{
EventBus
.
$emit
(
'uiMap.monitor.openInfoWindow'
,
snSourceType
)
}
});
mapService
.
setFitView
(
MAP
);
this
.
allData
=
this
.
allData
.
concat
(
data
);
EventBus
.
$emit
(
'uiMap.monitor.drawDone'
);
if
(
this
.
isCompare
)
{
if
(
this
.
isCompare
)
{
this
.
compareLocation
(
true
)
}
});
},
compareLocation
(
isFitView
){
if
(
this
.
data
.
length
<
2
)
return
compareLocation
(
isFitView
)
{
if
(
this
.
data
.
length
<
2
)
return
const
MAP
=
mapService
.
map
;
if
(
!
this
.
compareLine
)
{
if
(
!
this
.
compareLine
)
{
this
.
compareLine
=
new
AMap
.
Polyline
({
map
:
MAP
,
strokeColor
:
'#80d8ff'
,
isOutline
:
true
,
outlineColor
:
'white'
strokeColor
:
'#80d8ff'
,
isOutline
:
true
,
outlineColor
:
'white'
});
}
if
(
!
this
.
compareText
)
{
if
(
!
this
.
compareText
)
{
this
.
compareText
=
new
AMap
.
Text
({
map
:
MAP
,
text
:
''
,
style
:{
'background-color'
:
'#29b6f6'
,
'border-color'
:
'#e1f5fe'
,
'font-size'
:
'12px'
}
text
:
''
,
style
:
{
'background-color'
:
'#29b6f6'
,
'border-color'
:
'#e1f5fe'
,
'font-size'
:
'12px'
}
});
}
let
m1
=
this
.
markers
[
`
${
this
.
data
[
0
].
sn
}
:
${
this
.
data
[
0
].
isSource
}
`
]
let
m2
=
this
.
markers
[
`
${
this
.
data
[
1
].
sn
}
:
${
this
.
data
[
1
].
isSource
}
`
]
const
p1
=
m1
.
getPosition
()
const
p2
=
m2
.
getPosition
()
var
textPos
=
p1
.
divideBy
(
2
).
add
(
p2
.
divideBy
(
2
));
var
distance
=
Math
.
round
(
p1
.
distance
(
p2
));
var
path
=
[
p1
,
p2
];
var
path
=
[
p1
,
p2
];
this
.
compareLine
.
setPath
(
path
);
this
.
compareText
.
setText
(
`两点相距
${
distance
>
1000
?(
distance
/
1000
+
'k'
):
distance
}
m`
)
this
.
compareText
.
setText
(
`两点相距
${
distance
>
1000
?
(
distance
/
1000
+
'k'
)
:
distance
}
m`
)
this
.
compareText
.
setPosition
(
textPos
)
mapService
.
setFitView
(
MAP
);
...
...
@@ -247,16 +258,16 @@ const monitor = {
//MAP.setFitView(ms.concat(infos))
//isFitView && mapService.setFitView(MAP)
},
intervalDraw
(){
intervalDraw
()
{
},
compareDestroy
:
function
()
{
compareDestroy
:
function
()
{
const
MAP
=
mapService
.
map
;
for
(
let
snSourceType
in
this
.
markers
)
{
for
(
let
snSourceType
in
this
.
markers
)
{
MAP
.
remove
(
this
.
markers
[
snSourceType
])
}
for
(
let
snSourceType
in
this
.
infowins
)
{
for
(
let
snSourceType
in
this
.
infowins
)
{
MAP
.
remove
(
this
.
infowins
[
snSourceType
])
}
this
.
markers
=
{};
...
...
@@ -264,7 +275,7 @@ const monitor = {
this
.
data
=
[];
this
.
allData
=
[];
this
.
isCompare
=
false
this
.
compareLine
&&
MAP
.
remove
(
this
.
compareLine
);
this
.
compareText
&&
MAP
.
remove
(
this
.
compareText
);
...
...
@@ -272,49 +283,49 @@ const monitor = {
this
.
compareText
=
null
;
this
.
clearTimeoutIds
();
},
clearTimeoutIds
(){
this
.
timeoutIds
&&
this
.
timeoutIds
.
forEach
((
item
)
=>
{
clearTimeoutIds
()
{
this
.
timeoutIds
&&
this
.
timeoutIds
.
forEach
((
item
)
=>
{
item
&&
window
.
clearTimeout
(
item
);
});
this
.
timeoutIds
=
[]
},
// 激活位置
drawMaker
(
data
,
autoOpenLastInfoWindow
)
{
let
tag
=
`
${
data
.
sn
}
-
${
data
.
standNo
}
`
;
const
MAP
=
mapService
.
map
const
marker
=
mapService
.
createCarMarker
(
[
parseFloat
(
data
.
lng
||
data
.
bsLng
),
parseFloat
(
data
.
lat
||
data
.
bsLat
)],
MAP
)
const
infoWindow
=
mapService
.
bindActiveLocationInfoWindow
(
marker
,
MAP
,
data
,
true
)
monitor
.
markers
[
tag
]
=
marker
;
monitor
.
infowins
[
tag
]
=
infoWindow
;
// 设置图标
mapService
.
setDefaultIcon
(
marker
,
data
.
vehicleIcon
)
if
(
autoOpenLastInfoWindow
)
{
// /EventBus.$emit("uiMap.monitor.openInfoWindow");
monitor
.
openActiveInfoWindow
(
marker
,
infoWindow
)
}
drawMaker
(
data
,
autoOpenLastInfoWindow
)
{
let
tag
=
`
${
data
.
sn
}
-
${
data
.
standNo
}
`
;
const
MAP
=
mapService
.
map
const
marker
=
mapService
.
createCarMarker
(
[
parseFloat
(
data
.
lng
||
data
.
bsLng
),
parseFloat
(
data
.
lat
||
data
.
bsLat
)],
MAP
)
const
infoWindow
=
mapService
.
bindActiveLocationInfoWindow
(
marker
,
MAP
,
data
,
true
)
monitor
.
markers
[
tag
]
=
marker
;
monitor
.
infowins
[
tag
]
=
infoWindow
;
// 设置图标
mapService
.
setDefaultIcon
(
marker
,
data
.
vehicleIcon
)
if
(
autoOpenLastInfoWindow
)
{
// /EventBus.$emit("uiMap.monitor.openInfoWindow");
monitor
.
openActiveInfoWindow
(
marker
,
infoWindow
)
}
// mapService.setFitView(MAP);
EventBus
.
$emit
(
'uiMap.monitor.drawDone'
)
},
// mapService.setFitView(MAP);
EventBus
.
$emit
(
'uiMap.monitor.drawDone'
)
},
// 打开激活位置点弹框
openActiveInfoWindow
(
makers
,
infoWindow
)
{
const
MAP
=
mapService
.
map
const
lnglat
=
makers
.
getPosition
()
infoWindow
.
open
(
MAP
,
lnglat
)
MAP
.
setZoomAndCenter
(
MAP
.
getZoom
(),
lnglat
)
}
// 打开激活位置点弹框
openActiveInfoWindow
(
makers
,
infoWindow
)
{
const
MAP
=
mapService
.
map
const
lnglat
=
makers
.
getPosition
()
infoWindow
.
open
(
MAP
,
lnglat
)
MAP
.
setZoomAndCenter
(
MAP
.
getZoom
(),
lnglat
)
}
}
export
default
monitor
;
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