fix: 修复仪表盘用户数统计和岗位筛选问题
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
1. 后端 admin.py: - 用户总数统计添加 is_deleted=False, is_active=True 过滤 - 现在只统计有效的活跃用户数 2. 前端 user-management.vue: - 岗位筛选从硬编码改为动态加载 positionOptions - 岗位列表从API获取,而不是写死的4个选项
This commit is contained in:
@@ -34,8 +34,11 @@ async def get_dashboard_stats(
|
||||
message="权限不足,需要管理员权限"
|
||||
)
|
||||
|
||||
# 用户统计
|
||||
total_users = await db.scalar(select(func.count(User.id)))
|
||||
# 用户统计 - 只统计未删除且活跃的用户
|
||||
total_users = await db.scalar(
|
||||
select(func.count(User.id))
|
||||
.where(User.is_deleted == False, User.is_active == True)
|
||||
)
|
||||
|
||||
# 计算最近30天的新增用户
|
||||
thirty_days_ago = datetime.now() - timedelta(days=30)
|
||||
|
||||
Reference in New Issue
Block a user