Commit 3287dfa9 by zhaochengxiang

数据地图

parent 90accdb2
...@@ -30,7 +30,7 @@ class Tree extends React.Component { ...@@ -30,7 +30,7 @@ class Tree extends React.Component {
], ],
}, },
defaultNode: { defaultNode: {
size: 26, size: 9,
anchorPoints: [ anchorPoints: [
[0, 0.5], [0, 0.5],
[1, 0.5], [1, 0.5],
...@@ -65,7 +65,7 @@ class Tree extends React.Component { ...@@ -65,7 +65,7 @@ class Tree extends React.Component {
// const node = e.item; // const node = e.item;
// const model = node.getModel(); // const model = node.getModel();
history && history.push(`${ContextPath}/home`); // history && history.push(`${ContextPath}/home`);
}); });
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
......
import React from 'react'; import React from 'react';
import { Row, Col, Breadcrumb } from 'antd'; import { Row, Col, Breadcrumb, Spin } from 'antd';
import { HomeOutlined } from '@ant-design/icons'; import { HomeOutlined } from '@ant-design/icons';
import SquareItem from './Component/SquareItem'; import SquareItem from './Component/SquareItem';
...@@ -26,13 +26,13 @@ class MapContent extends React.Component { ...@@ -26,13 +26,13 @@ class MapContent extends React.Component {
componentDidMount() { componentDidMount() {
const { tid } = this.props; const { tid } = this.props;
this.setState({ loadingTableModel: true }, () => { this.setState({ loading: true }, () => {
dispatchLatest({ dispatchLatest({
type: 'map.getTableAndTreeModelByTid', type: 'map.getTableAndTreeModelByTid',
payload: { dirId: tid }, payload: { dirId: tid },
callback: data => { callback: data => {
this.setState({ this.setState({
loadingTableModel: false, loading: false,
tableModelData: data.tables||[], tableModelData: data.tables||[],
curTableModelData: data.tables||[], curTableModelData: data.tables||[],
treeModelData: data.trees||{}, treeModelData: data.trees||{},
...@@ -99,7 +99,7 @@ class MapContent extends React.Component { ...@@ -99,7 +99,7 @@ class MapContent extends React.Component {
render() { render() {
const { diagram, type } = this.props; const { diagram, type } = this.props;
const { curTableModelData, breadcrumbContents, treeModelData, relationModelData } = this.state; const { curTableModelData, breadcrumbContents, treeModelData, relationModelData, loading } = this.state;
let groups = []; let groups = [];
if (curTableModelData) { if (curTableModelData) {
...@@ -111,50 +111,54 @@ class MapContent extends React.Component { ...@@ -111,50 +111,54 @@ class MapContent extends React.Component {
return ( return (
<> <>
{ {
diagram==='square' && <> loading ? <Spin /> : <>
{ {
breadcrumbContents && breadcrumbContents.length>1 && <Breadcrumb className='mb-3'> diagram==='square' && <>
{ {
breadcrumbContents.map((content, index) => { breadcrumbContents && breadcrumbContents.length>1 && <Breadcrumb className='mb-3'>
{
breadcrumbContents.map((content, index) => {
return (
<Breadcrumb.Item key={index}>
{
index===0 ? <HomeOutlined onClick={() => { this.onBreadcrumbItemClick(content, index); }} /> : ((index===breadcrumbContents.length-1) ? <span>{content.name||''}</span> : <span className='pointer' onClick={() => { this.onBreadcrumbItemClick(content, index); }}>
{content.name||''}
</span>)
}
</Breadcrumb.Item>
)
})
}
</Breadcrumb>
}
{
groups && groups.map((group, index) => {
return ( return (
<Breadcrumb.Item key={index}> <Row gutter={10} key={index} className={index===0?'':'mt-3'}>
{ {
index===0 ? <HomeOutlined onClick={() => { this.onBreadcrumbItemClick(content, index); }} /> : ((index===breadcrumbContents.length-1) ? <span>{content.name||''}</span> : <span className='pointer' onClick={() => { this.onBreadcrumbItemClick(content, index); }}> group && group.map((item, _index) => {
{content.name||''} return (
</span>) <Col key={_index} span={24/column}>
<SquareItem item={item} onClick={this.onSquareItemClick} {...this.props} />
</Col>
)
})
} }
</Breadcrumb.Item> </Row>
) )
}) })
} }
</Breadcrumb> </>
} }
{ {
groups && groups.map((group, index) => { diagram==='tree' && <Tree data={treeModelData} type={type} {...this.props} />
return (
<Row gutter={10} key={index} className={index===0?'':'mt-3'}>
{
group && group.map((item, _index) => {
return (
<Col key={_index} span={24/column}>
<SquareItem item={item} onClick={this.onSquareItemClick} {...this.props} />
</Col>
)
})
}
</Row>
)
})
} }
</> {
} diagram==='relation' && <Relation data={relationModelData} type={type} {...this.props} />
{ }
diagram==='tree' && <Tree data={treeModelData} type={type} {...this.props} /> </>
}
{
diagram==='relation' && <Relation data={relationModelData} type={type} {...this.props} />
} }
</> </>
); );
} }
} }
......
import React from 'react'; import React from 'react';
import { Tabs, Radio } from 'antd'; import { Tabs, Radio, Spin } from 'antd';
import MapContent from './MapContent'; import MapContent from './MapContent';
import { dispatchLatest } from '../../../model'; import { dispatchLatest } from '../../../model';
...@@ -42,9 +42,11 @@ class Map extends React.Component { ...@@ -42,9 +42,11 @@ class Map extends React.Component {
} }
render() { render() {
const { diagram, tabKey, topics } = this.state; const { diagram, tabKey, topics, loadingTopics } = this.state;
return ( return (
<div style={{ backgroundColor: '#fff', height: '100%' }}> <div style={{ backgroundColor: '#fff', height: '100%' }}>
{
loadingTopics ? <Spin /> : <>
{ {
topics && topics.length>0 && <Tabs topics && topics.length>0 && <Tabs
activeKey={tabKey} activeKey={tabKey}
...@@ -72,6 +74,8 @@ class Map extends React.Component { ...@@ -72,6 +74,8 @@ class Map extends React.Component {
} }
</Tabs> </Tabs>
} }
</>
}
</div> </div>
); );
} }
......
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