import '../../style/orgChart.less'; import React, { Component } from 'react'; import { inject, observer } from 'mobx-react'; import { WeaTop, WeaAlertPage, WeaRightMenu, WeaNewScroll, } from 'ecCom'; import { Spin } from 'antd'; import { i18n } from '../../public/i18n'; import Chart from './Chart'; @inject('hrmOrgChart') @observer export default class OrgChart extends Component { constructor(props) { super(props); } componentDidMount() { this.init(); window.addEventListener('message', this.messageHandle, false); } componentWillUnmount() { window.removeEventListener('message', this.messageHandle, false); } componentWillReceiveProps(nextProps) { if (this.props.location.key !== nextProps.location.key) { this.init(true); } } messageHandle = (e) => { const { hrmOrgChart: store } = this.props; if (e.data.act == 'initOrgChart') { store.onInitOrgChart(e.data.status); } else if (e.data.act == 'callChild') { store.showSpin(e.data.status); } } init = (refresh = false) => { const { hrmOrgChart: store } = this.props; const { initData } = store; initData(refresh); } render() { const { hrmOrgChart: store } = this.props; const { containerInitFinished, topBtnAndMenu, spinning } = store; const { btns, menus } = topBtnAndMenu(); const topProps = { title: i18n.module.orgChart(), icon: , iconBgcolor: '#217346', showDropIcon: true, buttons: btns, dropMenuDatas: menus } return (