import React, { useEffect, useState } from 'react'; import { api } from '../lib/api'; import { AttendanceDto, LeaveDto, NotificationDto } from '../types'; export default function Dashboard() { const [attendance, setAttendance] = useState([]); const [leaves, setLeaves] = useState([]); const [notifications, setNotifications] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { Promise.all([ api.get('/attendance/me'), api.get('/leave-requests/my'), api.get('/notifications'), ]) .then(([a, l, n]) => { setAttendance(a); setLeaves(l); setNotifications(n); }) .finally(() => setLoading(false)); }, []); return (

概览

关键指标一览与近期动态

本月考勤记录
{attendance.length}
来自个人记录
我的请假申请
{leaves.length}
当前与历史
通知
{notifications.length}
含未读与已读
最近考勤
{loading ? (
加载中...
) : ( {attendance.slice(0, 5).map((a) => ( ))}
日期 签到 签退 工时
{a.date} {a.checkInTime || '-'} {a.checkOutTime || '-'} {a.workHours}
)}
最近通知
{notifications.slice(0, 5).map((n) => (
{n.title}
{n.content}
))}
); }