feat(操作统计): 人员筛选增加全选/全不选按钮

This commit is contained in:
2026-08-28 13:33:08 +08:00
parent 5722fe159a
commit 554608b948

View File

@ -356,6 +356,9 @@ export default function AdminDashboard() {
return next;
});
};
// 全选 / 全不选
const selectAllUsers = () => setOpFilterUsers(new Set(opStats.map(u => u.user_id)));
const clearAllUsers = () => setOpFilterUsers(new Set());
// 表头升降序:无 → 升序 → 降序 → 无
const toggleOpSort = (key: string) => {
@ -707,11 +710,17 @@ export default function AdminDashboard() {
{/* 人员选择 — 人名宫格多选 */}
<div className="mb-4">
<div className="mb-2 flex items-center justify-between">
<span className="text-xs text-gray-400"> = </span>
<button onClick={() => setOpFilterUsers(new Set())}
className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${opFilterUsers.size === 0 ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`}>
</button>
<span className="text-xs text-gray-400"></span>
<div className="flex gap-1">
<button onClick={selectAllUsers}
className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${opFilterUsers.size > 0 && opFilterUsers.size === opStats.length ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`}>
</button>
<button onClick={clearAllUsers}
className={`rounded-full px-3 py-1 text-xs font-medium transition-colors ${opFilterUsers.size === 0 ? "bg-blue-600 text-white" : "bg-gray-100 text-gray-600 hover:bg-gray-200"}`}>
</button>
</div>
</div>
<div className="grid gap-1.5" style={{ gridTemplateColumns: "repeat(auto-fill, minmax(72px, 1fr))" }}>
{opStats.map(u => {