import React from 'react';
import { Row, Col,Steps} from 'antd';
import { $http } from '../../../containers/config/https';
import store from '../../../store';
import moment from 'moment';

const { Step } = Steps;
let user ;
class ConsultationProcessright extends React.Component {
    constructor() {
        super()
        this.state = {
            // current: 0,
            conStatusProcess: []
           // conStatusProcess: props.rightData.conStatusProcess || [],
        };
        user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
    }
   
    componentDidMount() {
        this.props.onRef(this);
    }
    componentWillUnmount() {
        this.setState = (state, callback) => {
            return
        }
    }

    componentWillReceiveProps(props){
        if(props.rightData.conStatusProcess !== this.state.conStatusProcess){
            this.setState({conStatusProcess:props.rightData.conStatusProcess})
        }
      
    }

    onChange = current => {
        // this.setState({ current });
      };
    
  
    render() {
       // console.log(this.props.rightData)
        let current = 0;
        if (this.props.rightData.conStatusProcess)
        {current  = this.props.rightData.conStatusProcess.length -1;}
        return (
            <div className="stutus">
                <div>
                    <Row>
                            <Col>
                                    <p style={{background: "#e8e8e8",fontSize:'16px',height:'40px',lineHeight:'40px'}}>状态</p>
                            </Col>
                    </Row>
                    <Row style={{ height: store.getState().tableHeight.y +90 + 'px', overflow: 'auto' }}>
                            <Col>
                                <Steps current={current} onChange={this.onChange} direction="vertical">
                                    {this.state.conStatusProcess && this.state.conStatusProcess.map((item, i) => {
                                        return  <Step title={item.conItemStatusDesc +'  ' +item.userDesc} description={item.conItemStatusDate+ '  ' +item.conItemStatusTime} key={i} />
                                    }) }
                                
                                </Steps>
                            </Col>
                        </Row>
                </div>
            </div>
        )
    }
}
export default ConsultationProcessright