fix: KPI统计跟随筛选条件变化+客户筛选修正+部门排序

- KPI统计(总里程/平均单车/监控台数)改为基于筛选后数据计算
- 移除不需要的 onlineCount 字段
- 快捷筛选"按客户"和全屏表格"客户"列改为真正的客户筛选
- 删除混乱的 projects 变量映射
- 部门列表按 一部→二部→三部 顺序排序

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-01 23:29:31 +08:00
parent c73e20bacf
commit 66de41d50b
3 changed files with 24 additions and 13 deletions

View File

@@ -106,7 +106,7 @@ export default function MonitoringView() {
const [appliedMileageRange, setAppliedMileageRange] = useState({ min: '', max: '' });
const [vehicles, setVehicles] = useState<MonitoringVehicle[]>([]);
const [stats, setStats] = useState<MonitoringStats>({ totalToday: 0, totalAll: 0, onlineCount: 0, vehicleCount: 0 });
const [stats, setStats] = useState<MonitoringStats>({ totalToday: 0, totalAll: 0, vehicleCount: 0 });
const [filterOptions, setFilterOptions] = useState<MonitoringFilters>({ departments: [], customers: [], plates: [], projects: [], entities: [] });
const [total, setTotal] = useState(0);
const [page, setPage] = useState(1);
@@ -119,7 +119,6 @@ export default function MonitoringView() {
const departments = filterOptions.departments;
const plateNumbers = filterOptions.plates;
const projects = filterOptions.customers;
// 加载首页数据
const loadFirstPage = useCallback(() => {
@@ -327,14 +326,14 @@ export default function MonitoringView() {
<th className="p-4 text-[10px] font-bold text-slate-500 uppercase">线</th>
<th className="p-4 text-[10px] font-bold text-slate-500 uppercase">
<div className="flex flex-col gap-1.5">
<span></span>
<span></span>
<select
className="bg-slate-800 border-none rounded-lg px-2 py-1 text-[9px] text-slate-300 outline-none focus:ring-1 focus:ring-blue-500/30"
value={filterProject}
onChange={(e) => setFilterProject(e.target.value)}
value={filterCustomer}
onChange={(e) => setFilterCustomer(e.target.value)}
>
<option value="All"></option>
{projects.map(p => <option key={p} value={p}>{p}</option>)}
{filterOptions.customers.map(p => <option key={p} value={p}>{p}</option>)}
</select>
</div>
</th>