Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
eaa833ea
Commit
eaa833ea
authored
Nov 25, 2020
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: log
parent
947a6457
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
16 deletions
+96
-16
index.js
src/pages/log/serviceLog/index.js
+96
-16
No files found.
src/pages/log/serviceLog/index.js
View file @
eaa833ea
...
...
@@ -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
=
{{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment