Commit 88ce93fd authored by 纪泽龙's avatar 纪泽龙

增加消警功能

parent eaa1ccd3
...@@ -8,7 +8,7 @@ VUE_APP_BASE_API = '/dev-api' ...@@ -8,7 +8,7 @@ VUE_APP_BASE_API = '/dev-api'
VUE_APP_MAP_CENTER = '石家庄' VUE_APP_MAP_CENTER = '石家庄'
#代理地址 #代理地址
VUE_APP_TARGET = 'http://36.148.23.59:8901/gassafety' VUE_APP_TARGET = 'http://192.168.2.28:8903/gassafety'
# 路由懒加载 # 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true
/*
* @Author: your name
* @Date: 2021-07-16 10:06:43
* @LastEditTime: 2022-01-18 11:36:15
* @LastEditors: your name
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /gassafety-web/src/api/enterprise/info.js
*/
import request from '@/utils/request' import request from '@/utils/request'
// 查询企业基本信息列表 // 查询企业基本信息列表
...@@ -51,3 +59,12 @@ export function exportInfo(query) { ...@@ -51,3 +59,12 @@ export function exportInfo(query) {
params: query params: query
}) })
} }
// 消除警报
export function handEliminationAlarm(query) {
return request({
url: 'dataMonitoring/deviceAlarm/handEliminationAlarm',
method: 'get',
params: query
})
}
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
}}</span> }}</span>
</div> </div>
</div> </div>
<div @click.stop="stopPropatation" class="btn"> <div @click.stop="stopPropatation" class="btn">
<span @mousedown.stop="deviceMore"> <span @mousedown.stop="deviceMore">
<el-button class="elbtn" type="primary">设备详情</el-button> <el-button class="elbtn" type="primary">设备详情</el-button>
...@@ -99,6 +100,9 @@ ...@@ -99,6 +100,9 @@
<span v-else @mousedown.stop="checkWork"> <span v-else @mousedown.stop="checkWork">
<el-button class="elbtn" type="primary">查看工单</el-button> <el-button class="elbtn" type="primary">查看工单</el-button>
</span> </span>
<span @click="handelR">
<el-button class="elbtn" type="primary">消警</el-button>
</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -107,12 +111,16 @@ ...@@ -107,12 +111,16 @@
<script> <script>
//line移入时的的infowindow //line移入时的的infowindow
import moment from "moment"; import moment from "moment";
// 消除警报
import { handEliminationAlarm } from "@/api/enterprise/info";
export default { export default {
props: { props: {
obj: { typs: Object }, obj: { typs: Object },
}, },
data() { data() {
return {}; return {
loading:null,
};
}, },
created() { created() {
// console.log("created", this.obj); // console.log("created", this.obj);
...@@ -200,7 +208,34 @@ export default { ...@@ -200,7 +208,34 @@ export default {
}, },
close() { close() {
this.obj.polyline.infoWindow.close(); this.obj.polyline.infoWindow.close();
this.obj.polyline.getExtData().class.view.domAllShow() this.obj.polyline.getExtData().class.view.domAllShow();
},
handelR() {
this.$confirm("是否消除警报")
.then((item) => {
if (item == "confirm") {
this.loading = this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
handEliminationAlarm({
alarmId: this.obj.alarmId,
}).then((res) => {
if (res.code == 200) {
this.obj.polyline.getExtData().class.closeInfoWindow();
this.loading.close();
}
});
}
})
.catch((item) => {
console.log(item);
this.loading.close();
});
}, },
}, },
}; };
...@@ -242,7 +277,7 @@ export default { ...@@ -242,7 +277,7 @@ export default {
} }
.left { .left {
padding-left: 22px; padding-left: 22px;
width:100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.right { .right {
......
...@@ -14,10 +14,12 @@ ...@@ -14,10 +14,12 @@
<div class="eq-content display-default"> <div class="eq-content display-default">
<div class="text-wrapper"> <div class="text-wrapper">
<div class="eq-text"> <div class="eq-text">
设备类型:<span>{{ title ? title: "-" }}</span> 设备类型:<span>{{ title ? title : "-" }}</span>
</div> </div>
<div class="eq-text"> <div class="eq-text">
设备型号:<span>{{ data.deviceModel ? data.deviceModel : "-" }}</span> 设备型号:<span>{{
data.deviceModel ? data.deviceModel : "-"
}}</span>
</div> </div>
<div class="eq-text"> <div class="eq-text">
所属管道:<span>{{ data.pipeName ? data.pipeName : "-" }}</span> 所属管道:<span>{{ data.pipeName ? data.pipeName : "-" }}</span>
...@@ -63,7 +65,9 @@ ...@@ -63,7 +65,9 @@
<div class="warn-wrapper" v-if="true"> <div class="warn-wrapper" v-if="true">
<div class="warn-content"> <div class="warn-content">
<div> <div>
报警状态:<span>报警({{ data.alarmType ? data.alarmType : "-" }})</span> 报警状态:<span
>报警({{ data.alarmType ? data.alarmType : "-" }})</span
>
</div> </div>
<div> <div>
详细信息:<span>{{ data.alarmValue ? data.alarmValue : "-" }}</span> 详细信息:<span>{{ data.alarmValue ? data.alarmValue : "-" }}</span>
...@@ -73,12 +77,17 @@ ...@@ -73,12 +77,17 @@
</div> </div>
</div> </div>
<template v-if="data.deviceType ==3 || data.deviceType==4"> <template v-if="data.deviceType == 3 || data.deviceType == 4">
<div v-if="data.deviceType==3" class="windowwarn-content" style=" <div
v-if="data.deviceType == 3"
class="windowwarn-content"
style="
border-bottom: 1px solid #e2e2e2; border-bottom: 1px solid #e2e2e2;
padding: 10px 0 2px 22px; padding: 10px 0 2px 22px;
height: 150px;padding-bottom: 2px; height: 150px;
"> padding-bottom: 2px;
"
>
<el-col :span="12"> <el-col :span="12">
<div class="windowwarn"> <div class="windowwarn">
标况累积量:<span class="standardConditionAccumulation">-</span> 标况累积量:<span class="standardConditionAccumulation">-</span>
...@@ -110,9 +119,7 @@ ...@@ -110,9 +119,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<div class="windowwarn"> <div class="windowwarn">压力:<span class="pressure">-</span></div>
压力:<span class="pressure">-</span>
</div>
</el-col> </el-col>
<el-col :span="15"> <el-col :span="15">
<div class="windowwarn"> <div class="windowwarn">
...@@ -120,15 +127,18 @@ ...@@ -120,15 +127,18 @@
</div> </div>
</el-col> </el-col>
</div> </div>
<div v-if="data.deviceType==4" class="windowwarn-content" style=" <div
v-if="data.deviceType == 4"
class="windowwarn-content"
style="
border-bottom: 1px solid #e2e2e2; border-bottom: 1px solid #e2e2e2;
padding: 10px 0 2px 22px; padding: 10px 0 2px 22px;
height: 70px;padding-bottom: 2px; height: 70px;
"> padding-bottom: 2px;
"
>
<el-col :span="24"> <el-col :span="24">
<div class="windowwarn"> <div class="windowwarn">压力:<span class="pressure">-</span></div>
压力:<span class="pressure">-</span>
</div>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<div class="windowwarn"> <div class="windowwarn">
...@@ -138,30 +148,37 @@ ...@@ -138,30 +148,37 @@
</div> </div>
</template> </template>
<div class="btn"> <div class="btn">
<span @mousedown.stop="deviceMore"> <span @mousedown.stop="deviceMore">
<el-button class="elbtn" type="primary">设备详情</el-button> <el-button class="elbtn" type="primary">设备详情</el-button>
</span> </span>
<span v-if="orderId" @mousedown.stop="createWork"> <span v-if="orderId" @mousedown.stop="createWork">
<el-button v-if="title == '压力表' || title == '流量计'" class="elbtn" type="primary">生成工单</el-button> <el-button
v-if="title == '压力表' || title == '流量计'"
class="elbtn"
type="primary"
>生成工单</el-button
>
</span> </span>
<span v-else @mousedown.stop="checkWork"> <span v-else @mousedown.stop="checkWork">
<el-button class="elbtn" type="primary">查看工单</el-button> <el-button class="elbtn" type="primary">查看工单</el-button>
</span> </span>
<span @click="handelR"
><el-button class="elbtn" type="primary">消警</el-button>
</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
let closeInfoWindowTimer = null; let closeInfoWindowTimer = null;
import { getWindowData } from "@/api/dataMonitoring/reportData"; import { getWindowData } from "@/api/dataMonitoring/reportData";
import moment from "moment"; // 消除警报
//line移入时的的infowindow import { handEliminationAlarm } from "@/api/enterprise/info";
export default { import moment from "moment";
//line移入时的的infowindow
export default {
props: { props: {
obj: { typs: Object }, obj: { typs: Object },
title: "", title: "",
...@@ -176,10 +193,11 @@ ...@@ -176,10 +193,11 @@
3: "流量计", 3: "流量计",
4: "智能燃气表", 4: "智能燃气表",
}, },
loading: null,
}; };
}, },
mounted() { mounted() {
clearInterval(this.data.view.deviceTimer) clearInterval(this.data.view.deviceTimer);
if (this.data.deviceType == 3 || this.data.deviceType == 4) { if (this.data.deviceType == 3 || this.data.deviceType == 4) {
this.getDataid(); this.getDataid();
...@@ -188,14 +206,12 @@ ...@@ -188,14 +206,12 @@
const dom = document.getElementsByClassName("amap-info")[0]; const dom = document.getElementsByClassName("amap-info")[0];
const disPlay = dom?.style.display; const disPlay = dom?.style.display;
if (!dom || (dom && disPlay == "none")) { if (!dom || (dom && disPlay == "none")) {
clearInterval(this.data.view.deviceTimer) clearInterval(this.data.view.deviceTimer);
clearInterval(closeInfoWindowTimer) clearInterval(closeInfoWindowTimer);
console.log("请求关闭") console.log("请求关闭");
} }
}, 1000) }, 1000);
} }
}, },
computed: { computed: {
orderId() { orderId() {
...@@ -208,36 +224,42 @@ ...@@ -208,36 +224,42 @@
methods: { methods: {
moment, moment,
getDataid() { getDataid() {
getWindowData(this.data.deviceId).then(response => { getWindowData(this.data.deviceId).then((response) => {
this.changeValue(response.data) this.changeValue(response.data);
});
})
}, },
changeValue(data) { changeValue(data) {
const keyArr = Object.keys(data); const keyArr = Object.keys(data);
keyArr.forEach((item) => { keyArr.forEach((item) => {
const dw = this.danwei(item) const dw = this.danwei(item);
const dom = document.getElementsByClassName(item)[0]; const dom = document.getElementsByClassName(item)[0];
if (dom) { if (dom) {
dom.innerHTML = data[item] +"&nbsp"+dw; dom.innerHTML = data[item] + "&nbsp" + dw;
} }
}) });
}, },
danwei(item) { danwei(item) {
let dw=''; let dw = "";
if(item =='standardConditionAccumulation' || item == 'workingConditionAccumulation' || item == 'residualQuantity'){ if (
dw="m³" item == "standardConditionAccumulation" ||
}else if(item =='standardConditionFlow'|| item == 'workingConditionFlow'){ item == "workingConditionAccumulation" ||
dw="m³/h" item == "residualQuantity"
}else if(item =='temperature'){ ) {
dw="℃" dw = "m³";
}else if(item == 'pressure'){ } else if (
dw="KPa" item == "standardConditionFlow" ||
}else if(item == 'reportTime'){ item == "workingConditionFlow"
dw=" " ) {
dw = "m³/h";
} else if (item == "temperature") {
dw = "℃";
} else if (item == "pressure") {
dw = "KPa";
} else if (item == "reportTime") {
dw = " ";
} }
return dw; return dw;
} , },
createWork() { createWork() {
// 控制外层弹框 // 控制外层弹框
// console.log(this.data.view.$refs.CreateWork); // console.log(this.data.view.$refs.CreateWork);
...@@ -285,23 +307,42 @@ ...@@ -285,23 +307,42 @@
}, },
}); });
}, },
changeA() { changeA() {},
// 手动消除报警器
handelR() {
this.$confirm("是否消除警报")
.then((item) => {
if (item == "confirm") {
this.loading = this.$loading({
lock: true,
text: "Loading",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)",
});
handEliminationAlarm({
alarmId: this.data.alarmId,
}).then((res) => {
if (res.code == 200) {
this.map.clearInfoWindow();
this.loading.close();
} }
});
}
})
.catch((item) => {
console.log(item);
this.loading.close();
});
},
}, },
beforeDestroy() { beforeDestroy() {
// this.data.view.createWorkOpen = false; // this.data.view.createWorkOpen = false;
console.log("清空卸载") console.log("清空卸载");
}, },
};
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.windowwarn-content { .windowwarn-content {
div { div {
font-size: 14px; font-size: 14px;
font-wwight: 400; font-wwight: 400;
...@@ -310,9 +351,9 @@ ...@@ -310,9 +351,9 @@
margin-bottom: 7px; margin-bottom: 7px;
} }
} }
} }
.wrapper { .wrapper {
width: 406px; width: 406px;
max-height: 600px; max-height: 600px;
// background: #fff; // background: #fff;
...@@ -378,7 +419,7 @@ ...@@ -378,7 +419,7 @@
.text-wrapper { .text-wrapper {
padding-top: 1px; padding-top: 1px;
&>div { & > div {
margin-bottom: 6px; margin-bottom: 6px;
} }
...@@ -388,7 +429,7 @@ ...@@ -388,7 +429,7 @@
color: #fff; color: #fff;
opacity: 1; opacity: 1;
&>span { & > span {
vertical-align: top; vertical-align: top;
display: inline-block; display: inline-block;
// white-space: nowrap; // white-space: nowrap;
...@@ -424,7 +465,7 @@ ...@@ -424,7 +465,7 @@
box-sizing: border-box; box-sizing: border-box;
// border-bottom: 1px solid #e2e2e2; // border-bottom: 1px solid #e2e2e2;
&>div { & > div {
margin-bottom: 8px; margin-bottom: 8px;
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
...@@ -445,7 +486,7 @@ ...@@ -445,7 +486,7 @@
border-bottom: 1px solid #e2e2e2; border-bottom: 1px solid #e2e2e2;
color: #fe5966; color: #fe5966;
&>div { & > div {
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
margin-bottom: 8px; margin-bottom: 8px;
...@@ -470,12 +511,13 @@ ...@@ -470,12 +511,13 @@
} }
} }
} }
} }
.wrapperEditorPage {} .wrapperEditorPage {
}
.display-default { .display-default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
</style> </style>
...@@ -475,7 +475,7 @@ export default { ...@@ -475,7 +475,7 @@ export default {
mapStyle: true, mapStyle: true,
// 设备轮询用的定时器 // 设备轮询用的定时器
deviceTimer:null, deviceTimer: null,
}; };
}, },
created() { created() {
...@@ -691,18 +691,26 @@ export default { ...@@ -691,18 +691,26 @@ export default {
// 过滤报警管道 // 过滤报警管道
const polyLineArr = list.filter((item) => { const polyLineArr = list.filter((item) => {
return item.deviceType == "0"; return item.deviceType == "0" || item.deviceType=="管道";
}); });
// 过滤报警的其它设备 // 过滤报警的其它设备
const deviceArr = list.filter((item) => { const deviceArr = list.filter((item) => {
return item.deviceType != "0"; return item.deviceType != "管道" ;
}); });
// 管道 // 管道
console.log("polyLineArr",polyLineArr)
if (polyLineArr.length > 0) { if (polyLineArr.length > 0) {
polyLineArr.forEach((item) => { polyLineArr.forEach((item) => {
// 获取循报警设备的id // 获取循报警设备的id
const { deviceId, orderId, alarmId, alarmType, alarmValue, endTime } = const {
item; deviceId,
orderId,
alarmId,
alarmType,
alarmValue,
endTime,
dealStatus,
} = item;
console.log("endTime", endTime); console.log("endTime", endTime);
// 获取polyLine // 获取polyLine
const polyline = this.gaoMap.polyLines.filter((item) => { const polyline = this.gaoMap.polyLines.filter((item) => {
...@@ -718,14 +726,21 @@ export default { ...@@ -718,14 +726,21 @@ export default {
options.lineData.view = this; options.lineData.view = this;
options.lineData.alarmId = alarmId; options.lineData.alarmId = alarmId;
options.lineData.orderId = orderId; options.lineData.orderId = orderId;
if (endTime) { // dealStatus==4 就是取消报警状态
polyline.setOptions({ strokeColor: "#2EE7E7" }); if (endTime || dealStatus==4) {
// 判断管道颜色
const pipePressureObj = this.gaoMap.polyLines.filter(item=>{
return options.lineData.alarmId == item.getExtData().lineData.alarmId;
})[0];
const {pipePressure} = pipePressureObj.getExtData().lineData;
polyline.setOptions({ strokeColor: lineColor[pipePressure] });
options.lineData.alarmState = 0; options.lineData.alarmState = 0;
options.lineData.dealStatus=4
// 报警类型 // 报警类型
options.lineData.alarmType = null; options.lineData.alarmType = null;
// 报警信息 // 报警信息
options.lineData.alarmValue = null; options.lineData.alarmValue = null;
console.log("管道回复"); console.log("管道");
} else { } else {
// 报警声音 // 报警声音
this.audio(); this.audio();
...@@ -738,16 +753,20 @@ export default { ...@@ -738,16 +753,20 @@ export default {
console.log("管道报警"); console.log("管道报警");
} }
polyline.setExtData(options); polyline.setExtData(options);
console.log("dealStatus",dealStatus)
const myP = this.allList[0].filter((item) => { const myP = this.allList[0].filter((item) => {
console.log(item.selfData.alarmState); console.log(item.selfData.alarmState);
return item.selfData.alarmState; return item.selfData.alarmState || item.selfData.dealStatus ==4;
})[0]; })[0];
// console.log("this.allList[0]", this.allList[0]); // console.log("this.allList[0]", this.allList[0]);
// console.log("myP", myP); // console.log("myP", myP);
// 改变左侧列表的状态(1报警,0,正常) // 改变左侧列表的状态(1报警,0,正常)
console.log("myP", myP);
if (myP) {
myP.alarmState = options.lineData.alarmState; myP.alarmState = options.lineData.alarmState;
} }
}
}); });
} }
...@@ -756,8 +775,15 @@ export default { ...@@ -756,8 +775,15 @@ export default {
if (deviceArr.length > 0) { if (deviceArr.length > 0) {
deviceArr.forEach((item) => { deviceArr.forEach((item) => {
// 获取循报警设备的id // 获取循报警设备的id
const { deviceId, alarmId, alarmType, alarmValue, endTime, orderId } = const {
item; deviceId,
alarmId,
alarmType,
alarmValue,
endTime,
orderId,
dealStatus,
} = item;
// 获取polyLine // 获取polyLine
const device = this.gaoMap.markers.filter((item) => { const device = this.gaoMap.markers.filter((item) => {
const { deviceId: id, troubleId } = item.getExtData(); const { deviceId: id, troubleId } = item.getExtData();
...@@ -771,7 +797,9 @@ export default { ...@@ -771,7 +797,9 @@ export default {
options.view = this; options.view = this;
options.alarmId = alarmId; options.alarmId = alarmId;
options.orderId = orderId; options.orderId = orderId;
if (endTime) { // dealStatus==4 就是取消报警状态
if (endTime || dealStatus == 4) {
options.alarmState = 0; options.alarmState = 0;
// 报警类型 // 报警类型
options.alarmType = null; options.alarmType = null;
...@@ -812,7 +840,7 @@ export default { ...@@ -812,7 +840,7 @@ export default {
// 3是流量计 4是压力表 // 3是流量计 4是压力表
if (device.getExtData().deviceType == 3) { if (device.getExtData().deviceType == 3) {
// 如果有endtime说明已经维护好了 // 如果有endtime说明已经维护好了
if (endTime) { if (endTime || dealStatus == 4) {
this.gaoMap.changeMarkIcon( this.gaoMap.changeMarkIcon(
device, device,
require(`@/assets/images/liuliangji.png`) require(`@/assets/images/liuliangji.png`)
...@@ -824,7 +852,7 @@ export default { ...@@ -824,7 +852,7 @@ export default {
); );
} }
} else if (device.getExtData().deviceType == 4) { } else if (device.getExtData().deviceType == 4) {
if (endTime) { if (endTime || dealStatus == 4) {
this.gaoMap.changeMarkIcon( this.gaoMap.changeMarkIcon(
device, device,
require(`@/assets/images/yalibiao.png`) require(`@/assets/images/yalibiao.png`)
...@@ -848,7 +876,7 @@ export default { ...@@ -848,7 +876,7 @@ export default {
"ws://36.148.23.59:8901/gassafety/websocketServer" "ws://36.148.23.59:8901/gassafety/websocketServer"
); );
// this.ws = new WebSocket( // this.ws = new WebSocket(
// "ws://192.168.2.23:8903/gassafety/websocketServer" // "ws://192.168.2.28:8903/gassafety/websocketServer"
// ); // );
this.ws.onopen = (evt) => { this.ws.onopen = (evt) => {
console.log("WebSockets开启"); console.log("WebSockets开启");
...@@ -858,6 +886,7 @@ export default { ...@@ -858,6 +886,7 @@ export default {
// console.log("Received Message: " + evt.data); // console.log("Received Message: " + evt.data);
// ws.close(); // ws.close();
const obj = JSON.parse(evt.data); const obj = JSON.parse(evt.data);
console.log("接受socketobj", obj);
this.statusChange([obj]); this.statusChange([obj]);
}; };
this.ws.onclose = () => { this.ws.onclose = () => {
......
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