fix: remove PermissionButton wrappers from Upload components

This commit is contained in:
2026-07-05 21:37:47 +08:00
parent 940b587df9
commit b77e5a2f50
7 changed files with 197 additions and 268 deletions

View File

@@ -330,27 +330,25 @@ const RoomsPage: React.FC = () => {
>
宿
</PermissionButton>
<PermissionButton permission="room:create" type="text">
<Upload
accept=".xlsx,.xls"
showUploadList={false}
customRequest={async ({ file, onSuccess, onError }: any) => {
try {
const res: any = await api.post('/rooms/import', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});
message.success(res.message);
onSuccess?.(res);
fetchData();
} catch (e: any) {
message.error(e?.message || '导入失败');
onError?.(e);
}
}}
>
<Button icon={<UploadOutlined />}>Excel</Button>
</Upload>
</PermissionButton>
<Upload
accept=".xlsx,.xls"
showUploadList={false}
customRequest={async ({ file, onSuccess, onError }: any) => {
try {
const res: any = await api.post('/rooms/import', formData, {
headers: { 'Content-Type': 'multipart/form-data' },
});
message.success(res.message);
onSuccess?.(res);
fetchData();
} catch (e: any) {
message.error(e?.message || '导入失败');
onError?.(e);
}
}}
>
<Button icon={<UploadOutlined />}>Excel</Button>
</Upload>
<PermissionButton
permission="room:view"
icon={<DownloadOutlined />}