feat(scheduling): add 近期已干预 summary card (last 7 days)
Restore 替换建议 card and add a new emerald 近期已干预 card. Clicking opens the history modal pre-filtered to the last 7 days (excluding cancelled) via a toggle chip users can switch off. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -171,6 +171,7 @@ export default function SchedulingModule() {
|
||||
const [batchInFlight, setBatchInFlight] = useState(false);
|
||||
const [batchResultMsg, setBatchResultMsg] = useState<string | null>(null);
|
||||
const [showHistory, setShowHistory] = useState(false);
|
||||
const [historyRecentOnly, setHistoryRecentOnly] = useState(false);
|
||||
|
||||
const loadData = useCallback(async () => {
|
||||
setLoading(true);
|
||||
@@ -277,7 +278,7 @@ export default function SchedulingModule() {
|
||||
<div className="max-w-6xl mx-auto flex flex-col gap-3 pb-16 md:pb-0">
|
||||
|
||||
{/* ===== Summary Cards ===== */}
|
||||
<div className="grid grid-cols-3 gap-2.5">
|
||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-2.5">
|
||||
{/* 里程高·换下 — warm orange */}
|
||||
<button
|
||||
onClick={() => setTypeFilter(typeFilter === 'qualified' ? 'all' : 'qualified')}
|
||||
@@ -330,7 +331,7 @@ export default function SchedulingModule() {
|
||||
}`}
|
||||
>
|
||||
<div className={`text-[10px] font-bold mb-1 ${typeFilter === 'all' ? 'text-slate-300' : 'text-slate-500'}`}>
|
||||
调度方案
|
||||
替换建议
|
||||
</div>
|
||||
<div className={`text-2xl font-black ${typeFilter === 'all' ? 'text-white' : 'text-slate-800'}`}>
|
||||
{loading && !data ? '-' : summary?.suggestionCount ?? 0}
|
||||
@@ -340,6 +341,23 @@ export default function SchedulingModule() {
|
||||
执行后预计 +{summary?.estimatedGain ?? 0} 台达标
|
||||
</div>
|
||||
</button>
|
||||
|
||||
{/* 近期已干预 — emerald */}
|
||||
<button
|
||||
onClick={() => { setShowHistory(true); setHistoryRecentOnly(true); }}
|
||||
className="p-3.5 rounded-2xl text-left transition-all cursor-pointer bg-gradient-to-br from-emerald-50 to-teal-50 border border-emerald-200/60"
|
||||
>
|
||||
<div className="text-[10px] font-bold mb-1 text-emerald-600">
|
||||
近期已干预
|
||||
</div>
|
||||
<div className="text-2xl font-black text-emerald-700">
|
||||
{loading && !data ? '-' : summary?.recentInterventionCount ?? 0}
|
||||
<span className="text-[10px] font-normal ml-1 text-emerald-400">条</span>
|
||||
</div>
|
||||
<div className="text-[9px] mt-0.5 text-emerald-400">
|
||||
最近 7 天 · 点击查看
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* ===== List Card ===== */}
|
||||
@@ -363,7 +381,7 @@ export default function SchedulingModule() {
|
||||
<Download size={15} />
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setShowHistory(true)}
|
||||
onClick={() => { setShowHistory(true); setHistoryRecentOnly(false); }}
|
||||
className="p-1.5 text-slate-400 hover:text-slate-600 transition-colors rounded-lg hover:bg-slate-50 cursor-pointer"
|
||||
title="调度记录"
|
||||
>
|
||||
@@ -510,7 +528,11 @@ export default function SchedulingModule() {
|
||||
)}
|
||||
|
||||
{showHistory && (
|
||||
<NotificationHistory onClose={() => setShowHistory(false)} onChange={loadData} />
|
||||
<NotificationHistory
|
||||
onClose={() => setShowHistory(false)}
|
||||
onChange={loadData}
|
||||
recentOnly={historyRecentOnly}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Batch action bar */}
|
||||
|
||||
Reference in New Issue
Block a user