feat: 月度增减员改为月度办理,增加正常在保人员展示

This commit is contained in:
freedakgmail
2026-07-23 20:29:08 +08:00
parent 4f125d309b
commit 32a57873cf
+39 -10
View File
@@ -72,11 +72,18 @@ export default function SocialInsurance() {
const { data: monthlyChanges } = useQuery<any>({
queryKey: ['monthly-changes', monthlyMonth],
queryFn: async () => {
const [socialRes, housingRes] = await Promise.all([
const [socialRes, housingRes, socialActiveRes, housingActiveRes] = await Promise.all([
api.get('/social/monthly-changes', { params: { month: monthlyMonth } }) as any,
api.get('/social/housing/monthly-changes', { params: { month: monthlyMonth } }) as any,
api.get('/social/active-declaration', { params: { month: monthlyMonth } }) as any,
api.get('/social/housing/active-declaration', { params: { month: monthlyMonth } }) as any,
])
return { social: socialRes.data, housing: housingRes.data }
return {
social: socialRes.data,
housing: housingRes.data,
socialActive: socialActiveRes.data,
housingActive: housingActiveRes.data,
}
},
enabled: tab === 'monthly',
})
@@ -219,7 +226,7 @@ export default function SocialInsurance() {
}`}
onClick={() => { setTab(t); setShowVersions(false); setShowNewVersion(false); setShowAdjust(false); setAdjustData(null); setEditItems({}) }}
>
{t === 'social' ? '社保' : t === 'housing' ? '公积金' : '月度增减员'}
{t === 'social' ? '社保' : t === 'housing' ? '公积金' : '月度办理'}
</button>
))}
</div>
@@ -523,11 +530,11 @@ export default function SocialInsurance() {
</div>
)}
{/* ========== 月度增减员 Tab ========== */}
{/* ========== 月度办理 Tab ========== */}
{tab === 'monthly' && (
<Card>
<div className="flex items-center justify-between mb-3">
<h2 className="text-xs font-medium"></h2>
<h2 className="text-xs font-medium"></h2>
<div className="flex items-center gap-2">
<Input type="month" value={monthlyMonth} onChange={(e) => setMonthlyMonth(e.target.value)} className="!w-32" />
<Button variant="secondary" size="sm" onClick={() => monthlyChanges && handleExportCSV('social', monthlyChanges.social)}>
@@ -539,20 +546,22 @@ export default function SocialInsurance() {
</div>
</div>
<div className="bg-blue-50 text-blue-700 text-xs px-3 py-2 rounded-md mb-3">
//
///
</div>
{(() => {
if (!monthlyChanges) return <div className="text-center py-4 text-gray-400 text-xs">...</div>
const sAdd = monthlyChanges.social?.additions || []
const sSub = monthlyChanges.social?.subtractions || []
const sNormal = monthlyChanges.socialActive?.items || []
const hAdd = monthlyChanges.housing?.additions || []
const hSub = monthlyChanges.housing?.subtractions || []
if (sAdd.length === 0 && sSub.length === 0 && hAdd.length === 0 && hSub.length === 0) {
return <div className="text-center py-4 text-gray-400 text-xs">{monthlyMonth} </div>
const hNormal = monthlyChanges.housingActive?.items || []
if (sAdd.length === 0 && sSub.length === 0 && hAdd.length === 0 && hSub.length === 0 && sNormal.length === 0 && hNormal.length === 0) {
return <div className="text-center py-4 text-gray-400 text-xs">{monthlyMonth} </div>
}
return (
<div className="space-y-4">
{/* 社保增减员 */}
{/* 社保 */}
<div>
<h3 className="text-xs font-medium mb-2"></h3>
<div className="overflow-x-auto">
@@ -588,11 +597,21 @@ export default function SocialInsurance() {
<td className="py-1.5">{i.endMonth}</td>
</tr>
))}
{sNormal.map((i: any) => (
<tr key={`sn-${i.employeeId}`} className="border-b last:border-0">
<td className="py-1.5">{i.name}</td>
<td className="py-1.5 text-gray-500">{i.department}</td>
<td className="py-1.5"><span className="px-2 py-0.5 rounded bg-gray-100 text-gray-500"></span></td>
<td className="py-1.5 text-right">¥{fmt(i.base)}</td>
<td className="py-1.5 text-gray-400">{i.startMonth}</td>
<td className="py-1.5 text-gray-400">{i.endMonth || '在保'}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
{/* 公积金增减员 */}
{/* 公积金 */}
<div>
<h3 className="text-xs font-medium mb-2"></h3>
<div className="overflow-x-auto">
@@ -628,6 +647,16 @@ export default function SocialInsurance() {
<td className="py-1.5">{i.endMonth}</td>
</tr>
))}
{hNormal.map((i: any) => (
<tr key={`hn-${i.employeeId}`} className="border-b last:border-0">
<td className="py-1.5">{i.name}</td>
<td className="py-1.5 text-gray-500">{i.department}</td>
<td className="py-1.5"><span className="px-2 py-0.5 rounded bg-gray-100 text-gray-500"></span></td>
<td className="py-1.5 text-right">¥{fmt(i.base)}</td>
<td className="py-1.5 text-gray-400">{i.startMonth}</td>
<td className="py-1.5 text-gray-400">{i.endMonth || '在保'}</td>
</tr>
))}
</tbody>
</table>
</div>