Commit eda453d9 by zhaochengxiang

资产地图刷新效果

parent bde8c08a
......@@ -288,7 +288,7 @@ class Org extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
const { childData, parentNodeId } = this.props;
const { childData, parentNodeId, data } = this.props;
if (parentNodeId && parentNodeId!== prevProps.parentNodeId) {
const parentData = graph.findDataById(parentNodeId);
......@@ -302,7 +302,7 @@ class Org extends React.Component {
collapsed: false,
});
} else {
} else if (data !== prevProps.data) {
this.layoutGraph();
}
}
......
......@@ -304,7 +304,7 @@ class Relation extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
const { childData, parentNodeId } = this.props;
const { childData, parentNodeId, data } = this.props;
if (parentNodeId && parentNodeId !== prevProps.parentNodeId) {
const parentData = graph.findDataById(parentNodeId);
......@@ -326,7 +326,7 @@ class Relation extends React.Component {
collapsed: false,
});
} else {
} else if (data !== prevProps.data) {
this.layoutGraph();
}
}
......
......@@ -249,7 +249,7 @@ class Tree extends React.Component {
}
componentDidUpdate(prevProps, prevState){
const { childData, parentNodeId } = this.props;
const { childData, parentNodeId, data } = this.props;
if (parentNodeId && parentNodeId!== prevProps.parentNodeId) {
const parentData = graph.findDataById(parentNodeId);
......@@ -263,7 +263,7 @@ class Tree extends React.Component {
collapsed: false,
});
} else {
} else if (data !== prevProps.data) {
this.layoutGraph();
}
}
......
......@@ -15,7 +15,6 @@ class MapContent extends React.Component {
constructor(props) {
super(props);
this.state = {
loading: false,
curTableModelData: null,
orgModelData: null,
orgChildData: null,
......@@ -63,31 +62,23 @@ class MapContent extends React.Component {
queryAllDirectoryAsTreeByDirLevel = (level) => {
const { topic } = this.props;
this.setState({ loading: true }, () => {
dispatchLatest({
type: 'map.queryAllDirectoryAsTreeByDirLevel',
payload: { dirId: topic.id, dirLevel: level },
callback: data => {
dispatchLatest({
type: 'map.queryAllDirectoryAsTreeByDirLevel',
payload: { dirId: topic.id, dirLevel: level },
callback: data => {
this.convertRemoteData(data);
this.setState({
loading: false,
curTableModelData: data||[],
breadcrumbContents: [{ data: data||[] }]
}, () => {
const _treeData = this.convertTreeModelData(data||[]);
this.setState({
//深拷贝
orgModelData: JSON.parse(JSON.stringify(_treeData)),
treeModelData: JSON.parse(JSON.stringify(_treeData)),
relationModelData: JSON.parse(JSON.stringify(_treeData))
});
});
},
error: () => {
this.setState({ loading: false })
}
})
this.convertRemoteData(data);
const _treeData = this.convertTreeModelData(data||[]);
this.setState({
curTableModelData: data||[],
breadcrumbContents: [{ data: data||[] }],
//深拷贝
orgModelData: JSON.parse(JSON.stringify(_treeData)),
treeModelData: JSON.parse(JSON.stringify(_treeData)),
relationModelData: JSON.parse(JSON.stringify(_treeData))
});
}
})
}
......@@ -244,7 +235,6 @@ class MapContent extends React.Component {
parentNodeId={parentNodeId}
childData={orgChildData}
type={`${topic.id||''}${type}`}
{...this.props}
loadMoreData={this.loadMoreData}
/>
}
......@@ -254,7 +244,6 @@ class MapContent extends React.Component {
parentNodeId={parentNodeId}
childData={treeChildData}
type={`${topic.id||''}${type}`}
{...this.props}
loadMoreData={this.loadMoreData} />
}
{
......@@ -263,7 +252,6 @@ class MapContent extends React.Component {
parentNodeId={parentNodeId}
childData={relationChildData}
type={`${topic.id||''}${type}`}
{...this.props}
loadMoreData={this.loadMoreData} />
}
{
......
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