Commit fecc4bae authored by 纪泽龙's avatar 纪泽龙

添加报警音频

parent b40cfd04
<template> <template>
<div> <div>
<div class="audio" >
<audio ref="audio" :src="mp3Src"></audio>
</div>
<div <div
:style="{ height: `${boxHeight}px`, width: `${boxWidth}px` }" :style="{ height: `${boxHeight}px`, width: `${boxWidth}px` }"
id="container" id="container"
...@@ -355,6 +358,7 @@ export default { ...@@ -355,6 +358,7 @@ export default {
}, },
data() { data() {
return { return {
mp3Src: require("@/assets/mp3/baojing.mp3"),
lineColor, lineColor,
gaoMap: null, gaoMap: null,
deviceType: false, deviceType: false,
...@@ -512,6 +516,13 @@ export default { ...@@ -512,6 +516,13 @@ export default {
} }
}, },
audio(){
console.log("this.$refs.audio.paused",this.$refs.audio.paused)
if (this.$refs.audio.paused) {
// this.$refs.audio.paused = false;
this.$refs.audio.play();
}
},
initMap() { initMap() {
let gaoMap = new gaodeMap(process.env.VUE_APP_MAP_CENTER); let gaoMap = new gaodeMap(process.env.VUE_APP_MAP_CENTER);
this.gaoMap = gaoMap; this.gaoMap = gaoMap;
...@@ -672,6 +683,9 @@ export default { ...@@ -672,6 +683,9 @@ export default {
}, },
// 遍历设备改变状态 polyLines markers // 遍历设备改变状态 polyLines markers
statusChange(list) { statusChange(list) {
// 报警声音
this.audio();
// 过滤报警管道 // 过滤报警管道
const polyLineArr = list.filter((item) => { const polyLineArr = list.filter((item) => {
return item.deviceType == "0"; return item.deviceType == "0";
...@@ -768,19 +782,21 @@ export default { ...@@ -768,19 +782,21 @@ export default {
device.setExtData(options); device.setExtData(options);
// 找到是列表里的哪个,改变它的状态,让列表里的这个设备变成红色 // 找到是列表里的哪个,改变它的状态,让列表里的这个设备变成红色
const myDevice = this.allList.filter((item) => { const myDevice = this.allList
for (let i = 0; i < item.length; i++) { .filter((item) => {
const iten = item[i]; for (let i = 0; i < item.length; i++) {
// 不是隐患也不是值班人员 const iten = item[i];
if (!iten.troubleId && !iten.userId) { // 不是隐患也不是值班人员
if(iten.deviceId == device.getExtData().deviceId){ if (!iten.troubleId && !iten.userId) {
return true if (iten.deviceId == device.getExtData().deviceId) {
return true;
}
} }
} }
} })[0]
})[0]?.filter(item=>{ ?.filter((item) => {
return item.deviceId == device.getExtData().deviceId return item.deviceId == device.getExtData().deviceId;
})[0]; })[0];
// console.log("myDevice", myDevice); // console.log("myDevice", myDevice);
myDevice.alarmState = options.alarmState; myDevice.alarmState = options.alarmState;
// const imageName = device.getExtData() // const imageName = device.getExtData()
...@@ -1466,7 +1482,7 @@ export default { ...@@ -1466,7 +1482,7 @@ export default {
}, },
// 搜索 // 搜索
async search() { async search() {
this. Clear(); this.Clear();
map.clearMap(); map.clearMap();
this.gaoMap.placeSearch.clear(); this.gaoMap.placeSearch.clear();
if (!(!this.gaoMap.searchSelectAdcode && !this.gaoMap.searchSelectName)) { if (!(!this.gaoMap.searchSelectAdcode && !this.gaoMap.searchSelectName)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment