巴林闲侠
2 years ago
37 changed files with 1380 additions and 329 deletions
@ -1,115 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
async function list (ctx) { |
|
||||
try { |
|
||||
const { models } = ctx.fs.dc; |
|
||||
const { userId, pepUserId } = ctx.fs.api |
|
||||
const linkListRes = await models.QuickLink.findAll({ |
|
||||
attributes: { exclude: ['userId'] }, |
|
||||
where: { |
|
||||
userId, |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
ctx.status = 200; |
|
||||
ctx.body = linkListRes |
|
||||
} catch (error) { |
|
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
||||
ctx.status = 400; |
|
||||
ctx.body = { |
|
||||
message: typeof error == 'string' ? error : undefined |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
async function edit (ctx) { |
|
||||
try { |
|
||||
const { models } = ctx.fs.dc; |
|
||||
const { userId, pepUserId } = ctx.fs.api |
|
||||
const { linkId, name, link } = ctx.request.body |
|
||||
|
|
||||
if (!name || !link) { |
|
||||
throw '请将参数填写完整' |
|
||||
} |
|
||||
|
|
||||
let findOption = { |
|
||||
where: { |
|
||||
userId: userId, |
|
||||
$or: [{ |
|
||||
name, |
|
||||
}, { |
|
||||
link, |
|
||||
}] |
|
||||
} |
|
||||
} |
|
||||
if (linkId) { |
|
||||
findOption.where.id = { $ne: linkId } |
|
||||
} |
|
||||
const existRes = await models.QuickLink.findOne({ |
|
||||
where: { |
|
||||
userId: userId, |
|
||||
$or: [{ |
|
||||
name, |
|
||||
}, { |
|
||||
link, |
|
||||
}] |
|
||||
} |
|
||||
}) |
|
||||
if (existRes) { |
|
||||
throw '已有相同名称/地址的工具' |
|
||||
} |
|
||||
if (linkId) { |
|
||||
await models.QuickLink.update({ |
|
||||
name, |
|
||||
link, |
|
||||
}, { |
|
||||
where: { |
|
||||
id: linkId |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
} else { |
|
||||
await models.QuickLink.create({ |
|
||||
userId, |
|
||||
name, |
|
||||
link, |
|
||||
}) |
|
||||
|
|
||||
} |
|
||||
|
|
||||
ctx.status = 204; |
|
||||
} catch (error) { |
|
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
||||
ctx.status = 400; |
|
||||
ctx.body = { |
|
||||
message: typeof error == 'string' ? error : undefined |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
async function del (ctx) { |
|
||||
try { |
|
||||
const { models } = ctx.fs.dc; |
|
||||
const { userId, pepUserId } = ctx.fs.api |
|
||||
const { linkId } = ctx.params |
|
||||
|
|
||||
await models.QuickLink.destroy({ |
|
||||
where: { |
|
||||
id: linkId, |
|
||||
userId, |
|
||||
} |
|
||||
}) |
|
||||
|
|
||||
ctx.status = 204; |
|
||||
} catch (error) { |
|
||||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
||||
ctx.status = 400; |
|
||||
ctx.body = { |
|
||||
message: typeof error == 'string' ? error : undefined |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
module.exports = { |
|
||||
list, edit, del, |
|
||||
}; |
|
@ -0,0 +1,90 @@ |
|||||
|
'use strict'; |
||||
|
const moment = require('moment'); |
||||
|
|
||||
|
async function dataList (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { userId, pepUserId, userInfo = {}, pepUserInfo } = ctx.fs.api |
||||
|
const { clickHouse } = ctx.app.fs |
||||
|
const { utils: { judgeSuper, anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs |
||||
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
||||
|
const { pepProjectId } = ctx.request.query |
||||
|
|
||||
|
|
||||
|
let anxinStruc = await anxinStrucIdRange({ |
||||
|
ctx, pepProjectId |
||||
|
}) |
||||
|
let pomsProject = await pomsProjectRange({ |
||||
|
ctx, pepProjectId, |
||||
|
}) |
||||
|
const pomsProjectIds = pomsProject.map(p => p.id) |
||||
|
|
||||
|
if (anxinStruc.length) { |
||||
|
|
||||
|
const anxinStrucIds = anxinStruc.map(a => a.strucId) || [] |
||||
|
|
||||
|
const dataAlarm = await clickHouse.dataAlarm.query(` |
||||
|
SELECT |
||||
|
formatDateTime(alarmData.StartTime,'%F %H') hours, count(AlarmId) count |
||||
|
FROM |
||||
|
( SELECT |
||||
|
AlarmId,State,StartTime |
||||
|
FROM |
||||
|
alarms |
||||
|
WHERE |
||||
|
alarms.StructureId IN (${anxinStrucIds.join(",")}) |
||||
|
AND |
||||
|
AlarmGroup = 3) AS alarmData |
||||
|
GROUP BY hours |
||||
|
`).toPromise();
|
||||
|
|
||||
|
// const confirmedAlarm = dataAlarm
|
||||
|
// // TODO: 开发临时注释
|
||||
|
// .filter(ar => ar.State && ar.State > 2)
|
||||
|
// .map(ar => "'" + ar.AlarmId + "'")
|
||||
|
|
||||
|
// // formatDateTime(Time,'%F %H') hours, count(AlarmId) count
|
||||
|
|
||||
|
// const dataConfirme = confirmedAlarm.length ?
|
||||
|
// await clickHouse.dataAlarm.query(`
|
||||
|
// SELECT
|
||||
|
// max(Time) AS Time, AlarmId
|
||||
|
// FROM
|
||||
|
// alarm_details
|
||||
|
// WHERE
|
||||
|
// AlarmId IN (${confirmedAlarm.join(',')})
|
||||
|
// GROUP BY AlarmId
|
||||
|
// `).toPromise() :
|
||||
|
// [];
|
||||
|
|
||||
|
|
||||
|
// dataAlarm.forEach(ar => {
|
||||
|
// ar.confirme =
|
||||
|
// dataConfirme.find(as => as.AlarmId == ar.AlarmId) || {}
|
||||
|
|
||||
|
// })
|
||||
|
ctx.status = 200 |
||||
|
ctx.body = dataAlarm |
||||
|
} else { |
||||
|
ctx.status = 200 |
||||
|
ctx.body = { |
||||
|
dataAlarm: 0, |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
module.exports = { |
||||
|
dataList, |
||||
|
}; |
@ -0,0 +1,195 @@ |
|||||
|
'use strict'; |
||||
|
const moment = require('moment'); |
||||
|
const { alarmList } = require('../alarm/video'); |
||||
|
//工作台
|
||||
|
async function getWorkbench(ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { clickHouse } = ctx.app.fs |
||||
|
const { alarmId, limit, page } = ctx.query |
||||
|
ctx.status = 200; |
||||
|
ctx.body = [] |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//项目概览
|
||||
|
async function getProjectsInfo(ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { clickHouse, utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs |
||||
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
||||
|
const { alarmId, limit, page, projectCorrelationId, pepProjectId, keywordTarget, keyword } = ctx.query; |
||||
|
const { userInfo } = ctx.fs.api; |
||||
|
// let where = {}
|
||||
|
// if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) {
|
||||
|
// where.projectCorrelationId = { $in: userInfo.correlationProject }
|
||||
|
// }
|
||||
|
// if (projectCorrelationId) {//查指定项目,控制台全局切换
|
||||
|
// where.projectCorrelationId = projectCorrelationId
|
||||
|
// }
|
||||
|
let anxinStruc = await anxinStrucIdRange({ |
||||
|
ctx, pepProjectId, keywordTarget, keyword |
||||
|
}) |
||||
|
const anxinStrucIds = anxinStruc.map(a => a.strucId); |
||||
|
//先查全部的摄像头
|
||||
|
const videoList = anxinStrucIds.length ? await clickHouse.vcmp.query( |
||||
|
`select camera.id,
|
||||
|
camera.name, |
||||
|
camera.serial_no from camera where camera.delete=false and camera.recycle_time is null |
||||
|
|
||||
|
LEFT JOIN ${anxinyun}.t_video_ipc AS anxinIpc |
||||
|
ON toString(anxinIpc.channel_no) = cameraAlarm.cameraChannelNo |
||||
|
AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo |
||||
|
LEFT JOIN ${anxinyun}.t_structure AS anxinStruc |
||||
|
ON anxinStruc.id = anxinIpc.structure |
||||
|
AND anxinStruc.id IN (${anxinStrucIds.join(',')}) |
||||
|
LEFT JOIN ${anxinyun}.t_video_ipc_station AS anxinIpcStation |
||||
|
ON anxinIpcStation.ipc = anxinIpc.id |
||||
|
LEFT JOIN ${anxinyun}.t_sensor AS anxinStation |
||||
|
ON anxinStation.id = anxinIpcStation.station` |
||||
|
).toPromise() : [] |
||||
|
|
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = [] |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//BI分析
|
||||
|
async function getVideoAlarmsAggDay(ctx) { |
||||
|
try { |
||||
|
let videoAlarms = await alarmList(ctx, 'day'); |
||||
|
let aggDayMap = []; |
||||
|
for (let a of videoAlarms) { |
||||
|
let exist = aggDayMap.find(ad => ad.day == moment(a.createTime).format('YYYY-MM-DD')); |
||||
|
if (exist) { |
||||
|
exist.total++;//总数
|
||||
|
if (a.confirmTime || a.autoRestore) { |
||||
|
exist.done++;//已恢复
|
||||
|
} |
||||
|
} else { |
||||
|
aggDayMap.push({ day: moment(a.createTime).format('YYYY-MM-DD'), total: 1, done: a.confirmTime || a.autoRestore ? 1 : 0 }); |
||||
|
} |
||||
|
} |
||||
|
ctx.status = 200; |
||||
|
ctx.body = aggDayMap; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//最新动态
|
||||
|
async function getLatestDynamic(ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { limit, page, projectCorrelationId, types } = ctx.query; |
||||
|
const { userInfo } = ctx.fs.api; |
||||
|
const { clickHouse } = ctx.app.fs; |
||||
|
|
||||
|
let where = { type: { $in: types.split(',') } }//传类型选择
|
||||
|
if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) { |
||||
|
where.projectCorrelationId = { $in: userInfo.correlationProject } |
||||
|
} |
||||
|
if (projectCorrelationId) {//查指定项目,控制台全局切换
|
||||
|
where.projectCorrelationId = projectCorrelationId |
||||
|
} |
||||
|
let news = await models.LatestDynamicList.findAll({//最新动态
|
||||
|
include: [{ |
||||
|
model: models.ProjectCorrelation, |
||||
|
where: { del: false }, |
||||
|
attributes: ['id', 'name', 'pepProjectId'], |
||||
|
}, { |
||||
|
model: models.AlarmAppearRecord |
||||
|
}, { |
||||
|
model: models.EmailSendLog |
||||
|
}, { |
||||
|
model: models.AlarmConfirmLog |
||||
|
}], |
||||
|
where: where, |
||||
|
offset: Number(page) * Number(limit), |
||||
|
limit: Number(limit), |
||||
|
order: [['time', 'desc']], |
||||
|
}); |
||||
|
|
||||
|
//查项目名称 查用户名
|
||||
|
let pepPojectIds = new Set(), notedUserIds = new Set(); |
||||
|
for (let p of news) { |
||||
|
pepPojectIds.add(p.projectCorrelation.pepProjectId); |
||||
|
|
||||
|
if (p.emailSendLog) { |
||||
|
notedUserIds.add(p.emailSendLog.toPepUserId);//通知 接收人
|
||||
|
} |
||||
|
if (p.alarmConfirmLog && p.alarmConfirmLog.pepUserId) { |
||||
|
notedUserIds.add(p.alarmConfirmLog.pepUserId);//确认 操作者
|
||||
|
} |
||||
|
} |
||||
|
let pepProjects = pepPojectIds.size ? await clickHouse.projectManage.query(` |
||||
|
SELECT id, project_name FROM t_pim_project WHERE id IN (${[...pepPojectIds]}) |
||||
|
`).toPromise() : [];
|
||||
|
|
||||
|
let userPepRes = notedUserIds.size ? await clickHouse.pepEmis.query( |
||||
|
`SELECT DISTINCT user.id AS id, "user"."name" AS name FROM user WHERE user.id IN (${[...notedUserIds].join(',')})
|
||||
|
`).toPromise() : []
|
||||
|
|
||||
|
|
||||
|
let appear = [], notice = [], confirm = []; |
||||
|
news.map(d => { |
||||
|
let projectName = d.projectCorrelation.name || pepProjects.find(pp => pp.id == d.projectCorrelation.pepProjectId).project_name; |
||||
|
if (d.alarmAppearId) { |
||||
|
appear.push({ |
||||
|
projectName, |
||||
|
...d.alarmAppearRecord |
||||
|
}); |
||||
|
} |
||||
|
if (d.emailSendId) { |
||||
|
notice.push({ |
||||
|
userName: userPepRes.find(u => u.id == d.emailSendLog.toPepUserId).name, |
||||
|
projectName, |
||||
|
...d.emailSendLog |
||||
|
}); |
||||
|
} |
||||
|
if (d.alarmConfirmId) { |
||||
|
confirm.push({ |
||||
|
userName: d.alarmConfirmLog.pepUserId ? userPepRes.find(u => u.id == d.alarmConfirmLog.pepUserId).name : '自动恢复', |
||||
|
projectName, |
||||
|
...d.alarmConfirmLog.dataValues |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
ctx.status = 200; |
||||
|
ctx.body = { |
||||
|
appear,//发现
|
||||
|
notice,//通知
|
||||
|
confirm//确认
|
||||
|
}; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
getWorkbench, |
||||
|
getProjectsInfo, |
||||
|
getVideoAlarmsAggDay, |
||||
|
getLatestDynamic |
||||
|
}; |
@ -0,0 +1,367 @@ |
|||||
|
'use strict'; |
||||
|
const moment = require('moment'); |
||||
|
|
||||
|
async function list (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { userId, pepUserId } = ctx.fs.api |
||||
|
const linkListRes = await models.QuickLink.findAll({ |
||||
|
attributes: { exclude: ['userId'] }, |
||||
|
where: { |
||||
|
userId, |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = linkListRes |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function edit (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { userId, pepUserId } = ctx.fs.api |
||||
|
const { linkId, name, link } = ctx.request.body |
||||
|
|
||||
|
if (!name || !link) { |
||||
|
throw '请将参数填写完整' |
||||
|
} |
||||
|
|
||||
|
let findOption = { |
||||
|
where: { |
||||
|
userId: userId, |
||||
|
$or: [{ |
||||
|
name, |
||||
|
}, { |
||||
|
link, |
||||
|
}] |
||||
|
} |
||||
|
} |
||||
|
if (linkId) { |
||||
|
findOption.where.id = { $ne: linkId } |
||||
|
} |
||||
|
const existRes = await models.QuickLink.findOne({ |
||||
|
where: { |
||||
|
userId: userId, |
||||
|
$or: [{ |
||||
|
name, |
||||
|
}, { |
||||
|
link, |
||||
|
}] |
||||
|
} |
||||
|
}) |
||||
|
if (existRes) { |
||||
|
throw '已有相同名称/地址的工具' |
||||
|
} |
||||
|
if (linkId) { |
||||
|
await models.QuickLink.update({ |
||||
|
name, |
||||
|
link, |
||||
|
}, { |
||||
|
where: { |
||||
|
id: linkId |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
} else { |
||||
|
await models.QuickLink.create({ |
||||
|
userId, |
||||
|
name, |
||||
|
link, |
||||
|
}) |
||||
|
|
||||
|
} |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
async function del (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { userId, pepUserId } = ctx.fs.api |
||||
|
const { linkId } = ctx.params |
||||
|
|
||||
|
await models.QuickLink.destroy({ |
||||
|
where: { |
||||
|
id: linkId, |
||||
|
userId, |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
async function count (ctx) { |
||||
|
try { |
||||
|
const { models } = ctx.fs.dc; |
||||
|
const { userId, pepUserId, userInfo = {}, pepUserInfo } = ctx.fs.api |
||||
|
const { clickHouse } = ctx.app.fs |
||||
|
const { utils: { judgeSuper, anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs |
||||
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
||||
|
const { pepProjectId } = ctx.request.query |
||||
|
|
||||
|
|
||||
|
let anxinStruc = await anxinStrucIdRange({ |
||||
|
ctx, pepProjectId |
||||
|
}) |
||||
|
let pomsProject = await pomsProjectRange({ |
||||
|
ctx, pepProjectId, |
||||
|
}) |
||||
|
const pomsProjectIds = pomsProject.map(p => p.id) |
||||
|
|
||||
|
if (anxinStruc.length) { |
||||
|
|
||||
|
const anxinStrucIds = anxinStruc.map(a => a.strucId) || [] |
||||
|
|
||||
|
const dataAlarm = await clickHouse.dataAlarm.query(` |
||||
|
SELECT |
||||
|
AlarmId,State,StartTime,AlarmGroup |
||||
|
FROM |
||||
|
alarms |
||||
|
WHERE |
||||
|
alarms.StructureId IN (${anxinStrucIds.join(",")}) |
||||
|
`).toPromise();
|
||||
|
|
||||
|
const confirmedAlarm = dataAlarm |
||||
|
// TODO: 开发临时注释
|
||||
|
.filter(ar => ar.State && ar.State > 2) |
||||
|
.map(ar => "'" + ar.AlarmId + "'") |
||||
|
|
||||
|
//剩余数据告警
|
||||
|
const dataSurplus = dataAlarm.filter(ar => ar.State && ar.State < 3 && ar.AlarmGroup < 4).length || 0 |
||||
|
//剩余设备告警
|
||||
|
const toolSurplus = dataAlarm.filter(ar => ar.State && ar.State < 3 && ar.AlarmGroup > 3).length || 0 |
||||
|
|
||||
|
//今日新增数据告警
|
||||
|
const dataNewAdd = dataAlarm.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.StartTime) && moment(r.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')) && r.AlarmGroup < 4).length || 0 |
||||
|
const toolNewAdd = dataAlarm.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.StartTime) && moment(r.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')) && r.AlarmGroup > 3).length || 0 |
||||
|
|
||||
|
//今日确认数据告警
|
||||
|
const dataConfirme = confirmedAlarm.length ? |
||||
|
await clickHouse.dataAlarm.query(` |
||||
|
SELECT |
||||
|
max(Time) AS Time, AlarmId , max(Content) AS Content, |
||||
|
alarms.AlarmGroup AS AlarmGroup |
||||
|
FROM |
||||
|
alarm_details |
||||
|
LEFT JOIN alarms |
||||
|
ON alarm_details.AlarmId=alarms.AlarmId |
||||
|
WHERE |
||||
|
AlarmId IN (${confirmedAlarm.join(',')}) |
||||
|
AND |
||||
|
alarm_details.Time >= '${moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')}' |
||||
|
AND |
||||
|
alarm_details.Time <= '${moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')}' |
||||
|
GROUP BY AlarmId,AlarmGroup |
||||
|
`).toPromise() :
|
||||
|
[]; |
||||
|
|
||||
|
|
||||
|
let findOption = { |
||||
|
where: { |
||||
|
'$app->projectCorrelations.id$': { |
||||
|
$in: pomsProjectIds |
||||
|
} |
||||
|
}, |
||||
|
attributes: ['createTime', 'confirmTime'], |
||||
|
include: [{ |
||||
|
model: models.App, |
||||
|
where: { |
||||
|
|
||||
|
}, |
||||
|
attributes: ['id', 'name'], |
||||
|
include: [{ |
||||
|
model: models.ProjectCorrelation, |
||||
|
where: { |
||||
|
|
||||
|
}, |
||||
|
attributes: ['id'], |
||||
|
}] |
||||
|
}] |
||||
|
} |
||||
|
|
||||
|
//应用总告警
|
||||
|
const listRes = await models.AppAlarm.findAndCountAll(findOption) |
||||
|
//剩余应用告警
|
||||
|
const appSurplus = listRes.rows.filter(r => !r.confirmTime).length || 0 |
||||
|
//今日新增应用告警
|
||||
|
const appNewAdd = listRes.rows.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 |
||||
|
//今日确认应用告警
|
||||
|
const appConfirme = listRes.rows.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 |
||||
|
|
||||
|
const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( |
||||
|
` |
||||
|
SELECT |
||||
|
cameraAlarm.cameraId AS cameraId, |
||||
|
cameraAlarm.cameraName AS cameraName, |
||||
|
cameraAlarm.cameraSerialNo AS cameraSerialNo, |
||||
|
cameraAlarm.cameraChannelNo AS cameraChannelNo, |
||||
|
cameraAlarm.alarmId AS alarmId, |
||||
|
cameraAlarm.createTime AS createTime, |
||||
|
cameraAlarm.platform AS platform, |
||||
|
cameraAlarm.confirmTime AS confirmTime, |
||||
|
camera_status_resolve.id AS resolveId, |
||||
|
camera_status.describe AS statusDescribe, |
||||
|
camera_status_resolve.resolve AS resolve, |
||||
|
"gbCamera".online AS cameraOnline, |
||||
|
anxinIpc.t_video_ipc.name AS anxinIpcPosition, |
||||
|
anxinStation.id AS anxinStationId, |
||||
|
anxinStation.name AS anxinStationName, |
||||
|
anxinStruc.name AS strucName, |
||||
|
anxinStruc.id AS strucId |
||||
|
FROM |
||||
|
( |
||||
|
SELECT |
||||
|
camera.id AS cameraId, |
||||
|
camera.gb_id AS gbId, |
||||
|
camera.name AS cameraName, |
||||
|
camera_status_alarm.id AS alarmId, |
||||
|
camera_status_alarm.create_time AS createTime, |
||||
|
camera_status_alarm.platform AS platform, |
||||
|
camera_status_alarm.status_id AS statusId, |
||||
|
camera_status_alarm.serial_no AS cameraSerialNo, |
||||
|
camera_status_alarm.channel_no AS cameraChannelNo, |
||||
|
camera_status_alarm.confirm_time AS confirmTime |
||||
|
FROM camera_status_alarm |
||||
|
INNER JOIN camera |
||||
|
ON camera.serial_no = camera_status_alarm.serial_no |
||||
|
AND camera.channel_no = camera_status_alarm.channel_no |
||||
|
LEFT JOIN vender |
||||
|
ON vender.id = camera.vender_id |
||||
|
WHERE |
||||
|
camera.delete = false |
||||
|
AND camera.recycle_time is null |
||||
|
AND alarmId IN ( |
||||
|
SELECT camera_status_alarm.id AS alarmId |
||||
|
FROM camera_status_alarm |
||||
|
RIGHT JOIN ${anxinyun}.t_video_ipc |
||||
|
ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no |
||||
|
AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no |
||||
|
${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})` |
||||
|
} |
||||
|
) |
||||
|
) AS cameraAlarm |
||||
|
LEFT JOIN camera_status |
||||
|
ON cameraAlarm.platform = camera_status.platform |
||||
|
AND cameraAlarm.statusId = camera_status.id |
||||
|
LEFT JOIN camera_status_resolve |
||||
|
ON camera_status_resolve.status_id = camera_status.id |
||||
|
LEFT JOIN "gbCamera" |
||||
|
ON "gbCamera".id = cameraAlarm.gbId |
||||
|
LEFT JOIN ${anxinyun}.t_video_ipc AS anxinIpc |
||||
|
ON toString(anxinIpc.channel_no) = cameraAlarm.cameraChannelNo |
||||
|
AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo |
||||
|
LEFT JOIN ${anxinyun}.t_structure AS anxinStruc |
||||
|
ON anxinStruc.id = anxinIpc.structure |
||||
|
AND anxinStruc.id IN (${anxinStrucIds.join(',')}) |
||||
|
LEFT JOIN ${anxinyun}.t_video_ipc_station AS anxinIpcStation |
||||
|
ON anxinIpcStation.ipc = anxinIpc.id |
||||
|
LEFT JOIN ${anxinyun}.t_sensor AS anxinStation |
||||
|
ON anxinStation.id = anxinIpcStation.station |
||||
|
` |
||||
|
).toPromise() : [] |
||||
|
|
||||
|
let returnD = [] |
||||
|
let positionD = {} |
||||
|
// 每个设备一个告警
|
||||
|
for (let a of alarmRes) { |
||||
|
if (positionD[a.cameraId]) { |
||||
|
let curD = returnD[positionD[a.cameraId].positionReturnD] |
||||
|
|
||||
|
} else { |
||||
|
let d = { |
||||
|
cameraId: a.cameraId, |
||||
|
cameraName: a.cameraName, |
||||
|
createTime: a.createTime, |
||||
|
alarmId: a.alarmId, |
||||
|
confirmTime: a.confirmTime, |
||||
|
} |
||||
|
|
||||
|
returnD.push(d) |
||||
|
positionD[a.cameraId] = { |
||||
|
positionReturnD: returnD.length - 1 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//剩余视频告警
|
||||
|
const videoSurplus = returnD.filter(r => !r.confirmTime).length || 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 |
||||
|
//今日确认视频告警
|
||||
|
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 findOptions = { |
||||
|
where: { |
||||
|
del: false |
||||
|
}, |
||||
|
attributes: [] |
||||
|
} |
||||
|
if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) { |
||||
|
findOptions.where.id = { $in: userInfo.correlationProject } |
||||
|
} |
||||
|
const projects = await models.ProjectCorrelation.findAndCountAll(findOptions) |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = { |
||||
|
|
||||
|
dataSurplus: dataSurplus + videoSurplus, |
||||
|
dataNewAdd: dataNewAdd + videoNewAdd, |
||||
|
dataConfirme: appConfirme + dataConfirme.filter(r => r.AlarmGroup < 4).length, |
||||
|
|
||||
|
|
||||
|
toolSurplus: toolSurplus, |
||||
|
toolNewAdd: toolNewAdd, |
||||
|
toolConfirme: dataConfirme.filter(r => r.AlarmGroup > 3).length, |
||||
|
|
||||
|
|
||||
|
appSurplus: appSurplus, |
||||
|
appNewAdd: appNewAdd, |
||||
|
appConfirme: appConfirme, |
||||
|
|
||||
|
projects: projects.count, |
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
ctx.body = { |
||||
|
dataAlarm: 0, |
||||
|
} |
||||
|
} |
||||
|
ctx.status = 200; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
module.exports = { |
||||
|
list, edit, del, count |
||||
|
}; |
@ -0,0 +1,62 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const AlarmAppearRecord = sequelize.define("alarmAppearRecord", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "alarm_appear_record_id_uindex" |
||||
|
}, |
||||
|
projectCorrelationId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "project_correlation_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
alarmInfo: { |
||||
|
type: DataTypes.JSON, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "alarm_info", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
time: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "time", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
type: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: "数据告警:data,设备告警:device,应用告警:application", |
||||
|
primaryKey: false, |
||||
|
field: "type", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "alarm_appear_record", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.AlarmAppearRecord = AlarmAppearRecord; |
||||
|
return AlarmAppearRecord; |
||||
|
}; |
@ -0,0 +1,71 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const AlarmConfirmLog = sequelize.define("alarmConfirmLog", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "alarm_confirm_log_id_uindex" |
||||
|
}, |
||||
|
pepUserId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "pep_user_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
projectCorrelationId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "project_correlation_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
alarmInfo: { |
||||
|
type: DataTypes.JSON, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "alarm_info", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
confirmTime: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "confirm_time", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
confirmContent: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "confirm_content", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "alarm_confirm_log", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.AlarmConfirmLog = AlarmConfirmLog; |
||||
|
return AlarmConfirmLog; |
||||
|
}; |
@ -0,0 +1,62 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const EmailSendLog = sequelize.define("emailSendLog", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "email_send_log_id_uindex" |
||||
|
}, |
||||
|
projectCorrelationId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "project_correlation_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
toPepUserId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "to_pep_user_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
by: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "by", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
time: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "time", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "email_send_log", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.EmailSendLog = EmailSendLog; |
||||
|
return EmailSendLog; |
||||
|
}; |
@ -0,0 +1,80 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const LatestDynamicList = sequelize.define("latestDynamicList", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "latest_dynamic_list_id_uindex" |
||||
|
}, |
||||
|
time: { |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "time", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
alarmAppearId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "alarm_appear_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
emailSendId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "email_send_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
alarmConfirmId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "alarm_confirm_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
projectCorrelationId: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: false, |
||||
|
field: "project_correlation_id", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
type: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: '1:发现,2:通知,3:处置,4:确认', |
||||
|
primaryKey: false, |
||||
|
field: "type", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "latest_dynamic_list", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.LatestDynamicList = LatestDynamicList; |
||||
|
return LatestDynamicList; |
||||
|
}; |
@ -1,14 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
const toolLink = require('../../controllers/console/toolLink'); |
|
||||
|
|
||||
module.exports = function (app, router, opts) { |
|
||||
app.fs.api.logAttr['GET/console/toollink'] = { content: '获取常用工具', visible: true }; |
|
||||
router.get('/console/toollink', toolLink.list); |
|
||||
|
|
||||
app.fs.api.logAttr['PUT/console/toollink'] = { content: '编辑常用工具', visible: true }; |
|
||||
router.put('/console/toollink', toolLink.edit); |
|
||||
|
|
||||
app.fs.api.logAttr['DEL/console/toollink'] = { content: '删除常用工具', visible: true }; |
|
||||
router.del('/console/toollink/:linkId', toolLink.del); |
|
||||
}; |
|
@ -0,0 +1,36 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
const toolLink = require('../../controllers/control/toolLink'); |
||||
|
const analysis = require('../../controllers/control/analysis'); |
||||
|
const csData = require('../../controllers/control/data'); |
||||
|
|
||||
|
module.exports = function (app, router, opts) { |
||||
|
app.fs.api.logAttr['GET/console/toollink'] = { content: '获取常用工具', visible: true }; |
||||
|
router.get('/console/toollink', toolLink.list); |
||||
|
|
||||
|
app.fs.api.logAttr['PUT/console/toollink'] = { content: '编辑常用工具', visible: true }; |
||||
|
router.put('/console/toollink', toolLink.edit); |
||||
|
|
||||
|
app.fs.api.logAttr['DEL/console/toollink'] = { content: '删除常用工具', visible: true }; |
||||
|
router.del('/console/toollink/:linkId', toolLink.del); |
||||
|
|
||||
|
app.fs.api.logAttr['GET/console/count'] = { content: '查询告警数量', visible: true }; |
||||
|
router.get('/console/count', toolLink.count); |
||||
|
|
||||
|
app.fs.api.logAttr['GET/analysis/dataList'] = { content: '查询数据告警产生,确认数量', visible: true }; |
||||
|
router.get('/analysis/dataList', analysis.dataList); |
||||
|
|
||||
|
|
||||
|
|
||||
|
//项目概览
|
||||
|
app.fs.api.logAttr['GET/projects/info'] = { content: '查询项目概览', visible: false }; |
||||
|
router.get('/projects/info', csData.getProjectsInfo); |
||||
|
|
||||
|
//BI分析模块
|
||||
|
app.fs.api.logAttr['GET/video/alarms/agg/day'] = { content: '查询BI分析数据-视频异常', visible: false }; |
||||
|
router.get('/video/alarms/agg/day', csData.getVideoAlarmsAggDay); |
||||
|
|
||||
|
//最新动态
|
||||
|
app.fs.api.logAttr['GET/latest/dynamic'] = { content: '查询最新动态', visible: false }; |
||||
|
router.get('/latest/dynamic', csData.getLatestDynamic); |
||||
|
}; |
After Width: | Height: | Size: 868 KiB |
@ -1,36 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import { ApiTable ,basicAction} from '$utils' |
|
||||
|
|
||||
export function ConsoleToollink () { //获取常用工具
|
|
||||
return dispatch => basicAction({ |
|
||||
type: 'get', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'GET_CONSLE_TOOLLINK', |
|
||||
url: `${ApiTable.consoleToollink}`, |
|
||||
msg: { option: '获取常用工具' }, |
|
||||
reducer: { name: '' } |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
export function putConsoleToollink (data) { //编辑常用工具
|
|
||||
return dispatch => basicAction({ |
|
||||
type: 'put', |
|
||||
dispatch: dispatch, |
|
||||
data, |
|
||||
actionType: 'PUT_CONSLE_TOOLLINK', |
|
||||
url: `${ApiTable.consoleToollink}`, |
|
||||
msg: { option: '编辑常用工具' }, |
|
||||
reducer: { name: '' } |
|
||||
}); |
|
||||
} |
|
||||
export function deleteConsoleToollink (orgId) { //删除常用工具
|
|
||||
return dispatch => basicAction({ |
|
||||
type: 'delete', |
|
||||
dispatch: dispatch, |
|
||||
actionType: 'DELETE_CONSLE_TOOLLINK', |
|
||||
url: `${ApiTable.consoleToollink.replace('{linkId}', orgId)}`, |
|
||||
msg: { option: '删除常用工具' }, |
|
||||
reducer: { name: '' } |
|
||||
}); |
|
||||
} |
|
@ -1,7 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import * as console from './console' |
|
||||
|
|
||||
export default { |
|
||||
...console |
|
||||
} |
|
@ -1,6 +0,0 @@ |
|||||
'use strict'; |
|
||||
|
|
||||
import Console from './console'; |
|
||||
import UserCenter from './userCenter'; |
|
||||
|
|
||||
export { Console, UserCenter }; |
|
@ -0,0 +1,48 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import { ApiTable, basicAction } from '$utils' |
||||
|
|
||||
|
export function getConsoleToollink () { //获取常用工具
|
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'GET_CONSLE_TOOLLINK', |
||||
|
url: `${ApiTable.consoleToollink}`, |
||||
|
msg: { option: '获取常用工具' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function putConsoleToollink (data) { //编辑常用工具
|
||||
|
return dispatch => basicAction({ |
||||
|
type: 'put', |
||||
|
dispatch: dispatch, |
||||
|
data, |
||||
|
actionType: 'PUT_CONSLE_TOOLLINK', |
||||
|
url: `${ApiTable.consoleToollink}`, |
||||
|
msg: { option: '编辑常用工具' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
export function deleteConsoleToollink (orgId) { //删除常用工具
|
||||
|
return dispatch => basicAction({ |
||||
|
type: 'delete', |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'DELETE_CONSLE_TOOLLINK', |
||||
|
url: `${ApiTable.deleteConsoleToollink.replace('{linkId}', orgId)}`, |
||||
|
msg: { option: '删除常用工具' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
export function geteteConsoleCount (query) { //工作台数量查询
|
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
dispatch: dispatch, |
||||
|
query, |
||||
|
actionType: 'GET_CONSLE_COUNT', |
||||
|
url: `${ApiTable.geteteConsoleCount}`, |
||||
|
msg: { option: '工作台数量查询' }, |
||||
|
reducer: { name: '' } |
||||
|
}); |
||||
|
} |
@ -0,0 +1,8 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import * as control from './control' |
||||
|
|
||||
|
export default { |
||||
|
...control |
||||
|
|
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import Control from './control'; |
||||
|
import UserCenter from './userCenter'; |
||||
|
|
||||
|
export { Control, UserCenter }; |
@ -1,13 +1,13 @@ |
|||||
'use strict'; |
'use strict'; |
||||
import { Console,UserCenter } from './containers'; |
import { Control,UserCenter } from './containers'; |
||||
|
|
||||
export default [{ |
export default [{ |
||||
type: 'inner', |
type: 'inner', |
||||
route: { |
route: { |
||||
path: '/console', |
path: '/control', |
||||
key: 'console', |
key: 'control', |
||||
breadcrumb: '控制台', |
breadcrumb: '控制台', |
||||
component: Console, |
component: Control, |
||||
// 不设置 component 则面包屑禁止跳转
|
// 不设置 component 则面包屑禁止跳转
|
||||
} |
} |
||||
}, { |
}, { |
Loading…
Reference in new issue