diff --git a/app/static/portal/employee-risk/dashboard/dashboard.js b/app/static/portal/employee-risk/dashboard/dashboard.js index 00031a6..2c558b8 100644 --- a/app/static/portal/employee-risk/dashboard/dashboard.js +++ b/app/static/portal/employee-risk/dashboard/dashboard.js @@ -236,7 +236,7 @@ if (requireRiskStaff()) { document.querySelector(`[data-${kind}-prev]`).disabled = current.page === 0; document.querySelector(`[data-${kind}-next]`).disabled = !current.next; const total = Number(meta.total ?? 0); - const pageSize = Number(meta.page_size ?? (kind === 'alert' ? 5 : 10)); + const pageSize = Number(meta.page_size ?? 10); const totalPages = total > 0 && pageSize > 0 ? Math.ceil(total / pageSize) : 0; document.querySelector(`[data-${kind}-summary]`).textContent = total > 0 ? `第 ${current.page + 1} / ${totalPages} 页,共 ${total} 条` @@ -247,7 +247,7 @@ if (requireRiskStaff()) { renderLoading(alertTable, 4); document.querySelector('[data-alert-summary]').textContent = '正在加载'; try { - const response = await apiClient.get('RK002', { query: { ...state.alert.filters, cursor: state.alert.cursors[state.alert.page], limit: 5 } }); + const response = await apiClient.get('RK002', { query: { ...state.alert.filters, cursor: state.alert.cursors[state.alert.page], limit: 10 } }); const items = Array.isArray(response.data) ? response.data : []; if (!items.length) renderEmpty(alertTable, '暂无预警', '当前筛选条件下没有风险预警。'); else { diff --git a/tests/unit/api/test_portal_frontend.py b/tests/unit/api/test_portal_frontend.py index 7fda51f..1f68411 100644 --- a/tests/unit/api/test_portal_frontend.py +++ b/tests/unit/api/test_portal_frontend.py @@ -296,6 +296,14 @@ def test_risk_tables_show_page_and_total_summary() -> None: assert "共 ${total} 条" in source +def test_risk_alert_queue_uses_ten_rows_per_page() -> None: + source = ( + PORTAL / "employee-risk" / "dashboard" / "dashboard.js" + ).read_text(encoding="utf-8") + assert "limit: 10" in source + assert "meta.page_size ?? 10" in source + + def test_risk_alert_prompts_hide_until_alert_context_is_bound() -> None: html = (PORTAL / "employee-risk" / "dashboard" / "index.html").read_text(encoding="utf-8") css = (PORTAL / "employee-risk" / "dashboard" / "dashboard.css").read_text(encoding="utf-8")