fix: 全屏模式重新设计为纵向布局
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 去掉 CSS transform 旋转(移动端不兼容)
- KPI 改为单行横排4个卡片
- 标题栏+KPI 紧凑排列在顶部
- 表格区域占满剩余空间,可滚动查看所有列
- 移动端和桌面端统一布局

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-02 00:38:26 +08:00
parent 8b95e53098
commit e57b8d8801

View File

@@ -241,82 +241,53 @@ export default function MonitoringView() {
initial={{ opacity: 0 }} initial={{ opacity: 0 }}
animate={{ opacity: 1 }} animate={{ opacity: 1 }}
exit={{ opacity: 0 }} exit={{ opacity: 0 }}
className="fixed inset-0 z-[100] bg-slate-950 flex flex-row p-4 gap-4 overflow-hidden portrait:origin-top-left" className="fixed inset-0 z-[100] bg-slate-950 flex flex-col overflow-hidden"
style={{
...(typeof window !== 'undefined' && window.innerHeight > window.innerWidth
? { transform: 'rotate(90deg) translateY(-100%)', width: window.innerHeight, height: window.innerWidth, transformOrigin: 'top left' }
: {}),
}}
> >
{/* Sidebar Stats */} {/* Top bar: title + KPI row + close */}
<div className="flex flex-col gap-4 w-72 flex-shrink-0"> <div className="flex-shrink-0 p-3 border-b border-slate-800 space-y-2">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="w-1 h-6 bg-blue-500 rounded-full"></div> <div className="w-1 h-5 bg-blue-500 rounded-full"></div>
<h2 className="text-white font-bold text-lg"></h2> <h2 className="text-white font-bold text-sm"></h2>
</div> </div>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<button <button
onClick={() => { onClick={() => { setFilterDept('All'); setFilterCustomer('All'); setFilterPlate('All'); setSearchTerm(''); }}
setFilterDept('All'); className="p-1.5 bg-slate-800 text-slate-400 rounded-full hover:text-blue-400 transition-colors"
setFilterProject('All');
setFilterPlate('All');
setSearchTerm('');
}}
className="p-2 bg-slate-800 text-slate-400 rounded-full hover:text-blue-400 transition-colors"
title="重置筛选"
> >
<RotateCcw size={16} /> <RotateCcw size={14} />
</button> </button>
<button <button onClick={toggleFullscreen} className="p-1.5 bg-slate-800 text-slate-400 rounded-full hover:text-white transition-colors">
onClick={toggleFullscreen} <Minimize2 size={16} />
className="p-2 bg-slate-800 text-slate-400 rounded-full hover:text-white transition-colors"
>
<Minimize2 size={20} />
</button> </button>
</div> </div>
</div> </div>
{/* KPI — single row */}
{/* KPI Cards in Fullscreen */} <div className="flex gap-2">
<div className="grid grid-cols-2 landscape:grid-cols-1 gap-3"> <div className={`flex-1 bg-slate-900/50 border px-3 py-2 rounded-xl ${sortBy === 'today' ? 'border-blue-500/50' : 'border-slate-800'}`}>
<div className={`bg-slate-900/50 border p-4 rounded-2xl transition-all ${sortBy === 'today' ? 'border-blue-500/50 ring-1 ring-blue-500/20' : 'border-slate-800'}`}> <div className="text-[8px] font-bold text-slate-500 uppercase"></div>
<div className="text-[10px] font-bold text-slate-500 uppercase mb-1"></div> <div className="text-base font-black text-white">{Math.round(stats.totalToday).toLocaleString()} <span className="text-blue-400 text-[9px]">km</span></div>
<div className="text-2xl font-black text-white tracking-tighter">
{stats.totalToday.toLocaleString()}
<span className="text-blue-400 text-xs ml-2">KM</span>
</div> </div>
<div className={`flex-1 bg-slate-900/50 border px-3 py-2 rounded-xl ${sortBy === 'total' ? 'border-blue-500/50' : 'border-slate-800'}`}>
<div className="text-[8px] font-bold text-slate-500 uppercase"></div>
<div className="text-base font-black text-white">{Math.round(stats.totalAll).toLocaleString()} <span className="text-blue-400 text-[9px]">km</span></div>
</div> </div>
<div className={`bg-slate-900/50 border p-4 rounded-2xl transition-all ${sortBy === 'total' ? 'border-blue-500/50 ring-1 ring-blue-500/20' : 'border-slate-800'}`}> <div className="flex-1 bg-slate-900/50 border border-slate-800 px-3 py-2 rounded-xl">
<div className="text-[10px] font-bold text-slate-500 uppercase mb-1"></div> <div className="text-[8px] font-bold text-slate-500 uppercase"></div>
<div className="text-2xl font-black text-white tracking-tighter"> <div className="text-base font-black text-white">{stats.vehicleCount} <span className="text-blue-400 text-[9px]"></span></div>
{stats.totalAll.toLocaleString()}
<span className="text-blue-400 text-xs ml-2">KM</span>
</div>
</div>
<div className="bg-slate-900/50 border border-slate-800 p-4 rounded-2xl">
<div className="text-[10px] font-bold text-slate-500 uppercase mb-1"></div>
<div className="text-2xl font-black text-white tracking-tighter">
{stats.vehicleCount}
<span className="text-blue-400 text-xs ml-2"></span>
</div>
</div>
<div className="bg-slate-900/50 border border-slate-800 p-4 rounded-2xl">
<div className="text-[10px] font-bold text-slate-500 uppercase mb-1">
({sortBy === 'today' ? '今日' : '累计'})
</div>
<div className="text-2xl font-black text-white tracking-tighter">
{(stats.vehicleCount > 0 ? (sortBy === 'today' ? stats.totalToday : stats.totalAll) / stats.vehicleCount : 0).toFixed(0)}
<span className="text-blue-400 text-xs ml-2">KM</span>
</div> </div>
<div className="flex-1 bg-slate-900/50 border border-slate-800 px-3 py-2 rounded-xl">
<div className="text-[8px] font-bold text-slate-500 uppercase"></div>
<div className="text-base font-black text-white">{(stats.vehicleCount > 0 ? (sortBy === 'today' ? stats.totalToday : stats.totalAll) / stats.vehicleCount : 0).toFixed(0)} <span className="text-blue-400 text-[9px]">km</span></div>
</div> </div>
</div> </div>
</div> </div>
{/* Main Table Area */} {/* Table Area */}
<div className="flex-1 bg-slate-900/30 border border-slate-800 rounded-2xl overflow-hidden flex flex-col"> <div className="flex-1 overflow-hidden flex flex-col">
<div className="p-4 border-b border-slate-800 flex justify-between items-center bg-slate-900/50"> <div className="px-3 py-2 border-b border-slate-800 flex justify-between items-center flex-shrink-0">
<span className="text-xs font-bold text-slate-400 uppercase tracking-widest"></span> <span className="text-[10px] font-bold text-slate-400 uppercase tracking-widest"></span>
<div className="flex items-center gap-4 text-[10px] text-slate-500"> <div className="flex items-center gap-3 text-[9px] text-slate-500">
<div className="flex items-center gap-1"> <div className="flex items-center gap-1">
<div className="w-2 h-2 rounded-full bg-green-500"></div> <div className="w-2 h-2 rounded-full bg-green-500"></div>
<span>线</span> <span>线</span>