From 386a15236707b32ba8a2c98894b2bcdadcc87313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Thu, 21 Sep 2023 15:59:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=B0=E5=9B=BE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/BoardTopNav/index.vue | 14 ++++---- ruoyi-ui/src/views/board/GPS/index.vue | 33 ++++++++++++++++--- .../electronicFence/editElectronicFence.vue | 1 + 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ruoyi-ui/src/components/BoardTopNav/index.vue b/ruoyi-ui/src/components/BoardTopNav/index.vue index 99067f3..338779b 100644 --- a/ruoyi-ui/src/components/BoardTopNav/index.vue +++ b/ruoyi-ui/src/components/BoardTopNav/index.vue @@ -66,14 +66,9 @@ export default { }, async mounted() { - await this.setSelectSecnes() - if (this.$store.state.user.permissions.includes('business:monitor:index') || this.$store.state.user.permissions.includes('*:*:*')) { - this.isIndex = true - } else { - this.isIndex = false - } - if (this.$route.name === 'SmartScene') { + await this.setSelectSecnes() + if (this.$route.name === 'SmartScene'||this.$route.name === 'GPS' ) { if (this.$route.query?.name) { this.name = this.$route.query?.name } else { @@ -84,6 +79,11 @@ export default { }); } } + if (this.$store.state.user.permissions.includes('business:monitor:index') || this.$store.state.user.permissions.includes('*:*:*')) { + this.isIndex = true + } else { + this.isIndex = false + } }, methods: { async setSelectSecnes() { diff --git a/ruoyi-ui/src/views/board/GPS/index.vue b/ruoyi-ui/src/views/board/GPS/index.vue index 3f4be69..1958ef0 100644 --- a/ruoyi-ui/src/views/board/GPS/index.vue +++ b/ruoyi-ui/src/views/board/GPS/index.vue @@ -174,25 +174,47 @@ export default { center: [113.4, 23.35], }); }, + setText(e) { + let position = e.areaPoints?.length > 0 ? e.areaPoints:e.centerPoint + if(position.length>0){ + let length = position.length + let longitudes = e.areaPoints.map(e=>e.longitude).reduce((a,b)=>a+b) + let latitudes = e.areaPoints.map(e=>e.latitude).reduce((a,b)=>a+b) + position = [longitudes/length, latitudes/length] + }else{ + position = [e.centerPoint.longitude, e.centerPoint.latitude] + } + let text = new AMap.Text({ + text: e.deviceCount + (e.abnormalCount ? ('/' + e.abnormalCount) : ''), + anchor: 'center', + draggable: true, + cursor: 'pointer', + position:position + }); + map.add(text) + }, setPolygon(position) { let e = position.map(val => { return [val.longitude, val.latitude] }) - let thisPolygon = new AMap.Polygon({path: e}); + let thisPolygon = new AMap.Polygon({ + path: e, + fillColor: e ? '#ff0000' : '#1791fc', + }); map.add(thisPolygon) map.setFitView() }, - setCircle(center, radius) { + setCircle(center, radius, e) { let circle = new AMap.Circle({ center, radius, borderWeight: 3, - strokeColor: "#FF33FF", + strokeColor: e ? '#ff0000' : "#FF33FF", strokeWeight: 6, strokeOpacity: 0.2, fillOpacity: 0.4, strokeDasharray: [10, 10], - fillColor: '#1791fc', + fillColor: e ? '#ff0000' : '#1791fc', }) map.add(circle); map.setFitView() @@ -269,8 +291,9 @@ export default { this.setPolygon(e.areaPoints) } if (e.centerPoint) { - this.setCircle([e.centerPoint.longitude, e.centerPoint.latitude], e.radius) + this.setCircle([e.centerPoint.longitude, e.centerPoint.latitude], e.radius, e.abnormalCount) } + this.setText(e) }) } } diff --git a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue index 4ff1032..3a20d63 100644 --- a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue +++ b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue @@ -278,6 +278,7 @@ export default { }) polygonData.forEach(e => { this.setPolygon(e) + console.log(e) }) circleAreaList.forEach(e => {