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 0f232a82
authored
Apr 28, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复监控列表树
1 parent
63710f4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
68 deletions
src/pages/monitor/monitor.vue
src/utils/mapgeo.js
src/pages/monitor/monitor.vue
View file @
0f232a8
...
...
@@ -381,6 +381,7 @@ export default {
},
checkFlow
(
data
,
node
)
{
let
_this
=
this
;
let
action
=
MONITOR_SERVICE
.
getVehicleTreeUserIds
;
let
params
=
{
oId
:
data
.
id
};
if
(
data
.
origin
.
type
===
"u"
)
{
...
...
@@ -388,14 +389,19 @@ export default {
params
=
{
uId
:
data
.
id
};
}
console
.
log
(
'勾选树:'
,
data
)
console
.
log
(
"勾选树:"
,
data
);
params
.
termType
=
this
.
searchType
;
params
.
term
=
this
.
searchText
;
if
(
data
.
origin
.
type
==
"u"
)
{
params
.
pageSize
=
_this
.
pageSize
;
params
.
pageNumber
=
_this
.
pageSizeList
[
data
.
id
]
||
1
;
}
this
.
treeLoading
=
true
;
action
(
params
).
then
((
res
)
=>
{
this
.
treeLoading
=
false
;
let
list
=
res
.
data
||
[];
let
cList
=
this
.
monitorList
.
itemArr
||
[];
// 最多创建100个设备监听
...
...
@@ -438,7 +444,7 @@ export default {
if
(
data
.
children
!==
undefined
)
{
data
.
children
.
forEach
((
item
,
i
)
=>
{
//this.$refs.tree.setChecked(item, false, true);
this
.
checkedKeys
.
push
(
item
.
id
)
this
.
checkedKeys
.
push
(
item
.
id
)
;
});
}
}
...
...
@@ -746,12 +752,12 @@ export default {
let
_this
=
this
;
arr
.
forEach
((
item
)
=>
{
if
(
isDevice
)
{
console
.
log
(
item
.
id
)
let
keys
=
_this
.
$refs
.
tree
.
getCheckedKeys
()
console
.
log
(
'keys'
,
keys
)
console
.
log
(
item
.
id
)
;
let
keys
=
_this
.
$refs
.
tree
.
getCheckedKeys
()
;
console
.
log
(
"keys"
,
keys
);
//_this.$refs.tree.setCheckedKeys(keys);
_this
.
checkedKeys
.
push
(
item
.
id
);
console
.
log
(
'勾选key:'
,
_this
.
checkedKeys
)
console
.
log
(
"勾选key:"
,
_this
.
checkedKeys
);
this
.
addMonitor
({
sn
:
item
.
label
,
name
:
item
.
label1
,
...
...
@@ -762,9 +768,9 @@ export default {
sourceType
:
item
.
source
,
});
}
else
{
console
.
log
(
'展开节点'
,
item
)
console
.
log
(
"展开节点"
,
item
);
this
.
expandedKeys
.
push
(
item
.
id
);
console
.
log
(
this
.
expandedKeys
)
console
.
log
(
this
.
expandedKeys
)
;
}
if
(
item
.
children
&&
item
.
children
.
length
)
{
this
.
expandTreeItems
(
...
...
@@ -1010,8 +1016,11 @@ export default {
this
.
monitorList
.
itemArr
.
indexOf
(
item
.
sn
)
>
-
1
&&
item
.
eLocateType
);
if
(
this
.
monitorList
.
itemArr
&&
this
.
monitorList
.
itemArr
.
length
>
0
){
this
.
autoOpenLastInfoWindow
=
true
if
(
this
.
monitorList
.
itemArr
&&
this
.
monitorList
.
itemArr
.
length
>
0
)
{
this
.
autoOpenLastInfoWindow
=
true
;
EventBus
.
$emit
(
"uiMap.monitor.draw"
,
drawData
,
...
...
@@ -1214,7 +1223,7 @@ export default {
this
.
getTreeData
();
},
mounted
(){
mounted
()
{
let
_this
=
this
;
AMapLoader
.
load
({
key
:
CONSTANT
.
MAP_KEY
,
...
...
@@ -1222,7 +1231,7 @@ export default {
plugins
:
CONSTANT
.
MAP_PLUGINS
,
}).
then
((
AMap
)
=>
{
window
.
AMap
=
AMap
;
_this
.
initMap
();
_this
.
initMap
();
});
},
beforeDestroy
()
{
...
...
src/utils/mapgeo.js
View file @
0f232a8
const
MAPGEO
=
{
geocoder
:
null
,
getGeocoder
:
function
()
{
return
new
Promise
((
resolve
)
=>
{
AMap
.
service
(
'AMap.Geocoder'
,
function
()
{
//回调函数
var
geocoder
=
new
AMap
.
Geocoder
({
batch
:
true
});
MAPGEO
.
geocoder
=
geocoder
;
resolve
(
geocoder
);
});
})
getGeocoder
:
function
()
{
return
new
Promise
((
resolve
)
=>
{
AMap
.
service
(
'AMap.Geocoder'
,
function
()
{
//回调函数
var
geocoder
=
new
AMap
.
Geocoder
({
batch
:
true
});
MAPGEO
.
geocoder
=
geocoder
;
resolve
(
geocoder
);
});
})
},
transferAddressByGroup
(
obj
,
cb
){
if
(
!
this
.
geocoder
)
{
this
.
getGeocoder
().
then
(()
=>
{
transferAddressByGroup
(
obj
,
cb
)
{
if
(
!
this
.
geocoder
)
{
this
.
getGeocoder
().
then
(()
=>
{
this
.
transfer
(
obj
,
cb
)
})
}
else
{
}
else
{
this
.
transfer
(
obj
,
cb
)
}
},
transfer
(
obj
,
cb
){
const
data
=
obj
.
data
;
obj
.
len
=
data
.
length
;
obj
.
times
=
obj
.
len
>
20
?
Math
.
ceil
(
obj
.
len
/
20
):
1
;
obj
.
totalNum
=
0
;
transfer
(
obj
,
cb
)
{
const
data
=
obj
.
data
;
obj
.
len
=
data
.
length
;
obj
.
times
=
obj
.
len
>
20
?
Math
.
ceil
(
obj
.
len
/
20
)
:
1
;
obj
.
totalNum
=
0
;
obj
.
realNum
=
0
;
//为了剔除脏数据,脏数据导致解析不回调
for
(
let
i
=
0
;
i
<
obj
.
times
;
i
++
)
{
let
lnglatArr
=
[];
let
initIdx
=
i
*
20
;
let
maxIdx
=
i
===
obj
.
times
-
1
?
obj
.
len
:(
i
+
1
)
*
20
;
for
(
let
idx
=
initIdx
;
idx
<
maxIdx
;
idx
++
)
{
for
(
let
i
=
0
;
i
<
obj
.
times
;
i
++
)
{
let
lnglatArr
=
[];
let
initIdx
=
i
*
20
;
let
maxIdx
=
i
===
obj
.
times
-
1
?
obj
.
len
:
(
i
+
1
)
*
20
;
for
(
let
idx
=
initIdx
;
idx
<
maxIdx
;
idx
++
)
{
// 防止出现gps点:.00000的错误
if
(
Number
(
data
[
idx
].
elng
)
>
0
&&
Number
(
data
[
idx
].
elat
)
>
0
)
{
if
(
Number
(
data
[
idx
].
elng
)
>
0
&&
Number
(
data
[
idx
].
elat
)
>
0
)
{
lnglatArr
.
push
([
data
[
idx
].
elng
,
data
[
idx
].
elat
])
obj
.
realNum
++
;
}
}
(
function
(
initIdx
){
geocoderGetAdr
(
lnglatArr
,
initIdx
)
})(
initIdx
)
}
}
(
function
(
initIdx
)
{
geocoderGetAdr
(
lnglatArr
,
initIdx
)
})(
initIdx
)
}
function
geocoderGetAdr
(
arr
,
initIdx
)
{
if
(
!
arr
||
arr
.
length
<=
0
)
{
return
false
;
}
const
timeoutId
=
window
.
setTimeout
(()
=>
{
function
geocoderGetAdr
(
arr
,
initIdx
){
const
timeoutId
=
window
.
setTimeout
(()
=>
{
MAPGEO
.
geocoder
.
getAddress
(
arr
,
function
(
status
,
result
)
{
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
//获取地址成功
result
.
regeocodes
.
forEach
((
item
,
idx
)
=>
{
data
[
initIdx
+
idx
].
transferAddress
=
item
.
formattedAddress
;
obj
.
totalNum
++
;
});
if
(
obj
.
totalNum
===
obj
.
realNum
){
cb
&&
cb
(
data
)
//ifPlay && obj.init(data)
//EventBus.$emit('uiMap.replay.transferAdrDone');
}
}
else
{
geocoderGetAdr
(
arr
,
initIdx
)
}
});
});
if
(
!
obj
.
timeoutIds
){
obj
.
timeoutIds
=
[]
}
obj
.
timeoutIds
.
push
(
timeoutId
)
}
MAPGEO
.
geocoder
.
getAddress
(
arr
,
function
(
status
,
result
)
{
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
//获取地址成功
result
.
regeocodes
.
forEach
((
item
,
idx
)
=>
{
data
[
initIdx
+
idx
].
transferAddress
=
item
.
formattedAddress
;
obj
.
totalNum
++
;
});
if
(
obj
.
totalNum
===
obj
.
realNum
)
{
cb
&&
cb
(
data
)
//ifPlay && obj.init(data)
//EventBus.$emit('uiMap.replay.transferAdrDone');
}
}
else
{
geocoderGetAdr
(
arr
,
initIdx
)
}
});
});
if
(
!
obj
.
timeoutIds
)
{
obj
.
timeoutIds
=
[]
}
obj
.
timeoutIds
.
push
(
timeoutId
)
}
}
}
export
default
MAPGEO
\ No newline at end of file
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