Browse Source

告警->状态筛选

dev
巴林闲侠 2 years ago
parent
commit
b497772eb9
  1. 10
      api/app/lib/controllers/alarm/data.js

10
api/app/lib/controllers/alarm/data.js

@ -34,7 +34,7 @@ async function list (ctx) {
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs
const { database: anxinyun } = clickHouse.anxinyun.opts.config 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({ let anxinStruc = await anxinStrucIdRange({
ctx, pepProjectId, keywordTarget, keyword ctx, pepProjectId, keywordTarget, keyword
@ -72,6 +72,13 @@ async function list (ctx) {
if (keywordTarget == 'source' && keyword) { if (keywordTarget == 'source' && keyword) {
whereOption.push(`SourceName LIKE '%${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(` const alarmRes = await clickHouse.dataAlarm.query(`
SELECT SELECT
@ -133,7 +140,6 @@ async function list (ctx) {
alarmRes.forEach(ar => { alarmRes.forEach(ar => {
ar.pepProject = (anxinStruc.find(as => as.strucId == ar.StructureId) || ar.pepProject = (anxinStruc.find(as => as.strucId == ar.StructureId) ||
{ {
pepProject: [ pepProject: [
// TODO: 开发临时添加 // TODO: 开发临时添加
{ {

Loading…
Cancel
Save