diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 7d1b960..09044c7 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -68,7 +68,7 @@ async function list (ctx) { ) `) } - + const alarmRes = await clickHouse.dataAlarm.query(` SELECT alarms.AlarmId AS AlarmId, @@ -103,7 +103,7 @@ async function list (ctx) { // ) // State = 3 是 自动恢复 / 4 是 人工恢复 / 其他数字 是 需要恢复 - + const SourceType = { 0: 'DTU', 1: '传感器', 2: '测点' }; ctx.status = 200; ctx.body = alarmRes diff --git a/api/app/lib/utils/dataRange.js b/api/app/lib/utils/dataRange.js index 7a605d2..1b31857 100644 --- a/api/app/lib/utils/dataRange.js +++ b/api/app/lib/utils/dataRange.js @@ -18,8 +18,10 @@ module.exports = function (app, opts) { try { const { models } = ctx.fs.dc; const { userInfo = {} } = ctx.fs.api || {}; + const { clickHouse } = ctx.app.fs const { correlationProject = [] } = userInfo + // TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内 const bindRes = await models.ProjectCorrelation.findAll({ where: { @@ -27,7 +29,8 @@ module.exports = function (app, opts) { del: false } }) - return [ + + const anxinStrucIds = [ ...bindRes.reduce( (arr, b) => { for (let sid of b.anxinProjectId) { @@ -38,6 +41,21 @@ module.exports = function (app, opts) { new Set() ) ] + + const undelStrucRes = anxinStrucIds.length ? + await clickHouse.anxinyun.query(` + SELECT + id + FROM + t_project + WHERE + project_state = 4 + AND + id IN (${anxinStrucIds.join(',')}) + `).toPromise() : + [] + + return undelStrucRes.map(s => s.id) } catch (error) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); } diff --git a/web/package.json b/web/package.json index cf926c8..874d87f 100644 --- a/web/package.json +++ b/web/package.json @@ -47,8 +47,8 @@ "vite": "^2.9.5" }, "dependencies": { - "@douyinfe/semi-ui": "^2.8.0", - "@douyinfe/semi-webpack-plugin": "^2.13.0", + "@douyinfe/semi-ui": "2.8.0", + "@douyinfe/semi-webpack-plugin": "2.13.0", "@micro-zoe/micro-app": "^1.0.0-alpha.1", "@peace/utils": "^0.0.64", "@semi-bot/semi-theme-fscamera": "^1.0.0",