feat: Cookie管理页面增加批量删除功能
This commit is contained in:
@@ -118,6 +118,22 @@ export default function CookiePage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteSelected = async () => {
|
||||
if (selectedRowKeys.length === 0) {
|
||||
message.warning('请先选择要删除的 Cookie');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const ids = selectedRowKeys.map((k) => Number(k));
|
||||
const res = await cookieApi.deleteBatch(ids);
|
||||
message.success(res.message);
|
||||
setSelectedRowKeys([]);
|
||||
loadCookies();
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
}
|
||||
};
|
||||
|
||||
// 筛选
|
||||
const filteredCookies = cookies.filter((c) => {
|
||||
if (!searchText) return true;
|
||||
@@ -199,6 +215,21 @@ export default function CookiePage() {
|
||||
>
|
||||
复制选中 {selectedRowKeys.length > 0 && `(${selectedRowKeys.length})`}
|
||||
</Button>
|
||||
{canExport && (
|
||||
<Popconfirm
|
||||
title={`确认删除选中的 ${selectedRowKeys.length} 条 Cookie?`}
|
||||
onConfirm={handleDeleteSelected}
|
||||
disabled={selectedRowKeys.length === 0}
|
||||
>
|
||||
<Button
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
disabled={selectedRowKeys.length === 0}
|
||||
>
|
||||
删除选中 {selectedRowKeys.length > 0 && `(${selectedRowKeys.length})`}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
{canExport && (
|
||||
<Dropdown
|
||||
menu={{
|
||||
|
||||
Reference in New Issue
Block a user