feat: add AI tree CRUD recipe
This commit is contained in:
@@ -51,10 +51,31 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||||
--field NAME:名称:string:100:true \
|
||||
--field CODE:编码:string:64:true \
|
||||
--field ENABLED:启用:boolean::false \
|
||||
--page-recipe maintenance-crud-v1 \
|
||||
--max-repair-attempts 2 \
|
||||
--output target/ai-runs/customer-level.json
|
||||
```
|
||||
|
||||
树形维护页使用 `tree-crud-v1`。如果字段列表没有显式提供 `PARENTID`,生成器会自动补一个父级字段,
|
||||
页面使用 `/api/entity/{table}/tree?parentKey=PARENTID&idKey={table}_ID&perPage=2000`
|
||||
作为树数据接口,并把 `PARENTID` 从树列表列中隐藏:
|
||||
|
||||
```bash
|
||||
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||||
--base-url http://localhost:8093 \
|
||||
--objective "新增组织分类树形维护功能" \
|
||||
--feature-name "组织分类维护" \
|
||||
--table-name EIP4AI_ORG_CATEGORY \
|
||||
--entity-name "组织分类" \
|
||||
--template-id eip4ai-org-category \
|
||||
--menu-name "组织分类维护" \
|
||||
--field NAME:名称:string:100:true \
|
||||
--field CODE:编码:string:64:true \
|
||||
--page-recipe tree-crud-v1 \
|
||||
--max-repair-attempts 2 \
|
||||
--output target/ai-runs/org-category-tree.json
|
||||
```
|
||||
|
||||
本地门禁通过后,可以把最终变更包封装成功能包快照,并保存一个里程碑 revision:
|
||||
|
||||
```bash
|
||||
@@ -88,6 +109,7 @@ curl -X POST http://localhost:8093/api/ai/features/auto-develop \
|
||||
"entityName": "客户等级",
|
||||
"templateId": "eip4ai-customer-level",
|
||||
"menuName": "客户等级维护",
|
||||
"pageRecipe": "maintenance-crud-v1",
|
||||
"fields": [
|
||||
{"column": "NAME", "label": "名称", "type": "string", "length": 100, "required": true},
|
||||
{"column": "CODE", "label": "编码", "type": "string", "length": 64, "required": true},
|
||||
@@ -105,6 +127,7 @@ curl -X POST http://localhost:8093/api/ai/features/auto-develop \
|
||||
2. 读取 `/api/ai/page-recipes` 中的 EIP4 页面 recipe,确认当前页面类型的 UI/UE 约束。
|
||||
3. 生成 `ENTITY`、`PAGE_SCHEMA`、`SERVICEFLOW`、`MENU`、`TEST` 草稿。`PAGE_SCHEMA`
|
||||
先生成 EIP4 PageBlueprint,再由平台编译器输出 amis schema;草稿 metadata 保留 blueprint 证据。
|
||||
未指定 `feature.pageRecipe` 时默认使用 `maintenance-crud-v1`;树形维护页应指定 `tree-crud-v1`。
|
||||
4. 对草稿执行基础门禁,包括 page-recipe、amis schema、typed page schema、服务流 XML、实体字段和 smoke 计划。
|
||||
5. 生成待人审 `AiChangeSet`。
|
||||
6. 生成 release plan。
|
||||
|
||||
@@ -18,6 +18,7 @@ EIP4 的 AI Agent 不直接自由生成 amis JSON。Agent 应先生成 EIP4 Page
|
||||
- `platform-metadata/src/main/java/com/eip4/platform/metadata/schema/blueprint/PageRecipeRegistry.java`
|
||||
- `platform-metadata/src/main/java/com/eip4/platform/metadata/schema/blueprint/PageRecipeValidator.java`
|
||||
- `platform-ai/src/main/resources/ai/page-recipes/maintenance-crud-v1.yaml`
|
||||
- `platform-ai/src/main/resources/ai/page-recipes/tree-crud-v1.yaml`
|
||||
|
||||
AI 可查询入口:
|
||||
|
||||
@@ -50,7 +51,7 @@ AI 自动开发链路中的 `PAGE_SCHEMA` 草稿仍然保存编译后的 amis sc
|
||||
标准输出结构:
|
||||
|
||||
- 顶层 `type=page`
|
||||
- `body[0]` 为 `crud`
|
||||
- `body` 为 `crud`
|
||||
- `crud.name` 固定为 `{lowerCamel(tableName)}Crud`
|
||||
- `crud.syncLocation=false`
|
||||
- 列表 API 固定为 `/api/entity/{table}/list?page=${page}&perPage=${perPage}`
|
||||
@@ -64,6 +65,29 @@ AI 自动开发链路中的 `PAGE_SCHEMA` 草稿仍然保存编译后的 amis sc
|
||||
- 页大小默认 `20`
|
||||
- `footerToolbar` 固定包含 `statistics` 和 `pagination`
|
||||
|
||||
## Recipe: tree-crud-v1
|
||||
|
||||
适用范围:
|
||||
|
||||
- 自引用层级实体维护页
|
||||
- 实体必须包含 `PARENTID` 字段
|
||||
- 覆盖树形列表、新增顶级节点、加子节点、编辑、删除
|
||||
|
||||
标准输出结构:
|
||||
|
||||
- 顶层 `type=page`
|
||||
- `body` 为 `crud`
|
||||
- `crud.name` 固定为 `{lowerCamel(tableName)}TreeCrud`
|
||||
- `crud.childrenColumnName=children`
|
||||
- 列表 API 固定为 `/api/entity/{table}/tree?parentKey=PARENTID&idKey={primaryKey}&perPage=2000`
|
||||
- 新增顶级按钮位于 `headerToolbar[0]`
|
||||
- 新增顶级按钮使用 `level=primary`、`icon=fa fa-plus`、`actionType=dialog`
|
||||
- 操作列按钮顺序固定为:加子项、编辑、删除
|
||||
- 加子项表单必须隐藏写入 `PARENTID=${primaryKey}`
|
||||
- 编辑表单必须保留隐藏主键和 `PARENTID`
|
||||
- 删除按钮使用 `className=text-danger`、`actionType=ajax`、`confirmText`
|
||||
- 树数据端点返回 `data.items` 层级数组,每个节点的子节点字段为 `children`
|
||||
|
||||
字段映射:
|
||||
|
||||
- `string` -> `input-text`
|
||||
@@ -78,7 +102,6 @@ AI 自动开发链路中的 `PAGE_SCHEMA` 草稿仍然保存编译后的 amis sc
|
||||
本阶段只解决“AI 生成维护类 CRUD 页时走受控 recipe”。还未覆盖:
|
||||
|
||||
- 主子表页面
|
||||
- 树表页面
|
||||
- 审批办理页面
|
||||
- 看板、日历、图表、报表页
|
||||
- 复杂字段分组
|
||||
@@ -97,7 +120,7 @@ AI 自动开发链路中的 `PAGE_SCHEMA` 草稿仍然保存编译后的 amis sc
|
||||
|
||||
## 后续演进
|
||||
|
||||
1. 增加 `master-detail-v1`、`tree-crud-v1`、`approval-task-v1` recipe。
|
||||
1. 增加 `master-detail-v1`、`approval-task-v1` recipe。
|
||||
2. 让设计器 overlay 保存也能记录对应 blueprint 或 template 来源。
|
||||
3. 在功能包中导出 blueprint,线上部署包继续导出编译后的 amis schema。
|
||||
4. Playwright E2E 从 recipe 反推出应验证的 UI 行为。
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
- 页面 templateId
|
||||
- 菜单名称
|
||||
- 字段列表
|
||||
- 页面配方,可省略。默认 `maintenance-crud-v1`;树形维护页使用 `tree-crud-v1`
|
||||
|
||||
字段格式:
|
||||
|
||||
@@ -46,10 +47,29 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||||
--field NAME:名称:string:100:true \
|
||||
--field CODE:编码:string:64:true \
|
||||
--field ENABLED:启用:boolean::false \
|
||||
--page-recipe maintenance-crud-v1 \
|
||||
--max-repair-attempts 2 \
|
||||
--output target/ai-runs/customer-level.json
|
||||
```
|
||||
|
||||
树形维护页示例:
|
||||
|
||||
```bash
|
||||
java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||||
--base-url http://localhost:8084 \
|
||||
--objective "新增组织分类树形维护功能" \
|
||||
--feature-name "组织分类维护" \
|
||||
--table-name EIP4AI_ORG_CATEGORY \
|
||||
--entity-name "组织分类" \
|
||||
--template-id eip4ai-org-category \
|
||||
--menu-name "组织分类维护" \
|
||||
--field NAME:名称:string:100:true \
|
||||
--field CODE:编码:string:64:true \
|
||||
--page-recipe tree-crud-v1 \
|
||||
--max-repair-attempts 2 \
|
||||
--output target/ai-runs/org-category-tree.json
|
||||
```
|
||||
|
||||
## 通过标准
|
||||
|
||||
- `applyStatus` 为 `PASSED`。
|
||||
@@ -57,6 +77,7 @@ java -jar platform-cli/target/platform-cli-0.1.0-SNAPSHOT.jar ai auto-develop \
|
||||
- 最终状态为 `READY_FOR_HUMAN_REVIEW`。
|
||||
- 部署包存在且 `requiresHumanApproval=true`。
|
||||
- 页面 schema 只能使用组件能力表中注册的组件和动作。
|
||||
- `PAGE_SCHEMA` 草稿必须声明并通过 `page-recipe` 门禁;普通维护页为 `maintenance-crud-v1`,树形维护页为 `tree-crud-v1`。
|
||||
|
||||
## 页面 schema 校验
|
||||
|
||||
|
||||
Reference in New Issue
Block a user