/**
 * 关联
 * 
 */

import React, { Component } from 'react';
import { Input, Form, Select, Modal, Button, DatePicker, Icon } from 'antd';
import { Util } from 'tools/index';
import '../style/index.less';
import moment from 'moment';

const Option = Select.Option;
const FormItem = Form.Item;

class CorrelationModal extends Component {

    constructor(props) {
        super(props);
        this.state = {
            num: 50
        }
    }

    componentWillReceiveProps(nextProp) {
        if (!this.props.isShow && nextProp.isShow === true) {

        } else if (this.props.isShow === false) {
            this.cleanInput();
        }
    }

    closeModal() {
        let { onHide } = this.props;
        onHide && onHide();
        this.cleanInput();
    }

    //清空输入框
    cleanInput() {
        this.props.form.resetFields();
    }

    //提交
    onSubmit() {
        let { onSubmit } = this.props;
        onSubmit && onSubmit();
    }

    render() {
        let { getFieldDecorator, getFieldValue } = this.props.form;
        let formItemLayout = {
            labelCol: { span: 7 },
            wrapperCol: { span: 10 }
        };

        return <Modal className='registr-modal'
            title={'提示'}
            maskClosable={false}
            visible={this.props.isShow}
            okText={'关联'}
            footer={<div><Button onClick={this.closeModal.bind(this)}>取消</Button>
                    <Button className='time-save-button' autoFocus type='primary'
                        // onkeyDown={this.onkeySubmit.bind(this)}
                        onClick={this.onSubmit.bind(this)}>确定</Button></div>}
            onCancel={this.closeModal.bind(this)}
            // onOk={this.onSubmit.bind(this)}
            >
            <h4>系统存在该证件类型证件号码病人，请核对病人信息，确认后关联</h4>
            <h4>{this.props.checkData ? this.props.checkData : ''}</h4>
        </Modal>
    }
}

export default Form.create()(CorrelationModal);