fix: 部门出勤/闲置下钻改为基于当日里程区分
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 后端/list新增attendance参数(active/idle),查询当日里程表区分
  出勤(mileage>0)和闲置(mileage=0),仅对Operating车辆生效
- 前端部门Tab出勤/闲置点击改用attendance:'active'/'idle'替代
  原来错误的category:'Operating'/'Inventory'
- 修复department='公务车'过滤:匹配departmentName为null的车辆
- 前端API层新增attendance参数传递

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-03-28 20:01:58 +08:00
parent 29d295fceb
commit 8727dc36ab
3 changed files with 25 additions and 8 deletions

View File

@@ -57,6 +57,7 @@ export default function App() {
manager?: string;
customer?: string;
department?: string;
attendance?: 'active' | 'idle';
isColdChain?: boolean;
isTrailer?: boolean;
type?: string;
@@ -190,6 +191,7 @@ export default function App() {
if (showPlateNumbers.manager) params.manager = showPlateNumbers.manager;
if (showPlateNumbers.customer) params.customer = showPlateNumbers.customer;
if (showPlateNumbers.department) params.department = showPlateNumbers.department;
if (showPlateNumbers.attendance) params.attendance = showPlateNumbers.attendance;
if (!showPlateNumbers.type) {
if (showPlateNumbers.isColdChain !== undefined) params.isColdChain = String(showPlateNumbers.isColdChain);
if (showPlateNumbers.isTrailer !== undefined) params.isTrailer = String(showPlateNumbers.isTrailer);
@@ -1274,14 +1276,14 @@ export default function App() {
<span className="text-xl font-black">{deptData.reduce((s, d) => s + d.totalAssets, 0)}</span>
</div>
<div className="flex flex-col cursor-pointer hover:opacity-80 transition-opacity"
onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Operating', source: 'department', title: '部门运营统计 - 出勤车辆' })}>
onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', attendance: 'active', source: 'department', title: '部门运营统计 - 出勤车辆' })}>
<span className="text-[9px] opacity-50 uppercase font-bold tracking-widest mb-0.5 text-green-400"></span>
<span className="text-xl font-black text-green-400">
{deptData.reduce((acc, d) => acc + d.operatingCount, 0)}
</span>
</div>
<div className="flex flex-col cursor-pointer hover:opacity-80 transition-opacity"
onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Inventory', source: 'department', title: '部门运营统计 - 闲置车辆' })}>
onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', attendance: 'idle', source: 'department', title: '部门运营统计 - 闲置车辆' })}>
<span className="text-[9px] opacity-50 uppercase font-bold tracking-widest mb-0.5 text-slate-400"></span>
<span className="text-xl font-black text-slate-400">
{deptData.reduce((acc, d) => acc + d.idleCount, 0)}
@@ -1396,7 +1398,7 @@ export default function App() {
<button
onClick={(e) => {
e.stopPropagation();
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, category: 'Operating', source: 'department', title: `部门运营统计 - ${dept.department} - 出勤车辆` });
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, attendance: 'active', source: 'department', title: `部门运营统计 - ${dept.department} - 出勤车辆` });
}}
className="text-green-500 hover:underline font-black"
>
@@ -1407,7 +1409,7 @@ export default function App() {
<button
onClick={(e) => {
e.stopPropagation();
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, category: 'Inventory', source: 'department', title: `部门运营统计 - ${dept.department} - 闲置车辆` });
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, attendance: 'idle', source: 'department', title: `部门运营统计 - ${dept.department} - 闲置车辆` });
}}
className="text-gray-400 hover:underline font-black"
>
@@ -1608,12 +1610,12 @@ export default function App() {
<div className="text-xs font-black text-gray-800">{dept.totalAssets}</div>
</div>
<div className="text-center cursor-pointer hover:bg-green-50 rounded p-1"
onClick={(e) => { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, category: 'Operating', source: 'department', title: `部门运营统计 - ${dept.department} - 出勤车辆` }); }}>
onClick={(e) => { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, attendance: 'active', source: 'department', title: `部门运营统计 - ${dept.department} - 出勤车辆` }); }}>
<div className="text-[8px] text-green-500 uppercase font-bold mb-0.5"></div>
<div className="text-xs font-black text-green-500">{dept.operatingCount}</div>
</div>
<div className="text-center cursor-pointer hover:bg-gray-100 rounded p-1"
onClick={(e) => { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, category: 'Inventory', source: 'department', title: `部门运营统计 - ${dept.department} - 闲置车辆` }); }}>
onClick={(e) => { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', department: dept.department, attendance: 'idle', source: 'department', title: `部门运营统计 - ${dept.department} - 闲置车辆` }); }}>
<div className="text-[8px] text-gray-400 uppercase font-bold mb-0.5"></div>
<div className="text-xs font-black text-gray-400">{dept.idleCount}</div>
</div>