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 ee4dcd7a
authored
Apr 16, 2022
by
张杰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
v1.6.0版本需求
1 parent
cb69b739
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
112 additions
and
44 deletions
src/api/services/fence.js
src/assets/scss/map.scss
src/components/area/index.vue
src/constant.js
src/pages/monitor/addFence.vue
src/pages/monitor/fence.vue
src/pages/monitor/monitor.vue
src/utils/mapService.js
src/utils/utils.js
src/api/services/fence.js
View file @
ee4dcd7
import
request
from
'./request'
import
store
from
"@/vuex/store"
;
console
.
log
(
'store'
,
store
)
// 新增围栏
export
const
SAVE_ELECFENCE_INFO
=
params
=>
{
...
...
src/assets/scss/map.scss
View file @
ee4dcd7
...
...
@@ -34,7 +34,10 @@ h3.uimap-info-title{
word-break
:
break-all
;
}
.amap-controls
{
display
:
none
;
//display: none;
}
.amap-logo
,
.amap-copyright
{
display
:
none
!
important
;
}
.navg-info-window
{
background-color
:
#fff
;
...
...
src/components/area/index.vue
View file @
ee4dcd7
...
...
@@ -66,8 +66,9 @@ export default {
return
false
;
}
let
m
=
list
.
find
((
k
)
=>
{
let
n
=
k
.
children
.
find
((
j
)
=>
j
.
name
==
o
);
let
n
=
k
.
children
.
find
((
j
)
=>
(
j
.
name
==
o
||
j
.
code
==
o
)
);
if
(
n
)
{
//let b = n.children.find(h => (h.name == n.name || h.code == n.code) )
arr
.
push
(
k
.
code
);
arr
.
push
(
n
.
code
);
}
...
...
src/constant.js
View file @
ee4dcd7
...
...
@@ -13,11 +13,12 @@ export const MAP_PLUGINS = [
"AMap.Geolocation"
,
"AMap.PolygonEditor"
,
"AMap.PolylineEditor"
,
'AMap.Scale'
]
export
const
CONSTANT
=
{
//ROOT: process.env.NODE_ENV === 'development'?'ots/':'',
API_URL
:
'/ots/'
,
MAP_KEY
,
MAP_PLUGINS
,
AMAP_URL
:
`https://webapi.amap.com/maps?v=1.4.2&key=
${
MAP_KEY
}
&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.DistrictSearch,AMap.Autocomplete,AMap.MarkerClusterer,AMap.MouseTool,AMap.Text`
AMAP_URL
:
`https://webapi.amap.com/maps?v=1.4.2&key=
${
MAP_KEY
}
&plugin=AMap.PolyEditor,AMap.CircleEditor,AMap.DistrictSearch,AMap.Autocomplete,AMap.MarkerClusterer,AMap.MouseTool,AMap.Text
,AMap.Scale
`
}
\ No newline at end of file
src/pages/monitor/addFence.vue
View file @
ee4dcd7
...
...
@@ -77,8 +77,8 @@
<el-table-column
fixed
prop=
"name"
label=
"姓名"
show-overflow-tooltip
></el-table-column>
<el-table-column
fixed
prop=
"vin"
label=
"车架号"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"sn"
label=
"设备号"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"
sn
"
label=
"GPS时间"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"
sn
"
label=
"位置"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"
time
"
label=
"GPS时间"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"
address
"
label=
"位置"
show-overflow-tooltip
></el-table-column>
<el-table-column
prop=
"userTel"
label=
"联系方式"
show-overflow-tooltip
></el-table-column>
</el-table>
</el-tab-pane>
...
...
@@ -106,6 +106,7 @@ import {
GET_ELECFENCE_INFO
,
SAVE_ELECFENCE_INFO
,
UPDATE_ELECFENCE_INFO
,
REMOVE_ELECFENCE_LINKEDDEVICES
}
from
"@/api/services/fence"
;
export
default
{
props
:
[
"fenceModalVisible"
,
"fenceId"
],
...
...
src/pages/monitor/fence.vue
View file @
ee4dcd7
...
...
@@ -22,15 +22,15 @@
<el-form-item
label=
"围栏名称"
prop=
"fenceName"
>
<el-input
v-model
.
trim=
"form.fenceName"
maxlength=
"200"
></el-input>
</el-form-item>
<el-form-item
label=
"触发类型"
>
<el-form-item
label=
"触发类型"
prop=
"triggerType"
>
<el-select
v-model=
"form.triggerType"
class=
"a_select"
placeholder=
"请选择"
size=
"small"
>
<el-option
label=
"驶出"
:value=
"2"
></el-option>
<el-option
label=
"驶入"
:value=
"1"
></el-option>
<el-option
label=
"驶入驶出"
:value=
"3"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"指定区间"
prop=
"date
r
ange"
>
<el-date-picker
style=
"width: 100%;"
v-model=
"form.dateRange"
type=
"daterange"
size=
"small"
:clearable=
"false"
:editable=
"false"
:unlink-panels=
"true"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
>
<el-form-item
label=
"指定区间"
prop=
"date
R
ange"
>
<el-date-picker
style=
"width: 100%;"
v-model=
"form.dateRange"
type=
"daterange"
size=
"small"
:clearable=
"false"
:editable=
"false"
:unlink-panels=
"true"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"yyyy-MM-dd"
>
</el-date-picker>
</el-form-item>
<el-form-item
label=
"监控区域"
class=
"row-form-item"
>
...
...
@@ -47,13 +47,13 @@
</div>
<div
class=
"radio_cell"
>
<el-radio
:label=
"4"
v-model=
"form.shapeType"
>
行政区域
</el-radio>
<el-form-item
label=
""
prop=
"
radius
"
>
<city-select
v-model=
"form.areaName"
:checkStrictly=
"true"
:disabled=
"form.shapeType !=
3
"
@
change=
"changeArea"
></city-select>
<el-form-item
label=
""
prop=
"
areaName
"
>
<city-select
v-model=
"form.areaName"
:checkStrictly=
"true"
:disabled=
"form.shapeType !=
4
"
@
change=
"changeArea"
></city-select>
</el-form-item>
</div>
</div>
</el-form-item>
<el-form-item
label=
"短信通知"
prop=
"
msgtel
"
>
<el-form-item
label=
"短信通知"
prop=
"
telNumbers
"
>
<el-input
v-model
.
trim=
"form.telNumbers"
maxlength=
"100"
placeholder=
"输入格式:手机号码,手机号码(支持双号)"
></el-input>
</el-form-item>
<el-form-item
label=
"围栏状态"
>
...
...
@@ -74,8 +74,6 @@
</template>
<
script
>
import
"@/assets/spritesmith-generated/sprite.css"
;
import
store
from
"@/vuex/store.js"
;
import
remoteLoad
from
"@/utils/remoteLoad.js"
;
import
mapService
from
"@/utils/mapService.js"
;
import
"@/utils/mapEvent.js"
;
import
EventBus
from
"@/event-bus"
;
...
...
@@ -83,13 +81,13 @@ import { services } from "@/api";
const
MONITOR_SERVICE
=
services
.
monitor
;
import
{
CONSTANT
}
from
"@/constant"
;
import
{
deepClone
}
from
"@/utils/utils"
;
import
{
deepClone
,
showToast
}
from
"@/utils/utils"
;
import
AreaSelect
from
"./AreaSelect.vue"
;
import
MAPGEO
from
"@/utils/mapgeo"
;
import
MapControll
from
"./MapControll.vue"
;
import
AMapLoader
from
"@amap/amap-jsapi-loader"
;
import
{
GET_DEVICE_LOCATION
}
from
"@/api/services/monitor"
;
import
CitySelect
from
"@/components/area"
;
import
{
SAVE_ELECFENCE_INFO
}
from
"@/api/services/fence"
;
export
default
{
components
:
{
AreaSelect
,
...
...
@@ -139,9 +137,9 @@ export default {
};
let
checkRadius
=
(
rule
,
vaule
,
cb
)
=>
{
const
fenceRadius
=
this
.
form
.
fenceR
adius
;
const
fenceRadius
=
this
.
form
.
r
adius
;
if
(
this
.
form
.
shapeType
==
2
&&
this
.
form
.
shapeType
==
1
&&
(
!
/^
\d
+$/
.
test
(
fenceRadius
)
||
fenceRadius
<
1000
)
)
{
cb
(
new
Error
(
"请输入整数且不小于1000"
));
...
...
@@ -151,12 +149,24 @@ export default {
};
let
checkMsgtel
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
msgtel
&&
!
/^1
\d{10}(\,
1
\d{10})?
$/
.
test
(
this
.
form
.
msgtel
))
{
let
reg
=
/^1
\d{10}((\,
1
\d{10})
|
(\,
1
\d{10}))?
$/
if
(
this
.
form
.
telNumbers
&&
!
reg
.
test
(
this
.
form
.
telNumbers
)
)
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
cb
();
}
};
let
checkArea
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
4
&&
!
this
.
form
.
areaCode
)
{
cb
(
new
Error
(
"请选择行政区域"
));
}
else
{
cb
();
}
};
return
{
sn
:
this
.
$route
.
query
.
sn
,
name
:
this
.
$route
.
query
.
name
,
...
...
@@ -176,19 +186,26 @@ export default {
triggerType
:
3
,
shapeType
:
1
,
radius
:
1000
,
enableStatus
:
1
enableStatus
:
1
,
},
rules
:
{
fenceName
:
[
{
required
:
true
,
message
:
"请输入围栏名称"
,
trigger
:
"blur"
},
{
pattern
:
/^
\S{2,200}
$/
,
message
:
"至少2字"
,
trigger
:
"blur"
},
{
validator
:
checkFenceName
,
trigger
:
"blur"
},
// { validator: checkFenceName, trigger: "blur" },
],
triggerType
:
[
{
required
:
true
,
message
:
"请选择触发类型"
,
trigger
:
"change"
},
],
daterange
:
[{
validator
:
checkDaterange
}],
fenceRadius
:
[{
validator
:
checkRadius
,
trigger
:
"blur"
}],
msgtel
:
[{
validator
:
checkMsgtel
,
trigger
:
"blur"
}],
dateRange
:
[
{
required
:
true
,
message
:
"请选择指定区间"
,
trigger
:
"change"
},
{
validator
:
checkDaterange
,
trigger
:
"change"
},
],
raidus
:
[{
validator
:
checkRadius
,
trigger
:
"blur"
}],
telNumbers
:
[{
validator
:
checkMsgtel
,
trigger
:
"blur"
}],
areaName
:
[{
validator
:
checkArea
,
trigger
:
"blur"
}],
},
fenceId
:
undefined
,
fenceId
:
""
,
restainFenceName
:
""
,
polygonPath
:
[],
deviceInfo
:
{},
// 设备信息
...
...
@@ -203,14 +220,14 @@ export default {
mounted
()
{
//store.dispatch("setFullsize", true);
},
watch
:
{
"form.shapeType"
:
{
handler
:
function
(
n
,
o
)
{
this
.
changeShapeType
(
n
);
},
immediate
:
true
,
},
},
//
watch: {
//
"form.shapeType": {
//
handler: function (n, o) {
//
this.changeShapeType(n);
//
},
//
immediate: true,
//
},
//
},
methods
:
{
// 初始化地图
initMap
()
{
...
...
@@ -245,13 +262,51 @@ export default {
pickDate
(
beforeDays
)
{},
// 保存围栏信息
submit
()
{
let
_this
=
this
;
_this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
!
valid
)
{
return
false
;
}
let
oParams
=
_this
.
getParams
();
// 多边形围栏校验
if
(
oParams
.
shapeType
==
3
&&
(
!
_this
.
polygonPath
||
_this
.
polygonPath
.
length
<=
0
)
)
{
showToast
({
message
:
"请绘制线路"
,
});
return
false
;
}
console
.
log
(
oParams
);
_this
.
isSubmitting
=
true
;
SAVE_ELECFENCE_INFO
(
oParams
)
.
then
((
res
)
=>
{
_this
.
isSubmitting
=
false
;
if
(
res
.
code
!=
200
)
{
showToast
({
message
:
res
.
message
,
});
return
false
;
}
showToast
({
message
:
"保存成功"
,
type
:
"success"
,
});
})
.
catch
((
error
)
=>
{
_this
.
isSubmitting
=
false
;
});
});
},
updateFenceRadius
(
radius
)
{},
// 在地图上画圆形围栏
drawFenceCircle
(
info
)
{
let
_this
=
this
;
_this
.
form
.
lng
=
info
.
elng
;
_this
.
form
.
lat
=
info
.
elat
;
EventBus
.
$emit
(
"uiMap.fence.createFenceCircle"
,
{
lng
:
info
.
elng
,
lat
:
info
.
elat
,
...
...
@@ -308,7 +363,7 @@ export default {
// 监听圆形围栏直径变化
onFenceRadiusChange
(
e
)
{
console
.
log
(
e
);
console
.
log
(
"圆形围栏:"
,
e
);
this
.
$set
(
this
.
form
,
"radius"
,
e
);
},
...
...
@@ -343,6 +398,7 @@ export default {
this
.
form
.
areaCode
=
e
.
code
;
this
.
form
.
areaText
=
e
.
name
;
this
.
drawDistrict
(
e
.
code
);
this
.
$refs
.
form
.
clearValidate
();
},
// 获取参数
...
...
@@ -351,7 +407,6 @@ export default {
let
o
=
deepClone
(
_this
.
form
);
console
.
log
(
o
);
let
oParams
=
{};
let
device
=
this
.
deviceInfo
;
let
deviceList
=
this
.
deviceList
;
oParams
.
fenceName
=
o
.
fenceName
;
...
...
@@ -371,7 +426,7 @@ export default {
// 圆形围栏
if
(
o
.
shapeType
==
1
)
{
oParams
.
radius
=
o
.
radius
;
oParams
.
lnglat
=
`
${
device
.
elng
}
,
${
device
.
e
lat
}
`
;
oParams
.
lnglat
=
`
${
o
.
lng
}
,
${
o
.
lat
}
`
;
}
// 多边形围栏
...
...
@@ -401,6 +456,7 @@ export default {
arr
.
push
(
cur
);
});
oParams
.
snList
=
arr
;
return
oParams
;
},
},
};
...
...
src/pages/monitor/monitor.vue
View file @
ee4dcd7
...
...
@@ -66,7 +66,7 @@
<el-option
label=
"工单号"
value=
"4"
></el-option>
</el-select>
</el-input>
<div
slot=
"tip"
class=
"el-upload__tip"
>
仅支持同时监控100台设备,还可导入{{100-monitorList.
count
}}台设备
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
仅支持同时监控100台设备,还可导入{{100-monitorList.
itemArr.length
}}台设备
</div>
</el-upload>
</el-form-item>
<el-button
type=
"primary"
class=
"upload-sure-btn"
size=
"small"
@
click=
"submitUpload"
:loading=
"importing"
:disabled=
"uploadDisabled"
>
确认
</el-button>
...
...
@@ -77,7 +77,7 @@
<div
class=
"filter-dialog animated "
:class=
"listDialogHidden?'fadeOut':'active fadeIn'"
>
<div
class=
"filter-dialog-header monitor_dialog_header"
>
<span>
监控列表({{monitorList.
count
}})
</span>
<span>
监控列表({{monitorList.
itemArr.length
}})
</span>
<i
class=
"el-icon-close pull-right"
@
click
.
stop=
"listDialogHidden=true"
></i>
</div>
<div
class=
"filter-dialog-body"
>
...
...
@@ -920,7 +920,7 @@ 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
);
...
...
@@ -947,8 +947,10 @@ export default {
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
);
}
...
...
src/utils/mapService.js
View file @
ee4dcd7
...
...
@@ -22,20 +22,26 @@ var zhongliType = sessionStorage.getItem('zhongliType');//获取是否仲利账
MapService
.
prototype
=
{
init
:
function
(
id
)
{
var
self
=
this
;
self
.
map
=
new
AMap
.
Map
(
id
,
{
var
map
=
new
AMap
.
Map
(
id
,
{
resizeEnable
:
true
,
zoom
:
11
});
// 添加比例尺
var
scale
=
new
AMap
.
Scale
()
map
.
addControl
(
scale
);
scale
.
show
()
//距离测量
self
.
map
.
plugin
([
"AMap.RangingTool"
],
function
()
{
map
.
plugin
([
"AMap.RangingTool"
],
function
()
{
self
.
ruler
=
new
AMap
.
RangingTool
(
self
.
map
);
});
//定位
self
.
map
.
plugin
(
'AMap.Geolocation'
,
function
()
{
map
.
plugin
(
'AMap.Geolocation'
,
function
()
{
self
.
geolocation
=
new
AMap
.
Geolocation
();
});
self
.
map
=
map
;
return
self
.
map
;
},
toggleMapType
:
function
()
{
...
...
src/utils/utils.js
View file @
ee4dcd7
...
...
@@ -3,7 +3,6 @@ const EventBus = new Vue()
import
{
Message
,
MessageBox
,
Loading
}
from
'element-ui'
import
moment
from
'moment'
let
loadingInstance
=
''
console
.
log
(
MessageBox
)
export
const
Util
=
{
/**
* 简单alert
...
...
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