diff --git a/src/pages/System/Group.tsx b/src/pages/System/Group.tsx
index 2a82ac7..15bdbe7 100644
--- a/src/pages/System/Group.tsx
+++ b/src/pages/System/Group.tsx
@@ -603,7 +603,7 @@ const Group = () => {
diff --git a/src/pages/System/Role.tsx b/src/pages/System/Role.tsx
index 5462f44..570beb2 100644
--- a/src/pages/System/Role.tsx
+++ b/src/pages/System/Role.tsx
@@ -612,7 +612,7 @@ const Role = () => {
diff --git a/src/pages/System/Statistics/ActiveInfo.tsx b/src/pages/System/Statistics/ActiveInfo.tsx
index c79c012..0e93ff6 100644
--- a/src/pages/System/Statistics/ActiveInfo.tsx
+++ b/src/pages/System/Statistics/ActiveInfo.tsx
@@ -10,7 +10,7 @@ const ActiveInfo = () => {
const activeInfoDivRef = useRef(null)
const activeInfoEChartsRef = useRef(null)
const [isLoading, setIsLoading] = useState(false)
- const [scope, setScope] = useState('WEAK')
+ const [scope, setScope] = useState('WEEK')
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
@@ -165,7 +165,7 @@ const ActiveInfo = () => {
disabled={isLoading}
style={{ width: '8em' }}
>
- 最近7天
+ 最近7天
最近30天
最近3个月
最近12个月
diff --git a/src/pages/System/Statistics/OnlineInfo.tsx b/src/pages/System/Statistics/OnlineInfo.tsx
index 59704af..624ceca 100644
--- a/src/pages/System/Statistics/OnlineInfo.tsx
+++ b/src/pages/System/Statistics/OnlineInfo.tsx
@@ -11,7 +11,7 @@ const OnlineInfo = () => {
const onlineInfoEChartsRef = useRef(null)
const [isLoading, setIsLoading] = useState(false)
const [currentOnlineCount, setCurrentOnlineCount] = useState(-1)
- const [scope, setScope] = useState('WEAK')
+ const [scope, setScope] = useState('WEEK')
useEffect(() => {
const chartResizeObserver = new ResizeObserver(() => {
@@ -59,13 +59,53 @@ const OnlineInfo = () => {
const dataList = getTimesBetweenTwoTimes(
data.history[0].time,
data.history[data.history.length - 1].time,
- 'minute'
- ).map((time) => [
- time,
- data.history.find(
- (value) => value.time.substring(0, 16) === time.substring(0, 16)
- )?.record ?? 0
- ])
+ _scope === 'DAY'
+ ? 'minute'
+ : _scope === 'WEEK'
+ ? 'minute'
+ : _scope === 'MONTH'
+ ? 'hour'
+ : 'day'
+ ).map((time) => {
+ const records = data.history
+ .filter(
+ (value) =>
+ value.time.substring(
+ 0,
+ _scope === 'DAY'
+ ? 16
+ : _scope === 'WEEK'
+ ? 16
+ : _scope === 'MONTH'
+ ? 13
+ : 10
+ ) ===
+ time.substring(
+ 0,
+ _scope === 'DAY'
+ ? 16
+ : _scope === 'WEEK'
+ ? 16
+ : _scope === 'MONTH'
+ ? 13
+ : 10
+ )
+ )
+ .map((item) => Number(item.record))
+ return [
+ time.substring(
+ 0,
+ _scope === 'DAY'
+ ? 16
+ : _scope === 'WEEK'
+ ? 16
+ : _scope === 'MONTH'
+ ? 13
+ : 10
+ ),
+ records.length ? Math.max(...records) : 0
+ ]
+ })
onlineInfoEChartsRef.current = echarts.init(
onlineInfoDivRef.current,
@@ -77,7 +117,15 @@ const OnlineInfo = () => {
...lineEChartsBaseOption,
tooltip: {
...lineEChartsBaseOption.tooltip,
- formatter: getTooltipTimeFormatter('yyyy-MM-DD HH:mm')
+ formatter: getTooltipTimeFormatter(
+ _scope === 'DAY'
+ ? 'yyyy-MM-DD HH:mm'
+ : _scope === 'WEEK'
+ ? 'yyyy-MM-DD HH:mm'
+ : _scope === 'MONTH'
+ ? 'yyyy-MM-DD HH时'
+ : 'yyyy-MM-DD'
+ )
},
xAxis: {
...lineEChartsBaseOption.xAxis
@@ -122,7 +170,7 @@ const OnlineInfo = () => {
style={{ width: '8em' }}
>
最近24小时
- 最近7天
+ 最近7天
最近30天
最近3个月
最近12个月
diff --git a/src/pages/System/Tools/Base.tsx b/src/pages/System/Tools/Base.tsx
index ccf9dda..528a107 100644
--- a/src/pages/System/Tools/Base.tsx
+++ b/src/pages/System/Tools/Base.tsx
@@ -1046,7 +1046,7 @@ const Base = () => {
diff --git a/src/pages/System/Tools/Category.tsx b/src/pages/System/Tools/Category.tsx
index 802065a..68dc276 100644
--- a/src/pages/System/Tools/Category.tsx
+++ b/src/pages/System/Tools/Category.tsx
@@ -272,7 +272,7 @@ const Category = () => {
diff --git a/src/pages/System/Tools/Template.tsx b/src/pages/System/Tools/Template.tsx
index 6c663d4..97a4457 100644
--- a/src/pages/System/Tools/Template.tsx
+++ b/src/pages/System/Tools/Template.tsx
@@ -985,7 +985,7 @@ const Template = () => {
diff --git a/src/pages/System/User.tsx b/src/pages/System/User.tsx
index f1692c7..5facab6 100644
--- a/src/pages/System/User.tsx
+++ b/src/pages/System/User.tsx
@@ -806,7 +806,7 @@ const User = () => {
@@ -815,7 +815,7 @@ const User = () => {
@@ -824,14 +824,14 @@ const User = () => {