import {
    inject,
    observer,
} from 'mobx-react'
import {
    toJS
} from 'mobx'
import {
    WeaAuth
} from 'ecCom'
import {
    Spin
} from 'antd'

@inject('hrmConExWarning')
@observer
export default class Add extends React.Component {
    constructor(props) {
        super(props);
    }

    handleOk = (datas) => {
        const {
            hrmConExWarning
        } = this.props, {
            save,
            setParams
        } = hrmConExWarning;

        setParams(datas); //设置参数
        save();
    }

    render() {
        const {
            hrmConExWarning
        } = this.props, {
            mainDialog,
            subForm,
            closeDialog,
        } = hrmConExWarning, {
            visible,
            title,
        } = mainDialog, {
            conditions,
        } = subForm;

        return (
            <WeaAuth ecId={`${this && this.props && this.props.ecId || ''}_WeaAuth@upve68`}
                modalClassName='hrm-auth'
                visible={visible}
                title={title}
                height={290}
                icon="icon-coms-hrm"
                iconBgcolor="#217346"
                conditions={toJS(conditions)}
                onOk={datas => this.handleOk(datas)}
                onCancel={() => closeDialog(false)}
            />
        )

    }
}