人力资源
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.
 
 
 
 

44 lines
1.2 KiB

'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,
}