diff --git a/src/components/drawer/index.jsx b/src/components/drawer/index.jsx index bea0e32..84ed0b6 100644 --- a/src/components/drawer/index.jsx +++ b/src/components/drawer/index.jsx @@ -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 { - + } > {detailType == 'chart' ? ( - data.length > 0 && ( - +
+ + {data.length > 0 && ( (orgChart = chart)} setClick={(click) => (addNodeChildFunc = click)} @@ -394,14 +408,15 @@ export default class DrawerComponents extends React.Component { nodeHeight={this.nodeHeightRender} nodeContent={this.nodeContentRender} /> - - ) + )} +
) : (