//预诊分级
import React from 'react';
import { Row, Col, Form } from 'antd';
import PreliminaryLeft from './PreliminaryLeft.jsx';
import PreliminaryCenter from './PreliminaryCenter.jsx';
import Preliminaryright from './Preliminaryright.jsx';


const PreliminaryClinical = Form.create()(
    class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                // leftspan + centerspan = 24;
                leftspan: 4,
                centerspan: 20,
                rightspan: 7,

            }

        }
        componentDidMount() {

        }

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

        componentWillUnmount() {
            this.setState = (state, callback) => {
                return
            }
        }
        //调用中间组件的方法
        getTableData=(data)=>{
            //console.log("tableData",data)
            this.Righthild.getPropsTableData(data)
            
        }
        // 调用公共组件的连接事件
        onRef = (ref) => {
            this.load = ref
        }

        // // 调用公共组件的连接事件
        onRightRef = (ref) => {
            this.Righthild = ref
        }
        // // 调用公共组件的连接事件
        loadData = (ref) => {
            this.PreliminaryCenter = ref
        }
        //赋值右边组件
        setRightCom(data) {
            this.Righthild.setRightFormData(data);
        }
       
        // setRightScore(data) {
        //     this.Righthild.setRightForm(data);
        // }

        getCenterFormValue = () => {
            this.PreliminaryCenter.getFormValues((value) => {
                this.Righthild.getConterFormValue(value)
            })
            // this.child.getFormValues();
        }
        //接收左组件
        callBackLeft(data) {
            // console.log("父组件",data)
            this.PreliminaryCenter.getPreGradeData(data)
        }

        loadPatID(id) {
            this.setState({
                patID: id
            })
        }

        scoreInfo = (id) => {
            this.PreliminaryCenter.handleSymptom(id)
            // this.child.getFormValues();
        }
        // //调用中间table数据
        // getCenter = () => {
        //     this.PreliminaryCenter.getForm((data) => {
        //         this.Righthild.getConter(data)
        //     // this.child.getFormValues();
        //   })
        // }
        render() {
            return (
                <div style={{ width: '100%', height: '100%' }}>
                    <Row style={{ height: "100%", width: "100%" }}>
                        <Col span={this.state.leftspan} style={{ border: "1px solid #cccccc", height: "100%", overflow: 'hidden' }}>
                            <PreliminaryLeft
                                onRef={this.onRef}
                                callBackLeft={(data) => this.callBackLeft(data)}
                              
                            />
                        </Col>
                        <Col span={this.state.centerspan} style={{ border: "1px solid #cccccc", height: "100%", overflow: 'hidden' }} >
                            <Row style={{ height: "100%" }}>
                                <Col span={24 - this.state.rightspan} style={{ height: "100%" }}>
                                    <PreliminaryCenter
                                        setRightCom={(data) => this.setRightCom(data)}
                                       // setRightScore={(TableData) => this. setRightScore(TableData)}
                                        loadPatID={this.loadPatID.bind(this)}
                                        getTableData={this.getTableData}
                                        onRef={this.loadData}
                                    />
                                </Col>
                                <Col span={this.state.rightspan} style={{ height: "100%", border: "1px solid #cccccc" }} >
                                    <Preliminaryright
                                        scoreInfo={this.scoreInfo}
                                        onRef={this.onRightRef}
                                        patID={this.state.patID}
                                        getCenterFormValue={this.getCenterFormValue}
                                        // getCenter={this.getCenter}
                                    />
                                </Col>
                            </Row>
                        </Col>
                    </Row>
                </div>
            )
        }

    }
);
export default PreliminaryClinical;





































