fix: 合同管理未签合同统计修正

原查询查contractType=UNSIGNED的合同数(=0),但实际有12名员工完全无合同记录。
改为查contracts: { none: {} }的在职员工数,getHealthCheck和getComplianceScore均修复。
This commit is contained in:
selfrelease
2026-08-01 15:14:11 +08:00
parent 4d067e476e
commit 5dd92a0e20
+4 -2
View File
@@ -1408,7 +1408,8 @@ export async function getComplianceScore(orgId: string) {
lastMonthRisks,
] = await Promise.all([
prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }),
prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }),
// 未签合同:完全无合同记录的在职员工
prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }),
prisma.laborContract.count({
where: {
orgId,
@@ -1583,7 +1584,8 @@ export async function getHealthCheck(orgId: string) {
totalPayslips,
] = await Promise.all([
prisma.employee.count({ where: { orgId, status: 'ACTIVE' } }),
prisma.laborContract.count({ where: { orgId, contractType: 'UNSIGNED', employee: { status: 'ACTIVE' } } }),
// 未签合同:完全无合同记录的在职员工
prisma.employee.count({ where: { orgId, status: 'ACTIVE', contracts: { none: {} } } }),
prisma.laborContract.count({
where: {
orgId,