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>({ const { data: monthlyChanges } = useQuery<any>({
queryKey: ['monthly-changes', monthlyMonth], queryKey: ['monthly-changes', monthlyMonth],
queryFn: async () => { 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/monthly-changes', { params: { month: monthlyMonth } }) as any,
api.get('/social/housing/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', enabled: tab === 'monthly',
}) })
@@ -219,7 +226,7 @@ export default function SocialInsurance() {
}`} }`}
onClick={() => { setTab(t); setShowVersions(false); setShowNewVersion(false); setShowAdjust(false); setAdjustData(null); setEditItems({}) }} onClick={() => { setTab(t); setShowVersions(false); setShowNewVersion(false); setShowAdjust(false); setAdjustData(null); setEditItems({}) }}
> >
{t === 'social' ? '社保' : t === 'housing' ? '公积金' : '月度增减员'} {t === 'social' ? '社保' : t === 'housing' ? '公积金' : '月度办理'}
</button> </button>
))} ))}
</div> </div>
@@ -523,11 +530,11 @@ export default function SocialInsurance() {
</div> </div>
)} )}
{/* ========== 月度增减员 Tab ========== */} {/* ========== 月度办理 Tab ========== */}
{tab === 'monthly' && ( {tab === 'monthly' && (
<Card> <Card>
<div className="flex items-center justify-between mb-3"> <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"> <div className="flex items-center gap-2">
<Input type="month" value={monthlyMonth} onChange={(e) => setMonthlyMonth(e.target.value)} className="!w-32" /> <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)}> <Button variant="secondary" size="sm" onClick={() => monthlyChanges && handleExportCSV('social', monthlyChanges.social)}>
@@ -539,20 +546,22 @@ export default function SocialInsurance() {
</div> </div>
</div> </div>
<div className="bg-blue-50 text-blue-700 text-xs px-3 py-2 rounded-md mb-3"> <div className="bg-blue-50 text-blue-700 text-xs px-3 py-2 rounded-md mb-3">
// ///
</div> </div>
{(() => { {(() => {
if (!monthlyChanges) return <div className="text-center py-4 text-gray-400 text-xs">...</div> if (!monthlyChanges) return <div className="text-center py-4 text-gray-400 text-xs">...</div>
const sAdd = monthlyChanges.social?.additions || [] const sAdd = monthlyChanges.social?.additions || []
const sSub = monthlyChanges.social?.subtractions || [] const sSub = monthlyChanges.social?.subtractions || []
const sNormal = monthlyChanges.socialActive?.items || []
const hAdd = monthlyChanges.housing?.additions || [] const hAdd = monthlyChanges.housing?.additions || []
const hSub = monthlyChanges.housing?.subtractions || [] const hSub = monthlyChanges.housing?.subtractions || []
if (sAdd.length === 0 && sSub.length === 0 && hAdd.length === 0 && hSub.length === 0) { const hNormal = monthlyChanges.housingActive?.items || []
return <div className="text-center py-4 text-gray-400 text-xs">{monthlyMonth} </div> 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 ( return (
<div className="space-y-4"> <div className="space-y-4">
{/* 社保增减员 */} {/* 社保 */}
<div> <div>
<h3 className="text-xs font-medium mb-2"></h3> <h3 className="text-xs font-medium mb-2"></h3>
<div className="overflow-x-auto"> <div className="overflow-x-auto">
@@ -588,11 +597,21 @@ export default function SocialInsurance() {
<td className="py-1.5">{i.endMonth}</td> <td className="py-1.5">{i.endMonth}</td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
</div> </div>
{/* 公积金增减员 */} {/* 公积金 */}
<div> <div>
<h3 className="text-xs font-medium mb-2"></h3> <h3 className="text-xs font-medium mb-2"></h3>
<div className="overflow-x-auto"> <div className="overflow-x-auto">
@@ -628,6 +647,16 @@ export default function SocialInsurance() {
<td className="py-1.5">{i.endMonth}</td> <td className="py-1.5">{i.endMonth}</td>
</tr> </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> </tbody>
</table> </table>
</div> </div>