|
@@ -3,6 +3,7 @@ import storage from '@/utils/storage'
|
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
|
import { useNotification } from 'naive-ui'
|
|
import { useNotification } from 'naive-ui'
|
|
|
import { h } from 'vue'
|
|
import { h } from 'vue'
|
|
|
|
|
+import { useOutsideHomeStore } from './home'
|
|
|
|
|
|
|
|
const {
|
|
const {
|
|
|
API_PANORAMA_POST,
|
|
API_PANORAMA_POST,
|
|
@@ -32,7 +33,8 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
videoList: {}, // 视频地址列表
|
|
videoList: {}, // 视频地址列表
|
|
|
partObj: {}, //细节X Y
|
|
partObj: {}, //细节X Y
|
|
|
ratio: 0, //全景比例
|
|
ratio: 0, //全景比例
|
|
|
- alarmList: [] // 告警列表
|
|
|
|
|
|
|
+ alarmList: [], // 告警列表
|
|
|
|
|
+ alarmCount: 0 // 告警数量
|
|
|
}),
|
|
}),
|
|
|
getters: {
|
|
getters: {
|
|
|
ipF() {
|
|
ipF() {
|
|
@@ -93,6 +95,7 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
},
|
|
},
|
|
|
// 连接报警信息
|
|
// 连接报警信息
|
|
|
async connectAlarmWS() {
|
|
async connectAlarmWS() {
|
|
|
|
|
+ const useHomeStore = useOutsideHomeStore()
|
|
|
const notification = useNotification()
|
|
const notification = useNotification()
|
|
|
const eventTypes = { 1: '车牌', 2: '安全帽', 3: '定员' }
|
|
const eventTypes = { 1: '车牌', 2: '安全帽', 3: '定员' }
|
|
|
// setInterval(() => {
|
|
// setInterval(() => {
|
|
@@ -123,6 +126,12 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
// this.alarmList.splice(20, 10)
|
|
// this.alarmList.splice(20, 10)
|
|
|
// }
|
|
// }
|
|
|
// }, 1000)
|
|
// }, 1000)
|
|
|
|
|
+
|
|
|
|
|
+ useHomeStore.$subscribe((mutation, state) => {
|
|
|
|
|
+ if (state.temp === 'video') {
|
|
|
|
|
+ notification.destroyAll()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
let websocket
|
|
let websocket
|
|
|
let that = this
|
|
let that = this
|
|
|
;(() => {
|
|
;(() => {
|
|
@@ -134,21 +143,25 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
}
|
|
}
|
|
|
websocket.onmessage = function (e) {
|
|
websocket.onmessage = function (e) {
|
|
|
const data = JSON.parse(e.data)
|
|
const data = JSON.parse(e.data)
|
|
|
- that.alarmList.unshift(data)
|
|
|
|
|
|
|
+ that.alarmList.unshift({ ...data, eventTypes })
|
|
|
|
|
|
|
|
- notification.warning({
|
|
|
|
|
- title: eventTypes[data.EventId] ? eventTypes[data.EventId] + '警告' : '其他警告',
|
|
|
|
|
- content: () =>
|
|
|
|
|
- h('p', [
|
|
|
|
|
- h('span', '时间:'),
|
|
|
|
|
- h(
|
|
|
|
|
- 'span',
|
|
|
|
|
- dayjs(parseInt(`${data.HaveTime}`.padEnd(13, '0'))).format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
- )
|
|
|
|
|
- ])
|
|
|
|
|
- })
|
|
|
|
|
- if (that.alarmList.length >= 30) {
|
|
|
|
|
- that.alarmList.splice(20, 10)
|
|
|
|
|
|
|
+ if (useHomeStore.temp != 'video') {
|
|
|
|
|
+ notification.warning({
|
|
|
|
|
+ title: eventTypes[data.EventId] ? eventTypes[data.EventId] + '警告' : '其他警告',
|
|
|
|
|
+ content: () =>
|
|
|
|
|
+ h('p', [
|
|
|
|
|
+ h('span', '时间:'),
|
|
|
|
|
+ h(
|
|
|
|
|
+ 'span',
|
|
|
|
|
+ dayjs(parseInt(`${data.HaveTime}`.padEnd(13, '0'))).format(
|
|
|
|
|
+ 'YYYY-MM-DD HH:mm:ss'
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ ])
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (that.alarmList.length >= 50) {
|
|
|
|
|
+ that.alarmList.splice(30, 20)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
websocket.onerror = function () {
|
|
websocket.onerror = function () {
|