ibp盘多个报警器处理

This commit is contained in:
yuan 2021-06-17 14:52:58 +08:00
parent ecea32ad9c
commit dbfbbc9034
2 changed files with 15 additions and 9 deletions

View File

@ -49,11 +49,13 @@ export default class alarm extends Group {
setStatus(state) {
// domid还是写在了alarm里面 待优化
const audioDom = document.querySelector('#buzzer');
if (state && state.on) {
audioDom.play().catch(e=>{throw e})
} else if (state && !state.on) {
audioDom.pause()
const audioDom = document.querySelector(`#buzzer_${this.model.code}`);
if (audioDom) {
if (state && state.on) {
audioDom.play().catch(e=>{throw e})
} else if (state && !state.on) {
audioDom.pause()
}
}
}
}

View File

@ -7,9 +7,11 @@
<el-button v-if="$route.query.noPreLogout" type="primary" @click="quit">退出</el-button>
</el-button-group>
<audio id="buzzer" controls loop="loop">
<template v-for="alarm in alarmList" >
<audio :key="alarm.code" :id="`buzzer_${alarm.code}`" controls loop="loop">
<source :src="buzzerAudio" type="audio/mpeg">
</audio>
</audio>
</template>
</div>
</template>
@ -64,7 +66,8 @@ export default {
stationCode: '',
banUpOpenScreenDoor: false,
banDownOpenScreenDoor: false,
buzzerAudio:BuzzerAudio
buzzerAudio:BuzzerAudio,
alarmList: []
};
},
computed: {
@ -193,7 +196,8 @@ export default {
this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus();
this.preResetBtn = this.$ibp.$painter.ibpInstanceLevel.SquareButton.children().find(e=>e.model.mean === IbpOperation.PRERESET_Z.event);
this.preResetBtn = this.$ibp.$painter.ibpInstanceLevel.SquareButton.children().find(e=>e.model.mean === IbpOperation.PRERESET_Z.event); //
this.alarmList = this.$ibp.$painter.ibpInstanceLevel.Alarm.children().map(e=>e.model);
} else {
//
this.loading = false;