diff --git a/api/app/lib/controllers/control/toolLink.js b/api/app/lib/controllers/control/toolLink.js index 62d5264..4d827dc 100644 --- a/api/app/lib/controllers/control/toolLink.js +++ b/api/app/lib/controllers/control/toolLink.js @@ -126,7 +126,7 @@ async function count (ctx) { if (anxinStruc.length) { const anxinStrucIds = anxinStruc.map(a => a.strucId) || [] - + let dataFront = new moment(); //验证前时间 //剩余数据,设备告警 const dataAlarm = await clickHouse.dataAlarm.query(` SELECT @@ -226,6 +226,12 @@ async function count (ctx) { }] } + let dataAfter = new moment(); //验证后时间 + let dataduration = moment.duration(dataAfter.diff(dataFront))._data.milliseconds + console.log('数据',dataduration); + + let yingyongFront = new moment(); //验证前时间 + //应用总告警 let listRes = await models.AppAlarm.findAndCountAll(findOption) @@ -242,6 +248,12 @@ async function count (ctx) { if (p.dataValues.confirmTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.dataValues.confirmTime) && moment(p.dataValues.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) appConfirme++ } + let yingyongAfter = new moment(); //验证后时间 + let yingyongduration = moment.duration(yingyongAfter.diff(yingyongFront))._data.milliseconds + console.log('应用',yingyongduration); + + let videoFront = new moment(); //验证前时间 + const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( ` SELECT @@ -338,11 +350,22 @@ async function count (ctx) { } //剩余视频告警 - const videoSurplus = returnD.filter(r => !r.confirmTime).length || 0 + let videoSurplus = 0 //今日新增视频告警 - const videoNewAdd = returnD.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.createTime) && moment(r.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))).length || 0 + let videoNewAdd = 0 //今日确认视频告警 - const videoConfirme = returnD.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.confirmTime) && moment(r.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))).length || 0 + let videoConfirme = 0 + + for (let p of returnD) { + if (!p.confirmTime) videoSurplus++ + if (p.createTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.createTime) && moment(p.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) videoNewAdd++ + if (p.confirmTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.confirmTime) && moment(p.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) videoConfirme++ + } + + let videoAfter = new moment(); //验证后时间 + let videoduration = moment.duration(videoAfter.diff(videoFront))._data.milliseconds + console.log('视频',videoduration); + let findOptions = { where: { @@ -380,6 +403,7 @@ async function count (ctx) { p.dataValues.pepProjectIsDelete = corPro.isdelete } + ctx.status = 200; ctx.body = { diff --git a/web/client/src/sections/control/containers/control.jsx b/web/client/src/sections/control/containers/control.jsx index 2e6e08f..9d17166 100644 --- a/web/client/src/sections/control/containers/control.jsx +++ b/web/client/src/sections/control/containers/control.jsx @@ -110,9 +110,9 @@ const Control = (props) => { async function concentration1 () { if (pepProjectId) setProjectId(pepProjectId) // 工作台数据请求 - // await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setWorkData(res.payload.data) - // }) + await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setWorkData(res.payload.data) + }) // 查询BI分析数据-数据 await dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { if (res.success) setDataBI(res.payload.data)