diff --git a/api/app/lib/controllers/alarm/app.js b/api/app/lib/controllers/alarm/app.js index 6010b7a..8e989df 100644 --- a/api/app/lib/controllers/alarm/app.js +++ b/api/app/lib/controllers/alarm/app.js @@ -375,7 +375,7 @@ async function exportAppAlarms(ctx, listRes) { let typeData = { element: "元素异常", apiError: "接口报错 ", timeout: "加载超时" } try { const { utils: { simpleExcelDown, getExportAlarmHeader } } = ctx.app.fs; - let header = await getExportAlarmHeader(ctx, 'app'); + let header = await getExportAlarmHeader('app'); let exportData = [] for (let { dataValues: item } of listRes.rows) { let projectName = []; diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 3aafbb9..7ad2046 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -242,7 +242,7 @@ async function getAlarmGroups(ctx) { async function exportDataAlarms(ctx, alarmList, groupId) { try { const { utils: { simpleExcelDown, getExportAlarmHeader } } = ctx.app.fs; - let header = await getExportAlarmHeader(ctx, groupId); + let header = await getExportAlarmHeader(groupId); let alarmGroups = await getAlarmGroups(ctx); let ggroups = [] diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index d97a4ab..270c0f8 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -286,7 +286,7 @@ async function exportVideoAlarms(ctx, alarmList) { const kindRes = await clickHouse.vcmp.query(` SELECT * FROM camera_kind `).toPromise() - let header = await getExportAlarmHeader(ctx, 'video'); + let header = await getExportAlarmHeader('video'); let exportData = [] for (let item of alarmList) { let projectNames = item.pomsProject.map(p => { diff --git a/api/app/lib/utils/exportAlarmHeader.js b/api/app/lib/utils/exportAlarmHeader.js index b8cdfa1..2f436a5 100644 --- a/api/app/lib/utils/exportAlarmHeader.js +++ b/api/app/lib/utils/exportAlarmHeader.js @@ -243,7 +243,7 @@ let header_app = [{ key: "confirmTime", }]; module.exports = function (app, opts) { - async function getExportAlarmHeader(ctx, type) { + async function getExportAlarmHeader(type) { try { let headerMap = { "1": headerZD,//数据中断 @@ -254,13 +254,9 @@ module.exports = function (app, opts) { app: header_app, } return headerMap[type] || [] - } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); - ctx.status = 400; - ctx.body = { - message: typeof error == 'string' ? error : undefined - } - } + } catch (err) { + console.log(`获取告警导出表格表头失败, error: ${err}`); + } } return {