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.
|
|
|
'use strict';
|
|
|
|
|
|
|
|
async function getPatrolReport(ctx, next) {
|
|
|
|
try {
|
|
|
|
const models = ctx.fs.dc.models;
|
|
|
|
const { limit, page, projectId, startTime, endTime } = ctx.query;
|
|
|
|
let options = {
|
|
|
|
where: {},
|
|
|
|
include: [{
|
|
|
|
model: models.Project
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
if (limit) {
|
|
|
|
options.limit = Number(limit);
|
|
|
|
}
|
|
|
|
if (page && limit) {
|
|
|
|
options.offset = Number(page) * Number(limit);
|
|
|
|
}
|
|
|
|
if (projectId) {
|
|
|
|
options.where.projectId = projectId;
|
|
|
|
}
|
|
|
|
if (startTime && endTime) {
|
|
|
|
options.where.inspectTm = { $between: [startTime, endTime] };
|
|
|
|
}
|
|
|
|
const res = await models.ReportInfo.findAndCountAll(options);
|
|
|
|
ctx.status = 200;
|
|
|
|
ctx.body = res;
|
|
|
|
} catch (error) {
|
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
|
|
|
|
ctx.status = 400;
|
|
|
|
ctx.body = {
|
|
|
|
"message": "获取巡检报告失败"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
getPatrolReport,
|
|
|
|
}
|