feat: 节假日配置、排班管理独立页面、考勤加班显示优化

- 新增 HolidayConfig 模型,支持法定节假日和调休工作日配置
- 加班费同步逻辑改用 HolidayConfig 判断日期类型
- 员工端考勤显示加班工时、费率和日期类型
- 周末/节假日出勤状态显示为"周末出勤"/"节假日出勤"
- 新增 Employee.defaultShiftId 字段,支持长期排班(工作日班次)
- 排班管理拆分为独立页面(班次管理+排班),考勤管理保留出勤相关功能
- 排班和每日出勤页面增加身份证号列
- 修复岗位和部门编辑失败问题(POST 改 PUT)
- 新增 backfill 脚本:合同薪资回填、默认班次回填

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-18 11:00:53 +08:00
parent eb91c2d8fb
commit 1feada76d1
20 changed files with 1482 additions and 484 deletions
+54
View File
@@ -0,0 +1,54 @@
/**
* 迁移脚本:为现有员工设置默认班次(长期排班=工作日班次)
* 每个员工的默认班次设为该组织的第一个班次
*/
import prisma from '../src/lib/prisma'
async function main() {
// 查找所有没有默认班次的在职员工
const employees = await prisma.employee.findMany({
where: {
status: 'ACTIVE',
defaultShiftId: null,
},
select: { id: true, orgId: true, name: true },
})
console.log(`找到 ${employees.length} 个员工未设置默认班次`)
// 按组织分组
const orgShifts = new Map<string, string>()
let updated = 0
for (const emp of employees) {
// 获取该组织的第一个班次(缓存)
let shiftId = orgShifts.get(emp.orgId)
if (!shiftId) {
const shift = await prisma.shift.findFirst({
where: { orgId: emp.orgId },
orderBy: { createdAt: 'asc' },
})
if (shift) {
shiftId = shift.id
orgShifts.set(emp.orgId, shiftId)
}
}
if (shiftId) {
await prisma.employee.update({
where: { id: emp.id },
data: { defaultShiftId: shiftId },
})
console.log(` ✓ 员工 ${emp.name} → 默认班次已设置`)
updated++
} else {
console.log(` ✗ 员工 ${emp.name} → 该组织无班次配置,跳过`)
}
}
console.log(`\n完成:共更新 ${updated} 个员工`)
}
main()
.catch(console.error)
.finally(() => prisma.$disconnect())