/* 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, Tooltip } 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',
|
render: (cur, item) => {
|
return <Tooltip title={cur}><span>{this.fontNumber(cur||'')}</span></Tooltip>
|
}
|
},
|
{
|
title: '浏览描述', dataIndex: 'operDesc',
|
render: (cur, item) => {
|
return <Tooltip title={cur}><span>{this.fontNumber(cur||'')}</span></Tooltip>
|
}
|
},
|
{
|
title: '浏览日期', dataIndex: 'createTime', render: (cur, item) => {
|
return cur ? moment(cur).format("YYYY-MM-DD HH:mm:ss") : ""
|
}
|
},
|
{ title: 'IP地址', dataIndex: 'operIp' },
|
{ title: '访问终端', dataIndex: 'operTerminal' },
|
{ title: '访问浏览器', dataIndex: 'operBrowser' },
|
{
|
title: '状态', dataIndex: 'operStatus', render: (cur, item) => {
|
return cur == '1' ? <Badge count={'成功'} style={{ backgroundColor: '#52c41a' }} /> : <Badge count={'失败'} />
|
|
}
|
}
|
];
|
}
|
|
fontNumber(date) {
|
const length = date.length
|
if (length > 16) {
|
var str = ''
|
str = date.substring(0, 16) + '......'
|
return str
|
} else {
|
return date
|
}
|
}
|
|
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>
|
)
|
}
|
}
|