|
|
@ -1245,54 +1245,54 @@ module.exports = function (app, opts) { |
|
|
|
// 上面的代码自内而外构建数据
|
|
|
|
// 下面的逻辑自外向内!!!
|
|
|
|
|
|
|
|
// 处理那些没有被匹配到的告警信息
|
|
|
|
// 将设备没有绑定到测点的告警也推出去
|
|
|
|
for (let a of alarmDatas) { |
|
|
|
if (!matchedAlarmIds.includes(a.alarmId)) { |
|
|
|
let curStruc = strucMap[a.StructureId] |
|
|
|
if (curStruc) { |
|
|
|
// curStruc 可以推出 告警属于哪个 project -> pomsProject
|
|
|
|
let curProject = pepProject_name.filter(p => p.anxinProjectId && p.anxinProjectId.includes(curStruc.projectId)); |
|
|
|
for (let cp of curProject) { |
|
|
|
// cp.projects 是结构物信息
|
|
|
|
let curStruc = cp.projects.find(cpp => cpp.id == a.StructureId) |
|
|
|
if (!curStruc) { |
|
|
|
console.error(`没有查到结构物信息:${a.StructureId}?!不应该不应该!`); |
|
|
|
} else { |
|
|
|
// let emptyFactor = { id: -1 }
|
|
|
|
let emptyFactor = curStruc.factor.find(f => f.id == -1) |
|
|
|
if (!emptyFactor) { |
|
|
|
curStruc.factor.push({ |
|
|
|
id: -1, |
|
|
|
devices: [{ |
|
|
|
alarmDatas: [ |
|
|
|
{ ...a } |
|
|
|
], |
|
|
|
iotaDeviceId: a.sourceId, |
|
|
|
name: a.SourceName, |
|
|
|
structureId: a.StructureId, |
|
|
|
}] |
|
|
|
}) |
|
|
|
} else { |
|
|
|
let curDevice = emptyFactor.devices.find(d => d.iotaDeviceId == a.sourceId) |
|
|
|
if (!curDevice) { |
|
|
|
emptyFactor.devices.push({ |
|
|
|
alarmDatas: [ |
|
|
|
{ ...a } |
|
|
|
], |
|
|
|
iotaDeviceId: a.sourceId, |
|
|
|
name: a.SourceName, |
|
|
|
structureId: a.StructureId, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
curDevice.alarmDatas.push({ ...a }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// // 处理那些没有被匹配到的告警信息
|
|
|
|
// // 将设备没有绑定到测点的告警也推出去
|
|
|
|
// for (let a of alarmDatas) {
|
|
|
|
// if (!matchedAlarmIds.includes(a.alarmId)) {
|
|
|
|
// let curStruc = strucMap[a.StructureId]
|
|
|
|
// if (curStruc) {
|
|
|
|
// // curStruc 可以推出 告警属于哪个 project -> pomsProject
|
|
|
|
// let curProject = pepProject_name.filter(p => p.anxinProjectId && p.anxinProjectId.includes(curStruc.projectId));
|
|
|
|
// for (let cp of curProject) {
|
|
|
|
// // cp.projects 是结构物信息
|
|
|
|
// let curStruc = cp.projects.find(cpp => cpp.id == a.StructureId)
|
|
|
|
// if (!curStruc) {
|
|
|
|
// console.error(`没有查到结构物信息:${a.StructureId}?!不应该不应该!`);
|
|
|
|
// } else {
|
|
|
|
// // let emptyFactor = { id: -1 }
|
|
|
|
// let emptyFactor = curStruc.factor.find(f => f.id == -1)
|
|
|
|
// if (!emptyFactor) {
|
|
|
|
// curStruc.factor.push({
|
|
|
|
// id: -1,
|
|
|
|
// devices: [{
|
|
|
|
// alarmDatas: [
|
|
|
|
// { ...a }
|
|
|
|
// ],
|
|
|
|
// iotaDeviceId: a.sourceId,
|
|
|
|
// name: a.SourceName,
|
|
|
|
// structureId: a.StructureId,
|
|
|
|
// }]
|
|
|
|
// })
|
|
|
|
// } else {
|
|
|
|
// let curDevice = emptyFactor.devices.find(d => d.iotaDeviceId == a.sourceId)
|
|
|
|
// if (!curDevice) {
|
|
|
|
// emptyFactor.devices.push({
|
|
|
|
// alarmDatas: [
|
|
|
|
// { ...a }
|
|
|
|
// ],
|
|
|
|
// iotaDeviceId: a.sourceId,
|
|
|
|
// name: a.SourceName,
|
|
|
|
// structureId: a.StructureId,
|
|
|
|
// })
|
|
|
|
// } else {
|
|
|
|
// curDevice.alarmDatas.push({ ...a })
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
pepProject_name.forEach(h => { |
|
|
|
let rowspan1 = 0 |
|
|
|