|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div></div>
|
|
<div></div>
|
|
- <!-- <div
|
|
|
|
|
|
+ <div
|
|
draggable="true"
|
|
draggable="true"
|
|
@dragstart="startDrag"
|
|
@dragstart="startDrag"
|
|
@dragend="stopDrag"
|
|
@dragend="stopDrag"
|
|
@@ -34,7 +34,7 @@
|
|
@cancleConfig="displaySetting = false"
|
|
@cancleConfig="displaySetting = false"
|
|
:alarmConfigArray="alarmConfigArray"
|
|
:alarmConfigArray="alarmConfigArray"
|
|
/>
|
|
/>
|
|
- </div> -->
|
|
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -207,76 +207,76 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
playAudioEffect() {
|
|
playAudioEffect() {
|
|
- // const lv1Config = this.getConfigItem(1);
|
|
|
|
- // let lv1Play = false;
|
|
|
|
- // if (lv1Config.isAlarmSound) {
|
|
|
|
- // lv1Play = this.dialogList.some((ele) => {
|
|
|
|
- // return ele.lv === 1 && !ele.confirm;
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // const lv2Config = this.getConfigItem(2);
|
|
|
|
- // let lv2Play = false;
|
|
|
|
- // if (lv2Config.isAlarmSound) {
|
|
|
|
- // lv2Play = this.dialogList.some((ele) => {
|
|
|
|
- // return ele.lv === 2 && !ele.confirm;
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // const lv3Config = this.getConfigItem(3);
|
|
|
|
- // let lv3Play = false;
|
|
|
|
- // if (lv3Config.isAlarmSound) {
|
|
|
|
- // lv3Play = this.dialogList.some((ele) => {
|
|
|
|
- // return ele.lv === 3 && !ele.confirm;
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // const lv4Config = this.getConfigItem(4);
|
|
|
|
- // let lv4Play = false;
|
|
|
|
- // if (lv4Config.isAlarmSound) {
|
|
|
|
- // lv4Play = this.dialogList.some((ele) => {
|
|
|
|
- // return ele.lv === 4 && !ele.confirm;
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // const lv5Config = this.getConfigItem(5);
|
|
|
|
- // let lv5Play = false;
|
|
|
|
- // if (lv5Config.isAlarmSound) {
|
|
|
|
- // lv5Play = this.dialogList.some((ele) => {
|
|
|
|
- // return ele.lv === 5 && !ele.confirm;
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // // console.log(lv1Play, lv2Play, lv3Play, lv4Play, lv5Play);
|
|
|
|
- // if (lv5Play && !this.seriousWarning) {
|
|
|
|
- // this.seriousWarning = true;
|
|
|
|
- // this.audioElement = new Audio();
|
|
|
|
- // this.audioElement.src = "./static/sound/lv5.mp3";
|
|
|
|
- // this.audioElement.loop = true;
|
|
|
|
- // this.audioElement?.play();
|
|
|
|
- // } else if (
|
|
|
|
- // (lv1Play || lv2Play || lv3Play || lv4Play) &&
|
|
|
|
- // !this.seriousWarning
|
|
|
|
- // ) {
|
|
|
|
- // this.audioElement = new Audio();
|
|
|
|
- // this.audioElement.src = "./static/sound/lv4.mp3";
|
|
|
|
- // this.audioElement.addEventListener("ended", () => {
|
|
|
|
- // this.audioElement?.removeEventListener(
|
|
|
|
- // "ended",
|
|
|
|
- // this.stopPlayAudioEffect
|
|
|
|
- // );
|
|
|
|
- // });
|
|
|
|
- // this.audioElement?.play();
|
|
|
|
- // } else {
|
|
|
|
- // if (!this.seriousWarning) {
|
|
|
|
- // this.stopPlayAudioEffect();
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ const lv1Config = this.getConfigItem(1);
|
|
|
|
+ let lv1Play = false;
|
|
|
|
+ if (lv1Config.isAlarmSound) {
|
|
|
|
+ lv1Play = this.dialogList.some((ele) => {
|
|
|
|
+ return ele.lv === 1 && !ele.confirm;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ const lv2Config = this.getConfigItem(2);
|
|
|
|
+ let lv2Play = false;
|
|
|
|
+ if (lv2Config.isAlarmSound) {
|
|
|
|
+ lv2Play = this.dialogList.some((ele) => {
|
|
|
|
+ return ele.lv === 2 && !ele.confirm;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ const lv3Config = this.getConfigItem(3);
|
|
|
|
+ let lv3Play = false;
|
|
|
|
+ if (lv3Config.isAlarmSound) {
|
|
|
|
+ lv3Play = this.dialogList.some((ele) => {
|
|
|
|
+ return ele.lv === 3 && !ele.confirm;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ const lv4Config = this.getConfigItem(4);
|
|
|
|
+ let lv4Play = false;
|
|
|
|
+ if (lv4Config.isAlarmSound) {
|
|
|
|
+ lv4Play = this.dialogList.some((ele) => {
|
|
|
|
+ return ele.lv === 4 && !ele.confirm;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ const lv5Config = this.getConfigItem(5);
|
|
|
|
+ let lv5Play = false;
|
|
|
|
+ if (lv5Config.isAlarmSound) {
|
|
|
|
+ lv5Play = this.dialogList.some((ele) => {
|
|
|
|
+ return ele.lv === 5 && !ele.confirm;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // console.log(lv1Play, lv2Play, lv3Play, lv4Play, lv5Play);
|
|
|
|
+ if (lv5Play && !this.seriousWarning) {
|
|
|
|
+ this.seriousWarning = true;
|
|
|
|
+ this.audioElement = new Audio();
|
|
|
|
+ this.audioElement.src = "./static/sound/lv5.mp3";
|
|
|
|
+ this.audioElement.loop = true;
|
|
|
|
+ this.audioElement?.play();
|
|
|
|
+ } else if (
|
|
|
|
+ (lv1Play || lv2Play || lv3Play || lv4Play) &&
|
|
|
|
+ !this.seriousWarning
|
|
|
|
+ ) {
|
|
|
|
+ this.audioElement = new Audio();
|
|
|
|
+ this.audioElement.src = "./static/sound/lv4.mp3";
|
|
|
|
+ this.audioElement.addEventListener("ended", () => {
|
|
|
|
+ this.audioElement?.removeEventListener(
|
|
|
|
+ "ended",
|
|
|
|
+ this.stopPlayAudioEffect
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ this.audioElement?.play();
|
|
|
|
+ } else {
|
|
|
|
+ if (!this.seriousWarning) {
|
|
|
|
+ this.stopPlayAudioEffect();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
stopPlayAudioEffect() {
|
|
stopPlayAudioEffect() {
|
|
- // this.seriousWarning = false;
|
|
|
|
- // if (this.audioElement) {
|
|
|
|
- // this.audioElement.pause();
|
|
|
|
- // this.audioElement.currentTime = 0;
|
|
|
|
- // this.audioElement.loop = false;
|
|
|
|
- // }
|
|
|
|
- // this.audioElement = null;
|
|
|
|
|
|
+ this.seriousWarning = false;
|
|
|
|
+ if (this.audioElement) {
|
|
|
|
+ this.audioElement.pause();
|
|
|
|
+ this.audioElement.currentTime = 0;
|
|
|
|
+ this.audioElement.loop = false;
|
|
|
|
+ }
|
|
|
|
+ this.audioElement = null;
|
|
},
|
|
},
|
|
//获取报警配置
|
|
//获取报警配置
|
|
getAlarmConfig() {
|
|
getAlarmConfig() {
|