From b497772eb905e93ca240b0cfbcc51cf8a7a84b51 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 26 Sep 2022 10:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6->=E7=8A=B6=E6=80=81=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/data.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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: 开发临时添加 {