diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index b3196e1..813ac59 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -34,7 +34,7 @@ async function list (ctx) { const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs const { database: anxinyun } = clickHouse.anxinyun.opts.config - const { pepProjectId, keywordTarget, keyword, groupId, groupUnitId, sustainTimeStart, sustainTimeEnd, limit, page, } = ctx.query + const { pepProjectId, keywordTarget, keyword, groupId, groupUnitId, sustainTimeStart, sustainTimeEnd, limit, page, state } = ctx.query let anxinStruc = await anxinStrucIdRange({ ctx, pepProjectId, keywordTarget, keyword @@ -72,6 +72,13 @@ async function list (ctx) { if (keywordTarget == 'source' && keyword) { whereOption.push(`SourceName LIKE '%${keyword}%'`) } + if (state) { + if (state == 'new') { + whereOption.push(`alarms.State < 3`) + } else if (state == 'histroy') { + whereOption.push(`alarms.State >= 3`) + } + } const alarmRes = await clickHouse.dataAlarm.query(` SELECT @@ -133,7 +140,6 @@ async function list (ctx) { alarmRes.forEach(ar => { ar.pepProject = (anxinStruc.find(as => as.strucId == ar.StructureId) || { - pepProject: [ // TODO: 开发临时添加 {