Commit eaa833ea authored by 陈前坚's avatar 陈前坚

perf: log

parent 947a6457
......@@ -6,12 +6,11 @@ import {
Col,
Button,
Select,
Menu,
notification,
message,
Spin,
} from 'antd';
import { SwapRightOutlined, DownOutlined } from '@ant-design/icons';
import { SwapRightOutlined } from '@ant-design/icons';
import { Chart, Interval, Tooltip, Axis } from 'bizcharts';
import { DataSet } from '@antv/data-set';
import moment from 'moment';
......@@ -31,9 +30,73 @@ const ServiceLog = () => {
const [logType, setLogType] = useState(0); // 请求参数,日志类型,默认是正常,0:成功 -1:错误 9999:全部
const [tableColumns, setTableColumns] = useState([]); // 源数据
console.log(startTime.format('HH:mm:ss'));
console.log(endTime.format('HH:mm:ss'));
const columns11 = [
{
title: '调用时间',
dataIndex: 'CallTime',
key: 'CallTime',
// filters: orgFilters,
// onFilter: (value, record) => record.OUName === value,
},
{
title: 'IP',
dataIndex: 'IP',
key: 'IP',
},
{
title: '接口名称',
dataIndex: 'Path',
key: 'Path',
width: 200,
ellipsis: true,
},
{
title: '请求方法',
dataIndex: 'Method',
key: 'Method',
ellipsis: true,
},
{
title: '查询参数',
dataIndex: 'QueryString',
key: 'QueryString',
width: 150,
ellipsis: true,
},
{
title: '请求体',
dataIndex: 'Body',
key: 'Body',
width: 200,
ellipsis: true,
},
{
title: '状态码',
dataIndex: 'Result',
key: 'Result',
},
{
title: '耗时/ms',
dataIndex: 'ConsumerTime',
key: 'ConsumerTime',
defaultSortOrder: 'descend',
sorter: (a, b) => a.ConsumerTime - b.ConsumerTime,
},
{
title: '返回体大小/byte',
dataIndex: 'ResponseSize',
key: 'ResponseSize',
ellipsis: true,
sorter: (a, b) => a.ResponseSize - b.ResponseSize,
},
{
title: '错误信息',
dataIndex: 'ErrorMsg',
key: 'ErrorMsg',
width: 200,
ellipsis: true,
},
];
// 在起止时间任意一个变化后获取数据
useEffect(() => {
if (startTime && endTime) {
......@@ -45,10 +108,10 @@ const ServiceLog = () => {
post(`${PUBLISH_SERVICE}/LogCenter/GetOMSLog`, {
PageIndex: 0,
PageSize: 0,
DateFrom: startTime.format('YYYY-MM-DD'),
DateTo: endTime.format('YYYY-MM-DD'),
HourFrom: startTime.format('HH:mm:ss'),
HourTo: endTime.format('HH:mm:ss'),
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'),
// HourFrom: startTime.format('HH:mm:ss'),
// HourTo: endTime.format('HH:mm:ss'),
IP: '',
Module: '',
LogType: +logType,
......@@ -79,12 +142,28 @@ const ServiceLog = () => {
item.key = index;
return item;
});
const columns = Object.keys(data[0]).map(key => ({
title: key,
dataIndex: key,
key,
}));
setTableColumns(columns);
// const columns = Object.keys(data[0]).map(key => {
// if (key === 'ResponseSize') {
// return {
// title: key,
// dataIndex: key,
// key,
// defaultSortOrder: 'descend',
// sorter: (a, b) => a.ResponseSize - b.ResponseSize,
// };
// }
// if (key === 'Body' || key === 'QueryString' || key === 'Path') {
// return {
// title: key,
// dataIndex: key,
// key,
// width: 150,
// ellipsis: true,
// };
// }
// return { title: key, dataIndex: key, key };
// });
// setTableColumns(columns);
// console.log(Object.keys(data[0]));
const scale1 = {
Path: {
......@@ -148,6 +227,7 @@ const ServiceLog = () => {
),
);
};
// 设置日志类型
const selectChange = value => {
setLogType(value);
};
......@@ -235,7 +315,7 @@ const ServiceLog = () => {
<Table
size="small"
bordered
columns={tableColumns || []}
columns={columns11}
dataSource={data0}
scroll={{ x: 'max-content' }}
pagination={{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment