优化:禁止自己删除自己
This commit is contained in:
@@ -7,6 +7,8 @@ import { getRoleListAPI } from '@/api/Role'
|
||||
import type { FilterForm, FilterUser, User } from '@/types/app/user';
|
||||
import { Role } from '@/types/app/role';
|
||||
|
||||
import { useUserStore } from '@/stores'
|
||||
|
||||
import { titleSty } from '@/styles/sty';
|
||||
import Title from '@/components/Title';
|
||||
import logo from '@/images/logo/logo.png';
|
||||
@@ -16,6 +18,8 @@ const UserPage = () => {
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [btnLoading, setBtnLoading] = useState(false)
|
||||
|
||||
const store = useUserStore()
|
||||
|
||||
const [userList, setUserList] = useState<User[]>([]);
|
||||
const [roleList, setRoleList] = useState<Role[]>([]);
|
||||
const [user, setUser] = useState<User>({} as User)
|
||||
@@ -96,7 +100,7 @@ const UserPage = () => {
|
||||
<Button onClick={() => editUserData(record.id!)}>修改</Button>
|
||||
|
||||
<Popconfirm title="警告" description="你确定要删除吗" okText="确定" cancelText="取消" onConfirm={() => delUserData(record.id!)}>
|
||||
<Button type="primary" danger>删除</Button>
|
||||
<Button type="primary" danger disabled={record.id === store.user.id}>删除</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user