Merge pull request '修复已知问题' (#9) from feature/cl into master

Reviewed-on: #9
pull/13/head
liang.cheng 12 months ago
commit 67cfb21f72

@ -31,14 +31,21 @@ export default class DrawerComponents extends React.Component {
dataSource: [], dataSource: [],
columns: [], columns: [],
spinning: true, spinning: true,
showJob: true, showJob: false,
}; };
} }
componentDidMount() {} 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) { onButtonClick(event, d) {
if (d.children) { if (d.children) {
@ -63,7 +70,7 @@ export default class DrawerComponents extends React.Component {
// //
getDeatilDatas(params, type = 'chart', showJob = '1') { getDeatilDatas(params, type = 'chart', showJob = '1') {
this.setState({ spinning: true }); this.setState({ spinning: true, data: [], dataSource: [] });
d3.json( d3.json(
'/api/bs/hrmorganization/orgchart/getDepartmentDetail?' + '/api/bs/hrmorganization/orgchart/getDepartmentDetail?' +
qs.stringify({ detauleType: type, ...params, showJob }), qs.stringify({ detauleType: type, ...params, showJob }),
@ -72,7 +79,11 @@ export default class DrawerComponents extends React.Component {
if (type == 'chart') { if (type == 'chart') {
this.setState({ data: data.data, spinning: false }); this.setState({ data: data.data, spinning: false });
} else { } 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) => { showDrawer = (params) => {
const showJob = params.fclass == '0' ? '1' : '0'; this.getDeatilDatas(params, 'chart', '0');
this.getDeatilDatas(params, 'chart', showJob);
this.setState({ open: true, params: params }); this.setState({ open: true, params: params });
}; };
onClose = () => { onClose = () => {
this.setState({ open: false, detailType: 'chart', showJob: true }); this.setState({ open: false, detailType: 'chart', showJob: false });
}; };
changeDetail = () => { changeDetail = () => {
@ -372,17 +382,21 @@ export default class DrawerComponents extends React.Component {
<Dropdown overlay={menu}> <Dropdown overlay={menu}>
<Button type="primary">导出</Button> <Button type="primary">导出</Button>
</Dropdown> </Dropdown>
<img <Button type="primary" onClick={this.changeDetail}>
style={{ width: 36, height: 36, cursor: 'pointer' }} 切换
src="./img/change.png" </Button>
onClick={this.changeDetail}
/>
</Space> </Space>
} }
> >
{detailType == 'chart' ? ( {detailType == 'chart' ? (
data.length > 0 && ( <div className="svg-container">
<Spin size="large" spinning={spinning}> <Spin
size="large"
spinning={spinning}
tip="正在读取数据...."
className="loading-center"
/>
{data.length > 0 && (
<OrgChartComponent <OrgChartComponent
setChart={(chart) => (orgChart = chart)} setChart={(chart) => (orgChart = chart)}
setClick={(click) => (addNodeChildFunc = click)} setClick={(click) => (addNodeChildFunc = click)}
@ -394,14 +408,15 @@ export default class DrawerComponents extends React.Component {
nodeHeight={this.nodeHeightRender} nodeHeight={this.nodeHeightRender}
nodeContent={this.nodeContentRender} nodeContent={this.nodeContentRender}
/> />
</Spin> )}
) </div>
) : ( ) : (
<div style={{ padding: '0 20px' }}> <div style={{ padding: '0 20px' }}>
<Table <Table
dataSource={dataSource} dataSource={dataSource}
columns={columns} columns={columns}
scroll={{ y: 500 }} scroll={{ y: 600 }}
loading={spinning}
pagination={{ pagination={{
locale: { locale: {
// //

@ -2,3 +2,11 @@
width: 500px; width: 500px;
text-align: left; text-align: left;
} }
.loading-center {
position: absolute;
top: 50vh;
left: 50%;
margin-left: -8px;
margin-top: -8px;
}

Loading…
Cancel
Save