Browse Source

请假类型

master
巴林闲侠 2 years ago
parent
commit
8d7388f685
  1. 21
      api/app/lib/controllers/attendance/index.js
  2. 3
      api/app/lib/routes/attendance/index.js

21
api/app/lib/controllers/attendance/index.js

@ -147,6 +147,26 @@ async function exportOvertimeStatistic (ctx) {
} }
} }
async function vacateType (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
const vacateTypeRes = await clickHouse.hr.query(`
SELECT type FROM vacate GROUP BY type ORDER BY type DESC
`).toPromise()
ctx.status = 200;
ctx.body = vacateTypeRes
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: error`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
async function vacateStatistic (ctx) { async function vacateStatistic (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -290,6 +310,7 @@ async function exportVacateStatistic (ctx) {
module.exports = { module.exports = {
overtimeStatistic, overtimeStatistic,
exportOvertimeStatistic, exportOvertimeStatistic,
vacateType,
vacateStatistic, vacateStatistic,
exportVacateStatistic, exportVacateStatistic,
}; };

3
api/app/lib/routes/attendance/index.js

@ -9,6 +9,9 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/attendance/overtime/export'] = { content: '加班统计导出', visible: true }; app.fs.api.logAttr['GET/attendance/overtime/export'] = { content: '加班统计导出', visible: true };
router.get('/attendance/overtime/export', attendance.exportOvertimeStatistic); router.get('/attendance/overtime/export', attendance.exportOvertimeStatistic);
app.fs.api.logAttr['GET/attendance/vacate/type'] = { content: '请假类型', visible: true };
router.get('/attendance/vacate/type', attendance.vacateType);
app.fs.api.logAttr['GET/attendance/vacate'] = { content: '请假统计', visible: true }; app.fs.api.logAttr['GET/attendance/vacate'] = { content: '请假统计', visible: true };
router.get('/attendance/vacate', attendance.vacateStatistic); router.get('/attendance/vacate', attendance.vacateStatistic);

Loading…
Cancel
Save