From 24a8f75f147407e67caa22fa0cee9a0b75a78772 Mon Sep 17 00:00:00 2001 From: lorne <1991wangliang@gmail.com> Date: Mon, 24 Aug 2026 21:47:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(flow-approval):=20=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=89=8D=E5=AE=A1=E8=AE=A1=E4=BF=AE=E5=A4=8D=E2=80=94=E2=80=94?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E4=B8=8A=E4=B8=8B=E6=96=87=E6=9A=B4=E9=9C=B2?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E8=83=BD=E5=8A=9B=E5=B9=B6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E7=B1=BB=E5=9E=8B=EF=BC=880.2.6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ApprovalPresenter/FlowActionPresenter 暴露 resetSubProcess,审批上下文可直达子流程重置接口 - flow-types 子流程视图类型同步后端新增字段:聚合组 superseded、实例 inherited/sourceProcessId - 能力文档与索引同步重置开关说明 codingapi/flow-engine#219 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../flow-design/sub-process-config.md | 2 +- docs/capabilities/index.md | 2 +- packages/flow-approval-presenter/CHANGELOG.md | 1 + .../src/presenters/action.ts | 24 ++++++++++++++++++- .../src/presenters/index.ts | 10 ++++++++ packages/flow-types/CHANGELOG.md | 1 + .../flow-types/src/types/flow-approval.ts | 6 +++++ 7 files changed, 43 insertions(+), 3 deletions(-) diff --git a/docs/capabilities/flow-design/sub-process-config.md b/docs/capabilities/flow-design/sub-process-config.md index 1ec75ca..105de8b 100644 --- a/docs/capabilities/flow-design/sub-process-config.md +++ b/docs/capabilities/flow-design/sub-process-config.md @@ -1,7 +1,7 @@ --- name: flow-design/sub-process-config module: flow-design -description: 子流程节点的多实例创建、结果判定脚本和异常节点跳转配置 +description: 子流程节点的多实例创建、结果判定脚本、异常节点跳转与重置能力开关配置 status: 已实现 scope: 前端 source: 项目自有 diff --git a/docs/capabilities/index.md b/docs/capabilities/index.md index ca6a6c2..fce7822 100644 --- a/docs/capabilities/index.md +++ b/docs/capabilities/index.md @@ -17,7 +17,7 @@ | [flow-core/message-registry](./flow-core/message-registry.md) | flow-core | 流程消息注册表(单例模式),将所有消息提示从硬编码中解耦,支持下游 App 通过字符串模板或函数模板自定义消息内容,运行时上下文数据由 Presenter 自动注入 | 前端 | 项目自有 | | [flow-design/manager-group](./flow-design/manager-group.md) | flow-design | 设计面板管理器组,包含表单字段管理、节点转换管理、路由节点管理和工作流策略管理 | 前端 | 项目自有 | | [flow-design/node-registry](./flow-design/node-registry.md) | flow-design | 流程节点注册机制,通过 FlowNodeRegistry 接口定义 19 种节点类型并注册到 Flowgram 固定布局编辑器 | 前端 | 项目自有 | -| [flow-design/sub-process-config](./flow-design/sub-process-config.md) | flow-design | 子流程节点的多实例创建、结果判定脚本和异常节点跳转配置 | 前端 | 项目自有 | +| [flow-design/sub-process-config](./flow-design/sub-process-config.md) | flow-design | 子流程节点的多实例创建、结果判定脚本、异常节点跳转与重置能力开关配置 | 前端 | 项目自有 | | [flowgram/flowgram](./flowgram/flowgram.md) | flowgram | Flowgram 固定布局流程编辑器,提供可视化节点编辑、连线、迷你地图等能力 | 前端 | 框架:Flowgram | | [form-engine/form-engine](./form-engine/form-engine.md) | form-engine | 外部表单引擎,提供表单渲染、表单项注册、表单实例创建等能力 | 前端 | 框架:Form Engine | | [react/react](./react/react.md) | react | React UI 框架,提供组件化渲染、Hooks 响应式状态管理、虚拟 DOM 等核心能力 | 前端 | 框架:React | diff --git a/packages/flow-approval-presenter/CHANGELOG.md b/packages/flow-approval-presenter/CHANGELOG.md index 9f745f3..bf675d0 100644 --- a/packages/flow-approval-presenter/CHANGELOG.md +++ b/packages/flow-approval-presenter/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.2.6 ### Patch Changes +- 审批上下文可直达子流程重置能力:ApprovalPresenter/FlowActionPresenter 暴露 `resetSubProcess`(codingapi/flow-engine#219) - 版本升级至 0.2.6(仅版本号升级,无功能变更) diff --git a/packages/flow-approval-presenter/src/presenters/action.ts b/packages/flow-approval-presenter/src/presenters/action.ts index 90763ba..bce40d7 100644 --- a/packages/flow-approval-presenter/src/presenters/action.ts +++ b/packages/flow-approval-presenter/src/presenters/action.ts @@ -1,5 +1,5 @@ import { ApprovalState, FlowApprovalApi } from "@/typings"; -import { FormActionContext, FlowAction } from "@coding-flow/flow-types"; +import { FormActionContext, FlowAction, FlowSubProcessResetRequest } from "@coding-flow/flow-types"; import { ActionInterceptor, ActionInterceptorManager, DialogContent, DialogContentManager, DialogContentProvider } from "@/interceptor"; export class FlowActionPresenter { @@ -316,6 +316,28 @@ export class FlowActionPresenter { } } + /** + * 子流程数据重置(独立能力,非审批动作)。 + * + * 仅当详情数据 `resetSubProcess` 标识为 true 时可调用:将选中实例流程id对应的 + * 已完成子流程聚合组重置,主流程退回子流程节点重新等待。 + * + * @param resetInstanceProcessIds 选中重建的子流程实例流程id列表 + * @param advice 重置说明(可选) + */ + public async resetSubProcess(resetInstanceProcessIds: string[], advice?: string) { + this.setLoading(true); + try { + const recordId = this.state.flow?.recordId; + if (recordId) { + const body: FlowSubProcessResetRequest = { recordId, resetInstanceProcessIds, advice }; + return await this.api.resetSubProcess(body, this.mockKey); + } + } finally { + this.setLoading(false); + } + } + /** * 执行已订阅的审批操作拦截器。 * diff --git a/packages/flow-approval-presenter/src/presenters/index.ts b/packages/flow-approval-presenter/src/presenters/index.ts index e4021ff..42d2167 100644 --- a/packages/flow-approval-presenter/src/presenters/index.ts +++ b/packages/flow-approval-presenter/src/presenters/index.ts @@ -49,4 +49,14 @@ export class ApprovalPresenter { return this.flowActionPresenter.processNodes(); } + /** + * 子流程数据重置(独立能力,非审批动作),仅当详情数据 resetSubProcess 标识为 true 时可调用。 + * + * @param resetInstanceProcessIds 选中重建的子流程实例流程id列表 + * @param advice 重置说明(可选) + */ + public resetSubProcess(resetInstanceProcessIds: string[], advice?: string) { + return this.flowActionPresenter.resetSubProcess(resetInstanceProcessIds, advice); + } + } \ No newline at end of file diff --git a/packages/flow-types/CHANGELOG.md b/packages/flow-types/CHANGELOG.md index 5305393..3f7df23 100644 --- a/packages/flow-types/CHANGELOG.md +++ b/packages/flow-types/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.2.6 ### Patch Changes +- 子流程节点视图类型同步后端新增字段:聚合组 `superseded`、实例 `inherited`/`sourceProcessId`(codingapi/flow-engine#219) - 版本升级至 0.2.6(仅版本号升级,无功能变更) diff --git a/packages/flow-types/src/types/flow-approval.ts b/packages/flow-types/src/types/flow-approval.ts index 40eae2f..3e2c3f8 100644 --- a/packages/flow-types/src/types/flow-approval.ts +++ b/packages/flow-types/src/types/flow-approval.ts @@ -242,6 +242,10 @@ export interface ProcessNodeSubProcessInstance { finishRecordId: number; state: SubProcessInstanceState; finishTime: number; + /** 是否为继承实例:重置时未被选中重置的实例沿用原结果,未重新执行。 */ + inherited?: boolean; + /** 重建实例替换的旧实例流程id;继承实例与常规实例为 undefined。 */ + sourceProcessId?: string; } /** @@ -257,6 +261,8 @@ export interface ProcessNodeSubProcess { createTime: number; finishTime: number; instances: ProcessNodeSubProcessInstance[]; + /** 是否已被重置取代(历史聚合组,仅保留审计用途)。 */ + superseded?: boolean; } /**