Browse Source

feat:删除自己退出登录

dev
zhaobing 2 years ago
parent
commit
df04b75109
  1. 2
      web/client/src/layout/components/header/index.js
  2. 16
      web/client/src/sections/organization/containers/user.js

2
web/client/src/layout/components/header/index.js

@ -66,7 +66,7 @@ const Header = props => {
>
<UserOutlined />
</div>
<div style={{ display: 'inline-block' }}>{user.name}</div>
<div style={{ display: 'inline-block' }}>{user?.name}</div>
</div>}
>
{/* <Menu.Item key="profile" icon={<UserOutlined />}>

16
web/client/src/sections/organization/containers/user.js

@ -13,7 +13,7 @@ import DepModal from '../components/depModal';
const TreeNode = Tree.TreeNode;
const UserManage = (props) => {
const { dispatch, loading, depMessage, depUser, clientHeight, user } = props
const { dispatch, loading, depMessage, depUser, clientHeight, user, actions } = props
const [modalVisible, setModalVisible] = useState(false);
const [modalType, setModalType] = useState();
const [modalRecord, setModalRecord] = useState();
@ -27,7 +27,7 @@ const UserManage = (props) => {
const [depCrumbs, setDepCrumbs] = useState([]);
const [depUserCopy, setDepUserCopy] = useState([])//用于存放除了自己的管理的数组,即自己不能调整自己是否为管理员
const [uid, setuid] = useState()
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'USERMANAGE')[0].isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'USERMANAGE')?.isshow === "true" ? true : '')//控制操作(新增删除等操作,对应权限的'不可编辑')是否可操作
const [depMessagedata, setdepMessagedata] = useState(depMessage)
//('depMessagedata', depMessagedata)
useEffect(async () => {
@ -87,6 +87,14 @@ const UserManage = (props) => {
setDepCrumbs(list)
}, [depSelectedKeys])
//删除自己退出登录
const conFirmHandler = (record) => {
delUsers([record.id])
if (user?.id === record.id) {
dispatch(actions.auth.logout(user));
history.push(`/signin`);
}
}
const columns =
[
{
@ -140,9 +148,7 @@ const UserManage = (props) => {
<Button type="link" onClick={() => { openModal('edit', record) }} disabled={editAble}>编辑</Button>,
<Popconfirm
title="确认删除?"
onConfirm={() => {
delUsers([record.id])
}}
onConfirm={() => { conFirmHandler(record) }}
disabled={editAble}
>
<Button type="link" disabled={editAble}>删除</Button>

Loading…
Cancel
Save