修复已知问题
This commit is contained in:
parent
1a676ab4a8
commit
a884e58203
|
|
@ -31,14 +31,21 @@ export default class DrawerComponents extends React.Component {
|
|||
dataSource: [],
|
||||
columns: [],
|
||||
spinning: true,
|
||||
showJob: true,
|
||||
showJob: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {}
|
||||
|
||||
// 点击节点
|
||||
onNodeClick(node) {}
|
||||
onNodeClick(node) {
|
||||
if (node.ftype == '4') {
|
||||
window.open(
|
||||
`/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo/${node.id}`,
|
||||
'_blank',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onButtonClick(event, d) {
|
||||
if (d.children) {
|
||||
|
|
@ -63,7 +70,7 @@ export default class DrawerComponents extends React.Component {
|
|||
|
||||
//获取数据
|
||||
getDeatilDatas(params, type = 'chart', showJob = '1') {
|
||||
this.setState({ spinning: true });
|
||||
this.setState({ spinning: true, data: [], dataSource: [] });
|
||||
d3.json(
|
||||
'/api/bs/hrmorganization/orgchart/getDepartmentDetail?' +
|
||||
qs.stringify({ detauleType: type, ...params, showJob }),
|
||||
|
|
@ -72,7 +79,11 @@ export default class DrawerComponents extends React.Component {
|
|||
if (type == 'chart') {
|
||||
this.setState({ data: data.data, spinning: false });
|
||||
} else {
|
||||
this.setState({ dataSource: data.dataSource, columns: data.columns });
|
||||
this.setState({
|
||||
dataSource: data.dataSource,
|
||||
columns: data.columns,
|
||||
spinning: false,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -299,13 +310,12 @@ export default class DrawerComponents extends React.Component {
|
|||
};
|
||||
|
||||
showDrawer = (params) => {
|
||||
const showJob = params.fclass == '0' ? '1' : '0';
|
||||
this.getDeatilDatas(params, 'chart', showJob);
|
||||
this.getDeatilDatas(params, 'chart', '0');
|
||||
this.setState({ open: true, params: params });
|
||||
};
|
||||
|
||||
onClose = () => {
|
||||
this.setState({ open: false, detailType: 'chart', showJob: true });
|
||||
this.setState({ open: false, detailType: 'chart', showJob: false });
|
||||
};
|
||||
|
||||
changeDetail = () => {
|
||||
|
|
@ -372,17 +382,21 @@ export default class DrawerComponents extends React.Component {
|
|||
<Dropdown overlay={menu}>
|
||||
<Button type="primary">导出</Button>
|
||||
</Dropdown>
|
||||
<img
|
||||
style={{ width: 36, height: 36, cursor: 'pointer' }}
|
||||
src="./img/change.png"
|
||||
onClick={this.changeDetail}
|
||||
/>
|
||||
<Button type="primary" onClick={this.changeDetail}>
|
||||
切换
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{detailType == 'chart' ? (
|
||||
data.length > 0 && (
|
||||
<Spin size="large" spinning={spinning}>
|
||||
<div className="svg-container">
|
||||
<Spin
|
||||
size="large"
|
||||
spinning={spinning}
|
||||
tip="正在读取数据...."
|
||||
className="loading-center"
|
||||
/>
|
||||
{data.length > 0 && (
|
||||
<OrgChartComponent
|
||||
setChart={(chart) => (orgChart = chart)}
|
||||
setClick={(click) => (addNodeChildFunc = click)}
|
||||
|
|
@ -394,14 +408,15 @@ export default class DrawerComponents extends React.Component {
|
|||
nodeHeight={this.nodeHeightRender}
|
||||
nodeContent={this.nodeContentRender}
|
||||
/>
|
||||
</Spin>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ padding: '0 20px' }}>
|
||||
<Table
|
||||
dataSource={dataSource}
|
||||
columns={columns}
|
||||
scroll={{ y: 500 }}
|
||||
scroll={{ y: 600 }}
|
||||
loading={spinning}
|
||||
pagination={{
|
||||
locale: {
|
||||
// 翻页文本替换
|
||||
|
|
|
|||
|
|
@ -2,3 +2,11 @@
|
|||
width: 500px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.loading-center {
|
||||
position: absolute;
|
||||
top: 50vh;
|
||||
left: 50%;
|
||||
margin-left: -8px;
|
||||
margin-top: -8px;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue