From 2772c49df1fd1885d924eb22a5c63f95cfcd3f07 Mon Sep 17 00:00:00 2001 From: kerwincui <164770707@qq.com> Date: Thu, 20 Mar 2025 22:02:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E8=AF=A6=E6=83=85=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=8C=E5=85=B6=E4=B8=ADtab-panel=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0key=E5=B1=9E=E6=80=A7=E8=A7=A3=E5=86=B3key?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/src/views/iot/device/device-edit.vue | 114 +++++++++++++---------- 1 file changed, 67 insertions(+), 47 deletions(-) diff --git a/vue/src/views/iot/device/device-edit.vue b/vue/src/views/iot/device/device-edit.vue index 594ca989..9de3b4d6 100644 --- a/vue/src/views/iot/device/device-edit.vue +++ b/vue/src/views/iot/device/device-edit.vue @@ -26,8 +26,6 @@ 设备编号 - 生成 生成 @@ -123,36 +121,31 @@ - + 运行状态 - - - + 设备直播 - + 设备定时 - + 设备用户 - + 事件日志 - + 指令日志 @@ -232,13 +225,11 @@ import runningStatus from './running-status'; import deviceTimer from './device-timer'; import DeviceFunc from './device-functionlog'; -import business from '@/views/iot/business/index.vue'; import vueQr from 'vue-qr'; import { loadBMap } from '@/utils/map.js'; -import { deviceSynchronization, getDevice, addDevice, updateDevice, generatorDeviceNum, listDevice, getMqttConnect } from '@/api/iot/device'; +import { deviceSynchronization, getDevice, addDevice, updateDevice, generatorDeviceNum, getMqttConnect } from '@/api/iot/device'; import { getDeviceRunningStatus } from '@/api/iot/device'; import { cacheJsonThingsModel } from '@/api/iot/model'; -import { getDeviceTemp } from '@/api/iot/temp'; import deviceLiveStream from '@/views/components/player/deviceLiveStream'; import sipid from '../sip/sipidGen.vue'; import player from '@/views/components/player/player.vue'; @@ -248,7 +239,6 @@ export default { name: 'DeviceEdit', dicts: ['iot_device_status', 'iot_location_way'], components: { - business, DeviceFunc, deviceLog, deviceUser, @@ -377,7 +367,7 @@ export default { // 获取设备信息 this.form.deviceId = this.$route.query && this.$route.query.deviceId; if (this.form.deviceId != 0) { - this.connectMqtt(); + // this.connectMqtt(); this.getDevice(this.form.deviceId); } this.isSubDev = this.$route.query.isSubDev === 1; @@ -496,54 +486,84 @@ export default { getPlayerData(data) { this.activeName = data.tabName; this.channelId = data.channelId; - // this.$set(this.form, 'channelId', this.channelId); if (this.channelId) { this.$refs.deviceLiveStream.channelId = this.channelId; this.$refs.deviceLiveStream.changeChannel(); } }, - /** 选项卡改变事件*/ - // tabChange(panel) { - // this.$nextTick(() => { - // // 获取监测统计数据 - // if (panel.name === 'deviceStastic' && !this.isSubDev) { - // this.$refs.deviceStatistic.getListHistory(); - // } else if (panel.name === 'deviceTimer'&& !this.isSubDev) { - // this.$refs.deviceTimer.getList(); - // } - // }); - // }, tabChange(panel) { - if (this.form.deviceType == 3 && panel.name != 'deviceReturn') { - if (panel.name === 'videoLive') { - if (this.channelId) { - this.$refs.deviceLiveStream.channelId = this.channelId; - this.$refs.deviceLiveStream.changeChannel(); + this.$nextTick(() => { + if (this.form.deviceType == 3 && panel.name != 'deviceReturn') { + if (panel.name === 'sipPlayer') { + if (this.$refs.deviceVideo && this.$refs.deviceVideo.destroy) { + this.$refs.deviceVideo.destroy(); + } + if (this.channelId) { + if (this.$refs.deviceLiveStream && this.$refs.deviceLiveStream.channelId !== undefined) { + this.$refs.deviceLiveStream.channelId = this.channelId; + } + this.$refs.deviceLiveStream.changeChannel(); + } + if (this.$refs.deviceLiveStream.channelId !== undefined) { + this.$refs.deviceLiveStream.changeChannel(); + } + } else if (panel.name === 'sipVideo') { + if (this.$refs.deviceLiveStream && this.$refs.deviceLiveStream.destroy) { + this.$refs.deviceLiveStream.destroy(); + } + if (this.$refs.deviceVideo && this.$refs.deviceVideo.channelId !== undefined && this.$refs.deviceVideo.queryDate) { + this.$refs.deviceVideo.loadDevRecord(); + } + } else if (panel.name === 'sipChannel') { + this.$nextTick(() => { + this.$refs.Channel.getList(); + }); } - if (this.$refs.deviceLiveStream.channelId) { - this.$refs.deviceLiveStream.changeChannel(); - } - } else if (panel.name === 'sipChannel') { - this.$refs.deviceChannel.getList(); - } - //关闭直播流 - if (panel.name !== 'sipVideo') { - if (this.$refs.deviceLiveStream.playing) { + //关闭直播流 + if (panel.name !== 'sipPlayer' && this.$refs.deviceLiveStream && this.$refs.deviceLiveStream.playing) { this.$refs.deviceLiveStream.closeDestroy(false); } + //关闭录像流 + if (panel.name !== 'sipVideo' && this.$refs.deviceVideo && this.$refs.deviceVideo.playing) { + this.$refs.deviceVideo.closeDestroy(); + } } - } + }); + this.$nextTick(() => { - if (panel.name === 'deviceTimer') { + // 获取监测统计数据 + if (panel.name === 'deviceStastic') { + this.$refs.deviceStatistic.getListHistory(); + } else if (panel.name === 'deviceTimer') { this.$refs.deviceTimer.getList(); } else if (panel.name === 'deviceSub') { if (this.form.serialNumber) { - this.$refs.deviceSub.queryParams.gwDevCode = this.form.serialNumber; + this.$refs.deviceSub.queryParams.gwDeviceId = this.form.deviceId; + this.$refs.deviceSub.gateway.gwDeviceId = this.form.deviceId; this.$refs.deviceSub.getList(); } } }); + if (this.form.deviceType !== 3) { + // 用于关闭视频推流(页面切换时候需要关闭推流) + if (panel.name !== 'inlineVideo') { + this.$refs.deviceInlineVideo && this.$refs.deviceInlineVideo.handleClose(); + } + if (panel.name !== 'scada') { + const scadaRef = this.$refs.deviceScada || {}; + if (scadaRef && scadaRef.$refs && scadaRef.$refs.deviceScada) { + const copmRef = scadaRef.$refs.deviceScada; + if (copmRef.$refs && copmRef.$refs.spirit) { + copmRef.$refs.spirit.forEach((item) => { + if (item.$vnode.tag.includes('ViewInlineVideo')) { + item.handleCloseJessibuca(); + } + }); + } + } + } + } }, /** 数据同步*/ deviceSynchronization() {