import React from 'react';
import { Menu, Icon } from 'antd';
import '../leftTab.less';
const SubMenu = Menu.SubMenu;
const MenuItemGroup = Menu.ItemGroup;


const LeftTab = React.createClass({
    getInitialState() {
        return {
            current: 'myClient', 
            subKey: 'sub1', 
            keyList: [
                { key: 'sub1', value: ['myClient','companyCustomer'] },
                { key: 'sub2', value: ['individualCustomer','queryCustomer'] },
                { key: 'sub3', value: ['myBusiness', 'serviceQuery'] },
                { key: 'sub4', value: ['visitStatistics', 'statusStatistics','followStatistics'] },
            ]
        };
    },
     handleClick(e) {
        this.props.handlekey(e.key);
        this.setState({
            current: e.key,
        });
    },
    componentWillMount() {
        const _me = this;
        if (window.location.hash) {
            let theKey = window.location.hash.substr(1);
            this.state.keyList.map(function (item1) {
                item1.value.map(function (item2) {
                    if (theKey == item2) {
                        _me.state.subKey = item1.key
                    };
                });
            });
            this.state.current = theKey;
        };
    },
    render() {
        return (
            <Menu onClick={this.handleClick}
                selectedKeys={[this.state.current]}
                defaultOpenKeys={[this.state.subKey]}
                mode="vertical"
                className="account-left"
                mode="inline" >
	            <SubMenu key="sub1" title={<span>单位客户</span>}>	            	
		                <Menu.Item key="myClient">
		                    我的单位客户
		                </Menu.Item>                              
		                <Menu.Item key="companyCustomer">
		                    单位客户查询
		                </Menu.Item>		           
		        </SubMenu> 
		        <SubMenu key="sub2" title={<span>个人客户</span>}>	            	
		                <Menu.Item key="individualCustomer">
		                    我的个人客户
		                </Menu.Item>               	               
		                <Menu.Item key="queryCustomer">
		                    个人客户查询
		                </Menu.Item>		           
		        </SubMenu>
		        <SubMenu key="sub3" title={<span>客户业务</span>}>		            
		                <Menu.Item key="myBusiness">
		                    我的业务
		                </Menu.Item>               
		                <Menu.Item key="serviceQuery">
		                    业务查询
		                </Menu.Item>	               		           
		        </SubMenu>
		        <SubMenu key="sub4" title={<span>统计分析</span>}>		            
		                <Menu.Item key="visitStatistics">
		                    客户拜访统计
		                </Menu.Item>               
		                <Menu.Item key="statusStatistics">
		                    业务客户状态统计
		                </Menu.Item>
		                <Menu.Item key="followStatistics">
		                    业务跟进进度统计
		                </Menu.Item>
		        </SubMenu>
            </Menu>
        );
    },
});

export default LeftTab;