// 草药组套维护
import React from 'react';
import { Row, Col, Card, Input, Button, Checkbox, Table, Divider, Icon, Form, Select, Popconfirm, message } from 'antd';
import store from 'store';
import { $http } from 'containers/config/https';
import PublicModalTable from 'pages/common/PublicModalTable';
import CMOrderGroupModal from './component/CMOrderGroupModal';
import PublicDataOrderAdjustment from 'pages/common/PublicDataOrderAdjustment';
import './css/index.less';
import '../workstation/style/CMOrderSave.less';
import '../workstation/style/index.less';

const { Option } = Select;

class CMOrderGroup extends React.Component {
    constructor(props) {
        super(props);
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        this.state = {
            user: userData,
            tableData: [],
            modalData: [], // 名称模态框数据
            modalRowId: '',
            top: '',
            left: '',
            selectData: {}, // 下拉框数据集
            nameInput: undefined, // 别名
            status: true, // 生效标志
            userSelf: false, // 个人标志
            departmentInformation: [], // 科室下拉框数据
            orderSetDetailData: [], // 草药医嘱套明细数据
            checkStatus: false, // 记录全选点击状态
            rowId: '', // 选中行ID
            rowData: {}, // 选中行数据
            cmOrderSetDetailComPrincipleID: undefined, // 用药类型
            cmOrderSetDetailDoseQty: undefined, // 药品数量
            cmOrderSetDetailDecoctMethodID: undefined, // 备注
            cmOrderSetDetailMedItemDesc: undefined, // 名称描述
            cmOrderSetDetailMedItemID: '', //名称ID
            page: 1,
            pageSize: 10,
            total: 0,
            num: 0,
            sum: 0, // 单副金额
            sumTotal: 0, // 总金额
        };
        this.columns = [{
            title: '级别',
            dataIndex: 'title',
            key: '1',
            width: '100px',
        }, {
            title: '名称',
            dataIndex: 'cmOrderSetDesc',
            key: '2',
            width: '150px',
        }, {
            title: '别名',
            dataIndex: 'cmOrderSetAlias',
            width: '150px',
            key: '3',
        }, {
            title: '操作员',
            dataIndex: 'creatUserDesc',
            width: '80px',
            key: '4',
        }, {
            title: '状态',
            dataIndex: 'cmOrderSetStatus',
            width: '80px',
            key: '5',
            render(value, row, index) {
                const obj = {
                    children: row?.cmOrderSetID ? (value === "Y" ? '生效' : '失效') : '',
                    props: {},
                };
                return obj;
            },
        }, {
            title: '操作',
            align: 'center',
            width: '120px',
            key: '6',
            fixed: 'right',
            render: (value, row, index) => {
                const obj = {
                    children: (
                        row?.cmOrderSetID ? (
                            <span>
                                <Icon type="edit" style={{ color: '#108EE9' }}></Icon>
                                <span className='span' onClick={(e) => this.handleCompile(e, row)}>编辑</span>
                                {/* 分割线 */}
                                <Divider type="vertical" />
                                <Icon type="delete" style={{ color: 'rgba(240,65,52,1)' }}></Icon>
                                <Popconfirm title="删除不可恢复，你确定要删除吗?" onCancel={this.handlePopconfirm} onClick={this.handlePopconfirm} onConfirm={(e) => this.handleDelete(e, row)} >
                                    <span className='span' style={{ color: 'rgba(240,65,52,1)' }}>删除</span>
                                </Popconfirm>
                            </span>
                        ) : (
                            <span className="span" onClick={(e) => this.handleSort(row, e)}>设置个人排序</span>
                        )
                    ),
                    props: {},
                };
                return obj;
            },
        }];
        this.modalColumns = [{
            title: '编码',
            dataIndex: 'medCode',
            key: '1',
            width: '100px',
            align: 'center'
        }, {
            title: '名称*规格',
            dataIndex: 'medDesc',
            width: '150px',
            key: '2',
            align: 'center'
        }, {
            title: '大类',
            dataIndex: 'medCatDesc',
            width: '100px',
            key: '3',
            align: 'center'
        }, {
            title: '子类',
            dataIndex: 'medSubCatDesc',
            key: '4',
            width: '150px',
            align: 'center'
        }];
        this.myRef1 = React.createRef();
        this.myRef2 = React.createRef();
        this.myRef3 = React.createRef();
        this.myRef4 = React.createRef();
    }

    componentDidMount() {
        this.getSelectData();
        this.handleQuery();
    }

    // 点击删除时阻止事件冒泡
    handlePopconfirm = (e) => {
        e.stopPropagation();
    }

    // 获取下拉框数据
    getSelectData = () => {
        let { user } = this.state;
        let data = {
            params: [
                {
                    comPrincipleFlag: '1',
                    herbalFormFlag: '1',
                    frequenceFlag: '1',
                    usageFlag: '1',
                    durationFlag: '1',
                    authRangeFlag: '1',
                    usageExplainFlag: '1',
                    decoctMethodFlag: '1',
                    // cookTypeFlag: '1',
                    hospID: user.hospID ? user.hospID : '',
                    admType: 'O', // 就诊类型
                }
            ]
        }
        $http.post('urlS', this, {
            code: "03050018",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    this.setState({ selectData: res })
                    // , () => {
                    //     this.props.form.setFieldsValue({
                    //         // 使用剂型
                    //         cmOrderSetHerbalFormID: this.state.selectData&&this.state.selectData.defaultHerbalFormID ? this.state.selectData.defaultHerbalFormID : undefined,
                    //         // 用药副数
                    //         cmOrderSetDurQty: this.state.selectData&&this.state.selectData.defaultDurQty ? this.state.selectData.defaultDurQty : undefined,
                    //         // 使用频次
                    //         cmOrderSetFreqID: this.state.selectData&&this.state.selectData.defaultFreqID ? this.state.selectData.defaultFreqID : undefined,
                    //         // 每次用量
                    //         cmOrderSetDoseQty: this.state.selectData&&this.state.selectData.defaultDoseQty ? this.state.selectData.defaultDoseQty : undefined,
                    //         // 用药方法
                    //         cmOrderSetUsageID: this.state.selectData&&this.state.selectData.defaultUsageID ? this.state.selectData.defaultUsageID : undefined,
                    //         // 服用要求
                    //         // cmOrderSetUsageExplainID: '',
                    //         // 执行科室
                    //         // cmOrderSetRecLocID: '',
                    //     })
                    //     this.getDepartmentInformation(this.state.selectData&&this.state.selectData.defaultHerbalFormID ? this.state.selectData.defaultHerbalFormID : '', 'yes');
                    // }
                }
            }
        })
    }

    // 3.13.23.获取科室信息
    getDepartmentInformation = (herbalFormID, isText) => {
        let data = {
            params: [
                {
                    herbalFormID: herbalFormID ? herbalFormID : '', // 剂型ID
                    admType: 'O', // 就诊类型
                    tisaneFlag: 'N', // 代煎标识
                }
            ]
        }
        $http.post('urlS', this, {
            code: "03050083",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let obj = {
                        cmOrderSetDurQty: res.data && res.data.defaultDurQty ? res.data.defaultDurQty : undefined,
                        // 使用频次
                        cmOrderSetFreqID: res.data && res.data.defaultFreqID ? res.data.defaultFreqID : undefined,
                        // 每次用量
                        cmOrderSetDoseQty: res.data && res.data.defaultDoseQty ? res.data.defaultDoseQty : undefined,
                        // 用药方法
                        cmOrderSetUsageID: res.data && res.data.defaultUsageID ? res.data.defaultUsageID : undefined,
                        // 服用要求
                        // cmOrderSetUsageExplainID: '',
                        // 执行科室
                        cmOrderSetRecLocID: res.data && res.data.defaultCMRecLocID ? res.data.defaultCMRecLocID : undefined,
                    }
                    this.setState({ departmentInformation: res.data && res.data.CMRecLocList.length > 0 ? res.data.CMRecLocList : [], rowData: isText !== 'no' ? obj : this.state.rowData })
                } else {
                    this.setState({ departmentInformation: [] })
                }
            }
        })
    }

    // 输入名称/别名回车查询列表数据
    handleQuery = () => {
        this.resetFields();
        let { userSelf, status, nameInput } = this.state;
        let data = {
            params: [
                {
                    userSelf: userSelf ? 'Y' : 'N', // 个人标志
                    status: status ? 'Y' : 'N', // 生效标志
                    input: nameInput, // 搜索框内容
                }
            ]
        }
        $http.post('urlS', this, {
            code: "03050024",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result && JSON.parse(JSON.stringify(res.result)).map((item, index) => {
                        return {
                            id: item.id,
                            title: item.title,
                            key: index + 'main',
                            children: item.data && item.data.map((childItem, childIndex) => {
                                return {
                                    key: childItem.cmOrderSetID,
                                    ...childItem,
                                }
                            })
                        }
                    })
                    this.setState({ tableData: arr, rowData: {}, rowId: '', orderSetDetailData: [] })
                }
            }
        })
    }

    onRef = (ref) => {
        this.child = ref;
    }

    groupRef = (ref) => {
        this.groupChild = ref;
    }

    // 获取描述列表数据
    getModalListData(isShowModal) {
        let { cmOrderSetDetailMedItemDesc, pageSize, page, user } = this.state;
        let herbalFormID = this.props.form.getFieldValue('cmOrderSetHerbalFormID');
        let data = {
            params: [
                {
                    searchCode: cmOrderSetDetailMedItemDesc, // 库存项描述别名
                    admID: "",
                    // admLocID: user.groupID,
                    logonLocID: user.locID ? user.locID : '',
                    userID: user.userID ? user.userID : '',
                    groupID: user.groupID ? user.groupID : '',
                    medSubCatID: this.state.selectData && this.state.selectData.defaultMedSubCatID ? this.state.selectData.defaultMedSubCatID : '',
                    hospID: user.hospID ? user.hospID : '',
                    cmFlag: 'Y',
                    herbalFormID, // 草药剂型
                }
            ],
            pagination: [{
                pageSize: 100000,
                currentPage: 1
            }]
        }
        setTimeout(() => {
            var gundong = document.getElementById("gundong");
            gundong.scrollTop = 0;
        }, 100)
        $http.post('urlS', this, {
            code: "03050019",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result.data ? res.result.data : [];
                    for (var i = 0; i < arr.length; i++) {
                        arr[i].key = i + 1
                    }
                    this.setState({ modalData: arr, total: res.result.totalCount, modalRowId: arr[0] ? arr[0].key : "" }, () => {
                        isShowModal === 'show' ? this.child.showModal() : ''
                    });
                }
            },
            error: function () {
                isShowModal === 'show' ? this.child.showModal() : ''
            }
        })
    }

    // 编辑
    handleCompile = (e, record) => {
        e.stopPropagation();
        this.groupChild.showModal("compile", record)
    }

    // 删除
    handleDelete = (e, record) => {
        e.stopPropagation();
        let data = {
            params: [{
                cmOrderSetID: record.cmOrderSetID
            }]
        }
        $http.post('urlADS', this, {
            code: '03050026',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    // 成功提示
                    message.success("删除成功")
                    this.handleQuery();
                }
            }
        })
    }

    // 名称回车事件
    nameOnPressEnter = (e) => {
        if (!e.target.value) {
            message.info("请输入名称回车搜索")
            return;
        }
        let top = document.getElementById('name-input').getBoundingClientRect().top + 40 + 'px';
        let left = document.getElementById('name-input').getBoundingClientRect().left + 'px';
        this.setState({
            top: top,
            left: left,
            cmOrderSetDetailMedItemDesc: e.target.value
        }, () => {
            this.getModalListData('show');
        });

    }

    // 操作弹框
    onClickRowPublic = (record) => {
        return {
            // 单击行选中
            onClick: () => {
                if (this.state.modalRowId === '') {
                    // 保存行数据以及ID
                    this.setState({ modalRowId: record.key })
                } else {
                    if (this.state.modalRowId !== record.key) {
                        this.setState({ modalRowId: record.key })
                    }
                }
            },
            onDoubleClick: () => {
                this.confirmSelection(record);
            }
        }
    }

    // 修改名称列表条数以及列数
    compilePage = (page, pageSize) => {
        this.setState({ page, pageSize }, () => {
            this.getModalListData()
        })
    }

    setRowClassNamePublic = (record) => {
        return record.key === this.state.modalRowId ? 'clickRowStyle' : '';
    }

    // 双击选中行数据的回调
    confirmSelection = (record) => {
        this.setState({ cmOrderSetDetailMedItemDesc: record.medDesc, cmOrderSetDetailMedItemID: record.medID }, () => {
            this.child.handleCancel();
        })
        setTimeout(() => {
            this.myRef2.current.focus();
        }, 100)
    }

    // 搜索条件 -- 别名
    handleNameInput = (e) => {
        this.setState({ nameInput: e.target.value })
    }

    // 搜索条件 -- 仅显示生效
    handleStatus = (e) => {
        this.setState({ status: e.target.checked }, () => {
            this.handleQuery()
        })
    }

    // 搜索条件 -- 仅显示本人添加的成套医嘱
    handleUserSelf = (e) => {
        this.setState({ userSelf: e.target.checked }, () => {
            this.handleQuery()
        })
    }

    // 全选
    handleCheckAll = () => {
        let { checkStatus, orderSetDetailData } = this.state;
        let checkStatusFlag = checkStatus; // 记录全选点击状态
        this.setState({ checkStatus: !checkStatus });
        let arr = orderSetDetailData ? JSON.parse(JSON.stringify(orderSetDetailData)) : [];
        if (!(arr && arr.length > 0)) {
            message.info("暂无可操作的数据");
            return;
        }
        for (var i = 0; i < arr.length; i++) {
            if (!checkStatusFlag) {
                arr[i].checkBox = true;
            } else {
                arr[i].checkBox = false;
            }

        }
        this.setState({ orderSetDetailData: arr })
    }

    // 改变checkBox操作
    handleCheckOnChange = (item, e) => {
        e.stopPropagation();
        let arr = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let checkStatusFlag = true;
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].key === item.key) {
                arr[i].checkBox = !arr[i].checkBox;
                break;
            }
        }
        this.setState({ orderSetDetailData: arr, checkStatus: checkStatusFlag }, () => {
            for (var j = 0; j < this.state.orderSetDetailData.length; j++) {
                if (!this.state.orderSetDetailData[j].checkBox) {
                    checkStatusFlag = false;
                    break;
                }
            }
            this.setState({ checkStatus: checkStatusFlag })
        });
    }

    // 保存明细医嘱套
    handleSaveDetailList = () => {
        if (this.state.rowId) {
            this.props.form.validateFields((err, values) => {
                if (!err) {
                    let { orderSetDetailData } = this.state;
                    let arr = orderSetDetailData ? JSON.parse(JSON.stringify(orderSetDetailData)) : [];
                    for (var i = 0; i < arr.length; i++) {
                        arr[i].cmOrderSetID = this.state.rowId,
                            arr[i].cmOrderSetDetailSeqNo = arr[i].key
                    }
                    let obj = {
                        cmOrderSetID: this.state.rowId,
                        ...values,
                        detailData: arr && arr.length > 0 ? arr : undefined,
                    }
                    let data = {
                        params: []
                    }
                    data.params.push(obj);
                    $http.post('urlADS', this, {
                        code: '03050025',
                        data: data,
                        success: function (res) {
                            if (+res.errorCode === 0) {
                                // 成功提示
                                message.success("保存成功");
                                // this.getDetailListData(this.state.rowData.cmOrderSetID);
                                this.handleQuery();
                                this.resetFields();
                                this.clearDetailFormData();
                            }
                        }
                    })
                }
            })
        } else {
            message.info("请先选择一条成套医嘱数据")
        }
    }

    // 重置表单
    resetFields() {
        this.props.form.resetFields();
    }

    // 操作行
    handleOnRow = (record) => {
        return {
            // 单击行选中
            onClick: () => {
                if (record.cmOrderSetID) {
                    if (this.state.rowId === '') {
                        // 保存行数据以及ID
                        this.setState({ rowId: record.cmOrderSetID, rowData: record }, () => {
                            // console.log(this.state.rowData)
                            // 查询医嘱草药医嘱套明细
                            this.getDetailListData(record.cmOrderSetID);
                            this.getDepartmentInformation(record.cmOrderSetHerbalFormID, 'no');
                        })
                    } else {
                        if (this.state.rowId !== record.cmOrderSetID) {
                            this.setState({ rowId: record.cmOrderSetID, rowData: record }, () => {
                                // 查询医嘱草药医嘱套明细
                                this.getDetailListData(record.cmOrderSetID);
                                this.getDepartmentInformation(record.cmOrderSetHerbalFormID, 'no');
                            })
                        }
                    }
                }
            }
        }
    }

    // 添加选中行背景颜色
    setRowClassName = (record) => {
        return record.cmOrderSetID === this.state.rowId ? 'clickRowStyle' : '';
    }

    // 获取医嘱草药医嘱套明细
    getDetailListData = (cmOrderSetID) => {
        this.resetFields();
        let data = {
            params: [
                {
                    cmOrderSetID: cmOrderSetID ? cmOrderSetID : '', // 库存项描述别名
                }
            ]
        }
        $http.post('urlS', this, {
            code: "03050027",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    for (var i = 0; i < res.result.length; i++) {
                        res.result[i].key = i,
                            res.result[i].checkBox = false,
                            res.result[i].cmOrderSetDetailDecoctMethodDesc = res.result[i].cmOrderSetDetailDecoctMethodDesc ? res.result[i].cmOrderSetDetailDecoctMethodDesc : '无'
                    }
                    this.setState({ orderSetDetailData: res.result, num: res.result.length - 1, sum: res.sum, sumTotal: res.sumTotal })
                }
            }
        })
    }

    handleTransition = (arr, id) => {
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].id === id) {
                return arr[i].descripts
            }
        }
    }

    // 重置明细输入框数据
    clearDetailFormData = () => {
        let { orderSetDetailData } = this.state;
        for (var i = 0; i < orderSetDetailData.length; i++) {
            orderSetDetailData[i].isboxShadow = false;
        }
        this.setState({
            orderSetDetailData,
            detailRowData: {}, // 需要修改的明细数据
            cmOrderSetDetailComPrincipleID: undefined,
            cmOrderSetDetailDoseQty: undefined,
            cmOrderSetDetailDecoctMethodID: undefined,
            cmOrderSetDetailDecoctMethodDesc: '',
            cmOrderSetDetailMedItemDesc: undefined,
            cmOrderSetDetailMedItemID: '',
        })
    }

    // 新增明细
    handleDetailSave = () => {
        let { cmOrderSetDetailComPrincipleID, cmOrderSetDetailDoseQty, cmOrderSetDetailDecoctMethodID, cmOrderSetDetailMedItemDesc,
            cmOrderSetDetailMedItemID, selectData, num, orderSetDetailData, detailRowData } = this.state;
        let nums = orderSetDetailData && orderSetDetailData.length > 0 ? num + 1 : 0;
        if (!cmOrderSetDetailMedItemID) {
            message.info("名称不能为空");
            setTimeout(() => {
                this.myRef1.current.focus();
            }, 100)
            return;
        }
        if (!cmOrderSetDetailDoseQty) {
            message.info("药品数量不能为空");
            setTimeout(() => {
                this.myRef2.current.focus();
            }, 100)
            return;
        }
        let obj = {
            cmOrderSetDetailComPrincipleID,
            cmOrderSetDetailDoseQty: cmOrderSetDetailDoseQty,
            cmOrderSetDetailDecoctMethodID,
            cmOrderSetDetailDecoctMethodDesc: cmOrderSetDetailDecoctMethodID ? this.handleTransition(selectData.decoctMethod, cmOrderSetDetailDecoctMethodID) : '无',
            cmOrderSetDetailMedItemDesc,
            cmOrderSetDetailMedItemID,
            checkBox: false,
            cmOrderSetDetailSeqNo: nums,
            key: nums,
        }
        let arr = JSON.parse(JSON.stringify(this.state.orderSetDetailData));
        console.log(arr, detailRowData, obj)
        if (detailRowData && detailRowData.cmOrderSetDetailMedItemID) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].cmOrderSetDetailMedItemID === detailRowData.cmOrderSetDetailMedItemID) {
                    arr[i] = obj;
                    break;
                }
            }
        } else {
            for (var i = 0; i < orderSetDetailData.length; i++) { // 编辑或者新增时名称不能重复
                if (orderSetDetailData[i].cmOrderSetDetailMedItemID == cmOrderSetDetailMedItemID) {
                    message.error("已经存在该名称，请添加别的名称");
                    return;
                }
            }
            arr.push(obj);
        }
        // console.log(arr)
        this.setState({ orderSetDetailData: arr, num: nums }, () => {
            this.clearDetailFormData();
        })
        setTimeout(() => {
            this.myRef1.current.focus();
        }, 100)
    }

    // 用药类型
    handleCmOrderSetDetailComPrincipleID = (e) => {
        this.setState({ cmOrderSetDetailComPrincipleID: e }, () => {
            setTimeout(() => {
                this.myRef3.current.focus();
            }, 100)
        })
    }

    // 药品数量
    handleCmOrderSetDetailDoseQty = (e) => {
        this.setState({ cmOrderSetDetailDoseQty: e.target.value })
    }

    // 名称
    handlecmOrderSetDetailMedItemDesc = (e) => {
        this.setState({ cmOrderSetDetailMedItemDesc: e.target.value })
    }

    // 备注
    handleCmOrderSetDetailDecoctMethodID = (e) => {
        this.setState({ cmOrderSetDetailDecoctMethodID: e }, () => {
            this.doseQtyOnPressEnter();
        })
    }

    // 名称失焦操作
    handleOnBlur = (e) => {
        if (this.state.cmOrderSetDetailMedItemID) {
            let arr = this.state.modalData ? JSON.parse(JSON.stringify(this.state.modalData)) : '';
            let status = false;
            for (var i = 0; i < arr.length; i++) {
                if (arr[i].medDesc === e.target.value) {
                    status = true;
                    break;
                }
            }
            if (!status) {
                this.setState({ cmOrderSetDetailMedItemID: '', cmOrderSetDetailMedItemDesc: undefined })
            }
        } else {
            this.setState({ cmOrderSetDetailMedItemID: '', cmOrderSetDetailMedItemDesc: undefined })
        }
    }

    // 删除明细
    handleDeleteDetail = () => {
        let { orderSetDetailData } = this.state;
        let arr = orderSetDetailData ? JSON.parse(JSON.stringify(orderSetDetailData)) : [];
        let filterData = [];
        let filterLocalData = orderSetDetailData ? JSON.parse(JSON.stringify(orderSetDetailData)) : [];
        let localData = [];
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].checkBox) {
                if (arr[i].cmOrderSetDetailID) {
                    filterData.push(arr[i].cmOrderSetDetailID);
                } else {
                    localData.push(arr[i])
                    filterLocalData = filterLocalData.filter(function (item) { return arr[i].key !== item.key });
                }
            }
        }
        if ((filterData && filterData.length > 0) || (localData && localData.length > 0)) {
            if (filterData && filterData.length > 0) {
                let data = {
                    params: [
                        {
                            cmOrderSetDetailIDs: filterData,
                        }
                    ]
                }
                $http.post('urlS', this, {
                    code: "03050029",
                    data: data,
                    success: function (res) {
                        if (+res.errorCode === 0) {
                            this.getDetailListData(this.state.rowData.cmOrderSetID);
                            message.success("删除成功");
                            this.clearDetailFormData();
                        }
                    }
                })
            }
            this.setState({ orderSetDetailData: filterLocalData }, () => {
                this.clearDetailFormData();
            })
        } else {
            message.info("请选择需要删除的数据")
        }
    }

    // 获取以及勾选的数据
    getCheckBoxData = () => {
        let arr = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let filterData = [];
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].checkBox) {
                filterData.push(arr[i])
            }
        }
        return filterData;
    }

    // 左移
    handleLeft = () => {
        let data = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let checkData = this.getCheckBoxData();
        if (checkData && checkData.length > 0) {
            for (var i = 0; i < checkData.length; i++) {
                if (+checkData[i].key === 0) {
                    break;
                }
                var curRowData = data[Number(checkData[i].key)];
                var curRowKey = curRowData.key;
                var leftRowData = data[Number(checkData[i].key) - 1];
                var leftRowKey = leftRowData.key;
                leftRowData.key = curRowKey;
                curRowData.key = leftRowKey;

                data[Number(checkData[i].key)] = leftRowData;
                data[Number(checkData[i].key) - 1] = curRowData;
            }
            this.setState({ orderSetDetailData: data });
        } else {
            message.info("请选择需要操作的数据")
        }
    }

    // 右移
    handleRight = () => {
        let data = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let checkData = this.getCheckBoxData();
        if (checkData && checkData.length > 0) {
            for (var i = checkData.length - 1; i >= 0; i--) {
                if (+checkData[i].key >= data.length - 1) {
                    break;
                }
                var curRowData = data[Number(checkData[i].key)];
                var curRowKey = curRowData.key;
                var rightRowData = data[Number(checkData[i].key) + 1];
                var rightRowKey = rightRowData.key;
                rightRowData.key = curRowKey;
                curRowData.key = rightRowKey;

                data[Number(checkData[i].key)] = rightRowData;
                data[Number(checkData[i].key) + 1] = curRowData;
            }
            this.setState({ orderSetDetailData: data });
        } else {
            message.info("请选择需要操作的数据")
        }
    }

    // 获取dom宽度
    getDetailListWidth = (domId) => {
        var o = document.getElementById(domId);
        var w = o.clientWidth || o.clientWidth;
        let num = Number(Math.floor(w / 158));
        return num;
    }

    // 上移
    handleUp = () => {
        let nums = this.getDetailListWidth("round-detail-list");
        let data = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let checkData = this.getCheckBoxData();
        if (checkData && checkData.length > 0) {
            for (var i = 0; i < checkData.length; i++) {
                if (+checkData[i].key - nums < 0) {
                    break;
                }
                var curRowData = data[Number(checkData[i].key)];
                var curRowKey = curRowData.key;
                var leftRowData = data[Number(checkData[i].key) - nums];
                var leftRowKey = leftRowData.key;
                leftRowData.key = curRowKey;
                curRowData.key = leftRowKey;

                data[Number(checkData[i].key)] = leftRowData;
                data[Number(checkData[i].key) - nums] = curRowData;
            }
            this.setState({ orderSetDetailData: data });
        } else {
            message.info("请选择需要操作的数据")
        }
    }

    // 下移
    handleDown = () => {
        let nums = this.getDetailListWidth("round-detail-list");
        let data = this.state.orderSetDetailData ? JSON.parse(JSON.stringify(this.state.orderSetDetailData)) : [];
        let checkData = this.getCheckBoxData();
        if (checkData && checkData.length > 0) {
            for (var i = checkData.length - 1; i >= 0; i--) {
                if (+checkData[i].key + nums > data.length - 1) {
                    break;
                }
                var curRowData = data[Number(checkData[i].key)];
                var curRowKey = curRowData.key;
                var rightRowData = data[Number(checkData[i].key) + nums];
                var rightRowKey = rightRowData.key;
                rightRowData.key = curRowKey;
                curRowData.key = rightRowKey;

                data[Number(checkData[i].key)] = rightRowData;
                data[Number(checkData[i].key) + nums] = curRowData;
            }
            this.setState({ orderSetDetailData: data });
        } else {
            message.info("请选择需要操作的数据")
        }
    }

    handleOnKeydown = (e) => {
        var e = window.event || e;
        switch (e.keyCode) {
            case 38: //上
                this.handleUp()
                break;
            case 40: //下
                this.handleDown();
                break;
            case 37: //左
                this.handleLeft()
                break;
            case 39: //右
                this.handleRight();
                break;
        }
    }

    // 键盘操作名称模态框数据
    handlePublicModalTableOnKeydown = (e) => {
        var e = window.event || e;
        let scroll_height = 32;
        let id = '';
        let oneArr = this.state.modalData && this.state.modalData.length > 0 ? this.state.modalData : [];
        switch (e.keyCode) {
            case 13:
                if (this.state.modalRowId) {
                    let obj = {}
                    for (var i = 0; i < oneArr.length; i++) {
                        if (oneArr[i].key === this.state.modalRowId) {
                            obj = i > 0 ? oneArr[i] : oneArr[0];
                            break;
                        }
                    }
                    this.confirmSelection(obj);
                } else {
                    message.info("请选择一条需要操作的数据")
                }
                break;
            case 38: //上
                if (this.state.modalRowId) {
                    for (var i = 0; i < oneArr.length; i++) {
                        if (oneArr[i].key === this.state.modalRowId) {
                            id = i > 0 ? oneArr[i - 1].key : oneArr[0].key;
                            break;
                        }
                    }
                    this.setState({ modalRowId: id })
                    setTimeout(() => {
                        var gundong = document.getElementById("gundong");
                        gundong.scrollTop = gundong.scrollTop - scroll_height;
                    }, 100)
                } else {
                    this.setState({ modalRowId: oneArr[0].key })
                }
                break;
            case 40: //下
                if (this.state.modalRowId) {
                    for (let i = 0; i < oneArr.length; i++) {
                        if (oneArr[i].key === this.state.modalRowId) {
                            id = i + 1 >= oneArr.length ? oneArr[oneArr.length - 1].key : oneArr[i + 1].key;
                            break;
                        }
                    }
                    this.setState({ modalRowId: id })
                    setTimeout(() => {
                        var gundong = document.getElementById("gundong");
                        gundong.scrollTop = gundong.scrollTop + scroll_height;
                    }, 100)
                } else {
                    this.setState({ modalRowId: oneArr[0].key })
                }
                break;
        }
    };

    // 编辑明细
    compileOrderDetailDom = item => {
        let { orderSetDetailData } = this.state;
        for (var i = 0; i < orderSetDetailData.length; i++) {
            orderSetDetailData[i].isboxShadow = false;
            if (orderSetDetailData[i].cmOrderSetDetailMedItemID === item.cmOrderSetDetailMedItemID) {
                orderSetDetailData[i].isboxShadow = true;
            }
        }
        this.setState({
            orderSetDetailData,
            detailRowData: item, // 需要修改的明细数据
            cmOrderSetDetailDecoctMethodID: item.cmOrderSetDetailDecoctMethodID, // 备注
            checkBox: item.checkBox,
            cmOrderSetDetailDoseQty: item.cmOrderSetDetailDoseQty,  // 药品数量
            cmOrderSetDetailMedItemDesc: item.cmOrderSetDetailMedItemDesc, // 名称
            cmOrderSetDetailMedItemID: item.cmOrderSetDetailMedItemID,
            cmOrderSetDetailComPrincipleID: item.cmOrderSetDetailComPrincipleID,
        }, () => {
            this.getModalListData()
        })
    }

    // 药品数量回车操作
    doseQtyOnPressEnter = () => {
        setTimeout(() => {
            this.myRef4.current.buttonNode.focus();
        }, 100)
    }

    // 使用剂型
    handleHerbalFormID = e => {
        this.setState({ orderSetDetailData: [] });
        // this.clearDetailInput();
        this.getDepartmentInformation(e);
    }

    // 排序
    handleSort = (record, e) => {
        React.$stopPropagation(e);
        let columns = this.columns.slice(1, this.columns.length - 1);
        this.sortRef && this.sortRef.modifyVisible(true, {
            tableData: record?.children || [],
            columns,
            totalWidth: 460,
            saveCode: '03020074',
            recordIdIndex: 'cmOrderSetID',
            modalTitle: (record?.title || '') + '医嘱套餐排序', // 弹窗title
            interfaceParams: {
                id: record?.id || '',
                type: 'Z', // 医嘱套餐（西药及其他） 【 X-西药及其他 Z-中草药 M-医嘱模板 DM-诊断模板 】
            }
        })
    }

    render() {
        let { tableData, selectData, userSelf, status, nameInput, departmentInformation, orderSetDetailData, rowData, rowId, sum, sumTotal,
            cmOrderSetDetailComPrincipleID, cmOrderSetDetailDoseQty, cmOrderSetDetailDecoctMethodID, cmOrderSetDetailMedItemDesc, detailRowData, checkStatus
        } = this.state;
        const { getFieldDecorator } = this.props.form;
        let param = {
            width: '500px',
            height: 250,
            top: this.state.top,
            left: this.state.left,
            columns: this.modalColumns,
            data: this.state.modalData,
            isOnRow: true,
            TableClassName: 'tab-placeholder',
            rowClassName: true,
            // showPagination: true,
            // page,
            // total,
        }

        // 剂型
        let herbalFormOption = selectData.herbalForm && selectData.herbalForm.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 频次
        let frequenceOption = selectData.frequence && selectData.frequence.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 用药方法
        let usageOption = selectData.usage && selectData.usage.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 服用要求
        let usageExplainOption = selectData.usageExplain && selectData.usageExplain.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 执行科室
        let departmentOption = departmentInformation && departmentInformation.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 用药类型
        let comPrincipleOption = selectData.comPrinciple && selectData.comPrinciple.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        // 备注
        let decoctMethodOption = selectData.decoctMethod && selectData.decoctMethod.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        let orderSetDetailDom = orderSetDetailData && orderSetDetailData.map((item, index) => {
            return (
                <li key={index} onClick={() => this.compileOrderDetailDom(item)} style={{ cursor: 'pointer', boxShadow: item.isboxShadow ? '4px 4px 8px' : '0 0 0' }}>
                    <h3
                        style={{
                            background: item.cmOrderSetDetailComPrincipleID === '1' ? '#ffa23e' : (item.cmOrderSetDetailComPrincipleID === '2' ? '#39d1d1' : (item.cmOrderSetDetailComPrincipleID === '3' ? '#fa5ab2' : (item.cmOrderSetDetailComPrincipleID === '4' ? '#aa71f9' : '#fff'))),
                            textAlign: 'center',
                            position: 'relative',
                            color: item.cmOrderSetDetailComPrincipleID ? '#fff' : '#000',
                            height: '24px',
                            lineHeight: '24px',
                            padding: '0 20px',
                        }}
                        className="ellipsis"
                    >
                        <Checkbox style={{ position: 'absolute', left: '4px' }} checked={item.checkBox} onClick={e => e.stopPropagation()} onChange={(e) => this.handleCheckOnChange(item, e)} />
                        {item.cmOrderSetDetailMedItemDesc}
                    </h3>
                    <div>
                        <div className="ellipsis" style={{ marginBottom: '8px' }}>药品数量: {item.cmOrderSetDetailDoseQty + 'g'}</div>
                        <div className="ellipsis">备注: {item.cmOrderSetDetailDecoctMethodDesc}</div>
                    </div>
                </li>
            )
        })
        return (
            <div className="cm-order-group">
                <Row>
                    <div style={{ paddingRight: '6px', position: 'relative' }}>
                        <Col span={7}>
                            <Card
                                size="small"
                                title={<div className="card-title-left-icon"><div></div>成套医嘱列表(草药)</div>}
                                className="medical-advice-list"
                            >
                                <div style={{ height: store.getState().tableHeight.y + 204 + 'px', overflow: 'auto' }}>
                                    <div style={{ padding: '12px' }} className="table-body-height">
                                        <Row style={{ marginBottom: '8px' }}>
                                            <Col span={16} style={{ marginRight: '20px' }}>
                                                <Input
                                                    placeholder="输入名称/别名回车查询"
                                                    onPressEnter={this.handleQuery}
                                                    value={nameInput}
                                                    onChange={this.handleNameInput}
                                                />
                                            </Col>
                                            <Button icon="plus" style={{ background: 'rgba(247,128,93,1)', color: '#fff' }} onClick={() => this.groupChild.showModal("add")}>成套医嘱</Button>
                                        </Row>
                                        <Row>
                                            <span style={{ marginRight: '40px' }}><Checkbox checked={status} onChange={this.handleStatus}>仅显示生效</Checkbox></span>
                                            <Checkbox checked={userSelf} onChange={this.handleUserSelf}>仅显示本人添加的成套医嘱</Checkbox>
                                        </Row>
                                        <Table
                                            bordered
                                            columns={this.columns}
                                            dataSource={tableData}
                                            scroll={{ x: 560, y: store.getState().tableHeight.y + 40 }}
                                            pagination={false}
                                            onRow={this.handleOnRow}
                                            rowClassName={this.setRowClassName}
                                            defaultExpandedRowKeys={['0main']}
                                        />
                                    </div>
                                </div>
                                <div style={{ width: '6px', background: 'rgba(240, 242, 245, 1)', position: 'absolute', top: 0, right: 0, height: '100%' }}></div>
                            </Card>
                        </Col>
                    </div>
                    <Col
                        span={17}
                        tabIndex={1}
                        onKeyDown={this.handleOnKeydown}
                        style={{ outline: 'none' }}
                    >
                        <Card
                            size="small"
                            title={<div className="card-title-left-icon"><div></div>成套医嘱明细项维护</div>}
                            className="medical-advice-list"
                        >
                            <div style={{ height: store.getState().tableHeight.y + 204 + 'px', overflow: 'auto' }}>
                                <Row style={{ height: '36px', lineHeight: '36px', borderBottom: '1px solid #ccc', paddingLeft: '12px' }}>
                                    当前套餐：{rowData.hospDesc ? rowData.hospDesc : '---'} {rowData.cmOrderSetDesc ? ('（' + rowData.cmOrderSetDesc + '）') : ''}<span style={{ display: 'inline-block', margin: '0 6px' }}>|</span>
                                    {rowData.cmOrderSetUserRangeDesc ? rowData.cmOrderSetUserRangeDesc + '医嘱套餐' : '---'}
                                    <div className="handle-btn-right">
                                        当前处方单副金额：<span style={{ color: '#1999db', fontSize: '14px', fontWeight: '900' }}>{sum}</span>
                                        当前处方总计：<span style={{ color: '#1999db', fontSize: '14px', fontWeight: '900', marginRight: '6px' }}>{rowData.cmOrderSetDurQty ? rowData.cmOrderSetDurQty : 0}</span>副；
                                        总金额：<span style={{ color: '#1999db', fontSize: '14px', fontWeight: '900' }}>{sumTotal}</span>
                                    </div>
                                </Row>
                                <div>
                                    <div className="cm-order-save" style={{ height: '36px', lineHeight: '36px', borderBottom: '1px solid #ccc' }}>
                                        <ul className="handle-btn" style={{ paddingLeft: '12px' }}>
                                            <li onClick={this.handleCheckAll} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className="doctor-hourglass-splice" />
                                                <span>{checkStatus ? '全不选' : '全选'}</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleDeleteDetail} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className='doctor-delete-splice' />
                                                <span>删除</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleUp} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className='doctor-up-splice' />
                                                <span>上移</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleDown} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className='doctor-down-splice' />
                                                <span>下移</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleLeft} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className="doctor-left-splice" />
                                                <span>左移</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleRight} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className="doctor-right-splice" />
                                                <span>右移</span>
                                            </li>
                                            <Divider type="vertical" />
                                            <li onClick={this.handleSaveDetailList} className={rowId ? 'color333' : 'color999'}>
                                                <Icon className='doctor-save-splice' />
                                                <span>保存</span>
                                            </li>
                                        </ul>
                                    </div>
                                    <Form className="form-flex">
                                        <Form.Item label="使用剂型">
                                            {getFieldDecorator('cmOrderSetHerbalFormID', {
                                                initialValue: rowData.cmOrderSetHerbalFormID ? rowData.cmOrderSetHerbalFormID : undefined,
                                                rules: [{ required: true, message: '使用剂型不能为空' }]
                                            })(
                                                <Select showSearch optionFilterProp="seatchprop" allowClear onSelect={this.handleHerbalFormID} style={{ width: '150px', marginRight: '8px' }} placeholder="请选择">
                                                    {herbalFormOption}
                                                </Select>
                                            )}
                                        </Form.Item>
                                        <Form.Item label="用药副数" className="rules-position">
                                            {getFieldDecorator('cmOrderSetDurQty', {
                                                initialValue: rowData.cmOrderSetDurQty ? rowData.cmOrderSetDurQty : undefined,
                                                // rules: [{ required: true, message: '用药副数不能为空' }]
                                                rules: [{ required: true, message: '用药副数不能为空' }, { pattern: /^[1-9]\d*$/, message: '用药副数只能为正整数, 如1、2、3、4' }]
                                            })(
                                                <Input type="number" className="input-number" style={{ width: '150px', marginRight: '8px' }} placeholder="请输入" />
                                            )}
                                        </Form.Item>
                                        <Form.Item label="使用频次" style={{ marginLeft: '10px' }}>
                                            {getFieldDecorator('cmOrderSetFreqID', {
                                                initialValue: rowData.cmOrderSetFreqID ? rowData.cmOrderSetFreqID : undefined,
                                            })(
                                                <Select showSearch optionFilterProp="seatchprop" allowClear style={{ width: '150px', marginRight: '8px' }} placeholder="请选择">
                                                    {frequenceOption}
                                                </Select>
                                            )}
                                        </Form.Item>
                                        <Form.Item label="每次用量" style={{ marginLeft: '10px' }}>
                                            {getFieldDecorator('cmOrderSetDoseQty', {
                                                initialValue: rowData.cmOrderSetDoseQty ? rowData.cmOrderSetDoseQty : undefined,
                                            })(
                                                <Input style={{ width: '150px', marginRight: '8px' }} placeholder="请输入" />
                                            )}
                                        </Form.Item>
                                        <Form.Item label="用药方法" style={{ marginLeft: '10px' }}>
                                            {getFieldDecorator('cmOrderSetUsageID', {
                                                initialValue: rowData.cmOrderSetUsageID ? rowData.cmOrderSetUsageID : undefined,
                                            })(
                                                <Select showSearch optionFilterProp="seatchprop" allowClear style={{ width: '150px', marginRight: '8px' }} placeholder="请选择">
                                                    {usageOption}
                                                </Select>
                                            )}
                                        </Form.Item>
                                        <Form.Item label="服用要求" style={{ marginLeft: '10px' }}>
                                            {getFieldDecorator('cmOrderSetUsageExplainID', {
                                                initialValue: rowData.cmOrderSetUsageExplainID ? rowData.cmOrderSetUsageExplainID : undefined,
                                            })(
                                                <Select showSearch optionFilterProp="seatchprop" allowClear style={{ width: '150px', marginRight: '8px' }} placeholder="请选择">
                                                    {usageExplainOption}
                                                </Select>
                                            )}
                                        </Form.Item>
                                        <Form.Item label="执行科室" style={{ marginLeft: '10px' }}>
                                            {getFieldDecorator('cmOrderSetRecLocID', {
                                                initialValue: rowData.cmOrderSetRecLocID ? rowData.cmOrderSetRecLocID : undefined,
                                            })(
                                                <Select showSearch optionFilterProp="seatchprop" allowClear style={{ width: '150px' }} placeholder="请选择">
                                                    {departmentOption}
                                                </Select>
                                            )}
                                        </Form.Item>
                                    </Form>
                                </div>
                                <div>
                                    <div style={{ background: 'rgba(240, 242, 245, 1)', height: '32px', lineHeight: '32px' }}><Icon className='doctor-table-title-splice' style={{ marginLeft: 0 }} />处方提示信息</div>
                                    <div style={{ margin: '8px 0' }}>
                                        <div style={{ display: 'inline-block', padding: '0 12px' }}>
                                            <span className="star">名称：</span>
                                            <Input
                                                id="name-input"
                                                style={{ width: '150px', marginRight: '20px' }}
                                                onPressEnter={this.nameOnPressEnter}
                                                value={cmOrderSetDetailMedItemDesc}
                                                onChange={this.handlecmOrderSetDetailMedItemDesc}
                                                placeholder="(Enter)回车检索"
                                                onBlur={this.handleOnBlur}
                                                autoComplete="off"
                                                ref={this.myRef1}
                                            />
                                            <span className="star">药品数量：</span>
                                            <Input
                                                style={{ width: '100px', marginRight: '5px' }}
                                                value={cmOrderSetDetailDoseQty}
                                                onChange={this.handleCmOrderSetDetailDoseQty}
                                                placeholder="请输入"
                                                ref={this.myRef2}
                                                onPressEnter={this.doseQtyOnPressEnter}
                                            /><Input style={{ width: '50px', marginRight: '20px' }} value="g" disabled />
                                            用药类型：<Select
                                                style={{
                                                    width: '100px', marginRight: '10px'
                                                }}
                                                value={cmOrderSetDetailComPrincipleID}
                                                onChange={this.handleCmOrderSetDetailComPrincipleID}
                                                showSearch optionFilterProp="seatchprop" allowClear
                                                placeholder="请选择"
                                            >
                                                {comPrincipleOption}
                                            </Select>
                                            备注：<Select
                                                showSearch optionFilterProp="seatchprop" allowClear
                                                style={{ width: '150px', marginRight: '20px' }}
                                                value={cmOrderSetDetailDecoctMethodID}
                                                onChange={this.handleCmOrderSetDetailDecoctMethodID}
                                                placeholder="请选择"
                                                ref={this.myRef3}
                                            >
                                                {decoctMethodOption}
                                            </Select>
                                            <Button className="button-hover" ref={this.myRef4} onClick={this.handleDetailSave} disabled={!rowId} title="新增后请点击保存按钮保存新增的数据">{detailRowData && detailRowData.cmOrderSetDetailMedItemID ? '保存' : '新增'}</Button>
                                            <Button type="danger" ghost onClick={this.clearDetailFormData} style={{ display: detailRowData && detailRowData.cmOrderSetDetailMedItemID ? 'inline-block' : 'none', marginLeft: '8px' }}>取消编辑</Button>
                                        </div>
                                        <div style={{ display: 'inline-block', float: 'right' }}>
                                            <ul className="round-ul">
                                                <li>
                                                    <span className="round-span" style={{ background: '#ffa23e' }}></span>君药
                                                </li>
                                                <li>
                                                    <span className="round-span" style={{ background: '#39d1d1' }}></span>臣药
                                                </li>
                                                <li>
                                                    <span className="round-span" style={{ background: '#fa5ab2' }}></span>佐药
                                                </li>
                                                <li>
                                                    <span className="round-span" style={{ background: '#aa71f9' }}></span>使药
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                    <Row >
                                        <Col span={20} style={{ height: store.getState().tableHeight.y + 204 - 37 - 38 - 60 - 88 - 27 + 'px', border: '1px solid #ccc', marginLeft: '8px' }}>
                                            <ul className="round-list" id="round-detail-list">
                                                {orderSetDetailDom}
                                            </ul>
                                        </Col>
                                        <Col span={4}></Col>
                                    </Row>
                                </div>
                            </div>
                        </Card>
                    </Col>
                </Row>
                <div
                    tabIndex={1}
                    onKeyDown={this.handlePublicModalTableOnKeydown}
                    style={{ outline: 'none' }}
                >
                    <PublicModalTable
                        onClickRowPublic={this.onClickRowPublic}
                        setRowClassNamePublic={this.setRowClassNamePublic}
                        param={param}
                        onRef={this.onRef}
                        id="gundong"
                    />
                </div>
                <CMOrderGroupModal onRef={this.groupRef} selectData={selectData} handleQuery={this.handleQuery} />

                {/* 列表顺序调整 */}
                <PublicDataOrderAdjustment handleQuery={this.handleQuery} onRef={ref => this.sortRef = ref} />
            </div>
        )
    }
};

const CMOrderGroupForm = Form.create()(CMOrderGroup);
export default CMOrderGroupForm;
