|
@@ -1,6 +1,15 @@
|
|
|
-import { PlatformConstants } from '@/constants/PlatformConstants';
|
|
|
|
|
import API from '@/services';
|
|
import API from '@/services';
|
|
|
-import { Card, Col, DatePicker, Empty, Row, Space, Spin, Table, Tag } from 'antd';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ Card,
|
|
|
|
|
+ Col,
|
|
|
|
|
+ DatePicker,
|
|
|
|
|
+ Empty,
|
|
|
|
|
+ Row,
|
|
|
|
|
+ Space,
|
|
|
|
|
+ Spin,
|
|
|
|
|
+ Table,
|
|
|
|
|
+ Tag,
|
|
|
|
|
+} from 'antd';
|
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
import type { ColumnsType } from 'antd/es/table';
|
|
|
import dayjs, { Dayjs } from 'dayjs';
|
|
import dayjs, { Dayjs } from 'dayjs';
|
|
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
@@ -12,6 +21,7 @@ interface DashboardRow {
|
|
|
id?: number;
|
|
id?: number;
|
|
|
statDate?: string;
|
|
statDate?: string;
|
|
|
platform: string;
|
|
platform: string;
|
|
|
|
|
+ platform_name?: string;
|
|
|
totalPages?: number;
|
|
totalPages?: number;
|
|
|
totalCount?: number;
|
|
totalCount?: number;
|
|
|
totalTasks?: number;
|
|
totalTasks?: number;
|
|
@@ -100,9 +110,9 @@ const HomePage: React.FC = () => {
|
|
|
dataIndex: 'platform',
|
|
dataIndex: 'platform',
|
|
|
key: 'platform',
|
|
key: 'platform',
|
|
|
width: 140,
|
|
width: 140,
|
|
|
- render: (val) => (
|
|
|
|
|
|
|
+ render: (_, record) => (
|
|
|
<span className={styles.platformName}>
|
|
<span className={styles.platformName}>
|
|
|
- {(PlatformConstants as any)[val] ?? `平台${val}`}
|
|
|
|
|
|
|
+ {record.platform_name ?? record.platform}
|
|
|
</span>
|
|
</span>
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
@@ -124,14 +134,16 @@ const HomePage: React.FC = () => {
|
|
|
key: 'completionRate',
|
|
key: 'completionRate',
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
render: (val) =>
|
|
render: (val) =>
|
|
|
- val == null ? '-' : (
|
|
|
|
|
|
|
+ val === null ? (
|
|
|
|
|
+ '-'
|
|
|
|
|
+ ) : (
|
|
|
<span
|
|
<span
|
|
|
className={
|
|
className={
|
|
|
Number(val) >= 80
|
|
Number(val) >= 80
|
|
|
? styles.rateUp
|
|
? styles.rateUp
|
|
|
: Number(val) >= 50
|
|
: Number(val) >= 50
|
|
|
- ? undefined
|
|
|
|
|
- : styles.rateDown
|
|
|
|
|
|
|
+ ? undefined
|
|
|
|
|
+ : styles.rateDown
|
|
|
}
|
|
}
|
|
|
>
|
|
>
|
|
|
{`${Number(val).toFixed(2)}%`}
|
|
{`${Number(val).toFixed(2)}%`}
|
|
@@ -144,12 +156,7 @@ const HomePage: React.FC = () => {
|
|
|
key: 'totalPages',
|
|
key: 'totalPages',
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- title: '今日爬取条数',
|
|
|
|
|
- dataIndex: 'totalCount',
|
|
|
|
|
- key: 'totalCount',
|
|
|
|
|
- align: 'right',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
title: '活跃账号',
|
|
title: '活跃账号',
|
|
|
dataIndex: 'activeAccounts',
|
|
dataIndex: 'activeAccounts',
|
|
@@ -168,11 +175,7 @@ const HomePage: React.FC = () => {
|
|
|
key: 'exceptionTotal',
|
|
key: 'exceptionTotal',
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
render: (val) =>
|
|
render: (val) =>
|
|
|
- val > 0 ? (
|
|
|
|
|
- <Tag color="red">{val}</Tag>
|
|
|
|
|
- ) : (
|
|
|
|
|
- <Tag color="green">0</Tag>
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ val > 0 ? <Tag color="red">{val}</Tag> : <Tag color="green">0</Tag>,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '异常率',
|
|
title: '异常率',
|
|
@@ -180,12 +183,10 @@ const HomePage: React.FC = () => {
|
|
|
key: 'exceptionRate',
|
|
key: 'exceptionRate',
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
render: (val) =>
|
|
render: (val) =>
|
|
|
- val == null ? '-' : (
|
|
|
|
|
- <span
|
|
|
|
|
- className={
|
|
|
|
|
- Number(val) <= 5 ? styles.rateUp : styles.rateDown
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ val === null ? (
|
|
|
|
|
+ '-'
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <span className={Number(val) <= 5 ? styles.rateUp : styles.rateDown}>
|
|
|
{`${Number(val).toFixed(2)}%`}
|
|
{`${Number(val).toFixed(2)}%`}
|
|
|
</span>
|
|
</span>
|
|
|
),
|
|
),
|
|
@@ -221,7 +222,7 @@ const HomePage: React.FC = () => {
|
|
|
dataIndex: 'platform',
|
|
dataIndex: 'platform',
|
|
|
key: 'platform',
|
|
key: 'platform',
|
|
|
width: 140,
|
|
width: 140,
|
|
|
- render: (val) => (PlatformConstants as any)[val] ?? `平台${val}`,
|
|
|
|
|
|
|
+ render: (_, record) => record.platform_name ?? record.platform,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '总任务数',
|
|
title: '总任务数',
|
|
@@ -241,12 +242,6 @@ const HomePage: React.FC = () => {
|
|
|
key: 'totalPages',
|
|
key: 'totalPages',
|
|
|
align: 'right',
|
|
align: 'right',
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- title: '爬取条数',
|
|
|
|
|
- dataIndex: 'totalCount',
|
|
|
|
|
- key: 'totalCount',
|
|
|
|
|
- align: 'right',
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
title: '异常',
|
|
title: '异常',
|
|
|
dataIndex: 'exceptionTotal',
|
|
dataIndex: 'exceptionTotal',
|
|
@@ -280,17 +275,16 @@ const HomePage: React.FC = () => {
|
|
|
</Col>
|
|
</Col>
|
|
|
<Col xs={24} sm={12} md={6}>
|
|
<Col xs={24} sm={12} md={6}>
|
|
|
<div className={styles.summaryCard}>
|
|
<div className={styles.summaryCard}>
|
|
|
- <span className={styles.summaryTitle}>今日爬取条数</span>
|
|
|
|
|
- <span className={styles.summaryValue}>{summary.totalCount}</span>
|
|
|
|
|
- <span className={styles.summaryHint}>
|
|
|
|
|
- 爬取页数 {summary.totalPages}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <span className={styles.summaryTitle}>今日爬取页数</span>
|
|
|
|
|
+ <span className={styles.summaryValue}>{summary.totalPages}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</Col>
|
|
</Col>
|
|
|
<Col xs={24} sm={12} md={6}>
|
|
<Col xs={24} sm={12} md={6}>
|
|
|
<div className={styles.summaryCard}>
|
|
<div className={styles.summaryCard}>
|
|
|
<span className={styles.summaryTitle}>今日活跃账号</span>
|
|
<span className={styles.summaryTitle}>今日活跃账号</span>
|
|
|
- <span className={styles.summaryValue}>{summary.activeAccounts}</span>
|
|
|
|
|
|
|
+ <span className={styles.summaryValue}>
|
|
|
|
|
+ {summary.activeAccounts}
|
|
|
|
|
+ </span>
|
|
|
<span className={styles.summaryHint}>
|
|
<span className={styles.summaryHint}>
|
|
|
回告次数 {summary.reportCount}
|
|
回告次数 {summary.reportCount}
|
|
|
</span>
|
|
</span>
|
|
@@ -316,7 +310,9 @@ const HomePage: React.FC = () => {
|
|
|
</Row>
|
|
</Row>
|
|
|
|
|
|
|
|
<div className={styles.platformPanel}>
|
|
<div className={styles.platformPanel}>
|
|
|
- <div className={styles.panelTitle}>平台数据明细({date.format('YYYY-MM-DD')})</div>
|
|
|
|
|
|
|
+ <div className={styles.panelTitle}>
|
|
|
|
|
+ 平台数据明细({date.format('YYYY-MM-DD')})
|
|
|
|
|
+ </div>
|
|
|
<Spin spinning={loading}>
|
|
<Spin spinning={loading}>
|
|
|
{list.length ? (
|
|
{list.length ? (
|
|
|
<Table<DashboardRow>
|
|
<Table<DashboardRow>
|
|
@@ -349,9 +345,7 @@ const HomePage: React.FC = () => {
|
|
|
<Spin spinning={trendLoading}>
|
|
<Spin spinning={trendLoading}>
|
|
|
{trendData.length ? (
|
|
{trendData.length ? (
|
|
|
<Table
|
|
<Table
|
|
|
- rowKey={(r: any) =>
|
|
|
|
|
- `${r.statDate || ''}-${r.platform || ''}`
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ rowKey={(r: any) => `${r.statDate || ''}-${r.platform || ''}`}
|
|
|
dataSource={trendData}
|
|
dataSource={trendData}
|
|
|
columns={trendColumns}
|
|
columns={trendColumns}
|
|
|
size="small"
|
|
size="small"
|