Browse Source

"@douyinfe/semi-ui": "2.8.0"

dev
巴林闲侠 2 years ago
parent
commit
0ab20952e4
  1. 4
      api/app/lib/controllers/alarm/data.js
  2. 20
      api/app/lib/utils/dataRange.js
  3. 4
      web/package.json

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

@ -68,7 +68,7 @@ async function list (ctx) {
) )
`) `)
} }
const alarmRes = await clickHouse.dataAlarm.query(` const alarmRes = await clickHouse.dataAlarm.query(`
SELECT SELECT
alarms.AlarmId AS AlarmId, alarms.AlarmId AS AlarmId,
@ -103,7 +103,7 @@ async function list (ctx) {
// ) // )
// State = 3 是 自动恢复 / 4 是 人工恢复 / 其他数字 是 需要恢复 // State = 3 是 自动恢复 / 4 是 人工恢复 / 其他数字 是 需要恢复
const SourceType = { 0: 'DTU', 1: '传感器', 2: '测点' };
ctx.status = 200; ctx.status = 200;
ctx.body = alarmRes ctx.body = alarmRes

20
api/app/lib/utils/dataRange.js

@ -18,8 +18,10 @@ module.exports = function (app, opts) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { userInfo = {} } = ctx.fs.api || {}; const { userInfo = {} } = ctx.fs.api || {};
const { clickHouse } = ctx.app.fs
const { correlationProject = [] } = userInfo const { correlationProject = [] } = userInfo
// TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内 // TODO 这儿也许需要判断传进来的 pepProjectId 在不在当前用户的关注范围内
const bindRes = await models.ProjectCorrelation.findAll({ const bindRes = await models.ProjectCorrelation.findAll({
where: { where: {
@ -27,7 +29,8 @@ module.exports = function (app, opts) {
del: false del: false
} }
}) })
return [
const anxinStrucIds = [
...bindRes.reduce( ...bindRes.reduce(
(arr, b) => { (arr, b) => {
for (let sid of b.anxinProjectId) { for (let sid of b.anxinProjectId) {
@ -38,6 +41,21 @@ module.exports = function (app, opts) {
new Set() 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) { } catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
} }

4
web/package.json

@ -47,8 +47,8 @@
"vite": "^2.9.5" "vite": "^2.9.5"
}, },
"dependencies": { "dependencies": {
"@douyinfe/semi-ui": "^2.8.0", "@douyinfe/semi-ui": "2.8.0",
"@douyinfe/semi-webpack-plugin": "^2.13.0", "@douyinfe/semi-webpack-plugin": "2.13.0",
"@micro-zoe/micro-app": "^1.0.0-alpha.1", "@micro-zoe/micro-app": "^1.0.0-alpha.1",
"@peace/utils": "^0.0.64", "@peace/utils": "^0.0.64",
"@semi-bot/semi-theme-fscamera": "^1.0.0", "@semi-bot/semi-theme-fscamera": "^1.0.0",

Loading…
Cancel
Save