diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 6d8e84e..e366792 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -1,7 +1,7 @@ const moment = require('moment') -let isDev = false -// let isDev = true +// let isDev = false +let isDev = true let proDebug = false proDebug = true @@ -9,8 +9,8 @@ proDebug = true module.exports = function (app, opts) { const alarmsPush = app.fs.scheduleInit( { - interval: '12 */1 * * * *', - // interval: '12 0 0 0 */1 *', + // interval: '12 */1 * * * *', + interval: '12 0 0 0 */1 *', immediate: isDev, proRun: !isDev, }, @@ -102,7 +102,7 @@ module.exports = function (app, opts) { const corPomsProject = pomsProjectRes.filter(poms => pomsProjectId.includes(poms.id)) let curAnxinProjectId = new Set() let pepProjectName_ = [] - let pepProject_name = [] + let pepProject_name = [] //当前有关联的项目,后面往对应项目里面插入对应的结构物-监测因素-告警源 for (let { dataValues: poms } of corPomsProject) { if (poms.pepProjectId) { // 找对应的项企项目 @@ -1134,7 +1134,7 @@ module.exports = function (app, opts) { } }) - + let projectList = [] for (let key in strucMap) { if (strucMap[key].factor.length > 0) { @@ -1163,6 +1163,7 @@ module.exports = function (app, opts) { x.factor.forEach(f => { let rowspan3 = 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 => { @@ -1195,6 +1196,7 @@ module.exports = function (app, opts) { h.rowspan = rowspan1 }) console.log('数据组合', JSON.stringify(pepProject_name)); + // dataAlarmG1 = pepProject_name } @@ -1205,8 +1207,6 @@ module.exports = function (app, opts) { if (!alarmData.length) { return '' } - strucMap = { ...strucMap } - pepProject_name = [...pepProject_name] ifEmailSend = true let tableTitlePrefix = titlePrefix + '告警源' let newAddCount = 0 @@ -1214,47 +1214,20 @@ module.exports = function (app, opts) { let alarmContent = '' let alarmHtmlTitle = packageTableTitle(alarmTitleArr) - // // if (type == 1) { - // let projectData = [] - // //按项目分类 - // pepProject_name.map(c => { - - // let OneProjectdata = [] - - // alarmData.map(a => { - // let OneStructure = (strucMap[a.StructureId] || {}).pepProject || [] - // if (OneStructure.includes(c.id)) { - // OneProjectdata.push({ - // ...a, - // pepProjectId: c.id, - // pepProjectName: c.name - // }) - // } - // }) - - // if (OneProjectdata.length) { - // projectData.push(OneProjectdata) - // } - // }) - - // let projectType = [] - // projectData.map(p => { - - // }) - // // } if (type == 1) { + alarmData.map((h, hi) => { - + if (h.projects && h.projects.length) { h.projects.map((x, xi) => { - + let showOne1 = (xi == 0) ? true : false if (x.factor && x.factor.length) { x.factor.map((f, fi) => { - + let showOne2 = (fi == 0) ? true : false if (f.devices && f.devices.length) { f.devices.map((c, ci) => { @@ -1262,8 +1235,8 @@ module.exports = function (app, opts) { if (c.alarmDatas && c.alarmDatas.length) { c.alarmDatas.map(a => { - - + + let tableData = '