2026-10-19 06:44:15 -04:00
|
|
|
|
"""岗位下拉选项(基础数据与报表筛选共用)。
|
|
|
|
|
|
|
|
|
|
|
|
岗位管理本身仅管理员可用(FR-006),但报表的「岗位」筛选对财务/领导
|
|
|
|
|
|
开放(FR-029)。为避免把管理接口整体放开,这里提供只读、登录即可的
|
|
|
|
|
|
启用岗位选项;写操作仍走 `/system/business-roles` 的管理员端点。
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from typing import Annotated
|
|
|
|
|
|
|
|
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
|
|
|
|
|
|
|
|
from app.api.deps import DbSession, get_current_user
|
|
|
|
|
|
from app.core.response import ApiResponse, ok
|
|
|
|
|
|
from app.models import User
|
2026-10-22 07:43:20 -04:00
|
|
|
|
from app.schemas.business_role import BusinessRoleOptionOut
|
|
|
|
|
|
from app.services import business_role_service
|
2026-10-19 06:44:15 -04:00
|
|
|
|
|
|
|
|
|
|
router = APIRouter(prefix="/business-roles", tags=["人员管理"])
|
|
|
|
|
|
|
|
|
|
|
|
# 基础数据是业务操作:登录即可,不要求管理员
|
|
|
|
|
|
CurrentUser = Annotated[User, Depends(get_current_user)]
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-10-22 07:43:20 -04:00
|
|
|
|
@router.get(
|
|
|
|
|
|
"/options",
|
|
|
|
|
|
response_model=ApiResponse[list[BusinessRoleOptionOut]],
|
|
|
|
|
|
summary="岗位下拉选项",
|
|
|
|
|
|
)
|
|
|
|
|
|
def list_options(session: DbSession, _: CurrentUser) -> ApiResponse[list[BusinessRoleOptionOut]]:
|
2026-10-19 06:44:15 -04:00
|
|
|
|
"""岗位选项(登录即可;含停用——人员档案可能仍引用停用岗位)。
|
|
|
|
|
|
|
2026-10-22 07:43:20 -04:00
|
|
|
|
岗位规模有限(内置 + 自定义),一次取全量,不做分页。
|
2026-10-19 06:44:15 -04:00
|
|
|
|
"""
|
2026-10-22 07:43:20 -04:00
|
|
|
|
return ok(business_role_service.list_options(session))
|