Commit 92c27947 authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 修复系统能力,无法回显组织机构

parent 4dc50ea6
......@@ -73,21 +73,21 @@ const getTreeNode = (treeData: any, targetNodeId: any) => {
if (!Array.isArray(treeData)) {
return null;
}
let result = {
id: '',
title: '',
}
for (let i = 0; i < treeData.length; i++) {
const item = treeData[i];
if (item.id === targetNodeId) {
return item;
return item
}
if (item.children) {
return getTreeNode(item.children, targetNodeId);
result = getTreeNode(item.children, targetNodeId);
}
}
return {
id: '',
title: '',
};
return result;
};
const MemberDetail: React.FC<{}> = () => {
......@@ -106,7 +106,6 @@ const MemberDetail: React.FC<{}> = () => {
} = useTreeTabs({
fetchMenuData: fetchOrgsTreeData,
});
const { treeData, handleSelect } = useTreeData({
fetchMenuData,
fetchItemDetailData: ({ id }) =>
......@@ -124,6 +123,7 @@ const MemberDetail: React.FC<{}> = () => {
const [buttonInfos, setButtonInfos] = useState<any>([]);
// 储存的数据权限选项
const [authInfos, setAuthInfos] = useState<any>({});
const modalRef = useRef<any>({})
const disabledCheckAuthConfig = useMemo(() => {
if (nodeRecord && authInfos[nodeRecord.id]) {
......@@ -329,7 +329,7 @@ const MemberDetail: React.FC<{}> = () => {
backIcon={<ReutrnEle description="返回" />}
className="addRepository"
title={pageTitles[pageStatus]}
extra={[extraButtons]}
extra={extraButtons}
>
<Card>
<Tabs type="card" className="black-tabs" onChange={changeTabs}>
......@@ -423,9 +423,9 @@ const MemberDetail: React.FC<{}> = () => {
<p style={{color: '#909399'}}>组织机构授权</p>
{disabledCheckAuthConfig.orgIds.map(v => {
const node = getTreeNode(plateformTreeData, v);
if (!node) return null;
if (!node || !node.id) return null;
return (
<div className="org-tag-container" key={v.id}>
<div className="org-tag-container" key={node.id}>
<Tag color={'#F4F5F7'} className="org-tag">
{node.title}
</Tag>
......@@ -450,6 +450,7 @@ const MemberDetail: React.FC<{}> = () => {
visible={orgModalVisible}
onSuccess={handleOrgSuccess}
onCancel={handleOrgCancel}
modalRef={modalRef}
/>
</Card>
</PageHeaderWrapper>
......
......@@ -13,6 +13,7 @@ export interface OrgModalProps {
selectKeys: any[],
onSuccess(selectKeys: any[]),
onCancel(),
modalRef: any,
}
......@@ -30,13 +31,14 @@ const OrgModal:React.FC<OrgModalProps> = (props) => {
useEffect(() => {
syncTreeActions.setSelectKeys(selectKeys)
}, [selectKeys])
}, [selectKeys, syncTreeActions])
return (
<Drawer
visible={visible}
closable={false}
placement='right'
width={600}
forceRender
>
<TabTree
fetchData = {params => fetchOrgsTreeData()}
......
......@@ -134,8 +134,8 @@ export const UserDetailSchema:ISchema = {
},
title: '关联角色'
},
}
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment