/** 
 * Creator:     JYW
 * CreatDate:   2019-04-15
 * descripts：  护士执行组件
*/
import React from 'react';
import { Row, Col } from 'antd';
import PatientList from '../Patient/PatientList';
import SheetList from './SheetList';

import './CSS/nurseexecute.less';//引入样式
class NurseExecute extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            leftspan: 5,
            rightspan: 19,
            iconType: "double-left",
            patient: [],
            sheet: {},
            reload: false,
            check: 'checkbox',
            activeKey: '1',
            type: ''
        }
    }

    onBtnClick = () => {
        this.setState({
            leftspan: 5 - this.state.leftspan,
        });
    }

    onClose = () => {
        this.setState({
            visible: true,
        });
    }

    updateState = (state) => {
        this.setState(state, () => {
            this.sheetListChild.getPatientOrd('', '');
            this.sheetListChild.setPatiInfo(state.selectPatient, this.state.activeKey);
        });
    }

    childRef = (ref) => {
        this.patientListChild = ref
    }

    sheetChildRef = (ref) => {
        this.sheetListChild = ref
    }

    componentWillUnmount() {
        this.setState = (state, callback) => {
            return
        }
    }

    render() {

        return (
            <div style={{ width: '100%', height: '100%' }} className="nurseExecute">
                <Row style={{ height: "100%", width: "100%", overflow: 'hidden' }}>
                    <Col className={this.state.iconType == "double-left" ? "" : "visibleIcon"} span={this.state.leftspan} style={{ border: this.state.iconType == "double-left" ? "1px solid #cccccc" : "0px", height: "100%", overflowY: 'hidden', background: '#ffffff', boxSizing: 'border-box' }}>
                        <PatientList
                            updateState={this.updateState}
                            iconType={this.state.iconType}
                            onRef={this.childRef}
                            type='radio'
                            activeKey={this.state.activeKey}
                            check={this.state.check}
                        />
                    </Col>
                    <Col span={this.state.rightspan} style={{ border: "1px solid #cccccc", height: "100%" }} >
                        <SheetList
                            iconType={this.state.iconType}
                            patient={this.state.patient}
                            updateState={this.updateState}
                            patListRef={this.patientListChild}
                            onRef={this.sheetChildRef}
                        />
                    </Col>
                </Row>
            </div>
        )
    }
};

export default NurseExecute;