|
@@ -1,20 +1,17 @@
|
|
|
<template>
|
|
|
- <pannel class="fence-location-container">
|
|
|
+ <pannel class="rooms-container">
|
|
|
<template v-slot:title>
|
|
|
- 围栏闯禁事件
|
|
|
+ 室内定位
|
|
|
</template>
|
|
|
<template v-slot:action>
|
|
|
|
|
|
</template>
|
|
|
<template v-slot:content>
|
|
|
<div class="location-list">
|
|
|
- <template v-for="evt in evtList">
|
|
|
- <div :key="`evt_${evt.id}`" class="list-item">
|
|
|
- <span class="over-flow-hidden" style="width: 40%">
|
|
|
- {{ evt.evtDesc }}
|
|
|
- </span>
|
|
|
- <span class="over-flow-hidden" style="width: 40%">
|
|
|
- {{ dayjs(evt.evtTime).format('YYYY-MM-DD HH:mm') }}
|
|
|
+ <template v-for="room in roomList">
|
|
|
+ <div :key="`room_${room.id}`" class="list-item">
|
|
|
+ <span class="over-flow-hidden" style="width: 80%">
|
|
|
+ {{ room.room }}
|
|
|
</span>
|
|
|
<span class="over-flow-hidden" style="width: 20%">
|
|
|
</span>
|
|
@@ -28,14 +25,12 @@
|
|
|
|
|
|
<script>
|
|
|
|
|
|
-import { listFenceInfo } from '@/api/bd/fenceInfo';
|
|
|
-import { listFenceVioEvt } from '@/api/bd/fenceVioEvt';
|
|
|
import SocketMessage from '@/components/WebsocketMessage/index.vue';
|
|
|
+import { uuid } from '@/utils';
|
|
|
import maphandle from '@/views/bd/map/maphandle';
|
|
|
import Pannel from '@/views/bd/pannel/index.vue';
|
|
|
-import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
|
|
import dayjs from 'dayjs';
|
|
|
-import evt_vio from './icon/evt_vio.svg';
|
|
|
+import room_location from './icon/room_location.jpg';
|
|
|
|
|
|
export default {
|
|
|
name: 'room-location',
|
|
@@ -46,113 +41,78 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- evtList: [],
|
|
|
+ roomList: [],
|
|
|
fp: null,
|
|
|
ws: null,
|
|
|
markLayer: null,
|
|
|
+ markLayerId: '',
|
|
|
};
|
|
|
},
|
|
|
// 组件卸载前清空图层信息
|
|
|
beforeDestroy() {
|
|
|
- this.markLayer && window.map.removeLayersById('real_time_markerLayer');
|
|
|
+ this.markLayer && window.map.removeLayersById(this.markLayerId);
|
|
|
},
|
|
|
created() {
|
|
|
- this.markLayer = new BDLayers.Lib.Layer.CBVectorLayer('real_time_markerLayer', true);
|
|
|
- window.map.addCustomLayers(this.markLayer,5);
|
|
|
+ if (this.markLayer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.markLayerId = `real_time_markerLayer${uuid()}`;
|
|
|
+ this.markLayer = new BDLayers.Lib.Layer.CBVectorLayer(this.markLayerId, {
|
|
|
+ enableAltitude: true,
|
|
|
+ });
|
|
|
+ window.map.addCustomLayers(this.markLayer, 5);
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getFenceVioEvtList();
|
|
|
- this.getFingerprint();
|
|
|
- this.getFenceList();
|
|
|
+ this.getRoom();
|
|
|
},
|
|
|
methods: {
|
|
|
dayjs,
|
|
|
- async getFenceVioEvtList() {
|
|
|
- const { rows } = await listFenceVioEvt({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- });
|
|
|
- this.evtList = rows;
|
|
|
- this.addEvtToMap();
|
|
|
- },
|
|
|
- addEvtToMap() {
|
|
|
- this.evtList.forEach((item, i) => {
|
|
|
- const {
|
|
|
- lng,
|
|
|
- lat,
|
|
|
- } = item;
|
|
|
- var marker = new BDLayers.Lib.Overlays.MarkerImg(
|
|
|
- `marker0${i}`,
|
|
|
- [lng, lat],
|
|
|
- {
|
|
|
- imgurl: evt_vio,
|
|
|
- iconSize: [45, 45],
|
|
|
- },
|
|
|
- );
|
|
|
- this.markLayer.addMarker(marker);
|
|
|
- });
|
|
|
- },
|
|
|
- async getFenceList() {
|
|
|
- const { rows } = await listFenceInfo({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- });
|
|
|
- if (!rows || rows.length < 1) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const result = [];
|
|
|
- rows.forEach(item => {
|
|
|
- const {
|
|
|
- id,
|
|
|
- defenceName,
|
|
|
- poly,
|
|
|
- } = item;
|
|
|
- const polygon = this.drawPoly({
|
|
|
- name: defenceName,
|
|
|
- coordinates: this.polygonToCoordinates(poly),
|
|
|
- bizAttr: {
|
|
|
- id,
|
|
|
- name: defenceName,
|
|
|
+ getRoom() {
|
|
|
+ this.roomList = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ room: '创研院C4',
|
|
|
+ poly: 'POLYGON((118.869042069359 32.0131156239015, 118.86839482667 32.0131180416999, 118.868399686907 32.0133391503578, 118.869046506393 32.0133281708171, 118.869042069359 32.0131156239015))',
|
|
|
+ altitude: 11.4,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ // this.roomList.forEach(item => {
|
|
|
+ // const {
|
|
|
+ // id,
|
|
|
+ // room,
|
|
|
+ // poly,
|
|
|
+ // altitude,
|
|
|
+ // } = item;
|
|
|
+ // const polygon = this.drawPoly({
|
|
|
+ // name: room,
|
|
|
+ // altitude,
|
|
|
+ // coordinates: this.polygonToCoordinates(poly),
|
|
|
+ // bizAttr: {
|
|
|
+ // id,
|
|
|
+ // name: room,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // var marker = new BDLayers.Lib.Overlays.UIMarker('marker00', [118.869042069359, 32.0131156239015],
|
|
|
+ // {
|
|
|
+ // 'draggable': false,
|
|
|
+ // 'single': false,
|
|
|
+ // 'content': `<div class="text_marker" style="color:#fff"><img src="${room_location}" width="40px" height="40px"/></div>`,
|
|
|
+ // altitude: 800,
|
|
|
+ // });
|
|
|
+ var marker = new BDLayers.Lib.Overlays.MarkerImg(
|
|
|
+ 'marker01',
|
|
|
+ [118.869046506393,32.0133281708171], {
|
|
|
+ imgurl: room_location,
|
|
|
+ iconSize: [90, 54],
|
|
|
+ altitude: 20,
|
|
|
},
|
|
|
- });
|
|
|
- result.push({
|
|
|
- id,
|
|
|
- name: defenceName,
|
|
|
- polygon,
|
|
|
- });
|
|
|
+ );
|
|
|
+ marker.on('click', () => {
|
|
|
+
|
|
|
});
|
|
|
- },
|
|
|
- async getFingerprint() {
|
|
|
- // 初始化FingerprintJS
|
|
|
- const fp = await FingerprintJS.load();
|
|
|
- // 获取访问者的指纹
|
|
|
- const result = await fp.get();
|
|
|
- // 配置
|
|
|
- const {
|
|
|
- osCpu,
|
|
|
- webGlBasics,
|
|
|
- languages,
|
|
|
- audioBaseLatency,
|
|
|
- reducedTransparency,
|
|
|
- vendor,
|
|
|
- vendorFlavors,
|
|
|
- fonts,
|
|
|
- fontPreferences,
|
|
|
- plugins,
|
|
|
- forcedColors,
|
|
|
- domBlockers,
|
|
|
- pdfViewerEnabled,
|
|
|
- audio,
|
|
|
- canvas,
|
|
|
- webGlExtensions,
|
|
|
- math,
|
|
|
- ...components
|
|
|
- } = result.components;
|
|
|
- const extendedComponents = {
|
|
|
- ...components,
|
|
|
- };
|
|
|
- const fingerprintId = FingerprintJS.hashComponents(extendedComponents);
|
|
|
- this.ws = `/ws/evt/${fingerprintId}`;
|
|
|
+ this.markLayer.addMarker(marker);
|
|
|
+ // marker.getMarker().addTo(window.map.map);
|
|
|
},
|
|
|
onMessage(a) {
|
|
|
const data = JSON.parse(a.data);
|
|
@@ -162,7 +122,6 @@ export default {
|
|
|
message: `${data.msg.fenceName}发生闯禁事件。`,
|
|
|
type: 'warning',
|
|
|
});
|
|
|
- this.getFenceVioEvtList();
|
|
|
},
|
|
|
},
|
|
|
};
|