Commit 99c842a9 authored by 纪泽龙's avatar 纪泽龙

修改报警逻辑,增加调压箱,阀门报警,改变infowindow组件逻辑

parent 7dbf6501
<svg width="22" height="25" viewBox="0 0 22 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.6552 9.77278C16.6552 12.9211 14.103 15.4733 10.9547 15.4733C7.80636 15.4733 5.25415 12.9211 5.25415 9.77278C5.25415 6.62447 7.80636 4.07227 10.9547 4.07227C14.103 4.07227 16.6552 6.62447 16.6552 9.77278ZM10.867 11.2506H11.324V13.098H10.867V11.2506ZM9.84612 11.2506H10.3032V13.098H9.84612V11.2506ZM13.7726 6.71854V12.5548H14.2799V13.0979H11.726V11.0721C11.726 10.9225 11.6011 10.8005 11.4482 10.8005H9.43527C9.2823 10.8005 9.15705 10.9228 9.15705 11.0721V13.0979H7.62926V12.5544H8.13655V9.16448C8.13763 9.09164 8.16749 9.02218 8.21963 8.97129C8.27176 8.9204 8.34192 8.89223 8.41477 8.89292H10.0619V8.32503C10.0629 8.25212 10.0927 8.18257 10.1448 8.1316C10.197 8.08063 10.2672 8.0524 10.3401 8.0531H11.4035C11.4764 8.0524 11.5466 8.08063 11.5987 8.1316C11.6509 8.18257 11.6807 8.25212 11.6817 8.32503V8.89329H12.1236V6.71891C12.1247 6.64607 12.1545 6.57661 12.2067 6.52572C12.2588 6.47483 12.3289 6.44666 12.4018 6.44735H13.4943C13.5671 6.44666 13.6372 6.47478 13.6894 6.52559C13.7415 6.5764 13.7714 6.64576 13.7726 6.71854ZM9.23907 10.4022H11.6455H11.647V9.8591H9.23907V10.4022Z" fill="#F0C41B">
<animate attributeName="fill" attributeType="XML"
from="#F0C41B" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<path d="M5.7556 4.49115C2.88589 7.36086 2.87565 12.0077 5.73811 14.8702C6.03244 15.1645 6.45323 15.7447 6.94211 16.4931C7.42337 17.2298 7.94668 18.0917 8.44496 18.922C8.55553 19.1063 8.66499 19.2892 8.77248 19.4688C9.14688 20.0944 9.49738 20.6801 9.78744 21.1433C9.97373 21.4407 10.1413 21.6977 10.2784 21.8867C10.3462 21.9801 10.4142 22.0676 10.4788 22.1379C10.5108 22.1728 10.5501 22.2123 10.5949 22.2483C10.6309 22.2772 10.7126 22.3389 10.8281 22.3689C11.0039 22.4146 11.1483 22.3604 11.2172 22.3271C11.2918 22.2911 11.3505 22.2447 11.3901 22.21C11.4707 22.1392 11.548 22.0487 11.6172 21.9601C11.7593 21.7779 11.9291 21.5227 12.114 21.2281C12.454 20.6862 12.8754 19.9616 13.3199 19.1974C13.3616 19.1256 13.4036 19.0535 13.4457 18.9811C13.939 18.1333 14.4562 17.2492 14.9321 16.495C15.4164 15.7273 15.8303 15.1395 16.1171 14.8527C18.9868 11.983 18.9971 7.33612 16.1346 4.47366C13.2722 1.6112 8.62531 1.62144 5.7556 4.49115Z" stroke="#F0C41B">
<animate attributeName="fill" attributeType="XML"
from="#F0C41B" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<g filter="url(#filter0_f_194_268)">
<path d="M10.9626 22.709L12.997 19.1853H8.92825L10.9626 22.709Z" fill="#F0C41B">
<animate attributeName="fill" attributeType="XML"
from="#F0C41B" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
</g>
<defs>
<filter id="filter0_f_194_268" x="6.92822" y="17.1855" width="8.06885" height="7.52344" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="1" result="effect1_foregroundBlur_194_268"/>
</filter>
</defs>
</svg>
<svg width="22" height="25" viewBox="0 0 22 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.7556 4.49115C2.88589 7.36086 2.87565 12.0077 5.73811 14.8702C6.03244 15.1645 6.45323 15.7447 6.94211 16.4931C7.42337 17.2298 7.94668 18.0917 8.44496 18.922C8.55553 19.1063 8.66499 19.2892 8.77248 19.4688C9.14688 20.0944 9.49738 20.6801 9.78744 21.1433C9.97373 21.4407 10.1413 21.6977 10.2784 21.8867C10.3462 21.9801 10.4142 22.0676 10.4788 22.1379C10.5108 22.1728 10.5501 22.2123 10.5949 22.2483C10.6309 22.2772 10.7126 22.3389 10.8281 22.3689C11.0039 22.4146 11.1483 22.3604 11.2172 22.3271C11.2918 22.2911 11.3505 22.2447 11.3901 22.21C11.4707 22.1392 11.548 22.0487 11.6172 21.9601C11.7593 21.7779 11.9291 21.5227 12.114 21.2281C12.454 20.6862 12.8754 19.9616 13.3199 19.1974C13.3616 19.1256 13.4036 19.0535 13.4457 18.9811C13.939 18.1333 14.4562 17.2492 14.9321 16.495C15.4164 15.7273 15.8303 15.1395 16.1171 14.8527C18.9868 11.983 18.9971 7.33612 16.1346 4.47366C13.2722 1.6112 8.62531 1.62144 5.7556 4.49115Z" stroke="#FA8167">
<animate attributeName="fill" attributeType="XML"
from="#FA8167" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<path d="M16.6134 8.94262C16.4134 7.58911 15.7326 6.3525 14.6954 5.45841C13.6581 4.56433 12.3334 4.07236 10.963 4.07227C9.44847 4.07227 7.99596 4.67294 6.92503 5.74214C5.85409 6.81135 5.25244 8.2615 5.25244 9.77359C5.25244 11.2857 5.85409 12.7358 6.92503 13.805C7.99596 14.8742 9.44847 15.4749 10.963 15.4749C12.3334 15.4748 13.6581 14.9828 14.6954 14.0888C15.7326 13.1947 16.4134 11.9581 16.6134 10.6046L16.6551 9.77359L16.6134 8.94262ZM6.58836 9.37325C6.682 8.3553 7.12877 7.40197 7.85151 6.67789C8.57425 5.95381 9.52758 5.50446 10.5468 5.40744V6.27779C9.75838 6.37152 9.02466 6.72811 8.46439 7.28987C7.90413 7.85162 7.55009 8.58567 7.45957 9.37325H6.58836ZM10.5468 14.1399C9.5328 14.0434 8.58385 13.5981 7.8623 12.8802C7.14075 12.1623 6.69144 11.2165 6.59121 10.2044H7.46332C7.5602 10.9858 7.91657 11.7123 8.47551 12.2678C9.03445 12.8233 9.76372 13.1757 10.5468 13.2689V14.1399ZM10.3991 10.0155V11.9119H9.69579V7.62704H12.6225V8.2271H10.3984V9.4153H12.4963V10.0154L10.3991 10.0155ZM11.3792 14.1399V13.2694C12.1623 13.1762 12.8915 12.8238 13.4505 12.2683C14.0094 11.7128 14.3658 10.9863 14.4627 10.2049H15.3348C15.2344 11.2169 14.785 12.1625 14.0635 12.8803C13.3419 13.598 12.3931 14.0434 11.3792 14.1399ZM14.4664 9.37325C14.3759 8.58567 14.0219 7.85162 13.4616 7.28987C12.9013 6.72811 12.1676 6.37152 11.3792 6.27779V5.40744C12.3984 5.5045 13.3517 5.95387 14.0744 6.67794C14.7971 7.40202 15.2438 8.35533 15.3375 9.37325H14.4664Z" fill="#FA8167">
<animate attributeName="fill" attributeType="XML"
from="#FA8167" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<g filter="url(#filter0_f_194_248)">
<path d="M10.9626 22.709L12.997 19.1853H8.92825L10.9626 22.709Z" fill="#FA8167">
<animate attributeName="fill" attributeType="XML"
from="#FA8167" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
</g>
<defs>
<filter id="filter0_f_194_248" x="6.92822" y="17.1855" width="8.06885" height="7.52344" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="1" result="effect1_foregroundBlur_194_248"/>
</filter>
</defs>
</svg>
<svg width="22" height="25" viewBox="0 0 22 25" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.9547 4.07031C9.44279 4.07031 7.99285 4.6709 6.92379 5.73995C5.85474 6.80901 5.25415 8.25896 5.25415 9.77083C5.25415 11.2827 5.85474 12.7326 6.92379 13.8017C7.99285 14.8708 9.44279 15.4713 10.9547 15.4713C12.4665 15.4713 13.9165 14.8708 14.9855 13.8017C16.0546 12.7326 16.6552 11.2827 16.6552 9.77083C16.6552 8.25896 16.0546 6.80901 14.9855 5.73995C13.9165 4.6709 12.4665 4.07031 10.9547 4.07031V4.07031ZM14.375 11.766H13.8049V12.6211H12.9498V13.1911H11.8097V12.6211H10.3846V13.1911H9.24451V12.6211H8.38943V11.766H7.81938V7.77565H8.38943V6.92057H9.24451V6.63554H10.0996V6.92057H10.6696V6.63554H11.5247V6.92057H12.0948V6.63554H12.9498V6.92057H13.8049V7.77565H14.375V11.766ZM8.67446 11.766H13.5199V7.49062H8.67446V11.766ZM12.9498 7.77565H13.2349V11.481H12.9498V7.77565ZM12.3798 7.77565H12.6648V11.481H12.3798V7.77565ZM11.8097 7.77565H12.0948V11.481H11.8097V7.77565ZM11.2397 7.77565H11.5247V11.481H11.2397V7.77565ZM10.6696 7.77565H10.9547V11.481H10.6696V7.77565ZM10.0996 7.77565H10.3846V11.481H10.0996V7.77565ZM9.52954 7.77565H9.81456V11.481H9.52954V7.77565ZM8.95948 7.77565H9.24451V11.481H8.95948V7.77565Z" fill="#74C5FF">
<animate attributeName="fill" attributeType="XML"
from="#74C5FF" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<path d="M5.7556 4.49115C2.88589 7.36086 2.87565 12.0077 5.73811 14.8702C6.03244 15.1645 6.45323 15.7447 6.94211 16.4931C7.42337 17.2298 7.94668 18.0917 8.44496 18.922C8.55553 19.1063 8.66499 19.2892 8.77248 19.4688C9.14688 20.0944 9.49738 20.6801 9.78744 21.1433C9.97373 21.4407 10.1413 21.6977 10.2784 21.8867C10.3462 21.9801 10.4142 22.0676 10.4788 22.1379C10.5108 22.1728 10.5501 22.2123 10.5949 22.2483C10.6309 22.2772 10.7126 22.3389 10.8281 22.3689C11.0039 22.4146 11.1483 22.3604 11.2172 22.3271C11.2918 22.2911 11.3505 22.2447 11.3901 22.21C11.4707 22.1392 11.548 22.0487 11.6172 21.9601C11.7593 21.7779 11.9291 21.5227 12.114 21.2281C12.454 20.6862 12.8754 19.9616 13.3199 19.1974C13.3616 19.1256 13.4036 19.0535 13.4457 18.9811C13.939 18.1333 14.4562 17.2492 14.9321 16.495C15.4164 15.7273 15.8303 15.1395 16.1171 14.8527C18.9868 11.983 18.9971 7.33612 16.1346 4.47366C13.2722 1.6112 8.62531 1.62144 5.7556 4.49115Z" stroke="#74C5FF">
<animate attributeName="fill" attributeType="XML"
from="#74C5FF" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
<g filter="url(#filter0_f_194_260)">
<path d="M10.9626 22.709L12.997 19.1853H8.92825L10.9626 22.709Z" fill="#74C5FF">
<animate attributeName="fill" attributeType="XML"
from="#74C5FF" to="#ff0000"
begin="0s" dur="1s"
fill="remove" repeatCount="indefinite"/>
</path>
</g>
<defs>
<filter id="filter0_f_194_260" x="6.92822" y="17.1855" width="8.06885" height="7.52344" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="1" result="effect1_foregroundBlur_194_260"/>
</filter>
</defs>
</svg>
<!--
* @Author: your name
* @Date: 2022-01-26 20:07:52
* @LastEditTime: 2022-03-02 17:52:36
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/views/components/deviceA.vue
-->
<template>
<div class="devicea-wrapper">
<div class="title">
{{
deviceData.deviceName ? deviceData.deviceName : deviceData.stationName
}}
</div>
<div class="close" @click="close">
<img src="@/assets/mapImages/closeBtn.png" alt="" />
</div>
<div class="top flex">
<div class="group">
<div class="left">所属公司:</div>
<div class="right zzz">{{ companyType[deviceData.companyType] }}</div>
</div>
<div class="group">
<div class="left">设备类型:</div>
<div class="right zzz">
{{ deviceType[deviceData.iconType] }}
</div>
</div>
<div class="group">
<div class="left">设备地址:</div>
<div
v-if="deviceData.deviceAddr"
:title="deviceData.deviceAddr"
class="right last zzz"
>
{{ deviceData.deviceAddr || "-" }}
</div>
<div
v-else-if="deviceData.stationAddr"
:title="deviceData.stationAddr"
class="right last zzz"
>
{{ deviceData.stationAddr || "-" }}
</div>
<div v-else>-</div>
</div>
</div>
<div class="middle">{{ profile }}</div>
<div class="foot">
<div class="thead flex">
<div class="first">设备类型</div>
<div>设备数量</div>
<div>在线设备</div>
<div>离线设备</div>
<div>历史报警</div>
<div>已处理报警</div>
<div class="last">报警中</div>
</div>
<div class="tbody flex" v-if="Array.isArray(deviceData.pressureFlows)">
<div class="first zzz">{{ "压力表" }}</div>
<div v-unValue class="">{{ deviceData.numberPressureGauges }}</div>
<div v-unValue class="">
{{ deviceData.onlineEquipment }}
</div>
<div v-unValue class="">
{{ deviceData.offlineEquipment }}
</div>
<div v-unValue class="">
{{ deviceData.historicalAlarm }}
</div>
<div v-unValue class="">
{{ deviceData.alarmProcessed }}
</div>
<div v-unValue class="last">
{{ deviceData.inAlarm }}
</div>
</div>
<div class="tbody flex" v-if="Array.isArray(deviceData.pressureFlows)">
<div class="first zzz">{{ "流量计" }}</div>
<div v-unValue class="">{{ deviceData.numberEquipment }}</div>
<div v-unValue class="">
{{ deviceData.numberOnlineEquipment }}
</div>
<div v-unValue class="">
{{ deviceData.numberOfflineEquipment }}
</div>
<div v-unValue class="">
{{ deviceData.numberHistoricalAlarm }}
</div>
<div v-unValue class="">
{{ deviceData.numberAlarmProcessed }}
</div>
<div v-unValue class="last">
{{ deviceData.numberInAlarm }}
</div>
</div>
</div>
<div class="btn">
<div @click="btnClick">感知设备</div>
</div>
</div>
</template>
<script>
import { companyType, deviceType } from "@/utils/mapClass/config.js";
export default {
data() {
return {
companyType,
deviceType,
profile: "暂无",
};
},
computed: {
prodTest() {
return this.vueRoot.$store.state.user.systemSetting.prod_test;
},
company() {
return this.vueRoot.$store.state.bigWindowCompany.company;
},
},
mounted() {
// 如果不是测试,而是真数据,就要用帧数据的东西
if (this.prodTest != "test") {
this.companyType = {};
this.company.forEach((item) => {
this.companyType[item.conpanyId] = item.companyName;
});
}
// 当点开infowindow的时候,重新调接口
detectorUserList({ DeviceId: this.deviceData.DeviceId }).then((res) => {
if (res.code == 200) {
const data = res.data.filter(
(item) => item.deviceId == this.deviceData.deviceId
)[0].detectorCountList;
this.deviceData.detectorCountList = data;
}
});
// console.log(this.deviceData);
},
methods: {
close() {
this.mapClass.infowindowClose();
},
btnClick() {
this.vueRoot.centerDataFunc(this.deviceData.pressureFlows);
},
},
};
</script>
<style lang="scss" scoped>
.devicea-wrapper {
background-color: rgba(9, 18, 32, 0.6);
padding: 10px;
position: relative;
width: 700px;
.title {
// padding-top: 10px;
// padding-left: 10px;
font-size: 14px;
line-height: 14px;
color: #ffffff;
}
.close {
position: absolute;
right: 10px;
top: 5px;
cursor: pointer;
}
.top {
margin-top: 10px;
margin-bottom: 10px;
border: 1px solid #cccccc;
box-sizing: border-box;
.group {
height: 30px;
flex: 1;
display: flex;
justify-content: space-between;
box-sizing: border-box;
div {
flex: 1;
box-sizing: border-box;
border-right: 1px solid #cccccc;
text-align: center;
font-size: 14px;
color: #ffffff;
line-height: 30px;
padding: 0 5px;
&.last {
border-right: none;
}
}
.left {
text-align: right;
background-color: rgba(255, 255, 255, 0.1);
}
}
}
.middle {
width: 100%;
padding: 5px;
border: 1px solid #ffffff;
box-sizing: border-box;
font-size: 14px;
color: #ffffff;
text-indent: 2em;
margin-bottom: 10px;
}
.foot {
font-size: 14px;
color: #ffffff;
.thead,
.tbody {
border: 1px solid #cccccc;
div {
flex: 1;
text-align: left;
border-right: 1px solid #cccccc;
box-sizing: border-box;
padding: 0 5px;
}
.first {
flex: 2;
}
.last {
border-right: none;
}
}
.tbody {
border-top: none;
}
.thead {
div {
background-color: rgba(255, 255, 255, 0.1);
}
}
}
.btn {
position: relative;
margin-top: 10px;
text-align: right;
div {
font-size: 14px;
color: #ffffff;
padding: 2px 4px;
box-sizing: border-box;
display: inline-block;
cursor: pointer;
border: 1px solid #cccccc;
background-color: #1890ff;
&:hover {
// background: rgba(9, 18, 32, 0.6);
background-color: #18baff;
}
}
}
.flex {
display: flex;
justify-content: space-between;
}
}
</style>
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-01-26 20:07:52 * @Date: 2022-01-26 20:07:52
* @LastEditTime: 2022-03-01 09:17:01 * @LastEditTime: 2022-03-02 18:04:10
* @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
...@@ -80,6 +80,8 @@ ...@@ -80,6 +80,8 @@
<script> <script>
import { companyType, deviceType } from "@/utils/mapClass/config.js"; import { companyType, deviceType } from "@/utils/mapClass/config.js";
import { detectorUserList } from "@/api/detector/detectorUser";
export default { export default {
data() { data() {
return { return {
...@@ -103,7 +105,15 @@ export default { ...@@ -103,7 +105,15 @@ export default {
this.companyType[item.conpanyId] = item.companyName; this.companyType[item.conpanyId] = item.companyName;
}); });
} }
console.log(this.deviceData); detectorUserList({ userId: this.deviceData.userId }).then((res) => {
if (res.code == 200) {
const data = res.data.filter(
(item) => item.userId == this.deviceData.userId
)[0].detectorCountList;
this.deviceData.detectorCountList = data;
}
});
// console.log(this.deviceData);
}, },
methods: { methods: {
close() { close() {
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-01-26 10:47:44 * @Date: 2022-01-26 10:47:44
* @LastEditTime: 2022-03-02 11:28:29 * @LastEditTime: 2022-03-02 18:08:35
* @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/config.js * @FilePath: /test/hello-world/src/utils/config.js
...@@ -33,9 +33,9 @@ export const svgUrl = { ...@@ -33,9 +33,9 @@ export const svgUrl = {
8: require("@/assets/image/zcrq.svg"), 8: require("@/assets/image/zcrq.svg"),
}; };
export const svgAlarm = { export const svgAlarm = {
2: require("@/assets/image/tiaoyaxiang1.svg"), 2: require("@/assets/image/tyxAlarm.svg"),
3: require("@/assets/image/famen1.svg"), 3: require("@/assets/image/fmAlarm.svg"),
4: require("@/assets/image/changzhan1.svg"), 4: require("@/assets/image/czAlarm.svg"),
5: require("@/assets/image/jiankong1.svg"), 5: require("@/assets/image/jiankong1.svg"),
6: require("@/assets/mapImages/userAlarm.svg"), 6: require("@/assets/mapImages/userAlarm.svg"),
}; };
......
/* /*
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:45:12 * @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-03-02 10:53:47 * @LastEditTime: 2022-03-02 17:40:23
* @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
...@@ -496,10 +496,12 @@ export class EditorMap { ...@@ -496,10 +496,12 @@ export class EditorMap {
// 设备报警 // 设备报警
deviceAlarm(obj) { deviceAlarm(obj) {
// 设备的类型 // 设备的类型
const { iconType, userId } = obj; const { iconType } = obj;
const publicId = obj.userId || obj.deviceId;
// 找到这个设备所属的空间 // 找到这个设备所属的空间
const device = this.allDevice[iconType].filter( const device = this.allDevice[iconType].filter(
(item) => item.getExtData().userId == userId (item) =>
(item.getExtData().userId || item.getExtData().deviceId) == publicId
)[0]; )[0];
// 更改的icon // 更改的icon
const icon = svgAlarm[iconType]; const icon = svgAlarm[iconType];
...@@ -507,57 +509,78 @@ export class EditorMap { ...@@ -507,57 +509,78 @@ export class EditorMap {
// 将旧的值缓存一下 // 将旧的值缓存一下
device.oldData = device.getExtData(); device.oldData = device.getExtData();
device.setExtData(obj); device.setExtData(obj);
// 如果infowindow是打开的,就改变里面的数据,必须是用户才行 // 可能出现infoWindow数据变化
if ( this.alarmInfowindowChange(obj);
this.infowindowComponent &&
this.infowindowComponent.deviceData.iconType == 6 &&
this.infowindowComponent.deviceData.userId == obj.userId
) {
this.infowindowComponentChange(obj);
}
if (!this.alarmObj[iconType]) { if (!this.alarmObj[iconType]) {
this.alarmObj[iconType] = []; this.alarmObj[iconType] = [];
} else { } else {
const ind = this.alarmObj[iconType].indexOf(userId); const ind = this.alarmObj[iconType].indexOf(publicId);
if (ind < 0) { if (ind < 0) {
this.alarmObj[iconType].push(userId); this.alarmObj[iconType].push(publicId);
} }
} }
} }
// 报警时候,可能发生infowindowComponent存在,也要变化
alarmInfowindowChange(obj) {
if(!this.infowindowComponent ) return;
// 如果infowindow是打开的,就改变里面的数据 必须是 调压箱2 阀门3 用户6 才会发生变化电话
const infowindowDeviceType = [2, 3, 6].includes(
this.infowindowComponent.deviceData.iconType
);
// 如果存在userId就用userId,如果存在deviceId就用deviceId
const infowindowDeviceId =
this.infowindowComponent.deviceData.userId ||
this.infowindowComponent.deviceData.deviceId;
// 如果存在userId就用userId,如果存在deviceId就用deviceId
const objId = obj.userId || obj.deviceId;
// 如果两个值匹配,才可以改变infowindow身上的组件
const infowindowComponentHas = infowindowDeviceId == objId;
if (
this.infowindowComponent &&
infowindowDeviceType &&
infowindowComponentHas
) {
this.infowindowComponentChange(obj);
}
}
//如果传过来的报警设备中,有不在deviceAlarm中,就是恢复的设备恢复 //如果传过来的报警设备中,有不在deviceAlarm中,就是恢复的设备恢复
relieveAlarm(alarmObj) { relieveAlarm(alarmObj) {
// 把报警数组改变结构 // 把报警数组改变结构,如果有userId就是用户,如果有deviceId就是其他设备
const httpArr = alarmObj.map((item) => item.userId); const httpObj = {};
alarmObj.forEach((item) => {
const publicId = item.userId || item.deviceId;
if (Array.isArray(item.iconType)) {
httpObj[item.iconType].push(publicId);
}else{
httpObj[item.iconType]=[];
}
});
// 循环现有报警设备 // 循环现有报警设备
for (let 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++) {
// 看看现有报警设备中有没有不在 报警数组中的值,有就恢复 // 看看现有报警设备中有没有不在 报警数组中的值,有就恢复可能是userId,也可能是deviceId
const userId = arr[i]; const publicId = arr[i];
// 看看接口传来的数据中还有没有这些UserId,如果没有了,就是修好了 // 看看接口传来的数据中还有没有这些UserId,如果没有了,就是修好了
const index = httpArr.indexOf(userId); const index = httpObj[iconType].indexOf(publicId);
// 如果已经不在报警数组中,就要去大数组中找他,利用userId // 如果已经不在报警数组中,就要去大数组中找他,利用userId
if (index < 0) { if (index < 0) {
// 过滤出来这个要恢复的设备 // 过滤出来这个要恢复的设备
const device = this.allDevice[iconType].filter( const device = this.allDevice[iconType].filter(
(item) => item.getExtData().userId == userId (item) =>
(item.getExtData().userId || item.getExtData().deviceId) ==
publicId
)[0]; )[0];
// 恢复 // 恢复
const icon = svgUrl[iconType]; const icon = svgUrl[iconType];
device.setIcon(icon); device.setIcon(icon);
// 赋值 // 赋值
const deviceData = device.oldData; const deviceData = { ...device.oldData };
device.setExtData(deviceData); device.setExtData(deviceData);
device.oldData = null; device.oldData = null;
// 如果infowindow是打开的 // 如果infowindow是打开的
if ( this.alarmInfowindowChange(deviceData);
this.infowindowComponent &&
this.infowindowComponent.deviceData.iconType == 6 &&
this.infowindowComponent.deviceData.userId == obj.userId
) {
this.infowindowComponentChange(deviceData);
}
// 在arr中删掉 // 在arr中删掉
arr.splice(i, 1); arr.splice(i, 1);
// 由于删掉了当前,所以要--恢复位置 // 由于删掉了当前,所以要--恢复位置
......
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-01-11 13:44:17 * @Date: 2022-01-11 13:44:17
* @LastEditTime: 2022-03-02 11:47:13 * @LastEditTime: 2022-03-02 16:45: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
...@@ -144,7 +144,7 @@ import { ...@@ -144,7 +144,7 @@ import {
changzhan, changzhan,
jiankong, jiankong,
user, user,
alarmtime alarmtime,
} from "@/utils/mapClass/config.js"; } from "@/utils/mapClass/config.js";
import { import {
getPipe, getPipe,
...@@ -158,7 +158,8 @@ import { ...@@ -158,7 +158,8 @@ import {
} 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";
import DeviceA from "@/components/bigWindow/DeviceA.vue"; import Device from "@/components/bigWindow/Device.vue";
import Cz from "@/components/bigWindow/Cz.vue";
import User from "@/components/bigWindow/User.vue"; import User from "@/components/bigWindow/User.vue";
import Center from "@/components/bigWindow/Center.vue"; import Center from "@/components/bigWindow/Center.vue";
import UserCenter from "@/components/bigWindow/UserCenter.vue"; import UserCenter from "@/components/bigWindow/UserCenter.vue";
...@@ -290,9 +291,9 @@ export default { ...@@ -290,9 +291,9 @@ export default {
// 这是测试,用本地数据 // 这是测试,用本地数据
if (this.systemSetting.prod_test === "test") { if (this.systemSetting.prod_test === "test") {
this.addPipeLine(pipeData, Line); this.addPipeLine(pipeData, Line);
this.addDevice(tiaoyaxiang, DeviceA); this.addDevice(tiaoyaxiang, Device);
this.addDevice(famen, DeviceA); this.addDevice(famen, Device);
this.addDevice(changzhan, DeviceA); this.addDevice(changzhan, Cz);
this.addDevice(user, User); this.addDevice(user, User);
this.addDevice(jiankong, VideoView); this.addDevice(jiankong, VideoView);
} else { } else {
...@@ -308,13 +309,12 @@ export default { ...@@ -308,13 +309,12 @@ export default {
// getPipe() getTyx() getFm() getCz() getVideo() getUser() // getPipe() getTyx() getFm() getCz() getVideo() getUser()
this.goMap(getPipe, this.addPipeLine, Line); this.goMap(getPipe, this.addPipeLine, Line);
this.goMap(getTyx, this.addDevice, DeviceA); this.goMap(getTyx, this.addDevice, Device);
this.goMap(getFm, this.addDevice, DeviceA); this.goMap(getFm, this.addDevice, Device);
this.goMap(getCz, this.addDevice, DeviceA); this.goMap(getCz, this.addDevice, Cz);
this.goMap(getVideo, this.addDevice, VideoView); this.goMap(getVideo, this.addDevice, VideoView);
this.goMap(getEnterprise, this.addDevice, Company); this.goMap(getEnterprise, this.addDevice, Company);
// 用户要等一下 因为有报警数据 // 用户要等一下 因为有报警数据
this.goMap(detectorUserList, this.addDevice, User).then((res) => { this.goMap(detectorUserList, this.addDevice, User).then((res) => {
// 先查一下,然后开启定时器 // 先查一下,然后开启定时器
......
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