fix: 我的工作台'我的改善行动'空白 — CEO/管理员角色查看全部行动方案

根因: my-dashboard的action_plans按assignee==username/name过滤
  数据库18条行动方案assignee全是部门/角色(财务部/采购部王经理等)
  admin(管理员)无分配 → 显示0条'暂无待办'

修复: CEO/管理员角色(role=ceo)查看全部行动方案, 其他角色仍按assignee过滤
验证: 18条行动方案+6条待办提醒(含2条逾期+红色KPI预警)
This commit is contained in:
Hermes CI Fix
2026-08-26 09:52:11 +08:00
parent b9076e6818
commit 37223d2afb
+11 -7
View File
@@ -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: