Commit a3bfb14b by zhaochengxiang

地图调整

parent dce4bc47
...@@ -84,5 +84,9 @@ div[id^='__qiankun_microapp_wrapper_'] { ...@@ -84,5 +84,9 @@ div[id^='__qiankun_microapp_wrapper_'] {
background-color: transparent !important; background-color: transparent !important;
} }
.yy-card-bordered {
border-color: #333333 !important;
}
...@@ -217,7 +217,6 @@ class Relation extends React.Component { ...@@ -217,7 +217,6 @@ class Relation extends React.Component {
const nodeId = node.get('id'); const nodeId = node.get('id');
const model = node.getModel(); const model = node.getModel();
console.log('model', model);
if (model.dbType==='Dir') { if (model.dbType==='Dir') {
const children = model.children; const children = model.children;
if (!children && loadMoreData) { if (!children && loadMoreData) {
......
.map-square-item { .map-square-item {
.yy-card-head { .yy-card-head {
background-color: #ff4d4f !important; background-color: #f4856f !important;
.yy-card-head-title { .yy-card-head-title {
color: #fff !important; color: #fff !important;
font-size: 20px !important;
font-weight: bold !important;
:hover { :hover {
color: #1890ff; color: #1890ff;
} }
} }
} }
.yy-card-body {
p {
color: #1890ff !important;
font-size: 18px !important;
}
}
} }
\ No newline at end of file
...@@ -94,7 +94,6 @@ class MapContent extends React.Component { ...@@ -94,7 +94,6 @@ class MapContent extends React.Component {
} }
onSquareItemClick = (item) => { onSquareItemClick = (item) => {
const { tableModelData } = this.state;
if (!item.children) { if (!item.children) {
dispatchLatest({ dispatchLatest({
type: 'map.getTableModelByDirIid', type: 'map.getTableModelByDirIid',
...@@ -103,14 +102,12 @@ class MapContent extends React.Component { ...@@ -103,14 +102,12 @@ class MapContent extends React.Component {
this.convertRemoteData(data||[]); this.convertRemoteData(data||[]);
item.children = (data||[]); item.children = (data||[]);
this.setSquareGraphState(item); this.setSquareGraphState(item);
this.setAllTreeGraphState(tableModelData);
} }
}) })
return; return;
} }
this.setSquareGraphState(item); this.setSquareGraphState(item);
this.setAllTreeGraphState(tableModelData);
} }
onBreadcrumbItemClick = (content, index) => { onBreadcrumbItemClick = (content, index) => {
...@@ -141,7 +138,7 @@ class MapContent extends React.Component { ...@@ -141,7 +138,7 @@ class MapContent extends React.Component {
} }
render() { render() {
const { diagram, topic } = this.props; const { type, topic } = this.props;
const { curTableModelData, breadcrumbContents, orgModelData , treeModelData, relationModelData, loading, orgChildData, treeChildData, relationChildData, parentNodeId } = this.state; const { curTableModelData, breadcrumbContents, orgModelData , treeModelData, relationModelData, loading, orgChildData, treeChildData, relationChildData, parentNodeId } = this.state;
let groups = []; let groups = [];
...@@ -156,7 +153,7 @@ class MapContent extends React.Component { ...@@ -156,7 +153,7 @@ class MapContent extends React.Component {
{ {
loading ? <Spin /> : <> loading ? <Spin /> : <>
{ {
diagram==='square' && <> type==='square' && <>
{ {
breadcrumbContents && breadcrumbContents.length>1 && <Breadcrumb className='mb-3'> breadcrumbContents && breadcrumbContents.length>1 && <Breadcrumb className='mb-3'>
{ {
...@@ -194,30 +191,30 @@ class MapContent extends React.Component { ...@@ -194,30 +191,30 @@ class MapContent extends React.Component {
</> </>
} }
{ {
diagram==='org' && <Org type==='org' && <Org
data={orgModelData} data={orgModelData}
parentNodeId={parentNodeId} parentNodeId={parentNodeId}
childData={orgChildData} childData={orgChildData}
type={`${topic.id||''}${diagram}`} type={`${topic.id||''}${type}`}
{...this.props} {...this.props}
loadMoreData={this.loadMoreData} loadMoreData={this.loadMoreData}
/> />
} }
{ {
diagram==='tree' && <Tree type==='tree' && <Tree
data={treeModelData} data={treeModelData}
parentNodeId={parentNodeId} parentNodeId={parentNodeId}
childData={treeChildData} childData={treeChildData}
type={`${topic.id||''}${diagram}`} type={`${topic.id||''}${type}`}
{...this.props} {...this.props}
loadMoreData={this.loadMoreData} /> loadMoreData={this.loadMoreData} />
} }
{ {
diagram==='relation' && <Relation type==='relation' && <Relation
data={relationModelData} data={relationModelData}
parentNodeId={parentNodeId} parentNodeId={parentNodeId}
childData={relationChildData} childData={relationChildData}
type={`${topic.id||''}${diagram}`} type={`${topic.id||''}${type}`}
{...this.props} {...this.props}
loadMoreData={this.loadMoreData} /> loadMoreData={this.loadMoreData} />
} }
......
import React from 'react'; import React from 'react';
import { Tabs, Radio, Spin } from 'antd'; import { Tabs, Spin, Select } from 'antd';
import MapContent from './MapContent'; import MapContent from './MapContent';
import { dispatchLatest } from '../../../model'; import { dispatchLatest } from '../../../model';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const { Option } = Select;
const graphModes = [
{
title: '方块图',
key: 'square'
},
{
title: '组织图',
key: 'org',
},
{
title: '树形图',
key: 'tree',
},
{
title: '关系图',
key: 'relation'
}
];
class Map extends React.Component { class Map extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
diagram: 'square', type: 'square',
tabKey: '0', tabKey: '0',
loadingTopics: false, loadingTopics: false,
topics: null topics: null
...@@ -36,8 +56,8 @@ class Map extends React.Component { ...@@ -36,8 +56,8 @@ class Map extends React.Component {
}) })
} }
onRadioChange = e => { onTypeChange = value => {
this.setState({ diagram: e.target.value }); this.setState({ type: value||'' });
}; };
onTabChange = activeKey => { onTabChange = activeKey => {
...@@ -45,7 +65,7 @@ class Map extends React.Component { ...@@ -45,7 +65,7 @@ class Map extends React.Component {
} }
render() { render() {
const { diagram, tabKey, topics, loadingTopics } = this.state; const { type, tabKey, topics, loadingTopics } = this.state;
return ( return (
<div style={{ backgroundColor: '#fff', height: '100%' }}> <div style={{ backgroundColor: '#fff', height: '100%' }}>
{ {
...@@ -57,13 +77,21 @@ class Map extends React.Component { ...@@ -57,13 +77,21 @@ class Map extends React.Component {
centered centered
style={{ height: '100%' }} style={{ height: '100%' }}
tabBarExtraContent={{ tabBarExtraContent={{
left: <Radio.Group className='m-3' size='small' value={diagram} onChange={this.onRadioChange} > left: <div className='ml-3' style={{ width: 120, marginRight: 50 }} ></div>,
<Radio.Button value='square'>方块图</Radio.Button> right: (
<Radio.Button value='org'>组织图</Radio.Button> <Select
<Radio.Button value='tree'>树形图</Radio.Button> value={type}
<Radio.Button value='relation'>关系图</Radio.Button> className='mr-3'
</Radio.Group>, style={{ width: 120, marginLeft: 50 }}
right: <div style={{ width: 172 }}></div> onChange={this.onTypeChange}
>
{
graphModes && graphModes.map((mode, index) => {
return <Option key={index} value={mode.key||''}>{mode.title||''}</Option>
})
}
</Select>
)
}} }}
onChange={this.onTabChange} onChange={this.onTabChange}
> >
...@@ -71,7 +99,7 @@ class Map extends React.Component { ...@@ -71,7 +99,7 @@ class Map extends React.Component {
topics && topics.map((topic, index) => { topics && topics.map((topic, index) => {
return ( return (
<TabPane tab={topic.name||''} key={index.toString()} className='p-3' style={{ height: '100%' }}> <TabPane tab={topic.name||''} key={index.toString()} className='p-3' style={{ height: '100%' }}>
{ tabKey===index.toString() && <MapContent diagram={diagram} topic={topic} {...this.props} /> } { tabKey===index.toString() && <MapContent type={type} topic={topic} {...this.props} /> }
</TabPane> </TabPane>
); );
}) })
......
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