|
|
@@ -1,9 +1,10 @@
|
|
|
import { piniaStore } from '@/stores'
|
|
|
import storage from '@/utils/storage'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { useNotification } from 'naive-ui'
|
|
|
+import { useNotification, useModal, NButton } from 'naive-ui'
|
|
|
import { h } from 'vue'
|
|
|
import { useOutsideHomeStore } from './home'
|
|
|
+import AlarmVideo from '../../views/VideoBox/components/AlarmVideo.vue'
|
|
|
|
|
|
const {
|
|
|
API_PANORAMA_POST,
|
|
|
@@ -97,6 +98,8 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
async connectAlarmWS() {
|
|
|
const useHomeStore = useOutsideHomeStore()
|
|
|
const notification = useNotification()
|
|
|
+ const alarmModel = useModal()
|
|
|
+
|
|
|
const eventTypes = { 1: '车牌', 2: '安全帽', 3: '定员' }
|
|
|
// setInterval(() => {
|
|
|
// const data = {
|
|
|
@@ -143,19 +146,51 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
}
|
|
|
websocket.onmessage = function (e) {
|
|
|
const data = JSON.parse(e.data)
|
|
|
- that.alarmList.unshift({ ...data, eventTypes })
|
|
|
+ const d = { ...data, eventTypes }
|
|
|
+ that.alarmList.unshift(d)
|
|
|
|
|
|
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'
|
|
|
+ h('div', { class: 'flex justify-between' }, [
|
|
|
+ h('div', [
|
|
|
+ h('span', '时间:'),
|
|
|
+ h(
|
|
|
+ 'span',
|
|
|
+ dayjs(parseInt(`${data.HaveTime}`.padEnd(13, '0'))).format(
|
|
|
+ 'YYYY-MM-DD HH:mm:ss'
|
|
|
+ )
|
|
|
)
|
|
|
+ ]),
|
|
|
+ h(
|
|
|
+ NButton,
|
|
|
+ {
|
|
|
+ text: true,
|
|
|
+ onClick: () => {
|
|
|
+ alarmModel.create({
|
|
|
+ title: d.eventTypes[d.EventId]
|
|
|
+ ? d.eventTypes[d.EventId] + '警告视频'
|
|
|
+ : '其他警告视频',
|
|
|
+ preset: 'card',
|
|
|
+ maskClosable: false,
|
|
|
+ style: {
|
|
|
+ width: '50%',
|
|
|
+ marginTop: '10%'
|
|
|
+ },
|
|
|
+ content: () =>
|
|
|
+ h(AlarmVideo, {
|
|
|
+ alarm: d
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ () =>
|
|
|
+ // h('div', {
|
|
|
+ // class: 'i-fluent-eye-48-regular',
|
|
|
+ // style: { width: '28px', height: '28px', padding: '5px' }
|
|
|
+ // })
|
|
|
+ '查看'
|
|
|
)
|
|
|
])
|
|
|
})
|
|
|
@@ -176,7 +211,7 @@ export const useSystemStore = defineStore('systemStore', {
|
|
|
const d = Object.assign(
|
|
|
{
|
|
|
device_id: '1723678178923719873',
|
|
|
- steam_type: 'live',
|
|
|
+ stream_type: 'live',
|
|
|
quality: 'low',
|
|
|
from: 0,
|
|
|
to: 0,
|