fix schedule job notify editor
Some checks failed
ci / build-test-parity (push) Has been cancelled

This commit is contained in:
2026-06-18 17:15:10 +08:00
parent 62188a557f
commit ccd74710fa
6 changed files with 149 additions and 38 deletions

View File

@@ -730,31 +730,7 @@ public final class EngineclassDelta {
mapOf("label", "指定维度岗位类别负责人", "value", "fixedDimension"),
mapOf("label", "所属公司岗位类别", "value", "formSpecifiedDimension"),
mapOf("label", "基于项目角色", "value", "projectRoleType")))),
inputTableColumn("users", "用户", 280, notifyPicker("users",
"76d2f950-ef40-4eff-89ec-98ad9a4976b9"), "${type === 'user'}"),
inputTableColumn("departs", "部门", 280, notifyPicker("departs",
"138b7ca7-befb-4a0c-bfc6-ed8fb4d4e434"), "${type === 'depart'}"),
inputTableColumn("positions", "岗位", 280, notifyPicker("positions",
"feeee51d-d41b-410b-b7a4-67d61ec8c4df"), "${type === 'position'}"),
inputTableColumn("dimensionId", "维度", 180, mapOf(
"type", "select",
"name", "dimensionId",
"source", "/api/schedulejob/dimensions/options",
"clearable", true), "${type === 'fixedDimension'}"),
inputTableColumn("positionTypes", "岗位类别", 280, notifyPicker("positionTypes",
"8c19a765-047e-4a5c-8657-eb16c013ba65"),
"${type === 'fixedDimension' || type === 'formSpecifiedDimension'}"),
inputTableColumn("projectRoles", "项目角色", 260, mapOf(
"type", "checkboxes",
"name", "projectRoles",
"source", "/api/schedulejob/project-role-options"), "${type === 'projectRoleType'}"),
inputTableColumn("content", "原始内容", 220, mapOf(
"type", "input-text",
"name", "content",
"clearable", true),
"${type !== 'user' && type !== 'depart' && type !== 'position' "
+ "&& type !== 'fixedDimension' && type !== 'formSpecifiedDimension' "
+ "&& type !== 'projectRoleType'}"),
inputTableColumn("notifyTarget", "提醒对象", 520, notifyTargetGroup()),
inputTableColumn("isSendMessage", "短消息", 80, mapOf(
"type", "checkbox",
"name", "isSendMessage")),
@@ -767,6 +743,47 @@ public final class EngineclassDelta {
return table;
}
private static Map<String, Object> notifyTargetGroup() {
return mapOf(
"type", "group",
"name", "notifyTarget",
"body", List.of(
visibleControl(notifyPicker("users",
"76d2f950-ef40-4eff-89ec-98ad9a4976b9"), "${type === 'user'}"),
visibleControl(notifyPicker("departs",
"138b7ca7-befb-4a0c-bfc6-ed8fb4d4e434"), "${type === 'depart'}"),
visibleControl(notifyPicker("positions",
"feeee51d-d41b-410b-b7a4-67d61ec8c4df"), "${type === 'position'}"),
visibleControl(mapOf(
"type", "group",
"body", List.of(
mapOf("type", "select",
"name", "dimensionId",
"label", false,
"source", "/api/schedulejob/dimensions/options",
"clearable", true),
notifyPicker("positionTypes",
"8c19a765-047e-4a5c-8657-eb16c013ba65"))),
"${type === 'fixedDimension'}"),
visibleControl(notifyPicker("positionTypes",
"8c19a765-047e-4a5c-8657-eb16c013ba65"),
"${type === 'formSpecifiedDimension'}"),
visibleControl(mapOf(
"type", "checkboxes",
"name", "projectRoles",
"label", false,
"source", "/api/schedulejob/project-role-options"),
"${type === 'projectRoleType'}"),
visibleControl(mapOf(
"type", "input-text",
"name", "content",
"label", false,
"clearable", true),
"${type !== 'user' && type !== 'depart' && type !== 'position' "
+ "&& type !== 'fixedDimension' && type !== 'formSpecifiedDimension' "
+ "&& type !== 'projectRoleType'}")));
}
private static Map<String, Object> inputTableColumn(String name, String label, int width,
Map<String, Object> quickEdit) {
return inputTableColumn(name, label, width, quickEdit, null);
@@ -789,6 +806,7 @@ public final class EngineclassDelta {
Map<String, Object> picker = new LinkedHashMap<>();
picker.put("type", "picker");
picker.put("name", name);
picker.put("label", false);
picker.put("multiple", true);
picker.put("joinValues", false);
picker.put("extractValue", false);
@@ -811,6 +829,12 @@ public final class EngineclassDelta {
return picker;
}
private static Map<String, Object> visibleControl(Map<String, Object> control, String visibleOn) {
Map<String, Object> copy = new LinkedHashMap<>(control);
copy.put("visibleOn", visibleOn);
return copy;
}
private static Map<String, Object> downloadButton(String label, String icon, String url) {
Map<String, Object> btn = new LinkedHashMap<>();
btn.put("type", "button");

View File

@@ -1396,12 +1396,18 @@ class TemplateToAmisConverterTest {
Map<String, Object> table = (Map<String, Object>) body.get(0);
assertEquals("input-table", table.get("type"));
List<Map<String, Object>> columns = (List<Map<String, Object>>) table.get("columns");
assertTrue(columns.stream().anyMatch(c -> "users".equals(c.get("name"))));
Map<String, Object> userColumn = columns.stream()
assertTrue(columns.stream().noneMatch(c -> c.containsKey("visibleOn")),
"input-table 列级 visibleOn 不按行求值,提醒对象应收敛到 group 内部");
Map<String, Object> targetColumn = columns.stream()
.filter(c -> "notifyTarget".equals(c.get("name"))).findFirst().orElseThrow();
Map<String, Object> quickEdit = (Map<String, Object>) targetColumn.get("quickEdit");
assertEquals("group", quickEdit.get("type"));
List<Map<String, Object>> targetControls = (List<Map<String, Object>>) quickEdit.get("body");
Map<String, Object> users = targetControls.stream()
.filter(c -> "users".equals(c.get("name"))).findFirst().orElseThrow();
Map<String, Object> quickEdit = (Map<String, Object>) userColumn.get("quickEdit");
assertEquals("picker", quickEdit.get("type"));
assertEquals("/api/picker/76d2f950-ef40-4eff-89ec-98ad9a4976b9/list", quickEdit.get("source"));
assertEquals("picker", users.get("type"));
assertEquals("${type === 'user'}", users.get("visibleOn"));
assertEquals("/api/picker/76d2f950-ef40-4eff-89ec-98ad9a4976b9/list", users.get("source"));
}
/** engineclass=ProcessFormRemoveComponent → 审批表单删除注入查看和历史删除按钮。 */