|
|
@ -1168,11 +1168,11 @@ module.exports = function (app, opts) { |
|
|
|
if (f.devices.length) { |
|
|
|
f.devices.forEach(c => { |
|
|
|
if (c.alarmDatas.length) { |
|
|
|
c.alarmDatas.forEach(a => { |
|
|
|
|
|
|
|
rowspan1 += 1 |
|
|
|
rowspan2 += 1 |
|
|
|
rowspan3 += 1 |
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
delete c.alarmDatas |
|
|
|
} |
|
|
@ -1195,7 +1195,7 @@ module.exports = function (app, opts) { |
|
|
|
} |
|
|
|
h.rowspan = rowspan1 |
|
|
|
}) |
|
|
|
console.log('数据组合', JSON.stringify(pepProject_name)); |
|
|
|
// console.log('数据组合', JSON.stringify(pepProject_name));
|
|
|
|
//
|
|
|
|
dataAlarmG1 = pepProject_name |
|
|
|
} |
|
|
@ -1214,10 +1214,8 @@ module.exports = function (app, opts) { |
|
|
|
let alarmContent = '' |
|
|
|
let alarmHtmlTitle = packageTableTitle(alarmTitleArr) |
|
|
|
|
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alarmData.map((h, hi) => { |
|
|
|
|
|
|
|
if (h.projects && h.projects.length) { |
|
|
@ -1232,46 +1230,46 @@ module.exports = function (app, opts) { |
|
|
|
f.devices.map((c, ci) => { |
|
|
|
let showOne3 = (ci == 0) ? true : false |
|
|
|
if (c.alarmDatas && c.alarmDatas.length) { |
|
|
|
c.alarmDatas.map(a => { |
|
|
|
let tableData = '<tr>' |
|
|
|
|
|
|
|
for (let t of alarmTitleArr) { |
|
|
|
if (t.f) { |
|
|
|
tableData += `<td>${t.f(a) || ''}</td>` |
|
|
|
} else if (t.k) { |
|
|
|
|
|
|
|
switch (t.k) { |
|
|
|
case 'name': |
|
|
|
if (showOne1 && showOne2 && showOne3) { |
|
|
|
tableData += `<th rowspan=${h.rowspan}>${h[t.k] || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'Structure': |
|
|
|
|
|
|
|
if (showOne2 && showOne3) { |
|
|
|
tableData += `<th rowspan=${x.rowspan}>${x['name'] || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'factor': |
|
|
|
|
|
|
|
if (showOne3) { |
|
|
|
tableData += `<th rowspan=${f.rowspan}>${(f['name']+'('+f.rowspan+'/'+f.devicesLength+')') || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'SourceName': |
|
|
|
tableData += `<td>${a[t.k] || ''}</td>` |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
//取设备里面告警最新的一条数据
|
|
|
|
if (c.alarmDatas.length > 1) { |
|
|
|
c.alarmDatas.sort((a, b) => new Date(b.StartTime) - new Date(a.StartTime)) |
|
|
|
} |
|
|
|
let alarmNewest = c.alarmDatas[0] || {} |
|
|
|
let tableData = '<tr>' |
|
|
|
for (let t of alarmTitleArr) { |
|
|
|
if (t.f) { |
|
|
|
tableData += `<td>${t.f(alarmNewest) || ''}</td>` |
|
|
|
} else if (t.k) { |
|
|
|
switch (t.k) { |
|
|
|
case 'name': |
|
|
|
if (showOne1 && showOne2 && showOne3) { |
|
|
|
tableData += `<th rowspan=${h.rowspan}>${h[t.k] || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'Structure': |
|
|
|
if (showOne2 && showOne3) { |
|
|
|
tableData += `<th rowspan=${x.rowspan}>${x['name'] || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'factor': |
|
|
|
if (showOne3) { |
|
|
|
tableData += `<th rowspan=${f.rowspan}>${(f['name'] + '(' + f.rowspan + '/' + f.devicesLength + ')') || ''}</th>` |
|
|
|
} |
|
|
|
break; |
|
|
|
case 'SourceName': |
|
|
|
tableData += `<td>${alarmNewest[t.k] || ''}</td>` |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
tableData += '</tr>' |
|
|
|
alarmContent += tableData |
|
|
|
if (a[keyOfStartTime] && moment(a[keyOfStartTime]).isBetween(newAddStartTime, newAddEndTime)) { |
|
|
|
newAddCount++ |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
tableData += '</tr>' |
|
|
|
alarmContent += tableData |
|
|
|
if (alarmNewest[keyOfStartTime] && moment(alarmNewest[keyOfStartTime]).isBetween(newAddStartTime, newAddEndTime)) { |
|
|
|
newAddCount++ |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@ -1382,7 +1380,7 @@ module.exports = function (app, opts) { |
|
|
|
} |
|
|
|
if (proDebug) { |
|
|
|
console.log(`相关设备及测点信息:`); |
|
|
|
console.log(deviceSensorRes); |
|
|
|
// console.log(deviceSensorRes);
|
|
|
|
} |
|
|
|
let alarmTitle = dataAlarmTitle.concat( |
|
|
|
videoAlarmTitle.slice(2).map(v => { |
|
|
|