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
f0974e0c
Commit
f0974e0c
authored
Jan 22, 2021
by
Maofei94
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of g.civnet.cn:ReactWeb5/maintenance
parents
c4e83ae5
0affa87a
Pipeline
#22845
skipped with stages
Changes
1
Pipelines
1
Show 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 @
f0974e0c
...
@@ -35,15 +35,9 @@ const ServiceLog = () => {
...
@@ -35,15 +35,9 @@ const ServiceLog = () => {
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
const
[
searchWord
,
setSearchWord
]
=
useState
(
''
);
// 关键字
// 计算时间间隔(分钟)
// 计算时间间隔(分钟)
const
start
=
new
Date
(
startTime
.
format
(
'YYYY-MM-DD HH:mm:ss'
)
).
getTime
();
const
start
=
new
Date
(
startTime
).
getTime
();
const
end
=
new
Date
(
endTime
.
format
(
'YYYY-MM-DD HH:mm:ss'
)
).
getTime
();
const
end
=
new
Date
(
endTime
).
getTime
();
const
minuteInterval
=
(
end
-
start
)
/
(
60
*
1000
);
// 相隔多少分钟
const
minuteInterval
=
(
end
-
start
)
/
(
60
*
1000
);
// 相隔多少分钟
if
(
minuteInterval
<=
0
)
{
notification
.
error
({
message
:
'时间设置有误'
,
description
:
'起始时间应该早于结束时间'
,
});
}
const
countInterval
=
()
=>
{
const
countInterval
=
()
=>
{
if
(
minuteInterval
>
0
&&
minuteInterval
<=
30
)
{
if
(
minuteInterval
>
0
&&
minuteInterval
<=
30
)
{
setTimeInterval
(
'1'
);
setTimeInterval
(
'1'
);
...
@@ -55,6 +49,25 @@ const ServiceLog = () => {
...
@@ -55,6 +49,25 @@ const ServiceLog = () => {
setTimeInterval
(
'4'
);
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
=
[
const
columns
=
[
{
{
...
@@ -119,20 +132,38 @@ const ServiceLog = () => {
...
@@ -119,20 +132,38 @@ const ServiceLog = () => {
sorter
:
(
a
,
b
)
=>
a
.
ResponseSize
-
b
.
ResponseSize
,
sorter
:
(
a
,
b
)
=>
a
.
ResponseSize
-
b
.
ResponseSize
,
},
},
];
];
// 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间
// 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间
,且不允许跨月查询
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
countInterval
();
// 根据起止时间计算时间间隔
countInterval
();
// 根据起止时间计算时间间隔
}
}
},
[
startTime
,
endTime
]);
},
[
startTime
,
endTime
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
setLoading
(
true
);
setLoading
(
true
);
getData
(
'/TrafficStatistics'
,
setVisitedCount
);
// 访问量统计
getData
(
'/TrafficStatistics'
,
setVisitedCount
);
// 访问量统计
}
}
},
[
startTime
,
endTime
,
logType
,
timeInterval
]);
},
[
startTime
,
endTime
,
logType
,
timeInterval
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
)
{
if
(
startTime
&&
endTime
&&
end
-
start
>
0
&&
startMonth
===
endMonth
&&
startYear
===
endYear
)
{
setLoading
(
true
);
setLoading
(
true
);
getData
(
'/TopCountList'
,
setPathCount
);
// 接口调用频次统计
getData
(
'/TopCountList'
,
setPathCount
);
// 接口调用频次统计
getData
(
'/TopConsumeList'
,
setReponseTime
);
// 接口平均耗时统计
getData
(
'/TopConsumeList'
,
setReponseTime
);
// 接口平均耗时统计
...
...
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