弹窗组件open外置并使用三元运算

This commit is contained in:
unknown
2023-08-03 09:42:13 +08:00
parent 354bd23fc9
commit eb1e82fc12
20 changed files with 1592 additions and 1552 deletions

View File

@@ -165,68 +165,70 @@ export const SystemAdminrolesUpdate: React.FC<PropInterface> = ({
return (
<>
<Drawer
title="编辑角色权限"
onClose={onCancel}
maskClosable={false}
open={open}
footer={
<Space className="j-r-flex">
<Button onClick={() => onCancel()}> </Button>
<Button onClick={() => form.submit()} type="primary">
</Button>
</Space>
}
width={634}
>
<div className="float-left mt-24">
<Form
form={form}
name="adminroles-update"
labelCol={{ span: 5 }}
wrapperCol={{ span: 19 }}
initialValues={{ remember: true }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
<Form.Item
label="角色名"
name="name"
rules={[{ required: true, message: "请输入角色名!" }]}
{open ? (
<Drawer
title="编辑角色权限"
onClose={onCancel}
maskClosable={false}
open={true}
footer={
<Space className="j-r-flex">
<Button onClick={() => onCancel()}> </Button>
<Button onClick={() => form.submit()} type="primary">
</Button>
</Space>
}
width={634}
>
<div className="float-left mt-24">
<Form
form={form}
name="adminroles-update"
labelCol={{ span: 5 }}
wrapperCol={{ span: 19 }}
initialValues={{ remember: true }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
<Input
style={{ width: 424 }}
allowClear
placeholder="请输入角色名"
/>
</Form.Item>
<Form.Item label="操作权限" name="action_ids">
<TreeSelect
style={{ width: 424 }}
listHeight={600}
treeCheckable={true}
placeholder="请选择权限"
multiple
allowClear
treeData={actions}
/>
</Form.Item>
<Form.Item label="数据权限" name="permission_ids">
<TreeSelect
style={{ width: 424 }}
listHeight={600}
treeCheckable={true}
placeholder="请选择权限"
multiple
allowClear
treeData={permissions}
/>
</Form.Item>
</Form>
</div>
</Drawer>
<Form.Item
label="角色名"
name="name"
rules={[{ required: true, message: "请输入角色名!" }]}
>
<Input
style={{ width: 424 }}
allowClear
placeholder="请输入角色名"
/>
</Form.Item>
<Form.Item label="操作权限" name="action_ids">
<TreeSelect
style={{ width: 424 }}
listHeight={600}
treeCheckable={true}
placeholder="请选择权限"
multiple
allowClear
treeData={actions}
/>
</Form.Item>
<Form.Item label="数据权限" name="permission_ids">
<TreeSelect
style={{ width: 424 }}
listHeight={600}
treeCheckable={true}
placeholder="请选择权限"
multiple
allowClear
treeData={permissions}
/>
</Form.Item>
</Form>
</div>
</Drawer>
) : null}
</>
);
};