diff --git a/ruoyi-ui/src/views/business/effectiveFence/index.vue b/ruoyi-ui/src/views/business/effectiveFence/index.vue index 865f1f8..1476efd 100644 --- a/ruoyi-ui/src/views/business/effectiveFence/index.vue +++ b/ruoyi-ui/src/views/business/effectiveFence/index.vue @@ -13,9 +13,7 @@
- 新增多边形 - 新增圆 清空 保存 diff --git a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue index 484ff43..fc0fc56 100644 --- a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue +++ b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue @@ -6,7 +6,7 @@ - + { - 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}) + }) }); } }, diff --git a/ruoyi-ui/src/views/business/electronicFence/index.vue b/ruoyi-ui/src/views/business/electronicFence/index.vue index 3ff6106..f8b4c91 100644 --- a/ruoyi-ui/src/views/business/electronicFence/index.vue +++ b/ruoyi-ui/src/views/business/electronicFence/index.vue @@ -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() {