feat: wire process form removal actions

This commit is contained in:
2026-06-18 08:55:17 +08:00
parent d82ef94da8
commit 1d8a4fec60
8 changed files with 225 additions and 0 deletions

View File

@@ -86,6 +86,14 @@ public final class EngineclassDelta {
registerMutator("com.dsasp.client.wf.ui.process.monitor.MySendTaskComponent",
EngineclassDelta::startedProcessDataSource);
// 审批表单删除:ProcessFormRemoveComponent 在默认流程实例列表之上加「查看」「删除」。
// 查看复用只读 ApprovalDrawer;删除仅删除已结束的历史流程实例,后端守卫运行中流程 409。
register("com.dsasp.client.wf.ui.process.monitor.ProcessFormRemoveComponent",
EngineclassDelta::processFormRemoveDetailButton,
EngineclassDelta::processFormRemoveDeleteButton);
registerMutator("com.dsasp.client.wf.ui.process.monitor.ProcessFormRemoveComponent",
EngineclassDelta::processFormRemoveCrudAnchor);
// 消息查看:MessageReceiveView/MessageSendView 在默认 GridTemplateComponent 之上加「查看」按钮。
// 收到消息按 SYS_MESSAGEUSER_ID 打开并置已读;已发送消息按 SYS_MESSAGE_ID 打开只读详情。
register("com.dsasp.client.tools.message.MessageReceiveView",
@@ -354,6 +362,59 @@ public final class EngineclassDelta {
return btn;
}
/** 审批表单删除「查看」:按历史流程实例打开只读审批详情。 */
private static Map<String, Object> processFormRemoveDetailButton(String pkField) {
Map<String, Object> args = mapOf(
"taskName", "${selectedItems[0].TITLE || '审批表单查看'}",
"processInstanceId", selectedSingleFieldExpr(pkField),
"businessKey", "${selectedItems[0].businessKey || selectedItems[0].BUSINESSKEY || ''}",
"businessTable", "${selectedItems[0].businessTable || selectedItems[0].BUSINESSTABLE || ''}",
"businessSummary", "${selectedItems[0].businessSummary || {}}",
"readOnly", true,
"mode", "read");
Map<String, Object> action = mapOf(
"actionType", "openApprovalDrawer",
"args", args);
Map<String, Object> btn = new LinkedHashMap<>();
btn.put("type", "button");
btn.put("id", "查看");
btn.put("label", "查看");
btn.put("icon", "fa fa-search");
btn.put("disabledOn", "${!selectedItems || selectedItems.length !== 1}");
btn.put("onEvent", mapOf("click", mapOf("actions", List.of(action))));
return btn;
}
/** 审批表单删除「删除」:按历史流程实例物理删除流程历史。 */
private static Map<String, Object> processFormRemoveDeleteButton(String pkField) {
Map<String, Object> btn = new LinkedHashMap<>();
btn.put("type", "button");
btn.put("id", "删除");
btn.put("label", "删除");
btn.put("icon", "fa fa-trash");
btn.put("level", "danger");
btn.put("actionType", "ajax");
btn.put("disabledOn", "${!selectedItems || selectedItems.length !== 1}");
btn.put("confirmText", "确认删除选中的审批表单历史?");
btn.put("api", mapOf(
"method", "post",
"url", "/api/workflow/process/" + selectedSingleFieldExpr(pkField) + "/delete-history"));
btn.put("reload", "process-form-remove-crud");
return btn;
}
/** 审批表单删除 CRUD 刷新锚点,供删除后精准 reload。 */
@SuppressWarnings("unchecked")
private static void processFormRemoveCrudAnchor(Map<String, Object> schema, ConversionResult result) {
Object bodyObj = schema.get("body");
if (bodyObj instanceof Map<?, ?> body && "crud".equals(body.get("type"))) {
((Map<String, Object>) bodyObj).putIfAbsent("id", "process-form-remove-crud");
if (result != null) {
result.note("engineclass[ProcessFormRemoveComponent] 设置审批表单删除 CRUD 刷新锚点");
}
}
}
private static Map<String, Object> approvalDrawerButton(String label, String icon, String pkField,
boolean readOnly) {
Map<String, Object> args = mapOf(