feat: 实现20260730优化方案全部功能

- AI文件审查:.docx上传提取文本,支持多种文档类型
- 用工办理工作流:WorkProcess页面+后端API,支持入职/续签/终止等流程
- 企业自建文本库:Templates页面Tab切换,企业模板CRUD+渲染+下载Word
- 考勤发布:Attendance发布/取消发布按钮,员工端MyAttendance页面
- 工资条发布:Money发布/定时发送按钮+弹窗,portal端publishStatus过滤
- 合同到期弹窗:Dashboard合同到期预警可点击打开弹窗,支持续签/终止操作
- Prisma schema新增WorkProcess/EnterpriseTemplate/AttendancePublish模型
- 前后端编译验证全部通过
This commit is contained in:
freedakgmail
2026-07-30 10:21:22 +08:00
parent 38b8849332
commit 42e0c650a4
24 changed files with 3639 additions and 35 deletions
+31 -2
View File
@@ -110,7 +110,7 @@ router.get('/payslip', portalAuth, async (req: any, res, next) => {
try {
const month = req.query.month as string || new Date().toISOString().slice(0, 7)
const payslip = await prisma.payslip.findFirst({
where: { employeeId: req.employee.id, orgId: req.employee.orgId, month },
where: { employeeId: req.employee.id, orgId: req.employee.orgId, month, publishStatus: 'PUBLISHED' },
})
if (!payslip) {
return res.json({ success: true, data: null })
@@ -125,7 +125,7 @@ router.get('/payslip', portalAuth, async (req: any, res, next) => {
router.get('/payslip/history', portalAuth, async (req: any, res, next) => {
try {
const payslips = await prisma.payslip.findMany({
where: { employeeId: req.employee.id, orgId: req.employee.orgId },
where: { employeeId: req.employee.id, orgId: req.employee.orgId, publishStatus: 'PUBLISHED' },
orderBy: { month: 'desc' },
take: 6,
})
@@ -611,4 +611,33 @@ router.get('/auto-login', async (req, res, next) => {
}
})
// 员工端查看自己的月度考勤
router.get('/attendance', portalAuth, async (req: any, res, next) => {
try {
const month = req.query.month as string || new Date().toISOString().slice(0, 7)
// 检查该月份是否已发布
const publish = await (prisma as any).attendancePublish.findFirst({
where: { orgId: req.employee.orgId, month, status: 'PUBLISHED' },
})
if (!publish) {
return res.json({ success: true, data: { published: false, records: [] } })
}
// 查询该月考勤记录
const startDate = new Date(`${month}-01`)
const endDate = new Date(startDate)
endDate.setMonth(endDate.getMonth() + 1)
const records = await prisma.attendanceRecord.findMany({
where: {
employeeId: req.employee.id,
orgId: req.employee.orgId,
date: { gte: startDate, lt: endDate },
},
orderBy: { date: 'asc' },
})
res.json({ success: true, data: { published: true, records, title: publish.title } })
} catch (err) {
next(err)
}
})
export default router