'use strict'; const moment = require('moment') /**考核列表 * query * limit、offset * type : 考核分类 * year : 年 * month :月 */ async function getemployeeAssessmentList(ctx) { try { const { models } = ctx.fs.dc; const { limit, page, year, month } = ctx.query; const { type } = ctx.params; let rlst = []; const findObj = { order: [["year", "desc"], ["month", "desc"]], where: {} }; if (Number(limit) > 0 && Number(page) >= 0) { findObj.limit = Number(limit); findObj.offset = Number(page) * Number(limit); } if (year && month) { findObj.where.year = year; findObj.where.month = month; } if (type) { findObj.where.type = type; } rlst = await models.PerformanceAll.findAndCountAll(findObj); ctx.status = 200; ctx.body = rlst; } catch (err) { ctx.fs.logger.error(`path: ${ctx.path}, error: ${err}`); ctx.status = 400; ctx.body = { message: err.message || '查询列表失败' } } } module.exports = { getemployeeAssessmentList, }