Commit 8b1c4a26 authored by 纪泽龙's avatar 纪泽龙

优化map的报警bug

parent 65d7d9d9
<!--
* @Author: your name
* @Date: 2022-01-26 20:07:52
* @LastEditTime: 2022-03-02 17:52:36
* @LastEditTime: 2022-03-03 11:51:13
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
......@@ -109,6 +109,7 @@
<script>
import { companyType, deviceType } from "@/utils/mapClass/config.js";
import { getTyx, getFm } from "@/api/bigWindow/getDevice.js";
export default {
data() {
return {
......@@ -134,14 +135,7 @@ export default {
});
}
// 当点开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;
}
});
this.myHttp();
// console.log(this.deviceData);
},
methods: {
......@@ -151,6 +145,29 @@ export default {
btnClick() {
this.vueRoot.centerDataFunc(this.deviceData.pressureFlows);
},
myHttp() {
console.log(this.deviceData.iconType)
if (this.deviceData.iconType == 2) {
getTyx({ 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;
}
});
} else {
getFm({ 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;
}
});
}
},
},
};
</script>
......
<!--
* @Author: your name
* @Date: 2022-01-26 20:07:52
* @LastEditTime: 2022-03-02 18:04:10
* @LastEditTime: 2022-03-03 11:51:48
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
......@@ -105,14 +105,7 @@ export default {
this.companyType[item.conpanyId] = item.companyName;
});
}
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;
}
});
this.myHttp();
// console.log(this.deviceData);
},
methods: {
......@@ -126,6 +119,16 @@ export default {
this.deviceData.nickName
);
},
myHttp() {
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;
}
});
},
},
};
</script>
......
/*
* @Author: your name
* @Date: 2022-01-11 13:45:12
* @LastEditTime: 2022-03-03 10:23:10
* @LastEditTime: 2022-03-03 11:51:16
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: /test/hello-world/src/utils/mapClass.js
......@@ -523,7 +523,7 @@ export class EditorMap {
}
// 报警时候,可能发生infowindowComponent存在,也要变化
alarmInfowindowChange(obj) {
return;
if (!this.infowindowComponent) return;
// 如果infowindow是打开的,就改变里面的数据 必须是 调压箱2 阀门3 用户6 才会发生变化电话
const infowindowDeviceType = [2, 3, 6].includes(
......@@ -542,7 +542,10 @@ export class EditorMap {
infowindowDeviceType &&
infowindowComponentHas
) {
this.infowindowComponentChange(obj);
// this.infowindowComponentChange(obj);
if(this.infowindowComponent.http){
this.infowindowComponent.myHttp()
}
}
}
//如果传过来的报警设备中,有不在deviceAlarm中,就是恢复的设备恢复
......@@ -563,10 +566,11 @@ export class EditorMap {
for (let i = 0; i < arr.length; i++) {
// 看看现有报警设备中有没有不在 报警数组中的值,有就恢复可能是userId,也可能是deviceId
const publicId = arr[i];
// 看看接口传来的数据中还有没有这些UserId,如果没有了,就是修好了
const index = httpObj[iconType]?.indexOf(publicId);
// 看看接口传来的数据中还有没有这些Id,如果没有了,就是修好了
const hasId = httpObj[iconType]?.includes(publicId);
// 如果已经不在报警数组中,就要去大数组中找他,利用userId
if (index < 0) {
// 如果id不存在了,说明不报警了
if (!hasId) {
// 过滤出来这个要恢复的设备
const device = this.allDevice[iconType].filter(
(item) =>
......@@ -581,7 +585,7 @@ export class EditorMap {
// device.setExtData(deviceData);
// device.oldData = null;
// 如果infowindow是打开的
// this.alarmInfowindowChange(deviceData);
this.alarmInfowindowChange(device.getExtData());
// 在arr中删掉
arr.splice(i, 1);
// 由于删掉了当前,所以要--恢复位置
......
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