/**
 * 停医嘱
 */

import React, { Component } from 'react';
import { Form, Select, Modal, Input, Table, Pagination } from 'antd';
import { Util,dateFormat,timeFormat,dayFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import '../style/index.less';
import moment from 'moment';

const Option = Select.Option;
const FormItem = Form.Item;
const { TextArea } = Input;

class ShowStopAdviceModal extends Component {

    constructor(props) {
        super(props);
        this.state = {
            total: 0,
            page: 1,
            pageSize: 10,
            dataSource: []
        }
    }

    componentWillReceiveProps(nextProp) {
        if (nextProp.isShow === true) {

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

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

    //清空输入框
    cleanInput() {
        this.setState({
            reason: undefined
        })
    }

    //提交
    onSubmit() {
        let { onSubmit } = this.props;
        onSubmit && onSubmit('refused',this.state.reason);
    }

    render() {
        var date = new Date();
        return <div>
            <Modal className='confirm-refused-modal'
                title={'拒绝理由'}
                maskClosable={false}
                visible={this.props.isShow}
                onCancel={this.closeModal.bind(this)}
                onOk={this.onSubmit.bind(this)}>
                    <h4>拒绝理由：</h4>
                    <TextArea rows={6}maxLength={60} value={this.state.reason} onChange={Util.commonInputChange.bind(this,'reason')}/>
            </Modal></div >
    }
}

export default Form.create()(ShowStopAdviceModal);