diff --git a/backend/app/services/hr_leave_sqlserver.py b/backend/app/services/hr_leave_sqlserver.py index 66a6462a..464c863b 100644 --- a/backend/app/services/hr_leave_sqlserver.py +++ b/backend/app/services/hr_leave_sqlserver.py @@ -210,12 +210,12 @@ WHERE c002001 = ? return str(datetime.now().year) @classmethod - def _render_table_row(cls, index: int, title: str, record: dict | None, requested_year: int | None) -> str: + def _render_table_row(cls, index: int, title: str, record: dict | None, requested_year: int | None, quota_unit: str = "天") -> str: response_year = cls._resolve_response_year(record, requested_year) if not record: return f"| {index} | {title} | {response_year} | 暂无数据 | 暂无数据 | 暂无数据 |" - total = cls._format_quota(record.get('total_hours')) - used = cls._format_quota(record.get('used_hours')) + total = cls._format_quota(record.get('total_hours'), quota_unit) + used = cls._format_quota(record.get('used_hours'), quota_unit) remaining = cls._format_quota(record.get('remaining_hours'), "小时") return f"| {index} | {title} | {response_year} | {total} | {used} | {remaining} |" @@ -249,7 +249,7 @@ WHERE c002001 = ? sections.append(cls._render_table_row(index, "年假", annual_record, requested_year)) index += 1 if leave_type in ("childcare", "all"): - sections.append(cls._render_table_row(index, "育儿假", childcare_record, requested_year)) + sections.append(cls._render_table_row(index, "育儿假", childcare_record, requested_year, "小时")) index += 1 sections.extend(