leftTab.jsx 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import React from 'react';
  2. import { Menu, Icon } from 'antd';
  3. import '../leftTab.less';
  4. const SubMenu = Menu.SubMenu;
  5. const MenuItemGroup = Menu.ItemGroup;
  6. const LeftTab = React.createClass({
  7. getInitialState() {
  8. return {
  9. current: 'myClient',
  10. subKey: 'sub1',
  11. keyList: [
  12. { key: 'sub1', value: ['myClient','companyCustomer'] },
  13. { key: 'sub2', value: ['individualCustomer','queryCustomer'] },
  14. { key: 'sub3', value: ['myBusiness', 'serviceQuery'] },
  15. { key: 'sub4', value: ['visitStatistics', 'statusStatistics','followStatistics'] },
  16. ]
  17. };
  18. },
  19. handleClick(e) {
  20. this.props.handlekey(e.key);
  21. this.setState({
  22. current: e.key,
  23. });
  24. },
  25. componentWillMount() {
  26. const _me = this;
  27. if (window.location.hash) {
  28. let theKey = window.location.hash.substr(1);
  29. this.state.keyList.map(function (item1) {
  30. item1.value.map(function (item2) {
  31. if (theKey == item2) {
  32. _me.state.subKey = item1.key
  33. };
  34. });
  35. });
  36. this.state.current = theKey;
  37. };
  38. },
  39. render() {
  40. return (
  41. <Menu onClick={this.handleClick}
  42. selectedKeys={[this.state.current]}
  43. defaultOpenKeys={[this.state.subKey]}
  44. mode="vertical"
  45. className="account-left"
  46. mode="inline" >
  47. <SubMenu key="sub1" title={<span>单位客户</span>}>
  48. <Menu.Item key="myClient">
  49. 我的单位客户
  50. </Menu.Item>
  51. <Menu.Item key="companyCustomer">
  52. 单位客户查询
  53. </Menu.Item>
  54. </SubMenu>
  55. <SubMenu key="sub2" title={<span>个人客户</span>}>
  56. <Menu.Item key="individualCustomer">
  57. 我的个人客户
  58. </Menu.Item>
  59. <Menu.Item key="queryCustomer">
  60. 个人客户查询
  61. </Menu.Item>
  62. </SubMenu>
  63. <SubMenu key="sub3" title={<span>客户业务</span>}>
  64. <Menu.Item key="myBusiness">
  65. 我的业务
  66. </Menu.Item>
  67. <Menu.Item key="serviceQuery">
  68. 业务查询
  69. </Menu.Item>
  70. </SubMenu>
  71. <SubMenu key="sub4" title={<span>统计分析</span>}>
  72. <Menu.Item key="visitStatistics">
  73. 客户拜访统计
  74. </Menu.Item>
  75. <Menu.Item key="statusStatistics">
  76. 业务客户状态统计
  77. </Menu.Item>
  78. <Menu.Item key="followStatistics">
  79. 业务跟进进度统计
  80. </Menu.Item>
  81. </SubMenu>
  82. </Menu>
  83. );
  84. },
  85. });
  86. export default LeftTab;