Browse Source

problem 告警设备数

dev
wenlele 2 years ago
parent
commit
70b91cfc2b
  1. 6
      api/app/lib/schedule/alarms_push.js

6
api/app/lib/schedule/alarms_push.js

@ -1167,13 +1167,14 @@ module.exports = function (app, opts) {
if (x.factor.length) {
x.factor.forEach(f => {
let rowspan3 = 0
let problem = 0
if (f.devices.length) {
f.devicesLength = f.devices.length
f.devices = f.devices.filter(b => b.alarmDatas && b.alarmDatas.length > 0)
if (f.devices.length) {
f.devices.forEach(c => {
if (c.alarmDatas.length) {
rowspan3 += 1
problem += 1
let grouped = c.alarmDatas.reduce((acc, cur) => {
if (!acc[cur.AlarmCode]) {
acc[cur.AlarmCode] = []
@ -1185,6 +1186,7 @@ module.exports = function (app, opts) {
for (let key in grouped) {
rowspan1 += 1
rowspan2 += 1
rowspan3 += 1
grouped[key].sort((a, b) => new Date(b.StartTime) - new Date(a.StartTime))
alarmData.push(grouped[key][0])
}
@ -1273,7 +1275,7 @@ module.exports = function (app, opts) {
break;
case 'factor':
if (showOne3 && showOne4) {
tableData += `<th rowspan=${f.rowspan}>${(f['name'] + '(' + f.rowspan + '/' + f.devicesLength + ')') || ''}</th>`
tableData += `<th rowspan=${f.rowspan}>${(f['name'] + '(' + f.problem + '/' + f.devicesLength + ')') || ''}</th>`
}
break;
case 'SourceName':

Loading…
Cancel
Save