fix: move defect drilldown breadcrumb beside trend heading

This commit is contained in:
2026-11-13 14:20:15 +08:00
parent e3e38dec04
commit 79edb3f6db
4 changed files with 9 additions and 8 deletions
+1 -2
View File
@@ -774,14 +774,13 @@ export default function QueryPage({ page, onUnauthorized }: {
<>
<div className="analysis-stack">
<QueryTrendPanel panelRef={trendSection} id={active ? 'monthly-trend' : undefined}
<QueryTrendPanel headingControls={defectDrill.controls} panelRef={trendSection} id={active ? 'monthly-trend' : undefined}
mode={trendMode} onMode={setTrendMode} granularity={trendGranularity} onGranularity={setTrendGranularity}
defectDisplay={defectDisplay} onDefectDisplay={setDefectDisplay} fullFields={trendFullFields} onFullFields={setTrendFullFields}
object={trendObject} onObject={setSynchronizedTrendObject}
objects={trendOptions} scopeName={scopeName}
stageSwitch={<Segmented value={trendStage} options={[{ label: '亮片', value: 'bright' }, { label: '黑片', value: 'black' }]} onChange={value => setTrendStage(value as Stage)} aria-label="趋势阶段" />}>
{currentTrendError && <Alert type="warning" showIcon message={retainedTrend ? "趋势更新失败,当前显示上次结果" : "趋势读取失败"} description={retainedTrend ? `${currentTrendError};当前范围:${loadedQueryScope(retainedTrend.query, decodeQueryValueList)}` : currentTrendError} action={<Button onClick={() => setTrendRevision(value => value + 1)}>重试</Button>} />}
{defectDrill.controls}
<div className="trend-chart-shell" aria-busy={trendRefreshing} inert={trendRefreshing || trendDataKey !== trendKey}>
{trendMode === 'data'
? <TrendTable rows={renderedTrendData} defectDisplay={defectDisplay} rateBasis={rateBasis} fullFields={trendFullFields} onMonth={selectTrendPeriod} />
+3 -3
View File
@@ -7,18 +7,18 @@ type Granularity = 'month' | 'quarter' | 'year';
type TrendMode = 'production' | 'defects' | 'data';
type DefectDisplay = 'weight' | 'rate';
export function QueryTrendPanel({ panelRef, id, mode, onMode, granularity, onGranularity, defectDisplay, onDefectDisplay, fullFields, onFullFields, object, onObject, objects, scopeName, stageSwitch, children }: {
export function QueryTrendPanel({ panelRef, id, mode, onMode, granularity, onGranularity, defectDisplay, onDefectDisplay, fullFields, onFullFields, object, onObject, objects, scopeName, stageSwitch, headingControls, children }: {
panelRef?: Ref<HTMLElement>; id?: string; mode: TrendMode; onMode: (value: TrendMode) => void;
granularity: Granularity; onGranularity: (value: Granularity) => void;
defectDisplay: DefectDisplay; onDefectDisplay: (value: DefectDisplay) => void;
fullFields: boolean; onFullFields: (value: boolean) => void;
object?: string; onObject: (value?: string) => void; objects: Array<{ label: string; value: string }>;
scopeName: string; stageSwitch?: ReactNode; children: ReactNode;
scopeName: string; stageSwitch?: ReactNode; headingControls?: ReactNode; children: ReactNode;
}) {
const periodName = granularity === 'month' ? '月度' : granularity === 'quarter' ? '季度' : '年度';
return <section className="panel section-panel trend-panel" data-snapshot-module="trend" ref={panelRef} id={id}>
<div className="section-heading-row trend-heading-row">
<div className="section-heading"><h2>{periodName}变化趋势</h2></div>
<div className="section-heading trend-heading-content"><h2>{periodName}变化趋势</h2>{headingControls}</div>
<Segmented value={mode} options={[{ label: '合格率与产量', value: 'production' }, { label: '不良率', value: 'defects' }, { label: `${periodName}数据`, value: 'data' }]} onChange={onMode} aria-label="趋势视图" />
</div>
<div className="trend-controls">
+1 -2
View File
@@ -138,11 +138,10 @@ export default function StageProductPage({stage,onUnauthorized}:{stage:Stage;onU
<MetricCard label="总重量" value={`${weight(summary?.totalWeight)} kg`} onClick={()=>openDetail(null,stage)}/>
</section>
<div className="analysis-stack">
<QueryTrendPanel mode={trendMode} onMode={setTrendMode} granularity={trendGranularity} onGranularity={setTrendGranularity}
<QueryTrendPanel headingControls={defectDrill.controls} mode={trendMode} onMode={setTrendMode} granularity={trendGranularity} onGranularity={setTrendGranularity}
defectDisplay={defectDisplay} onDefectDisplay={setDefectDisplay} fullFields={trendFullFields} onFullFields={setTrendFullFields}
object={trendObject} onObject={setTrendObject} objects={trendOptions} scopeName="产品">
{trendError&&<Alert type="warning" showIcon message={trendResponse?"趋势更新失败,当前显示上次结果":"趋势读取失败"} description={trendResponse?`${trendError};当前范围:${loadedQueryScope(trendResponse.query,decodeQueryValueList)}`:trendError} action={<Button onClick={()=>setTrendRevision(v=>v+1)}>重试</Button>}/>}
{defectDrill.controls}
<div className="trend-chart-shell" aria-busy={trendRefreshing} inert={trendRefreshing||!!trendError}>
{trendMode==='data'
? <TrendTable rows={displayedTrend} defectDisplay={defectDisplay} rateBasis={rateBasis} onlyStage={stage} fullFields={trendFullFields} onMonth={selectTrendPeriod}/>
+4 -1
View File
@@ -54,6 +54,9 @@
.animated-metric-text { font-variant-numeric: tabular-nums lining-nums; }
@media (prefers-reduced-motion: reduce) { .smooth-table-frame { transition: none; } }
.defect-drilldown-controls { display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 8px;color:var(--ink);font-size:13px; }
.defect-drilldown-controls { display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0;color:var(--ink);font-size:13px;flex:1; }
.defect-drilldown-controls > .ant-btn {padding-inline:0;}
.defect-drilldown-notice {color:var(--muted-ink);font-size:12px;margin-left:auto;}
.trend-heading-content {flex:1;align-items:center;flex-wrap:wrap;gap:6px 16px;}
.trend-heading-content h2 {flex-shrink:0;}