/*
 * Creator:     ML
 * CreatDate:   2020-04-07
 * descripts：  居民健康管理统计分析
 * */
import React from 'react';
import {
    Card, Table, Input, Form, Select, Row, Col, Checkbox, Tabs,
    DatePicker, Button, Popconfirm, Icon, Divider, message, Modal,
} from 'antd';
// import { Util, dayFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import store from 'store';
import './style/StatisticalAnalysis.less';
import AnalysisOfContractedResidents from './component/AnalysisOfContractedResidents.jsx';//签约居民分析
import AnalysisWorkloadStatistics from './component/AnalysisWorkloadStatistics.jsx';//工作量统计
import AnalysisPhysical from './component/AnalysisPhysical.jsx';//体验满意度分析

const TabPane = Tabs.TabPane;
class StatisticalAnalysisPage extends React.Component {
    constructor(props) {
        super(props)
        var userData = JSON.parse(sessionStorage.getItem('userData'))
        this.state = {
            dataSource: [],
            total: 0,
            page: 1,
            pageSize: 10,
            userData: userData,
            activeKey: '1',
        }
    }

    componentDidMount() {
    }
    componentWillUnmount() {
        // 组件销毁前将静止让setState修改state的状态
        this.setState = (state, callback) => { return; }
    }

    // 导航栏切换
    callback = (key) => {
        this.setState({ activeKey: key },()=>{
            this.handleTo(key)
        })

    }
    handleTo = (key) => {
        let obj = {
            "1": () => this.childAnalysisOfContractedResidents.loadInit(),
            "2": () => this.childAnalysisWorkloadStatistics.handleGet(),
            "3": () => this.childAnalysisPhysical.loadInit(),
        }
        if (obj[key]) {
            obj[key]()
        }
    }
    onAnalysisOfContractedResidents = (ref) => {
        this.childAnalysisOfContractedResidents=ref
    }
    onAnalysisWorkloadStatistics = (ref) => {
        this.childAnalysisWorkloadStatistics=ref
    }
    onAnalysisPhysical = (ref) => {
        this.childAnalysisPhysical=ref
    }
    render() {
        let tabsHeight = store.getState().tableHeight.y + 238 + 'px';
        return <div className='out-patient-service-body'>
            <Tabs
                activeKey={this.state.activeKey}
                onChange={this.callback}
                tabPosition="left"
                type="card"
                className="new_department_tabs"
                style={{ width: '100%', height: tabsHeight }}
            >
                <TabPane className="title" tab="统计分析" disabled={true}>
                </TabPane>
                <TabPane tab="居民分析" key="1">
                    <AnalysisOfContractedResidents onAnalysisOfContractedResidents={this.onAnalysisOfContractedResidents} />
                </TabPane>
                <TabPane tab="工作量统计" key="2">
                    <AnalysisWorkloadStatistics onAnalysisWorkloadStatistics={this.onAnalysisWorkloadStatistics} />
                </TabPane>
                <TabPane tab="体验满意度分析" key="3">
                    <AnalysisPhysical onAnalysisPhysical={this.onAnalysisPhysical} />
                </TabPane>
            </Tabs>
        </div>
    }

}

export default StatisticalAnalysisPage;