修改电子围栏

dev
夜笙歌 1 year ago
parent 92c5c6a7c0
commit 678261d878

@ -13,9 +13,7 @@
</el-form-item>
</el-form>
<div>
<el-button type="primary" @click="createPolygon"></el-button>
<el-button type="primary" @click="createCircle"></el-button>
<el-button type="primary" @click="clear"></el-button>
<el-button type="primary" @click="getDate"></el-button>

@ -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})
})
});
}
},

@ -378,7 +378,7 @@ export default {
handleUpdate(row) {
const electronicFenceId = row.electronicFenceId || this.ids
let electronicFenceName = row.electronicName;
this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId, params);
this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId, );
},
/** 提交按钮 */
submitForm() {

Loading…
Cancel
Save