feat(效能分析): 轨迹流转图时间轴支持工作日/自然天切换

- flow 接口加 mode 参数,workdays 模式把时间偏移换算为排除周末/节假日的工作小时
- 轨迹流转图的横轴随顶部按钮(自然天/工作日)切换,休息日被压缩
- 按钮切换自动重新请求 flow
This commit is contained in:
2026-08-28 15:34:17 +08:00
parent 7f1858387c
commit 4447a1f52d
4 changed files with 19 additions and 4 deletions

View File

@ -38,12 +38,13 @@ async def capability_profile(
async def flow_compare(
product_sns: str | None = Query(None, description="身份证,逗号分隔"),
spec_models: str | None = Query(None, description="规格型号,逗号分隔(无 product_sns 时按型号取最近设备)"),
mode: str = Query("natural", description="时间口径: natural(自然小时) / workdays(工作小时,排除周末节假日)"),
db: AsyncSession = Depends(get_db),
):
"""设备流转对比 — 每台设备各操作人耗时(堆叠柱状,按人堆叠,识别瓶颈)。"""
sns = [s.strip() for s in product_sns.split(",") if s.strip()] if product_sns else None
specs = [s.strip() for s in spec_models.split(",") if s.strip()] if spec_models else None
return await get_flow_compare(db, product_sns=sns, spec_models=specs)
return await get_flow_compare(db, product_sns=sns, spec_models=specs, mode=mode)
@router.get("/options", response_model=AnalyticsOptions)