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 01990e91
authored
Apr 22, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改圆形围栏
1 parent
8bf5e171
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
29 deletions
src/pages/monitor/fence.vue
src/pages/monitor/fenceMap.vue
src/pages/monitor/monitor.vue
src/pages/monitor/replay.vue
src/utils/fence.js
src/pages/monitor/fence.vue
View file @
01990e9
...
@@ -38,7 +38,10 @@
...
@@ -38,7 +38,10 @@
<div
class=
"radio_cell"
>
<div
class=
"radio_cell"
>
<el-radio
:label=
"1"
v-model=
"form.shapeType"
>
圆形
</el-radio>
<el-radio
:label=
"1"
v-model=
"form.shapeType"
>
圆形
</el-radio>
<el-form-item
label=
""
prop=
"radius"
>
<el-form-item
label=
""
prop=
"radius"
>
<el-input
v-model
.
trim=
"form.radius"
style=
"width: 80px;"
maxlength=
"200"
@
change=
"changeRadius"
></el-input>
米
<el-input
v-model
.
trim=
"form.radius"
style=
"width:120px"
maxlength=
"200"
>
<template
slot=
"append"
>
米
</
template
>
</el-input>
<el-button
type=
"primary"
class=
"btn"
:disabled=
"!form.radius"
@
click=
"changeRadius"
>
更新
</el-button>
</el-form-item>
</el-form-item>
</div>
</div>
<div
class=
"radio_cell"
>
<div
class=
"radio_cell"
>
...
@@ -289,7 +292,7 @@ export default {
...
@@ -289,7 +292,7 @@ export default {
}
}
showToast
({
showToast
({
message
:
"保存成功"
,
message
:
"保存成功"
,
type
:
"success"
type
:
"success"
,
});
});
})
})
.
catch
((
error
)
=>
{
.
catch
((
error
)
=>
{
...
@@ -457,20 +460,16 @@ export default {
...
@@ -457,20 +460,16 @@ export default {
},
},
// 监听圆形半径更改
// 监听圆形半径更改
changeRadius
(
e
)
{
changeRadius
()
{
let
reg
=
/^
\d
+$/
;
let
reg
=
/^
\d
+$/
;
let
e
=
this
.
form
.
radius
;
if
(
!
reg
.
test
(
e
)
||
e
>
10000
)
{
if
(
!
reg
.
test
(
e
)
||
e
>
10000
)
{
showToast
({
showToast
({
message
:
"请输入1-10000间的整数"
,
message
:
"请输入1-10000间的整数"
,
});
});
return
false
;
return
false
;
}
}
this
.
$refs
.
fenceMap
.
updateFence
({
EventBus
.
$emit
(
"uiMap.fence.updateFenceRadius"
,
{
fenceType
:
'circle'
,
radius
:
e
});
fenceType
:
"circle"
,
lng
:
this
.
form
.
lng
,
lat
:
this
.
form
.
lat
,
radius
:
this
.
form
.
radius
,
});
},
},
},
},
};
};
...
...
src/pages/monitor/fenceMap.vue
View file @
01990e9
...
@@ -300,6 +300,7 @@ export default {
...
@@ -300,6 +300,7 @@ export default {
}
}
},
100
);
},
100
);
},
},
// 更新围栏信息
updateFence
(
data
)
{
updateFence
(
data
)
{
let
_this
=
this
;
let
_this
=
this
;
let
mapInterval
=
setInterval
(
function
()
{
let
mapInterval
=
setInterval
(
function
()
{
...
...
src/pages/monitor/monitor.vue
View file @
01990e9
...
@@ -186,6 +186,7 @@ import { CONSTANT } from "@/constant";
...
@@ -186,6 +186,7 @@ import { CONSTANT } from "@/constant";
import
MapControll
from
"./MapControll.vue"
;
import
MapControll
from
"./MapControll.vue"
;
import
{
exportExcel
}
from
"@/utils"
;
import
{
exportExcel
}
from
"@/utils"
;
import
{
GET_MONITOR_ONLINELIST
}
from
"@/api/services/monitor"
;
import
{
GET_MONITOR_ONLINELIST
}
from
"@/api/services/monitor"
;
import
AMapLoader
from
"@amap/amap-jsapi-loader"
;
export
default
{
export
default
{
data
()
{
data
()
{
let
checkFilename
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkFilename
=
(
rule
,
vaule
,
cb
)
=>
{
...
@@ -1206,17 +1207,17 @@ export default {
...
@@ -1206,17 +1207,17 @@ 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();
}
//
}
);
//
);
});
//
});
}
//
}
this
.
keyupSubmit
();
this
.
keyupSubmit
();
EventBus
.
$on
(
"uiMap.monitor.drawDone"
,
this
.
drawDoneCb
);
EventBus
.
$on
(
"uiMap.monitor.drawDone"
,
this
.
drawDoneCb
);
EventBus
.
$on
(
"uiMap.monitor.changeELocate"
,
this
.
changeELocate
);
EventBus
.
$on
(
"uiMap.monitor.changeELocate"
,
this
.
changeELocate
);
...
@@ -1224,6 +1225,17 @@ export default {
...
@@ -1224,6 +1225,17 @@ export default {
this
.
getTreeData
();
this
.
getTreeData
();
},
},
mounted
(){
let
_this
=
this
;
AMapLoader
.
load
({
key
:
CONSTANT
.
MAP_KEY
,
version
:
"1.4.2"
,
plugins
:
CONSTANT
.
MAP_PLUGINS
,
}).
then
((
AMap
)
=>
{
window
.
AMap
=
AMap
;
_this
.
initMap
();
});
},
beforeDestroy
()
{
beforeDestroy
()
{
document
.
onkeydown
=
null
;
document
.
onkeydown
=
null
;
EventBus
.
$emit
(
"uiMap.monitor.destroy"
);
EventBus
.
$emit
(
"uiMap.monitor.destroy"
);
...
...
src/pages/monitor/replay.vue
View file @
01990e9
<
template
>
<
template
>
<v-full-layout>
<v-full-layout
class=
"full_wrap_layout"
>
<template
slot=
"breadcrumb"
>
<template
slot=
"breadcrumb"
>
<el-breadcrumb-item>
车辆监控
</el-breadcrumb-item>
<el-breadcrumb-item>
车辆监控
</el-breadcrumb-item>
</
template
>
</
template
>
...
...
src/utils/fence.js
View file @
01990e9
...
@@ -22,9 +22,10 @@ const fence = {
...
@@ -22,9 +22,10 @@ const fence = {
});
});
EventBus
.
$on
(
'uiMap.fence.updateFenceRadius'
,
(
data
)
=>
{
EventBus
.
$on
(
'uiMap.fence.updateFenceRadius'
,
(
data
)
=>
{
this
.
circle
.
setRadius
(
data
*
1
);
console
.
log
(
'监听围栏更新'
,
data
)
mapService
.
setFitView
(
)
this
.
updateFenceInfo
(
data
)
});
});
//this.circle.setRadius(data * 1);
EventBus
.
$on
(
'uiMap.fence.createFenceMarker'
,
(
data
)
=>
{
EventBus
.
$on
(
'uiMap.fence.createFenceMarker'
,
(
data
)
=>
{
this
.
createFenceMarker
(
data
)
this
.
createFenceMarker
(
data
)
...
@@ -126,11 +127,20 @@ const fence = {
...
@@ -126,11 +127,20 @@ const fence = {
const
MAP
=
mapService
.
map
;
const
MAP
=
mapService
.
map
;
_this
.
destroy
();
_this
.
destroy
();
let
mapInterval
=
setInterval
(()
=>
{
let
mapInterval
=
setInterval
(()
=>
{
if
(
MAP
)
{
if
(
MAP
)
{
clearInterval
(
mapInterval
)
clearInterval
(
mapInterval
)
console
.
log
(
data
)
let
lng
=
data
.
lng
||
_this
.
lng
let
lat
=
data
.
lat
||
_this
.
lat
if
(
data
.
lng
)
{
_this
.
lng
=
data
.
lng
}
if
(
data
.
lat
)
{
_this
.
lat
=
data
.
lat
}
_this
.
circle
=
new
AMap
.
Circle
({
_this
.
circle
=
new
AMap
.
Circle
({
map
:
MAP
,
map
:
MAP
,
center
:
mapService
.
getLngLat
(
data
.
lng
,
data
.
lat
),
center
:
mapService
.
getLngLat
(
lng
,
lat
),
radius
:
data
.
radius
*
1
,
radius
:
data
.
radius
*
1
,
strokeColor
:
"#F33"
,
strokeColor
:
"#F33"
,
strokeOpacity
:
1
,
strokeOpacity
:
1
,
...
@@ -139,19 +149,20 @@ const fence = {
...
@@ -139,19 +149,20 @@ const fence = {
fillOpacity
:
0.35
,
fillOpacity
:
0.35
,
zIndex
:
0
,
zIndex
:
0
,
});
});
_this
.
circleEditor
=
new
AMap
.
CircleEditor
(
MAP
,
_this
.
circle
);
_this
.
circleEditor
=
new
AMap
.
CircleEditor
(
MAP
,
_this
.
circle
);
_this
.
circleEditor
.
on
(
'adjust'
,
function
(
e
)
{
_this
.
circleEditor
.
on
(
'adjust'
,
function
(
e
)
{
//log.info('触发事件:adjust'
)
console
.
log
(
'监听圆心改变'
,
e
)
EventBus
.
$emit
(
'uiMap.fence.onFenceRadiusChange'
,
e
.
radius
/
1
)
EventBus
.
$emit
(
'uiMap.fence.onFenceRadiusChange'
,
e
.
radius
/
1
)
})
})
_this
.
circleEditor
.
on
(
'move'
,
function
(
e
)
{
_this
.
circleEditor
.
on
(
'move'
,
function
(
e
)
{
EventBus
.
$emit
(
'uiMap.fence.onFenceLngLatChange'
,
{
EventBus
.
$emit
(
'uiMap.fence.onFenceLngLatChange'
,
{
lng
:
e
.
lnglat
.
lng
,
lng
:
e
.
lnglat
.
lng
,
lat
:
e
.
lnglat
.
lat
lat
:
e
.
lnglat
.
lat
});
});
})
})
if
(
_this
.
isEditMode
)
{
if
(
_this
.
isEditMode
)
{
_this
.
circleEditor
.
open
();
_this
.
circleEditor
.
open
();
}
else
{
}
else
{
...
@@ -159,9 +170,10 @@ const fence = {
...
@@ -159,9 +170,10 @@ const fence = {
}
}
mapService
.
setFitView
()
mapService
.
setFitView
()
MAP
.
setZoom
(
14
);
MAP
.
setZoom
(
14
);
_this
.
bindContextMenu
()
}
}
},
100
);
},
100
);
},
},
createFenceMarker
(
data
)
{
createFenceMarker
(
data
)
{
...
@@ -283,6 +295,94 @@ const fence = {
...
@@ -283,6 +295,94 @@ const fence = {
item
&&
window
.
clearTimeout
(
item
);
item
&&
window
.
clearTimeout
(
item
);
});
});
this
.
timeoutIds
=
[]
this
.
timeoutIds
=
[]
},
// 地图增加右键功能
bindContextMenu
()
{
const
self
=
this
;
const
MAP
=
mapService
.
map
;
var
contextMenu
=
new
AMap
.
ContextMenu
();
contextMenu
.
addItem
(
"设置围栏中心"
,
function
()
{
self
.
moveCenter
();
},
0
);
//地图绑定鼠标右击事件——弹出右键菜单
MAP
.
on
(
"rightclick"
,
function
(
e
)
{
contextMenu
.
open
(
MAP
,
e
.
lnglat
);
self
.
contextMenuPositon
=
e
.
lnglat
;
});
},
// 改变圆心
moveCenter
()
{
this
.
lng
=
this
.
contextMenuPositon
.
lng
;
this
.
lat
=
this
.
contextMenuPositon
.
lat
;
let
center
=
mapService
.
getLngLat
(
this
.
lng
,
this
.
lat
);
this
.
circle
.
setCenter
(
center
);
EventBus
.
$emit
(
'uiMap.fence.onFenceLngLatChange'
,
{
lng
:
this
.
lng
,
lat
:
this
.
lat
,
});
},
// 更新围栏
updateFenceInfo
(
data
)
{
let
_this
=
this
;
const
MAP
=
mapService
.
map
;
let
mapInterval
=
setInterval
(
function
()
{
if
(
MAP
)
{
clearInterval
(
mapInterval
);
MAP
.
clearMap
();
_this
.
fenceType
=
data
.
fenceType
;
_this
.
polyEditor
&&
_this
.
polyEditor
.
close
();
_this
.
mouseTool
&&
_this
.
mouseTool
.
close
();
// 更新圆形围栏
if
(
data
.
fenceType
==
'circle'
)
{
_this
.
fenceCircle
=
null
;
if
(
data
.
lng
)
{
_this
.
lng
=
data
.
lng
;
}
if
(
data
.
lat
)
{
_this
.
lat
=
data
.
lat
;
}
if
(
data
.
radius
)
{
_this
.
radius
=
Number
(
data
.
radius
);
}
console
.
log
(
data
)
_this
.
createFenceCircle
(
data
);
return
false
;
}
// 更新行政区域围栏
if
(
data
.
fenceType
===
"area"
)
{
_this
.
areaCode
=
data
.
areaCode
;
_this
.
drawDistrict
(
data
);
return
false
}
// 更新多边形围栏
if
(
data
.
fenceType
===
"polygon"
)
{
if
(
data
)
{
if
(
Array
.
isArray
(
data
))
{
this
.
polygonPath
=
data
;
this
.
isEditMode
=
true
;
}
else
if
((
'isEdit'
in
data
)
&&
!
data
.
isEdit
)
{
this
.
polygonPath
=
data
.
path
;
this
.
isEditMode
=
false
;
}
}
_this
.
drawPolygon
();
}
mapService
.
setFitView
()
MAP
.
setZoom
(
14
);
}
},
100
);
}
}
}
}
...
...
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