Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. import React from 'react';
  2. import { Tabs,Button,Table } from 'antd';
  3. import './App.css';
  4. const TabPane = Tabs.TabPane;
  5.  
  6.  
  7. const eventList = [
  8. {
  9. title: '事件时间',
  10. dataIndex: 'eventTime',
  11. key: 'eventTime',
  12. },
  13. {
  14. title: '事件名称',
  15. dataIndex: 'eventName',
  16. key: 'eventName',
  17. },
  18. {
  19. title: '事件类型',
  20. dataIndex: 'eventType',
  21. key: 'eventType',
  22. },
  23. {
  24. title: '事件级别',
  25. dataIndex: 'eventLevel',
  26. key: 'eventLevel',
  27. },
  28. {
  29. title: '源地址',
  30. dataIndex: 'sourceAddress',
  31. key: 'sourceAddress',
  32. },
  33. {
  34. title: '源端口',
  35. dataIndex: 'sourcePort',
  36. key: 'sourcePort',
  37. },
  38. {
  39. title: '目的地址',
  40. dataIndex: 'desAddress',
  41. key: 'desAddress',
  42. },
  43. {
  44. title: '目的端口',
  45. dataIndex: 'desPort',
  46. key: 'desPort',
  47. },
  48. {
  49. title: '协议',
  50. dataIndex: 'protocol',
  51. key: 'protocol',
  52. },
  53. {
  54. title: '相关资产',
  55. dataIndex: 'relatedAssets',
  56. key: 'relatedAssets',
  57. },
  58. {
  59. title: '所属单位',
  60. dataIndex: 'affilationUnit',
  61. key: 'affilationUnit',
  62. },
  63. {
  64. title: '次数',
  65. dataIndex: 'frequencys',
  66. key: 'frequencys',
  67. },
  68. ];
  69.  
  70.  
  71. class App extends React.Component {
  72. constructor(props){
  73. super(props)
  74. this.state = {
  75. defaultKey:'list',
  76. dataSource:[]
  77. }
  78. }
  79.  
  80. render() {
  81. const { defaultKey,dataSource } = this.state;
  82. return (
  83. <div className="App">
  84. <header className="App-header">
  85. <div className='btn-global'>
  86. <Button type="" onClick={(e) => {this.setState({ defaultKey: 'list'})}}>list</Button>
  87. <Button type="" onClick={(e) => {this.setState({ defaultKey: 'chart'})}}>chart</Button>
  88. </div>
  89. <Tabs activeKey={ defaultKey }>
  90. <TabPane tab="" key="list">
  91. <Table
  92. dataSource={dataSource}
  93. columns={eventList}
  94. />
  95. </TabPane>
  96. <TabPane tab="" key="chart">
  97. <Table
  98. dataSource={dataSource}
  99. columns={eventList}
  100. />
  101. </TabPane>
  102. </Tabs>
  103. </header>
  104. </div>
  105. )
  106. }
  107. }
  108.  
  109. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement