fix(metadata): make user picker searchable and show selections
Some checks failed
ci / build-test-parity (push) Has been cancelled

This commit is contained in:
2026-06-17 22:04:26 +08:00
parent 88ff6f6bfb
commit 78d27847dd
3 changed files with 15 additions and 9 deletions

View File

@@ -45,16 +45,16 @@ public class UserSelectController {
List<Map<String, Object>> users = listUsers(normalizedMode, q, safeLimit);
List<Map<String, Object>> tabs = new ArrayList<>();
tabs.add(tab("全部人员", "users", users));
tabs.add(tab("按公司、部门选择人员", "depart-users", departmentUserTree(users)));
tabs.add(tab("按岗位类别选择人员", "position-type-users", positionTypeUserTree(users)));
tabs.add(tab("按用户类别选择人员", "category-users", categoryUserTree(users)));
tabs.add(tab("全部人员", "users", users, "list"));
tabs.add(tab("按公司、部门选择人员", "depart-users", departmentUserTree(users), "tree"));
tabs.add(tab("按岗位类别选择人员", "position-type-users", positionTypeUserTree(users), "tree"));
tabs.add(tab("按用户类别选择人员", "category-users", categoryUserTree(users), "tree"));
if ("org".equals(normalizedMode)) {
tabs.add(tab("全体人员", "all-users", List.of(option("全体人员", ALL_VALUE, "all"))));
tabs.add(tab("选择公司", "orgs", orgOptions(null, 500)));
tabs.add(tab("选择部门", "departs", departOptions(null, 1000)));
tabs.add(tab("选择岗位类别", "position-types", positionTypeOptions(null, 500)));
tabs.add(tab("全体人员", "all-users", List.of(option("全体人员", ALL_VALUE, "all")), "list"));
tabs.add(tab("选择公司", "orgs", orgOptions(null, 500), "list"));
tabs.add(tab("选择部门", "departs", departOptions(null, 1000), "list"));
tabs.add(tab("选择岗位类别", "position-types", positionTypeOptions(null, 500), "list"));
}
return okOptions(tabs);
}
@@ -320,10 +320,13 @@ public class UserSelectController {
return (rs, rowNum) -> option(rs.getString("label"), rs.getString("value"), type);
}
private static Map<String, Object> tab(String label, String value, List<Map<String, Object>> children) {
private static Map<String, Object> tab(String label, String value, List<Map<String, Object>> children,
String selectMode) {
Map<String, Object> tab = new LinkedHashMap<>();
tab.put("label", label);
tab.put("value", value);
tab.put("searchable", true);
tab.put("selectMode", selectMode);
tab.put("children", children == null ? List.of() : children);
return tab;
}