feat: 20260805 系统优化 - 身份证复制fallback/薪税日期筛选/社保版本修复/证据链导出/违纪证明/医疗期政策/绩效类型评级/合同作废/帮助更新

This commit is contained in:
freedakgmail
2026-08-05 20:26:16 +08:00
parent a5901d648e
commit c355a7d208
24 changed files with 1185 additions and 257 deletions
+26 -2
View File
@@ -284,9 +284,33 @@ router.delete('/contracts/:contractId', authMiddleware, async (req: AuthRequest,
if (!contract) {
return res.status(404).json({ success: false, error: { code: 'NOT_FOUND', message: '合同不存在' } })
}
await prisma.laborContract.delete({ where: { id: req.params.contractId } })
// 作废处理:设置结束日期为当前时间,保留记录但不物理删除
await prisma.laborContract.update({
where: { id: req.params.contractId },
data: { endDate: new Date() },
})
const emp = await prisma.employee.findFirst({ where: { id: contract.employeeId }, select: { name: true } })
await auditLog(req, 'DELETE_CONTRACT', 'CONTRACT', req.params.contractId, { employeeName: emp?.name || '', employeeId: contract.employeeId, contractType: contract.contractType, startDate: contract.startDate, endDate: contract.endDate })
await auditLog(req, 'VOID_CONTRACT', 'CONTRACT', req.params.contractId, { employeeName: emp?.name || '', employeeId: contract.employeeId, contractType: contract.contractType, startDate: contract.startDate, endDate: contract.endDate })
res.json({ success: true })
} catch (err) {
next(err)
}
})
// 补充上传合同附件
router.patch('/contracts/:contractId/attachment', authMiddleware, async (req: AuthRequest, res, next) => {
try {
const contract = await prisma.laborContract.findFirst({
where: { id: req.params.contractId, orgId: req.user!.orgId },
})
if (!contract) {
return res.status(404).json({ success: false, error: { code: 'NOT_FOUND', message: '合同不存在' } })
}
const { attachmentUrl } = req.body as { attachmentUrl: string }
await prisma.laborContract.update({
where: { id: req.params.contractId },
data: { attachmentUrl: attachmentUrl || null },
})
res.json({ success: true })
} catch (err) {
next(err)