1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
| /* eslint-disable */
| /**liuwh
| * 4/29/2020, 2:21:33 PM
| * doc comment for the file goes here
| */
|
| /** 浏览日志 */
| import React, { ReactNode, ReactEventHandler, Component } from 'react';
| import { Badge } from 'antd';
| import TableView from '../../../common/TableView';
| import SearchFormView from '../../../common/SearchFormView';
| import './index.scss';
| import moment from 'moment';
|
| export default class BrowseLog extends Component {
| constructor(props) {
| super(props);
| this.config = {
| };
| this.state = {
| formData: {
| __key: Date.now(),
| page: 1,
| size: 10,
| keyWord: ''
| },
| };
| }
|
| componentDidMount() { }
|
| setFormData = data => {
| console.log('form', data);
| this.setState({
| formData: data,
| });
| }
|
| renderColumns = () => {
| return [
| { title: '序号', dataIndex: 'index' },
| { title: '浏览者', dataIndex: 'userName' },
| { title: '浏览模块', dataIndex: 'moduleName' },
| { title: '浏览功能', dataIndex: 'functionName' },
| { title: '浏览描述', dataIndex: 'operDesc' },
| {
| title: '浏览日期', dataIndex: 'createTime', render: (cur, item) => {
| return cur ? moment(cur).format("YYYY-MM-DD HH:mm") : ""
| }
| },
| { title: 'IP地址', dataIndex: 'operIp' },
| { title: '访问终端', dataIndex: 'operTerminal' },
| { title: '访问浏览器', dataIndex: 'operBrowser' },
| { title: '状态', dataIndex: 'operStatus', render: (cur, item)=> {
| return this.operStatus(cur)
| }}
| ];
| }
|
| operStatus = (status) => {
| switch (status) {
| case '1':
| return <Badge count={'成功'} style={{ backgroundColor: '#52c41a' }}/>
| case '99':
| return <Badge count={'失败'} />
| }
| }
|
| render() {
| const { formData } = this.state;
|
| let tableParams = {
| url: `api/log/queryLog`,
| formData,
| key: formData.__key,
| columns: this.renderColumns(),
| extraFromData: {
| logType: '1',
| },
| setFormData: this.setFormData
| }
|
| return (
| <div className="browse-log-main">
| <SearchFormView
| formData={formData}
| setFormData={this.setFormData}
| data={[
| { type: 'input', name: '关键字', label: '关键字', key: 'keyWord' },
| {
| type: 'rangePicker',
| label: '浏览时间',
| name: JSON.stringify(['开始时间', '结束时间']),
| key: JSON.stringify(['startTime', 'endTime']),
| keylistName: 'rangeTimelist',
| },
| ]} />
| <TableView {...tableParams} />
| </div>
| )
| }
| }
|
|