fix(assets): correct modal filtering for 待交车/库存-其他/本周X
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
三个弹窗筛选问题一起修: 1. 待交车 drill-in:Pending 原本错归入 weekly-detail(该接口不支持 model/batch/location 过滤),改走 /list 并给 /list 的 category 分支 补上 'Pending' 状态匹配。 2. 库存-其他:'其他' 同时存在于两个体系——资产表的"库存-其他" (mapRegion 结果) vs 区域统计的"其他"(mapMacroRegion 结果), 过滤语义完全不同。引入 source 参数由前端传递,source==='asset' 时按 v.location 匹配(库存语义),否则按 mapMacroRegion(宏观区域)。 抽取 filterByLocation 辅助函数供 /list 与 /weekly-detail 共用。 3. 本周交车/还车/替换:/weekly-detail 接口新增 model/batch/location/source 过滤;前端 fetchWeeklyDetail 签名扩容。实现方式:SQL 结果与缓存 车辆集(按过滤条件筛)按 truck_id 取交集。 4. BIGINT 精度丢失:DELIVERED_SQL / RETURNED_SQL / REPLACED_SQL 及 pending/new 子查询原本使用裸 truck.id,mysql2 驱动把 BIGINT 当 JS Number 返回,大 id (>2^53) 尾部被截,导致 truck_id 交集永远 为空。全部改为 CAST(truck.id AS CHAR),与 MAIN_SQL 保持一致。 5. fetchVehicleList 类型补上 source,避免前端传的 source 被 URLSearchParams 构造时静默丢弃。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,7 @@ export async function fetchVehicleList(params: {
|
||||
department?: string;
|
||||
attendance?: string;
|
||||
subject?: string | null;
|
||||
source?: string;
|
||||
}): Promise<VehicleListItem[]> {
|
||||
const query = new URLSearchParams();
|
||||
if (params.batch) query.set('batch', params.batch);
|
||||
@@ -65,6 +66,7 @@ export async function fetchVehicleList(params: {
|
||||
if (params.department) query.set('department', params.department);
|
||||
if (params.attendance) query.set('attendance', params.attendance);
|
||||
if (params.subject) query.set('subject', params.subject);
|
||||
if (params.source) query.set('source', params.source);
|
||||
return fetchJson<VehicleListItem[]>(`${BASE}/list?${query.toString()}`);
|
||||
}
|
||||
|
||||
@@ -112,6 +114,14 @@ export async function fetchRegionChart(
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchWeeklyDetail(type: string): Promise<WeeklyDetailItem[]> {
|
||||
return fetchJson<WeeklyDetailItem[]>(`${BASE}/weekly-detail?type=${type}`);
|
||||
export async function fetchWeeklyDetail(
|
||||
type: string,
|
||||
filters?: { model?: string; batch?: string; location?: string; source?: string },
|
||||
): Promise<WeeklyDetailItem[]> {
|
||||
const params = new URLSearchParams({ type });
|
||||
if (filters?.model && filters.model !== 'All') params.set('model', filters.model);
|
||||
if (filters?.batch && filters.batch !== 'All') params.set('batch', filters.batch);
|
||||
if (filters?.location && filters.location !== 'All') params.set('location', filters.location);
|
||||
if (filters?.source) params.set('source', filters.source);
|
||||
return fetchJson<WeeklyDetailItem[]>(`${BASE}/weekly-detail?${params.toString()}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user