fix: 修复已撤销解聘记录(CANCELLED)在各模块中未正确过滤的问题

- 花名册API新增latestTerminationStatus字段,前端列表/操作按钮/离职日期列过滤CANCELLED/COMPLETED
- 证据链后端过滤CANCELLED状态的解聘记录,不再产生无效证据和风险提醒
- 重新入职判断增加status=COMPLETED条件,避免已撤销记录被误判为已离职
- 薪酬警告过滤CANCELLED状态,不再对已撤销记录触发结算提醒
- 风险扫描查询条件增加status=COMPLETED,避免已撤销记录导致员工被跳过
- 解聘向导canProceed和警告提示过滤CANCELLED/COMPLETED状态
- 档案解聘记录列表过滤CANCELLED状态,新增流程状态标签
- 重新生成Prisma Client以同步femaleWorkerType字段
This commit is contained in:
selfrelease
2026-07-25 20:10:42 +08:00
parent 41a2c665ed
commit 7ca2ada0d4
6 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ export async function rehireEmployee(orgId: string, userId: string, id: string,
const today = new Date()
today.setHours(0, 0, 0, 0)
const isResigned = employee.terminations.some((t) => t.terminationDate <= today)
const isResigned = employee.terminations.some((t) => t.status === 'COMPLETED' && t.terminationDate <= today)
if (!isResigned) {
throw { code: 'CONFLICT', message: '该员工当前在职,无需重新入职' }
}
+1 -1
View File
@@ -236,7 +236,7 @@ export async function getPayrollRiskWarnings(orgId: string, employeeId: string):
if (!employee.housingFundBase) {
warnings.push('未设置公积金缴费基数')
}
if (employee.terminations.length) {
if (employee.terminations.some((t) => t.status !== 'CANCELLED')) {
warnings.push('已有解聘记录,请注意结算')
}
+1 -1
View File
@@ -107,7 +107,7 @@ export async function detectOnboardingRisks(orgId: string) {
where: { orgId, status: 'ACTIVE', hireDate: { lte: today } },
include: {
contracts: { orderBy: { createdAt: 'desc' }, take: 1 },
terminations: { where: { terminationDate: { lte: today } }, take: 1 },
terminations: { where: { terminationDate: { lte: today }, status: 'COMPLETED' }, take: 1 },
},
})