diff --git a/src/App.tsx b/src/App.tsx index d19cfcf..ef4f3d7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -56,6 +56,7 @@ export default function App() { vehicleType?: string; manager?: string; customer?: string; + department?: string; isColdChain?: boolean; isTrailer?: boolean; type?: string; @@ -188,6 +189,7 @@ export default function App() { if (cat === 'Operating') params.category = 'Operating'; if (showPlateNumbers.manager) params.manager = showPlateNumbers.manager; if (showPlateNumbers.customer) params.customer = showPlateNumbers.customer; + if (showPlateNumbers.department) params.department = showPlateNumbers.department; if (!showPlateNumbers.type) { if (showPlateNumbers.isColdChain !== undefined) params.isColdChain = String(showPlateNumbers.isColdChain); if (showPlateNumbers.isTrailer !== undefined) params.isTrailer = String(showPlateNumbers.isTrailer); @@ -469,112 +471,108 @@ export default function App() { - {activeTab === 'overview' && ( - <> - {/* Header Summary - Ultra Compact */} -
- {/* Total Assets */} -
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All' })}> -
- -
-
-
资产总数
-
{SUMMARY.totalAssets.toLocaleString()}
-
-
- - {/* Operating */} -
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Operating' })}> -
- -
-
-
总运营
-
- {SUMMARY.operating.total} - 自{SUMMARY.operating.self} 租{SUMMARY.operating.leased}{SUMMARY.operating.hanging > 0 ? ` 挂${SUMMARY.operating.hanging}` : ''} -
-
-
- - {/* Inventory */} -
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Inventory' })}> -
- -
-
-
总库存
-
- {SUMMARY.inventory.total} - 库{SUMMARY.inventory.inStock} 异{SUMMARY.inventory.abnormal} -
-
-
- - {/* Pending */} -
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Pending' })}> -
- -
-
-
待交车
-
{SUMMARY.pendingDelivery}
-
-
- - {/* Dynamics */} -
-
-
本周动态
-
上周六-本周五
-
-
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', title: '本周新增车辆' })}> - {SUMMARY.weeklyNew} - 新增 -
-
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Delivered' })}> - {SUMMARY.weeklyDelivered} - 交车 -
-
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Returned' })}> - {SUMMARY.weeklyReturned} - 还车 -
-
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Replaced' })}> - {SUMMARY.weeklyReplaced} - 替换 -
-
-
-
- - )} - {/* Main Content Area */}
+ {activeTab === 'overview' && ( - <> - {/* Asset Summary Table with Dimension Switch */} + <> + {/* Header Summary - Ultra Compact */} +
+ {/* Total Assets */} +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', source: 'asset', title: '资产概览' })}> +
+ +
+
+
资产总数
+
{SUMMARY.totalAssets.toLocaleString()}
+
+
+ + {/* Operating */} +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Operating', source: 'asset', title: '正在运营' })}> +
+ +
+
+
总运营
+
+ {SUMMARY.operating.total} + 自{SUMMARY.operating.self} 租{SUMMARY.operating.leased} +
+
+
+ + {/* Inventory */} +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Inventory', source: 'asset', title: '库存总数' })}> +
+ +
+
+
总库存
+
+ {SUMMARY.inventory.total} + 库{SUMMARY.inventory.inStock} 异{SUMMARY.inventory.abnormal} +
+
+
+ + {/* Pending */} +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Pending', source: 'asset', title: '待交车' })}> +
+ +
+
+
待交车
+
{SUMMARY.pendingDelivery}
+
+
+ + {/* Dynamics */} +
+
+
本周动态
+
上周六-本周五
+
+
+
+ {SUMMARY.weeklyNew} + 新增 +
+
+
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Delivered', source: 'asset', title: '本周交车' })}> + {SUMMARY.weeklyDelivered} + 交车 +
+
+
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Returned', source: 'asset', title: '本周还车' })}> + {SUMMARY.weeklyReturned} + 还车 +
+
+
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Replaced', source: 'asset', title: '本周替换' })}> + {SUMMARY.weeklyReplaced} + 替换 +
+
+
+
+ + {/* Asset Summary Table */}

资产数据实时汇总

- 点击车型展开品牌型号明细 + 点击型号展开详情
@@ -584,12 +582,7 @@ export default function App() { - + @@ -604,342 +597,162 @@ export default function App() { - - - - - - {['嘉兴', '广东', '北京', '新疆', '其他'].map((reg) => { - const val = processedData.reduce((s, t) => s + (t.inventoryRegions?.[reg] || 0), 0); - return ( - - ); - })} - - - - - - - {processedData.map((typeGroup) => ( - - {/* Category Header Row */} - toggleAssetType(typeGroup.type)} - > - <> - - - - - {['嘉兴', '广东', '北京', '新疆', '其他'].map((reg) => ( - - ))} - - - - - - - + {processedData.map((typeGroup) => ( + + {/* Category Header Row */} + toggleAssetType(typeGroup.type)}> + + - - {expandedAssetTypes.has(typeGroup.type) && - typeGroup.models.map((model) => ( - - toggleModel(model.model)} - > - - - - - {['嘉兴', '广东', '北京', '新疆', '其他'].map((reg) => ( - - ))} - - - - - - - {expandedModels.has(model.model) && model.batches.map((batch) => ( - + {expandedAssetTypes.has(typeGroup.type) && typeGroup.models.map((model) => ( + + toggleModel(model.model)} + > + + + + + {['嘉兴', '广东', '北京', '新疆', '其他'].map(reg => ( + - - - - {['嘉兴', '广东', '北京', '新疆', '其他'].map((reg) => ( - - ))} - - - - - - - ))} - + {model.inventoryRegions[reg]} + + ) : ''} + ))} - - - ))} + + + + + + + + ))} + + + ))}
- - 车型 品牌型号 车辆总资产 库存总数本周还车 本周替换
总计 - - - - - {val > 0 ? ( - - ) : ''} - - {processedData.reduce((s, t) => s + t.pending, 0) > 0 ? ( - - ) : ''} - - - - {processedData.reduce((s, t) => s + t.weeklyDelivered, 0) > 0 ? ( - - ) : ''} - - {processedData.reduce((s, t) => s + t.weeklyReturned, 0) > 0 ? ( - - ) : ''} - - {processedData.reduce((s, t) => s + t.weeklyReplaced, 0) > 0 ? ( - - ) : ''} -
-
- {expandedAssetTypes.has(typeGroup.type) ? ( - - ) : ( - - )} - {typeGroup.type} -
-
小计 - - - - - {(typeGroup.inventoryRegions?.[reg] || 0) > 0 ? ( - - ) : ''} - - {typeGroup.pending > 0 ? ( - - ) : ''} - - - - {typeGroup.weeklyDelivered > 0 ? ( - - ) : ''} - - {typeGroup.weeklyReturned > 0 ? ( - - ) : ''} - - {typeGroup.weeklyReplaced > 0 ? ( - - ) : ''} -
+
+
+ {expandedAssetTypes.has(typeGroup.type) ? + : + + } + {typeGroup.type} +
+
+ 资产 {typeGroup.totalAssets} + 库存 {typeGroup.totalInventory} + 运营 {typeGroup.totalOperating} +
+
+
{typeGroup.type} - {expandedModels.has(model.model) ? ( - - ) : ( - - )} - {model.model} - - - - {model.inventory > 0 ? ( - - ) : model.inventory} - - {(model.inventoryRegions[reg] || 0) > 0 ? ( - - ) : ( - '' - )} - - {model.pending > 0 ? ( - - ) : ( - '' - )} - - - - {model.weeklyDelivered > 0 ? ( - - ) : ( - '' - )} - - {model.weeklyReturned > 0 ? ( - - ) : ( - '' - )} - - {model.weeklyReplaced > 0 ? ( - - ) : ( - '' - )} - {typeGroup.type} +
+ {expandedModels.has(model.model) ? : } + {model.model} +
+
+ 资产 {model.total} + 库存 {model.inventory} + 运营 {model.operating} +
+
+ + + + + {model.inventoryRegions[reg] > 0 ? ( + {batch.batch} - - - {batch.inventory > 0 ? ( - - ) : ''} - - {(batch.inventoryRegions[reg] || 0) > 0 ? ( - - ) : ''} - - {batch.pending > 0 ? ( - - ) : ''} - - - - {batch.weeklyDelivered > 0 ? ( - - ) : ''} - - {batch.weeklyReturned > 0 ? ( - - ) : ''} - - {batch.weeklyReplaced > 0 ? ( - - ) : ''} - + {model.pending > 0 ? ( + + ) : model.pending} + + + + {model.weeklyDelivered > 0 ? ( + + ) : model.weeklyDelivered} + + {model.weeklyReturned > 0 ? ( + + ) : model.weeklyReturned} + + {model.weeklyReplaced > 0 ? ( + + ) : model.weeklyReplaced} +
@@ -947,128 +760,114 @@ export default function App() { {/* Mobile View Cards for Asset Summary */}
{processedData.map((typeGroup) => ( -
-
toggleAssetType(typeGroup.type)} - > -
- {expandedAssetTypes.has(typeGroup.type) ? ( - - ) : ( - - )} - {typeGroup.type} -
-
- - 资产 {typeGroup.totalAssets} - - - 库存{' '} - {typeGroup.totalInventory} - - - 运营{' '} - {typeGroup.totalOperating} - -
+
+
toggleAssetType(typeGroup.type)} + > +
+ {expandedAssetTypes.has(typeGroup.type) ? + : + + } + {typeGroup.type}
- - {expandedAssetTypes.has(typeGroup.type) && ( - - {typeGroup.models.map((model) => ( -
-
toggleModel(model.model)} - > -
- {expandedModels.has(model.model) ? ( - - ) : ( - - )} - {model.model} -
-
- 资产 {model.total} - 库存 {model.inventory} - 运营 {model.operating} -
-
+
+ 资产 {typeGroup.totalAssets} + 库存 {typeGroup.totalInventory} + 运营 {typeGroup.totalOperating} +
+
- {expandedModels.has(model.model) && ( -
-
-
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Inventory', source: 'asset', title: `${model.model} - 库存` })}> - 总库存 - {model.inventory} -
-
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Pending', source: 'asset', title: `${model.model} - 待交车` })}> - 待交车 - {model.pending} -
-
- {['嘉兴', '广东', '北京', '新疆', '其他'].map(reg => ( -
-
{reg === '嘉兴' ? '浙' : reg === '广东' ? '粤' : reg === '北京' ? '京' : reg === '新疆' ? '新' : '其'}
- {(model.inventoryRegions[reg] || 0) > 0 ? ( - - ) : ( -
-
- )} -
- ))} -
-
-
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Delivered', source: 'asset', title: `${model.model} - 本周交车` })}> - 本周已交车 - {model.weeklyDelivered} -
-
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Returned', source: 'asset', title: `${model.model} - 本周还车` })}> - 已还车 - {model.weeklyReturned} -
-
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Replaced', source: 'asset', title: `${model.model} - 本周替换` })}> - 已替换 - {model.weeklyReplaced} + + {expandedAssetTypes.has(typeGroup.type) && ( + + {typeGroup.models.map((model) => ( +
+
toggleModel(model.model)} + > +
+ {expandedModels.has(model.model) ? : } + {model.model} +
+
+ 资产 {model.total} + 库存 {model.inventory} + 运营 {model.operating} +
+
+ + {expandedModels.has(model.model) && ( +
+
+
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Inventory', source: 'asset', title: `${model.model} - 库存` })}> + 总库存 + {model.inventory} +
+
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Pending', source: 'asset', title: `${model.model} - 待交车` })}> + 待交车 + {model.pending} +
+
+ {['嘉兴', '广东', '北京', '新疆', '其他'].map(reg => ( +
+
{reg === '嘉兴' ? '浙' : reg === '广东' ? '粤' : reg === '北京' ? '京' : reg === '新疆' ? '新' : '其'}
+ {model.inventoryRegions[reg] > 0 ? ( + + ) : ( +
-
+ )}
+ ))} +
+
+
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Delivered', source: 'asset', title: `${model.model} - 本周交车` })}> + 本周已交车 + {model.weeklyDelivered} +
+
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Returned', source: 'asset', title: `${model.model} - 本周还车` })}> + 已还车 + {model.weeklyReturned} +
+
setShowPlateNumbers({ batch: 'All', model: model.model, location: 'All', category: 'Replaced', source: 'asset', title: `${model.model} - 本周替换` })}> + 已替换 + {model.weeklyReplaced}
- )} -
- ))} - - )} - -
- ))} +
+ )} +
+ ))} + + )} + +
+ ))}
@@ -1501,34 +1300,26 @@ export default function App() { )} {activeTab === 'department' && ( - /* Department Operations Statistics */
-
-
-
-
-

部门运营统计

-

实时更新部门运营核心指标

-
-
-
-
{/* Overall Total Summary (Compact) - Moved to Top */}
-
- 总资产 +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', source: 'department', title: '部门运营统计' })}> + 总运营车辆 {deptData.reduce((s, d) => s + d.totalAssets, 0)}
-
- 运营中 +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Operating', source: 'department', title: '部门运营统计 - 出勤车辆' })}> + 出勤车辆 {deptData.reduce((acc, d) => acc + d.operatingCount, 0)}
-
- 闲置中 +
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', category: 'Inventory', source: 'department', title: '部门运营统计 - 闲置车辆' })}> + 闲置车辆 {deptData.reduce((acc, d) => acc + d.idleCount, 0)} @@ -1555,7 +1346,7 @@ export default function App() { onClick={() => setDeptViewMode('manager')} className={`px-4 py-1.5 text-xs font-bold rounded-md transition-all ${deptViewMode === 'manager' ? 'bg-white text-blue-600 shadow-sm' : 'text-gray-500 hover:text-gray-700'}`} > - 按业务负责人 + 按业务员
@@ -1592,10 +1383,9 @@ export default function App() { {deptViewMode === 'department' ? '出勤率' : '合计资产'} {deptViewMode === 'department' && ( <> - 资产总数 - 日均里程 - 运营中 - 闲置中 + 总运营车辆 + 出勤车辆 + 闲置车辆 )} {deptViewMode === 'manager' && ( @@ -1632,19 +1422,37 @@ export default function App() { - {dept.totalAssets} - - -
- {dept.avgMileage} - km -
+ - {dept.operatingCount} + - {dept.idleCount} + {isExpanded ? : } @@ -1652,7 +1460,7 @@ export default function App() { {isExpanded && ( - +
{dept.managers.map(m => { const isManagerExpanded = expandedManagerDetails.has(m.manager); @@ -1669,7 +1477,7 @@ export default function App() {
-
+
@@ -2158,14 +1969,6 @@ export default function App() {
-
- -
)} @@ -2199,9 +2002,9 @@ export default function App() { {r.region}区域 - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating' }); }}>{r.totalAssets} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating' }); }}>{r.operatingCount} - { e.stopPropagation(); if (r.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending' }); }}>{r.pendingCount || ''} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, source: 'region', title: `区域运营统计 - ${r.region}` }); }}>{r.totalAssets} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating', source: 'region', title: `区域运营统计 - ${r.region} - 正在运营` }); }}>{r.operatingCount} + { e.stopPropagation(); if (r.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending', source: 'region', title: `区域运营统计 - ${r.region} - 待交车` }); }}>{r.pendingCount || ''} {r.customers.slice(0, 2).join(', ')} {isExpanded && r.cities.map((city) => { @@ -2218,9 +2021,9 @@ export default function App() { {city.city} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Operating' }); }}>{city.totalAssets} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Operating' }); }}>{city.operatingCount} - { e.stopPropagation(); if (city.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Pending' }); }}>{city.pendingCount || ''} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, source: 'region', title: `区域运营统计 - ${city.city}` }); }}>{city.totalAssets} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Operating', source: 'region', title: `区域运营统计 - ${city.city} - 正在运营` }); }}>{city.operatingCount} + { e.stopPropagation(); if (city.pendingCount) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, category: 'Pending', source: 'region', title: `区域运营统计 - ${city.city} - 待交车` }); }}>{city.pendingCount || ''} {city.customers.slice(0, 2).join(', ')} {isCityExpanded && city.typeBreakdown.map(tb => ( @@ -2229,9 +2032,9 @@ export default function App() {
{tb.type} 车型 - setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating' })}>{tb.total} - setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating' })}>{tb.operating} - { if (tb.inventory) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Pending' }); }}>{tb.inventory || ''} + setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type}` })}>{tb.total} + setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Operating', source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type} - 正在运营` })}>{tb.operating} + { if (tb.inventory) setShowPlateNumbers({ batch: 'All', model: 'All', location: city.city, vehicleType: tb.type, category: 'Inventory', source: 'region', title: `区域运营统计 - ${city.city} - ${tb.type} - 库存` }); }}>{tb.inventory || ''} {tb.customers.slice(0, 2).join(', ')} ))} @@ -2267,14 +2070,14 @@ export default function App() {
setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating', source: 'asset' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Operating', source: 'region', title: `区域运营统计 - ${r.region} - 正在运营` })} >
运营中
{r.operatingCount}
setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending', source: 'asset' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, category: 'Pending', source: 'region', title: `区域运营统计 - ${r.region} - 待交车` })} >
待交车
{r.pendingCount || ''}
@@ -2287,13 +2090,13 @@ export default function App() {
setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Operating', source: 'asset' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Operating', source: 'region', title: `区域运营统计 - ${r.region} - ${tb.type} - 正在运营` })} > 运:{tb.operating} setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Pending', source: 'asset' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: r.region, vehicleType: tb.type, category: 'Inventory', source: 'region', title: `区域运营统计 - ${r.region} - ${tb.type} - 库存` })} > 待:{tb.inventory || ''} @@ -2542,14 +2345,6 @@ export default function App() {
-
- -
)} @@ -2594,13 +2389,13 @@ export default function App() { {cust.region} {cust.manager} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', source: 'customer' }); }}>{cust.t4_5} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', source: 'customer' }); }}>{cust.t4_5c} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '18T', source: 'customer' }); }}>{cust.t18} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '49T', source: 'customer' }); }}>{cust.t49} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer' }); }}>{cust.trailer} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer' }); }}>{cust.other} - { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, source: 'customer' }); }}>{cust.total} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', isColdChain: false, source: 'customer', title: `客户运营统计 - ${cust.customer} - 4.5T` }); }}>{cust.t4_5} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', isColdChain: true, source: 'customer', title: `客户运营统计 - ${cust.customer} - 4.5T冷链` }); }}>{cust.t4_5c} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '18T', source: 'customer', title: `客户运营统计 - ${cust.customer} - 18T` }); }}>{cust.t18} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '49T', source: 'customer', title: `客户运营统计 - ${cust.customer} - 49T` }); }}>{cust.t49} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer', title: `客户运营统计 - ${cust.customer} - 挂车` }); }}>{cust.trailer} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer', title: `客户运营统计 - ${cust.customer} - 其他` }); }}>{cust.other} + { e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, source: 'customer', title: `客户运营统计 - ${cust.customer}` }); }}>{cust.total} {isExpanded && ( @@ -2656,7 +2451,10 @@ export default function App() { {cust.region}区域
-
+
{ e.stopPropagation(); setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, source: 'customer', title: `客户运营统计 - ${cust.customer}` }); }} + > 合计: {cust.total}
@@ -2690,44 +2488,44 @@ export default function App() {
车型分布
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', isColdChain: false, source: 'customer', title: `客户运营统计 - ${cust.customer} - 4.5T` })} >
4.5T
{cust.t4_5}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '4.5T', isColdChain: true, source: 'customer', title: `客户运营统计 - ${cust.customer} - 4.5T冷链` })} >
冷链
{cust.t4_5c}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '18T', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '18T', source: 'customer', title: `客户运营统计 - ${cust.customer} - 18T` })} >
18T
{cust.t18}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '49T', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '49T', source: 'customer', title: `客户运营统计 - ${cust.customer} - 49T` })} >
49T
{cust.t49}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer', title: `客户运营统计 - ${cust.customer} - 挂车` })} >
挂车
{cust.trailer}
-
setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer' })} + onClick={() => setShowPlateNumbers({ batch: 'All', model: 'All', location: 'All', customer: cust.customer, type: '其他车型', source: 'customer', title: `客户运营统计 - ${cust.customer} - 其他` })} >
其他
{cust.other}
@@ -2753,7 +2551,7 @@ export default function App() {
@@ -2913,7 +2711,7 @@ export default function App() {
- + @@ -2931,13 +2729,11 @@ export default function App() {
车牌 客户名称 日期
) : ( -
- - - - {showPlateNumbers.source === 'customer' ? ( - <> - +
+
+ + + @@ -2951,31 +2747,17 @@ export default function App() { - - ) : ( - <> - - {showPlateNumbers.source !== 'asset' && ( - - )} - - - - - )} {filteredModalVehicles.map((v, idx) => ( - - {showPlateNumbers.source === 'customer' ? ( - <> - + + - + - - - ) : ( - <> - - {showPlateNumbers.source !== 'asset' && ( - - )} - - - - - )} + ))} {filteredModalVehicles.length === 0 && ( - diff --git a/src/api.ts b/src/api.ts index 4452a5e..4617962 100644 --- a/src/api.ts +++ b/src/api.ts @@ -35,6 +35,7 @@ export async function fetchVehicleList(params: { customer?: string; isColdChain?: string; isTrailer?: string; + department?: string; }): Promise { const query = new URLSearchParams(); if (params.batch) query.set('batch', params.batch); @@ -47,6 +48,7 @@ export async function fetchVehicleList(params: { if (params.customer) query.set('customer', params.customer); if (params.isColdChain) query.set('isColdChain', params.isColdChain); if (params.isTrailer) query.set('isTrailer', params.isTrailer); + if (params.department) query.set('department', params.department); return fetchJson(`${BASE}/list?${query.toString()}`); } diff --git a/src/server/routes/vehicles.ts b/src/server/routes/vehicles.ts index 61e92f8..b6858d2 100644 --- a/src/server/routes/vehicles.ts +++ b/src/server/routes/vehicles.ts @@ -857,7 +857,7 @@ const VEHICLE_TYPE_FILTERS: Record boolean> = { // GET /api/vehicles/list — flat list with optional filters app.get('/list', async (c) => { const vehicles = await getVehicles(); - const { batch, model, location, status, category, vehicleType, manager, customer, isColdChain, isTrailer } = c.req.query(); + const { batch, model, location, status, category, vehicleType, manager, customer, isColdChain, isTrailer, department } = c.req.query(); let filtered = vehicles; if (vehicleType) { @@ -902,6 +902,9 @@ app.get('/list', async (c) => { if (customer) { filtered = filtered.filter((v) => customer === '未分配客户' ? !v.customerName : v.customerName === customer); } + if (department) { + filtered = filtered.filter((v) => v.departmentName === department); + } if (isColdChain !== undefined) { const wantCold = isColdChain === 'true'; filtered = filtered.filter((v) => wantCold ? v.model.includes('冷链') : !v.model.includes('冷链'));
业务部门 业务负责人 品牌运营区域 离到期 签约公司车牌客户名称品牌车型所在地
{'—'}
{v.contractNo || '—'} {v.departmentName || '—'} {v.customerManager || '—'} {v.brandLabel || '—'} {v.type}{v.subjectOrg || '—'}{v.subjectOrg || '—'} {v.customerName || '—'} {v.plateNumber || v.vin || '—'} @@ -2990,24 +2772,12 @@ export default function App() { {'—'} {v.location} {'—'}{v.orgName || '—'}{v.plateNumber || v.vin || '—'}{v.customerName || '—'}{v.brandLabel || '—'}{v.type}{v.location}{v.orgName || '—'}
+ 暂无符合条件的车辆数据