From 8194c24f4d4b0d8c3470a3fd2081cbb5d3860ed7 Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Mon, 17 Jan 2022 14:43:17 +0800 Subject: [PATCH] =?UTF-8?q?iscs=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/broadcast/centerHome.vue | 57 ++++++++++++------- .../config/broadcast/voiceBroadcast.vue | 4 +- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/src/views/iscs/iscsSystem/config/broadcast/centerHome.vue b/src/views/iscs/iscsSystem/config/broadcast/centerHome.vue index c278c1866..376182db8 100644 --- a/src/views/iscs/iscsSystem/config/broadcast/centerHome.vue +++ b/src/views/iscs/iscsSystem/config/broadcast/centerHome.vue @@ -17,7 +17,7 @@
{{ it.name }}
-
+
@@ -87,6 +87,7 @@ import { queryIscsDeviceCod, queryIscsResourcesCod } from '@/api/iscs'; import MusicIcon from '@/assets/iscs_icon/music_icon.png'; import StateTable from './stateTable'; import VoiceBroadcast from './voiceBroadcast'; +import { sendCommandNew } from '@/api/jmap/training'; export default { name: 'CenterHome', components: { @@ -113,7 +114,8 @@ export default { iscsDeviceList: [], resourcesList: [], videoMode: 'RECORDING', - bgmResources: '' + bgmResources: '', + deviceMap: {} }; }, computed: { @@ -167,33 +169,42 @@ export default { audio.pause(); }, stopBroadcast() { + const iscsDeviceCodes = []; + this.selectedAreaList.forEach(item => { + if (this.deviceMap[item]) { + iscsDeviceCodes.push(this.deviceMap[item].code); + } + }); + if (!iscsDeviceCodes.length) { + this.$message.error('请选择需要停止广播的设备'); + return; + } const audio = document.getElementById('voice'); audio.pause(); }, releaseBroadcast(voice) { - const operate = { - operation: '', - cmdType: 'ISCS_PA_Play', - over: true, - params: { - resourceId: voice.id, - iscsDeviceCodes: [] - } - }; + const iscsDeviceCodes = []; this.selectedAreaList.forEach(item => { - - }); - this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { - if (valid) { - this.voiceUrl = this.$store.state.user.resourcesUrl + voice.url; - const audio = document.getElementById('voice'); - audio.src = this.voiceUrl; - audio.play(); + if (this.deviceMap[item]) { + iscsDeviceCodes.push(this.deviceMap[item].code); } + }); + if (!iscsDeviceCodes.length) { + this.$message.error('请选择需要发布广播的设备'); + return; + } + const params = { + resourceId: voice.id, + iscsDeviceCodes: iscsDeviceCodes + }; + sendCommandNew(this.$route.query.group, 'ISCS_PA_Play', params).then(resp => { + this.voiceUrl = this.$store.state.user.resourcesUrl + voice.url; + const audio = document.getElementById('voice'); + audio.src = this.voiceUrl; + audio.play(); }).catch(() => { this.$message.error('发布广播失败!'); }); - }, clickArea(i, j) { if (this.selectedAreaList.includes(i + '-' + j)) { @@ -203,8 +214,10 @@ export default { this.selectedAreaList.push(i + '-' + j); } }, - checkHasDevice(item, station) { - return this.iscsDeviceList.some(elem => elem.station == station.code && elem.position == item.position); + checkHasDevice(item, station, index) { + const device = this.iscsDeviceList.find(elem => elem.station == station.code && elem.position == item.position); + this.deviceMap[index] = device; + return !!device; }, selectedBatch(data) { data.active = !data.active; diff --git a/src/views/iscs/iscsSystem/config/broadcast/voiceBroadcast.vue b/src/views/iscs/iscsSystem/config/broadcast/voiceBroadcast.vue index 6da6bf533..956deafe5 100644 --- a/src/views/iscs/iscsSystem/config/broadcast/voiceBroadcast.vue +++ b/src/views/iscs/iscsSystem/config/broadcast/voiceBroadcast.vue @@ -50,7 +50,9 @@ export default { }, releaseBroadcast() { this.visible = false; - this.$emit('releaseBroadcast', this.resourcesList[this.messageIndex]); + if (this.resourcesList[this.messageIndex]) { + this.$emit('releaseBroadcast', this.resourcesList[this.messageIndex]); + } } } };