Browse Source

工作台接口打开

dev
wenlele 2 years ago
parent
commit
fd63414de2
  1. 32
      api/app/lib/controllers/control/toolLink.js
  2. 6
      web/client/src/sections/control/containers/control.jsx

32
api/app/lib/controllers/control/toolLink.js

@ -126,7 +126,7 @@ async function count (ctx) {
if (anxinStruc.length) { if (anxinStruc.length) {
const anxinStrucIds = anxinStruc.map(a => a.strucId) || [] const anxinStrucIds = anxinStruc.map(a => a.strucId) || []
let dataFront = new moment(); //验证前时间
//剩余数据,设备告警 //剩余数据,设备告警
const dataAlarm = await clickHouse.dataAlarm.query(` const dataAlarm = await clickHouse.dataAlarm.query(`
SELECT 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) 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++ 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( const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query(
` `
SELECT 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 = { let findOptions = {
where: { where: {
@ -381,6 +404,7 @@ async function count (ctx) {
} }
ctx.status = 200; ctx.status = 200;
ctx.body = { ctx.body = {

6
web/client/src/sections/control/containers/control.jsx

@ -110,9 +110,9 @@ const Control = (props) => {
async function concentration1 () { async function concentration1 () {
if (pepProjectId) setProjectId(pepProjectId) if (pepProjectId) setProjectId(pepProjectId)
// //
// await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => {
// if (res.success) setWorkData(res.payload.data) if (res.success) setWorkData(res.payload.data)
// }) })
// BI- // BI-
await dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { await dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => {
if (res.success) setDataBI(res.payload.data) if (res.success) setDataBI(res.payload.data)

Loading…
Cancel
Save