fix(production): list-by-work-orders 不再请求 pageSize 500
按当前页工单数发送合理 chunk(≤100),后端循环凑齐任务,避免 Network 中再出现 pageSize:500。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8370573edc
commit
426a884aa7
3 files changed
+6
-5
No files matched your search
@@ -2340,8 +2340,8 @@ async def list_production_tasks_by_work_orders(
|
||||
return success_response(
|
||||
{"list": [], "total": 0, "page": 1, "pageSize": body.page_size, "totalPages": 0}
|
||||
)
|
||||
# 当前页工单卡片需要这些工单下的全部任务;避免单页 pageSize 上限静默截断
|
||||
effective_page_size = min(max(body.page_size, len(wo_ids) * 100), 500)
|
||||
# pageSize 仅作翻页 chunk(默认/上限 100),不按工单数放大到 500;循环凑齐当前页全部任务
|
||||
chunk_size = min(max(int(body.page_size or 100), 1), 100)
|
||||
all_items = []
|
||||
total = 0
|
||||
page = 1
|
||||
@@ -2350,7 +2350,7 @@ async def list_production_tasks_by_work_orders(
|
||||
db,
|
||||
tenant_no=tenant_no,
|
||||
page=page,
|
||||
page_size=effective_page_size,
|
||||
page_size=chunk_size,
|
||||
work_order_ids=wo_ids,
|
||||
user_info=user,
|
||||
include_step_summary=body.include_step_summary,
|
||||
|
||||
@@ -42,7 +42,7 @@ class ProductionTaskListByWorkOrdersBody(BaseModel):
|
||||
|
||||
work_order_ids: List[str] = Field(..., alias="workOrderIds", min_length=1)
|
||||
include_step_summary: bool = Field(True, alias="includeStepSummary")
|
||||
page_size: int = Field(100, alias="pageSize", ge=1, le=500)
|
||||
page_size: int = Field(100, alias="pageSize", ge=1, le=100)
|
||||
|
||||
|
||||
class ProductionTaskUpdate(BaseModel):
|
||||
|
||||
@@ -62,7 +62,8 @@ export function fetchProductionTasksByWorkOrderIds(workOrderIds: string[]) {
|
||||
params: {
|
||||
workOrderIds: ids,
|
||||
includeStepSummary: true,
|
||||
pageSize: Math.min(500, ids.length * 100)
|
||||
// 仅作后端翻页 chunk;后端会循环凑齐当前页工单下全部任务,勿再放大到 500
|
||||
pageSize: Math.min(100, Math.max(10, ids.length * 10))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user