优化:日报卡片文本防溢出 — 高发设备改top1+6字截断,副标题限20字
This commit is contained in:
@@ -281,8 +281,8 @@ async def _build_daily_report_data() -> Optional[Dict]:
|
||||
"areas": _top_summary(area_counter),
|
||||
"cameras": _top_summary(camera_counter),
|
||||
"cleaning_types": _top_summary(cleaning_type_count, CLEANING_TYPE_NAMES),
|
||||
# 卡片专用:截断名称,只取 top2 防溢出
|
||||
"cameras_short": _top_summary(camera_counter, top_n=2, max_len=8),
|
||||
# 卡片专用:截断名称,只取 top1 防溢出
|
||||
"cameras_short": _top_summary(camera_counter, top_n=1, max_len=6),
|
||||
"alarm_types_short": _top_summary(alarm_type_count, ALARM_TYPE_NAMES, top_n=2),
|
||||
},
|
||||
"top_overdue": top_overdue,
|
||||
@@ -327,7 +327,10 @@ def _build_template_card(report: Dict) -> Dict:
|
||||
if s["backlog_count"] == 0:
|
||||
sub_title = "昨日工单全部清零,运营状态良好"
|
||||
elif report["top_overdue"]:
|
||||
sub_title = f"⚠ 需关注:{report['top_overdue'][0]}"
|
||||
overdue_text = report["top_overdue"][0]
|
||||
if len(overdue_text) > 20:
|
||||
overdue_text = overdue_text[:20] + "…"
|
||||
sub_title = f"⚠ 需关注:{overdue_text}"
|
||||
else:
|
||||
sub_title = f"当前 {s['backlog_count']} 条待处理"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user