import { inject, observer, } from 'mobx-react'; import { toJS } from 'mobx'; import { WeaEchart, WeaLocaleProvider } from 'ecCom'; import { Tabs } from 'antd'; const TabPane = Tabs.TabPane; const getLabel = WeaLocaleProvider.getLabel; import Query from './Query'; @inject('hrmUsedemand') @observer export default class TabsWp extends React.Component { constructor(props) { super(props); } componentDidMount() { // this.props.hrmUsedemand.getTabsDatas(); } componentDidUpdate() { const { hrmUsedemand } = this.props, { tabs } = hrmUsedemand, { key } = tabs; this[`echart${key}`] && this[`echart${key}`].paint(); } componentWillUnmount() { this.props.hrmUsedemand.resetTabs(); } setRef = (ref, alias) => { const { hrmUsedemand } = this.props, { setRef } = hrmUsedemand; this[alias] = ref; setRef({ ref, alias, type: 'tabs', }); } render() { const { hrmUsedemand } = this.props, { tabs, tabsCallback, } = hrmUsedemand, { charts, key, } = tabs; return (
tabsCallback(key)} type="card">{ toJS(charts).map((chart, index) => { const {title, option} = chart; const bl1 = option.series[0].data.length > 0; return (
{ bl1 ?
{key == index && this.setRef(ref,`echart${index}`)} option={chart.option} useDefault={false} />}
: {getLabel(83553, '暂无数据')} }
) }) }
) } }