|
@ -4,10 +4,12 @@ import { Spin, Row, Col, Tree, Tooltip, Input } from 'antd'; |
|
|
import BusinessTab from './businessTab'; |
|
|
import BusinessTab from './businessTab'; |
|
|
let expandedKeysData = []; |
|
|
let expandedKeysData = []; |
|
|
let allTreeNodeKeys = []; |
|
|
let allTreeNodeKeys = []; |
|
|
|
|
|
let resourceCatalogRawData = []; |
|
|
|
|
|
|
|
|
const BusinessMetadata = (props) => { |
|
|
const BusinessMetadata = (props) => { |
|
|
const { user, dispatch, actions, clientHeight, isRequesting, resourceCatalog } = props; |
|
|
const { user, dispatch, actions, clientHeight, isRequesting, resourceCatalog } = props; |
|
|
const { metadataManagement } = actions; |
|
|
const { metadataManagement } = actions; |
|
|
|
|
|
const [isAdmin, setIsAdmin] = useState(false); |
|
|
const [resourceCatalogData, setResourceCatalogData] = useState([]); |
|
|
const [resourceCatalogData, setResourceCatalogData] = useState([]); |
|
|
const [selectedKeys, setSelectedKeys] = useState([]); |
|
|
const [selectedKeys, setSelectedKeys] = useState([]); |
|
|
const [expandedKeys, setExpandedKeys] = useState([]); |
|
|
const [expandedKeys, setExpandedKeys] = useState([]); |
|
@ -23,6 +25,7 @@ const BusinessMetadata = (props) => { |
|
|
dispatch(metadataManagement.getResourceCatalog()).then(res => { |
|
|
dispatch(metadataManagement.getResourceCatalog()).then(res => { |
|
|
const { data } = res.payload; |
|
|
const { data } = res.payload; |
|
|
if (res.success) { |
|
|
if (res.success) { |
|
|
|
|
|
resourceCatalogRawData = data; |
|
|
allTreeNodeKeys = [] |
|
|
allTreeNodeKeys = [] |
|
|
const resourceCatalogData = getTreeNodeData(data, null, 'rc', [], null); |
|
|
const resourceCatalogData = getTreeNodeData(data, null, 'rc', [], null); |
|
|
setResourceCatalogData(resourceCatalogData); |
|
|
setResourceCatalogData(resourceCatalogData); |
|
@ -44,7 +47,10 @@ const BusinessMetadata = (props) => { |
|
|
const keyArr = selectedData[0].split('-'); |
|
|
const keyArr = selectedData[0].split('-'); |
|
|
keyArr.shift();//['rc-2-5']->返回'rc';keyArr:['2','5']
|
|
|
keyArr.shift();//['rc-2-5']->返回'rc';keyArr:['2','5']
|
|
|
const allExpandedKeys = allTreeNodeKeys.filter(k => keyArr.includes(k.id.toString())); |
|
|
const allExpandedKeys = allTreeNodeKeys.filter(k => keyArr.includes(k.id.toString())); |
|
|
setResourceCatalogId(keyArr.pop()); |
|
|
const resourceCatalogId = keyArr.pop(); |
|
|
|
|
|
setResourceCatalogId(resourceCatalogId); |
|
|
|
|
|
setIsAdmin(user?.username === 'SuperAdmin' |
|
|
|
|
|
|| (user?.role === '系统管理员' && user?.orgId == resourceCatalogRawData.find(a => a.id == resourceCatalogId)?.orgId)); |
|
|
setResourceCatalogKey(selectedData[0]); |
|
|
setResourceCatalogKey(selectedData[0]); |
|
|
const resourceCatalogPath = allExpandedKeys.map(a => a.name); |
|
|
const resourceCatalogPath = allExpandedKeys.map(a => a.name); |
|
|
setResourceCatalogPath(resourceCatalogPath); |
|
|
setResourceCatalogPath(resourceCatalogPath); |
|
@ -161,7 +167,8 @@ const BusinessMetadata = (props) => { |
|
|
<Col style={{ width: 'calc(100% - 240px)' }}> |
|
|
<Col style={{ width: 'calc(100% - 240px)' }}> |
|
|
<BusinessTab resourceCatalogId={resourceCatalogId} |
|
|
<BusinessTab resourceCatalogId={resourceCatalogId} |
|
|
resourceCatalogKey={resourceCatalogKey} |
|
|
resourceCatalogKey={resourceCatalogKey} |
|
|
resourceCatalogPath={resourceCatalogPath} /> |
|
|
resourceCatalogPath={resourceCatalogPath} |
|
|
|
|
|
isAdmin={isAdmin} /> |
|
|
</Col> |
|
|
</Col> |
|
|
</Row> |
|
|
</Row> |
|
|
</Spin> |
|
|
</Spin> |
|
|