fix: 区域统计客户筛选生效,后端region-stats支持过滤参数
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

- 后端/region-stats新增customer/city/region查询参数
- 前端regionFilters变化时重新请求后端数据
- 移除前端冗余过滤逻辑,由后端统一处理

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-03-29 00:42:59 +08:00
parent 1d19bb07a7
commit 16f5ef8741
3 changed files with 27 additions and 6 deletions

View File

@@ -724,7 +724,11 @@ app.get('/dept-stats', async (c) => {
// GET /api/vehicles/region-stats — macro-region with city drill-down
app.get('/region-stats', async (c) => {
const vehicles = await getVehicles();
const operating = vehicles.filter((v) => v.status === 'Operating' || v.status === 'Pending');
const { customer, city: filterCity, region: filterRegion } = c.req.query();
let operating = vehicles.filter((v) => v.status === 'Operating' || v.status === 'Pending');
if (customer) operating = operating.filter((v) => v.customerName === customer);
if (filterCity) operating = operating.filter((v) => resolveCity(v.city, v.province) === filterCity);
if (filterRegion) operating = operating.filter((v) => mapMacroRegion(v.province, v.city) === filterRegion);
const regionCityMap = new Map<string, Map<string, Vehicle[]>>();
for (const v of operating) {