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
0affa87a
Commit
0affa87a
authored
4 years ago
by
陈前坚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 服务监控只能查询当月
parent
ecf42b2d
Pipeline
#22820
skipped with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
12 deletions
+43
-12
index.js
src/pages/log/serviceLog/index.js
+43
-12
No files found.
src/pages/log/serviceLog/index.js
View file @
0affa87a
...
...
@@ -35,15 +35,9 @@ const ServiceLog = () => {
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
// 计算时间间隔(分钟)
const
start
=
new
Date
(
startTime
.
format
(
'YYYY-MM-DD HH:mm:ss'
)
).
getTime
();
const
end
=
new
Date
(
endTime
.
format
(
'YYYY-MM-DD HH:mm:ss'
)
).
getTime
();
const
start
=
new
Date
(
startTime
).
getTime
();
const
end
=
new
Date
(
endTime
).
getTime
();
const
minuteInterval
=
(
end
-
start
)
/
(
60
*
1000
);
// 相隔多少分钟
if
(
minuteInterval
<=
0
)
{
notification
.
error
({
message
:
'时间设置有误'
,
description
:
'起始时间应该早于结束时间'
,
});
}
const
countInterval
=
()
=>
{
if
(
minuteInterval
>
0
&&
minuteInterval
<=
30
)
{
setTimeInterval
(
'1'
);
...
...
@@ -55,6 +49,25 @@ const ServiceLog = () => {
setTimeInterval
(
'4'
);
}
};
// 计算时间间隔(月份),禁止跨月份查询
const
startMonth
=
new
Date
(
startTime
).
getMonth
();
const
endMonth
=
new
Date
(
endTime
).
getMonth
();
const
startYear
=
new
Date
(
startTime
).
getYear
();
const
endYear
=
new
Date
(
endTime
).
getYear
();
if
(
minuteInterval
<=
0
)
{
notification
.
error
({
message
:
'时间设置有误'
,
description
:
'起始时间应该早于结束时间'
,
});
}
else
if
(
(
startMonth
!==
endMonth
&&
startYear
===
endYear
)
||
startYear
!==
endYear
)
{
notification
.
info
({
message
:
'时间设置提示'
,
description
:
'不允许跨月份查询'
,
});
}
const
columns
=
[
{
...
...
@@ -119,20 +132,38 @@ const ServiceLog = () => {
sorter
:
(
a
,
b
)
=>
a
.
ResponseSize
-
b
.
ResponseSize
,
},
];
// 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间
// 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间
,且不允许跨月查询
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
countInterval
();
// 根据起止时间计算时间间隔
}
},
[
startTime
,
endTime
]);
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
setLoading
(
true
);
getData
(
'/TrafficStatistics'
,
setVisitedCount
);
// 访问量统计
}
},
[
startTime
,
endTime
,
logType
,
timeInterval
]);
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
setLoading
(
true
);
getData
(
'/TopCountList'
,
setPathCount
);
// 接口调用频次统计
getData
(
'/TopConsumeList'
,
setReponseTime
);
// 接口平均耗时统计
...
...
This diff is collapsed.
Click to expand it.
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