feat: edit show

master
guofei 2024-06-24 18:56:56 +08:00
parent fa7e0b0964
commit c6d594216e
2 changed files with 56 additions and 48 deletions

View File

@ -61,16 +61,20 @@ const Page = () => {
align: 'center', align: 'center',
hideInSearch: true, hideInSearch: true,
render: (_, record: User.UserItem) => { render: (_, record: User.UserItem) => {
const isExpired = Reflect.has(record, 'isExpired') && record.isExpired === true;
return ( return (
<Button <>
type="link" <Button
onClick={() => { type="link"
setEditRow(record); className={`${isExpired ? 'text-[red] font-bold' : ''} `}
setUserDetailsVisible(true); onClick={() => {
}} setEditRow(record);
> setUserDetailsVisible(true);
{record.email} }}
</Button> >
{record.email} {isExpired && <span></span>}
</Button>
</>
); );
}, },
}, },
@ -204,51 +208,54 @@ const Page = () => {
dataIndex: 'option', dataIndex: 'option',
valueType: 'option', valueType: 'option',
align: 'center', align: 'center',
render: (_: React.ReactNode, record: User.UserItem) => ( render: (_: React.ReactNode, record: User.UserItem) => {
<div className="space-x-4"> const isExpired = !record.packageId || (Reflect.has(record, 'isExpired') && record.isExpired === true);
{!record.packageId && ( return (
<div className="space-x-4">
{isExpired && (
<Button
key={'openPackage'}
type="primary"
onClick={() => {
setEditRow(record);
setOpenPackageVisible(true);
}}
>
</Button>
)}
<Button <Button
key={'openPackage'} className="app-btn warning"
key={'changeStatus'}
type="primary" type="primary"
onClick={() => { onClick={() => {
setEditRow(record); handleChangeUserStatus(record);
setOpenPackageVisible(true);
}} }}
> >
{record.enabled ? '禁用' : '启用'}
</Button> </Button>
)} <Button
<Button type="primary"
className="app-btn warning" danger
key={'changeStatus'} key={'delUser'}
type="primary" onClick={() => {
onClick={() => { modal.confirm({
handleChangeUserStatus(record); title: '提示',
}} content: '确定要删除该用户?',
> async onOk() {
{record.enabled ? '禁用' : '启用'} const flag = await delUxUserAPI(record.id);
</Button> if (flag.code === 200) {
<Button tableRef.current?.reload();
type="primary" }
danger },
key={'delUser'} });
onClick={() => { }}
modal.confirm({ >
title: '提示',
content: '确定要删除该用户?', </Button>
async onOk() { </div>
const flag = await delUxUserAPI(record.id); );
if (flag.code === 200) { },
tableRef.current?.reload();
}
},
});
}}
>
</Button>
</div>
),
}, },
]; ];

View File

@ -15,6 +15,7 @@ declare namespace User {
packageId?: string; packageId?: string;
expired?: string; expired?: string;
isExpired?: boolean | null;
// 用户来源 1. ux 注册 2. 后台创建 // 用户来源 1. ux 注册 2. 后台创建
userSource?: number; userSource?: number;
// 用户总空间 // 用户总空间