@@ -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]);
+ }
}
}
};