diff --git a/web/client/src/layout/components/header/index.js b/web/client/src/layout/components/header/index.js
index 066188d8..35b5a83b 100644
--- a/web/client/src/layout/components/header/index.js
+++ b/web/client/src/layout/components/header/index.js
@@ -66,7 +66,7 @@ const Header = props => {
>
-
{user.name}
+ {user?.name}
}
>
{/* }>
diff --git a/web/client/src/sections/organization/containers/user.js b/web/client/src/sections/organization/containers/user.js
index c89563e2..e2c93dd0 100644
--- a/web/client/src/sections/organization/containers/user.js
+++ b/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) => {
,
{
- delUsers([record.id])
- }}
+ onConfirm={() => { conFirmHandler(record) }}
disabled={editAble}
>