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 be63bdeb
authored
Dec 23, 2024
by
wangzhihui
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
高德地图替换百度地图
1 parent
2917f8e2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
638 additions
and
499 deletions
src/pages/monitor/addPoi.vue
src/pages/monitor/editFence.vue
src/pages/monitor/fence.vue
src/utils/historyLocation.js
src/utils/mapBService.js
src/utils/replay.js
src/pages/monitor/addPoi.vue
View file @
be63bde
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
</v-full-layout>
</v-full-layout>
</template>
</template>
<
script
>
<
script
>
import
mapService
from
"@/utils/mapService.js"
;
import
mapService
from
"@/utils/map
B
Service.js"
;
import
"@/utils/mapEvent.js"
;
import
"@/utils/mapEvent.js"
;
import
{
STATICIMAGE
}
from
"@/constant"
;
import
{
STATICIMAGE
}
from
"@/constant"
;
import
FenceMapControll
from
"./FenceMapControll"
;
import
FenceMapControll
from
"./FenceMapControll"
;
...
@@ -145,6 +145,8 @@ export default {
...
@@ -145,6 +145,8 @@ export default {
},
},
],
],
},
},
markers
:
{},
infowins
:
{},
hideFooter
:
false
,
hideFooter
:
false
,
poi
:
{},
poi
:
{},
poiMapSearch
:
""
,
poiMapSearch
:
""
,
...
@@ -158,43 +160,44 @@ export default {
...
@@ -158,43 +160,44 @@ export default {
},
},
mounted
()
{
mounted
()
{
console
.
log
(
STATICIMAGE
);
console
.
log
(
STATICIMAGE
);
this
.
initMap
();
this
.
init
B
Map
();
EventBus
.
$on
(
"uiMap.poi.marker.delete"
,
this
.
removePoi
);
EventBus
.
$on
(
"uiMap.poi.marker.delete"
,
this
.
removePoi
);
},
},
methods
:
{
methods
:
{
// 地图初始化
async
initBMap
()
{
initMap
()
{
this
.
mapObj
=
await
mapService
.
init
(
"map"
);
let
_this
=
this
;
this
.
mapLoading
=
false
;
let
plugins
=
[
"AMap.LngLat"
,
"AMap.MassMarks"
,
"AMap.Geocoder"
];
window
.
AMap
=
this
.
mapObj
;
_this
.
$mapInit
({
plugins
:
plugins
}).
then
((
AMap
)
=>
{
this
.
autoComplete
=
AMap
.
invoke
(
"Autocomplete"
,
{
_this
.
mapLoading
=
false
;
input
:
"poiMapSearch"
,
window
.
AMap
=
AMap
;
_this
.
map
=
mapService
.
init
(
"map"
,
{
zoom
:
15
,
showIndoorMap
:
false
,
showLabel
:
false
,
});
});
_this
.
bindSearch
();
AMap
.
invoke
(
"autocompleteShow"
);
_this
.
initMapEvent
();
AMap
.
invoke
(
"autocompleteAddEventListener"
,
"onconfirm"
,
(
e
)
=>
{
_this
.
getPoiTrack
();
this
.
poi
=
e
.
item
.
value
;
this
.
$set
(
this
.
form
,
"address"
,
this
.
poi
.
address
);
this
.
$refs
.
addressInput
.
focus
();
});
});
this
.
initMapEvent
();
this
.
getPoiTrack
();
},
},
// 创建地图右键菜单
// 创建地图右键菜单
initMapEvent
()
{
initMapEvent
()
{
let
_this
=
this
;
const
self
=
this
;
let
_map
=
this
.
map
;
const
mapInstance
=
mapService
.
mapInstance
;
var
contextMenu
=
AMap
.
invoke
(
"ContextMenu"
);
let
_position
=
""
;
let
_position
=
""
;
let
_contextMenu
=
new
AMap
.
ContextMenu
();
//右键添加Marker标记
contextMenu
.
addItem
(
_contextMenu
.
addItem
(
"设置POI点"
,
function
()
{
AMap
.
invoke
(
"MenuItem"
,
"设置POI点"
,
function
()
{
_contextMenu
.
close
();
self
.
addPoiMarker
(
_position
);
_this
.
addPoiMarker
(
_position
);
})
});
);
//地图绑定鼠标右击事件——弹出右键菜单
_map
.
on
(
"rightclick"
,
function
(
e
)
{
AMap
.
invoke
(
"mapAddEventListener"
,
"rightclick"
,
function
(
e
)
{
_contextMenu
.
open
(
_map
,
e
.
lnglat
);
console
.
log
(
e
)
_position
=
e
.
lnglat
;
AMap
.
invoke
(
"addContextMenu"
,
contextMenu
);
_position
=
e
.
latlng
;
});
});
},
},
...
@@ -203,72 +206,71 @@ export default {
...
@@ -203,72 +206,71 @@ export default {
let
_this
=
this
;
let
_this
=
this
;
let
_query
=
_this
.
$route
.
query
;
let
_query
=
_this
.
$route
.
query
;
let
markers
=
[];
let
markers
=
[];
let
_icon
=
{
url
:
STATICIMAGE
.
POI_MASS_ICON
,
size
:
new
AMap
.
Size
(
16
,
21
),
anchor
:
new
AMap
.
Pixel
(
3
,
3
),
};
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
arr
.
length
;
i
<
len
;
i
++
)
{
let
k
=
arr
[
i
];
let
k
=
arr
[
i
];
if
(
k
.
id
!=
_query
.
id
)
{
if
(
k
.
lnglat
)
{
if
(
k
.
lnglat
)
{
let
m
=
k
.
lnglat
.
split
(
","
);
let
m
=
k
.
lnglat
.
split
(
","
);
k
.
lng
=
m
[
0
];
let
lnglatXY
=
mapService
.
getLngLat
(
m
[
0
],
m
[
1
]);
k
.
lat
=
m
[
1
];
markers
.
push
(
lnglatXY
);
k
.
lnglat
=
m
;
let
marker
=
mapService
.
createPoiMarker
(
lnglatXY
,
AMap
);
markers
.
push
(
k
);
AMap
.
invoke
(
"addOverlay"
,
marker
);
}
AMap
.
invoke
(
"markerAddEventListener"
,
"click"
,
(
e
)
=>
{
let
data
=
{
...
e
,
...
k
};
this
.
markerEvent
(
data
);
});
}
}
}
}
let
mass
=
new
AMap
.
MassMarks
(
markers
,
{
AMap
.
invoke
(
"setViewport"
,
markers
);
opacity
:
0.8
,
zIndex
:
10
,
cursor
:
"pointer"
,
style
:
_icon
,
});
mass
.
on
(
"click"
,
function
(
e
)
{
console
.
log
(
e
);
_this
.
markerEvent
(
e
.
data
);
});
mass
.
setMap
(
_this
.
map
);
},
},
// 地图右键添加poi点
// 地图右键添加poi点
addPoiMarker
(
options
,
type
,
isOpen
)
{
addPoiMarker
(
options
,
type
,
isOpen
)
{
console
.
log
(
options
,
type
,
isOpen
);
let
_this
=
this
;
let
_this
=
this
;
let
_map
=
_this
.
map
;
let
_map
=
_this
.
map
;
let
_InfoWindow
=
_this
.
poiInfoWindow
;
let
_InfoWindow
=
_this
.
poiInfoWindow
;
if
(
_this
.
poiMarker
)
{
if
(
_this
.
poiMarker
)
{
_map
.
remove
(
_this
.
poiMarker
);
AMap
.
invoke
(
"removeOverlay"
,
_this
.
poiMarker
);
_InfoWindow
&&
_InfoWindow
.
close
(
);
_InfoWindow
&&
AMap
.
invoke
(
"mapCloseInfoWindow"
,
_InfoWindow
);
_this
.
poiMarker
=
null
;
_this
.
poiMarker
=
null
;
}
}
let
_icon
=
new
AMap
.
Icon
({
let
_icon
=
AMap
.
invoke
(
image
:
STATICIMAGE
.
POI_MARKER
,
"Icon"
,
});
STATICIMAGE
.
POI_MARKER
,
AMap
.
invoke
(
"Size"
,
24
,
24
)
);
if
(
options
.
id
)
{
if
(
options
.
id
)
{
_icon
=
new
AMap
.
Icon
({
_icon
=
AMap
.
invoke
(
image
:
STATICIMAGE
.
POI_MASS_ICON
,
"Icon"
,
imageSize
:
new
AMap
.
Size
(
16
,
21
),
STATICIMAGE
.
POI_MASS_ICON
,
});
AMap
.
invoke
(
"Size"
,
16
,
21
)
);
}
}
let
lnglatXY
=
mapService
.
getLngLat
(
options
.
lng
,
options
.
lat
);
let
_marker
=
new
AMap
.
Marker
({
let
_marker
=
AMap
.
invoke
(
'Marker'
,
lnglatXY
,
{
icon
:
_icon
,
icon
:
_icon
position
:
[
options
.
lng
,
options
.
lat
],
})
extData
:
options
,
// let _marker = new AMap.Marker({
});
// icon: _icon,
// position: [options.lng, options.lat],
let
_markerInfo
=
_marker
.
getExtData
();
// extData: options,
//_marker.infoWindow = mapService.createPoiMarkerInfowindow(options);
// });
_marker
.
on
(
"click"
,
function
(
e
)
{
let
_markerInfo
=
options
_this
.
markerEvent
(
_markerInfo
);
_markerInfo
.
latLng
=
mapService
.
getLngLat
(
options
.
lng
,
options
.
lat
);
AMap
.
invoke
(
"addOverlay"
,
_marker
);
this
.
markerEvent
(
_markerInfo
);
// AMap.invoke("mapOpenInfoWindow", infoWindow,lnglat)
AMap
.
invoke
(
"markerAddEventListener"
,
"click"
,
(
e
)
=>
{
_markerInfo
=
{
...
e
,
...
_markerInfo
};
this
.
markerEvent
(
_markerInfo
);
});
});
_marker
.
setMap
(
_this
.
map
);
// let _markerInfo = _marker.getExtData();
// //_marker.infoWindow = mapService.createPoiMarkerInfowindow(options);
// _marker.on("click", function (e) {
// _this.markerEvent(_markerInfo);
// });
// _marker.setMap(_this.map);
// 历史marker存储起来,以id为键值,方便后续删除用
// 历史marker存储起来,以id为键值,方便后续删除用
if
(
options
.
id
)
{
if
(
options
.
id
)
{
...
@@ -295,27 +297,20 @@ export default {
...
@@ -295,27 +297,20 @@ export default {
// marker点击事件
// marker点击事件
markerEvent
(
e
)
{
markerEvent
(
e
)
{
let
_this
=
this
;
console
.
log
(
e
)
console
.
log
(
e
);
let
_params
=
e
;
let
_params
=
e
;
const
geocoder
=
new
AMap
.
Geocoder
({
this
.
setPoiInfo
(
e
);
extensions
:
"all"
,
let
point
=
e
.
latLng
;
});
AMap
.
invoke
(
"getLocation"
,
point
,
(
res
)
=>
{
_this
.
setPoiInfo
(
e
);
console
.
log
(
res
)
geocoder
.
getAddress
(
let
_pois
=
res
.
surroundingPois
||
[];
new
AMap
.
LngLat
(
e
.
lng
,
e
.
lat
),
_params
.
address
=
res
.
address
;
function
(
status
,
result
)
{
_params
.
near
=
_pois
[
0
]
?
_pois
[
0
].
title
:
""
;
console
.
log
(
status
);
console
.
log
(
result
);
let
_regeocode
=
result
.
regeocode
||
{};
let
_pois
=
_regeocode
.
pois
||
[];
_params
.
address
=
_regeocode
.
formattedAddress
||
""
;
_params
.
near
=
_pois
[
0
]
?
_pois
[
0
].
name
:
""
;
let
infoWindow
=
mapService
.
createPoiMarkerInfowindow
(
_params
);
let
infoWindow
=
mapService
.
createPoiMarkerInfowindow
(
_params
);
_
this
.
poiInfoWindow
=
infoWindow
;
this
.
poiInfoWindow
=
infoWindow
;
infoWindow
.
open
(
_this
.
map
);
AMap
.
invoke
(
"mapOpenInfoWindow"
,
infoWindow
,
point
);
}
AMap
.
invoke
(
"centerAndZoom"
,
point
,
14
)
);
}
);
},
},
// 设置poi信息
// 设置poi信息
...
@@ -439,8 +434,8 @@ export default {
...
@@ -439,8 +434,8 @@ export default {
let _InfoWindow = this.poiInfoWindow;
let _InfoWindow = this.poiInfoWindow;
// id不存在,临时的poi点,删除marker就行了
// id不存在,临时的poi点,删除marker就行了
if (!row.id) {
if (!row.id) {
_map.remove(_this.poiMarker);
AMap.invoke('removeOverlay', _this.poiMarker)
_InfoWindow &&
_InfoWindow.close(
);
_InfoWindow &&
AMap.invoke('mapCloseInfoWindow', _InfoWindow
);
_this.form = {};
_this.form = {};
setTimeout(function () {
setTimeout(function () {
_this.$refs.poiForm.clearValidate();
_this.$refs.poiForm.clearValidate();
...
@@ -451,8 +446,8 @@ export default {
...
@@ -451,8 +446,8 @@ export default {
DELETE_POI_INFO(_params).then((res) => {
DELETE_POI_INFO(_params).then((res) => {
if (res.code == 200) {
if (res.code == 200) {
let _marker = _this.markerList[row.id];
let _marker = _this.markerList[row.id];
_map.remove(_marker);
AMap.invoke('removeOverlay', _marker)
_InfoWindow &&
_InfoWindow.close(
);
_InfoWindow &&
AMap.invoke('mapCloseInfoWindow', _InfoWindow
);
showToast({
showToast({
message: "删除成功",
message: "删除成功",
type: "success",
type: "success",
...
@@ -473,13 +468,12 @@ export default {
...
@@ -473,13 +468,12 @@ export default {
if (res.code == 200) {
if (res.code == 200) {
let _list = res.data || [];
let _list = res.data || [];
_this.addMassMarkers(_list);
_this.addMassMarkers(_list);
// 编辑页面
// 编辑页面
if (_query.id) {
if (_query.id) {
_this.getInfo();
_this.getInfo();
}
}
_this.trackList = res.data || [];
_this.trackList = res.data || [];
_this.showRoadTitle();
//
_this.showRoadTitle();
}
}
});
});
},
},
...
@@ -526,7 +520,8 @@ export default {
...
@@ -526,7 +520,8 @@ export default {
if (_map) {
if (_map) {
console.log(lng, lat);
console.log(lng, lat);
setTimeout(function () {
setTimeout(function () {
_map.setCenter([lng, lat]);
let lnglatXY = mapService.getLngLat(lng, lat);
AMap.invoke('panTo',lnglatXY)
}, 1000);
}, 1000);
}
}
},
},
...
...
src/pages/monitor/editFence.vue
View file @
be63bde
<
template
>
<
template
>
<!-- 线路弹框 -->
<!-- 线路弹框 -->
<!--
<el-dialog
id=
"fenceModal"
:visible=
"fenceModalVisible"
@
open=
"openDialog"
@
close=
"closeDialog"
append-to-body
width=
"800px"
>
-->
<!--
<el-dialog
id=
"fenceModal"
:visible=
"fenceModalVisible"
@
open=
"openDialog"
@
close=
"closeDialog"
append-to-body
width=
"800px"
>
-->
<v-layout
>
<v-layout>
<template
slot=
"breadcrumb"
>
<template
slot=
"breadcrumb"
>
<el-breadcrumb-item>
车辆监控
</el-breadcrumb-item>
<el-breadcrumb-item>
车辆监控
</el-breadcrumb-item>
<el-breadcrumb-item
@
click=
"addMode"
>
{{
isEditMode
?
'编辑线路'
:
'新增线路'
}}
</el-breadcrumb-item>
<el-breadcrumb-item
@
click=
"addMode"
>
{{
isEditMode
?
"编辑线路"
:
"新增线路"
}}
</el-breadcrumb-item>
</
template
>
</
template
>
<
template
slot=
"main"
>
<
template
slot=
"main"
>
<!-- 线路调用地图弹框 -->
<!-- 线路调用地图弹框 -->
<div
class=
"ibox-content"
style=
"height: 500px; padding:0 20px;z-index: 100"
>
<div
class=
"ibox-content"
style=
"height: 500px; padding: 0 20px; z-index: 100"
>
<fence-map
<fence-map
:mapData=
"mapData"
:mapData=
"mapData"
@
onUpdateMapData=
"updateMapData"
@
onUpdateMapData=
"updateMapData"
...
@@ -21,8 +26,18 @@
...
@@ -21,8 +26,18 @@
<div
class=
"tab_wrap"
>
<div
class=
"tab_wrap"
>
<el-tabs
type=
"card"
v-show=
"hideTab"
>
<el-tabs
type=
"card"
v-show=
"hideTab"
>
<el-tab-pane
label=
"线路基础信息"
>
<el-tab-pane
label=
"线路基础信息"
>
<div
class=
"ibox-content scrollbar"
style=
"padding: 30px 20px; overflow-y:auto;height: 100px;"
>
<div
<el-form
ref=
"fenceForm"
:model=
"form"
:rules=
"rules"
:inline=
"false"
size=
"mini"
label-width=
"100px"
>
class=
"ibox-content scrollbar"
style=
"padding: 30px 20px; overflow-y: auto; height: 100px"
>
<el-form
ref=
"fenceForm"
:model=
"form"
:rules=
"rules"
:inline=
"false"
size=
"mini"
label-width=
"100px"
>
<el-row>
<el-row>
<!--
<el-col
:span=
"12"
>
<!--
<el-col
:span=
"12"
>
<el-form-item
label=
"线路编号"
prop=
"fenceNo"
>
<el-form-item
label=
"线路编号"
prop=
"fenceNo"
>
...
@@ -31,12 +46,18 @@
...
@@ -31,12 +46,18 @@
</el-col>
-->
</el-col>
-->
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"线路名称"
prop=
"fenceName"
>
<el-form-item
label=
"线路名称"
prop=
"fenceName"
>
<el-input
v-model
.
trim=
"form.fenceName"
maxlength=
"200"
:disabled=
"readonlyStatus"
></el-input>
<el-input
v-model
.
trim=
"form.fenceName"
maxlength=
"200"
:disabled=
"readonlyStatus"
></el-input>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"线路类型"
prop=
"bizFenceType"
>
<el-form-item
label=
"线路类型"
prop=
"bizFenceType"
>
<el-radio
value=
"12"
label=
"12"
:disabled=
"readonlyStatus"
>
试驾线路
</el-radio>
<el-radio
value=
"12"
label=
"12"
:disabled=
"readonlyStatus"
>
试驾线路
</el-radio
>
<!--
<el-radio
v-model=
"form.bizFenceType"
:label=
"1"
:disabled=
"isEditMode"
>
试乘试驾型
</el-radio>
-->
<!--
<el-radio
v-model=
"form.bizFenceType"
:label=
"1"
:disabled=
"isEditMode"
>
试乘试驾型
</el-radio>
-->
</el-form-item>
</el-form-item>
</el-col>
</el-col>
...
@@ -44,15 +65,27 @@
...
@@ -44,15 +65,27 @@
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"区域类型"
prop=
"shapeType"
>
<el-form-item
label=
"区域类型"
prop=
"shapeType"
>
<el-radio-group
v-model=
"form.shapeType"
@
change=
"shapeTypeChange"
>
<el-radio-group
v-model=
"form.shapeType"
@
change=
"shapeTypeChange"
>
<!--
<el-radio-button
label=
"4"
value=
"4"
>
行政区域
</el-radio-button>
-->
<!--
<el-radio-button
label=
"4"
value=
"4"
>
行政区域
</el-radio-button>
-->
<!--
<el-radio-button
label=
"1"
value=
"1"
:disabled=
"readonlyStatus"
>
圆形
</el-radio-button>
-->
<!--
<el-radio-button
label=
"1"
value=
"1"
:disabled=
"readonlyStatus"
>
圆形
</el-radio-button>
-->
<el-radio-button
label=
"3"
value=
"3"
:disabled=
"readonlyStatus"
>
多边形
</el-radio-button>
<el-radio-button
label=
"3"
value=
"3"
:disabled=
"readonlyStatus"
>
多边形
</el-radio-button
>
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
class=
"special-shop-input"
label=
"特约店"
prop=
"specialShop"
>
<el-form-item
class=
"special-shop-input"
label=
"特约店"
prop=
"specialShop"
>
<!--
<el-cascader
<!--
<el-cascader
v-model=
"form.specialShopName"
v-model=
"form.specialShopName"
:value=
"form.specialShopName"
:value=
"form.specialShopName"
...
@@ -69,21 +102,39 @@
...
@@ -69,21 +102,39 @@
placement=
"top-end"
placement=
"top-end"
width=
"400"
width=
"400"
@
show=
"selectStore"
@
show=
"selectStore"
trigger=
"click"
>
trigger=
"click"
>
<div
v-loading=
"loading"
>
<div
v-loading=
"loading"
>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
size=
"small"
>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
size=
"small"
>
</el-input>
</el-input>
<el-tree
style=
"max-height:50vh;overflow:auto"
class=
"filter-tree"
:data=
"filterTextData"
:filter-node-method=
"filterNode"
highlight-current
ref=
"tree"
node-key=
"id"
check-on-click-node
>
<el-tree
style=
"max-height: 50vh; overflow: auto"
class=
"filter-tree"
:data=
"filterTextData"
:filter-node-method=
"filterNode"
highlight-current
ref=
"tree"
node-key=
"id"
check-on-click-node
>
</el-tree>
</el-tree>
<p
style=
"text-align: right; margin-top: 10px"
>
<p
style=
"text-align: right; margin-top: 10px"
>
<el-button
@
click=
"filterConfirm"
type=
"primary"
>
确定
</el-button>
<el-button
@
click=
"filterConfirm"
type=
"primary"
>
确定
</el-button
>
<el-button
@
click=
"closeFilter"
>
取消
</el-button>
<el-button
@
click=
"closeFilter"
>
取消
</el-button>
</p>
</p>
</div>
</div>
<el-input
<el-input
v-model=
"form.specialShopName"
v-model=
"form.specialShopName"
:placeholder=
"form.specialShopName || '请选择特约店名称'"
:placeholder=
"
form.specialShopName || '请选择特约店名称'
"
slot=
"reference"
slot=
"reference"
>
>
</el-input>
</el-input>
...
@@ -203,7 +254,9 @@
...
@@ -203,7 +254,9 @@
</el-col>
-->
</el-col>
-->
<!-- </div> -->
<!-- </div> -->
<div
class=
"tab-content shape_tip"
v-show=
"form.shapeType==3"
>
*注:地图任意位置,单击新增双击结束绘制。
</div>
<div
class=
"tab-content shape_tip"
v-show=
"form.shapeType == 3"
>
*注:地图任意位置,单击新增双击结束绘制。
</div>
<!-- </el-col> -->
<!-- </el-col> -->
<!-- <el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="短信通知" prop="msgtel">
<el-form-item label="短信通知" prop="msgtel">
...
@@ -217,9 +270,16 @@
...
@@ -217,9 +270,16 @@
</el-form>
</el-form>
</div>
</div>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"关联对象"
v-loadmore=
'loadMore'
>
<el-tab-pane
label=
"关联对象"
v-loadmore=
"loadMore"
>
<div
style=
"float: right;"
>
<div
style=
"float: right"
>
<el-button
v-if=
"!readonlyStatus"
type=
"primary"
@
click=
"userDate"
size=
"small"
:loading=
"submitting"
>
关联用户
</el-button>
<el-button
v-if=
"!readonlyStatus"
type=
"primary"
@
click=
"userDate"
size=
"small"
:loading=
"submitting"
>
关联用户
</el-button
>
<!-- <el-button size="small" @click="deleteFenceModel">批量删除</el-button> -->
<!-- <el-button size="small" @click="deleteFenceModel">批量删除</el-button> -->
</div>
</div>
<el-table
<el-table
...
@@ -228,27 +288,57 @@
...
@@ -228,27 +288,57 @@
height=
"300"
height=
"300"
size=
"small"
size=
"small"
v-loading=
"loading"
v-loading=
"loading"
@
selection-change=
"selectChange"
@
selection-change=
"selectChange"
style=
"width: 100%;margin-bottom:40px"
>
style=
"width: 100%; margin-bottom: 40px"
<el-table-column
:disabled=
"readonlyStatus"
type=
"selection"
width=
"40"
align=
"center"
></el-table-column>
>
<el-table-column
fixed
type=
"index"
label=
"序号"
:index=
"getIndex"
align=
"center"
width=
"70"
></el-table-column>
<el-table-column
:disabled=
"readonlyStatus"
<el-table-column
fixed
prop=
"name"
label=
"姓名"
min-width=
"80"
align=
"center"
></el-table-column>
type=
"selection"
<el-table-column
fixed
prop=
"vin"
label=
"车架号"
min-width=
"160"
align=
"center"
></el-table-column>
width=
"40"
align=
"center"
<el-table-column
prop=
"sn"
label=
"设备号"
min-width=
"160"
align=
"center"
>
></el-table-column>
<el-table-column
fixed
type=
"index"
label=
"序号"
:index=
"getIndex"
align=
"center"
width=
"70"
></el-table-column>
<el-table-column
fixed
prop=
"name"
label=
"姓名"
min-width=
"80"
align=
"center"
></el-table-column>
<el-table-column
fixed
prop=
"vin"
label=
"车架号"
min-width=
"160"
align=
"center"
></el-table-column>
<el-table-column
prop=
"sn"
label=
"设备号"
min-width=
"160"
align=
"center"
>
</el-table-column>
</el-table-column>
<!-- <el-table-column prop="gpsTime" label="GPS时间" min-width="100" align="center">
<!-- <el-table-column prop="gpsTime" label="GPS时间" min-width="100" align="center">
</el-table-column>
</el-table-column>
<el-table-column prop="address" label="位置" min-width="200" align="center"></el-table-column> -->
<el-table-column prop="address" label="位置" min-width="200" align="center"></el-table-column> -->
<el-table-column
prop=
"userTel"
label=
"联系方式"
min-width=
"100"
align=
"center"
></el-table-column>
<el-table-column
prop=
"userTel"
label=
"联系方式"
min-width=
"100"
align=
"center"
></el-table-column>
</el-table>
</el-table>
</el-tab-pane>
</el-tab-pane>
</el-tabs>
</el-tabs>
...
@@ -258,18 +348,26 @@
...
@@ -258,18 +348,26 @@
</div> -->
</div> -->
</div>
</div>
<div
class=
"fenceModalfooter"
>
<div
class=
"fenceModalfooter"
>
<el-button
v-if=
"!readonlyStatus"
type=
"primary"
@
click=
"saveFence"
size=
"small"
:loading=
"submitting"
>
{{btnText}}
</el-button>
<el-button
v-if=
"!readonlyStatus"
type=
"primary"
@
click=
"saveFence"
size=
"small"
:loading=
"submitting"
>
{{ btnText }}
</el-button
>
<el-button
@
click=
"cancel"
size=
"small"
>
取消
</el-button>
<el-button
@
click=
"cancel"
size=
"small"
>
取消
</el-button>
</div>
</div>
<user-list
<user-list
:init=
"userListInit"
:init=
"userListInit"
@
onUserListInit=
"(res)=>userListInit=res
"
@
onUserListInit=
"(res) => (userListInit = res)
"
:userData=
"userArr"
:userData=
"userArr"
@
onUpdateUserData=
"updateUserData"
@
onUpdateUserData=
"updateUserData"
:userListModalVisible=
"userListModalVisible"
:userListModalVisible=
"userListModalVisible"
:shopId=
"form.specialShopId"
:shopId=
"form.specialShopId"
@
onUserListModalChange=
"userListModalChange"
@
onUserListModalChange=
"userListModalChange"
ref=
"userList"
>
ref=
"userList"
>
</user-list>
</user-list>
</template>
</template>
<!-- </el-dialog> -->
<!-- </el-dialog> -->
...
@@ -277,19 +375,22 @@
...
@@ -277,19 +375,22 @@
</v-layout>
</v-layout>
</template>
</template>
<
script
>
<
script
>
import
{
services
}
from
'../../api'
import
{
services
}
from
"../../api"
;
import
AreaSelect
from
'./AreaSelect.vue'
import
AreaSelect
from
"./AreaSelect.vue"
;
import
mapService
from
'utils/mapService.js'
import
mapService
from
"utils/mapBService.js"
;
import
fenceMap
from
'./fenceMap.vue'
import
fenceMap
from
"./fenceMap.vue"
;
import
userList
from
'./userList.vue'
import
userList
from
"./userList.vue"
;
import
InfiniteLoading
from
'vue-infinite-loading'
;
import
InfiniteLoading
from
"vue-infinite-loading"
;
const
MONITOR_SERVICE
=
services
.
monitor
;
const
MONITOR_SERVICE
=
services
.
monitor
;
export
default
{
export
default
{
props
:
[
'fenceModalVisible'
,
'fenceId'
],
props
:
[
"fenceModalVisible"
,
"fenceId"
],
data
(){
data
()
{
let
checkFenceName
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkFenceName
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
typeof
this
.
restainFenceName
!=
'undefined'
&&
this
.
form
.
fenceName
===
this
.
restainFenceName
){
if
(
typeof
this
.
restainFenceName
!=
"undefined"
&&
this
.
form
.
fenceName
===
this
.
restainFenceName
)
{
cb
();
cb
();
}
}
// MONITOR_SERVICE.checkFenceName({name: this.form.fenceName}).then((res)=>{
// MONITOR_SERVICE.checkFenceName({name: this.form.fenceName}).then((res)=>{
...
@@ -301,48 +402,58 @@ export default{
...
@@ -301,48 +402,58 @@ export default{
// }
// }
// }
// }
// })
// })
}
};
let
checkMonitorTime
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkMonitorTime
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
electricTimeFenceType
==
""
)
{
if
(
this
.
form
.
electricTimeFenceType
==
""
)
{
cb
(
new
Error
(
'请选择监控时间'
))
cb
(
new
Error
(
"请选择监控时间"
));
}
else
{
}
else
{
cb
();
cb
();
}
}
}
};
let
checkSpecialShop
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkSpecialShop
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
specialShopId
==
""
)
{
if
(
this
.
form
.
specialShopId
==
""
)
{
cb
(
new
Error
(
'请选择特约店'
))
cb
(
new
Error
(
"请选择特约店"
));
}
else
{
}
else
{
cb
();
cb
();
}
}
}
};
let
checkArea
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkArea
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
1
&&
!
this
.
form
.
areaCode
)
{
if
(
this
.
form
.
shapeType
==
1
&&
!
this
.
form
.
areaCode
)
{
cb
(
new
Error
(
'请选择行政区域'
))
cb
(
new
Error
(
"请选择行政区域"
));
}
else
{
}
else
{
cb
();
cb
();
}
}
}
};
let
checkLng
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkLng
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
2
&&
!
/^
(\+
|-
)?(?:
180
(?:(?:\.
0
{1,6})?)
|
(?:[
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-7
][
0-9
])(?:(?:\.[
0-9
]{1,6})?))
$/
.
test
(
this
.
form
.
lng
)){
if
(
cb
(
new
Error
(
'请输入正确的格式'
))
this
.
form
.
shapeType
==
2
&&
}
else
{
!
/^
(\+
|-
)?(?:
180
(?:(?:\.
0
{1,6})?)
|
(?:[
0-9
]
|
[
1-9
][
0-9
]
|1
[
0-7
][
0-9
])(?:(?:\.[
0-9
]{1,6})?))
$/
.
test
(
this
.
form
.
lng
)
)
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
cb
();
cb
();
}
}
}
};
let
checkLat
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkLat
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
2
&&
!
/^
(\+
|-
)?(?:
90
(?:(?:\.
0
{1,6})?)
|
(?:[
0-9
]
|
[
1-8
][
0-9
])(?:(?:\.[
0-9
]{1,6})?))
$/
.
test
(
this
.
form
.
lat
)){
if
(
cb
(
new
Error
(
'请输入正确的格式'
))
this
.
form
.
shapeType
==
2
&&
}
else
{
!
/^
(\+
|-
)?(?:
90
(?:(?:\.
0
{1,6})?)
|
(?:[
0-9
]
|
[
1-8
][
0-9
])(?:(?:\.[
0-9
]{1,6})?))
$/
.
test
(
this
.
form
.
lat
)
)
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
cb
();
cb
();
}
}
}
};
let
checkTransferAddr
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkTransferAddr
=
(
rule
,
vaule
,
cb
)
=>
{
/*if(this.form.shapeType == 2){
/*if(this.form.shapeType == 2){
if(this.transferError){
if(this.transferError){
cb(new Error('所填经纬度不能正确解析地址,请重新输入'))
cb(new Error('所填经纬度不能正确解析地址,请重新输入'))
...
@@ -352,53 +463,52 @@ export default{
...
@@ -352,53 +463,52 @@ export default{
}else{
}else{
cb();
cb();
}*/
}*/
if
(
this
.
form
.
shapeType
==
1
)
{
if
(
this
.
form
.
shapeType
==
1
)
{
if
(
this
.
transferError
)
{
if
(
this
.
transferError
)
{
cb
(
new
Error
(
'所填经纬度不能正确解析地址,请重新输入'
));
cb
(
new
Error
(
"所填经纬度不能正确解析地址,请重新输入"
));
}
else
{
}
else
{
cb
();
cb
();
}
}
}
else
{
}
else
{
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
();
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
();
}
}
let
checkDaterange
=
(
rule
,
vaule
,
cb
)
=>
{
};
let
checkDaterange
=
(
rule
,
vaule
,
cb
)
=>
{
const
dateRange
=
this
.
form
.
dateRange
;
const
dateRange
=
this
.
form
.
dateRange
;
if
(
!
dateRange
||
!
dateRange
.
length
)
{
if
(
!
dateRange
||
!
dateRange
.
length
)
{
cb
(
new
Error
(
'请选择日期'
))
cb
(
new
Error
(
"请选择日期"
));
}
else
{
}
else
{
let
min
=
dateRange
[
0
];
let
min
=
dateRange
[
0
];
let
max
=
dateRange
[
1
];
let
max
=
dateRange
[
1
];
if
(
!
moment
.
isMoment
(
min
))
{
if
(
!
moment
.
isMoment
(
min
))
{
min
=
moment
(
min
)
min
=
moment
(
min
);
}
}
if
(
!
moment
.
isMoment
(
max
))
{
if
(
!
moment
.
isMoment
(
max
))
{
max
=
moment
(
max
)
max
=
moment
(
max
);
}
}
if
(
min
.
isBefore
(
moment
(
max
).
subtract
(
30
*
6
,
'days'
),
'minute'
)){
if
(
min
.
isBefore
(
moment
(
max
).
subtract
(
30
*
6
,
"days"
),
"minute"
))
{
cb
(
new
Error
(
'日期范围不能超过180天'
))
cb
(
new
Error
(
"日期范围不能超过180天"
));
}
}
}
cb
()
}
}
let
checkMsgtel
=
(
rule
,
vaule
,
cb
)
=>
{
cb
();
if
(
this
.
form
.
msgtel
&&
!
/^1
\d{10}(\,
1
\d{10})?
$/
.
test
(
this
.
form
.
msgtel
)){
};
cb
(
new
Error
(
'请输入正确的格式'
))
let
checkMsgtel
=
(
rule
,
vaule
,
cb
)
=>
{
}
else
{
if
(
this
.
form
.
msgtel
&&
!
/^1
\d{10}(\,
1
\d{10})?
$/
.
test
(
this
.
form
.
msgtel
))
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
cb
();
cb
();
}
}
}
};
/*let checkMap = (rule, vaule, cb)=>{
/*let checkMap = (rule, vaule, cb)=>{
if(this.form.shapeType == 2 && !this.mapData.lng && !this.mapData.lat && !this.mapData.radius && !this.mapData.address){
if(this.form.shapeType == 2 && !this.mapData.lng && !this.mapData.lat && !this.mapData.radius && !this.mapData.address){
cb(new Error('请打开地图自定义设置'))
cb(new Error('请打开地图自定义设置'))
...
@@ -407,91 +517,94 @@ export default{
...
@@ -407,91 +517,94 @@ export default{
}
}
} */
} */
return
{
return
{
scrollToRef
:
''
,
scrollToRef
:
""
,
tableData
:
[],
tableData
:
[],
//dateRange: [],
//dateRange: [],
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
10
,
pageSize
:
10
,
maxPage
:
1
,
maxPage
:
1
,
submitting
:
false
,
submitting
:
false
,
userArr
:
[],
userArr
:
[],
userData
:
[],
userData
:
[],
areaString
:
''
,
areaString
:
""
,
hideTab
:
true
,
hideTab
:
true
,
needInfinite
:
false
,
needInfinite
:
false
,
fenceMapModalVisible
:
false
,
fenceMapModalVisible
:
false
,
areaCode
:
null
,
areaCode
:
null
,
btnText
:
'保存'
,
btnText
:
"保存"
,
specialShopOptions
:
[],
specialShopOptions
:
[],
specialShopDefaultProps
:
{
specialShopDefaultProps
:
{
children
:
'children'
,
children
:
"children"
,
label
:
'label'
,
label
:
"label"
,
value
:
'id'
value
:
"id"
,
},
},
readonlyStatus
:
false
,
readonlyStatus
:
false
,
form
:
{
form
:
{
fenceName
:
''
,
fenceName
:
""
,
bizFenceType
:
'12'
,
bizFenceType
:
"12"
,
shapeType
:
3
,
shapeType
:
3
,
specialShopId
:
''
,
specialShopId
:
""
,
specialShopName
:
''
,
specialShopName
:
""
,
// fenceNo: '',
// fenceNo: '',
electricFenceType
:
1
,
electricFenceType
:
1
,
startTime
:
''
,
startTime
:
""
,
endTime
:
''
,
endTime
:
""
,
des
:
''
,
des
:
""
,
areaCode
:
''
,
areaCode
:
""
,
analysisAddress
:
''
,
analysisAddress
:
""
,
lng
:
''
,
lng
:
""
,
lat
:
''
,
lat
:
""
,
radius
:
1000
,
radius
:
1000
,
status
:
1
,
status
:
1
,
transferError
:
false
,
transferError
:
false
,
timeType
:
2
,
timeType
:
2
,
electricTimeFenceType
:
''
,
electricTimeFenceType
:
""
,
electricTimeFenceTypes
:
[
electricTimeFenceTypes
:
[
{
{
value
:
1
,
value
:
1
,
label
:
'1个月'
label
:
"1个月"
,
},
{
},
{
value
:
2
,
value
:
2
,
label
:
'2个月'
label
:
"2个月"
,
},
{
},
{
value
:
3
,
value
:
3
,
label
:
'3个月'
label
:
"3个月"
,
},
{
},
{
value
:
4
,
value
:
4
,
label
:
'4个月'
label
:
"4个月"
,
},
{
},
{
value
:
5
,
value
:
5
,
label
:
'5个月'
label
:
"5个月"
,
},
{
},
{
value
:
6
,
value
:
6
,
label
:
'6个月'
label
:
"6个月"
,
}
},
],
],
dateRange
:
[],
dateRange
:
[],
msgtel
:
''
msgtel
:
""
,
},
},
restainFenceName
:
''
,
restainFenceName
:
""
,
rules
:
{
rules
:
{
// fenceNo: [
// fenceNo: [
// {required: true, message: '线路编号不能为空', trigger: 'blur'},
// {required: true, message: '线路编号不能为空', trigger: 'blur'},
// ],
// ],
fenceName
:
[
fenceName
:
[
{
required
:
true
,
message
:
'请输入线路名称'
,
trigger
:
'blur'
},
{
required
:
true
,
message
:
"请输入线路名称"
,
trigger
:
"blur"
},
{
pattern
:
/^
\S{2,200}
$/
,
message
:
'至少2字'
,
trigger
:
'blur'
},
{
pattern
:
/^
\S{2,200}
$/
,
message
:
"至少2字"
,
trigger
:
"blur"
},
// {validator: checkFenceName, trigger: 'blur'}
// {validator: checkFenceName, trigger: 'blur'}
],
],
bizFenceType
:
[
bizFenceType
:
[
{
required
:
true
,
message
:
'请选择线路类型'
,
trigger
:
'change'
}
{
required
:
true
,
message
:
"请选择线路类型"
,
trigger
:
"change"
},
],
],
specialShop
:
[
specialShop
:
[
{
required
:
true
,
validator
:
checkSpecialShop
,
trigger
:
'change'
}
{
required
:
true
,
validator
:
checkSpecialShop
,
trigger
:
"change"
},
],
],
shapeType
:
[
shapeType
:
[{
required
:
true
}],
{
required
:
true
}
]
// electricFenceType: [
// electricFenceType: [
// {required: true, message: '', trigger: 'blur'}
// {required: true, message: '', trigger: 'blur'}
// ],
// ],
...
@@ -530,7 +643,7 @@ export default{
...
@@ -530,7 +643,7 @@ export default{
geocoder
:
null
,
geocoder
:
null
,
transferFlag
:
null
,
transferFlag
:
null
,
transferError
:
false
,
transferError
:
false
,
userListModalVisible
:
false
,
userListModalVisible
:
false
,
selectedIds
:
[],
selectedIds
:
[],
mapData
:
null
,
mapData
:
null
,
polygonPath
:
[],
polygonPath
:
[],
...
@@ -546,7 +659,7 @@ export default{
...
@@ -546,7 +659,7 @@ export default{
// ["113.99274", "22.586622"],
// ["113.99274", "22.586622"],
// ["113.99008", "22.585592"]
// ["113.99008", "22.585592"]
// ]
// ]
}
};
},
},
watch
:
{
watch
:
{
...
@@ -559,52 +672,48 @@ export default{
...
@@ -559,52 +672,48 @@ export default{
this.form.endTime = '';
this.form.endTime = '';
}
}
},*/
},*/
lng
(
newVal
)
{
lng
(
newVal
)
{
//this.transfer()
//this.transfer()
},
},
lat
(
newVal
)
{
lat
(
newVal
)
{
//this.transfer()
//this.transfer()
},
},
filterText
(
val
)
{
filterText
(
val
)
{
this
.
_timeout
&&
clearTimeout
(
this
.
_timeout
);
this
.
_timeout
&&
clearTimeout
(
this
.
_timeout
)
this
.
_timeout
=
setTimeout
(()
=>
{
this
.
_timeout
=
setTimeout
(()
=>
{
this
.
$refs
.
tree
.
filter
(
val
);
this
.
$refs
.
tree
.
filter
(
val
)
},
500
);
},
500
)
},
}
},
},
computed
:
{
computed
:
{
isEditMode
:{
isEditMode
:
{
get
(){
get
()
{
return
typeof
this
.
fenceId
!=
'undefined'
return
typeof
this
.
fenceId
!=
"undefined"
;
}
},
}
},
},
},
created
()
{
created
()
{
let
_this
=
this
;
let
_this
=
this
;
//this.getFenceSnsList();
//this.getFenceSnsList();
//this.getSpecialShopList();
//this.getSpecialShopList();
window
.
Vue
.
directive
(
'loadmore'
,
{
window
.
Vue
.
directive
(
"loadmore"
,
{
bind
(
el
,
binding
)
{
bind
(
el
,
binding
)
{
const
selectWrap
=
el
.
querySelector
(
'.el-table__body-wrapper'
)
const
selectWrap
=
el
.
querySelector
(
".el-table__body-wrapper"
);
selectWrap
.
addEventListener
(
'scroll'
,
function
()
{
selectWrap
.
addEventListener
(
"scroll"
,
function
()
{
let
sign
=
0
let
sign
=
0
;
const
scrollDistance
=
this
.
scrollHeight
-
this
.
scrollTop
-
this
.
clientHeight
const
scrollDistance
=
this
.
scrollHeight
-
this
.
scrollTop
-
this
.
clientHeight
;
if
(
scrollDistance
==
sign
)
{
if
(
scrollDistance
==
sign
)
{
//binding.value()
//binding.value()
//console.log(sign)
//console.log(sign)
// _this.currentPage++;
// _this.currentPage++;
// _this.getFenceSnsList(_this.fenceId);
// _this.getFenceSnsList(_this.fenceId);
}
}
})
});
}
},
})
});
this
.
getStoreList
()
this
.
getStoreList
();
},
},
mounted
()
{
mounted
()
{
this
.
listener
();
this
.
listener
();
...
@@ -614,7 +723,7 @@ export default{
...
@@ -614,7 +723,7 @@ export default{
if
(
this
.
isReadonly
)
return
;
if
(
this
.
isReadonly
)
return
;
this
.
filterText
=
""
;
this
.
filterText
=
""
;
this
.
filterDialogTitle
=
"选择所属组织"
;
this
.
filterDialogTitle
=
"选择所属组织"
;
if
(
!
this
.
filterTextData
.
length
)
{
if
(
!
this
.
filterTextData
.
length
)
{
this
.
getStoreList
();
this
.
getStoreList
();
}
}
...
@@ -627,7 +736,7 @@ export default{
...
@@ -627,7 +736,7 @@ export default{
getStoreList
()
{
getStoreList
()
{
let
_this
=
this
;
let
_this
=
this
;
_this
.
loading
=
true
;
_this
.
loading
=
true
;
MONITOR_SERVICE
.
getOrgTree
({
hasUserLeaf
:
true
}).
then
((
res
)
=>
{
MONITOR_SERVICE
.
getOrgTree
({
hasUserLeaf
:
true
}).
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
const
{
code
,
data
}
=
res
;
_this
.
loading
=
false
;
_this
.
loading
=
false
;
if
(
code
==
200
)
{
if
(
code
==
200
)
{
...
@@ -637,15 +746,15 @@ export default{
...
@@ -637,15 +746,15 @@ export default{
},
},
filterConfirm
()
{
filterConfirm
()
{
const
{
label
,
id
,
origin
}
=
this
.
$refs
.
tree
.
getCurrentNode
();
const
{
label
,
id
,
origin
}
=
this
.
$refs
.
tree
.
getCurrentNode
();
if
(
origin
.
type
!=
'u'
)
{
if
(
origin
.
type
!=
"u"
)
{
this
.
$message
({
this
.
$message
({
message
:
"请选择下级所属组织"
,
message
:
"请选择下级所属组织"
,
type
:
"error"
,
type
:
"error"
,
});
});
return
;
return
;
}
}
this
.
form
.
specialShopName
=
label
.
split
(
'/'
)[
1
]
this
.
form
.
specialShopName
=
label
.
split
(
"/"
)[
1
];
this
.
form
.
specialShopCode
=
label
.
split
(
'/'
)[
0
]
this
.
form
.
specialShopCode
=
label
.
split
(
"/"
)[
0
];
//this.$set(this, "form.specialShopName", label);
//this.$set(this, "form.specialShopName", label);
this
.
form
.
specialShopId
=
id
;
this
.
form
.
specialShopId
=
id
;
this
.
closeFilter
();
this
.
closeFilter
();
...
@@ -657,26 +766,28 @@ export default{
...
@@ -657,26 +766,28 @@ export default{
},
},
listener
()
{
listener
()
{
const
state
=
history
.
state
;
const
state
=
history
.
state
;
if
(
!
state
)
{
if
(
!
state
)
{
this
.
init
(
null
);
this
.
init
(
null
);
return
;
return
;
}
}
const
{
fenceId
,
readonlyStatus
,
btnRemark
}
=
state
;
const
{
fenceId
,
readonlyStatus
,
btnRemark
}
=
state
;
if
(
readonlyStatus
)
{
if
(
readonlyStatus
)
{
this
.
readonlyStatus
=
readonlyStatus
;
this
.
readonlyStatus
=
readonlyStatus
;
this
.
fenceId
=
fenceId
;
this
.
fenceId
=
fenceId
;
}
}
this
.
init
(
btnRemark
);
this
.
init
(
btnRemark
);
},
},
init
(
btnRemark
)
{
init
(
btnRemark
)
{
const
{
id
,
btnText
}
=
this
.
$route
.
query
;
const
{
id
,
btnText
}
=
this
.
$route
.
query
;
if
(
id
)
{
if
(
id
)
{
this
.
fenceId
=
id
;
this
.
fenceId
=
id
;
this
.
btnText
=
btnText
;
this
.
btnText
=
btnText
;
}
}
if
(
typeof
this
.
fenceId
!=
'undefined'
){
if
(
typeof
this
.
fenceId
!=
"undefined"
)
{
btnRemark
===
'viewUpdated'
?
this
.
getUpdatedFenceDetail
(
this
.
fenceId
)
:
this
.
getFenceDetail
(
this
.
fenceId
);;
btnRemark
===
"viewUpdated"
}
else
{
?
this
.
getUpdatedFenceDetail
(
this
.
fenceId
)
:
this
.
getFenceDetail
(
this
.
fenceId
);
}
else
{
// 线路编号无意义 屏蔽
// 线路编号无意义 屏蔽
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// if(res.returnCode == 0){
// if(res.returnCode == 0){
...
@@ -689,81 +800,82 @@ export default{
...
@@ -689,81 +800,82 @@ export default{
// });
// });
this
.
$refs
.
fenceMap
.
initFence
({
this
.
$refs
.
fenceMap
.
initFence
({
fenceType
:
'polygon'
,
fenceType
:
"polygon"
,
polygonPath
:
this
.
polygonPath
polygonPath
:
this
.
polygonPath
,
});
});
this
.
restainFenceName
=
undefined
;
this
.
restainFenceName
=
undefined
;
}
}
},
},
getSpecialShopList
()
{
getSpecialShopList
()
{
MONITOR_SERVICE
.
getSpecialShopList
().
then
(
res
=>
{
MONITOR_SERVICE
.
getSpecialShopList
().
then
((
res
)
=>
{
const
{
code
,
data
}
=
res
;
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
if
(
code
==
200
)
{
this
.
specialShopOptions
=
data
;
this
.
specialShopOptions
=
data
;
}
}
})
});
},
},
getDetailData
(
res
,
id
)
{
getDetailData
(
res
,
id
)
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
const
form
=
this
.
form
;
const
form
=
this
.
form
;
const
data
=
res
.
data
;
const
data
=
res
.
data
;
for
(
let
key
in
data
)
{
for
(
let
key
in
data
)
{
form
[
key
]
=
data
[
key
]
form
[
key
]
=
data
[
key
];
}
}
this
.
form
.
shapeType
=
3
;
this
.
form
.
shapeType
=
3
;
this
.
form
.
dateRange
=
[
form
.
startTime
,
form
.
endTime
];
this
.
form
.
dateRange
=
[
form
.
startTime
,
form
.
endTime
];
this
.
areaCode
=
form
.
areaCode
this
.
areaCode
=
form
.
areaCode
;
this
.
restainFenceName
=
form
.
fenceName
;
this
.
restainFenceName
=
form
.
fenceName
;
this
.
form
.
fenceName
=
form
.
fenceName
;
this
.
form
.
fenceName
=
form
.
fenceName
;
this
.
form
.
msgtel
=
data
.
telNumbers
;
this
.
form
.
msgtel
=
data
.
telNumbers
;
this
.
form
.
specialShopId
=
data
.
shopId
;
this
.
form
.
specialShopId
=
data
.
shopId
;
this
.
form
.
specialShopName
=
data
.
shopName
;
this
.
form
.
specialShopName
=
data
.
shopName
;
this
.
form
.
specialShopCode
=
data
.
shopCode
;
this
.
form
.
specialShopCode
=
data
.
shopCode
;
this
.
getFenceSnsList
(
id
,
''
,
data
.
snList
)
this
.
getFenceSnsList
(
id
,
""
,
data
.
snList
);
if
(
form
.
shapeType
===
1
)
{
if
(
form
.
shapeType
===
1
)
{
this
.
mapData
=
{
this
.
mapData
=
{
fenceType
:
'circle'
,
fenceType
:
"circle"
,
lng
:
form
.
lng
,
lng
:
form
.
lng
,
lat
:
form
.
lat
,
lat
:
form
.
lat
,
radius
:
form
.
radius
,
radius
:
form
.
radius
,
}
};
}
else
if
(
form
.
shapeType
===
4
)
{
}
else
if
(
form
.
shapeType
===
4
)
{
this
.
mapData
=
{
this
.
mapData
=
{
fenceType
:
'area'
,
fenceType
:
"area"
,
areaCode
:
this
.
form
.
areaCode
areaCode
:
this
.
form
.
areaCode
,
}
};
}
else
if
(
form
.
shapeType
===
3
){
}
else
if
(
form
.
shapeType
===
3
)
{
if
(
data
.
lnglat
){
if
(
data
.
lnglat
)
{
this
.
polygonPath
=
data
.
lnglat
.
split
(
'|'
).
map
((
item
)
=>
{
this
.
polygonPath
=
data
.
lnglat
.
split
(
"|"
).
map
((
item
)
=>
{
return
[
item
.
split
(
','
)[
0
],
item
.
split
(
','
)[
1
]]
let
arr
=
item
.
split
(
","
);
})
console
.
log
(
arr
);
return
mapService
.
getLngLat
(
arr
[
0
],
arr
[
1
]);
});
}
}
console
.
log
(
this
.
polygonPath
)
this
.
mapData
=
{
this
.
mapData
=
{
fenceType
:
'polygon'
,
fenceType
:
"polygon"
,
polygonPath
:
this
.
polygonPath
polygonPath
:
this
.
polygonPath
,
}
};
}
}
this
.
$refs
.
fenceMap
.
initFence
(
this
.
mapData
);
this
.
$refs
.
fenceMap
.
initFence
(
this
.
mapData
);
}
}
},
},
getFenceDetail
(
id
)
{
getFenceDetail
(
id
)
{
MONITOR_SERVICE
.
getFenceDetailById
({
fenceId
:
id
}).
then
((
res
)
=>
{
MONITOR_SERVICE
.
getFenceDetailById
({
fenceId
:
id
}).
then
((
res
)
=>
{
this
.
getDetailData
(
res
,
id
);
this
.
getDetailData
(
res
,
id
);
});
});
},
},
getUpdatedFenceDetail
(
id
)
{
getUpdatedFenceDetail
(
id
)
{
MONITOR_SERVICE
.
getUpdatedFenceDetail
({
fenceId
:
id
}).
then
((
res
)
=>
{
MONITOR_SERVICE
.
getUpdatedFenceDetail
({
fenceId
:
id
}).
then
((
res
)
=>
{
this
.
getDetailData
(
res
,
id
);
this
.
getDetailData
(
res
,
id
);
});
});
},
},
getFenceSnsList
(
id
,
cur
,
resData
)
{
getFenceSnsList
(
id
,
cur
,
resData
)
{
let
params
=
{};
let
params
=
{};
params
.
id
=
id
;
params
.
id
=
id
;
this
.
tableData
=
this
.
tableData
.
concat
(
resData
);
this
.
tableData
=
this
.
tableData
.
concat
(
resData
);
this
.
$refs
.
userList
.
reset
(
resData
);
this
.
$refs
.
userList
.
reset
(
resData
);
// if(this.currentPage>this.maxPage){
// if(this.currentPage>this.maxPage){
...
@@ -778,8 +890,6 @@ export default{
...
@@ -778,8 +890,6 @@ export default{
// params.pageSize = this.pageSize;
// params.pageSize = this.pageSize;
// }
// }
// params.id=id;
// params.id=id;
// MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
// MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
// if(res.c == 0){
// if(res.c == 0){
...
@@ -791,34 +901,33 @@ export default{
...
@@ -791,34 +901,33 @@ export default{
// }
// }
// });
// });
},
},
shapeTypeChange
()
{
shapeTypeChange
()
{
//console.log(this.form.shapeType)
//console.log(this.form.shapeType)
if
(
this
.
form
.
shapeType
==
4
)
{
if
(
this
.
form
.
shapeType
==
4
)
{
//this.$refs.clearArea.rest();
//this.$refs.clearArea.rest();
this
.
$refs
.
fenceForm
.
clearValidate
();
this
.
$refs
.
fenceForm
.
clearValidate
();
//this.$refs.fenceMap.updateSeach(this.form.areaCode);
//this.$refs.fenceMap.updateSeach(this.form.areaCode);
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'area'
fenceType
:
"area"
,
});
});
}
else
if
(
this
.
form
.
shapeType
==
1
)
{
}
else
if
(
this
.
form
.
shapeType
==
1
)
{
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'circle'
fenceType
:
"circle"
,
});
});
}
else
if
(
this
.
form
.
shapeType
==
3
)
{
}
else
if
(
this
.
form
.
shapeType
==
3
)
{
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'polygon'
fenceType
:
"polygon"
,
});
});
}
}
// if(val=="3"){
// if(val=="3"){
//
//
// }
// }
},
},
selectChange
(
selection
)
{
selectChange
(
selection
)
{
this
.
selectedIds
=
[];
this
.
selectedIds
=
[];
selection
.
map
((
obj
)
=>
{
selection
.
map
((
obj
)
=>
{
this
.
selectedIds
.
push
(
obj
.
id
)
this
.
selectedIds
.
push
(
obj
.
id
);
});
});
},
},
/*deleteFenceModel(id){
/*deleteFenceModel(id){
let params = {};
let params = {};
...
@@ -842,11 +951,11 @@ export default{
...
@@ -842,11 +951,11 @@ export default{
});
});
}
}
},*/
},*/
userListModalChange
(
isOpen
)
{
userListModalChange
(
isOpen
)
{
this
.
userListModalVisible
=
isOpen
;
this
.
userListModalVisible
=
isOpen
;
},
},
userDate
()
{
userDate
()
{
this
.
userListModalVisible
=
true
;
this
.
userListModalVisible
=
true
;
},
},
/*resetMapForm(){
/*resetMapForm(){
...
@@ -861,106 +970,99 @@ export default{
...
@@ -861,106 +970,99 @@ export default{
fenceMapModalChange(isOpen, mapData){
fenceMapModalChange(isOpen, mapData){
this.fenceMapModalVisible = isOpen;
this.fenceMapModalVisible = isOpen;
},*/
},*/
updateUserData
(
data
)
{
updateUserData
(
data
)
{
this
.
userArr
=
data
;
this
.
userArr
=
data
;
this
.
tableData
=
data
;
this
.
tableData
=
data
;
//console.log(data)
//console.log(data)
},
},
updateMapData
(
data
){
updateMapData
(
data
)
{
if
(
data
.
radius
)
{
if
(
data
.
radius
){
this
.
form
.
radius
=
data
.
radius
;
this
.
form
.
radius
=
data
.
radius
;
}
}
if
(
data
.
lng
&&
data
.
lat
)
{
if
(
data
.
lng
&&
data
.
lat
)
{
this
.
form
.
lng
=
data
.
lng
;
this
.
form
.
lng
=
data
.
lng
;
this
.
form
.
lat
=
data
.
lat
;
this
.
form
.
lat
=
data
.
lat
;
this
.
transfer
()
this
.
transfer
();
}
}
if
(
data
.
polygonPath
&&
data
.
polygonPath
.
length
)
{
if
(
data
.
polygonPath
&&
data
.
polygonPath
.
length
)
{
this
.
polygonPath
=
data
.
polygonPath
this
.
polygonPath
=
data
.
polygonPath
;
}
}
},
},
changeStatus
()
{
changeStatus
()
{
if
(
this
.
hideTab
==
true
)
{
if
(
this
.
hideTab
==
true
)
{
this
.
hideTab
=
false
;
this
.
hideTab
=
false
;
}
else
if
(
this
.
hideTab
==
false
)
{
}
else
if
(
this
.
hideTab
==
false
)
{
this
.
hideTab
=
true
this
.
hideTab
=
true
;
}
}
},
},
saveFence
()
{
saveFence
()
{
if
(
this
.
form
.
shapeType
==
3
)
{
if
(
this
.
form
.
shapeType
==
3
)
{
if
(
this
.
polygonPath
.
length
===
0
)
{
if
(
this
.
polygonPath
.
length
===
0
)
{
this
.
$message
({
this
.
$message
({
message
:
'请绘制线路'
,
message
:
"请绘制线路"
,
type
:
'error'
type
:
"error"
,
});
});
return
;
return
;
}
}
}
}
this
.
$refs
.
fenceForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
fenceForm
.
validate
((
valid
)
=>
{
if
(
valid
){
if
(
valid
)
{
this
.
submitting
=
true
;
this
.
submitting
=
true
;
const
params
=
this
.
getParams
();
const
params
=
this
.
getParams
();
params
.
snList
.
forEach
(
item
=>
{
params
.
snList
.
forEach
((
item
)
=>
{
if
(
item
.
sns
)
{
if
(
item
.
sns
)
{
delete
item
.
sns
;
delete
item
.
sns
;
}
}
})
});
if
(
typeof
this
.
fenceId
!=
'undefined'
)
{
if
(
typeof
this
.
fenceId
!=
"undefined"
)
{
params
.
id
=
this
.
fenceId
;
params
.
id
=
this
.
fenceId
;
MONITOR_SERVICE
.
updateFence
(
params
).
then
((
res
)
=>
{
MONITOR_SERVICE
.
updateFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
){
//this.closeDialog();
//this.closeDialog();
this
.
$message
({
this
.
$message
({
message
:
'提交成功'
,
message
:
"提交成功"
,
type
:
'success'
type
:
"success"
,
});
});
history
.
go
(
-
1
);
history
.
go
(
-
1
);
// this.$router.push({path:"fenceManagement"})
// this.$router.push({path:"fenceManagement"})
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
res
.
message
,
message
:
res
.
message
,
type
:
'error'
type
:
"error"
,
});
});
}
}
this
.
submitting
=
false
;
this
.
submitting
=
false
;
});
});
}
else
{
}
else
{
MONITOR_SERVICE
.
saveFence
(
params
).
then
((
res
)
=>
{
MONITOR_SERVICE
.
saveFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
){
//this.closeDialog();
//this.closeDialog();
this
.
$message
({
this
.
$message
({
message
:
'提交成功'
,
message
:
"提交成功"
,
type
:
'success'
type
:
"success"
,
});
});
history
.
go
(
-
1
);
history
.
go
(
-
1
);
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
res
.
message
,
message
:
res
.
message
,
type
:
'error'
type
:
"error"
,
});
});
}
}
this
.
submitting
=
false
;
this
.
submitting
=
false
;
// this.$router.push({path:"fenceManagement"})
// this.$router.push({path:"fenceManagement"})
});
});
}
}
}
else
{
}
else
{
return
false
;
return
false
;
}
}
});
});
},
},
cancel
()
{
cancel
()
{
window
.
history
.
go
(
-
1
);
window
.
history
.
go
(
-
1
);
// this.$router.push({path:"fenceManagement"})
// this.$router.push({path:"fenceManagement"})
},
},
getParams
()
{
getParams
()
{
const
form
=
this
.
form
;
const
form
=
this
.
form
;
const
params
=
{};
const
params
=
{};
...
@@ -974,37 +1076,39 @@ export default{
...
@@ -974,37 +1076,39 @@ export default{
// params.des = form.des;
// params.des = form.des;
params
.
shapeType
=
form
.
shapeType
;
params
.
shapeType
=
form
.
shapeType
;
params
.
timeType
=
form
.
timeType
;
params
.
timeType
=
form
.
timeType
;
if
(
params
.
shapeType
==
4
)
{
if
(
params
.
shapeType
==
4
)
{
params
.
areaCode
=
form
.
areaCode
;
params
.
areaCode
=
form
.
areaCode
;
params
.
areaString
=
form
.
areaString
;
params
.
areaString
=
form
.
areaString
;
}
else
if
(
params
.
shapeType
==
1
)
{
}
else
if
(
params
.
shapeType
==
1
)
{
params
.
lnglat
=
`
${
form
.
lng
}
,
${
form
.
lat
}
`
;
params
.
lnglat
=
`
${
form
.
lng
}
,
${
form
.
lat
}
`
;
params
.
radius
=
form
.
radius
;
params
.
radius
=
form
.
radius
;
params
.
analysisAddress
=
form
.
analysisAddress
;
params
.
analysisAddress
=
form
.
analysisAddress
;
}
else
if
(
params
.
shapeType
==
3
){
}
else
if
(
params
.
shapeType
==
3
)
{
params
.
lnglat
=
this
.
polygonPath
.
join
(
'|'
)
let
lnglats
=
this
.
polygonPath
.
map
((
item
)
=>
{
return
item
.
lng
+
","
+
item
.
lat
;
});
params
.
lnglat
=
lnglats
.
join
(
"|"
);
}
}
params
.
bizFenceType
=
form
.
bizFenceType
params
.
bizFenceType
=
form
.
bizFenceType
;
// params.status = form.status;
// params.status = form.status;
if
(
this
.
tableData
)
{
if
(
this
.
tableData
)
{
params
.
snList
=
this
.
tableData
params
.
snList
=
this
.
tableData
;
}
else
{
}
else
{
params
.
snList
=
this
.
userArr
;
params
.
snList
=
this
.
userArr
;
}
}
if
(
form
.
timeType
==
1
)
{
if
(
form
.
timeType
==
1
)
{
params
.
startTime
=
moment
().
format
(
'YYYY-MM-DD'
);
params
.
startTime
=
moment
().
format
(
"YYYY-MM-DD"
);
params
.
endTime
=
moment
().
add
(
10
,
'year'
).
format
(
'YYYY-MM-DD'
);
params
.
endTime
=
moment
().
add
(
10
,
"year"
).
format
(
"YYYY-MM-DD"
);
}
else
{
}
else
{
params
.
startTime
=
moment
(
this
.
form
.
dateRange
[
0
]).
format
(
'YYYY-MM-DD'
);
params
.
startTime
=
moment
(
this
.
form
.
dateRange
[
0
]).
format
(
"YYYY-MM-DD"
);
params
.
endTime
=
moment
(
this
.
form
.
dateRange
[
1
]).
format
(
'YYYY-MM-DD'
);
params
.
endTime
=
moment
(
this
.
form
.
dateRange
[
1
]).
format
(
"YYYY-MM-DD"
);
}
}
if
(
form
.
msgtel
)
{
if
(
form
.
msgtel
)
{
params
.
telNumbers
=
form
.
msgtel
params
.
telNumbers
=
form
.
msgtel
;
}
}
return
params
;
return
params
;
},
},
/*closeDialog(){
/*closeDialog(){
...
@@ -1012,54 +1116,57 @@ export default{
...
@@ -1012,54 +1116,57 @@ export default{
this.$emit('onFenceModalChange', false);
this.$emit('onFenceModalChange', false);
},*/
},*/
scrollTo
(
refName
)
{
scrollTo
(
refName
)
{
this
.
scrollToRef
=
refName
;
this
.
scrollToRef
=
refName
;
var
element
=
this
.
$refs
[
refName
];
var
element
=
this
.
$refs
[
refName
];
const
top
=
element
.
offsetTop
;
const
top
=
element
.
offsetTop
;
window
.
document
.
getElementById
(
'fenceModal'
).
querySelector
(
'form'
).
scrollTo
(
0
,
top
-
80
);
window
.
document
.
getElementById
(
"fenceModal"
)
.
querySelector
(
"form"
)
.
scrollTo
(
0
,
top
-
80
);
},
},
/*addMode(){
/*addMode(){
this.starMap=true;
this.starMap=true;
},*/
},*/
areaChoose
(
id
,
str
)
{
areaChoose
(
id
,
str
)
{
if
(
this
.
form
.
areaCode
!=
id
)
{
if
(
this
.
form
.
areaCode
!=
id
)
{
this
.
starMap
=
true
;
this
.
starMap
=
true
;
}
}
this
.
form
.
areaCode
=
id
;
this
.
form
.
areaCode
=
id
;
this
.
form
.
areaString
=
str
;
this
.
form
.
areaString
=
str
;
this
.
$refs
.
fenceForm
.
validateField
(
'area'
);
this
.
$refs
.
fenceForm
.
validateField
(
"area"
);
if
(
this
.
starMap
)
{
if
(
this
.
starMap
)
{
this
.
district
()
this
.
district
();
}
}
//this.starMap = true;
//this.starMap = true;
//}
//}
},
},
district
()
{
district
()
{
console
.
log
(
"district"
)
console
.
log
(
"district"
);
//this.starMap = true;
//this.starMap = true;
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'area'
,
fenceType
:
"area"
,
areaCode
:
this
.
form
.
areaCode
areaCode
:
this
.
form
.
areaCode
,
})
});
},
},
/*openMapModal(){
/*openMapModal(){
this.$emit('onFenceMapModalChange', true);
this.$emit('onFenceMapModalChange', true);
},*/
},*/
validateLngLat
()
{
validateLngLat
()
{
let
pass
=
true
;
let
pass
=
true
;
this
.
$refs
.
fenceForm
.
validateField
(
'lng'
,
(
error
)
=>
{
this
.
$refs
.
fenceForm
.
validateField
(
"lng"
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
pass
=
false
;
pass
=
false
;
}
}
});
});
this
.
$refs
.
fenceForm
.
validateField
(
'lat'
,
(
error
)
=>
{
this
.
$refs
.
fenceForm
.
validateField
(
"lat"
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
pass
=
false
;
pass
=
false
;
}
}
});
});
this
.
$refs
.
fenceForm
.
validateField
(
'radius'
,
(
error
)
=>
{
this
.
$refs
.
fenceForm
.
validateField
(
"radius"
,
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
pass
=
false
;
pass
=
false
;
}
}
});
});
...
@@ -1070,85 +1177,85 @@ export default{
...
@@ -1070,85 +1177,85 @@ export default{
this.$refs.fenceMap.updateMap(this.form)
this.$refs.fenceMap.updateMap(this.form)
}
}
}*/
}*/
transfer
()
{
transfer
()
{
if
(
this
.
form
.
lng
&&
this
.
form
.
lat
&&
this
.
validateLngLat
())
{
if
(
this
.
form
.
lng
&&
this
.
form
.
lat
&&
this
.
validateLngLat
())
{
this
.
transferTimeoutId
&&
window
.
clearTimeout
(
this
.
transferTimeoutId
);
this
.
transferTimeoutId
&&
window
.
clearTimeout
(
this
.
transferTimeoutId
);
this
.
transferTimeoutId
=
window
.
setTimeout
(()
=>
{
this
.
transferTimeoutId
=
window
.
setTimeout
(()
=>
{
const
flag
=
new
Date
();
const
flag
=
new
Date
();
this
.
transferFlag
=
flag
;
this
.
transferFlag
=
flag
;
if
(
!
this
.
geocoder
)
{
if
(
!
this
.
geocoder
)
{
mapService
.
getGeocoder
().
then
((
gc
)
=>
{
mapService
.
getGeocoder
().
then
((
gc
)
=>
{
this
.
geocoder
=
gc
;
this
.
geocoder
=
gc
;
this
.
getAddress
(
flag
);
this
.
getAddress
(
flag
);
});
});
}
else
{
}
else
{
this
.
getAddress
(
flag
);
this
.
getAddress
(
flag
);
}
}
},
500
)
},
500
);
}
}
},
},
getAddress
(
flag
)
{
getAddress
(
flag
)
{
const
lnglatXY
=
[
this
.
form
.
lng
,
this
.
form
.
lat
];
const
lnglatXY
=
[
this
.
form
.
lng
,
this
.
form
.
lat
];
this
.
form
.
analysisAddress
=
''
this
.
form
.
analysisAddress
=
""
;
this
.
geocoder
.
getAddress
(
lnglatXY
,
(
status
,
result
)
=>
{
this
.
geocoder
.
getAddress
(
lnglatXY
,
(
status
,
result
)
=>
{
if
(
flag
==
this
.
transferFlag
){
if
(
flag
==
this
.
transferFlag
)
{
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
//获取地址成功
if
(
status
===
"complete"
&&
result
.
info
===
"OK"
)
{
//获取地址成功
//console.log(result.regeocode.formattedAddress)
//console.log(result.regeocode.formattedAddress)
this
.
form
.
analysisAddress
=
result
.
regeocode
.
formattedAddress
;
this
.
form
.
analysisAddress
=
result
.
regeocode
.
formattedAddress
;
this
.
transferError
=
false
;
this
.
transferError
=
false
;
this
.
$refs
.
fenceForm
.
validateField
(
'analysisAddress'
);
this
.
$refs
.
fenceForm
.
validateField
(
"analysisAddress"
);
//this.$refs.fenceMap.updateMap(this.form)
//this.$refs.fenceMap.updateMap(this.form)
}
else
{
}
else
{
this
.
transferError
=
true
;
this
.
transferError
=
true
;
this
.
$refs
.
fenceForm
.
validateField
(
'analysisAddress'
);
this
.
$refs
.
fenceForm
.
validateField
(
"analysisAddress"
);
}
}
}
}
});
});
},
},
updateFence
()
{
updateFence
()
{
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'circle'
,
fenceType
:
"circle"
,
lng
:
this
.
form
.
lng
,
lng
:
this
.
form
.
lng
,
lat
:
this
.
form
.
lat
,
lat
:
this
.
form
.
lat
,
radius
:
this
.
form
.
radius
radius
:
this
.
form
.
radius
,
});
});
this
.
transfer
()
this
.
transfer
();
},
},
handleSpecialShopChange
(
val
)
{
handleSpecialShopChange
(
val
)
{
// 特约店级联选项
// 特约店级联选项
if
(
val
&&
val
.
length
>
1
)
{
if
(
val
&&
val
.
length
>
1
)
{
this
.
form
.
specialShopId
=
val
[
1
];
this
.
form
.
specialShopId
=
val
[
1
];
console
.
log
(
this
.
form
.
specialShopId
)
console
.
log
(
this
.
form
.
specialShopId
);
}
}
}
},
},
components
:{
},
components
:
{
AreaSelect
,
AreaSelect
,
fenceMap
,
fenceMap
,
userList
,
userList
,
InfiniteLoading
InfiniteLoading
,
}
},
}
}
;
</
script
>
</
script
>
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
h3
{
h3
{
margin
:
10px
0px
;
margin
:
10px
0px
;
}
}
form
{
form
{
height
:
100%
;
height
:
100%
;
overflow-y
:
auto
;
overflow-y
:
auto
;
margin
:
-30px
-20px
;
margin
:
-30px
-20px
;
padding
:
10px
100px
20px
30px
;
padding
:
10px
100px
20px
30px
;
}
}
.tab-content
{
.tab-content
{
margin-top
:
20px
;
margin-top
:
20px
;
}
}
.record-list
{
.record-list
{
padding-left
:
20px
;
padding-left
:
20px
;
}
}
.fenceModalfooter
{
.fenceModalfooter
{
margin
:
0
;
margin
:
0
;
padding
:
20px
;
padding
:
20px
;
padding-top
:
10px
;
padding-top
:
10px
;
...
@@ -1156,44 +1263,43 @@ export default{
...
@@ -1156,44 +1263,43 @@ export default{
box-sizing
:
border-box
;
box-sizing
:
border-box
;
z-index
:
500
;
z-index
:
500
;
position
:
fixed
;
position
:
fixed
;
left
:
0
;
left
:
0
;
bottom
:
0
;
bottom
:
0
;
width
:
100%
;
width
:
100%
;
border-top
:
1px
solid
#e7eaec
;
border-top
:
1px
solid
#e7eaec
;
background-color
:
#fdfdfd
;
background-color
:
#fdfdfd
;
margin-left
:
220px
;
margin-left
:
220px
;
padding-right
:
260px
;
padding-right
:
260px
;
}
}
.tab_wrap
{
.tab_wrap
{
position
:
relative
;
position
:
relative
;
padding
:
20px
;
padding
:
20px
;
.tab_ctrl
{
.tab_ctrl
{
position
:
absolute
;
position
:
absolute
;
top
:
20px
;
top
:
20px
;
right
:
20px
;
right
:
20px
;
}
}
}
}
.shape_tip
{
.shape_tip
{
color
:
#999
;
color
:
#999
;
line-height
:
1.5
;
line-height
:
1.5
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
margin-left
:
100px
;
margin-left
:
100px
;
}
}
</
style
>
</
style
>
<
style
>
<
style
>
.scrollbar
::-webkit-scrollbar
{
.scrollbar
::-webkit-scrollbar
{
width
:
4px
;
width
:
4px
;
}
}
.scrollbar
::-webkit-scrollbar-thumb
{
.scrollbar
::-webkit-scrollbar-thumb
{
border-radius
:
15px
;
border-radius
:
15px
;
box-shadow
:
inset
0
0
5px
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
inset
0
0
5px
rgba
(
0
,
0
,
0
,
0.2
);
background
:
rgba
(
255
,
255
,
255
,
0.1
);
background
:
rgba
(
255
,
255
,
255
,
0.1
);
}
}
.scrollbar
::-webkit-scrollbar-track
{
.scrollbar
::-webkit-scrollbar-track
{
border-radius
:
0
;
border-radius
:
0
;
box-shadow
:
inset
0
0
5px
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
inset
0
0
5px
rgba
(
0
,
0
,
0
,
0.2
);
background
:
rgba
(
255
,
255
,
255
,
255
);
background
:
rgba
(
255
,
255
,
255
,
255
);
}
}
.special-shop-input
.el-input__inner
{
.special-shop-input
.el-input__inner
{
cursor
:
pointer
;
cursor
:
pointer
;
...
...
src/pages/monitor/fence.vue
View file @
be63bde
...
@@ -343,10 +343,10 @@ export default {
...
@@ -343,10 +343,10 @@ export default {
},
},
methods
:
{
methods
:
{
//初始化百度地图
//初始化百度地图
async
initBMap
(){
async
initBMap
()
{
this
.
mapObj
=
await
mapService
.
init
(
"map"
);
this
.
mapObj
=
await
mapService
.
init
(
"map"
);
window
.
AMap
=
this
.
mapObj
;
window
.
AMap
=
this
.
mapObj
;
this
.
getDevinceInfo
()
this
.
getDevinceInfo
()
;
},
},
// 获取设备信息
// 获取设备信息
...
@@ -476,10 +476,9 @@ export default {
...
@@ -476,10 +476,9 @@ export default {
// 监听圆形围栏直径变化
// 监听圆形围栏直径变化
onFenceRadiusChange
(
e
)
{
onFenceRadiusChange
(
e
)
{
if
(
e
)
{
if
(
e
)
{
this
.
$set
(
this
.
form
,
"radius"
,
e
);
this
.
$set
(
this
.
form
,
"radius"
,
e
);
}
}
},
},
// 监听围栏类型变化
// 监听围栏类型变化
...
@@ -490,9 +489,11 @@ export default {
...
@@ -490,9 +489,11 @@ export default {
// 1:圆形围栏 4:行政区域 3:多边形
// 1:圆形围栏 4:行政区域 3:多边形
switch
(
e
)
{
switch
(
e
)
{
case
4
:
case
4
:
// AMap.invoke("removeContextMenu");
_this
.
drawDistrict
(
areaText
);
_this
.
drawDistrict
(
areaText
);
break
;
break
;
case
3
:
case
3
:
// AMap.invoke("removeContextMenu");
_this
.
drawPolygon
();
_this
.
drawPolygon
();
break
;
break
;
default
:
default
:
...
...
src/utils/historyLocation.js
View file @
be63bde
...
@@ -40,8 +40,8 @@ const historyLocation = {
...
@@ -40,8 +40,8 @@ const historyLocation = {
const
MAP
=
mapService
.
map
;
const
MAP
=
mapService
.
map
;
const
lnglat
=
this
.
markers
[
idx
].
getPosition
();
const
lnglat
=
this
.
markers
[
idx
].
getPosition
();
// this.infowins[idx].open(MAP, lnglat);
// this.infowins[idx].open(MAP, lnglat);
MAP
.
invoke
(
"mapOpenInfoWindow"
,
this
.
infowins
[
idx
],
lnglat
)
AMap
.
invoke
(
"mapOpenInfoWindow"
,
this
.
infowins
[
idx
],
lnglat
)
MAP
.
invoke
(
'centerAndZoom'
,
lnglat
,
10
)
AMap
.
invoke
(
'centerAndZoom'
,
lnglat
,
10
)
}
}
});
});
...
@@ -49,9 +49,11 @@ const historyLocation = {
...
@@ -49,9 +49,11 @@ const historyLocation = {
createClusterer
(){
createClusterer
(){
let
map
=
mapService
.
mapInstance
;
let
map
=
mapService
.
mapInstance
;
var
cluster
,
markers
=
[];
var
cluster
,
markers
=
[];
for
(
let
idx
in
this
.
markers
){
for
(
let
idx
in
this
.
markers
){
markers
.
push
(
this
.
markers
[
idx
]);
markers
.
push
(
this
.
markers
[
idx
]);
}
}
console
.
log
(
markers
)
this
.
cluster
=
AMap
.
invoke
(
'Cluster'
,
markers
,
data
=>
{
this
.
cluster
=
AMap
.
invoke
(
'Cluster'
,
markers
,
data
=>
{
return
{
return
{
point
:
[
data
.
latLng
.
lng
,
data
.
latLng
.
lat
],
point
:
[
data
.
latLng
.
lng
,
data
.
latLng
.
lat
],
...
...
src/utils/mapBService.js
View file @
be63bde
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Author: 'wangzhihui' '1733904062@qq.com'
* @Date: 2024-12-06 14:10:32
* @Date: 2024-12-06 14:10:32
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditors: 'wangzhihui' '1733904062@qq.com'
* @LastEditTime: 2024-12-2
0 11:23:44
* @LastEditTime: 2024-12-2
1 15:52:17
* @FilePath: \oEshield\src\utils\mapBService.js
* @FilePath: \oEshield\src\utils\mapBService.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -214,6 +214,16 @@ MapService.prototype = {
...
@@ -214,6 +214,16 @@ MapService.prototype = {
marker
.
setAnimation
(
BMAP_ANIMATION_DROP
)
marker
.
setAnimation
(
BMAP_ANIMATION_DROP
)
return
marker
;
return
marker
;
},
},
createPoiMarker
(
lnglatXY
,
map
)
{
let
that
=
this
,
url
=
require
(
'images/poi-marker-default.png'
),
size
=
that
.
map
.
invoke
(
'Size'
,
24
,
34
)
var
marker
=
that
.
map
.
invoke
(
'Marker'
,
lnglatXY
,
{
icon
:
that
.
map
.
invoke
(
'Icon'
,
url
,
size
)
})
marker
.
setAnimation
(
BMAP_ANIMATION_DROP
)
return
marker
;
},
createStartMarker
:
function
(
lnglatXY
,
map
)
{
createStartMarker
:
function
(
lnglatXY
,
map
)
{
let
that
=
this
,
let
that
=
this
,
url
=
require
(
'images/icon_start.png'
),
url
=
require
(
'images/icon_start.png'
),
...
@@ -945,6 +955,8 @@ MapService.prototype = {
...
@@ -945,6 +955,8 @@ MapService.prototype = {
// 创建poi信息弹框
// 创建poi信息弹框
createPoiMarkerInfowindow
(
info
)
{
createPoiMarkerInfowindow
(
info
)
{
console
.
log
(
info
)
let
self
=
this
;
let
infoDiv
=
document
.
createElement
(
'div'
);
let
infoDiv
=
document
.
createElement
(
'div'
);
let
_div
=
`<div class="map_poi_infowindow_popup"><h3 class="map_poi_infowindow_title">
${
info
.
address
||
'暂无地址'
}
</h3>
let
_div
=
`<div class="map_poi_infowindow_popup"><h3 class="map_poi_infowindow_title">
${
info
.
address
||
'暂无地址'
}
</h3>
<div class="map_poi_infowindow_content">
<div class="map_poi_infowindow_content">
...
...
src/utils/replay.js
View file @
be63bde
...
@@ -66,6 +66,7 @@ const replay = {
...
@@ -66,6 +66,7 @@ const replay = {
EventBus
.
$emit
(
'uiMap.replay.initDone'
)
EventBus
.
$emit
(
'uiMap.replay.initDone'
)
AMap
.
invoke
(
'lushuAddEventListener'
,
'move'
,
(
e
)
=>
{
AMap
.
invoke
(
'lushuAddEventListener'
,
'move'
,
(
e
)
=>
{
this
.
idx
=
e
.
target
.
i
;
this
.
idx
=
e
.
target
.
i
;
console
.
log
(
this
.
idx
)
let
lnglat
=
replayData
[
this
.
idx
]
let
lnglat
=
replayData
[
this
.
idx
]
let
item
=
replay
.
data
[
this
.
idx
]
let
item
=
replay
.
data
[
this
.
idx
]
AMap
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
//设置信息窗口文案
AMap
.
invoke
(
'lushuSetContent'
,
replay
.
getNavgInfoContent
(
item
))
//设置信息窗口文案
...
@@ -133,6 +134,7 @@ const replay = {
...
@@ -133,6 +134,7 @@ const replay = {
//轨迹暂停
//轨迹暂停
EventBus
.
$on
(
'uiMap.replay.pause'
,
(
ifShowAddr
)
=>
{
EventBus
.
$on
(
'uiMap.replay.pause'
,
(
ifShowAddr
)
=>
{
console
.
log
(
this
.
idx
)
if
(
replay
.
navg
){
if
(
replay
.
navg
){
AMap
.
invoke
(
'lushuPause'
)
AMap
.
invoke
(
'lushuPause'
)
if
(
ifShowAddr
){
if
(
ifShowAddr
){
...
@@ -172,10 +174,12 @@ const replay = {
...
@@ -172,10 +174,12 @@ const replay = {
EventBus
.
$on
(
'uiMap.replay.drawLocation'
,
(
data
)
=>
{
EventBus
.
$on
(
'uiMap.replay.drawLocation'
,
(
data
)
=>
{
const
MAP
=
mapService
.
map
;
const
MAP
=
mapService
.
map
;
for
(
let
idx
in
this
.
markers
){
for
(
let
idx
in
this
.
markers
){
MAP
.
remove
(
this
.
markers
[
idx
])
// MAP.remove(this.markers[idx])
AMap
.
invoke
(
'removeOverlay'
,
this
.
markers
[
idx
])
}
}
for
(
let
idx
in
this
.
infowins
){
for
(
let
idx
in
this
.
infowins
){
MAP
.
remove
(
this
.
infowins
[
idx
])
// MAP.remove(this.infowins[idx])
AMap
.
invoke
(
'removeOverlay'
,
this
.
infowins
[
idx
])
}
}
this
.
markers
=
{};
this
.
markers
=
{};
this
.
infowins
=
{};
this
.
infowins
=
{};
...
@@ -193,26 +197,45 @@ const replay = {
...
@@ -193,26 +197,45 @@ const replay = {
if
(
this
.
markers
[
idx
]){
if
(
this
.
markers
[
idx
]){
const
MAP
=
mapService
.
map
;
const
MAP
=
mapService
.
map
;
const
lnglat
=
this
.
markers
[
idx
].
getPosition
();
const
lnglat
=
this
.
markers
[
idx
].
getPosition
();
this
.
infowins
[
idx
].
open
(
MAP
,
lnglat
);
AMap
.
invoke
(
'mapOpenInfoWindow'
,
this
.
infowins
[
idx
],
lnglat
)
// this.infowins[idx].open(MAP, lnglat);
EventBus
.
$emit
(
'uiMap.replay.pause'
);
EventBus
.
$emit
(
'uiMap.replay.pause'
);
EventBus
.
$emit
(
'uiMap.replay.replayIng'
,
false
);
EventBus
.
$emit
(
'uiMap.replay.replayIng'
,
false
);
MAP
.
setZoomAndCenter
(
MAP
.
getZoom
(),
lnglat
);
// MAP.setZoomAndCenter(MAP.getZoom(), lnglat);
AMap
.
invoke
(
'panTo'
,
lnglat
)
}
}
});
});
},
},
drawLocation
(
data
){
drawLocation
(
data
)
{
const
MAP
=
mapService
.
map
;
// console.log(data)
EventBus
.
$emit
(
'uiMap.historyLocation.transferSuccess'
,
data
);
const
{
MAP
,
mapapi
}
=
mapService
data
.
forEach
((
item
)
=>
{
EventBus
.
$emit
(
'uiMap.historyLocation.transferSuccess'
,
data
)
let
marker
=
mapService
.
createPointMarker
([
item
.
elng
,
item
.
elat
],
MAP
);
data
.
forEach
((
item
)
=>
{
let
infoWindow
=
mapService
.
bindLocationInfoWindow
(
marker
,
MAP
,
item
);
const
marker
=
mapService
.
createPointMarker
(
mapService
.
getLngLat
(
item
.
elng
,
item
.
elat
),
MAP
)
this
.
markers
[
item
.
idx
]
=
marker
;
AMap
.
invoke
(
'addOverlay'
,
marker
)
this
.
infowins
[
item
.
idx
]
=
infoWindow
;
const
infoWindow
=
mapService
.
bindLocationInfoWindow
(
marker
,
MAP
,
item
)
});
this
.
markers
[
item
.
idx
]
=
marker
this
.
infowins
[
item
.
idx
]
=
infoWindow
//mapService.setFitView(MAP);
})
// console.log(this.markers, 'markers')
const
points
=
Object
.
values
(
this
.
markers
).
map
(
item
=>
item
.
latLng
)
// console.log(points)
AMap
.
invoke
(
'setViewport'
,
points
)
// mapService.setFitView(MAP);
},
},
// drawLocation(data){
// EventBus.$emit('uiMap.historyLocation.transferSuccess', data);
// data.forEach((item)=>{
// let lnglatXY=mapService.getLngLat(item.elng, item.elat);
// let marker = mapService.createPointMarker(lnglatXY, MAP);
// let infoWindow = mapService.bindLocationInfoWindow(marker, MAP, item);
// this.markers[item.idx] = marker;
// this.infowins[item.idx] = infoWindow;
// });
// //mapService.setFitView(MAP);
// },
speedEvent
(
idx
,
dis
)
{
speedEvent
(
idx
,
dis
)
{
console
.
log
(
idx
,
dis
)
console
.
log
(
idx
,
dis
)
let
timeArr
=
[[
40
,
30
,
16
],
[
30
,
20
,
12
],
[
20
,
12
,
8
],
[
5
,
3
,
2
]]
// 慢 正常 快 很快
let
timeArr
=
[[
40
,
30
,
16
],
[
30
,
20
,
12
],
[
20
,
12
,
8
],
[
5
,
3
,
2
]]
// 慢 正常 快 很快
...
...
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