feat(ai-recipe): align maintenance-crud-v1 to converter house-style
AI 生成的单表维护页与转换器基线产出存在「陌生感」:缺查询区、走自创
/api/entity REST 而非保真层服务流、动作放 per-row 操作列。本次对齐:
- crud.api → /api/flow/<TABLE>_SEARCH(amis 自动追 page/perPage,无 adaptor)
+ selectable/checkOnItemClick/primaryField
- 补 filter 查询区(string 列 → input-text 文本搜索)
- 新增/编辑/删除挂 headerToolbar 操作 selectedItems(带 id + disabledOn 守卫,
删掉 per-row 操作列);增改 inline 表单绑 _ADD/_UPDATE + reload,编辑用
dialog data:{"&":"${selectedItems[0]}"} 预填 + hidden 主键;删除
data={ids:"${selectedItems|pick:<PK>|join:','}"}(照搬基线,键为 ids)
- 连带:AiFeatureDraftGenerator.expectedPageApi + AiAgentService 的
render-plan 门禁改 recipe-aware(原硬编码 /api/entity + /list? 会让整条
pipeline 409)
证据:2727 转换页聚合 0 用 per-row operation 列 / 1976 headerToolbar /
1211 filter / 1277 _SEARCH。DefaultFlowHelper 流名吻合,AI pipeline 仅生成
list 页无独立表单页 → recipe 保持 inline 自包含。
验证:platform-metadata 397 + platform-ai 61 测试绿;8093 live 经 AI pipeline
重生成页 + 浏览器实证查询区/工具栏/选中守卫/flow 取数/编辑预填全绿,0 console error。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1016,14 +1016,19 @@ public class AiAgentService {
|
|||||||
if (crudName.isBlank()) {
|
if (crudName.isBlank()) {
|
||||||
messages.add("render expectedCrudName 不能为空");
|
messages.add("render expectedCrudName 不能为空");
|
||||||
}
|
}
|
||||||
if (!expectedApi.startsWith("/api/entity/")) {
|
// house-style 对齐:单表维护页列表走保真层服务流 _SEARCH(/api/flow),
|
||||||
messages.add("render expectedApi 必须指向 /api/entity/: " + expectedApi);
|
// 树页仍走 /api/entity 树接口。
|
||||||
}
|
if (PageBlueprint.RECIPE_TREE_CRUD.equals(recipe)) {
|
||||||
if (PageBlueprint.RECIPE_TREE_CRUD.equals(recipe) && !expectedApi.contains("/tree?")) {
|
if (!expectedApi.startsWith("/api/entity/") || !expectedApi.contains("/tree?")) {
|
||||||
messages.add("tree-crud-v1 render expectedApi 必须是树接口");
|
messages.add("tree-crud-v1 render expectedApi 必须是 /api/entity 树接口: " + expectedApi);
|
||||||
}
|
}
|
||||||
if (PageBlueprint.RECIPE_MAINTENANCE_CRUD.equals(recipe) && !expectedApi.contains("/list?")) {
|
} else if (PageBlueprint.RECIPE_MAINTENANCE_CRUD.equals(recipe)) {
|
||||||
messages.add("maintenance-crud-v1 render expectedApi 必须是列表接口");
|
if (!expectedApi.startsWith("/api/flow/") || !expectedApi.endsWith("_SEARCH")) {
|
||||||
|
messages.add("maintenance-crud-v1 render expectedApi 必须是 /api/flow 服务流 _SEARCH 接口: "
|
||||||
|
+ expectedApi);
|
||||||
|
}
|
||||||
|
} else if (!expectedApi.startsWith("/api/")) {
|
||||||
|
messages.add("render expectedApi 必须指向 /api/: " + expectedApi);
|
||||||
}
|
}
|
||||||
if (!components.isArray() || components.isEmpty()) {
|
if (!components.isArray() || components.isEmpty()) {
|
||||||
messages.add("render expectedComponents 至少需要 1 项");
|
messages.add("render expectedComponents 至少需要 1 项");
|
||||||
|
|||||||
@@ -222,7 +222,8 @@ public class AiFeatureDraftGenerator {
|
|||||||
return "/api/entity/" + spec.tableName()
|
return "/api/entity/" + spec.tableName()
|
||||||
+ "/tree?parentKey=PARENTID&idKey=" + spec.tableName() + "_ID&perPage=2000";
|
+ "/tree?parentKey=PARENTID&idKey=" + spec.tableName() + "_ID&perPage=2000";
|
||||||
}
|
}
|
||||||
return "/api/entity/" + spec.tableName() + "/list?page=${page}&perPage=${perPage}";
|
// 与 PageBlueprintCompiler.maintenanceCrud 的 house-style 对齐:列表走保真层 _SEARCH 服务流。
|
||||||
|
return "/api/flow/" + spec.tableName() + "_SEARCH";
|
||||||
}
|
}
|
||||||
|
|
||||||
private ObjectNode sampleEntityBody(FeatureSpec spec) {
|
private ObjectNode sampleEntityBody(FeatureSpec spec) {
|
||||||
|
|||||||
@@ -662,7 +662,7 @@ class AiAgentServiceTest {
|
|||||||
"expectedRootType": "page",
|
"expectedRootType": "page",
|
||||||
"expectedBodyType": "crud",
|
"expectedBodyType": "crud",
|
||||||
"expectedCrudName": "testPageCrud",
|
"expectedCrudName": "testPageCrud",
|
||||||
"expectedApi": "/api/entity/EIP4AI_TEST/list?page=${page}&perPage=${perPage}",
|
"expectedApi": "/api/flow/EIP4AI_TEST_SEARCH",
|
||||||
"expectedComponents": ["page", "crud", "form", "button"],
|
"expectedComponents": ["page", "crud", "form", "button"],
|
||||||
"expectedColumns": [{"name": "NAME", "label": "名称"}],
|
"expectedColumns": [{"name": "NAME", "label": "名称"}],
|
||||||
"expectedActions": ["新增", "编辑", "删除"],
|
"expectedActions": ["新增", "编辑", "删除"],
|
||||||
|
|||||||
@@ -28,6 +28,16 @@ public final class PageBlueprintCompiler {
|
|||||||
throw new IllegalArgumentException("Unsupported page recipe: " + blueprint.recipe());
|
throw new IllegalArgumentException("Unsupported page recipe: " + blueprint.recipe());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单表维护页,对齐转换器 house-style:
|
||||||
|
* <ul>
|
||||||
|
* <li>列表数据走保真层服务流 {@code /api/flow/<TABLE>_SEARCH}(含显名/枚举/引用列约定),
|
||||||
|
* 而非自创 {@code /api/entity} REST;amis crud 自动追加 page/perPage。</li>
|
||||||
|
* <li>顶部带查询区 {@code filter}(按 string 列生成文本搜索)。</li>
|
||||||
|
* <li>新增/编辑/删除按钮挂 {@code headerToolbar} 并操作 {@code selectedItems}(基线习惯,
|
||||||
|
* 不生成 per-row「操作」列);写入走 {@code _ADD/_UPDATE/_DELETE} 服务流。</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
private ObjectNode maintenanceCrud(PageBlueprint blueprint) {
|
private ObjectNode maintenanceCrud(PageBlueprint blueprint) {
|
||||||
ObjectNode page = objectMapper.createObjectNode();
|
ObjectNode page = objectMapper.createObjectNode();
|
||||||
page.put("type", "page");
|
page.put("type", "page");
|
||||||
@@ -37,25 +47,21 @@ public final class PageBlueprintCompiler {
|
|||||||
crud.put("type", "crud");
|
crud.put("type", "crud");
|
||||||
crud.put("name", crudName);
|
crud.put("name", crudName);
|
||||||
crud.put("syncLocation", false);
|
crud.put("syncLocation", false);
|
||||||
ObjectNode api = crud.putObject("api");
|
crud.put("api", "/api/flow/" + blueprint.tableName() + "_SEARCH");
|
||||||
api.put("method", "get");
|
crud.put("selectable", true);
|
||||||
api.put("url", "/api/entity/" + blueprint.tableName() + "/list?page=${page}&perPage=${perPage}");
|
crud.put("checkOnItemClick", true);
|
||||||
api.put("adaptor", "return payload;");
|
crud.put("primaryField", blueprint.primaryKey());
|
||||||
|
crud.set("filter", searchFilter(blueprint));
|
||||||
|
|
||||||
ArrayNode headerToolbar = crud.putArray("headerToolbar");
|
ArrayNode headerToolbar = crud.putArray("headerToolbar");
|
||||||
if (blueprint.allowCreate()) {
|
if (blueprint.allowCreate()) {
|
||||||
ObjectNode addButton = headerToolbar.addObject();
|
headerToolbar.add(maintenanceAddButton(blueprint, crudName));
|
||||||
addButton.put("type", "button");
|
}
|
||||||
addButton.put("label", "新增");
|
if (blueprint.allowEdit()) {
|
||||||
addButton.put("level", "primary");
|
headerToolbar.add(maintenanceEditButton(blueprint, crudName));
|
||||||
addButton.put("icon", "fa fa-plus");
|
}
|
||||||
addButton.put("actionType", "dialog");
|
if (blueprint.allowDelete()) {
|
||||||
ObjectNode addDialog = addButton.putObject("dialog");
|
headerToolbar.add(maintenanceDeleteButton(blueprint, crudName));
|
||||||
addDialog.put("title", "新增" + blueprint.entityName());
|
|
||||||
ObjectNode addForm = addDialog.putObject("body");
|
|
||||||
addForm.put("type", "form");
|
|
||||||
addForm.put("api", "post:/api/entity/" + blueprint.tableName() + "/save");
|
|
||||||
addForm.set("body", formControls(blueprint, false));
|
|
||||||
}
|
}
|
||||||
headerToolbar.add("pagination");
|
headerToolbar.add("pagination");
|
||||||
|
|
||||||
@@ -63,7 +69,7 @@ public final class PageBlueprintCompiler {
|
|||||||
footerToolbar.add("statistics");
|
footerToolbar.add("statistics");
|
||||||
footerToolbar.add("pagination");
|
footerToolbar.add("pagination");
|
||||||
crud.put("perPage", blueprint.pageSize());
|
crud.put("perPage", blueprint.pageSize());
|
||||||
crud.set("columns", columns(blueprint, crudName));
|
crud.set("columns", maintenanceColumns(blueprint));
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +113,7 @@ public final class PageBlueprintCompiler {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayNode columns(PageBlueprint blueprint, String crudName) {
|
private ArrayNode maintenanceColumns(PageBlueprint blueprint) {
|
||||||
ArrayNode columns = objectMapper.createArrayNode();
|
ArrayNode columns = objectMapper.createArrayNode();
|
||||||
for (PageBlueprintField field : blueprint.fields()) {
|
for (PageBlueprintField field : blueprint.fields()) {
|
||||||
if (!field.listVisible()) {
|
if (!field.listVisible()) {
|
||||||
@@ -117,23 +123,105 @@ public final class PageBlueprintCompiler {
|
|||||||
column.put("name", field.name());
|
column.put("name", field.name());
|
||||||
column.put("label", field.label());
|
column.put("label", field.label());
|
||||||
}
|
}
|
||||||
if (!blueprint.allowEdit() && !blueprint.allowDelete()) {
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
ObjectNode op = columns.addObject();
|
|
||||||
op.put("type", "operation");
|
|
||||||
op.put("label", "操作");
|
|
||||||
op.put("width", 180);
|
|
||||||
ArrayNode buttons = op.putArray("buttons");
|
|
||||||
if (blueprint.allowEdit()) {
|
|
||||||
addEditAction(blueprint, buttons);
|
|
||||||
}
|
|
||||||
if (blueprint.allowDelete()) {
|
|
||||||
addDeleteAction(blueprint, buttons, crudName);
|
|
||||||
}
|
|
||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 顶部查询区:按 string 列生成文本搜索;若无 string 列则回退按 displayField 搜索。 */
|
||||||
|
private ObjectNode searchFilter(PageBlueprint blueprint) {
|
||||||
|
ObjectNode filter = objectMapper.createObjectNode();
|
||||||
|
filter.put("title", "查询");
|
||||||
|
ArrayNode body = filter.putArray("body");
|
||||||
|
for (PageBlueprintField field : blueprint.fields()) {
|
||||||
|
if (field.listVisible() && "string".equals(field.type())) {
|
||||||
|
body.add(textSearch(field.name(), field.label()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (body.isEmpty()) {
|
||||||
|
String name = blueprint.displayField();
|
||||||
|
body.add(textSearch(name, displayLabel(blueprint, name)));
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectNode textSearch(String name, String label) {
|
||||||
|
ObjectNode control = objectMapper.createObjectNode();
|
||||||
|
control.put("type", "input-text");
|
||||||
|
control.put("name", name);
|
||||||
|
control.put("label", label);
|
||||||
|
control.put("clearable", true);
|
||||||
|
return control;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String displayLabel(PageBlueprint blueprint, String name) {
|
||||||
|
for (PageBlueprintField field : blueprint.fields()) {
|
||||||
|
if (field.name().equals(name)) {
|
||||||
|
return field.label();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectNode maintenanceAddButton(PageBlueprint blueprint, String crudName) {
|
||||||
|
ObjectNode addButton = objectMapper.createObjectNode();
|
||||||
|
addButton.put("type", "button");
|
||||||
|
addButton.put("id", "新增");
|
||||||
|
addButton.put("label", "新增");
|
||||||
|
addButton.put("level", "primary");
|
||||||
|
addButton.put("icon", "fa fa-plus");
|
||||||
|
addButton.put("actionType", "dialog");
|
||||||
|
ObjectNode addDialog = addButton.putObject("dialog");
|
||||||
|
addDialog.put("title", "新增" + blueprint.entityName());
|
||||||
|
addDialog.put("size", "lg");
|
||||||
|
ObjectNode addForm = addDialog.putObject("body");
|
||||||
|
addForm.put("type", "form");
|
||||||
|
addForm.put("api", "post:/api/flow/" + blueprint.tableName() + "_ADD");
|
||||||
|
addForm.put("reload", crudName);
|
||||||
|
addForm.set("body", formControls(blueprint, false));
|
||||||
|
return addButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectNode maintenanceEditButton(PageBlueprint blueprint, String crudName) {
|
||||||
|
ObjectNode edit = objectMapper.createObjectNode();
|
||||||
|
edit.put("type", "button");
|
||||||
|
edit.put("id", "编辑");
|
||||||
|
edit.put("label", "编辑");
|
||||||
|
edit.put("level", "primary");
|
||||||
|
edit.put("actionType", "dialog");
|
||||||
|
edit.put("disabledOn", "${!selectedItems || selectedItems.length === 0}");
|
||||||
|
ObjectNode dialog = edit.putObject("dialog");
|
||||||
|
dialog.put("title", "编辑" + blueprint.entityName());
|
||||||
|
dialog.put("size", "lg");
|
||||||
|
// 选中行铺进对话框作用域,内层表单据此预填(自包含,无需 _LOAD 服务往返)。
|
||||||
|
dialog.putObject("data").put("&", "${selectedItems[0]}");
|
||||||
|
ObjectNode editForm = dialog.putObject("body");
|
||||||
|
editForm.put("type", "form");
|
||||||
|
editForm.put("api", "post:/api/flow/" + blueprint.tableName() + "_UPDATE");
|
||||||
|
editForm.put("reload", crudName);
|
||||||
|
ArrayNode editControls = formControls(blueprint, false);
|
||||||
|
editControls.add(hidden(blueprint.primaryKey(), "${" + blueprint.primaryKey() + "}"));
|
||||||
|
editForm.set("body", editControls);
|
||||||
|
return edit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObjectNode maintenanceDeleteButton(PageBlueprint blueprint, String crudName) {
|
||||||
|
ObjectNode del = objectMapper.createObjectNode();
|
||||||
|
del.put("type", "button");
|
||||||
|
del.put("id", "删除");
|
||||||
|
del.put("label", "删除");
|
||||||
|
del.put("level", "danger");
|
||||||
|
del.put("actionType", "ajax");
|
||||||
|
del.put("disabledOn", "${!selectedItems || selectedItems.length === 0}");
|
||||||
|
del.put("confirmText", "确认要删除此记录吗?");
|
||||||
|
ObjectNode delApi = del.putObject("api");
|
||||||
|
delApi.put("method", "post");
|
||||||
|
delApi.put("url", "/api/flow/" + blueprint.tableName() + "_DELETE");
|
||||||
|
// 与转换器 house-style 一致:选中行主键逗号拼成 ids 串(单/多选通吃,运行时 _DELETE fanout 逐 id)。
|
||||||
|
delApi.putObject("data").put("ids",
|
||||||
|
"${selectedItems|pick:" + blueprint.primaryKey() + "|join:','}");
|
||||||
|
del.put("reload", crudName);
|
||||||
|
return del;
|
||||||
|
}
|
||||||
|
|
||||||
private ArrayNode treeColumns(PageBlueprint blueprint, String crudName) {
|
private ArrayNode treeColumns(PageBlueprint blueprint, String crudName) {
|
||||||
ArrayNode columns = objectMapper.createArrayNode();
|
ArrayNode columns = objectMapper.createArrayNode();
|
||||||
for (PageBlueprintField field : blueprint.fields()) {
|
for (PageBlueprintField field : blueprint.fields()) {
|
||||||
@@ -197,26 +285,6 @@ public final class PageBlueprintCompiler {
|
|||||||
editForm.set("body", editControls);
|
editForm.set("body", editControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEditAction(PageBlueprint blueprint, ArrayNode buttons) {
|
|
||||||
ObjectNode edit = buttons.addObject();
|
|
||||||
edit.put("type", "button");
|
|
||||||
edit.put("label", "编辑");
|
|
||||||
edit.put("level", "link");
|
|
||||||
edit.put("actionType", "dialog");
|
|
||||||
ObjectNode editDialog = edit.putObject("dialog");
|
|
||||||
editDialog.put("title", "编辑${" + blueprint.displayField() + "}");
|
|
||||||
ObjectNode editForm = editDialog.putObject("body");
|
|
||||||
editForm.put("type", "form");
|
|
||||||
editForm.put("api", "post:/api/entity/" + blueprint.tableName() + "/save");
|
|
||||||
ArrayNode editControls = formControls(blueprint, true);
|
|
||||||
ObjectNode hiddenPk = objectMapper.createObjectNode();
|
|
||||||
hiddenPk.put("type", "hidden");
|
|
||||||
hiddenPk.put("name", blueprint.primaryKey());
|
|
||||||
hiddenPk.put("value", "${" + blueprint.primaryKey() + "}");
|
|
||||||
editControls.add(hiddenPk);
|
|
||||||
editForm.set("body", editControls);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addDeleteAction(PageBlueprint blueprint, ArrayNode buttons, String crudName) {
|
private void addDeleteAction(PageBlueprint blueprint, ArrayNode buttons, String crudName) {
|
||||||
ObjectNode del = buttons.addObject();
|
ObjectNode del = buttons.addObject();
|
||||||
del.put("type", "button");
|
del.put("type", "button");
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.eip4.platform.metadata.schema.blueprint;
|
package com.eip4.platform.metadata.schema.blueprint;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -9,6 +11,7 @@ import org.junit.jupiter.api.DisplayName;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
class PageBlueprintCompilerTest {
|
class PageBlueprintCompilerTest {
|
||||||
@@ -16,7 +19,7 @@ class PageBlueprintCompilerTest {
|
|||||||
private static final ObjectMapper MAPPER = new ObjectMapper();
|
private static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("maintenance-crud-v1 编译为 EIP4 标准 amis CRUD 页")
|
@DisplayName("maintenance-crud-v1 编译为对齐转换器 house-style 的 amis CRUD 页")
|
||||||
void compilesMaintenanceCrudRecipe() {
|
void compilesMaintenanceCrudRecipe() {
|
||||||
PageBlueprint blueprint = new PageBlueprint(
|
PageBlueprint blueprint = new PageBlueprint(
|
||||||
PageBlueprint.VERSION,
|
PageBlueprint.VERSION,
|
||||||
@@ -42,17 +45,53 @@ class PageBlueprintCompilerTest {
|
|||||||
ObjectNode crud = (ObjectNode) schema.path("body");
|
ObjectNode crud = (ObjectNode) schema.path("body");
|
||||||
assertEquals("crud", crud.path("type").asText());
|
assertEquals("crud", crud.path("type").asText());
|
||||||
assertEquals("eip4aiContractTypeCrud", crud.path("name").asText());
|
assertEquals("eip4aiContractTypeCrud", crud.path("name").asText());
|
||||||
assertEquals("/api/entity/EIP4AI_CONTRACT_TYPE/list?page=${page}&perPage=${perPage}",
|
|
||||||
crud.path("api").path("url").asText());
|
// ① 列表数据走保真层服务流 _SEARCH(基线口径),非自创 /api/entity REST。
|
||||||
assertEquals("新增", crud.path("headerToolbar").get(0).path("label").asText());
|
assertEquals("/api/flow/EIP4AI_CONTRACT_TYPE_SEARCH", crud.path("api").asText());
|
||||||
assertEquals("post:/api/entity/EIP4AI_CONTRACT_TYPE/save",
|
assertTrue(crud.path("selectable").asBoolean());
|
||||||
crud.path("headerToolbar").get(0).path("dialog").path("body").path("api").asText());
|
assertTrue(crud.path("checkOnItemClick").asBoolean());
|
||||||
assertEquals("switch", crud.path("headerToolbar").get(0).path("dialog").path("body")
|
assertEquals("EIP4AI_CONTRACT_TYPE_ID", crud.path("primaryField").asText());
|
||||||
.path("body").get(1).path("type").asText());
|
|
||||||
assertEquals("hidden", crud.path("columns").get(2).path("buttons").get(0).path("dialog")
|
// ② 顶部查询区(filter):按 string 列生成文本搜索;boolean 列不入查询区。
|
||||||
.path("body").path("body").get(2).path("type").asText());
|
assertEquals("查询", crud.path("filter").path("title").asText());
|
||||||
assertEquals("text-danger", crud.path("columns").get(2).path("buttons").get(1)
|
assertEquals("input-text", crud.path("filter").path("body").get(0).path("type").asText());
|
||||||
.path("className").asText());
|
assertEquals("NAME", crud.path("filter").path("body").get(0).path("name").asText());
|
||||||
|
assertEquals(1, crud.path("filter").path("body").size());
|
||||||
|
|
||||||
|
// ③ 动作按钮挂 headerToolbar 操作 selectedItems(基线 house-style,无 per-row 操作列)。
|
||||||
|
ArrayNode header = (ArrayNode) crud.path("headerToolbar");
|
||||||
|
assertEquals("新增", header.get(0).path("label").asText());
|
||||||
|
assertEquals("dialog", header.get(0).path("actionType").asText());
|
||||||
|
assertEquals("post:/api/flow/EIP4AI_CONTRACT_TYPE_ADD",
|
||||||
|
header.get(0).path("dialog").path("body").path("api").asText());
|
||||||
|
assertEquals("switch", header.get(0).path("dialog").path("body").path("body").get(1).path("type").asText());
|
||||||
|
|
||||||
|
assertEquals("编辑", header.get(1).path("label").asText());
|
||||||
|
assertTrue(header.get(1).path("disabledOn").asText().contains("selectedItems"));
|
||||||
|
assertEquals("${selectedItems[0]}", header.get(1).path("dialog").path("data").path("&").asText());
|
||||||
|
assertEquals("post:/api/flow/EIP4AI_CONTRACT_TYPE_UPDATE",
|
||||||
|
header.get(1).path("dialog").path("body").path("api").asText());
|
||||||
|
assertEquals("hidden", header.get(1).path("dialog").path("body").path("body").get(2).path("type").asText());
|
||||||
|
|
||||||
|
assertEquals("删除", header.get(2).path("label").asText());
|
||||||
|
assertEquals("ajax", header.get(2).path("actionType").asText());
|
||||||
|
assertEquals("danger", header.get(2).path("level").asText());
|
||||||
|
assertEquals("/api/flow/EIP4AI_CONTRACT_TYPE_DELETE", header.get(2).path("api").path("url").asText());
|
||||||
|
assertEquals("${selectedItems|pick:EIP4AI_CONTRACT_TYPE_ID|join:','}",
|
||||||
|
header.get(2).path("api").path("data").path("ids").asText());
|
||||||
|
assertFalse(header.get(2).path("confirmText").asText().isBlank());
|
||||||
|
assertEquals("pagination", header.get(3).asText());
|
||||||
|
|
||||||
|
assertEquals("statistics", crud.path("footerToolbar").get(0).asText());
|
||||||
|
assertEquals("pagination", crud.path("footerToolbar").get(1).asText());
|
||||||
|
|
||||||
|
// ④ 列表列 = listVisible 业务列,无 per-row「操作」列。
|
||||||
|
ArrayNode columns = (ArrayNode) crud.path("columns");
|
||||||
|
assertEquals(2, columns.size());
|
||||||
|
assertEquals("NAME", columns.get(0).path("name").asText());
|
||||||
|
for (int i = 0; i < columns.size(); i++) {
|
||||||
|
assertFalse("operation".equals(columns.get(i).path("type").asText()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user