feat: 员工特殊状态台账(三期/工伤/医疗期)完整实现
This commit is contained in:
@@ -220,6 +220,21 @@ export async function createTermination(orgId: string, userId: string, data: any
|
||||
throw { code: 'NOT_FOUND', message: '员工不存在' }
|
||||
}
|
||||
|
||||
// 特殊状态拦截:三期/工伤/医疗期员工不得违法终止
|
||||
const activeSpecialStatus = await (prisma as any).employeeSpecialStatus.findFirst({
|
||||
where: { orgId, employeeId: data.employeeId, status: 'ACTIVE' },
|
||||
})
|
||||
if (activeSpecialStatus) {
|
||||
const typeLabel = activeSpecialStatus.type === 'PREGNANCY' ? '三期(孕期/产期/哺乳期)'
|
||||
: activeSpecialStatus.type === 'WORK_INJURY' ? '工伤'
|
||||
: activeSpecialStatus.type === 'MEDICAL_PERIOD' ? '医疗期'
|
||||
: '特殊状态'
|
||||
throw {
|
||||
code: 'SPECIAL_STATUS_BLOCK',
|
||||
message: `该员工处于${typeLabel}期间,依法不得终止劳动合同。如需操作,请先在特殊状态台账中结束该状态记录。`,
|
||||
}
|
||||
}
|
||||
|
||||
const { level } = assessRisk(employee, data.reason)
|
||||
|
||||
return createTerminationRecord(
|
||||
|
||||
Reference in New Issue
Block a user