fix(analytics): 对齐质量维度布局与封号历史折叠
统一维度提示与表格间距,取消无数据时的局部滚动;风控封号历史复用运营看板折叠样式。开发环境浏览器回归、875 项单测、ESLint 和 Prettier 均通过。
This commit is contained in:
@@ -10,6 +10,14 @@
|
||||
|
||||
## 2026-11-20
|
||||
|
||||
### 修复 · 风控看板自动封号历史
|
||||
|
||||
- 复用运营看板折叠面板外框,展开时由分隔线连接标题和内容;保留默认展开、筛选、刷新、分页与解封行为。
|
||||
|
||||
### 修复 · 控制台调用质量维度分布
|
||||
|
||||
- 对齐维度页签、数据来源提示和表格间距;表格随内容增高,空态不滚动,仅数据列超宽时支持横向滚动。保留排序、下钻与前 50 项查询规则。
|
||||
|
||||
### 性能 · 开发预热与公共首屏分包
|
||||
|
||||
- **范围**:Vite 开发和生产配置、应用启动、首页和认证页的加载边界。
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Select, Table, TabPane, Tabs, Tooltip } from '@/components/ui';
|
||||
import { Layers } from 'lucide-react';
|
||||
import { useIsMobile } from '@/hooks/common/useIsMobile';
|
||||
import {
|
||||
ORDER_OPTIONS,
|
||||
ORG_DIMS,
|
||||
@@ -27,6 +28,8 @@ export const RateBar = ({ value }) => (
|
||||
/** 维度分布:每行可点击,把该维度值加入筛选(下钻) */
|
||||
const QualityBreakdown = ({ quality, t }) => {
|
||||
const { scope, get, params, setFilters } = quality;
|
||||
const isPlatform = scope !== 'org';
|
||||
const isMobile = useIsMobile();
|
||||
const dims = scope === 'org' ? ORG_DIMS : PLATFORM_DIMS;
|
||||
const [dim, setDim] = useState('model');
|
||||
const [orderBy, setOrderBy] = useState('total');
|
||||
@@ -171,6 +174,9 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
setFilters({ [dimSpec.filterKey]: row.key });
|
||||
};
|
||||
|
||||
const rows = data?.rows || [];
|
||||
const isPlatformEmpty = isPlatform && rows.length === 0;
|
||||
|
||||
return (
|
||||
<div className='quality-card'>
|
||||
<div className='quality-card-head'>
|
||||
@@ -189,7 +195,9 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
onChange={setOrderBy}
|
||||
/>
|
||||
</div>
|
||||
<div className='quality-card-body quality-nested-tabs'>
|
||||
<div
|
||||
className={`quality-card-body quality-nested-tabs${isPlatform ? ' quality-breakdown-body' : ''}`}
|
||||
>
|
||||
<Tabs type='button' size='small' activeKey={dim} onChange={setDim}>
|
||||
{dims.map((d) => (
|
||||
<TabPane key={d.value} itemKey={d.value} tab={t(d.label)} />
|
||||
@@ -199,17 +207,37 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
<QualityMetaNotice meta={data.meta} scope={scope} t={t} />
|
||||
)}
|
||||
{error ? (
|
||||
<div className='quality-empty'>{qualityErrorText(t, error)}</div>
|
||||
<div className={isPlatform ? 'quality-breakdown-result' : undefined}>
|
||||
<div className='quality-empty'>{qualityErrorText(t, error)}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className='overflow-x-auto app-scrollbar mt-2'>
|
||||
<div
|
||||
className={
|
||||
isPlatform
|
||||
? 'quality-breakdown-result'
|
||||
: 'overflow-x-auto app-scrollbar mt-2'
|
||||
}
|
||||
>
|
||||
<Table
|
||||
className={
|
||||
isPlatformEmpty ? 'quality-breakdown-empty' : undefined
|
||||
}
|
||||
size='small'
|
||||
rowKey={(row) => `${row.key}|${row.key2 || ''}`}
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={data?.rows || []}
|
||||
columns={
|
||||
isPlatformEmpty
|
||||
? (isMobile ? columns.slice(0, 1) : columns).map(
|
||||
(column) => ({
|
||||
...column,
|
||||
width: undefined,
|
||||
}),
|
||||
)
|
||||
: columns
|
||||
}
|
||||
dataSource={rows}
|
||||
pagination={false}
|
||||
scroll={{ x: 960 }}
|
||||
scroll={{ x: isPlatformEmpty ? undefined : 960 }}
|
||||
onRow={(row) =>
|
||||
canDrill(row)
|
||||
? {
|
||||
@@ -224,11 +252,11 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
}
|
||||
empty={<div className='quality-empty'>{t('暂无数据')}</div>}
|
||||
/>
|
||||
{data && data.total_rows > (data.rows || []).length && (
|
||||
{data && data.total_rows > rows.length && (
|
||||
<div className='mt-2 text-xs text-[var(--text-secondary)]'>
|
||||
{t('共 {{total}} 项,仅展示排序后的前 {{shown}} 项', {
|
||||
total: data.total_rows,
|
||||
shown: (data.rows || []).length,
|
||||
shown: rows.length,
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -63,6 +63,32 @@
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.quality-breakdown-body {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
padding-block-start: 12px;
|
||||
}
|
||||
|
||||
.quality-breakdown-body .ant-tabs > .ant-tabs-nav {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.quality-breakdown-result {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quality-breakdown-empty .ant-table-thead > tr > th {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.quality-breakdown-body .ant-tabs .ant-tabs-tab + .ant-tabs-tab {
|
||||
margin-inline-start: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 筛选栏 */
|
||||
.quality-filter-grid {
|
||||
display: grid;
|
||||
|
||||
@@ -506,12 +506,12 @@ const Analytics = () => {
|
||||
/>
|
||||
|
||||
{/* 自动封号历史 */}
|
||||
<div className='mt-6 mb-6'>
|
||||
<div className='analytics-fold-panel'>
|
||||
<CollapsibleHeader
|
||||
icon={<History className='w-5 h-5' />}
|
||||
title={t('自动封号历史')}
|
||||
isOpen={banLogsOpen}
|
||||
onToggle={() => setBanLogsOpen(!banLogsOpen)}
|
||||
onToggle={() => setBanLogsOpen((open) => !open)}
|
||||
t={t}
|
||||
extra={
|
||||
<span className='text-xs text-gray-400 ml-2'>
|
||||
@@ -520,7 +520,7 @@ const Analytics = () => {
|
||||
}
|
||||
/>
|
||||
<Collapsible isOpen={banLogsOpen} keepDOM>
|
||||
<div className='mt-2 px-5 py-4 bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700'>
|
||||
<div className='min-w-0 px-5 py-4'>
|
||||
<RiskControlBanLogs
|
||||
loading={risk.banLogLoading}
|
||||
banLogs={risk.banLogs}
|
||||
|
||||
Reference in New Issue
Block a user