项企-报表中心
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
871 B

'use strict';
// 查询储备项目统计表
async function getReserveItemReport(ctx, next) {
const { type } = ctx.params;
let rslt = null;
try {
rslt = await ctx.fs.dc.models.ReserveItemReport.findAll({
order: [['year', 'DESC'], ['month', 'DESC']],
where: { type: type }
})
let newReportData = rslt.map(e => {
return {
id: e.id,
date: e.year + '-' + e.month,
path: e.path,
type: e.type,
name: e.name
}
})
ctx.status = 200
ctx.body = newReportData
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
ctx.body = { name: 'FindAllError', message: '获取失败' }
}
}
module.exports = {
getReserveItemReport
}