修改电子围栏

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

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

@ -6,7 +6,7 @@
<el-input v-model="form.electronicFenceName" placeholder="请输入电子围栏名称"/> <el-input v-model="form.electronicFenceName" placeholder="请输入电子围栏名称"/>
</el-form-item> </el-form-item>
<el-form-item label="所属场景" prop="sceneId"> <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 <el-option
v-for="(scene, index) in editedScenes" v-for="(scene, index) in editedScenes"
:key="index" :key="index"
@ -107,9 +107,9 @@ export default {
this.editedScenes = response.data; this.editedScenes = response.data;
}); });
this.getEditedElectronicFence();
}, },
mounted() { mounted() {
this.getEditedElectronicFence();
map = new AMap.Map('map', { map = new AMap.Map('map', {
zoom: 11, zoom: 11,
center: [113.4, 23.35], center: [113.4, 23.35],
@ -134,12 +134,6 @@ export default {
}) })
}, },
methods: { methods: {
a() {
this.clear();
[path, path1].forEach(e => {
this.setPolygon(e)
})
},
clear() { clear() {
if (!polyEditor) return if (!polyEditor) return
CircleEditor.close(); CircleEditor.close();
@ -168,6 +162,15 @@ export default {
map.add(thisPolygon) map.add(thisPolygon)
map.setFitView() 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() { getAreaData() {
let polygons = map.getAllOverlays('polygon'); let polygons = map.getAllOverlays('polygon');
let circles = map.getAllOverlays('circle'); let circles = map.getAllOverlays('circle');
@ -211,8 +214,29 @@ export default {
if(electronicFenceId!=undefined){ if(electronicFenceId!=undefined){
getElectronicFence(electronicFenceId).then(response => { getElectronicFence(electronicFenceId).then(response => {
this.form = response.data; this.form = response.data;
alert(this.form.circleAreaListStr); let circleAreaList = JSON.parse(response.data.circleAreaListStr)
alert(this.form.polygonAreaListStr); 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) { handleUpdate(row) {
const electronicFenceId = row.electronicFenceId || this.ids const electronicFenceId = row.electronicFenceId || this.ids
let electronicFenceName = row.electronicName; let electronicFenceName = row.electronicName;
this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId, params); this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId, );
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {

Loading…
Cancel
Save