/**
 * 医嘱单 NZS
 */
import React, { Component } from 'react';
import { Table, message, Tabs, Button, Pagination, Radio, Modal } from 'antd';
import { $http } from '../../../containers/config/https';
import './style/orderTable.less'
import store from 'store';
import { $loopPrint } from '../../lodop/Common/Print';
// import { getLodop } from '../../lodop/Common/LodopFuncs.js';
// import { $loadTemplate } from '../../lodop/Common/Print.js';
import { printDoctorOrder } from '../../pharmacy/commonPrint/stkPrint';
// import CommonPagination from 'components/pagination/index';
import { $fastReportTemplate } from '../../lodop/Common/FastReportPrint.js';
import { Util } from 'tools/index';

const TabPane = Tabs.TabPane;
const confirm = Modal.confirm;
let user;

export default class OrdTableModal extends Component {

    constructor(props) {
        super(props);
        this.state = {
            size: 'small',
            patAdm: this.props.patAdmId,
            ordPrior: "L",
            transLoc: [],
            activeKey: "0",
            tableData: [],
            total: 0,
            page: 1,
            pageSize: 22,
            locId: '',
            inDate: "",
            inTime: "",
            outDate: "",
            outTime: "",
            sortColumn: 'ordSTDate',
            ENObj: {},
            CNObj: {},
            tempColumns: [],
            languageObj: {},
            longColumns: [],
            longOrderPageSize: 22,
            tempOrderPageSize: 22,
            printedFlag: false,              //打印标识
            keepPrintFlag: false,            //续打标识
            ids: [],
            fastreportPrintNotFlag: 'N',
            printStopFlag: 'N',
            loading: false
        }
        user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
    }

    componentDidMount() {
        // let leftList = document.querySelectorAll('.ordDatailHeight  .ant-table-body');
        // if (leftList.length > 0) {
        //     leftList[0].style.height = store.getState().tableHeight.y + 75 + 'px';
        // }
        this.getDeta();
        this.setState({
            tableData: []
        })
        this.getDocOrderPageSize();
        if (this.props.patAdmId != "") {
            this.getTransLoc(this.props.patAdmId);
        }
        this.initData();
        document.querySelector('.ant-table-body').style.height = store.getState().tableHeight.y + 'px';
    }

    componentWillReceiveProps(nextProps) {
        if ((this.props.patAdmId != nextProps.patAdmId) && (nextProps.patAdmId != "")) {
            this.getTransLoc(nextProps.patAdmId);
        }
    }

    // 获取列表头数据
    getDeta = () => {
        let { userInfo } = this.state;
        let data = {
            params: [{
                reactCode: ['NuserDrugOrderSheet'],
                compontName: 'NuserDrugOrderSheet',
                type: 'C',
            }]
        }
        $http.post('urlS', this, {
            code: '01040073',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    if (+res.errorCode === 0) {
                        let column = res.result.C;
                        if (user.language == 'EN') {
                            for (let i = 0; i < column.length; i++) {
                                column[i].title = column[i].enDescripts
                            }
                        }
                        let languageObj = res.result.language[user.language];
                        this.setState({
                            ENObj: res.result.language.EN,
                            CNObj: res.result.language.CN,
                            languageObj: languageObj
                        }, () => {
                            //this.queryOrder();
                            this.initData();
                        })
                    }
                }
            }
        })
    };

    //获取护理医嘱单单页行数配置
    getDocOrderPageSize = () => {
        let data = {
            params: [{}]
        }
        $http.post('urlADS', this, {
            code: '04060017',
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        longOrderPageSize: res.result.DocLongOrderPageSize,
                        tempOrderPageSize: res.result.DocTempOrderPageSize,
                        fastreportPrintNotFlag: res.result.FastreportPrintNotFlag,
                        printStopFlag: res.result.PrintStopFlag,
                        //默认长期医嘱
                        pageSize: res.result.DocLongOrderPageSize,
                    })
                }
            }
        })
    }

    getTransLoc = (patAdmId) => {
        let data = {
            params: [{
                admID: patAdmId,
                finish: 'Y',
                locFlag: "1",
            }]
        }
        $http.post('urlADS', this, {
            code: '04020021',
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (let i = 0; i < res.result.length; i++) {
                        res.result[i].key = i;
                    }
                    this.setState({
                        transLoc: res.result,
                        page: 1,
                    }, () => {
                        this.setDefaultTab()
                    })
                }
            }
        })
    }

    queryOrder() {
        this.setState({ loading: true });
        let data = {
            params: [{
                admID: this.props.patAdmId,
                priorFlag: this.state.ordPrior,
                locID: this.state.locId,
                startDate: this.state.inDate,
                startTime: this.state.inTime,
                stopTime: this.state.outTime,
                stopDate: this.state.outDate,
                locSeqNo: this.state.activeKey,
            }],
            pagination: [{
                pageSize: this.state.pageSize,
                currentPage: this.state.page,
                sortColumn: this.state.sortColumn,
                sortOrder: 'asc'
            }]
        };
        $http.post('urlADS', this, {
            code: '04060015',
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (let i = 0; i < res.result.orderList.length; i++) {
                        res.result.orderList[i].key = i;
                    }
                    this.setState({
                        loading: false,
                        tableData: res.result.orderList,
                        printRecordID: res.result.printRecordID,
                        ids: [],
                        selectData: [],
                        total: res.result.TotalCount,
                        printedFlag: res.result.printedFlag === "1" ? true : false,
                        keepPrintFlag: res.result.keepPrintFlag === "0" ? false : true,
                    })
                } else {
                    this.setState({
                        tableData: [],
                        total: 0,
                        ids: [],
                        selectData: [],
                        loading: false
                    })
                }
            },
            error: function () {
                this.setState({ loading: false });
            }
        });
    }

    displayLanguage = (code) => {
        if (this.state.languageObj[code]) {
            return this.state.languageObj[code].descripts;
        } else {
            return "";
        }
    }

    initData() {
        const tempColumns = [{
            title: this.displayLanguage("NuserDrugOrderSheetordStartDate"),
            dataIndex: 'ordStartDate',
            width: '80px',
            align: 'center',
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetordStartTime"),
            //title: '时间',
            dataIndex: 'ordStartTime',
            width: '80px',
            align: 'center',
        }, {
            title: '组号',
            dataIndex: 'ordLinkSign',
            width: '80px',
            align: 'center',
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetmedDesc"),
            // title: '医嘱名称',
            dataIndex: 'medDesc',
            width: '300px',
            align: 'left',
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetordDocName"),
            //title: '开医嘱人',
            dataIndex: 'ordDocName',
            width: '80px',
            align: 'center',
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetordHandleUserName"),
            // title: '执行人',
            dataIndex: 'ordHandleUserName',
            width: '80px',
            align: 'center',
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetordHandleTime"),
            // title: '执行时间',
            dataIndex: 'ordHandleTime',
            width: '80px',
            align: 'center',
        }]

        const longColumns = [{
            title: this.displayLanguage("NuserDrugOrderSheetStart"),
            children: [{
                title: this.displayLanguage("NuserDrugOrderSheetordStartDate"),
                dataIndex: 'ordStartDate',
                width: '80px',
                align: 'center',
            }, {
                title: '组号',
                dataIndex: 'ordLinkSign',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordStartTime"),
                dataIndex: 'ordStartTime',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetmedDesc"),
                dataIndex: 'medDesc',
                width: '300px',
                align: 'left',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordDocName"),
                dataIndex: 'ordDocName',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordHandleTime"),
                // title: '执行时间',
                dataIndex: 'ordHandleTime',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordHandleUserName"),
                dataIndex: 'ordHandleUserName',
                width: '80px',
                align: 'center',
            }]
        }, {
            title: this.displayLanguage("NuserDrugOrderSheetStop"),
            children: [{
                title: this.displayLanguage("NuserDrugOrderSheetordStopDate"),
                dataIndex: 'ordStopDate',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordStopTime"),
                dataIndex: 'ordStopTime',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordStopDocName"),
                dataIndex: 'ordStopDocName',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordStopHandlerName"),
                dataIndex: 'ordStopHandlerName',
                width: '80px',
                align: 'center',
            }, {
                title: this.displayLanguage("NuserDrugOrderSheetordStopHandlerTime"),
                // title: '执行时间',
                dataIndex: 'ordStopHandlerTime',
                width: '80px',
                align: 'center',
            }]
        }];
        this.setState({
            tempColumns: tempColumns,
            longColumns: longColumns
        })
    }

    onTabChange = (activeKey) => {
        this.setChangeState(activeKey);
    }

    //切换页签时[切换科室时设置开始结束日期时间]
    setChangeState(activeKey) {
        this.setState({
            locId: this.state.transLoc[activeKey].inLocID,
            activeKey: activeKey,
            inDate: this.state.transLoc[activeKey].inDate,
            inTime: this.state.transLoc[activeKey].inTime,
            outDate: this.state.transLoc[activeKey].outDate,
            outTime: this.state.transLoc[activeKey].outTime,
        }, () => {
            this.queryOrder();
        })
    }

    returnPrintSheet = async (ordIDs) => {
        let data = {
            params: [{
                admID: this.props.patAdmId,
                priorFlag: this.state.ordPrior,
                locID: this.state.locId,
                startDate: this.state.inDate,
                startTime: this.state.inTime,
                stopTime: this.state.outTime,
                stopDate: this.state.outDate,
                rpxName: this.state.ordPrior == "T" ? "DoctorTempOrder.rpx" : "DoctorTempOrder.rpx",
                locSeqNo: this.state.activeKey,
                power: "rePrint",
            }],
            pagination: [{
                pageSize: this.state.pageSize,
                currentPage: this.state.page,
                sortColumn: this.state.sortColumn,
                sortOrder: 'asc'
            }]
        }
        if (this.state.fastreportPrintNotFlag == 'Y') {
            //旧医嘱单打印
            printDoctorOrder.call(this, data);
        } else {
            this.printDoctorOrderNew(data, '04160045')       //新医嘱单打印
        }
    }

    handlePrint(type) {
        var that = this;
        confirm({
            title: '补打',
            content: <span>请放入&nbsp;<span>{that.state.ordPrior == 'L' ? '长期医嘱单' : '临时医嘱单'}</span>&nbsp;第 &nbsp;
                <span>{that.state.page}</span>&nbsp;页</span>,
            okText: user.language == 'EN' ? 'YES' : '是',
            cancelText: user.language == 'EN' ? 'NO' : '否',
            onOk() {
                that.handlePrintMessage(type)
            },
            onCancel() {
                console.log('Cancel');
            },
        });
    }

    handlePrintMessage = async (type) => {
        var { selectData } = this.state;
        var source = []
        if (!Util.isEmpty(selectData)) {
            for (var i = 0; i < selectData.length; i++) {
                source.push({
                    seqNo: selectData[i].seqNo,
                    selectDate: selectData[i].selectDate,
                    ordID: selectData[i].ordID,
                    pageSize: '22'
                })
            }
        }
        var params = {
            params: [{
                priorFlag: this.state.ordPrior,
                pageNumber: this.state.page,
                ordList: source,
                stopFlag: type === 2 ? 'Y' : ''  //补打停止时间参数
            }]
        }
        if (this.state.fastreportPrintNotFlag === 'Y') {
            //旧医嘱单打印
            $http.post('urlDeault', this, {
                code: "04060020",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.setState({
                            ids: [],
                            selectData: []
                        }, () => {
                            $loopPrint('', res.result);
                            this.queryOrder()
                        })
                    }
                }
            });
        } else {
            this.printDoctorOrderNew(params, '04160047')       //新医嘱单打印
        }
    }

    keepPrintSheetMsg() {
        var params = {
            params: [{
                printRecordID: this.state.printRecordID
            }]
        }
        $http.post('urlDeault', this, {
            code: "04060019",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        printMsg: res.result
                    }, () => {
                        var that = this;
                        confirm({
                            title: '续打',
                            content: <span>{that.state.printMsg}</span>,
                            okText: user.language == 'EN' ? 'YES' : '是',
                            cancelText: user.language == 'EN' ? 'NO' : '否',
                            onOk() {
                                that.keepPrintSheet()
                            },
                            onCancel() {
                                console.log('Cancel');
                            },
                        });
                    })
                }
            }
        });
    }

    // 续打 
    keepPrintSheet = async (ordIDs) => {
        let data = {
            params: [{
                admID: this.props.patAdmId,
                priorFlag: this.state.ordPrior,
                locID: this.state.locId,
                startDate: this.state.inDate,
                startTime: this.state.inTime,
                stopTime: this.state.outTime,
                stopDate: this.state.outDate,
                rpxName: this.state.ordPrior == "T" ? "DoctorTempOrder.rpx" : "DoctorTempOrder.rpx",
                locSeqNo: this.state.activeKey,
                power: "keepPrint",
            }],
            pagination: [{
                pageSize: this.state.pageSize,
                currentPage: this.state.page,
                sortColumn: this.state.sortColumn,
                sortOrder: 'asc'
            }]
        }
        //printDoctorOrder.call(this, data);
        if (this.state.fastreportPrintNotFlag === 'Y') {
            //旧医嘱单打印
            printDoctorOrder.call(this, data);
        } else {
            this.printDoctorOrderNew(data, '04160045')       //新医嘱单打印
        }
    }

    // 医嘱单打印
    printExecSheet = async (ordIDs) => {
        let data = {
            params: [{
                admID: this.props.patAdmId,
                priorFlag: this.state.ordPrior,
                locID: this.state.locId,
                startDate: this.state.inDate,
                startTime: this.state.inTime,
                stopTime: this.state.outTime,
                stopDate: this.state.outDate,
                pageNumber: this.state.page,
                rpxName: this.state.ordPrior == "T" ? "DoctorTempOrder.rpx" : "DoctorTempOrder.rpx",
                locSeqNo: this.state.activeKey,
                power: ordIDs == '1' ? "currentPrint" : undefined
            }],
            pagination: [{
                pageSize: this.state.pageSize,
                currentPage: this.state.page,
                sortColumn: this.state.sortColumn,
                sortOrder: 'asc'
            }]
        }
        if (this.state.fastreportPrintNotFlag === 'Y') {
            //旧医嘱单打印
            printDoctorOrder.call(this, data);
        } else {
            this.printDoctorOrderNew(data, '04160045')       //新医嘱单打印
        }
    }

    // 显示分页总条数
    showTotal(total) {
        return `共 ${total} 条`;
    }

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

    // 条数改变的回调
    onShowSizeChange = (current, size) => {
        this.setState({ page: current, pageSize: size }, () => {
            this.queryOrder();
        });
    }

    //其他功能下拉框
    selectChange = (value) => {
        message.info('其他功能待开发!');
    }

    //切换排序顺序开关
    sortSwitch = (checked) => {
        if (checked) {
            this.setState({
                sortColumn: 'ordSTDate',
            }, () => {
                this.queryOrder();
            });
        } else {
            this.setState({
                sortColumn: 'ordEnterDate',
            }, () => {
                this.queryOrder();
            });
        }
    }

    handleChangeReceive(name, e) {
        this.setState({
            [name]: e.target.value,
            page: 1,
        }, () => {
            this.queryOrder();
        })
    }

    handleChangeReceiveMsg(name, e) {
        this.setState({
            [name]: e.target.value,
            page: 1,
            pageSize: e.target.value == 'L' ? this.state.longOrderPageSize : this.state.tempOrderPageSize,
        }, () => {
            this.queryOrder();
        })
    }

    //切换临时、长期医嘱开关
    priorSwitch = (checked) => {
        if (checked) {
            this.setState({
                ordPrior: 'L',
                pageSize: this.state.longOrderPageSize,
            }, () => {
                this.queryOrder();
            });
        } else {
            this.setState({
                ordPrior: 'T',
                pageSize: this.state.tempOrderPageSize,
            }, () => {
                this.queryOrder();
            });
        }
    }

    //fastreport 新医嘱单打印
    printDoctorOrderNew = async (data, code) => {
        let res = await React.$asyncPost(this, code, data);
        if (res.errorCode == '0') {
            let result = res.result
            if (result != "") {
                let prindata = result.prindata
                for (var i = 0; i < prindata.length; i++) {
                    //多次打印，如果是进入编辑器会存在后面弹框覆盖前面，如果不是进行编辑器权限不会影响打印
                    var template = prindata[i].template
                    var dataResult = prindata[i].data;
                    $fastReportTemplate(template, user.hospID, dataResult, "");
                }
            }
            this.queryOrder();
        }
    }

    tabBarSelect = () => {
        // return (
        //    <div style={{ marginRight: "20px" }}>
        //        <Tag>开医嘱时间</Tag>
        //        <Switch
        //             defaultChecked={true}
        //             onChange={this.sortSwitch}
        //         />
        //        <Tag>医嘱开始时间</Tag>

        //        <Tag>长期医嘱</Tag>
        //        <Switch
        //             defaultChecked={true}
        //             onChange={this.priorSwitch}
        //             style={{ marginLeft: '2px' }}
        //        />
        //        <Tag>临时医嘱</Tag>

        //         <Select style={{ width: '100px' ,marginLeft: '10px',}}
        //             onChange={this.selectChange}    
        //         >
        //             <Option value="P">打印</Option>
        //             <Option value="P">重打</Option>
        //             <Option value="P">全部打印</Option>
        //             <Option value="P">删除单前页打印记录</Option>
        //             <Option value="P">导出Excel</Option>
        //             <Option value="P">重整医嘱</Option>
        //             <Option value="P">删除重整</Option>
        //         </Select>
        //    </div>
        // )
    }

    //初始化设置默认页签[默认当前登录科室或病区]
    setDefaultTab = () => {
        this.setChangeState((this.state.transLoc.length - 1) + "");
    }

    onSelectChange(ids, selectData) {
        this.setState({
            ids: ids,
            selectData: selectData
        })
    }

    render() {
        let { ids, loading } = this.state;
        let language = user.language;
        let languageObj = {};
        if (language == "EN") {
            languageObj = this.state.ENObj;
        } else {
            languageObj = this.state.CNObj;
        }
        const rowSelection = {
            ids,
            onChange: this.onSelectChange.bind(this),
            selectedRowKeys: ids,
        }
        return (
            <div style={{ height: "100%" }} className="OrderDesc">
                <Tabs
                    style={{ height: "100%" }}
                    onChange={this.onTabChange}
                    className="nurseOrder table-body-height"
                    activeKey={this.state.activeKey}
                    tabBarExtraContent={this.tabBarSelect()}
                >
                    {
                        this.state.transLoc.map(
                            (locNote, index) => {
                                return (
                                    <TabPane tab={locNote.inLocDesc}
                                        key={index + ""}
                                        className="nurseOrder"
                                    >
                                        <div style={{ marginRight: "20px", padding: '0 6px' }}>
                                            <Radio.Group style={{ marginLeft: 10 }} onChange={this.handleChangeReceive.bind(this, 'sortColumn')} buttonStyle="solid" value={this.state.sortColumn}>
                                                <Radio.Button value="ordEnterDate">{languageObj.NuserDrugOrderSheetOrderTime != null ? languageObj.NuserDrugOrderSheetOrderTime.descripts : ""}</Radio.Button>
                                                <Radio.Button value="ordSTDate">{languageObj.NuserDrugOrderSheetStartTime != null ? languageObj.NuserDrugOrderSheetStartTime.descripts : ""}</Radio.Button>
                                            </Radio.Group>
                                            <Radio.Group style={{ marginLeft: 10 }} onChange={this.handleChangeReceiveMsg.bind(this, 'ordPrior')} buttonStyle="solid" value={this.state.ordPrior}>
                                                <Radio.Button value="T">{languageObj.NuserDrugOrderSheetStatOrder != null ? languageObj.NuserDrugOrderSheetStatOrder.descripts : ""}</Radio.Button>
                                                <Radio.Button value="L">{languageObj.NuserDrugOrderSheetLong != null ? languageObj.NuserDrugOrderSheetLong.descripts : ""}</Radio.Button>
                                            </Radio.Group>
                                            {/* <Tag>{languageObj.NuserDrugOrderSheetOrderTime != null ? languageObj.NuserDrugOrderSheetOrderTime.descripts : ""}</Tag>
                                            <Switch
                                                defaultChecked={true}
                                                onChange={this.sortSwitch}
                                            />
                                            <Tag >{languageObj.NuserDrugOrderSheetStartTime != null ? languageObj.NuserDrugOrderSheetStartTime.descripts : ""}</Tag>
 
                                            <Tag >{languageObj.NuserDrugOrderSheetStatOrder != null ? languageObj.NuserDrugOrderSheetStatOrder.descripts : ""}</Tag>
                                            <Switch
                                                defaultChecked={true}
                                                onChange={this.priorSwitch}
                                            />
                                            <Tag>{languageObj.NuserDrugOrderSheetLong != null ? languageObj.NuserDrugOrderSheetLong.descripts : ""}</Tag> */}
                                            {/* <Tag>{languageObj.NuserDrugOrderSheetPatchy!= null ? languageObj.NuserDrugOrderSheetPatch.descripts : ""}</Tag> */}

                                            {/* <Select style={{ width: '180px', marginLeft: '10px', }}
                                                onChange={this.selectChange}
                                                placeholder="Enter自动查询"
                                            >
                                                <Option value="P">打印</Option>
                                                <Option value="P">重打</Option>
                                                <Option value="P">全部打印</Option>
                                                <Option value="P">删除单前页打印记录</Option>
                                                <Option value="P">导出Excel</Option>
                                                <Option value="P">重整医嘱</Option>
                                                <Option value="P">删除重整</Option>
                                            </Select> */}

                                            <div className="content-box" style={{ float: 'Right' }}>
                                                <span>当前页为第<span style={{ fontSize: '16px', color: '#007AFF', marginLeft: '5px' }}>{this.state.page}</span>页</span>
                                                <Button type="primary" style={{ marginLeft: '10px' }} disabled={!Util.isEmpty(this.state.ids)}
                                                    onClick={this.printExecSheet.bind(this, '1')} >打印当前页</Button>
                                                <Button type="primary" style={{ marginLeft: '10px' }}
                                                    disabled={this.state.printedFlag || !Util.isEmpty(this.state.ids)}
                                                    onClick={this.printExecSheet} >打印</Button>
                                                <Button type="primary" style={{ marginLeft: '10px' }}
                                                    disabled={!this.state.keepPrintFlag || !Util.isEmpty(this.state.ids)}
                                                    onClick={this.keepPrintSheetMsg.bind(this)} >续打</Button>
                                                <Button type="primary" style={{ marginLeft: '10px' }}
                                                    disabled={Util.isEmpty(this.state.ids)}
                                                    onClick={this.handlePrint.bind(this, 1)} >补打</Button>
                                                {/*补打停止时间只*/}
                                                <Button type="primary" style={{
                                                    marginLeft: '10px',
                                                    display: this.state.printStopFlag === 'Y' ? '' : 'none'
                                                }}
                                                    disabled={Util.isEmpty(this.state.ids)}
                                                    onClick={this.handlePrint.bind(this, 2)} >补打取消标志</Button>

                                                <Button type="primary" style={{ marginLeft: '10px' }}
                                                    disabled={!this.state.printedFlag || !Util.isEmpty(this.state.ids)}
                                                    onClick={this.returnPrintSheet} >重打</Button>
                                                <span className="content"></span>&nbsp;&nbsp;{languageObj.NuserDrugOrderSheetStop != null ? languageObj.NuserDrugOrderSheetStop.descripts : ""}
                                                <span className="content-text"></span>&nbsp;&nbsp;{languageObj.NuserDrugOrderSheetUndo != null ? languageObj.NuserDrugOrderSheetUndo.descripts : ""}
                                                <span className="content-con"></span>&nbsp;&nbsp;{languageObj.NuserDrugOrderSheetRepeal != null ? languageObj.NuserDrugOrderSheetRepeal.descripts : ""}
                                                <span className="content-con-print"></span>&nbsp;&nbsp;{'未打印'}

                                                {/* <Tag color="#0C2EF0" style={{ width: '100px', marginLeft: '100px' }}>停止</Tag>
                                            <Tag color="#6CA894" style={{ width: '100px', marginLeft: '10px'}}>撤销</Tag>
                                            <Tag color="#09B7F1" style={{ width: '100px', marginLeft: '10px'}}>作废</Tag> */}
                                            </div>

                                        </div>
                                        <div style={{ padding: 12 }}>
                                            <Table
                                                bordered
                                                loading={loading}
                                                scroll={{ x: 620, y: store.getState().tableHeight.y + (this.state.ordPrior === 'T' ? 30 : -15) }}
                                                columns={this.state.ordPrior === "T" ? this.state.tempColumns : this.state.longColumns}
                                                dataSource={this.state.tableData}
                                                pagination={false} rowSelection={rowSelection}
                                                style={{ width: '100%', height: store.getState().tableHeight.y + 80 + 'px' }}
                                                rowKey={(data) => {
                                                    return data.ordID
                                                }}
                                                rowClassName={(record) => {
                                                    if (record.ordStatusCode === "DO") {
                                                        if (record.printFlag == 'N') {
                                                            return 'stopBgd'
                                                        } else {
                                                            return 'stopOrd'
                                                        }
                                                    } else if (record.ordStatusCode === "CO") {
                                                        if (record.printFlag == 'N') {
                                                            return 'cancelOrdBgd'
                                                        } else {
                                                            return 'cancelOrd'
                                                        }
                                                    } else if (record.ordStatusCode === "U") {
                                                        if (record.printFlag == 'N') {
                                                            return 'nullifyOrdbgd'
                                                        } else {
                                                            return 'nullifyOrd'
                                                        }
                                                    } else {
                                                        if (record.printFlag == 'N') {
                                                            return 'usualOrdBgd'
                                                        } else {
                                                            return 'usualOrd'
                                                        }
                                                    }

                                                }}
                                            />
                                            {/*<CommonPagination
                                                size={this.state.pageSize}
                                                current={this.state.page}
                                                total={this.state.total}
                                                search={this.state.search}
                                                onShowSizeChange={this.onShowSizeChange.bind(this)}
                                                complete={true}
                                                dataSource={this.state.tableData}
                                                loading={this.state.loading} 
                                                onChange={this.onChange.bind(this)} 
                                            />*/}
                                            <Pagination
                                                showTotal={() => this.showTotal(this.state.total)}
                                                // size="small"
                                                showQuickJumper
                                                showSizeChanger
                                                defaultCurrent={1}
                                                current={this.state.page}
                                                total={this.state.total}
                                                onChange={this.onChange.bind(this)}
                                                onShowSizeChange={this.onShowSizeChange.bind(this)}
                                                style={{ textAlign: "right", marginTop: '5px' }}
                                                pageSizeOptions={['22']}
                                                defaultPageSize={this.state.pageSize}
                                                bordered
                                            />
                                        </div>
                                    </TabPane>
                                )
                            }
                        )
                    }
                </Tabs>
            </div>
        )
    }
}