Browse Source

(+)考核接口,web调用接口

master
ww664853070 2 years ago
parent
commit
a004cc142b
  1. 43
      api/app/lib/controllers/employeeAssessment/index.js
  2. 71
      api/app/lib/models/employee_assessment.js
  3. 11
      api/app/lib/routes/employeeAssessment/index.js
  4. 14
      web/client/src/sections/humanAffairs/actions/employeeAssessment.js
  5. 4
      web/client/src/sections/humanAffairs/actions/index.js
  6. 13
      web/client/src/sections/humanAffairs/containers/regularKPI.jsx
  7. 5
      web/client/src/utils/webapi.js

43
api/app/lib/controllers/employeeAssessment/index.js

@ -0,0 +1,43 @@
'use strict';
const moment = require('moment')
/**
* query
* limitoffset
* 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,
}

71
api/app/lib/models/employee_assessment.js

@ -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;
};

11
api/app/lib/routes/employeeAssessment/index.js

@ -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);
};

14
web/client/src/sections/humanAffairs/actions/employeeAssessment.js

@ -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" },
});
}

4
web/client/src/sections/humanAffairs/actions/index.js

@ -7,6 +7,7 @@ import * as departmentTrain from './departmentTrain'
import * as personalTrainRecord from './personalTrainRecord'
import * as resourceRepository from './resourceRepository'
import * as employeeCommunication from './employeeCommunication'
import * as employeeAssessment from './employeeAssessment'
export default {
...personnelFiles,
@ -15,5 +16,6 @@ export default {
...departmentTrain,
...personalTrainRecord,
...resourceRepository,
...employeeCommunication
...employeeCommunication,
...employeeAssessment
}

13
web/client/src/sections/humanAffairs/containers/regularKPI.jsx

@ -5,9 +5,16 @@ import { SkeletonScreen } from "$components";
import '../style.less'
const RegularKPI = (props) => {
const { dispatch, actions } = props
const { dispatch, actions,employeeAssessmentList } = props
const [limits, setLimits] = useState()//
const [query, setQuery] = useState({ limit: 10, page: 0 }); //
const { getemployeeAssessmentList } = actions.humanAffairs;
useEffect(() => {
getList()
}, [query])
function getList() {
dispatch(getemployeeAssessmentList(query, 1))
}
const [tableData, setTableData] = useState([{ id: 1, year: '1月', statement: '正式员工测试12.xlsx' }, { id: 2, year: '2月', statement: '测试12.xlsx' }, { id: 3, year: '3月', statement: '测试12.xlsx' }, { id: 4, year: '4月', statement: '测试12.xlsx' }, { id: 5, year: '5月', statement: '测试12.xlsx' }, { id: 6, year: '6月', statement: '测试12.xlsx' }, { id: 7, year: '7月', statement: '测试12.xlsx' }, { id: 8, year: '8月', statement: '测试12.xlsx' }, { id: 9, year: '9月', statement: '测试12.xlsx' }, { id: 10, year: '10月', statement: '测试12.xlsx' }, { id: 11, year: '11月', statement: '测试12.xlsx' }, { id: 12, year: '12月', statement: '测试12.xlsx' }]);
@ -55,6 +62,7 @@ const RegularKPI = (props) => {
}];
const scroll = useMemo(() => ({}), []);
console.log(employeeAssessmentList, '---------------');
return (
<>
<div style={{ padding: '0px 12px' }}>
@ -123,10 +131,11 @@ const RegularKPI = (props) => {
}
function mapStateToProps(state) {
const { auth, global } = state;
const { auth, global, employeeAssessmentList } = state;
return {
user: auth.user,
actions: global.actions,
employeeAssessmentList: employeeAssessmentList
};
}

5
web/client/src/utils/webapi.js

@ -61,7 +61,10 @@ export const ApiTable = {
delResourceFile: 'train/trainFiles/resourceRepository/file/{id}',
//员工沟通统计
getEmployeeCommunicate:'employee/communicate/list'
getEmployeeCommunicate: 'employee/communicate/list',
//考核
getemployeeAssessmentList: 'employessAssessment/list/{type}'
};
export const RouteTable = {

Loading…
Cancel
Save