feat(metadata): wire legacy process selector
Some checks failed
ci / build-test-parity (push) Has been cancelled

This commit is contained in:
2026-06-17 21:45:12 +08:00
parent 1581a99d75
commit 88ff6f6bfb
8 changed files with 249 additions and 12 deletions

View File

@@ -27,6 +27,7 @@ final class UiTypeMapper {
private static final String USER_SELECT_ORG = "1b3bad0b-a24b-4347-9466-db78f7432756";
private static final String USER_SELECT_ALL = "090981ba-0c10-4d84-92dc-80e226594480";
private static final String USER_SELECT_ATTENDANCE = "e31ce405-21c4-4892-94bb-e87e07b7f8e7";
private static final String PROCESS_SELECT = "b3070157-7081-437f-9e56-63cf34f944ec";
private static final Set<String> USER_SELECT_DIALOG_IDS = Set.of(
USER_SELECT_CONTROLLED, USER_SELECT_ORG, USER_SELECT_ALL, USER_SELECT_ATTENDANCE);
@@ -257,6 +258,10 @@ final class UiTypeMapper {
result.note(origin + "@field " + name + " uitype=SelectDialog(dialogid="
+ dialogId + ") → tabs-transfer-picker(旧用户选择框,mode="
+ userSelectMode(dialogId) + ")");
} else if (isProcessSelectDialog(dialogId)) {
applyProcessSelectPicker(item, false);
result.note(origin + "@field " + name + " uitype=SelectDialog(dialogid="
+ dialogId + ") → transfer-picker(旧流程选择框)");
} else {
applyPicker(item, dialogId, false);
result.note(origin + "@field " + name + " uitype=SelectDialog(dialogid="
@@ -291,6 +296,10 @@ final class UiTypeMapper {
result.note(origin + "@field " + name + " uitype=MultiSelectDialog(dialogid="
+ dialogId + ") → tabs-transfer-picker(旧用户选择框,mode="
+ userSelectMode(dialogId) + ", multiple)");
} else if (isProcessSelectDialog(dialogId)) {
applyProcessSelectPicker(item, true);
result.note(origin + "@field " + name + " uitype=MultiSelectDialog(dialogid="
+ dialogId + ") → transfer-picker(旧流程选择框, multiple)");
} else {
applyPicker(item, dialogId, true);
result.note(origin + "@field " + name + " uitype=MultiSelectDialog(dialogid="
@@ -457,6 +466,35 @@ final class UiTypeMapper {
};
}
/**
* 旧 ProcessSelectDialog → amis 内建 transfer-picker。
*
* <p>老窗口是 {@code FilterableTwinColSelect},左列标题「流程名称」、右列标题「已选流程」;
* 选中值为流程名称本身。后端 {@code /api/process-select} 维持该值口径。
*/
private static void applyProcessSelectPicker(Map<String, Object> item, boolean multiple) {
item.put("type", "transfer-picker");
item.put("clearable", true);
item.put("multiple", multiple);
item.put("joinValues", true);
item.put("delimiter", ",");
item.put("labelField", "label");
item.put("valueField", "value");
item.put("source", "/api/process-select/options");
item.put("searchApi", "/api/process-select/search?term=${term}");
item.put("searchable", true);
item.put("searchResultMode", "list");
item.put("pickerSize", "lg");
item.put("selectTitle", "流程名称");
item.put("resultTitle", "已选流程");
item.put("placeholder", "请选择");
item.put("statistics", true);
}
private static boolean isProcessSelectDialog(String dialogId) {
return dialogId != null && PROCESS_SELECT.equals(dialogId.trim().toLowerCase());
}
/**
* dialogid 缺失时的降级:保持 F2-9 的 {@code select + 远程 source}(搜索下拉)。
* 无 dialogid 即无可解析数据源,弹窗 picker 会空载,故不退化为弹窗,沿用既有搜索下拉降级形态。

View File

@@ -609,6 +609,28 @@ class TemplateToAmisConverterTest {
assertTrue(r.getMappingNotes().stream().anyMatch(n -> n.contains("mode=all")));
}
@Test
@SuppressWarnings("unchecked")
void crud_流程选择框转transferPicker() {
String dialogId = "b3070157-7081-437f-9e56-63cf34f944ec";
String xml = "<crud entityid='e1'><display/>"
+ "<search><field name='AGENTPROCESSLIST' label='代理流程集合' uitype='MultiSelectDialog'"
+ " dialogid='" + dialogId + "'/></search></crud>";
ConversionResult r = converter.convertGraded(xml, new ArrayList<>(), noPage);
Map<String, Object> filter = (Map<String, Object>) body(r.getSchema()).get("filter");
List<Map<String, Object>> items = (List<Map<String, Object>>) filter.get("body");
Map<String, Object> picker = items.get(0);
assertEquals("transfer-picker", picker.get("type"));
assertEquals(Boolean.TRUE, picker.get("multiple"));
assertEquals(Boolean.TRUE, picker.get("joinValues"));
assertEquals("/api/process-select/options", picker.get("source"));
assertEquals("/api/process-select/search?term=${term}", picker.get("searchApi"));
assertEquals("流程名称", picker.get("selectTitle"));
assertEquals("已选流程", picker.get("resultTitle"));
assertTrue(r.getMappingNotes().stream().anyMatch(n -> n.contains("AGENTPROCESSLIST")
&& n.contains("transfer-picker") && n.contains("流程选择框")));
}
@Test
@SuppressWarnings("unchecked")
void crud_selectDialog无dialogid保持select降级() {

View File

@@ -2221,7 +2221,7 @@ fec401d7-d1c8-4f24-abf6-d9d7534808e7,项目资金支付申请表,200,report,PART
914c38c1-3e68-4809-982c-9e7c20412bfe,发起会议-需要预订会议室,viewpage,page,PARTIAL,false,21,false,转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
9175be2c-44e0-4834-b168-0df9c9d214a6,参保人员--查看缴费基数记录页面,viewpage,page,PARTIAL,true,17,false,转换器缺陷:editform@field PAYBASERECORDS uitype=EditGrid → input-table 子表(主子表子表侧,列取自 editgridtemplate;保存联动 updateSubTable 待后端)
917da832-444e-44d1-833f-37fb41ff4041,个人调职申请查看,viewpage,page,PARTIAL,false,8,false,转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
919477da-1201-45ea-98a2-5c55d5f91b55,流程代理授权,viewpage,page,PARTIAL,false,12,false,转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
919477da-1201-45ea-98a2-5c55d5f91b55,流程代理授权,viewpage,page,SUCCESS,true,12,false,
919f9739-1749-4138-b29e-f079f665ede4,建造师注册证-查看流转记录页面-五建定制,viewpage,page,PARTIAL,false,20,false,转换器缺陷:editform@field FLOWDETAILS uitype=EditGrid → input-table 子表(主子表子表侧,列取自 editgridtemplate;保存联动 updateSubTable 待后端) | 转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
91d86fd6-0e4a-4baa-a29e-1ac4b677340e,月度检查整改编辑页面(加决策节点),viewpage,page,PARTIAL,false,26,false,转换器缺陷:editform@field CHECKMONTHQUARTERLY uitype=ComboBox(无 comboboxid 且非枚举/列元数据缺失) → 空 select(选项源无法解析) | 转换器缺陷:editform@field AUTHENTICATIONTOR uitype=SelectDialog(dialogid=空) → select+source(无 dialogid,数据源缺失,保持搜索下拉) | 转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
91ecaac0-da48-4fe2-8987-15f3c2897e28,创优项目信息编辑页面,viewpage,page,PARTIAL,false,11,false,转换器缺陷:editform@field UNITPROJECTID uitype=ComboBox(列表服务=PM_UNITPROJECT_SEARCH_COMBOX 非 _SEARCH 命名,无法推实体) → 保底 /api/poc/dict(选项可能为空,待补服务→实体映射) | 转换器缺陷:闸一 schema 校验未过: $.body.body: array found, object expected | $.body.body: array found, object expected | $.body.body: array found, object expected
Can't render this file because it is too large.