diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index afd58c4..1263203 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -67,7 +67,7 @@ async function alarmList (ctx) { ) `) } - const alarmRes = await clickHouse.vcmp.query( + const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( ` SELECT cameraAlarm.cameraId AS cameraId, @@ -83,8 +83,7 @@ async function alarmList (ctx) { cameraAlarm.platform AS platform, cameraAlarm.confirmContent AS confirmContent, cameraAlarm.confirmTime AS confirmTime, - ${//'cameraAlarm.autoRestore AS autoRestore,' - ''} + ${'cameraAlarm.autoRestore AS autoRestore,'} camera_status_resolve.id AS resolveId, camera_status.describe AS statusDescribe, camera_status_resolve.resolve AS resolve, @@ -113,12 +112,8 @@ async function alarmList (ctx) { camera_status_alarm.serial_no AS cameraSerialNo, camera_status_alarm.channel_no AS cameraChannelNo, camera_status_alarm.confirm AS confirmContent, - ${ - //' camera_status_alarm.auto_restore AS autoRestore,' - '' - } + ${'camera_status_alarm.auto_restore AS autoRestore,'} camera_status_alarm.confirm_time AS confirmTime - FROM camera_status_alarm INNER JOIN camera ON camera.serial_no = camera_status_alarm.serial_no @@ -157,12 +152,14 @@ async function alarmList (ctx) { AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo LEFT JOIN ${anxinyun}.t_structure AS anxinStruc ON anxinStruc.id = anxinIpc.structure + AND anxinStruc.id IN (${anxinStrucIds.join(',')}) + ${keywordTarget == 'struc' && keyword ? `AND anxinStruc.name LIKE '%${keyword}%'` : ''} 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() + ).toPromise() : [] let returnD = [] let positionD = {} @@ -179,6 +176,7 @@ async function alarmList (ctx) { if (a.strucId && !curD.struc.some(s => s.id == a.strucId)) { curD.struc.push({ id: a.strucId, + projectId: a.projectId, name: a.strucName }) } @@ -220,7 +218,7 @@ async function alarmList (ctx) { anxinStruc.find(as => as.strucId == a.strucId) || { pomsProject: [ - + ] } ).pomsProject @@ -234,6 +232,7 @@ async function alarmList (ctx) { if (a.strucId) { d.struc.push({ id: a.strucId, + projectId: a.projectId, name: a.strucName }) } diff --git a/api/app/lib/utils/dataRange.js b/api/app/lib/utils/dataRange.js index a50c886..093f51e 100644 --- a/api/app/lib/utils/dataRange.js +++ b/api/app/lib/utils/dataRange.js @@ -57,7 +57,7 @@ module.exports = function (app, opts) { pepProjectIds.push(b.pepProjectId) } } - + // 查询项企项目的信息 const pepProjectRes = pepProjectIds.length ? await clickHouse.projectManage.query( @@ -158,7 +158,7 @@ module.exports = function (app, opts) { undelStruc.push({ strucId: s.strucId, strucName: s.strucName, - // projectId: s.projectId, + projectId: s.projectId, pomsProject: pomsProject }) }