From 37223d2afb3dc75cdfa7be3b9dd1ca06c8b6f6a7 Mon Sep 17 00:00:00 2001 From: Hermes CI Fix Date: Wed, 26 Aug 2026 09:52:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=91=E7=9A=84=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8F=B0'=E6=88=91=E7=9A=84=E6=94=B9=E5=96=84=E8=A1=8C?= =?UTF-8?q?=E5=8A=A8'=E7=A9=BA=E7=99=BD=20=E2=80=94=20CEO/=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E8=A7=92=E8=89=B2=E6=9F=A5=E7=9C=8B=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E8=A1=8C=E5=8A=A8=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: my-dashboard的action_plans按assignee==username/name过滤 数据库18条行动方案assignee全是部门/角色(财务部/采购部王经理等) admin(管理员)无分配 → 显示0条'暂无待办' 修复: CEO/管理员角色(role=ceo)查看全部行动方案, 其他角色仍按assignee过滤 验证: 18条行动方案+6条待办提醒(含2条逾期+红色KPI预警) --- backend/app/api/dashboard.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/app/api/dashboard.py b/backend/app/api/dashboard.py index cdbfdd7f..af4cc25e 100644 --- a/backend/app/api/dashboard.py +++ b/backend/app/api/dashboard.py @@ -471,14 +471,18 @@ def my_dashboard( "period": latest_v.period if latest_v else None, }) - # 2. 我的改善行动(assignee匹配) + # 2. 我的改善行动(assignee匹配;CEO/管理员看全部) from app.models import ActionPlan - my_plans = db.query(ActionPlan).filter( - or_( - ActionPlan.assignee == username, - ActionPlan.assignee == name, - ) - ).order_by(ActionPlan.updated_at.desc()).all() + if current_user.role == "ceo": + # CEO/管理员查看全部行动方案(2026-08-26修复: 原逻辑只按assignee过滤导致工作台显示空) + my_plans = db.query(ActionPlan).order_by(ActionPlan.updated_at.desc()).all() + else: + my_plans = db.query(ActionPlan).filter( + or_( + ActionPlan.assignee == username, + ActionPlan.assignee == name, + ) + ).order_by(ActionPlan.updated_at.desc()).all() plan_list = [] for p in my_plans: