import React, { Component } from 'react';
import PropTypes from 'prop-types';
import GrowthStatistics from './GrowthStatistics';
import RecentStatistics from './RecentStatistics';
import RiskFailure from './RiskFailure';
import RiskTrend from './RiskTrend';
import Statistics from './Statistics';
import SafetyRate from './SafetyRate';
import CentralInfoView from './../detail/index';

/**
 * situation
 * 安全态势
 * @class situation
 * @extends {Component}
 */
class Situation extends Component {
  constructor(props) {
    super(props);
    this.state = {
     divVisable:'none' ,//控制弹窗显示
     title: '',  //modal标题
     type: ''    //弹窗类型（根据类型切换不同弹窗）
    };
  }

  componentWillMount() {

  }

  componentDidMount() {

  }

  componentWillUnmount() {

  }

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

  
  //安全指数弹窗
  kpsi(values){
    console.log(values);
    this.setState({
      divVisable : values.divVisable,
      title : values.title,
      type : values.type
    })
  }

  render() {
    return (
      <div className='class-Situation'>
        <div className='daily-duties-content'>
          <div className='daily-duties-left'>
            <div>
              <SafetyRate onClick={()=>{  
                this.child1.kpsi()}}/>
            </div>
            <div>
              <GrowthStatistics onWarnClick={()=>{  
                this.child1.dangerWeekCensus()}}/>
            </div>
          </div>
          <div className='daily-duties-middle'>
          <div>
              <Statistics/>
            </div>
            <div>
              <RiskTrend/>
            </div>
          </div>
          <div className='daily-duties-right'>
          <div>
              <RiskFailure onRiskClick={()=>{  
                this.child1.safetyRiskFailure()}}/>
            </div>
            <div>
              <RecentStatistics onStatisticClick={()=>{
                  this.child1.sevenDaysRiskCensus()}}/>
            </div>
          </div>        
        </div>
        <div>
        </div>
        <CentralInfoView onRef={this.onRef}/>   
      </div>
    );
  }
}

Situation.propTypes = {

};

export default Situation;
