ww664853070
2 years ago
7 changed files with 158 additions and 5 deletions
@ -0,0 +1,43 @@ |
|||
'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: [["id", "desc"]] |
|||
}; |
|||
if (Number(limit) > 0 && Number(page) >= 0) { |
|||
findObj.limit = Number(limit); |
|||
findObj.offset = Number(page) * Number(limit); |
|||
} |
|||
if (year && month) { |
|||
findObj.year = year; |
|||
findObj.month = month; |
|||
} |
|||
if (type) { |
|||
findObj.type = type; |
|||
} |
|||
rlst = await models.PerformanceAll.findAndCountAll(findObj); |
|||
ctx.status = 200; |
|||
ctx.body = rlst; |
|||
} catch (err) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { message: err.message || '查询列表失败' } |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
getemployeeAssessmentList, |
|||
} |
@ -0,0 +1,71 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const PerformanceAll = sequelize.define("performance_all", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true |
|||
}, |
|||
year: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "year", |
|||
autoIncrement: false |
|||
}, |
|||
month: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "month", |
|||
autoIncrement: false |
|||
}, |
|||
name: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "name", |
|||
autoIncrement: false |
|||
}, |
|||
path: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "path", |
|||
autoIncrement: false |
|||
}, |
|||
type: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "type", |
|||
autoIncrement: false |
|||
}, |
|||
}, { |
|||
tableName: "performance_all", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
|
|||
dc.models.PerformanceAll = PerformanceAll; |
|||
return PerformanceAll; |
|||
}; |
@ -0,0 +1,11 @@ |
|||
'use strict'; |
|||
/**考核*/ |
|||
const resourceRepository = require('../../controllers/employeeAssessment'); |
|||
|
|||
module.exports = function (app, router, opts) { |
|||
|
|||
app.fs.api.logAttr['GET/employessAssessment/list/:type'] = { content: '获取列表数据', visible: true }; |
|||
router.get('/employessAssessment/list/:type', resourceRepository.getemployeeAssessmentList); |
|||
|
|||
|
|||
}; |
@ -0,0 +1,14 @@ |
|||
'use strict'; |
|||
import { ApiTable, basicAction } from '$utils' |
|||
|
|||
export function getemployeeAssessmentList(query,id) { |
|||
return (dispatch) => basicAction({ |
|||
type: "get", |
|||
dispatch: dispatch, |
|||
actionType: "GET_EMPLOYEE_ASSESSMENT_LIST", |
|||
query: query, |
|||
url: ApiTable.getemployeeAssessmentList.replace("{type}", id), |
|||
msg: { option: "查询列表" }, |
|||
reducer: { name: "employeeAssessmentList" }, |
|||
}); |
|||
} |
Loading…
Reference in new issue