iscs调整

This commit is contained in:
joylink_fanyuhong 2022-01-17 14:43:17 +08:00
parent e8fb8abcf2
commit 8194c24f4d
2 changed files with 38 additions and 23 deletions

View File

@ -17,7 +17,7 @@
<el-button v-if="item.type==='header'" class="pa-table-header" @click="selectedStation(it.code)"> <el-button v-if="item.type==='header'" class="pa-table-header" @click="selectedStation(it.code)">
<div style="cursor: default;">{{ it.name }}</div> <div style="cursor: default;">{{ it.name }}</div>
</el-button> </el-button>
<div v-if="checkHasDevice(item, it)"> <div v-if="checkHasDevice(item, it, i + '-' + j)">
<div class="pa-table-content" @click="clickArea(i,j)"> <div class="pa-table-content" @click="clickArea(i,j)">
<div class="pa-table-content-inside" :style="{background: selectedAreaList.includes(i + '-' + j)? '#2EFF74':'#CDCDCD'}" /> <div class="pa-table-content-inside" :style="{background: selectedAreaList.includes(i + '-' + j)? '#2EFF74':'#CDCDCD'}" />
</div> </div>
@ -87,6 +87,7 @@ import { queryIscsDeviceCod, queryIscsResourcesCod } from '@/api/iscs';
import MusicIcon from '@/assets/iscs_icon/music_icon.png'; import MusicIcon from '@/assets/iscs_icon/music_icon.png';
import StateTable from './stateTable'; import StateTable from './stateTable';
import VoiceBroadcast from './voiceBroadcast'; import VoiceBroadcast from './voiceBroadcast';
import { sendCommandNew } from '@/api/jmap/training';
export default { export default {
name: 'CenterHome', name: 'CenterHome',
components: { components: {
@ -113,7 +114,8 @@ export default {
iscsDeviceList: [], iscsDeviceList: [],
resourcesList: [], resourcesList: [],
videoMode: 'RECORDING', videoMode: 'RECORDING',
bgmResources: '' bgmResources: '',
deviceMap: {}
}; };
}, },
computed: { computed: {
@ -167,33 +169,42 @@ export default {
audio.pause(); audio.pause();
}, },
stopBroadcast() { 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'); const audio = document.getElementById('voice');
audio.pause(); audio.pause();
}, },
releaseBroadcast(voice) { releaseBroadcast(voice) {
const operate = { const iscsDeviceCodes = [];
operation: '',
cmdType: 'ISCS_PA_Play',
over: true,
params: {
resourceId: voice.id,
iscsDeviceCodes: []
}
};
this.selectedAreaList.forEach(item => { this.selectedAreaList.forEach(item => {
if (this.deviceMap[item]) {
iscsDeviceCodes.push(this.deviceMap[item].code);
}
}); });
this.$store.dispatch('training/nextNew', operate).then(({ valid }) => { if (!iscsDeviceCodes.length) {
if (valid) { 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; this.voiceUrl = this.$store.state.user.resourcesUrl + voice.url;
const audio = document.getElementById('voice'); const audio = document.getElementById('voice');
audio.src = this.voiceUrl; audio.src = this.voiceUrl;
audio.play(); audio.play();
}
}).catch(() => { }).catch(() => {
this.$message.error('发布广播失败!'); this.$message.error('发布广播失败!');
}); });
}, },
clickArea(i, j) { clickArea(i, j) {
if (this.selectedAreaList.includes(i + '-' + j)) { if (this.selectedAreaList.includes(i + '-' + j)) {
@ -203,8 +214,10 @@ export default {
this.selectedAreaList.push(i + '-' + j); this.selectedAreaList.push(i + '-' + j);
} }
}, },
checkHasDevice(item, station) { checkHasDevice(item, station, index) {
return this.iscsDeviceList.some(elem => elem.station == station.code && elem.position == item.position); const device = this.iscsDeviceList.find(elem => elem.station == station.code && elem.position == item.position);
this.deviceMap[index] = device;
return !!device;
}, },
selectedBatch(data) { selectedBatch(data) {
data.active = !data.active; data.active = !data.active;

View File

@ -50,9 +50,11 @@ export default {
}, },
releaseBroadcast() { releaseBroadcast() {
this.visible = false; this.visible = false;
if (this.resourcesList[this.messageIndex]) {
this.$emit('releaseBroadcast', this.resourcesList[this.messageIndex]); this.$emit('releaseBroadcast', this.resourcesList[this.messageIndex]);
} }
} }
}
}; };
</script> </script>