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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1194 additions
and
1055 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
();
_this
.
initMapEvent
();
_this
.
getPoiTrack
();
});
});
AMap
.
invoke
(
"autocompleteShow"
);
AMap
.
invoke
(
"autocompleteAddEventListener"
,
"onconfirm"
,
(
e
)
=>
{
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
.
lnglat
)
{
if
(
k
.
id
!=
_query
.
id
)
{
let
m
=
k
.
lnglat
.
split
(
","
);
if
(
k
.
lnglat
)
{
let
lnglatXY
=
mapService
.
getLngLat
(
m
[
0
],
m
[
1
]);
let
m
=
k
.
lnglat
.
split
(
","
);
markers
.
push
(
lnglatXY
);
k
.
lng
=
m
[
0
];
let
marker
=
mapService
.
createPoiMarker
(
lnglatXY
,
AMap
);
k
.
lat
=
m
[
1
];
AMap
.
invoke
(
"addOverlay"
,
marker
);
k
.
lnglat
=
m
;
AMap
.
invoke
(
"markerAddEventListener"
,
"click"
,
(
e
)
=>
{
markers
.
push
(
k
);
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
);
_marker
.
setMap
(
_this
.
map
);
this
.
markerEvent
(
_markerInfo
);
// AMap.invoke("mapOpenInfoWindow", infoWindow,lnglat)
AMap
.
invoke
(
"markerAddEventListener"
,
"click"
,
(
e
)
=>
{
_markerInfo
=
{
...
e
,
...
_markerInfo
};
this
.
markerEvent
(
_markerInfo
);
});
// 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
)
=>
{
console
.
log
(
res
)
let
_pois
=
res
.
surroundingPois
||
[];
_params
.
address
=
res
.
address
;
_params
.
near
=
_pois
[
0
]
?
_pois
[
0
].
title
:
""
;
let
infoWindow
=
mapService
.
createPoiMarkerInfowindow
(
_params
);
this
.
poiInfoWindow
=
infoWindow
;
AMap
.
invoke
(
"mapOpenInfoWindow"
,
infoWindow
,
point
);
AMap
.
invoke
(
"centerAndZoom"
,
point
,
14
)
});
});
_this
.
setPoiInfo
(
e
);
geocoder
.
getAddress
(
new
AMap
.
LngLat
(
e
.
lng
,
e
.
lat
),
function
(
status
,
result
)
{
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
);
_this
.
poiInfoWindow
=
infoWindow
;
infoWindow
.
open
(
_this
.
map
);
}
);
},
},
// 设置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"
>
{{
</
template
>
isEditMode
?
"编辑线路"
:
"新增线路"
<
template
slot=
"main"
>
}}
</el-breadcrumb-item>
<!-- 线路调用地图弹框 -->
</
template
>
<div
class=
"ibox-content"
style=
"height: 500px; padding:0 20px;z-index: 100"
>
<
template
slot=
"main"
>
<fence-map
<!-- 线路调用地图弹框 -->
:mapData=
"mapData"
<div
@
onUpdateMapData=
"updateMapData"
class=
"ibox-content"
:readonlyStatus=
"readonlyStatus"
style=
"height: 500px; padding: 0 20px; z-index: 100"
ref=
"fenceMap"
>
>
<fence-map
</fence-map>
:mapData=
"mapData"
</div>
@
onUpdateMapData=
"updateMapData"
<!-- 线路调用地图弹框 /-->
:readonlyStatus=
"readonlyStatus"
<div
class=
"tab_wrap"
>
ref=
"fenceMap"
<el-tabs
type=
"card"
v-show=
"hideTab"
>
>
<el-tab-pane
label=
"线路基础信息"
>
</fence-map>
<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"
>
<!-- 线路调用地图弹框 /-->
<el-row>
<div
class=
"tab_wrap"
>
<!--
<el-col
:span=
"12"
>
<el-tabs
type=
"card"
v-show=
"hideTab"
>
<el-tab-pane
label=
"线路基础信息"
>
<div
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-col
:span=
"12"
>
<el-form-item
label=
"线路编号"
prop=
"fenceNo"
>
<el-form-item
label=
"线路编号"
prop=
"fenceNo"
>
<el-input
v-model=
"form.fenceNo"
disabled
></el-input>
<el-input
v-model=
"form.fenceNo"
disabled
></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=
"fenceName"
>
<el-form-item
label=
"线路名称"
prop=
"fenceName"
>
<el-input
v-model
.
trim=
"form.fenceName"
maxlength=
"200"
:disabled=
"readonlyStatus"
></el-input>
<el-input
</el-form-item>
v-model
.
trim=
"form.fenceName"
</el-col>
maxlength=
"200"
<el-col
:span=
"12"
>
:disabled=
"readonlyStatus"
<el-form-item
label=
"线路类型"
prop=
"bizFenceType"
>
></el-input>
<el-radio
value=
"12"
label=
"12"
:disabled=
"readonlyStatus"
>
试驾线路
</el-radio>
</el-form-item>
<!--
<el-radio
v-model=
"form.bizFenceType"
:label=
"1"
:disabled=
"isEditMode"
>
试乘试驾型
</el-radio>
-->
</el-col>
</el-form-item>
<el-col
:span=
"12"
>
</el-col>
<el-form-item
label=
"线路类型"
prop=
"bizFenceType"
>
</el-row>
<el-radio
value=
"12"
label=
"12"
:disabled=
"readonlyStatus"
<el-row>
>
试驾线路
</el-radio
<el-col
:span=
"12"
>
>
<el-form-item
label=
"区域类型"
prop=
"shapeType"
>
<!--
<el-radio
v-model=
"form.bizFenceType"
:label=
"1"
:disabled=
"isEditMode"
>
试乘试驾型
</el-radio>
-->
<el-radio-group
v-model=
"form.shapeType"
@
change=
"shapeTypeChange"
>
</el-form-item>
<!--
<el-radio-button
label=
"4"
value=
"4"
>
行政区域
</el-radio-button>
-->
</el-col>
<!--
<el-radio-button
label=
"1"
value=
"1"
:disabled=
"readonlyStatus"
>
圆形
</el-radio-button>
-->
</el-row>
<el-radio-button
label=
"3"
value=
"3"
:disabled=
"readonlyStatus"
>
多边形
</el-radio-button>
<el-row>
</el-radio-group>
<el-col
:span=
"12"
>
</el-form-item>
<el-form-item
label=
"区域类型"
prop=
"shapeType"
>
</el-col>
<el-radio-group
<el-col
:span=
"12"
>
v-model=
"form.shapeType"
<el-form-item
class=
"special-shop-input"
label=
"特约店"
prop=
"specialShop"
>
@
change=
"shapeTypeChange"
<!--
<el-cascader
>
<!--
<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=
"3"
value=
"3"
:disabled=
"readonlyStatus"
>
多边形
</el-radio-button
>
</el-radio-group>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<el-form-item
class=
"special-shop-input"
label=
"特约店"
prop=
"specialShop"
>
<!--
<el-cascader
v-model=
"form.specialShopName"
v-model=
"form.specialShopName"
:value=
"form.specialShopName"
:value=
"form.specialShopName"
:placeholder=
"form.specialShopName || '请选择特约店名称'"
:placeholder=
"form.specialShopName || '请选择特约店名称'"
...
@@ -64,35 +97,53 @@
...
@@ -64,35 +97,53 @@
size=
"small"
size=
"small"
:disabled=
"readonlyStatus"
:disabled=
"readonlyStatus"
></el-cascader>
-->
></el-cascader>
-->
<el-popover
<el-popover
v-model=
"filterVisible"
v-model=
"filterVisible"
placement=
"top-end"
placement=
"top-end"
width=
"400"
width=
"400"
@
show=
"selectStore"
@
show=
"selectStore"
trigger=
"click"
>
trigger=
"click"
<div
v-loading=
"loading"
>
>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
size=
"small"
>
<div
v-loading=
"loading"
>
</el-input>
<el-input
placeholder=
"输入关键字进行过滤"
v-model=
"filterText"
size=
"small"
>
</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
</el-tree>
style=
"max-height: 50vh; overflow: auto"
<p
style=
"text-align: right; margin-top: 10px"
>
class=
"filter-tree"
<el-button
@
click=
"filterConfirm"
type=
"primary"
>
确定
</el-button>
:data=
"filterTextData"
<el-button
@
click=
"closeFilter"
>
取消
</el-button>
:filter-node-method=
"filterNode"
</p>
highlight-current
</div>
ref=
"tree"
<el-input
node-key=
"id"
v-model=
"form.specialShopName"
check-on-click-node
:placeholder=
"form.specialShopName || '请选择特约店名称'"
>
slot=
"reference"
</el-tree>
>
<p
style=
"text-align: right; margin-top: 10px"
>
</el-input>
<el-button
@
click=
"filterConfirm"
type=
"primary"
</el-popover>
>
确定
</el-button
</el-form-item>
>
</el-col>
<el-button
@
click=
"closeFilter"
>
取消
</el-button>
</el-row>
</p>
<!--
<el-row>
-->
</div>
<!--
<el-col
:span=
"12"
>
<el-input
v-model=
"form.specialShopName"
:placeholder=
"
form.specialShopName || '请选择特约店名称'
"
slot=
"reference"
>
</el-input>
</el-popover>
</el-form-item>
</el-col>
</el-row>
<!--
<el-row>
-->
<!--
<el-col
:span=
"12"
>
<el-form-item
label=
"监控类型"
prop=
"electricFenceType"
>
<el-form-item
label=
"监控类型"
prop=
"electricFenceType"
>
<el-select
v-model=
"form.electricFenceType"
placeholder=
"请选择"
size=
"small"
style=
"width:100px;"
>
<el-select
v-model=
"form.electricFenceType"
placeholder=
"请选择"
size=
"small"
style=
"width:100px;"
>
<el-option
label=
"驶入"
:value=
"1"
></el-option>
<el-option
label=
"驶入"
:value=
"1"
></el-option>
...
@@ -101,8 +152,8 @@
...
@@ -101,8 +152,8 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
</el-col>
-->
</el-col>
-->
<!--
<el-col
:span=
"12"
>
-->
<!--
<el-col
:span=
"12"
>
-->
<!--
<el-form-item
label=
"监控时间"
prop=
"electricTimeFenceType"
class=
"is-required"
>
<!--
<el-form-item
label=
"监控时间"
prop=
"electricTimeFenceType"
class=
"is-required"
>
<el-select
v-model=
"form.electricTimeFenceType"
placeholder=
"请选择时间"
size=
"small"
class=
"el-slect"
>
<el-select
v-model=
"form.electricTimeFenceType"
placeholder=
"请选择时间"
size=
"small"
class=
"el-slect"
>
<el-option
<el-option
v-for=
"item in form.electricTimeFenceTypes"
v-for=
"item in form.electricTimeFenceTypes"
...
@@ -112,7 +163,7 @@
...
@@ -112,7 +163,7 @@
</el-option>
</el-option>
</el-select>
</el-select>
</el-form-item>
-->
</el-form-item>
-->
<!--
<el-form-item
label=
"监控时间"
prop=
"timeType"
>
<!--
<el-form-item
label=
"监控时间"
prop=
"timeType"
>
<el-radio-group
v-model=
"form.timeType"
>
<el-radio-group
v-model=
"form.timeType"
>
<el-radio
:label=
1
>
<el-radio
:label=
1
>
永久有效
永久有效
...
@@ -138,8 +189,8 @@
...
@@ -138,8 +189,8 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
-->
</el-row>
-->
<!--
<el-row>
<!--
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"描述"
>
<el-form-item
label=
"描述"
>
<el-input
v-model
.
trim=
"form.des"
type=
"textarea"
rows=
"3"
maxlength=
"500"
></el-input>
<el-input
v-model
.
trim=
"form.des"
type=
"textarea"
rows=
"3"
maxlength=
"500"
></el-input>
...
@@ -157,8 +208,8 @@
...
@@ -157,8 +208,8 @@
</el-col>
</el-col>
</el-row>
-->
</el-row>
-->
<!--
<el-row>
<!--
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label=
"区域类型"
class=
"is-required"
>
<el-form-item
label=
"区域类型"
class=
"is-required"
>
<el-radio-group
v-model=
"form.shapeType"
@
change=
"shapeTypeChange"
>
<el-radio-group
v-model=
"form.shapeType"
@
change=
"shapeTypeChange"
>
...
@@ -170,11 +221,11 @@
...
@@ -170,11 +221,11 @@
<div
class=
"tab-content"
v-show=
"form.shapeType==3"
>
<div
class=
"tab-content"
v-show=
"form.shapeType==3"
>
<el-form-item
prop=
"area"
>
-->
<el-form-item
prop=
"area"
>
-->
<!-- 监控省市区组件 -->
<!-- 监控省市区组件 -->
<!--
<area-select
ref=
"clearArea"
@
onChangArea=
"areaChoose"
:prependFirst=
"true"
:id=
"areaCode"
></area-select>
-->
<!--
<area-select
ref=
"clearArea"
@
onChangArea=
"areaChoose"
:prependFirst=
"true"
:id=
"areaCode"
></area-select>
-->
<!-- 监控省市区组件 /-->
<!-- 监控省市区组件 /-->
<!--
</el-form-item>
<!--
</el-form-item>
</div>
</div>
<div
class=
"tab-content"
v-show=
"form.shapeType==2"
>
<div
class=
"tab-content"
v-show=
"form.shapeType==2"
>
...
@@ -201,11 +252,13 @@
...
@@ -201,11 +252,13 @@
<el-button
type=
"primary"
@
click=
"updateFence"
>
更新线路
</el-button>
<el-button
type=
"primary"
@
click=
"updateFence"
>
更新线路
</el-button>
</el-form-item>
</el-form-item>
</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"
>
<!-- </el-col> -->
*注:地图任意位置,单击新增双击结束绘制。
<!-- <el-col :span="12">
</div>
<!-- </el-col> -->
<!-- <el-col :span="12">
<el-form-item label="短信通知" prop="msgtel">
<el-form-item label="短信通知" prop="msgtel">
<el-input v-model.trim="form.msgtel" maxlength="100" placeholder="输入格式:手机号码,手机号码(支持双号)"></el-input>
<el-input v-model.trim="form.msgtel" maxlength="100" placeholder="输入格式:手机号码,手机号码(支持双号)"></el-input>
</el-form-item>
</el-form-item>
...
@@ -214,136 +267,194 @@
...
@@ -214,136 +267,194 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row> -->
</el-row> -->
</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
<!-- <el-button size="small" @click="deleteFenceModel">批量删除</el-button> -->
v-if=
"!readonlyStatus"
</div>
type=
"primary"
<el-table
@
click=
"userDate"
:data=
"tableData"
size=
"small"
border
:loading=
"submitting"
height=
"300"
>
关联用户
</el-button
size=
"small"
>
v-loading=
"loading"
<!-- <el-button size="small" @click="deleteFenceModel">批量删除</el-button> -->
</div>
@
selection-change=
"selectChange"
<el-table
style=
"width: 100%;margin-bottom:40px"
>
:data=
"tableData"
<el-table-column
:disabled=
"readonlyStatus"
type=
"selection"
width=
"40"
align=
"center"
></el-table-column>
border
<el-table-column
fixed
type=
"index"
label=
"序号"
:index=
"getIndex"
align=
"center"
width=
"70"
></el-table-column>
height=
"300"
size=
"small"
v-loading=
"loading"
@
selection-change=
"selectChange"
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
fixed
prop=
"name"
label=
"姓名"
min-width=
"80"
align=
"center"
></el-table-column>
<el-table-column
<el-table-column
fixed
prop=
"vin"
label=
"车架号"
min-width=
"160"
align=
"center"
></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
prop=
"sn"
</el-table-column>
label=
"设备号"
min-width=
"160"
align=
"center"
>
</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"
</el-table>
align=
"center"
</el-tab-pane>
></el-table-column>
</el-tabs>
</el-table>
<!-- <div class="tab_ctrl">
</el-tab-pane>
</el-tabs>
<!-- <div class="tab_ctrl">
<el-button size="small" type="primary" :fenceMapModalVisible="fenceMapModalVisible" @click="changeStatus" style="width: 65px;">展开</el-button>
<el-button size="small" type="primary" :fenceMapModalVisible="fenceMapModalVisible" @click="changeStatus" style="width: 65px;">展开</el-button>
<i :class="!hideTab?'fa fa-angle-double-up':'fa fa-angle-double-down'" style="position: absolute;top:9px;left:5px;color:#fff;"></i>
<i :class="!hideTab?'fa fa-angle-double-up':'fa fa-angle-double-down'" style="position: absolute;top:9px;left:5px;color:#fff;"></i>
</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
<el-button
@
click=
"cancel"
size=
"small"
>
取消
</el-button>
v-if=
"!readonlyStatus"
</div>
type=
"primary"
<user-list
@
click=
"saveFence"
:init=
"userListInit"
size=
"small"
@
onUserListInit=
"(res)=>userListInit=res"
:loading=
"submitting"
:userData=
"userArr"
>
{{ btnText }}
</el-button
@
onUpdateUserData=
"updateUserData"
>
:userListModalVisible=
"userListModalVisible"
<el-button
@
click=
"cancel"
size=
"small"
>
取消
</el-button>
:shopId=
"form.specialShopId"
</div>
@
onUserListModalChange=
"userListModalChange"
<user-list
ref=
"userList"
>
:init=
"userListInit"
</user-list>
@
onUserListInit=
"(res) => (userListInit = res)"
</template>
:userData=
"userArr"
<!-- </el-dialog> -->
@
onUpdateUserData=
"updateUserData"
<!-- 线路弹框 /-->
:userListModalVisible=
"userListModalVisible"
</v-layout>
:shopId=
"form.specialShopId"
@
onUserListModalChange=
"userListModalChange"
ref=
"userList"
>
</user-list>
</template>
<!-- </el-dialog> -->
<!-- 线路弹框 /-->
</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
(
cb
();
typeof
this
.
restainFenceName
!=
"undefined"
&&
}
this
.
form
.
fenceName
===
this
.
restainFenceName
// MONITOR_SERVICE.checkFenceName({name: this.form.fenceName}).then((res)=>{
)
{
// if(res.returnCode == 0){
cb
();
// if(res.data.isExist == 1){
}
// cb(new Error('该线路名已存在,请重新输入!'))
// MONITOR_SERVICE.checkFenceName({name: this.form.fenceName}).then((res)=>{
// }else{
// if(res.returnCode == 0){
// cb();
// if(res.data.isExist == 1){
// }
// cb(new Error('该线路名已存在,请重新输入!'))
// }
// }else{
// })
// cb();
}
// }
let
checkMonitorTime
=
(
rule
,
vaule
,
cb
)
=>
{
// }
if
(
this
.
form
.
electricTimeFenceType
==
""
){
// })
cb
(
new
Error
(
'请选择监控时间'
))
};
}
else
{
let
checkMonitorTime
=
(
rule
,
vaule
,
cb
)
=>
{
cb
();
if
(
this
.
form
.
electricTimeFenceType
==
""
)
{
}
cb
(
new
Error
(
"请选择监控时间"
));
}
}
else
{
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
(
cb
();
this
.
form
.
lng
}
)
}
)
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
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
(
cb
();
this
.
form
.
lat
}
)
}
)
{
cb
(
new
Error
(
"请输入正确的格式"
));
}
else
{
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('所填经纬度不能正确解析地址,请重新输入'))
}else{
}else{
...
@@ -352,205 +463,207 @@ export default{
...
@@ -352,205 +463,207 @@ 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
()
cb
();
}
}
};
}
let
checkRadius
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkRadius
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
this
.
form
.
shapeType
==
1
&&
!
/^
\d
+$/
.
test
(
this
.
form
.
radius
))
{
if
(
this
.
form
.
shapeType
==
1
&&
!
/^
\d
+$/
.
test
(
this
.
form
.
radius
)){
console
.
log
(
this
.
form
.
radius
)
console
.
log
(
this
.
form
.
radius
);
cb
(
new
Error
(
'请输入正确的格式,不能输入小数点'
))
cb
(
new
Error
(
"请输入正确的格式,不能输入小数点"
));
}
else
{
}
else
{
cb
();
cb
();
}
}
}
};
let
checkDaterange
=
(
rule
,
vaule
,
cb
)
=>
{
let
checkDaterange
=
(
rule
,
vaule
,
cb
)
=>
{
const
dateRange
=
this
.
form
.
dateRange
;
if
(
!
dateRange
||
!
dateRange
.
length
)
{
cb
(
new
Error
(
"请选择日期"
));
}
else
{
let
min
=
dateRange
[
0
];
let
max
=
dateRange
[
1
];
const
dateRange
=
this
.
form
.
dateRange
;
if
(
!
moment
.
isMoment
(
min
))
{
if
(
!
dateRange
||
!
dateRange
.
length
){
min
=
moment
(
min
);
cb
(
new
Error
(
'请选择日期'
))
}
}
else
{
if
(
!
moment
.
isMoment
(
max
))
{
let
min
=
dateRange
[
0
];
max
=
moment
(
max
);
let
max
=
dateRange
[
1
];
}
if
(
!
moment
.
isMoment
(
min
)){
if
(
min
.
isBefore
(
moment
(
max
).
subtract
(
30
*
6
,
"days"
),
"minute"
))
{
min
=
moment
(
min
)
cb
(
new
Error
(
"日期范围不能超过180天"
));
}
}
if
(
!
moment
.
isMoment
(
max
)){
}
max
=
moment
(
max
)
cb
();
}
};
let
checkMsgtel
=
(
rule
,
vaule
,
cb
)
=>
{
if
(
min
.
isBefore
(
moment
(
max
).
subtract
(
30
*
6
,
'days'
),
'minute'
)){
if
(
this
.
form
.
msgtel
&&
!
/^1
\d{10}(\,
1
\d{10})?
$/
.
test
(
this
.
form
.
msgtel
))
{
cb
(
new
Error
(
'日期范围不能超过180天'
))
cb
(
new
Error
(
"请输入正确的格式"
));
}
}
else
{
}
cb
();
cb
()
}
}
};
let
checkMsgtel
=
(
rule
,
vaule
,
cb
)
=>
{
/*let checkMap = (rule, vaule, cb)=>{
if
(
this
.
form
.
msgtel
&&
!
/^1
\d{10}(\,
1
\d{10})?
$/
.
test
(
this
.
form
.
msgtel
)){
cb
(
new
Error
(
'请输入正确的格式'
))
}
else
{
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('请打开地图自定义设置'))
}else{
}else{
cb();
cb();
}
}
} */
} */
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
,
{
label
:
'2个月'
value
:
2
,
},
{
label
:
"2个月"
,
value
:
3
,
},
label
:
'3个月'
{
},
{
value
:
3
,
value
:
4
,
label
:
"3个月"
,
label
:
'4个月'
},
},
{
{
value
:
5
,
value
:
4
,
label
:
'5个月'
label
:
"4个月"
,
},
{
},
value
:
6
,
{
label
:
'6个月'
value
:
5
,
}
label
:
"5个月"
,
],
},
dateRange
:
[],
{
msgtel
:
''
value
:
6
,
},
label
:
"6个月"
,
restainFenceName
:
''
,
},
rules
:
{
],
// fenceNo: [
dateRange
:
[],
// {required: true, message: '线路编号不能为空', trigger: 'blur'},
msgtel
:
""
,
// ],
},
fenceName
:
[
restainFenceName
:
""
,
{
required
:
true
,
message
:
'请输入线路名称'
,
trigger
:
'blur'
},
rules
:
{
{
pattern
:
/^
\S{2,200}
$/
,
message
:
'至少2字'
,
trigger
:
'blur'
},
// fenceNo: [
// {validator: checkFenceName, trigger: 'blur'}
// {required: true, message: '线路编号不能为空', trigger: 'blur'},
],
// ],
bizFenceType
:
[
fenceName
:
[
{
required
:
true
,
message
:
'请选择线路类型'
,
trigger
:
'change'
}
{
required
:
true
,
message
:
"请输入线路名称"
,
trigger
:
"blur"
},
],
{
pattern
:
/^
\S{2,200}
$/
,
message
:
"至少2字"
,
trigger
:
"blur"
},
specialShop
:
[
// {validator: checkFenceName, trigger: 'blur'}
{
required
:
true
,
validator
:
checkSpecialShop
,
trigger
:
'change'
}
],
],
bizFenceType
:
[
shapeType
:
[
{
required
:
true
,
message
:
"请选择线路类型"
,
trigger
:
"change"
},
{
required
:
true
}
],
]
specialShop
:
[
// electricFenceType: [
{
required
:
true
,
validator
:
checkSpecialShop
,
trigger
:
"change"
},
// {required: true, message: '', trigger: 'blur'}
],
// ],
shapeType
:
[{
required
:
true
}],
// electricTimeFenceType:[
// electricFenceType: [
// {required: true, validator: checkMonitorTime, trigger: 'change'}
// {required: true, message: '', trigger: 'blur'}
// ],
// ],
// electricTimeFenceType:[
/*dateRange: [
// {required: true, validator: checkMonitorTime, trigger: 'change'}
// ],
/*dateRange: [
{validator: checkMonitorTime, trigger: 'change'}
{validator: checkMonitorTime, trigger: 'change'}
],*/
],*/
// area: [
// area: [
// {validator: checkArea, trigger: 'change'}
// {validator: checkArea, trigger: 'change'}
// ],
// ],
// lng: [
// lng: [
// {validator: checkLng, trigger: 'blur'}
// {validator: checkLng, trigger: 'blur'}
// ],
// ],
// lat: [
// lat: [
// {validator: checkLat, trigger: 'blur'}
// {validator: checkLat, trigger: 'blur'}
// ],
// ],
// analysisAddress: [
// analysisAddress: [
// {validator: checkTransferAddr, trigger: 'change'}
// {validator: checkTransferAddr, trigger: 'change'}
// ],
// ],
// radius: [
// radius: [
// {validator: checkRadius, trigger: 'blur'}
// {validator: checkRadius, trigger: 'blur'}
// ],
// ],
// daterange: [{validator: checkDaterange}],
// daterange: [{validator: checkDaterange}],
// timeType:[{required: true, message: '请选择监控时间', trigger: 'change'}],
// timeType:[{required: true, message: '请选择监控时间', trigger: 'change'}],
// msgtel: [
// msgtel: [
// {validator: checkMsgtel, trigger: 'blur'}
// {validator: checkMsgtel, trigger: 'blur'}
// ],
// ],
/*map: [
/*map: [
{validator: checkMap, trigger: 'blur'}
{validator: checkMap, trigger: 'blur'}
]*/
]*/
},
},
transferTimeoutId
:
undefined
,
transferTimeoutId
:
undefined
,
geocoder
:
null
,
geocoder
:
null
,
transferFlag
:
null
,
transferFlag
:
null
,
transferError
:
false
,
transferError
:
false
,
userListModalVisible
:
false
,
userListModalVisible
:
false
,
selectedIds
:
[],
selectedIds
:
[],
mapData
:
null
,
mapData
:
null
,
polygonPath
:
[],
polygonPath
:
[],
loading
:
true
,
loading
:
true
,
filterVisible
:
false
,
filterVisible
:
false
,
filterText
:
""
,
filterText
:
""
,
filterTextData
:
[],
filterTextData
:
[],
// polygonPath: [
// polygonPath: [
// ["113.989993", "22.588762"],
// ["113.989993", "22.588762"],
// ["113.993298", "22.590585"],
// ["113.993298", "22.590585"],
// ["113.996431", "22.58892"],
// ["113.996431", "22.58892"],
// ["113.99274", "22.586622"],
// ["113.99274", "22.586622"],
// ["113.99008", "22.585592"]
// ["113.99008", "22.585592"]
// ]
// ]
}
};
},
},
watch
:
{
watch
:
{
/*dateRange(newVal){
/*dateRange(newVal){
if(newVal && newVal.length){
if(newVal && newVal.length){
this.form.startTime = moment(newVal[0]).format('YYYY-MM-DD HH:mm:ss');
this.form.startTime = moment(newVal[0]).format('YYYY-MM-DD HH:mm:ss');
this.form.endTime = moment(newVal[1]).format('YYYY-MM-DD HH:mm:ss');
this.form.endTime = moment(newVal[1]).format('YYYY-MM-DD HH:mm:ss');
...
@@ -559,65 +672,61 @@ export default{
...
@@ -559,65 +672,61 @@ 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
:
{
isEditMode
:
{
},
get
()
{
computed
:
{
return
typeof
this
.
fenceId
!=
"undefined"
;
isEditMode
:{
},
get
(){
},
return
typeof
this
.
fenceId
!=
'undefined'
},
}
created
()
{
}
let
_this
=
this
;
//this.getFenceSnsList();
},
//this.getSpecialShopList();
created
(){
window
.
Vue
.
directive
(
"loadmore"
,
{
let
_this
=
this
;
bind
(
el
,
binding
)
{
//this.getFenceSnsList();
const
selectWrap
=
el
.
querySelector
(
".el-table__body-wrapper"
);
//this.getSpecialShopList();
selectWrap
.
addEventListener
(
"scroll"
,
function
()
{
window
.
Vue
.
directive
(
'loadmore'
,
{
let
sign
=
0
;
bind
(
el
,
binding
)
{
const
scrollDistance
=
const
selectWrap
=
el
.
querySelector
(
'.el-table__body-wrapper'
)
this
.
scrollHeight
-
this
.
scrollTop
-
this
.
clientHeight
;
selectWrap
.
addEventListener
(
'scroll'
,
function
()
{
if
(
scrollDistance
==
sign
)
{
let
sign
=
0
//binding.value()
const
scrollDistance
=
this
.
scrollHeight
-
this
.
scrollTop
-
this
.
clientHeight
//console.log(sign)
if
(
scrollDistance
==
sign
)
{
// _this.currentPage++;
//binding.value()
// _this.getFenceSnsList(_this.fenceId);
//console.log(sign)
}
// _this.currentPage++;
});
},
// _this.getFenceSnsList(_this.fenceId);
});
}
})
}
})
this
.
getStoreList
()
this
.
getStoreList
();
},
},
mounted
()
{
mounted
()
{
this
.
listener
();
this
.
listener
();
},
},
methods
:
{
methods
:
{
selectStore
()
{
selectStore
()
{
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
();
}
}
//this.closeFilter();
//this.closeFilter();
},
},
closeFilter
()
{
closeFilter
()
{
...
@@ -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
();
...
@@ -655,172 +764,172 @@ export default{
...
@@ -655,172 +764,172 @@ export default{
if
(
!
value
)
return
true
;
if
(
!
value
)
return
true
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
return
data
.
label
.
indexOf
(
value
)
!==
-
1
;
},
},
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
);
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
}
else
{
// if(res.returnCode == 0){
// 线路编号无意义 屏蔽
// this.form.fenceNo = res.data.fenceNo;
// MONITOR_SERVICE.getNewFenceId().then((res)=>{
// if(res.returnCode == 0){
// this.form.fenceNo = res.data.fenceNo;
// this.$refs.fenceMap.initFence({
// this.$refs.fenceMap.initFence({
// fenceType: 'circle'
// fenceType: 'circle'
// });
// });
// }
// }
// });
// });
this
.
$refs
.
fenceMap
.
initFence
({
this
.
$refs
.
fenceMap
.
initFence
({
fenceType
:
'polygon'
,
fenceType
:
"polygon"
,
polygonPath
:
this
.
polygonPath
polygonPath
:
this
.
polygonPath
,
});
});
this
.
restainFenceName
=
undefined
;
}
},
getSpecialShopList
()
{
MONITOR_SERVICE
.
getSpecialShopList
().
then
(
res
=>
{
const
{
code
,
data
}
=
res
;
if
(
code
==
200
)
{
this
.
specialShopOptions
=
data
;
}
})
},
getDetailData
(
res
,
id
)
{
if
(
res
.
code
==
200
){
const
form
=
this
.
form
;
const
data
=
res
.
data
;
for
(
let
key
in
data
){
form
[
key
]
=
data
[
key
]
}
this
.
form
.
shapeType
=
3
;
this
.
form
.
dateRange
=
[
form
.
startTime
,
form
.
endTime
];
this
.
areaCode
=
form
.
areaCode
this
.
restainFenceName
=
form
.
fenceName
;
this
.
form
.
fenceName
=
form
.
fenceName
;
this
.
form
.
msgtel
=
data
.
telNumbers
;
this
.
form
.
specialShopId
=
data
.
shopId
;
this
.
form
.
specialShopName
=
data
.
shopName
;
this
.
form
.
specialShopCode
=
data
.
shopCode
;
this
.
getFenceSnsList
(
id
,
''
,
data
.
snList
)
if
(
form
.
shapeType
===
1
){
this
.
restainFenceName
=
undefined
;
this
.
mapData
=
{
}
fenceType
:
'circle'
,
},
lng
:
form
.
lng
,
getSpecialShopList
()
{
lat
:
form
.
lat
,
MONITOR_SERVICE
.
getSpecialShopList
().
then
((
res
)
=>
{
radius
:
form
.
radius
,
const
{
code
,
data
}
=
res
;
}
if
(
code
==
200
)
{
}
else
if
(
form
.
shapeType
===
4
){
this
.
specialShopOptions
=
data
;
this
.
mapData
=
{
}
fenceType
:
'area'
,
});
areaCode
:
this
.
form
.
areaCode
},
}
getDetailData
(
res
,
id
)
{
}
else
if
(
form
.
shapeType
===
3
){
if
(
res
.
code
==
200
)
{
if
(
data
.
lnglat
){
const
form
=
this
.
form
;
this
.
polygonPath
=
data
.
lnglat
.
split
(
'|'
).
map
((
item
)
=>
{
const
data
=
res
.
data
;
return
[
item
.
split
(
','
)[
0
],
item
.
split
(
','
)[
1
]]
for
(
let
key
in
data
)
{
})
form
[
key
]
=
data
[
key
];
}
}
this
.
form
.
shapeType
=
3
;
this
.
form
.
dateRange
=
[
form
.
startTime
,
form
.
endTime
];
this
.
areaCode
=
form
.
areaCode
;
this
.
restainFenceName
=
form
.
fenceName
;
this
.
form
.
fenceName
=
form
.
fenceName
;
this
.
form
.
msgtel
=
data
.
telNumbers
;
this
.
form
.
specialShopId
=
data
.
shopId
;
this
.
form
.
specialShopName
=
data
.
shopName
;
this
.
form
.
specialShopCode
=
data
.
shopCode
;
this
.
getFenceSnsList
(
id
,
""
,
data
.
snList
);
console
.
log
(
this
.
polygonPath
)
if
(
form
.
shapeType
===
1
)
{
this
.
mapData
=
{
this
.
mapData
=
{
fenceType
:
'polygon'
,
fenceType
:
"circle"
,
polygonPath
:
this
.
polygonPath
lng
:
form
.
lng
,
}
lat
:
form
.
lat
,
}
radius
:
form
.
radius
,
};
this
.
$refs
.
fenceMap
.
initFence
(
this
.
mapData
);
}
else
if
(
form
.
shapeType
===
4
)
{
}
this
.
mapData
=
{
},
fenceType
:
"area"
,
getFenceDetail
(
id
){
areaCode
:
this
.
form
.
areaCode
,
MONITOR_SERVICE
.
getFenceDetailById
({
fenceId
:
id
}).
then
((
res
)
=>
{
};
this
.
getDetailData
(
res
,
id
);
}
else
if
(
form
.
shapeType
===
3
)
{
});
if
(
data
.
lnglat
)
{
},
this
.
polygonPath
=
data
.
lnglat
.
split
(
"|"
).
map
((
item
)
=>
{
getUpdatedFenceDetail
(
id
){
let
arr
=
item
.
split
(
","
);
MONITOR_SERVICE
.
getUpdatedFenceDetail
({
fenceId
:
id
}).
then
((
res
)
=>
{
console
.
log
(
arr
);
this
.
getDetailData
(
res
,
id
);
return
mapService
.
getLngLat
(
arr
[
0
],
arr
[
1
]);
});
});
},
}
getFenceSnsList
(
id
,
cur
,
resData
){
let
params
=
{};
this
.
mapData
=
{
params
.
id
=
id
;
fenceType
:
"polygon"
,
this
.
tableData
=
this
.
tableData
.
concat
(
resData
);
polygonPath
:
this
.
polygonPath
,
this
.
$refs
.
userList
.
reset
(
resData
);
};
// if(this.currentPage>this.maxPage){
}
// return;
// }
this
.
$refs
.
fenceMap
.
initFence
(
this
.
mapData
);
// if(cur){
}
},
// params.currentPage =cur;
getFenceDetail
(
id
)
{
// params.pageSize = this.pageSize;
MONITOR_SERVICE
.
getFenceDetailById
({
fenceId
:
id
}).
then
((
res
)
=>
{
// }else{
this
.
getDetailData
(
res
,
id
);
// params.currentPage =this.currentPage;
});
// params.pageSize = this.pageSize;
},
// }
getUpdatedFenceDetail
(
id
)
{
MONITOR_SERVICE
.
getUpdatedFenceDetail
({
fenceId
:
id
}).
then
((
res
)
=>
{
this
.
getDetailData
(
res
,
id
);
});
// params.id=id;
},
// MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
getFenceSnsList
(
id
,
cur
,
resData
)
{
// if(res.c == 0){
let
params
=
{};
params
.
id
=
id
;
// this.tableData = this.tableData.concat(resData);
this
.
tableData
=
this
.
tableData
.
concat
(
resData
);
// this.maxPage = Math.ceil(resData.recordsTotal/this.pageSize);
this
.
$refs
.
userList
.
reset
(
resData
);
// this.$refs.userList.reset(resData);
// if(this.currentPage>this.maxPage){
// return;
// }
// }
// });
// if(cur){
},
shapeTypeChange
(){
// params.currentPage =cur;
//console.log(this.form.shapeType)
// params.pageSize = this.pageSize;
if
(
this
.
form
.
shapeType
==
4
){
// }else{
//this.$refs.clearArea.rest();
// params.currentPage =this.currentPage;
this
.
$refs
.
fenceForm
.
clearValidate
();
// params.pageSize = this.pageSize;
//this.$refs.fenceMap.updateSeach(this.form.areaCode);
// }
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'area'
// params.id=id;
});
// MONITOR_SERVICE.getFenceSnsList(params).then((res)=>{
}
else
if
(
this
.
form
.
shapeType
==
1
){
// if(res.c == 0){
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'circle'
// this.tableData = this.tableData.concat(resData);
});
// this.maxPage = Math.ceil(resData.recordsTotal/this.pageSize);
}
else
if
(
this
.
form
.
shapeType
==
3
){
// this.$refs.userList.reset(resData);
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
'polygon'
// }
});
// });
}
},
// if(val=="3"){
shapeTypeChange
()
{
//
//console.log(this.form.shapeType)
// }
if
(
this
.
form
.
shapeType
==
4
)
{
},
//this.$refs.clearArea.rest();
selectChange
(
selection
){
this
.
$refs
.
fenceForm
.
clearValidate
();
this
.
selectedIds
=
[];
//this.$refs.fenceMap.updateSeach(this.form.areaCode);
selection
.
map
((
obj
)
=>
{
this
.
$refs
.
fenceMap
.
updateFence
({
this
.
selectedIds
.
push
(
obj
.
id
)
fenceType
:
"area"
,
});
});
}
else
if
(
this
.
form
.
shapeType
==
1
)
{
},
this
.
$refs
.
fenceMap
.
updateFence
({
/*deleteFenceModel(id){
fenceType
:
"circle"
,
});
}
else
if
(
this
.
form
.
shapeType
==
3
)
{
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
"polygon"
,
});
}
// if(val=="3"){
//
// }
},
selectChange
(
selection
)
{
this
.
selectedIds
=
[];
selection
.
map
((
obj
)
=>
{
this
.
selectedIds
.
push
(
obj
.
id
);
});
},
/*deleteFenceModel(id){
let params = {};
let params = {};
let cur = this.currentPage
let cur = this.currentPage
if(this.selectedIds.length){
if(this.selectedIds.length){
...
@@ -842,360 +951,357 @@ export default{
...
@@ -842,360 +951,357 @@ export default{
});
});
}
}
},*/
},*/
userListModalChange
(
isOpen
)
{
userListModalChange
(
isOpen
)
{
this
.
userListModalVisible
=
isOpen
;
this
.
userListModalVisible
=
isOpen
;
},
},
userDate
()
{
userDate
()
{
this
.
userListModalVisible
=
true
;
this
.
userListModalVisible
=
true
;
},
},
/*resetMapForm(){
/*resetMapForm(){
this.form.lng = '';
this.form.lng = '';
this.form.lat = '';
this.form.lat = '';
this.form.address = '';
this.form.address = '';
this.form.radius = '';
this.form.radius = '';
},*/
},*/
/*fenceModalChange(isOpen){
/*fenceModalChange(isOpen){
this.fenceModalVisible = isOpen;
this.fenceModalVisible = isOpen;
},
},
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
){
this
.
polygonPath
=
data
.
polygonPath
}
},
changeStatus
(){
if
(
this
.
hideTab
==
true
){
this
.
hideTab
=
false
;
}
else
if
(
this
.
hideTab
==
false
){
this
.
hideTab
=
true
}
},
saveFence
(){
if
(
this
.
form
.
shapeType
==
3
){
if
(
this
.
polygonPath
.
length
===
0
){
this
.
$message
({
message
:
'请绘制线路'
,
type
:
'error'
});
return
;
}
}
this
.
$refs
.
fenceForm
.
validate
((
valid
)
=>
{
if
(
valid
){
this
.
submitting
=
true
;
const
params
=
this
.
getParams
();
params
.
snList
.
forEach
(
item
=>
{
if
(
item
.
sns
)
{
delete
item
.
sns
;
}
})
if
(
typeof
this
.
fenceId
!=
'undefined'
){
params
.
id
=
this
.
fenceId
;
MONITOR_SERVICE
.
updateFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
//this.closeDialog();
this
.
$message
({
message
:
'提交成功'
,
type
:
'success'
});
history
.
go
(
-
1
);
// this.$router.push({path:"fenceManagement"})
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
'error'
});
}
this
.
submitting
=
false
;
});
}
else
{
MONITOR_SERVICE
.
saveFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
){
if
(
data
.
polygonPath
&&
data
.
polygonPath
.
length
)
{
//this.closeDialog();
this
.
polygonPath
=
data
.
polygonPath
;
this
.
$message
({
}
message
:
'提交成功'
,
},
type
:
'success'
changeStatus
()
{
});
if
(
this
.
hideTab
==
true
)
{
history
.
go
(
-
1
);
this
.
hideTab
=
false
;
}
else
{
}
else
if
(
this
.
hideTab
==
false
)
{
this
.
$message
({
this
.
hideTab
=
true
;
message
:
res
.
message
,
}
type
:
'error'
},
});
saveFence
()
{
}
if
(
this
.
form
.
shapeType
==
3
)
{
this
.
submitting
=
false
;
if
(
this
.
polygonPath
.
length
===
0
)
{
// this.$router.push({path:"fenceManagement"})
this
.
$message
({
});
message
:
"请绘制线路"
,
}
type
:
"error"
,
});
}
else
{
return
;
return
false
;
}
}
}
});
this
.
$refs
.
fenceForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
submitting
=
true
;
const
params
=
this
.
getParams
();
params
.
snList
.
forEach
((
item
)
=>
{
if
(
item
.
sns
)
{
delete
item
.
sns
;
}
});
if
(
typeof
this
.
fenceId
!=
"undefined"
)
{
params
.
id
=
this
.
fenceId
;
MONITOR_SERVICE
.
updateFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
//this.closeDialog();
this
.
$message
({
message
:
"提交成功"
,
type
:
"success"
,
});
history
.
go
(
-
1
);
// this.$router.push({path:"fenceManagement"})
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
"error"
,
});
}
this
.
submitting
=
false
;
});
}
else
{
MONITOR_SERVICE
.
saveFence
(
params
).
then
((
res
)
=>
{
if
(
res
.
code
==
200
)
{
//this.closeDialog();
this
.
$message
({
message
:
"提交成功"
,
type
:
"success"
,
});
history
.
go
(
-
1
);
}
else
{
this
.
$message
({
message
:
res
.
message
,
type
:
"error"
,
});
}
this
.
submitting
=
false
;
// this.$router.push({path:"fenceManagement"})
});
}
}
else
{
return
false
;
}
});
},
cancel
()
{
window
.
history
.
go
(
-
1
);
// this.$router.push({path:"fenceManagement"})
},
getParams
()
{
const
form
=
this
.
form
;
const
params
=
{};
},
// params.fenceNo = form.fenceNo;
cancel
(){
params
.
fenceName
=
form
.
fenceName
;
window
.
history
.
go
(
-
1
);
// params.electricFenceType = form.electricFenceType;
// this.$router.push({path:"fenceManagement"})
//params.electricTimeFenceType = form.electricTimeFenceType
},
//params.startTime = form.startTime;
getParams
(){
//params.endTime = form.endTime;
const
form
=
this
.
form
;
params
.
shopId
=
form
.
specialShopId
;
const
params
=
{};
// params.des = form.des;
params
.
shapeType
=
form
.
shapeType
;
params
.
timeType
=
form
.
timeType
;
if
(
params
.
shapeType
==
4
)
{
params
.
areaCode
=
form
.
areaCode
;
params
.
areaString
=
form
.
areaString
;
}
else
if
(
params
.
shapeType
==
1
)
{
params
.
lnglat
=
`
${
form
.
lng
}
,
${
form
.
lat
}
`
;
params
.
radius
=
form
.
radius
;
params
.
analysisAddress
=
form
.
analysisAddress
;
}
else
if
(
params
.
shapeType
==
3
)
{
let
lnglats
=
this
.
polygonPath
.
map
((
item
)
=>
{
return
item
.
lng
+
","
+
item
.
lat
;
});
params
.
lnglat
=
lnglats
.
join
(
"|"
);
}
params
.
bizFenceType
=
form
.
bizFenceType
;
// params.status = form.status;
if
(
this
.
tableData
)
{
params
.
snList
=
this
.
tableData
;
}
else
{
params
.
snList
=
this
.
userArr
;
}
if
(
form
.
timeType
==
1
)
{
params
.
startTime
=
moment
().
format
(
"YYYY-MM-DD"
);
params
.
endTime
=
moment
().
add
(
10
,
"year"
).
format
(
"YYYY-MM-DD"
);
}
else
{
params
.
startTime
=
moment
(
this
.
form
.
dateRange
[
0
]).
format
(
"YYYY-MM-DD"
);
params
.
endTime
=
moment
(
this
.
form
.
dateRange
[
1
]).
format
(
"YYYY-MM-DD"
);
}
// params.fenceNo = form.fenceNo;
if
(
form
.
msgtel
)
{
params
.
fenceName
=
form
.
fenceName
;
params
.
telNumbers
=
form
.
msgtel
;
// params.electricFenceType = form.electricFenceType;
}
//params.electricTimeFenceType = form.electricTimeFenceType
//params.startTime = form.startTime;
//params.endTime = form.endTime;
params
.
shopId
=
form
.
specialShopId
;
// params.des = form.des;
params
.
shapeType
=
form
.
shapeType
;
params
.
timeType
=
form
.
timeType
;
if
(
params
.
shapeType
==
4
){
params
.
areaCode
=
form
.
areaCode
;
params
.
areaString
=
form
.
areaString
;
}
else
if
(
params
.
shapeType
==
1
){
params
.
lnglat
=
`
${
form
.
lng
}
,
${
form
.
lat
}
`
;
params
.
radius
=
form
.
radius
;
params
.
analysisAddress
=
form
.
analysisAddress
;
}
else
if
(
params
.
shapeType
==
3
){
params
.
lnglat
=
this
.
polygonPath
.
join
(
'|'
)
}
params
.
bizFenceType
=
form
.
bizFenceType
// params.status = form.status;
if
(
this
.
tableData
){
params
.
snList
=
this
.
tableData
}
else
{
params
.
snList
=
this
.
userArr
;
}
if
(
form
.
timeType
==
1
){
params
.
startTime
=
moment
().
format
(
'YYYY-MM-DD'
);
params
.
endTime
=
moment
().
add
(
10
,
'year'
).
format
(
'YYYY-MM-DD'
);
}
else
{
params
.
startTime
=
moment
(
this
.
form
.
dateRange
[
0
]).
format
(
'YYYY-MM-DD'
);
params
.
endTime
=
moment
(
this
.
form
.
dateRange
[
1
]).
format
(
'YYYY-MM-DD'
);
}
if
(
form
.
msgtel
){
params
.
telNumbers
=
form
.
msgtel
}
return
params
;
return
params
;
},
},
/*closeDialog(){
/*closeDialog(){
this.resetForm();
this.resetForm();
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"
)
/*addMode(){
.
querySelector
(
"form"
)
.
scrollTo
(
0
,
top
-
80
);
},
/*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
;
}
}
});
});
return
pass
;
return
pass
;
},
},
/*transfer(){
/*transfer(){
if(this.form.lng && this.form.lat && this.form.radius){
if(this.form.lng && this.form.lat && this.form.radius){
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
{
this
.
getAddress
(
flag
);
}
},
500
)
}
},
getAddress
(
flag
){
const
lnglatXY
=
[
this
.
form
.
lng
,
this
.
form
.
lat
];
this
.
form
.
analysisAddress
=
''
this
.
geocoder
.
getAddress
(
lnglatXY
,
(
status
,
result
)
=>
{
if
(
flag
==
this
.
transferFlag
){
if
(
status
===
'complete'
&&
result
.
info
===
'OK'
)
{
//获取地址成功
//console.log(result.regeocode.formattedAddress)
this
.
form
.
analysisAddress
=
result
.
regeocode
.
formattedAddress
;
this
.
transferError
=
false
;
this
.
$refs
.
fenceForm
.
validateField
(
'analysisAddress'
);
//this.$refs.fenceMap.updateMap(this.form)
}
else
{
this
.
transferError
=
true
;
this
.
$refs
.
fenceForm
.
validateField
(
'analysisAddress'
);
}
}
});
});
},
}
else
{
updateFence
(){
this
.
getAddress
(
flag
);
this
.
$refs
.
fenceMap
.
updateFence
({
}
fenceType
:
'circle'
,
},
500
);
lng
:
this
.
form
.
lng
,
}
lat
:
this
.
form
.
lat
,
radius
:
this
.
form
.
radius
});
this
.
transfer
()
},
handleSpecialShopChange
(
val
)
{
// 特约店级联选项
if
(
val
&&
val
.
length
>
1
)
{
this
.
form
.
specialShopId
=
val
[
1
];
console
.
log
(
this
.
form
.
specialShopId
)
}
}
},
},
components
:{
getAddress
(
flag
)
{
AreaSelect
,
const
lnglatXY
=
[
this
.
form
.
lng
,
this
.
form
.
lat
];
fenceMap
,
this
.
form
.
analysisAddress
=
""
;
userList
,
this
.
geocoder
.
getAddress
(
lnglatXY
,
(
status
,
result
)
=>
{
InfiniteLoading
if
(
flag
==
this
.
transferFlag
)
{
}
if
(
status
===
"complete"
&&
result
.
info
===
"OK"
)
{
}
//获取地址成功
//console.log(result.regeocode.formattedAddress)
this
.
form
.
analysisAddress
=
result
.
regeocode
.
formattedAddress
;
this
.
transferError
=
false
;
this
.
$refs
.
fenceForm
.
validateField
(
"analysisAddress"
);
//this.$refs.fenceMap.updateMap(this.form)
}
else
{
this
.
transferError
=
true
;
this
.
$refs
.
fenceForm
.
validateField
(
"analysisAddress"
);
}
}
});
},
updateFence
()
{
this
.
$refs
.
fenceMap
.
updateFence
({
fenceType
:
"circle"
,
lng
:
this
.
form
.
lng
,
lat
:
this
.
form
.
lat
,
radius
:
this
.
form
.
radius
,
});
this
.
transfer
();
},
handleSpecialShopChange
(
val
)
{
// 特约店级联选项
if
(
val
&&
val
.
length
>
1
)
{
this
.
form
.
specialShopId
=
val
[
1
];
console
.
log
(
this
.
form
.
specialShopId
);
}
},
},
components
:
{
AreaSelect
,
fenceMap
,
userList
,
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
;
text-align
:
right
;
text-align
:
right
;
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
;
}
}
</
style
>
</
style
>
\ No newline at end of file
\ No newline at end of file
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
})
// 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);
//
//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