feat: 社保公积金账户化重构

新增 SocialAccount(账户)+ SocialYearStandard(年度标准)两层实体,
替代原 SocialInsuranceConfig/HousingFundConfig 按城市管理的方式。

- DB: 新增 SocialAccount、SocialYearStandard 表,Department 加账户关联
- 迁移: 旧 Config 表数据迁移到 Account + YearStandard
- 后端: 新增账户 CRUD + 年度标准 API,薪资计算适配 accountId
- 前端: 设置页新增账户管理 Tab,组织架构提示 level=0 可关联账户
- 前端: SocialInsurance.tsx 城市选择器改为账户选择器
- 兼容: 旧 Config 表保留,薪资计算回退旧表

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-16 13:50:15 +08:00
parent 454b3d4b05
commit 63b6c9dcc7
8 changed files with 674 additions and 81 deletions
+8
View File
@@ -486,6 +486,9 @@ model SocialAccount {
socialRecords EmployeeSocialInsRecord[]
housingRecords EmployeeHousingFundRecord[]
monthlyProcesses SocialMonthlyProcess[]
// 部门关联(员工通过部门继承账户)
deptSocialAccounts Department[] @relation("DeptSocialAccount")
deptHousingAccounts Department[] @relation("DeptHousingAccount")
@@unique([orgId, type, name])
@@index([orgId, type, city])
@@ -1675,6 +1678,11 @@ model Department {
level Int @default(0) // 层级(0=根)
sortOrder Int @default(0) // 同级排序
description String?
// 社保公积金账户关联(员工通过部门继承账户)
socialAccountId String? // 社保账户
socialAccount SocialAccount? @relation("DeptSocialAccount", fields: [socialAccountId], references: [id], onDelete: SetNull)
housingAccountId String? // 公积金账户
housingAccount SocialAccount? @relation("DeptHousingAccount", fields: [housingAccountId], references: [id], onDelete: SetNull)
createdBy String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt