|
|
@ -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> |
|
|
|