Commit 0c4f8267 authored by 纪泽龙's avatar 纪泽龙

报警功能

parent c6d1490e
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-02-23 15:28:07 * @Date: 2022-02-23 15:28:07
* @LastEditTime: 2022-02-25 18:43:58 * @LastEditTime: 2022-03-01 09:05:43
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /newDev/gassafety-progress/gassafetyprogress-web/src/api/bigWindow/getdevice.js * @FilePath: /newDev/gassafety-progress/gassafetyprogress-web/src/api/bigWindow/getdevice.js
...@@ -68,3 +68,11 @@ export function getCompany(query) { ...@@ -68,3 +68,11 @@ export function getCompany(query) {
params: query params: query
}) })
} }
// 报警
export function userAlarm(query) {
return request({
url: '/supervise/user/getDetectorUserAlarmList',
method: 'get',
params: query
})
}
\ No newline at end of file
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-01-26 20:07:52 * @Date: 2022-01-26 20:07:52
* @LastEditTime: 2022-02-28 20:01:16 * @LastEditTime: 2022-03-01 09:17:01
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
</div> </div>
</div> </div>
<template v-if="deviceData.detectorCountList">
<div class="foot"> <div class="foot">
<div class="thead flex"> <div class="thead flex">
<div class="first">设备类型</div> <div class="first">设备类型</div>
...@@ -45,50 +46,35 @@ ...@@ -45,50 +46,35 @@
<div>已处理报警</div> <div>已处理报警</div>
<div class="last">报警中</div> <div class="last">报警中</div>
</div> </div>
<div class="tbody flex"> <div
<div v-unValue class="first zzz">{{ deviceData.detectorType }}</div> v-for="data in deviceData.detectorCountList"
<div class="">{{ deviceData.detectorCount }}</div> :key="data.userId"
class="tbody flex"
>
<div v-unValue class="first zzz">{{ data.detectorType }}</div>
<div class="">{{ data.detectorCount }}</div>
<div v-unValue class=""> <div v-unValue class="">
{{ deviceData.onLineNum }} {{ data.onLineNum }}
</div> </div>
<div v-unValue class=""> <div v-unValue class="">
{{ deviceData.offLineNum }} {{ data.offLineNum }}
</div> </div>
<div v-unValue class=""> <div v-unValue class="">
{{ deviceData.historyAlarmNum }} {{ data.historyAlarmNum }}
</div> </div>
<div v-unValue class=""> <div v-unValue class="">
{{ deviceData.cancelAlarmNum }} {{ data.cancelAlarmNum }}
</div> </div>
<div v-unValue class="last zzz"> <div v-unValue class="last zzz">
{{ deviceData.processingAlarmNum }} {{ data.processingAlarmNum }}
</div>
</div>
<div class="tbody flex">
<div v-unValue class="first zzz">{{ deviceData.detectorType }}</div>
<div class="">{{ deviceData.detectorCount }}</div>
<div v-unValue class="">
{{ deviceData.onLineNum }}
</div>
<div v-unValue class="">
{{ deviceData.offLineNum }}
</div>
<div v-unValue class="">
{{ deviceData.historyAlarmNum }}
</div>
<div v-unValue class="">
{{ deviceData.cancelAlarmNum }}
</div>
<div v-unValue class="last zzz">
{{ deviceData.processingAlarmNum }}
</div> </div>
</div> </div>
</div> </div>
</template>
<div class="btn"> <div class="btn">
<div @click="btnClick">感知设备</div> <div @click="btnClick">感知设备</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -125,7 +111,10 @@ export default { ...@@ -125,7 +111,10 @@ export default {
}, },
btnClick() { btnClick() {
// this.vueRoot.centerDataFunc(this.deviceData.pressureFlows); // this.vueRoot.centerDataFunc(this.deviceData.pressureFlows);
this.vueRoot.getDetectorInfoList({ userId: this.deviceData.userId },this.deviceData.nickName); this.vueRoot.getDetectorInfoList(
{ userId: this.deviceData.userId },
this.deviceData.nickName
);
}, },
}, },
}; };
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="detectorName" label="设备名称" width="100"> <el-table-column prop="detectorName" label="设备名称" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<div :title="scope.row.detectorName" class="ddd" v-unValue> <div :title="scope.row.detectorName" class="ddd" v-unValue>
{{ scope.row.detectorName }} {{ scope.row.detectorName }}
...@@ -39,12 +39,15 @@ ...@@ -39,12 +39,15 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="linkman" label="联系人" width="100"> <el-table-column prop="linkman" label="联系人" width="100">
<template slot-scope="scope">
<div v-unValue>{{ scope.row.linkman }}</div>
</template>
</el-table-column> </el-table-column>
<el-table-column prop="phone" label="联系电话" width=""> <el-table-column prop="phone" label="联系电话" width="">
</el-table-column> </el-table-column>
<el-table-column prop="detectorStatus" label="设备状态" width="100"> <el-table-column prop="detectorStatus" label="设备状态" width="100">
</el-table-column> </el-table-column>
<el-table-column prop="alarmTime" label="预警时间" width="200"> <el-table-column prop="alarmTime" label="预警时间" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-unValue>{{ scope.row.alarmTime }}</div> <div v-unValue>{{ scope.row.alarmTime }}</div>
</template> </template>
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:45:12 * @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-02-28 22:09:01 * @LastEditTime: 2022-03-01 10:04:44
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js * @FilePath: /test/hello-world/src/utils/mapClass.js
...@@ -499,7 +499,7 @@ export class EditorMap { ...@@ -499,7 +499,7 @@ export class EditorMap {
// 找到这个设备所属的空间 // 找到这个设备所属的空间
const device = this.allDevice[iconType].filter( const device = this.allDevice[iconType].filter(
(item) => item.getExtData().userId == userId (item) => item.getExtData().userId == userId
); )[0];
// 更改的icon // 更改的icon
const icon = svgAlarm[iconType]; const icon = svgAlarm[iconType];
device.setIcon(icon); device.setIcon(icon);
...@@ -521,7 +521,7 @@ export class EditorMap { ...@@ -521,7 +521,7 @@ export class EditorMap {
// 把报警数组改变结构 // 把报警数组改变结构
const httpArr = alarmObj.map((item) => item.userId); const httpArr = alarmObj.map((item) => item.userId);
// 循环现有报警设备 // 循环现有报警设备
for (iconType in this.alarmObj) { for (let iconType in this.alarmObj) {
const arr = this.alarmObj[iconType]; const arr = this.alarmObj[iconType];
// 循环现有报警设备 // 循环现有报警设备
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
...@@ -532,9 +532,9 @@ export class EditorMap { ...@@ -532,9 +532,9 @@ export class EditorMap {
// 如果已经不在报警数组中,就要去大数组中找他,利用userId // 如果已经不在报警数组中,就要去大数组中找他,利用userId
if (index < 0) { if (index < 0) {
// 过滤出来这个要恢复的设备 // 过滤出来这个要恢复的设备
const device = this.addDevice[iconType].filter( const device = this.allDevice[iconType].filter(
(item) => item.getExtData().userId == userId (item) => item.getExtData().userId == userId
); )[0];
// 恢复 // 恢复
const icon = svgUrl[iconType]; const icon = svgUrl[iconType];
device.setIcon(icon); device.setIcon(icon);
...@@ -554,17 +554,17 @@ export class EditorMap { ...@@ -554,17 +554,17 @@ export class EditorMap {
// ws协议方法 // ws协议方法
wsAlarm(obj) { wsAlarm(obj) {
const { iconType, userId, aaa } = obj; const { iconType, userId, userStatus } = obj;
const decice = this.allDevice[iconType].filter( const decice = this.allDevice[iconType].filter(
(item) => item.getExtData().userId == userId (item) => item.getExtData().userId == userId
); )[0];
let icon = null; let icon = null;
// 2报警,1恢复 // 2报警,1恢复
if (aaa == 2) { if (userStatus == 2) {
icon = svgAlarm[iconType]; icon = svgAlarm[iconType];
device.oldData = device.getExtData() device.oldData = device.getExtData()
device.setExtData(obj); device.setExtData(obj);
}else if(aaa==1){ }else if(userStatus==1){
icon = svgUrl[iconType]; icon = svgUrl[iconType];
const oldData = device.oldData; const oldData = device.oldData;
device.setExtData(oldData); device.setExtData(oldData);
......
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:44:17 * @Date: 2022-01-11 13:44:17
* @LastEditTime: 2022-02-28 15:54:27 * @LastEditTime: 2022-03-01 09:51:34
* @LastEditors: Please set LastEditors * @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/views/Home.vue * @FilePath: /test/hello-world/src/views/Home.vue
...@@ -152,6 +152,7 @@ import { ...@@ -152,6 +152,7 @@ import {
getCz, getCz,
getVideo, getVideo,
getUser, getUser,
userAlarm,
} from "@/api/bigWindow/getDevice"; } from "@/api/bigWindow/getDevice";
import Line from "@/components/bigWindow/Line.vue"; import Line from "@/components/bigWindow/Line.vue";
import VideoView from "@/components/bigWindow/VideoView.vue"; import VideoView from "@/components/bigWindow/VideoView.vue";
...@@ -244,6 +245,9 @@ export default { ...@@ -244,6 +245,9 @@ export default {
centerTotal: null, centerTotal: null,
centerShow: false, centerShow: false,
centerTitle: "", centerTitle: "",
// 报警轮询timer
alarmTimer: null,
}; };
}, },
...@@ -305,12 +309,16 @@ export default { ...@@ -305,12 +309,16 @@ export default {
this.goMap(getFm, this.addDevice, DeviceA); this.goMap(getFm, this.addDevice, DeviceA);
this.goMap(getCz, this.addDevice, DeviceA); this.goMap(getCz, this.addDevice, DeviceA);
this.goMap(getVideo, this.addDevice, VideoView); this.goMap(getVideo, this.addDevice, VideoView);
this.goMap(detectorUserList, this.addDevice, User); // 用户要等一下 因为有报警数据
// getVideo().then((res) => { this.goMap(detectorUserList, this.addDevice, User).then((res) => {
// console.log("getVideo", res); // 先查一下,然后开启定时器
// }); this.userAlarm();
this.alarmTimer = setInterval(() => {
this.userAlarm();
// console.log("查询报警");
}, 6000);
});
} }
this.currentTime(); this.currentTime();
this.$refs.mychild.choice(0); this.$refs.mychild.choice(0);
this.$refs.mychild2.choice(0); this.$refs.mychild2.choice(0);
...@@ -336,7 +344,7 @@ export default { ...@@ -336,7 +344,7 @@ export default {
} }
}, },
goMap(httpFunc, addFunc, component) { goMap(httpFunc, addFunc, component) {
httpFunc().then((res) => { return httpFunc().then((res) => {
// 给用户加icontype // 给用户加icontype
if (res.data && !res.data[0].iconType) { if (res.data && !res.data[0].iconType) {
...@@ -344,26 +352,35 @@ export default { ...@@ -344,26 +352,35 @@ export default {
item.iconType = 6; item.iconType = 6;
}); });
} }
// if (res.data && !res.data[0].iconType) {
// res.data.forEach((item) => {
// item.iconType = 6;
// });
// }
// 根据数据格式不同,赋值不同,如果是个数组,就用res,如果不是就用res.data // 根据数据格式不同,赋值不同,如果是个数组,就用res,如果不是就用res.data
let config = {}; let config = {};
if (Array.isArray(res)) { if (Array.isArray(res)) {
config = { data: res }; config = { data: res };
// 给视频设备的conpanyType变成null // 给视频设备的conpanyType变成null
if(res[0].iconType==5){ if (res[0].iconType == 5) {
res.forEach(item=>{ res.forEach((item) => {
item.companyType = null; item.companyType = null;
}) });
} }
} else { } else {
config = { data: res.data }; config = { data: res.data };
} }
addFunc(config, component); addFunc(config, component);
return config.iconType;
});
},
userAlarm() {
userAlarm().then((res) => {
console.log("报警", res.data);
if (res.data.length > 0) {
// 报警
res.data.forEach((item) => {
this.map.deviceAlarm(item);
});
// 看看谁告消警
}
this.map.relieveAlarm(res.data);
}); });
}, },
...@@ -474,6 +491,9 @@ export default { ...@@ -474,6 +491,9 @@ export default {
if (this.formatDate) { if (this.formatDate) {
clearInterval(this.formatDate); // 在Vue实例销毁前,清除时间定时器 clearInterval(this.formatDate); // 在Vue实例销毁前,清除时间定时器
} }
if (this.alarmTimer) {
clearInterval(this.alarmTimer);
}
}, },
}; };
</script> </script>
......
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