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)">
<div style="cursor: default;">{{ it.name }}</div>
</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-inside" :style="{background: selectedAreaList.includes(i + '-' + j)? '#2EFF74':'#CDCDCD'}" />
</div>
@ -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;

View File

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