政务数据资源中心(Government data Resource center) 03专项3期主要建设内容
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
2.4 KiB

import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
import { Tabs } from 'antd';
import BusinessDatabaseTable from './businessDatabaseTable';
import BusinessFilesTable from './businessFilesTable';
import BusinessRestapisTable from './businessRestapisTable';
const BusinessTab = (props) => {
const { resourceCatalogId, resourceCatalogKey, resourceCatalogPath, actions, dispatch, isAdmin } = props;
const [activeKey, setActiveKey] = useState('databases');
useEffect(() => {
setActiveKey('databases');
}, [resourceCatalogId]);
const onTabChange = (key) => {
setActiveKey(key)
}
return <div>
<Tabs defaultActiveKey="databases"
onChange={onTabChange}
activeKey={activeKey}
items={[
{
label: <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>,
key: 'databases'
},
{
label: <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文件&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>,
key: 'files'
},
{
label: <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;接口&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>,
key: 'restapis'
}
]}>
</Tabs>
{
activeKey === 'databases' && resourceCatalogId ? <BusinessDatabaseTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
activeKey === 'files' && resourceCatalogId ? <BusinessFilesTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
activeKey === 'restapis' && resourceCatalogId ? <BusinessRestapisTable resourceCatalogId={resourceCatalogId}
resourceCatalogKey={resourceCatalogKey} resourceCatalogPath={resourceCatalogPath} isAdmin={isAdmin} /> :
null
}
</div>
}
function mapStateToProps(state) {
const { global, auth } = state;
return {
user: auth.user,
actions: global.actions
};
}
export default connect(mapStateToProps)(BusinessTab)