fix: 修复实时事件组件弹出开发中提示

This commit is contained in:
huanghao1412 2024-05-20 11:07:55 +08:00
parent 430e003fd0
commit adfaf0475b

View File

@ -191,14 +191,16 @@ let alarmVideos = ref([])
// brand: '', // brand: '',
// plugin: '', // plugin: '',
// }) // })
let currentVideo: any = ref(null) let currentVideo: any = ref({})
const getVideos = (ids: number[], alarmIds: number[]) => { const getVideos = (ids: number[], alarmIds: number[]) => {
if(ids.length) { if(ids.length) {
publicInterface('/dcim/video_monitor/other_device', 'get_alarm_device', {device_uids: ids.toString()}).then((res: any) => { publicInterface('/dcim/video_monitor/other_device', 'get_alarm_device', {device_uids: ids.toString()}).then((res: any) => {
if(res.errcode !== '00000') return if(res.errcode !== '00000') return
let arr:any = [] let arr:any = []
ids.forEach(id => { ids.forEach(id => {
if(typeof id === 'number') {
arr.push(res.data[id] ? res.data[id][0] : null) arr.push(res.data[id] ? res.data[id][0] : null)
}
}) })
alarmVideos.value = arr.concat() alarmVideos.value = arr.concat()
@ -210,8 +212,8 @@ const getVideos = (ids: number[], alarmIds: number[]) => {
break break
} }
} }
if(!currentVideo.value && !last) return if(JSON.stringify(currentVideo.value) === '{}' && !last) return
let obj = currentVideo.value ? JSON.parse(JSON.stringify(currentVideo.value)) : { let obj = JSON.stringify(currentVideo.value) !== '{}' ? JSON.parse(JSON.stringify(currentVideo.value)) : {
ip: '', ip: '',
port: null, port: null,
account: '', account: '',
@ -226,7 +228,7 @@ const getVideos = (ids: number[], alarmIds: number[]) => {
} }
} }
obj.alarmId = alarmIds[index] obj.alarmId = alarmIds[index]
Object.assign(currentVideo, obj) currentVideo.value = obj
obj.showForce = false obj.showForce = false
postMessageToParent({ postMessageToParent({
type: 'openVideoV2', type: 'openVideoV2',
@ -311,7 +313,7 @@ const getData = () => {
serial_no: e.serial_no, serial_no: e.serial_no,
remark: e.remark, remark: e.remark,
})) }))
getVideos(arr.map(_ => _.device.uid), arr.map(_ => _.id)) getVideos(arr.map(_ => _.device?.uid), arr.map(_ => _.id))
if (checkAll.value) { if (checkAll.value) {
arr = arr.map((e:any) => ({ ...e, checked: e.confirm_status !== 'ok' })) arr = arr.map((e:any) => ({ ...e, checked: e.confirm_status !== 'ok' }))
} else if (lastTableData.length) { } else if (lastTableData.length) {