|
|
|
@ -6,7 +6,7 @@
|
|
|
|
|
<el-input v-model="form.electronicFenceName" placeholder="请输入电子围栏名称"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="所属场景" prop="sceneId">
|
|
|
|
|
<el-select v-model="form.sceneId" placeholder="请选择" @input="sceneChange" :disabled="sceneDisabled">
|
|
|
|
|
<el-select v-model="form.sceneId" placeholder="请选择">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="(scene, index) in editedScenes"
|
|
|
|
|
:key="index"
|
|
|
|
@ -107,9 +107,9 @@ export default {
|
|
|
|
|
this.editedScenes = response.data;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.getEditedElectronicFence();
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.getEditedElectronicFence();
|
|
|
|
|
map = new AMap.Map('map', {
|
|
|
|
|
zoom: 11,
|
|
|
|
|
center: [113.4, 23.35],
|
|
|
|
@ -134,12 +134,6 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
a() {
|
|
|
|
|
this.clear();
|
|
|
|
|
[path, path1].forEach(e => {
|
|
|
|
|
this.setPolygon(e)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
clear() {
|
|
|
|
|
if (!polyEditor) return
|
|
|
|
|
CircleEditor.close();
|
|
|
|
@ -168,6 +162,15 @@ export default {
|
|
|
|
|
map.add(thisPolygon)
|
|
|
|
|
map.setFitView()
|
|
|
|
|
},
|
|
|
|
|
setCircle(e) {
|
|
|
|
|
let thisCircle = new AMap.Circle({center: e.center,radius: e.radius});
|
|
|
|
|
thisCircle.on('dblclick', () => {
|
|
|
|
|
CircleEditor.setTarget(thisCircle);
|
|
|
|
|
CircleEditor.open();
|
|
|
|
|
})
|
|
|
|
|
map.add(thisCircle)
|
|
|
|
|
map.setFitView()
|
|
|
|
|
},
|
|
|
|
|
getAreaData() {
|
|
|
|
|
let polygons = map.getAllOverlays('polygon');
|
|
|
|
|
let circles = map.getAllOverlays('circle');
|
|
|
|
@ -211,8 +214,29 @@ export default {
|
|
|
|
|
if(electronicFenceId!=undefined){
|
|
|
|
|
getElectronicFence(electronicFenceId).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
alert(this.form.circleAreaListStr);
|
|
|
|
|
alert(this.form.polygonAreaListStr);
|
|
|
|
|
let circleAreaList = JSON.parse(response.data.circleAreaListStr)
|
|
|
|
|
let polygonAreaList = JSON.parse(response.data.polygonAreaListStr)
|
|
|
|
|
let polygonData1 = {}
|
|
|
|
|
let polygonData = []
|
|
|
|
|
polygonAreaList.forEach(e=>{
|
|
|
|
|
if(polygonData1[e.index]){
|
|
|
|
|
polygonData1[e.index].push([e.longitude,e.latitude])
|
|
|
|
|
}else{
|
|
|
|
|
polygonData1[e.index] = [[e.longitude,e.latitude]]
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Object.keys(polygonData1).forEach(e=>{
|
|
|
|
|
polygonData[e] = polygonData1[e]
|
|
|
|
|
})
|
|
|
|
|
polygonData.forEach(e=>{
|
|
|
|
|
this.setPolygon(e)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
circleAreaList.forEach(e=>{
|
|
|
|
|
let center = JSON.parse(e.center)
|
|
|
|
|
let radius = e.radius
|
|
|
|
|
this.setCircle({center,radius})
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|