//未结算费用查询 
import React from 'react'
import { Table, Form, Row, Col, Select, Card, Input, Button, Modal, message, Divider, Checkbox, Tooltip, DatePicker } from 'antd'
import { $http } from 'containers/config/https';
import { dayFormat, dateFormat } from 'tools';
import moment from 'moment';
import PayMentRecordModal from './component/PayMentRecordModal.jsx'
import CommonPagination from 'components/pagination/index';
// import RangeDatePicker from 'components/rangePicker/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import Search from 'antd/lib/input/Search';
import store from 'store';
import './style/style.less'
import ReadCard from 'components/readcard/ReadCard';
// import { $loadTemplate } from '../../lodop/Common/Print.js';
// import { $loopPrint } from '../../lodop/Common/Print.js';

const { Option } = Select;

class PayMentRecord extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            data: [],
            cardTypeData: [], // 卡类型
            RefundPayWayArr: [],
            user: [],
            InvStatusArr: [],
            AdmReasonArr: [],
            PatientSourceArr: [],
            visible: false,
            userInfo: {},
            total: 0,
            page: 1,
            pageSize: 50,
            loading: false,
            StartDateTop: moment().format(dayFormat) + '00:00:00',  // //开始日期
            EndDateTop: moment().format(dayFormat) + '23:59:59',  // //结束日期
            widthTotal: 0,//宽
            languageTable1: {}, // 国际化Table1
            languageTable2: {}, // 国际化Table2
            languageData: {}, // 国际化语言包
            language: {},   // 国际化语言
            languageCode: JSON.parse(window.sessionStorage.userData).language, // 国际化语言标识
            columns: [],
            selectedRows: [],
            compleRecordIDinfo: '',
            diseascType: [],
            selectedRowKeys: [],
            findINVFlag: ''
        }
    }

    //初始化数据
    componentDidMount() {
        this.initJuris()
        this.tableList();
        this.cardTypeList()
        this.getUserData()

        this.loadDepartMent()
        this.loadDoctorId()
        document.querySelector('.ant-table-body').style.height = store.getState().tableHeight.y + 145 + 'px';
    }

    //render 自定义项目名称
    listAdd = (i, j, languageCode) => {
        let { columns } = this.state
        // columns.splice(i, j,
        //     {
        //         title: languageCode === 'CN' ? "操作" : 'Operation',
        //         key: 'op',
        //         align: "center",
        //         width: '180px',
        //         fixed: 'right',
        //         render: (text, record) => (
        //             <span>
        //                 {record.recordTotalAmt && parseFloat(record.recordTotalAmt) < 0 ?
        //                     <span className='span' style={{ cursor: 'pointer' }} onClick={this.handlePrintAmt.bind(this, record)}>{languageCode === 'CN' ? "打印凭证" : 'Print'}</span> :
        //                     <span className='span' onClick={this.handlePrint.bind(this, record)}>{languageCode === 'CN' ? (record.ID ? "打印凭证" : '合并打印') : 'Print'}</span>}
        //                 <Divider type='vertical' />
        //                 <span className='span' onClick={this.handleModal.bind(this, record)}>{languageCode === 'CN' ? "费用明细" : 'Charge Details'}</span>
        //             </span>
        //         )
        //     },
        // )
    }

    // 权限
    initJuris = () => {
        var data = {
            params: [{
                logonHospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id
                logonGroupID: JSON.parse(window.sessionStorage.userData).groupID,  //角色id
                logonUserID: JSON.parse(window.sessionStorage.userData).userID, //人员id
                invTypeCode: 'O'  // 类型
            }]
        }
        $http.post('urlS', this, {
            code: "05210001",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        findINVFlag: res.moduleConfig.FindINVFlag,  // 是否多选
                    }, () => { this.handleQuery() });
                } else {
                    this.handleQuery()
                }
            }
        });
    }

    //打印负凭条
    handlePrintAmt(data) {
        var params = {
            params: [{
                recordID: data.ID,
            }]
        }
        $http.post('urlADS', this, {
            code: "05210080",
            data: params,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    message.success('打印成功')
                    let dataArr = res.result
                    dataArr && dataArr.map((item, i) => {
                        $loadTemplate(item.template, item.printStr);
                    })
                }
            }
        });
    }

    handlePrint(data) {
        let { selectedRows } = this.state
        let recordIDStr = ''
        selectedRows.map((item) => {
            recordIDStr += item.ID + '^'
        })
        recordIDStr = recordIDStr.substring(0, recordIDStr.length - 1);
        if (!recordIDStr && !data.ID) {
            message.warn('请选择要打印的数据！')
            return;
        }
        var params = {
            params: [{
                recordID: data.ID,
                recordIDStr: data.ID ? '' : recordIDStr
            }]
        }
        $http.post('urlADS', this, {
            code: "05210076",
            data: params,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    message.success('打印成功')
                    let dataArr = res.result
                    dataArr && dataArr.map((item, i) => {
                        $loadTemplate(item.template, item.printStr);
                    })
                    this.setState({ selectedRowKeys: [], selectedRows: [] })
                }
            }
        });
    }

    onColumnRef = (ref) => {
        this.columnRef = ref;
    }

    // 获取主列表columns
    tableList = () => {
        var data = {
            params: [{
                "reactCode": ["UnPayMentOrder"],
                "compontName": "UnPayMentOrder",
                "type": "C"
            }]
        }
        $http.post('urlS', this, {
            code: '01040073',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let resC = res.result.C
                    let { languageCode } = this.state
                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }
                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            fixed: item.fixed,
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                            display: item.display,
                            key: item.seqNo,
                            render: (text, record) => {
                                return (
                                    <Tooltip title={text}>
                                        <span className='ellipsis' style={{ width: '100%', display: 'block' }}>{text}</span>
                                    </Tooltip>
                                );
                            },
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    this.setState({
                        columns: filterArr,
                        languageTable1: res.result.B || {},  // 国际化Table1
                        languageTable2: res.result.C || {},  // 国际化Table2
                        languageData: res.result.language || {},  // 国际化语言包
                        widthTotal: res.totalWidth
                    }, () => {
                        this.LanCNEN(this.state.languageCode)
                        this.listAdd(filterArr.length + 1, 0, languageCode);
                    })
                }
            }
        })
    }

    LanCNEN = (code) => {
        let { languageData } = this.state
        this.setState({
            language: languageData[code]
        })
    }

    // 页码改变的回调，参数是改变后的页码及每页条数
    appPageChange = (page, pageSize) => {
        this.setState({
            page: page,
            pageSize: pageSize,
        }, () => {
            // 重新调用查询方法
            this.handleQuery();
        });
    }

    // 条数改变的回调
    apponShowSizeChange = (current, size) => {
        this.setState({
            page: current,
            pageSize: size,
        }, () => {
            // 重新调用查询方法
            this.handleQuery();
        });
    }

    startChange(date) {
        this.setState({
            StartDateTop: date ? moment(date).format(dateFormat) : '',
        })
    }

    endChange(date) {
        this.setState({
            EndDateTop: date ? moment(date).format(dateFormat) : '',
        })
    }

    //列表数据
    handleQuery = () => {
        let { StartDateTop, EndDateTop } = this.state
        let { page, pageSize } = this.state;
        let { validateFields } = this.props.form;
        validateFields({ force: true }, (err, params) => {
            if (err) {
                return;
            }
            this.setState({ loading: true });
            let data = {}
            params.startDate = params?.StartDateTop ? moment(params?.StartDateTop).format(dayFormat) : StartDateTop
            params.endDate = params?.EndDateTop ? moment(params?.EndDateTop).format(dayFormat) : EndDateTop;
            data = {
                params: [params],
                pagination: [{
                    pageSize: pageSize,
                    currentPage: page,
                    sortColumn: 'code',
                    sortOrder: 'asc'
                }]
            }
            $http.post('urls', this, {
                code: '05210101',
                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({ data: res.result, total: res.totalCount, loading: false, selectedRowKeys: [], selectedRows: [] })
                    } else {
                        this.setState({ data: [], total: 0, loading: false, selectedRowKeys: [], selectedRows: [] })
                        message.error(res.errorMessage);
                    }
                },
                error: function () {
                    this.setState({ loading: false });
                }
            })
        })
    }

    //获取科室
    loadDepartMent() {
        var params = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID
            }]
        }
        $http.post('urlDeault', this, {
            code: "01050029",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        departMentData: res.result.Data
                    })
                }
            }
        });
    }

    //获取挂号医生信息
    loadDoctorId() {
        var params = {
            params: [{
                locID: this.state.locId ? this.state.locId : JSON.parse(window.sessionStorage.userData).locID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03020058",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        depDoctorData: res.Data
                    })
                }
            }
        });
    }

    //获取接待人
    loadUnawares() {
        var params = {
            params: [{}]
        }
        $http.post('urlDeault', this, {
            code: "03040036",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        unawaresList: res.result,
                    })
                }
            }
        });
    }

    //获取来源渠道
    loadPatientSource() {
        var params = {
            params: [{}]
        }
        $http.post('urlDeault', this, {
            code: "05100285",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        PatientSourceArr: res.PatientSourceArr,
                    })
                }
            }
        });
    }

    //获取病人类型
    loadPatientType() {
        var params = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }
        $http.post('urlDeault', this, {
            code: "05100130",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        PatientType: res.data,
                    })
                }
            }
        });
    }

    //获取病种
    loadPiseascType() {
        var params = {
            params: [{

            }]
        }
        $http.post('urlDeault', this, {
            code: "05100357",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        diseascType: res.data,
                    })
                }
            }
        });
    }

    //操作员
    getUserData = () => {
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID, //医院id 
                "locTypeCode": "C"
            }]
        }
        $http.post("urlS", this, {
            code: '05210023',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.user) {
                    for (var i = 0; i < res.user.length; i++) {
                        this.state.user.push(<Option value={String(res.user[i].id)} key={i + "U"}>{res.user[i].descripts}</Option>)
                    }
                    this.setState({ user: this.state.user })
                }
            },
            error: function (err) {
                this.setState({ errMsg: this.state.languageCode === "CN" ? "数据加载失败，请重试！" : 'Data loading failed, please try again' })
            }
        })
    }

    //卡类型
    cardTypeList = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }

        $http.post('urlS', this, {
            code: "01040059",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let cardDeffault = res.cardType.filter((item) => {
                        return item.defaultFlag === 'Y';
                    })
                    this.setState({
                        cardType: cardDeffault[0].id, // 默认卡
                        cardTypeData: res.cardType,  // 用户数据
                    });
                }
            }
        });
    }

    //支付方式
    getPayWayData = () => {
        $http.post("urlS", this, {
            code: '05100078',
            data: { params: [] },
            success: function (res) {
                if (+res.errorCode === 0 && res.RefundPayWayArr) {
                    for (var i = 0; i < res.RefundPayWayArr.length; i++) {
                        this.state.RefundPayWayArr.push(<Option value={String(res.RefundPayWayArr[i].ID)} title='UnitID' key={i + "W"}>{res.RefundPayWayArr[i].Descripts}</Option>)
                    }
                    this.setState({ RefundPayWayArr: this.state.RefundPayWayArr })
                }
            },
            error: function (err) {
                this.setState({ errMsg: this.state.languageCode === "CN" ? "数据加载失败，请重试！" : 'Data loading failed, please try again' });
            }
        });
    }

    //收费状态
    getInvStatusData = () => {
        $http.post("urlS", this, {
            code: '05100097',
            data: { params: [] },
            success: function (res) {
                if (+res.errorCode === 0 && res.InvStatusArr) {
                    for (var i = 0; i < res.InvStatusArr.length; i++) {
                        this.state.InvStatusArr.push(<Option value={String(res.InvStatusArr[i].ID)} key={i + "S"}>{res.InvStatusArr[i].Descripts}</Option>)
                    }
                    this.setState({ InvStatusArr: this.state.InvStatusArr })
                }
            },
            error: function (err) {
                this.setState({ errMsg: this.state.languageCode === "CN" ? "数据加载失败，请重试！" : 'Data loading failed, please try again' })
            }
        })
    }

    //结算类型
    getAdmReasonData = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }
        $http.post("urlS", this, {
            code: '05100129',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.data) {
                    for (var i = 0; i < res.data.length; i++) {
                        this.state.AdmReasonArr.push(<Option value={String(res.data[i].id)} key={i + "A"}>{res.data[i].descripts}</Option>)
                    }
                    this.setState({ AdmReasonArr: this.state.AdmReasonArr })
                }
            },
            error: function (err) {
                this.setState({ errMsg: this.state.languageCode === "CN" ? "数据加载失败，请重试！" : 'Data loading failed, please try again' })
            }
        })
    }

    // 编辑
    handleModal(record) {
        // 初始化数据
        this.setState({ userInfo: record, visible: true, });
    }

    // 调用子组件的连接事件
    onRef = (ref) => {
        this.child = ref
    }

    // 取消
    handleCancel = () => {
        this.setState({
            visible: false,
        })
    }

    // 分页总条数
    showTotal(total) {
        return this.state.languageCode === "CN" ? `共 ${total} 条` : `Total ${total} data`;
    }

    // 页码改变的回调，参数是改变后的页码及每页条
    onChange = (page, pageSize) => {
        this.setState({ page: page, pageSize: pageSize }, () => {
            this.handleQuery()
        });
    }

    // 条数改变的回调
    onShowSizeChange = (current, size) => {
        this.setState({ page: current, pageSize: size }, () => {
            // 重新调用查询方法
            this.onChange(current, size);
        })
    }

    PrintXYPrescButtom = () => {
        if (this.state.selectedRows.length > 0) {
            for (var i = 0; i < this.state.selectedRows.length; i++) {
                this.PrintXYPresc(this.state.selectedRows[i]);
            }
        } else {
            message.error('请选择打印数据')
        }
    }

    // 回车查询
    patNodownE = (e) => {
        if (e.keyCode === 13) {
            this.handleQuery()
        }
    }

    //打印清单
    PrintXYPresc = (val) => {
        let { userInfo } = this.state
        let data = {}
        data = {
            params: [{
                "invrecordID": val.ID || userInfo.ID,
                "invrecordType": val.invType || userInfo.invType,
                "invNo": val.invNo || userInfo.invNo,
                "recordPatNum": val.recordPatNum || userInfo.recordPatNum,
                "name": val.name || userInfo.name,
                "sex": val.sexDesc || userInfo.sexDesc,
                "recordPayDate": val.recordPayDate || userInfo.recordPayDate,
                "hospID": JSON.parse(window.sessionStorage.userData).hospID
            }]
        }
        $http.post('urls', this, {
            code: '05100343',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    $loopPrint('', res.result);
                }
            }
        })
    }

    //数据导出
    DataoutputPresc = () => {
        const { StartDateTop, EndDateTop } = this.state;
        let Formlist = this.props.form;
        let startDate = Formlist.getFieldValue('StartDateTop') ? moment(Formlist.getFieldValue('StartDateTop')).format(dayFormat) : StartDateTop
        let endDate = Formlist.getFieldValue('EndDateTop') ? moment(Formlist.getFieldValue('EndDateTop')).format(dayFormat) : EndDateTop;
        window.open("http://192.168.5.36:18080/demo/reportJsp/showReport.jsp?rpx=ChargeDetails.rpx&cardTypeID=" + (Formlist.getFieldValue("cardTypeID") || '') + "&cardNo=" + (Formlist.getFieldValue("cardNo") || ' ') + "&sessionHospID=" + JSON.parse(window.sessionStorage.userData).hospID + "&recordPatNum=" + (Formlist.getFieldValue("recordPatNum") || '') + "&recordUserID=" + (Formlist.getFieldValue("recordUserID") || '') + "&invNo=" + (Formlist.getFieldValue("invNo") || '') + "&startDate=" + startDate + "&endDate=" + endDate + "&recordAdmReasonID=" + (Formlist.getFieldValue("recordAdmReasonID") || '') + "&payWayID=" + (Formlist.getFieldValue("payWayID") || '') + "&recordStatusID=" + (Formlist.getFieldValue("recordStatusID") || '') + "&locID=" + (Formlist.getFieldValue("locID") || '') + "&doctorID=" + (Formlist.getFieldValue("doctorID") || '') + "&deskClerkID=" + (Formlist.getFieldValue("deskClerkID") || '') + "&patTypeID=" + (Formlist.getFieldValue("patTypeID") || ''))
    }

    // 读卡 --- 根据卡号取病人信息
    handleReadCard = (value, event) => {
        if (event.keyCode) {
            this.handleQuery(); // 重新调用查询接口
            return false
        }
        let { cardType } = this.state;
        this.readCard.ReadCard(cardType, "R", (json) => {
            let patNo = json && json.patInfo ? json.patInfo.patNo : ''
            this.setState({ patNo, cardNo: json.cardNo }, () => {
                this.handleQuery(); // 重新调用查询接口
            })
        })
    }

    //点击行，渲染当前行样式 
    setRowClassName = (record) => {
        var id = ''
        var { selectedRowKeys } = this.state;
        if (selectedRowKeys) {
            for (var i = 0; i < selectedRowKeys.length; i++) {
                if (selectedRowKeys[i] == record.id) {
                    id = selectedRowKeys[i]
                }
            }
        }
        return record.id === id ? 'clickRowStyle' : '';
    }

    selectRowKeys(selectedRowKeys, selectedRows) {
        this.setState({
            selectedRowKeys: selectedRowKeys,
            selectedRows: selectedRows
        })
    }

    changeDepartMent(e) {
        var id = '';
        if (e) {
            id = e.substring(e.indexOf('^') + 1)
        }
        this.setState({
            locId: id,
        }, () => {
            this.loadDoctorId();
        })
    }

    //点击行，渲染当前行样式
    onClickRow = (record) => {
        return {
            // onDoubleClick: () => {
            //     this.setState({
            //         payID: record.ID
            //     }, () => {
            //         // this.columnRef.onOpenModel()
            //         this.handleModal(record)
            //     });
            // }
        };
    }

    //点击行，渲染当前行样式 
    setRowClassName = (record) => {
        return record.ID === this.state.payID ? 'clickRowStyle' : '';
    }

    // 打印
    print = () => {
        let { selectedRows } = this.state
        let recordIDStr = ''
        selectedRows.map((item) => {
            recordIDStr += item.ID + '^'
        })
        recordIDStr = recordIDStr.substring(0, recordIDStr.length - 1);
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID, //医院id 
                "groupID": JSON.parse(window.sessionStorage.userData).groupID,  //角色id
                "printType": "O",
                "printTemplateCode": "GuidePatDocuments",
                "recordIDStr": recordIDStr || '',
                "invIDStr": '',

            }]
        }
        /*  */

        $http.post('urlADS', this, {
            code: "05100153",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let dataArr = res.data
                    let template = res.template
                    dataArr.map((item, i) => {
                        $loadTemplate(template[i], item.toString());
                    })
                }
            }
        });
    }

    render() {
        let { language, widthTotal, selectedRowKeys, findINVFlag } = this.state
        let { getFieldDecorator } = this.props.form;
        //卡类型
        var cardTypeOPtion = []
        this.state.cardTypeData && this.state.cardTypeData.map((item, index) => {
            cardTypeOPtion.push(
                <Option title={item.descripts + '^' + item.descriptsSPCode} key={index} value={item.id}>{item.descripts}</Option>
            )
        })
        //获取科室信息
        let departMentOption = []
        this.state.departMentData && this.state.departMentData.map((item, index) => {
            departMentOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //获取科室医生信息
        let depDoctorOption = []
        this.state.depDoctorData && this.state.depDoctorData.map((item, index) => {
            depDoctorOption.push(<Option key={index} value={item.doctorID}>{item.descripts}</Option>)
        })


        const rowSelection = {
            selectedRowKeys,
            onChange: (selectedRowKeys, selectedRows) => {
                this.setState({ selectedRowKeys, selectedRows })
            },
            getCheckboxProps: record => ({
                disabled: (record.ID === '' ? true : false),
            }),
        };

        const formItemInput = {
            labelCol: { span: 8 },
            wrapperCol: { span: 16 }
        };
        return (
            <div className='readCard-body' style={{ width: '100%', height: '100%', background: '#F5F7FE' }} id='read-card-body'>
                <ReadCard ref={r => this.readCard = r} />
                <Card className="pmr-query-form" style={{ float: 'left', width: '20%', height: store.getState().tableHeight.y + 242 }}>
                    <Form>
                        {/* <Form.Item {...formItemInput} label={language.UnPayMentOrderCardType && language.UnPayMentOrderCardType.descripts}>
                            {getFieldDecorator("cardTypeID", {
                                initialValue: this.state.cardType
                            })(
                                <Select style={{ width: '100%' }}>
                                    {cardTypeOPtion}
                                </Select>
                            )}
                        </Form.Item>

                        <Form.Item>
                            {getFieldDecorator("cardNo", {
                                rules: [{ required: false }]
                            })(
                                <Search
                                    // onKeyUp={(e) => { this.patNodownE(e) }}
                                    style={{ width: '100%' }}
                                    placeholder={language.UnPayMentOrderCardNo && language.UnPayMentOrderCardNo.message}
                                    enterButton={language.UnPayMentOrderReadCard && language.UnPayMentOrderReadCard.descripts}
                                    onSearch={this.handleReadCard}
                                />
                            )}
                        </Form.Item> */}

                        <Form.Item {...formItemInput} label={<span className='common-label-style'>{language.UnPayMentOrderIDNCM && language.UnPayMentOrderIDNCM.descripts}</span>}>
                            {getFieldDecorator("recordPatNum", {
                                rules: [{ required: false }]
                            })(
                                <Input style={{ width: '100%' }} placeholder={language.UnPayMentOrderIDNCM && language.UnPayMentOrderIDNCM.message} onKeyUp={(e) => { this.patNodownE(e) }} />
                            )}
                        </Form.Item>

                        <Form.Item {...formItemInput} label={<span className='common-label-style'>{language.UnPayMentOrderStartDate && language.UnPayMentOrderStartDate.descripts}</span>}>
                            {getFieldDecorator("StartDateTop", {
                                initialValue: this.state.StartDateTop ? moment(this.state.StartDateTop, dayFormat) : undefined,
                                rules: [{ required: false }]
                            })(
                                <DatePicker
                                    showTime
                                    format={dayFormat}
                                    style={{ width: '100%' }}
                                    placeholder={language.UnPayMentOrderStartDate && language.UnPayMentOrderStartDate.message}
                                />
                            )}
                        </Form.Item>
                        <Form.Item {...formItemInput} label={<span className='common-label-style'>{language.UnPayMentOrderEndDate && language.UnPayMentOrderEndDate.descripts}</span>}>
                            {getFieldDecorator("EndDateTop", {
                                initialValue: this.state.EndDateTop ? moment(this.state.EndDateTop, dayFormat) : undefined,
                                rules: [{ required: false }]
                            })(
                                <DatePicker
                                    showTime
                                    format={dayFormat}
                                    style={{ width: '100%' }}
                                    placeholder={language.UnPayMentOrderEndDate && language.UnPayMentOrderEndDate.message}
                                />
                            )}
                        </Form.Item>
                       

                        <Form.Item {...formItemInput} label={<span className='common-label-style'>{language.UnPayMentOrderLoc && language.UnPayMentOrderLoc.descripts}</span>}>
                            {getFieldDecorator("locID", {
                                rules: [{ required: false }]
                            })(
                                <Select style={{ width: '100%' }}
                                    placeholder={language.UnPayMentOrderLoc && language.UnPayMentOrderLoc.message}
                                    allowClear
                                    showSearch
                                    onChange={this.changeDepartMent.bind(this)}
                                >{departMentOption}</Select>
                            )}
                        </Form.Item>

                        <Form.Item {...formItemInput} label={<span className='common-label-style'>{language.UnPayMentOrderDoctor && language.UnPayMentOrderDoctor.descripts}</span>}>
                            {getFieldDecorator("doctorID", {
                                rules: [{ required: false }]
                            })(
                                <Select style={{ width: '100%' }}
                                    placeholder={language.UnPayMentOrderDoctor && language.UnPayMentOrderDoctor.message}
                                    allowClear
                                    showSearch
                                >{depDoctorOption}</Select>
                            )}
                        </Form.Item>
                        
                        <Col span={24}>
                        
                            <Button type="primary" style={{ width: '48%', marginLeft: 60 }}
                                onClick={() => { this.setState({ page: 1, pageSize: '50' }, () => { this.handleQuery() }) }}>{language.UnPayMentOrderQuery && language.UnPayMentOrderQuery.descripts}</Button>

                        </Col>
                    </Form>
                </Card>
                <Card style={{ float: 'right', width: '79.5%', height: store.getState().tableHeight.y + 242 }}>
                    <Table
                        dataSource={this.state.data}
                        columns={this.state.columns}
                        // className='TableA'
                        rowClassName={this.setRowClassName}
                        pagination={false}
                        scroll={{ x: (this.state.columns && this.state.columns.length > 0 ? widthTotal : 2900), y: store.getState().tableHeight.y + 145 }}
                        bordered
                        rowKey={(data) => {
                            return data.ID
                        }}
                        loading={this.state.loading}
                        rowSelection={rowSelection}
                        onRow={this.onClickRow}
                    />
                    <CommonPagination size="large" current={this.state.page} total={this.state.total} search='search'
                        onShowSizeChange={this.apponShowSizeChange} complete={true} dataSource={this.state.data}
                        onChange={this.appPageChange} />
                    <ColumnAuthoritysModel
                        clientWidth='900px'
                        compontName='UnPayMentOrder'
                        configType="C"
                        onRef={this.onColumnRef}
                        reloadData={this.tableList}
                    />
                </Card>
                {/* <div>
                    <Modal
                        visible={this.state.visible}
                        okText={this.state.languageCode === "CN" ? "打印" : 'Set'}
                        onOk={this.PrintXYPresc}
                        onCancel={this.handleCancel}
                        cancelText={this.state.languageCode === "CN" ? "取消" : 'Cancel'}
                        width='1000px'
                        title={this.state.languageCode === "CN" ? "费用明细" : 'Cost Detail'}
                    >
                        <PayMentRecordModal onRef={this.onRef} userInfo={this.state.userInfo} key={this.state.userInfo.ID}></PayMentRecordModal>
                    </Modal>
                </div> */}
            </div >
        )
    }
}
export default Form.create()(PayMentRecord)