import React from 'react';
import { InputNumber, Modal, Checkbox, Card, DatePicker, Table, Input, Popconfirm, Icon, message, Form, Divider, Select, Row, Col, Button } from 'antd';
import { $http } from 'containers/config/https';
import moment from 'moment';
import store from 'store';
import CommonPagination from 'components/pagination/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import { ArraySome } from 'tools/index';
import RangeDatePicker from 'components/rangePicker/index';

const { Option } = Select;
const dateFormat = 'YYYY-MM-DD'; //定义全局日期格式
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 6 },
    wrapperCol: { span: 16, offset: 0 },
};


class ArrearsUncontrolledDepartment extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            loading: false, //加载状态标志
            visible: false, //弹窗显示状态标志
            total1: 0,  //总记录1
            page1: 1, //当前页数1
            pageSize1: 10, //每页显示条数1
            tableData1: [], //表格1数据
            total2: 0,  //总记录1
            page2: 1, //当前页数1
            pageSize2: 10, //每页显示条数1
            tableData2: [], //表格1数据
            startValue: null, //日期选择器开始时间
            endValue: null, //日期选择器结束时间
            startValue1: null, //日期选择器开始时间
            endValue1: null, //日期选择器结束时间


            admReasonID: '', //查询条件 --- 结算类型
            locID: '',  //查询条件 --- 科室
            locArr: [],  //科室下拉框数据
            modallocArr: [],
            admReason: [], //结算类型下拉框数据
            modalAdmReason: [],
            delArrearsMCID: '', //删除欠费主表ID
            modalAddAdmReasonID: '', //弹框增加结算类型
            modalAddlocID: '', //弹框增加科室类

            arrControlLevel: [], //控制级别下拉框数据
            refID: '', //欠费条件父表ID
            isVaild: 'Y', //仅显示生效标志
            setRowClassNameSelect: '',
            setRowClassNameSelect2: '',
        };

        this.columns1 = [
            {
                title: '结算类型',
                dataIndex: 'admReason',
                key: 'admReason',
                width: '100px',
                align: "center",
            },
            {
                title: '科室',
                dataIndex: 'locDesc',
                key: 'locDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '操作',
                key: 'op',
                align: "center",
                width: '80px',
                render: (text, record) => (
                    <span>
                        <Popconfirm
                            title="确定要删除吗?"
                            onConfirm={this.delConfirm}
                            okText="是"
                            cancelText="否"
                        >
                            <span style={{ color: '#f00' }} className='span' onClick={() => this.setState({ delArrearsMCID: record.id })}><Icon type="delete" />删除</span>
                        </Popconfirm>
                    </span>
                ),
            },
        ];
        this.columns2 = [
            {
                title: '额度类型',
                dataIndex: 'quotaType',
                key: 'quotaType',
                width: '100px',
                align: "center",
            },
            {
                title: '控制级别',
                dataIndex: 'ACLDesc',
                key: 'ACLDesc',
                width: '100px',
                align: "center",
            },
            {
                title: '操作符1',
                dataIndex: 'operator1',
                key: 'operator1',
                width: '100px',
                align: "center",
            },
            {
                title: '金额1',
                dataIndex: 'amt1',
                key: 'amt1',
                width: '100px',
                align: "center",
            },
            {
                title: '操作符2',
                dataIndex: 'operator2',
                key: 'operator2',
                width: '100px',
                align: "center",
            },
            {
                title: '金额2',
                dataIndex: 'amt2',
                key: 'amt2',
                width: '100px',
                align: "center",
            },
            {
                title: '费用比例',
                dataIndex: 'freeAmtRatio',
                key: 'freeAmtRatio',
                width: '100px',
                align: "center",
            },
            {
                title: '生效日期',
                dataIndex: 'startDate',
                key: 'startDate',
                width: '100px',
                align: "center",
            },
            {
                title: '失效日期',
                dataIndex: 'endDate',
                key: 'endDate',
                width: '100px',
                align: "center",
            },
        ];

    }

    componentDidMount() {
        //限制表格高度
        for (var i = 0; i < document.querySelectorAll("div.maxHeight div.ant-table-body").length; i++) {
            document.querySelectorAll("div.maxHeight div.ant-table-body")[i].style.height = store.getState().tableHeight.y + 'px';
        }
        this.handleQuery();
        //结算类型下拉框数据
        this.getOutPatient()
        //科室下拉框数据
        this.getLoc()
        //控制级别下拉框数据
        this.getControlLevel()
    }

    //弹窗点击取消
    handleCancel = () => {
        this.setState({
            visible: false,
        });
    };

    //弹窗显示
    showModal = () => {
        this.setState({
            visible: true,
            startValue: null, //日期选择器开始时间
            endValue: null, //日期选择器结束时间
            modalAddAdmReasonID: undefined, //弹框增加结算类型
            modalAddlocID: undefined, //弹框增加科室类
        });
    }

    //初始化列表数据
    handleQuery = () => {
        let { admReasonID, locID, pageSize1, page1 } = this.state;
        var data = {
            params: [{
                "admReasonID": admReasonID,
                "locID": locID,
                "hospID": JSON.parse(window.sessionStorage.userData).hospID,
            }],
            pagination: [{
                pageSize: pageSize1,
                currentPage: page1,
                sortColumn: 'code',
                sortOrder: 'asc'
            }]
        }
        $http.post('urls', this, {
            code: '05100274',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result) {
                    for (var i = 0; i < res.result.length; i++) {
                        res.result[i].key = i;
                    }
                    this.setState({ tableData1: res.result.Data, total1: res.result.TotalCount, loading: false })
                } else {
                    this.setState({ tableData1: [], total: 0, loading: false })
                }
            }
        })
    }

    //科室下拉框数据
    getLoc = () => {
        let data = {}
        data = {
            params: [{
                hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
            }]
        }
        let locArrIndex = []
        $http.post('urlS', this, {
            code: "03020046",
            data: data,
            success: function (res) {
                if (res.errorCode === '0') {
                    //console.log("科室",res.result.Data)
                    for (var i = 0; i < res.result.Data.length; i++) {
                        locArrIndex.push(<Option key={res.result.Data[i].id} value={String(res.result.Data[i].id)} >{res.result.Data[i].descripts}</Option>)
                    }
                    this.setState({ locArr: locArrIndex, modallocArr: locArrIndex })
                } else {
                    message.error('查询失败：' + res.errorMessage);
                }
            }
        })
    }
    setRowClassNameSelect = (record) => {
        return record.id === this.state.setRowClassNameSelect ? 'clickRowStyle' : '';
    }
    setRowClassNameSelect2 = (record) => {
        return record.id === this.state.setRowClassNameSelect2 ? 'clickRowStyle' : '';
    }
    //结算类型下拉框数据
    getOutPatient = () => {
        var data = {
            params: []
        }
        let admReaConDr = []
        $http.post("urlS", this, {
            code: '05100246',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.AdmReaConArr) {
                    for (var i = 0; i < res.AdmReaConArr.length; i++) {
                        admReaConDr.push(<Option key={res.AdmReaConArr[i].ID} value={String(res.AdmReaConArr[i].ID)} >{res.AdmReaConArr[i].AdmReaCon}</Option>)
                    }
                    this.setState({ admReason: admReaConDr, modalAdmReason: admReaConDr })
                }
            },
            error: function (err) {
                this.setState({ errMsg: "数据加载失败，请重试！" })
            }
        })
    }

    //查询条件 --- 科室修改
    changeLoc = (e) => {
        this.setState({ locID: e })
    }

    //查询条件 --- 结算类型修改
    changeAdmReason = (e) => {
        this.setState({ admReasonID: e })
    }

    //删除确认
    delConfirm = (e) => {
        this.handleDel();
    }

    //删除操作
    handleDel = () => {
        let data = {
            params: [{
                id: this.state.delArrearsMCID,
                userID: JSON.parse(window.sessionStorage.userData).userID
            }]
        };
        $http.post('urlS', this, {
            code: "05100275",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    message.success(res.errorMessage);
                    this.handleQuery() // 查询
                    this.setState({
                        tableData2: [],
                        refID: '',
                        setRowClassNameSelect: '',
                        setRowClassNameSelect2: '',
                    },() => this.props.form.resetFields())
                }
            }
        });
    }

    //开始日期选择器选择限制
    disabledStartDate = startValue => {
        const { endValue } = this.state;
        if (!startValue || !endValue) {
            return false;
        }
        return startValue.valueOf() > endValue.valueOf();
    };

    //失效日期选择器选择限制
    disabledEndDate = endValue => {
        const { startValue } = this.state;
        if (!endValue || !startValue) {
            return false;
        }
        return endValue.valueOf() <= startValue.valueOf();
    };

    //开始日期变化
    onStartChange = value => {
        this.onChange('startValue', value);
    };

    //结束日期变化
    onEndChange = value => {
        this.onChange('endValue', value);
    };

    //开始日期选择器选择限制
    disabledStartDate1 = startValue => {
        const { endValue1 } = this.state;
        if (!startValue || !endValue1) {
            return false;
        }
        return startValue.valueOf() > endValue1.valueOf();
    };

    //失效日期选择器选择限制
    disabledEndDate1 = endValue => {
        const { startValue1 } = this.state;
        if (!endValue || !startValue1) {
            return false;
        }
        return endValue.valueOf() <= startValue1.valueOf();
    };

    //开始日期变化
    onStartChange1 = value => {
        this.onChange('startValue1', value);
    };

    //结束日期变化
    onEndChange1 = value => {
        this.onChange('endValue1', value);
    };

    onChange = (field, value) => {
        this.setState({
            [field]: value,
        });
    };

    //弹窗点击确定
    handleOk = () => {
        let data = {};
        data = {
            params: [{
                userID: JSON.parse(window.sessionStorage.userData).userID,
                hospID: JSON.parse(window.sessionStorage.userData).hospID,
                locID: this.state.modalAddlocID,
                admReasonID: this.state.modalAddAdmReasonID,
                startDate: moment(this.state.startValue).utcOffset(480).format('YYYY-MM-DD'),
                endDate: this.state.endValue ? moment(this.state.endValue).utcOffset(480).format('YYYY-MM-DD') : ''
            }]
        }
        $http.post('urlS', this, {
            code: '05100276',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    message.success(res.errorMessage);
                    this.handleQuery();
                    this.setState({ loading: false, visible: false });
                }
            }
        })
    };

    //弹窗改变结算类型下拉框的值
    changeModalReason = (e) => {
        this.setState({ modalAddAdmReasonID: e })
    }

    //弹窗改变科室下拉框的值
    changeModalLoc = (e) => {
        this.setState({ modalAddlocID: e })
    }

    //获取控制级别下拉框数据
    getControlLevel = () => {
        let data = {}
        data = {
            params: [{
                hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
            }]
        }
        let ControlLevelIndex = []
        $http.post('urlS', this, {
            code: "05100001",
            data: data,
            success: function (res) {
                if (res.errorCode === '0') {
                    for (var i = 0; i < res.data.length; i++) {
                        ControlLevelIndex.push(<Option key={res.data[i].ID} value={String(res.data[i].ID)} >{res.data[i].Descripts}</Option>)
                    }
                    this.setState({ arrControlLevel: ControlLevelIndex })
                } else {
                    message.error('查询失败：' + res.errorMessage);
                }
            }
        })
    }

    //清空表单
    resetFields = () => {
        this.props.form.resetFields(); //清空所有
    }

    //保存欠费条件
    addArrearsMCQuota = () => {
        this.props.form.validateFields((err, values) => {
            if (err) {
                return;
            }
            if (this.state.refID === '') {
                message.error('未选择欠费规则');
                return;
            }
            let data = {};
            data = {
                params: [{
                    refID: this.state.refID,
                    id: this.state.setRowClassNameSelect2,
                    userID: JSON.parse(window.sessionStorage.userData).userID,
                    hospID: JSON.parse(window.sessionStorage.userData).hospID,
                    quotaType: values.quotaType,
                    ACLID: values.ACLID,
                    operator1: values.operator1,
                    amt1: values.amt1,
                    operator2: values.operator2,
                    amt2: values.amt2,
                    freeAmtRatio: (values.freeAmtRatio / 100),
                    startDate: moment(values.startDate).utcOffset(480).format('YYYY-MM-DD'),
                    endDate: values.endDate ? moment(values.endDate).utcOffset(480).format('YYYY-MM-DD') : '',
                }]
            }
            $http.post('urls', this, {
                code: '05100278',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success(res.errorMessage);
                        this.handleQueryArrearsMCQuota();
                        this.setState({ loading: false, visible: false });
                    }
                }
            })
        })
    }

    //选中欠费规则记录显示欠费条件设置
    handleQueryArrearsMCQuota = () => {
        let { refID, isVaild, pageSize2, page2 } = this.state;
        if (isVaild === '') {
            message.error('未选择欠费规则');
            return;
        }
        var data = {
            params: [{
                "refID": refID,
                "isVaild": isVaild,
                "hospID": JSON.parse(window.sessionStorage.userData).hospID,
            }],
            pagination: [{
                pageSize: pageSize2,
                currentPage: page2,
                sortColumn: 'code',
                sortOrder: 'asc'
            }]
        }
        $http.post('urls', this, {
            code: '05100277',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result) {
                    for (var i = 0; i < res.result.length; i++) {
                        res.result[i].key = i;
                    }
                    this.setState({ tableData2: res.result.Data, total2: res.result.TotalCount, loading: false })
                } else {
                    this.setState({ tableData2: [], total: 0, loading: false })
                }
            }
        })
    }

    //改变状态
    setStatus = (record) => {
        if (record.id !== this.state.setRowClassNameSelect) {
            this.setState({
                refID: record.id,
                setRowClassNameSelect: record.id,
                setRowClassNameSelect2: '',
            }, () => {
                this.handleQueryArrearsMCQuota()
                this.props.form.resetFields()
            })
        } else {
            this.setState({
                refID: '',
                setRowClassNameSelect: '',
                setRowClassNameSelect2: '',
                tableData2: [],
            },() => this.props.form.resetFields())
        }

    }

    //是否仅显示生效
    onchangeIsVaild = (e) => {
        this.setState({
            isVaild: e.target.checked ? 'Y' : 'N'
        }, () => { this.handleQueryArrearsMCQuota() })
    }

    //点击表格行
    onClickRow = (record) => {
        return {
            onClick: () => {
                this.setStatus(record)
            }
        };
    }

    //点击条件表格行
    onClickRow2 = (record) => {
        return {
            onClick: () => {
                this.setDetailData(record)
            }
        };
    }

    // 编辑欠费条件
    setDetailData = (record) => {
        if (record.id !== this.state.setRowClassNameSelect2) {
            this.setState({
                setRowClassNameSelect2: record.id
            }, () => {
                this.props.form.setFieldsValue({
                    quotaType: record.quotaTypeID,
                    ACLID: record.ACLID,
                    freeAmtRatio: record.freeAmtRatio,
                    amt1: record.amt1,
                    amt2: record.amt2,
                    operator1: record.operator1,
                    operator2: record.operator2,
                    startDate: moment(record.startDate,'YYYY-MM-DD'),
                    endDate: record.endDate ? moment(record.endDate,'YYYY-MM-DD') : null
                })
            })
        } else {
            this.setState({
                setRowClassNameSelect2: ''
            },() => this.props.form.resetFields())
        }
    }
    render() {
        const { getFieldDecorator } = this.props.form;
        return (
            <div>
                <div style={{ width: '100%', height: '100%' }}>
                    <Row type="flex" justify="space-between">
                        <Col span={9}>
                            <Card size="small" title={<div className="card-title-left-icon"><div></div>{'欠费规则列表'}</div>}>
                                <div>
                                    <Row style={{ marginBottom: '10px' }}>
                                        <Col span={11}>
                                            <span>科室：</span>
                                            <Select style={{ width: '80%' }} allowClear placeholder="请选择科室" onChange={this.changeLoc}>
                                                {this.state.locArr}
                                            </Select>
                                        </Col>
                                        <Col span={13} style={{ textAlign: 'right' }}>
                                            <span>结算类型：</span>
                                            <Select style={{ width: '70%' }} allowClear placeholder="请选择结算类型" onChange={this.changeAdmReason}>
                                                {this.state.admReason}
                                            </Select>
                                        </Col>
                                    </Row>
                                    <Row style={{ marginBottom: '10px' }}>
                                        <Col span={24} style={{ textAlign: 'right' }}>
                                            <Button type="primary" style={{ marginRight: '10px' }} icon="search" onClick={() => this.handleQuery()} >查询</Button>
                                            <Button type="primary" icon="plus" onClick={() => this.showModal()} style={{ backgroundColor: '#F7805D', border: 'none' }}>添加欠费规则</Button>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={24}>
                                            <Table
                                                className='maxHeight'
                                                dataSource={this.state.tableData1}
                                                columns={this.columns1}
                                                pagination={false}
                                                scroll={{ x: '100%', y: store.getState().tableHeight.y }}
                                                bordered
                                                loading={this.state.loading}
                                                onRow={this.onClickRow}
                                                rowClassName={this.setRowClassNameSelect}
                                            />
                                        </Col>
                                    </Row>
                                </div>
                            </Card>
                        </Col>
                        <Col span={15}>
                            <Card size="small" title={<div className="card-title-left-icon"><div></div>{'欠费条件设置'}</div>}>
                                <div>
                                    <Form layout="inline" >
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={24}>
                                                <Form.Item label="额度类型" {...{ labelCol: { span: 3 }, wrapperCol: { span: 20, offset: 0 }, }} style={{ width: '100%' }}>
                                                    {getFieldDecorator('quotaType', {
                                                        initialValue: undefined,
                                                        rules: [{ required: true, message: '额度类型不能为空' }],
                                                    })(
                                                        <Select allowClear placeholder="请选择额度类型" style={{ width: '100%' }}>
                                                            <Option key={'1'} value='1'>欠费额度</Option>
                                                            <Option key={'2'} value='2'>押金额度</Option>
                                                        </Select>
                                                    )}
                                                </Form.Item>
                                            </Col>
                                        </Row>
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={12}>
                                                <Form.Item label="控制级别" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('ACLID', {
                                                        initialValue: undefined,
                                                        rules: [{ required: true, message: '控制级别不能为空' }],
                                                    })(
                                                        <Select allowClear placeholder="请选择控制级别" style={{ width: '100%' }}>
                                                            {this.state.arrControlLevel}
                                                        </Select>
                                                    )}
                                                </Form.Item>
                                            </Col>
                                            <Col span={12}>
                                                <Form.Item label="费用比例" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('freeAmtRatio', {
                                                        initialValue: 100,
                                                        rules: [{ required: true, message: '费用比例不能为空' }],
                                                    })(
                                                        <InputNumber
                                                            min={0}
                                                            max={100}
                                                            formatter={value => `${value}%`}
                                                            parser={value => value.replace('%', '')}
                                                        />
                                                    )}
                                                </Form.Item>
                                            </Col>
                                        </Row>
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={12}>
                                                <Form.Item label="操作符1" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('operator1', {
                                                        initialValue: undefined,
                                                    })(
                                                        <Select allowClear placeholder="请选择操作符1" style={{ width: '100%' }}>
                                                            <Option key={'>'} value='>'>&gt;</Option>
                                                            <Option key={'>='} value='>='>&gt;=</Option>
                                                        </Select>
                                                    )}
                                                </Form.Item>
                                            </Col>
                                            <Col span={12}>
                                                <Form.Item label="金额1" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('amt1', {
                                                        initialValue: 0,
                                                    })(
                                                        <InputNumber
                                                            min={-9999999999999999}
                                                        />
                                                    )}
                                                </Form.Item>
                                            </Col>
                                        </Row>
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={12}>
                                                <Form.Item label="操作符2" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('operator2', {
                                                        initialValue: undefined,
                                                    })(
                                                        <Select allowClear placeholder="请选择操作符2" style={{ width: '100%' }}>
                                                            <Option key={'<'} value='<'>&lt;</Option>
                                                            <Option key={'<='} value='<='>&lt;=</Option>
                                                        </Select>
                                                    )}
                                                </Form.Item>
                                            </Col>
                                            <Col span={12}>
                                                <Form.Item label="金额2" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('amt2', {
                                                        initialValue: 0,
                                                    })(
                                                        <InputNumber
                                                            min={-9999999999999999}
                                                        />
                                                    )}
                                                </Form.Item>
                                            </Col>
                                        </Row>
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={12}>
                                                <Form.Item label="生效日期" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('startDate', {
                                                        initialValue: this.state.startValue1,
                                                        rules: [{ required: true, message: '生效日期不能为空' }],
                                                    })(
                                                        <DatePicker
                                                            placeholder="请选择生效日期"
                                                            style={{ width: '100%' }}
                                                            format={dateFormat}
                                                            disabledDate={this.disabledStartDate1}
                                                            onChange={this.onStartChange1}
                                                        />
                                                    )}
                                                </Form.Item>
                                            </Col>
                                            <Col span={12}>
                                                <Form.Item label="失效日期" {...formItemLayout} style={{ width: '100%' }}>
                                                    {getFieldDecorator('endDate', {
                                                        initialValue: this.state.endValue1,
                                                    })(
                                                        <DatePicker
                                                            placeholder="请选择失效日期"
                                                            style={{ width: '100%' }}
                                                            format={dateFormat}
                                                            disabledDate={this.disabledEndDate1}
                                                            onChange={this.onEndChange1}
                                                        />
                                                    )}
                                                </Form.Item>
                                            </Col>
                                        </Row>
                                        <Row style={{ marginBottom: '10px' }}>
                                            <Col span={23} style={{ textAlign: 'right' }}>
                                                <Button style={{ marginRight: '10px' }} onClick={this.resetFields} >清空</Button>
                                                <Button type="primary" onClick={this.addArrearsMCQuota}  >保存</Button>
                                            </Col>
                                        </Row>
                                    </Form>
                                </div>
                            </Card>
                            <Card size="small" title={
                                <div style={{ width: '100%' }}>
                                    <Row>
                                        <Col span={12}>{'欠费条件'}</Col>
                                        <Col span={12} style={{ textAlign: 'right' }}><Checkbox defaultChecked={this.state.isVaild === 'Y' ? true : false} onChange={this.onchangeIsVaild}>仅显示生效</Checkbox></Col>
                                    </Row>
                                </div>
                            }>
                                <div>
                                    <Row>
                                        <Col span={24}>
                                            <Table
                                                style={{ minHeight: '200px' }}
                                                dataSource={this.state.tableData2}
                                                columns={this.columns2}
                                                pagination={false}
                                                scroll={{ x: '100%', y: store.getState().tableHeight.y }}
                                                bordered
                                                loading={this.state.loading}
                                                onRow={this.onClickRow2}
                                                rowClassName={this.setRowClassNameSelect2}
                                            />
                                        </Col>
                                    </Row>
                                </div>
                            </Card>
                        </Col>
                    </Row>
                </div>
                <Modal
                    visible={this.state.visible}
                    title='添加欠费规则'
                    onOk={this.handleOk}
                    onCancel={this.handleCancel}
                    width='600px'
                    footer={[
                        <Button key="back" onClick={this.handleCancel}>
                            取消
                        </Button>,
                        <Button key="submit" type="primary" loading={this.state.loading} onClick={this.handleOk}>
                            保存
                        </Button>,
                    ]}
                >
                    <Row>
                        <Col span={4} style={{ textAlign: 'right' }}>结算类型：</Col>
                        <Col span={19} style={{ textAlign: 'left', marginBottom: '10px' }}>
                            <Select allowClear placeholder="请选择结算类型" value={this.state.modalAddAdmReasonID} onChange={this.changeModalReason} style={{ width: '100%' }}>
                                {this.state.modalAdmReason}
                            </Select>
                        </Col>
                        <Col span={4} style={{ textAlign: 'right' }}>科室：</Col>
                        <Col span={19} style={{ textAlign: 'left', marginBottom: '10px' }}>
                            <Select allowClear placeholder="请选择科室" value={this.state.modalAddlocID} onChange={this.changeModalLoc} style={{ width: '100%' }}>
                                {this.state.modallocArr}
                            </Select>
                        </Col>
                        <Col span={4} style={{ textAlign: 'right' }}>
                            <span style={{ color: '#f5222d' }}>*</span><span>生效日期：</span>
                        </Col>
                        <Col span={19} style={{ textAlign: 'left', marginBottom: '10px' }}>
                            <DatePicker
                                placeholder="请选择生效日期"
                                style={{ width: '100%' }}
                                format={dateFormat}
                                disabledDate={this.disabledStartDate}
                                value={this.state.startValue}
                                onChange={this.onStartChange}
                            />
                        </Col>
                        <Col span={4} style={{ textAlign: 'right' }}>失效日期：</Col>
                        <Col span={19} style={{ textAlign: 'left' }}>
                            <DatePicker
                                placeholder="请选择失效日期" style={{ width: '100%' }}
                                format={dateFormat}
                                disabledDate={this.disabledEndDate}
                                value={this.state.endValue}
                                onChange={this.onEndChange}
                            />
                        </Col>
                    </Row>
                </Modal>
            </div>
        )
    }
}


const ArrearsUncontrolledDepartmentForm = Form.create()(ArrearsUncontrolledDepartment);
export default ArrearsUncontrolledDepartmentForm;
