F1-5: 系统管理只读页面(amis schema + 后端端点)

新增 4 个系统管理只读页 amis JSON schema(admin-schemas/)及对应后端端点:
- AdminController: /api/admin/users(用户分页,密码不下发)、
  /api/admin/roles/{id}/users(角色成员)、
  /api/admin/menu-all(全量菜单树,管理视角)、
  /api/admin/filterrules(数据权限规则分页)
- 4 个 schema 以 sys-admin-* 为 template_id 入库 sys_page_schema,
  经既有 GET /api/page/schema/{id} 渲染链路下发(零前端改动)
- 幂等 upsert SQL(docs/sql/F1-5_sys_admin_schemas_upsert.sql),
  已在 eip4dev(eip3) 和 eip4m0(public) 两库执行
- AdminControllerTest 9 个单测全部通过;8094 临时实例实测所有端点 200

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 20:30:02 +08:00
parent 7a48a0ba29
commit 3c70e84de6
7 changed files with 859 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
{
"type": "page",
"title": "数据权限规则",
"body": [
{
"type": "crud",
"syncLocation": false,
"api": {
"method": "get",
"url": "/api/admin/filterrules?page=${page}&perPage=${perPage}&entityName=${entityName}",
"adaptor": "if(payload&&payload.data){return payload;}return {status:0,data:{items:payload.items||[],total:payload.total||0}};"
},
"headerToolbar": [
{
"type": "tpl",
"tpl": "共 ${total} 条规则",
"className": "v-middle"
},
"pagination"
],
"footerToolbar": ["statistics", "pagination"],
"perPage": 20,
"filter": {
"title": "查询条件",
"submitText": "查询",
"body": [
{
"type": "input-text",
"name": "entityName",
"label": "实体名",
"placeholder": "按实体名过滤",
"clearable": true
}
]
},
"columns": [
{
"name": "entityName",
"label": "实体名",
"sortable": false,
"width": 150
},
{
"name": "tableName",
"label": "表名",
"sortable": false,
"width": 180
},
{
"name": "roles",
"label": "关联角色",
"sortable": false,
"width": 200,
"type": "tpl",
"tpl": "<span title='${roles}'>${roles|truncate:60}</span>"
},
{
"name": "filterRule",
"label": "规则内容",
"sortable": false,
"type": "tpl",
"tpl": "<pre style='font-size:0.8em;max-height:80px;overflow:auto;white-space:pre-wrap;word-break:break-all'>${filterRule}</pre>"
}
]
}
]
}

View File

@@ -0,0 +1,52 @@
{
"type": "page",
"title": "菜单总览(管理视角)",
"body": [
{
"type": "service",
"api": {
"method": "get",
"url": "/api/admin/menu-all"
},
"body": [
{
"type": "each",
"name": "roots",
"className": "mb-4",
"items": {
"type": "panel",
"title": "${name}",
"body": {
"type": "table",
"source": "${children}",
"columns": [
{
"name": "name",
"label": "目录/菜单名"
},
{
"name": "templateId",
"label": "模板 ID",
"type": "tpl",
"tpl": "<span class='text-muted' style='font-size:0.85em'>${templateId}</span>"
},
{
"name": "typename",
"label": "类型"
},
{
"name": "seq",
"label": "排序"
},
{
"name": "childCount",
"label": "子菜单数"
}
]
}
}
}
]
}
]
}

View File

@@ -0,0 +1,82 @@
{
"type": "page",
"title": "角色与成员",
"body": [
{
"type": "crud",
"syncLocation": false,
"api": {
"method": "get",
"url": "/api/org/roles",
"adaptor": "var d=payload.data||{};return {status:0,data:{items:d.items||[],total:d.total||0}};"
},
"headerToolbar": [
{
"type": "tpl",
"tpl": "共 ${total} 条角色",
"className": "v-middle"
}
],
"footerToolbar": ["statistics", "pagination"],
"perPage": 20,
"columns": [
{
"name": "name",
"label": "角色名称",
"sortable": false
},
{
"name": "description",
"label": "描述",
"sortable": false
},
{
"name": "roleType",
"label": "类型",
"type": "mapping",
"map": {
"1": "功能角色",
"2": "数据角色",
"*": "其他"
}
},
{
"type": "operation",
"label": "成员",
"buttons": [
{
"type": "button",
"label": "查看成员",
"level": "link",
"actionType": "dialog",
"dialog": {
"title": "角色「${name}」成员列表",
"size": "lg",
"body": {
"type": "service",
"api": {
"method": "get",
"url": "/api/admin/roles/${id}/users",
"adaptor": "var d=payload.data||{};return {status:0,data:{items:d.items||[],total:d.total||0}};"
},
"body": {
"type": "table",
"source": "${items}",
"columns": [
{"name": "account", "label": "账号"},
{"name": "userName", "label": "姓名"},
{"name": "state", "label": "激活状态", "type": "mapping", "map": {"1": "激活", "2": "停用", "3": "未激活", "*": "未知"}}
]
}
},
"actions": [
{"type": "button", "label": "关闭", "actionType": "close"}
]
}
}
]
}
]
}
]
}

View File

@@ -0,0 +1,66 @@
{
"type": "page",
"title": "用户查询",
"body": [
{
"type": "crud",
"syncLocation": false,
"api": {
"method": "get",
"url": "/api/admin/users?page=${page}&perPage=${perPage}&keyword=${keyword}",
"adaptor": "if(payload&&payload.data){return payload;}return {status:0,data:{items:payload.items||[],total:payload.total||0}};"
},
"headerToolbar": [
{
"type": "tpl",
"tpl": "共 ${total} 条",
"className": "v-middle"
},
"pagination"
],
"footerToolbar": ["statistics", "pagination"],
"perPage": 20,
"filter": {
"title": "查询条件",
"submitText": "查询",
"body": [
{
"type": "input-text",
"name": "keyword",
"label": "账号/姓名",
"placeholder": "输入账号或姓名关键字",
"clearable": true
}
]
},
"columns": [
{
"name": "account",
"label": "账号",
"sortable": false
},
{
"name": "name",
"label": "姓名",
"sortable": false
},
{
"name": "departName",
"label": "部门",
"sortable": false
},
{
"name": "state",
"label": "激活状态",
"type": "mapping",
"map": {
"1": "<span class='label label-success'>激活</span>",
"2": "<span class='label label-warning'>停用</span>",
"3": "<span class='label label-default'>未激活</span>",
"*": "<span class='label label-default'>未知</span>"
}
}
]
}
]
}