refactor: 新增员工去掉参保城市选择器,城市从社保账户继承

- 前端:参保城市改为只读显示,从选中的社保账户自动继承
- 前端:去掉参保城市下拉选择器和 cities 查询
- 后端:clampSocialInsBase/clampHousingFundBase 改为优先按 accountId
  查年度标准裁剪基数,回退旧配置表
- 后端:createEmployee 传入 socialAccountId/housingAccountId 给 clamp 函数

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 14:08:11 +08:00
parent 014c94e482
commit fe427ef13f
3 changed files with 143 additions and 33 deletions
+2 -29
View File
@@ -670,13 +670,6 @@ export function AddEmployeeModal({ onClose, onSubmit, loading, error }: {
error: any
}) {
const todayStr = new Date().toISOString().slice(0, 10)
const { data: cities = ['北京'] } = useQuery<string[]>({
queryKey: ['social-config-cities'],
queryFn: async () => {
const res = await socialInsuranceApi.cities() as any
return res?.length ? res : ['北京']
},
})
const { data: contractTypes = [] } = useQuery<Array<{ value: string; label: string; hasEndDate: boolean }>>({
queryKey: ['contract-types'],
queryFn: async () => {
@@ -951,6 +944,7 @@ export function AddEmployeeModal({ onClose, onSubmit, loading, error }: {
idCardNumber: form.idCardNumber || undefined,
phone: form.phone || undefined,
education: form.education || undefined,
city: autoAccounts?.socialAccount?.city || form.city || '北京',
socialInsBase: form.socialInsBase ? parseFloat(form.socialInsBase) : undefined,
socialInsStartMonth: form.socialInsStartMonth || undefined,
housingFundBase: form.housingFundBase ? parseFloat(form.housingFundBase) : undefined,
@@ -1040,28 +1034,7 @@ export function AddEmployeeModal({ onClose, onSubmit, loading, error }: {
</div>
)}
<div className="grid grid-cols-4 gap-4">
<div><Label></Label><Select value={form.city} onChange={async (e) => {
const city = e.target.value
setForm({ ...form, city })
const salary = Number(form.socialInsBase === '' ? form.monthlySalary : form.socialInsBase) || 0
const hfBase = Number(form.housingFundBase === '' ? form.monthlySalary : form.housingFundBase) || 0
if (salary > 0) {
try {
const res = await socialInsuranceApi.calculate(salary, city)
if (res?.capped || res?.floored) {
setForm((prev: any) => ({ ...prev, socialInsBase: String(res.actualBase) }))
}
} catch {}
}
if (hfBase > 0) {
try {
const res = await socialInsuranceApi.housingCalculate(hfBase, city)
if (res?.capped || res?.floored) {
setForm((prev: any) => ({ ...prev, housingFundBase: String(res.actualBase) }))
}
} catch {}
}
}}>{cities.map((c) => <option key={c} value={c}>{c}</option>)}</Select></div>
<div><Label></Label><div className="text-xs text-gray-600 py-1.5">{autoAccounts?.socialAccount?.city || form.city || '—'}</div><div className="text-xs text-gray-400"></div></div>
<div><Label></Label><Select value={form.education} onChange={(e) => setForm({ ...form, education: e.target.value })}><option value=""></option><option value="博士"></option><option value="硕士"></option><option value="本科"></option><option value="大专"></option><option value="高中"></option><option value="其他"></option></Select></div>
</div>
{/* 社保公积金 */}