mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-21 04:46:26 +00:00
refactor: 统一状态字段类型为整型并清理冗余配置
1. 将多处字符串类型的状态值"0"统一改为整型0,包括查询条件、字段赋值和状态转换逻辑 2. 移除冗余的OPENAI_BASE_URL配置项及相关示例配置 3. 移动蓝色主题样式代码到variables.scss并删除冗余的theme-blue.scss文件
This commit is contained in:
@@ -109,7 +109,7 @@ class NoticeService:
|
||||
offset=0,
|
||||
limit=10,
|
||||
order_by=[{"id": "asc"}],
|
||||
search={"status": "0"},
|
||||
search={"status": 0},
|
||||
out_schema=NoticeOutSchema,
|
||||
)
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ class PositionService:
|
||||
# 复制数据并转换状态
|
||||
data = position_list.copy()
|
||||
for item in data:
|
||||
item["status"] = "启用" if item.get("status") == "0" else "停用"
|
||||
item["status"] = "启用" if item.get("status") == 0 else "停用"
|
||||
item["creator"] = (
|
||||
item.get("created_by", {}).get("name", "未知")
|
||||
if isinstance(item.get("created_by"), dict)
|
||||
|
||||
@@ -245,7 +245,7 @@ class RoleService:
|
||||
# 处理数据
|
||||
data = role_list.copy()
|
||||
for item in data:
|
||||
item["status"] = "启用" if item.get("status") == "0" else "停用"
|
||||
item["status"] = "启用" if item.get("status") == 0 else "停用"
|
||||
item["data_scope"] = data_scope_map.get(item.get("data_scope", 1), "")
|
||||
|
||||
return ExcelUtil.export_list2excel(list_data=data, mapping_dict=mapping_dict)
|
||||
|
||||
@@ -293,7 +293,7 @@ class UserService:
|
||||
if auth.user and auth.user.is_superuser:
|
||||
# 使用树形结构查询,预加载children关系(含 type=3 按钮,供前端权限列表使用)
|
||||
menu_all = await MenuCRUD(auth).get_tree_list(
|
||||
search={"type": ("in", [1, 2, 3, 4]), "status": "0", **_pc_only},
|
||||
search={"type": ("in", [1, 2, 3, 4]), "status": 0, **_pc_only},
|
||||
order_by=[{"order": "asc"}],
|
||||
)
|
||||
menus = [MenuOutSchema.model_validate(menu) for menu in menu_all]
|
||||
@@ -703,7 +703,7 @@ class UserService:
|
||||
# creator = {'id': 1, 'name': '管理员', 'username': 'admin'}
|
||||
data = user_list.copy()
|
||||
for item in data:
|
||||
item["status"] = "启用" if item.get("status") == "0" else "停用"
|
||||
item["status"] = "启用" if item.get("status") == 0 else "停用"
|
||||
gender = item.get("gender")
|
||||
item["gender"] = "男" if gender == "1" else ("女" if gender == "2" else "未知")
|
||||
item["is_superuser"] = "是" if item.get("is_superuser") else "否"
|
||||
|
||||
Reference in New Issue
Block a user