From 191d4bc43f70e7b88cc56a0b914a9cc3fdc9d282 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Mon, 10 Oct 2022 17:21:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=205800=20=E8=A7=86=E9=A2=91=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=90=9C=E7=B4=A2=E6=A0=8F=E8=BE=93=E5=85=A5=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E7=89=A9=E5=90=8D=E7=A7=B0=E5=85=B3=E9=94=AE=E5=AD=97?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 19 +++++++++---------- api/app/lib/utils/dataRange.js | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) 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 }) }