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 afa64046
authored
Apr 16, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
v1.6.0版本需求
1 parent
7caef154
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
72 deletions
src/pages/monitor/addFence.vue
src/pages/monitor/fenceMap.vue
src/pages/monitor/monitor.vue
src/utils/mapService.js
src/pages/monitor/addFence.vue
View file @
afa6404
...
...
@@ -50,6 +50,11 @@
</el-radio-group>
<div
class=
"shape_tip"
v-show=
"form.shapeType==3"
>
*注:地图任意位置,单击新增双击结束绘制。
</div>
</el-form-item>
<el-form-item
label=
"围栏半径"
prop=
"radius"
v-if=
"form.shapeType == 1"
>
<el-input
placeholder=
"请输入围栏半径"
v-model
.
trim=
"form.radius"
@
input=
"changeRadius"
>
<template
slot=
"append"
>
米
</
template
>
</el-input>
</el-form-item>
<el-form-item
label=
"省市区"
class=
"is-required"
v-if=
"form.shapeType==4"
prop=
"areaCode"
>
<city-select
v-model=
"form.areaCode"
:checkStrictly=
"true"
@
change=
"changeArea"
></city-select>
</el-form-item>
...
...
@@ -175,6 +180,16 @@ export default {
cb
();
}
};
// 校验半径
let
checkRadius
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
1
&&
!
/^
\d
+$/
.
test
(
this
.
form
.
radius
))
{
console
.
log
(
this
.
form
.
radius
);
cb
(
new
Error
(
"请输入正确的格式,不能输入小数点"
));
}
else
{
cb
();
}
};
return
{
scrollToRef
:
""
,
tableData
:
[],
...
...
@@ -194,6 +209,7 @@ export default {
triggerType
:
1
,
timeType
:
2
,
enableStatus
:
1
,
radius
:
1000
,
},
restainFenceName
:
""
,
rules
:
{
...
...
@@ -215,6 +231,7 @@ export default {
shapeType
:
[
{
required
:
true
,
message
:
"请选择区域类型"
,
trigger
:
"change"
},
],
radius
:
[{
validator
:
checkRadius
,
trigger
:
"blur"
}],
enableStatus
:
[
{
required
:
true
,
message
:
"请选择状态"
,
trigger
:
"change"
},
],
...
...
@@ -616,9 +633,22 @@ export default {
},
// 显示隐藏内容
foldEvent
(){
this
.
showContent
=
!
this
.
showContent
}
foldEvent
()
{
this
.
showContent
=
!
this
.
showContent
;
},
//监听围栏半径改变
changeRadius
(
e
)
{
if
(
!
e
){
return
false
;
}
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
"circle"
,
lng
:
this
.
form
.
lng
,
lat
:
this
.
form
.
lat
,
radius
:
this
.
form
.
radius
,
});
},
},
};
</
script
>
...
...
@@ -680,19 +710,19 @@ form {
flex
:
0
0
100%
;
}
}
.fold_box
{
display
:
flex
;
.fold_box
{
display
:
flex
;
justify-content
:
flex-end
;
border-bottom
:
1px
solid
#f2f2f2
;
.fold_btn{
border-bottom
:
1px
solid
#f2f2f2
;
.fold_btn
{
cursor
:
pointer
;
padding
:
6px
16px
;
border
:
1px
solid
#2196F
3
;
border-bottom
:
0
;
padding
:
6px
16px
;
border
:
1px
solid
#2196f
3
;
border-bottom
:
0
;
border-top-left-radius
:
10px
;
border-top-right-radius
:
10px
;
background
:
#2196F
3
;
color
:
#fff
;
background
:
#2196f
3
;
color
:
#fff
;
}
}
</
style
>
...
...
src/pages/monitor/fenceMap.vue
View file @
afa6404
...
...
@@ -52,8 +52,8 @@ import remoteLoad from "utils/remoteLoad.js";
import
mapService
from
"utils/mapService.js"
;
import
FenceMapControll
from
"./FenceMapControll.vue"
;
const
BUSINESS_SERVICE
=
services
.
business
;
const
mapMenu
=
''
import
{
CONSTANT
}
from
"../../constant"
;
export
default
{
props
:
[
"fenceMapModalVisible"
,
"init"
,
"readonlyStatus"
],
data
()
{
...
...
@@ -192,46 +192,56 @@ export default {
bindContextMenu
()
{
const
self
=
this
;
window
.
mapMenu
=
new
ContextMenu
(
this
.
mapObj
);
//暴露mapMenu onclick要用
console
.
log
(
mapMenu
);
function
ContextMenu
(
map
)
{
self
.
contextMenuPositon
=
null
;
self
.
contextMenu
=
new
AMap
.
ContextMenu
({
var
me
=
this
;
var
content
=
[];
this
.
contextMenuPositon
=
null
;
content
.
push
(
'<div class="context_menu" >'
)
content
.
push
(
'<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>'
)
content
.
push
(
'</div>'
)
this
.
contextMenu
=
new
AMap
.
ContextMenu
({
isCustom
:
true
,
content
:
`<div class="context_menu" >
<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>
</div>`
,
content
:
content
.
join
(
''
),
});
map
.
on
(
"rightclick"
,
(
e
)
=>
{
if
(
self
.
mapObj
.
getAllOverlays
(
"circle"
).
length
)
{
self
.
contextMenu
.
open
(
map
,
e
.
lnglat
);
this
.
contextMenu
.
open
(
map
,
e
.
lnglat
);
self
.
contextMenuPositon
=
e
.
lnglat
;
//右键菜单位置
}
});
}
ContextMenu
.
prototype
.
moveCenter
=
function
addPOI
()
{
ContextMenu
.
prototype
.
moveCenter
=
function
()
{
console
.
log
(
'6666666666'
)
self
.
moveCenter
();
self
.
contextMenu
.
close
();
this
.
contextMenu
.
close
();
};
},
drawFence
()
{
if
(
!
this
.
lng
&&
!
this
.
lat
)
{
this
.
mapLoading
=
true
;
this
.
getCurrentPosition
().
then
((
pos
)
=>
{
console
.
log
(
pos
);
this
.
lng
=
pos
.
lng
;
this
.
lat
=
pos
.
lat
;
this
.
radius
=
1000
;
this
.
drawFenceCircle
(
pos
);
this
.
$emit
(
"onUpdateMapData"
,
{
lng
:
this
.
lng
,
lat
:
this
.
lat
,
radius
:
this
.
radius
,
});
this
.
getCurrentPosition
()
.
then
((
pos
)
=>
{
console
.
log
(
pos
);
this
.
lng
=
pos
.
lng
;
this
.
lat
=
pos
.
lat
;
this
.
radius
=
1000
;
this
.
drawFenceCircle
(
pos
);
this
.
$emit
(
"onUpdateMapData"
,
{
lng
:
this
.
lng
,
lat
:
this
.
lat
,
radius
:
this
.
radius
,
});
this
.
mapLoading
=
false
;
}).
catch
(
error
=>
{
console
.
log
(
error
)
});
this
.
mapLoading
=
false
;
})
.
catch
((
error
)
=>
{
console
.
log
(
error
);
});
}
else
{
this
.
drawFenceCircle
(
mapService
.
getLngLat
(
this
.
lng
,
this
.
lat
));
}
...
...
src/pages/monitor/monitor.vue
View file @
afa6404
...
...
@@ -148,12 +148,12 @@
<div
class=
"filter-dialog-body"
>
<div
class=
"monitor-list"
>
<el-tree
ref=
"tree"
:key=
"treeKey"
:data=
"treeData"
:props=
"treeProps"
lazy
:load=
"loadNode"
show-checkbox
node-key=
"id"
:default-expanded-keys=
"expandedKeys"
:default-checked-keys=
"checkedKeys"
@
check=
"handleCheck"
v-loading=
"treeLoading"
@
check-change=
"handleCheckChange"
>
<span
class=
"custom-tree-node"
slot-scope=
"{ node,
data }"
>
<span
class=
"custom-tree-node"
slot-scope=
"{ node,data }"
>
<div
v-if=
"node.data.leaf"
>
<div>
姓名:{{node.data.label1 || "--"}}
</div>
<div>
设备号:{{node.data.label||'--'}}
</div>
<div>
车架号:{{node.data.label2}}
</div>
<div
v-if=
"
showMore(node,data)
"
@
click=
"loadNext(node, data)"
>
查看更多
</div>
<div
v-if=
"
data.showMore
"
@
click=
"loadNext(node, data)"
>
查看更多
</div>
</div>
<span
v-else
>
{{node.data.label}}
...
...
@@ -243,6 +243,8 @@ export default {
currentMessage
:
""
,
//当前是否有提示语弹框
treeKey
:
""
,
treeDataList
:
{},
// 缓存车辆
pageSizeList
:
{},
pageSize
:
10
};
},
computed
:
{
...
...
@@ -507,7 +509,9 @@ export default {
}
},
loadNode
(
node
,
resolve
)
{
console
.
log
(
node
);
console
.
log
(
node
)
let
_this
=
this
;
let
id
=
node
.
data
.
id
const
nodeData
=
node
.
data
;
const
origin
=
nodeData
.
origin
;
if
(
nodeData
.
children
)
{
...
...
@@ -522,13 +526,17 @@ export default {
oParams
.
termType
=
this
.
searchType
;
oParams
.
term
=
this
.
searchText
;
}
oParams
.
pageSize
=
100
;
oParams
.
pageNum
=
node
.
pageNum
||
1
oParams
.
pageSize
=
_this
.
pageSize
;
oParams
.
pageNum
ber
=
_this
.
pageSizeList
[
id
]
||
1
;
MONITOR_SERVICE
.
getVehicleTreeUserList
(
oParams
).
then
(({
data
})
=>
{
if
(
data
.
length
)
{
data
.
map
((
item
)
=>
{
item
.
leaf
=
true
;
item
.
showMore
=
false
});
data
[
data
.
length
-
1
].
showMore
=
true
_this
.
treeDataList
[
id
]
=
data
;
_this
.
pageSizeList
[
id
]
=
oParams
.
pageNumber
;
return
resolve
(
data
);
}
return
resolve
([]);
...
...
@@ -837,14 +845,15 @@ export default {
// 添加监控
addMonitor
(
item
)
{
let
_this
=
this
;
if
(
this
.
monitorList
.
count
===
100
)
{
let
obj
=
this
.
monitorList
;
if
(
obj
.
count
===
100
)
{
this
.
$message
({
type
:
"error"
,
message
:
"监控设备数最大100台,无法添加"
,
});
return
false
;
}
if
(
this
.
monitorList
[
item
.
sn
]
&&
!
_this
.
currentMessage
)
{
if
(
obj
[
item
.
sn
]
&&
!
_this
.
currentMessage
)
{
_this
.
currentMessage
=
this
.
$message
({
type
:
"error"
,
message
:
"该列表中有设备正在监控中,请勿重复监控"
,
...
...
@@ -855,11 +864,16 @@ export default {
return
false
;
}
this
.
resetRefreshCount
=
true
;
this
.
monitorList
.
count
++
;
item
.
eLocateType
=
"gpsLocation"
;
this
.
monitorList
[
item
.
sn
]
=
item
;
this
.
monitorList
.
itemArr
.
unshift
(
item
.
sn
);
console
.
log
(
this
.
monitorList
.
itemArr
);
// 去重
if
(
!
obj
[
item
.
sn
])
{
obj
[
item
.
sn
]
=
item
;
obj
.
count
++
;
obj
.
itemArr
.
unshift
(
item
.
sn
);
}
console
.
log
(
obj
.
itemArr
);
this
.
getPositionData
();
},
// standNoMonitor(item){
...
...
@@ -920,7 +934,7 @@ export default {
if
(
obj
[
item
.
sn
])
{
delete
obj
[
item
.
sn
];
}
console
.
log
(
list
)
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
);
...
...
@@ -950,7 +964,7 @@ export default {
o
.
itemArr
=
[];
arr
.
forEach
((
item
)
=>
{
let
n
=
o
[
item
.
sn
||
item
];
console
.
log
(
n
)
console
.
log
(
n
)
;
if
(
n
)
{
_this
.
removeMonitor
(
n
);
}
...
...
@@ -1119,19 +1133,17 @@ export default {
// 展示更多
showMore
(
node
,
data
)
{
console
.
log
(
data
);
console
.
log
(
node
);
console
.
log
(
this
.
treeDataList
);
let
o
=
this
.
treeDataList
[
"u"
+
data
.
parentId
];
console
.
log
(
node
)
console
.
log
(
o
)
// 不存在
if
(
!
o
)
{
if
(
!
o
||
o
.
length
<=
0
)
{
return
false
;
}
let
len
=
o
.
data
.
length
;
let
curr
=
o
.
idx
||
1
;
// 判断是否有下一页
if
(
len
>
curr
*
10
)
{
let
idx
=
o
.
findIndex
((
k
)
=>
k
.
id
==
node
.
data
.
id
);
if
(
idx
==
o
.
length
-
1
)
{
return
true
;
}
else
{
return
false
;
...
...
@@ -1140,27 +1152,41 @@ export default {
// 加载下一页
loadNext
(
node
,
data
)
{
console
.
log
(
data
);
console
.
log
(
node
);
console
.
log
(
data
)
let
_this
=
this
;
let
id
=
"u"
+
node
.
data
.
parentId
;
let
pageNumber
=
this
.
pageSizeList
[
id
];
let
oParams
=
{};
oParams
.
uId
=
nodeData
.
id
;
oParams
.
uId
=
id
;
oParams
.
termType
=
this
.
searchType
;
oParams
.
term
=
this
.
searchText
;
MONITOR_SERVICE
.
getVehicleTreeUserList
(
oParams
).
then
(({
data
})
=>
{
if
(
data
.
length
)
{
let
arr
=
[];
data
.
map
((
item
)
=>
{
oParams
.
pageSize
=
this
.
pageSize
;
oParams
.
pageNumber
=
pageNumber
+
1
;
data
.
showMore
=
false
MONITOR_SERVICE
.
getVehicleTreeUserList
(
oParams
).
then
((
res
)
=>
{
let
list
=
res
.
data
||
[];
if
(
list
.
length
)
{
list
.
map
((
item
)
=>
{
item
.
leaf
=
true
;
item
.
showMore
=
false
});
if
(
data
.
length
>
100
)
{
arr
=
data
.
slice
(
0
,
100
);
this
.
treeDataList
[
node
.
data
.
id
]
=
{
data
:
data
,
idx
:
1
};
list
[
list
.
length
-
1
].
showMore
=
true
_this
.
pageSizeList
[
id
]
=
oParams
.
pageNumber
let
treeDataList
=
_this
.
treeDataList
[
id
];
if
(
treeDataList
)
{
treeDataList
=
treeDataList
.
concat
(
list
);
_this
.
treeDataList
[
id
]
=
treeDataList
}
else
{
arr
=
data
;
_this
.
treeDataList
[
id
]
=
list
;
}
return
resolve
(
arr
);
list
.
map
(
k
=>
{
_this
.
$refs
.
tree
.
append
(
k
,
id
)
_this
.
showMore
(
node
,
k
)
})
}
return
resolve
([]);
});
},
...
...
src/utils/mapService.js
View file @
afa6404
...
...
@@ -28,9 +28,11 @@ MapService.prototype = {
});
// 添加比例尺
var
scale
=
new
AMap
.
Scale
()
map
.
addControl
(
scale
);
scale
.
show
()
map
.
plugin
([
"AMap.Scale"
],
function
()
{
var
scale
=
new
AMap
.
Scale
()
map
.
addControl
(
scale
);
scale
.
show
()
});
//距离测量
map
.
plugin
([
"AMap.RangingTool"
],
function
()
{
...
...
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