123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <pannel class="fence-location-container">
- <template v-slot:title>
- 围栏闯禁事件
- </template>
- <template v-slot:action>
- </template>
- <template v-slot:content>
- <div>
- <socket-message :onMessage="onMessage" :ws="ws"></socket-message>
- </div>
- </template>
- </pannel>
- </template>
- <script>
- import { listFenceVioEvt } from '@/api/bd/fenceVioEvt';
- import SocketMessage from '@/components/WebsocketMessage/index.vue';
- import Pannel from '@/views/bd/pannel/index.vue';
- import FingerprintJS from '@fingerprintjs/fingerprintjs';
- import dayjs from 'dayjs';
- export default {
- name: 'fenceVioEvt',
- components: {
- SocketMessage,
- Pannel,
- },
- data() {
- return {
- evtList: [],
- fp: null,
- ws: null,
- };
- },
- // 组件卸载前清空图层信息
- beforeDestroy() {
- },
- created() {
- },
- mounted() {
- this.getFenceVioEvtList();
- this.getFingerprint();
- },
- methods: {
- dayjs,
- async getFenceVioEvtList() {
- const { rows } = await listFenceVioEvt({
- pageNum: 1,
- pageSize: 10,
- });
- this.evtList = rows;
- },
- 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}`;
- },
- onMessage(a) {
- const data = JSON.parse(a.data);
- this.$notify({
- title: '警告',
- message: `${data.msg.fenceName}发生闯禁事件。`,
- type: 'warning',
- });
- this.getFenceVioEvtList();
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />
|