fix: remove nested button pattern in Rooms page (Popconfirm outside PermissionButton)
This commit is contained in:
@@ -222,18 +222,16 @@ const RoomsPage: React.FC = () => {
|
|||||||
render: (_: any, record: any) => (
|
render: (_: any, record: any) => (
|
||||||
<Space>
|
<Space>
|
||||||
{record.status === 'archived' ? (
|
{record.status === 'archived' ? (
|
||||||
<PermissionButton permission="room:edit">
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="确定恢复此宿舍?恢复后将重新出现在宿舍总览中。"
|
title="确定恢复此宿舍?恢复后将重新出现在宿舍总览中。"
|
||||||
onConfirm={() => handleRestore(record.id)}
|
onConfirm={() => handleRestore(record.id)}
|
||||||
okText="恢复"
|
okText="恢复"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button size="small" icon={<UndoOutlined />} type="link">
|
<PermissionButton permission="room:edit" size="small" icon={<UndoOutlined />} type="link">
|
||||||
恢复
|
恢复
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
|
</Popconfirm>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
@@ -255,19 +253,16 @@ const RoomsPage: React.FC = () => {
|
|||||||
>
|
>
|
||||||
编辑
|
编辑
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
<PermissionButton permission="room:delete">
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title="归档后不会删除数据,可随时恢复。有在住人员将无法归档。"
|
title="归档后不会删除数据,可随时恢复。有在住人员将无法归档。"
|
||||||
onConfirm={() => handleArchive(record.id)}
|
onConfirm={() => handleArchive(record.id)}
|
||||||
okText="归档"
|
okText="归档"
|
||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
>
|
>
|
||||||
<Button size="small" icon={<InboxOutlined />}>
|
<PermissionButton permission="room:delete" size="small" icon={<InboxOutlined />}>
|
||||||
归档
|
归档
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
</>
|
</Popconfirm>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
@@ -311,7 +306,6 @@ const RoomsPage: React.FC = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<PermissionButton permission="room:delete">
|
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={`确定批量归档选中的 ${selectedRowKeys.length} 间宿舍?(有在住人员的会跳过)`}
|
title={`确定批量归档选中的 ${selectedRowKeys.length} 间宿舍?(有在住人员的会跳过)`}
|
||||||
onConfirm={handleBatchDelete}
|
onConfirm={handleBatchDelete}
|
||||||
@@ -319,11 +313,10 @@ const RoomsPage: React.FC = () => {
|
|||||||
cancelText="取消"
|
cancelText="取消"
|
||||||
disabled={selectedRowKeys.length === 0}
|
disabled={selectedRowKeys.length === 0}
|
||||||
>
|
>
|
||||||
<Button danger icon={<DeleteOutlined />} disabled={selectedRowKeys.length === 0}>
|
<PermissionButton permission="room:delete" danger icon={<DeleteOutlined />} disabled={selectedRowKeys.length === 0}>
|
||||||
批量归档
|
批量归档
|
||||||
</Button>
|
|
||||||
</Popconfirm>
|
|
||||||
</PermissionButton>
|
</PermissionButton>
|
||||||
|
</Popconfirm>
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
permission="room:create"
|
permission="room:create"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -341,8 +334,6 @@ const RoomsPage: React.FC = () => {
|
|||||||
accept=".xlsx,.xls"
|
accept=".xlsx,.xls"
|
||||||
showUploadList={false}
|
showUploadList={false}
|
||||||
customRequest={async ({ file, onSuccess, onError }: any) => {
|
customRequest={async ({ file, onSuccess, onError }: any) => {
|
||||||
const formData = new FormData();
|
|
||||||
formData.append('file', file);
|
|
||||||
try {
|
try {
|
||||||
const res: any = await api.post('/rooms/import', formData, {
|
const res: any = await api.post('/rooms/import', formData, {
|
||||||
headers: { 'Content-Type': 'multipart/form-data' },
|
headers: { 'Content-Type': 'multipart/form-data' },
|
||||||
|
|||||||
Reference in New Issue
Block a user