feat: wire my started workflow tasks
This commit is contained in:
@@ -78,6 +78,14 @@ public final class EngineclassDelta {
|
||||
registerMutator("com.dsasp.client.wf.task.component.FinishTaskComponentNew",
|
||||
EngineclassDelta::taskDoneDataSource);
|
||||
|
||||
// 我的发起任务:MySendTaskComponent 在默认列表之上加「查看详细」和「撤回」。
|
||||
// 查看详细按流程实例打开只读审批详情;撤回按流程实例执行主动召回并回写状态。
|
||||
register("com.dsasp.client.wf.ui.process.monitor.MySendTaskComponent",
|
||||
EngineclassDelta::startedProcessDetailButton,
|
||||
EngineclassDelta::startedProcessWithdrawButton);
|
||||
registerMutator("com.dsasp.client.wf.ui.process.monitor.MySendTaskComponent",
|
||||
EngineclassDelta::startedProcessDataSource);
|
||||
|
||||
// 消息查看:MessageReceiveView/MessageSendView 在默认 GridTemplateComponent 之上加「查看」按钮。
|
||||
// 收到消息按 SYS_MESSAGEUSER_ID 打开并置已读;已发送消息按 SYS_MESSAGE_ID 打开只读详情。
|
||||
register("com.dsasp.client.tools.message.MessageReceiveView",
|
||||
@@ -264,6 +272,18 @@ public final class EngineclassDelta {
|
||||
}
|
||||
}
|
||||
|
||||
/** 我的发起任务数据源:老 VIEW_ACT_PROCESS_SEARCH 改走 Flowable startedBy 聚合端点。 */
|
||||
private static void startedProcessDataSource(Map<String, Object> schema, ConversionResult result) {
|
||||
replaceCrudApi(schema, "/api/workflow/process/started-amis");
|
||||
Object bodyObj = schema.get("body");
|
||||
if (bodyObj instanceof Map<?, ?> body && "crud".equals(body.get("type"))) {
|
||||
((Map<String, Object>) body).put("id", "my-started-process-crud");
|
||||
}
|
||||
if (result != null) {
|
||||
result.note("engineclass[MySendTaskComponent] 改写我的发起任务数据源为 /api/workflow/process/started-amis");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void replaceCrudApi(Map<String, Object> schema, String api) {
|
||||
Object bodyObj = schema.get("body");
|
||||
@@ -289,6 +309,51 @@ public final class EngineclassDelta {
|
||||
return approvalDrawerButton("查看详细", "fa fa-search", pkField, true);
|
||||
}
|
||||
|
||||
/** 我的发起任务「查看详细」:按流程实例打开只读审批详情。 */
|
||||
private static Map<String, Object> startedProcessDetailButton(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> startedProcessWithdrawButton(String pkField) {
|
||||
Map<String, Object> btn = new LinkedHashMap<>();
|
||||
btn.put("type", "button");
|
||||
btn.put("id", "撤回");
|
||||
btn.put("label", "撤回");
|
||||
btn.put("icon", "fa fa-undo");
|
||||
btn.put("level", "warning");
|
||||
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) + "/withdraw",
|
||||
"data", mapOf(
|
||||
"comment", "主动召回",
|
||||
"businessKey", "${selectedItems[0].businessKey || selectedItems[0].BUSINESSKEY || ''}",
|
||||
"tableName", "${selectedItems[0].businessTable || selectedItems[0].BUSINESSTABLE || ''}")));
|
||||
btn.put("reload", "my-started-process-crud");
|
||||
return btn;
|
||||
}
|
||||
|
||||
private static Map<String, Object> approvalDrawerButton(String label, String icon, String pkField,
|
||||
boolean readOnly) {
|
||||
Map<String, Object> args = mapOf(
|
||||
|
||||
Reference in New Issue
Block a user