diff --git a/src/commands/workflow/_webapi_helpers.ts b/src/commands/workflow/_webapi_helpers.ts index e7ca83b..01dda33 100644 --- a/src/commands/workflow/_webapi_helpers.ts +++ b/src/commands/workflow/_webapi_helpers.ts @@ -95,12 +95,36 @@ export const defaultGlobalForm: Record = { export function parseFlowXml(flowXml: string): Record> { const nodes: Record> = {} - // 匹配 bpmn2:startEvent / userTask / endEvent 节点 - // 形如: - const nodeRegex = /]*>/g + // v0.15+ (P1-6): 跨行匹配 + 加 4 种 gateway 节点 + // 旧版 [\s\S]*? 改 [\s\S]* (单行) → 跨行也匹配 (JNPF FlowXmlUtil 输出 BPMN 经常带换行缩进) + // 旧版仅 startEvent|userTask|endEvent → 加 parallelGateway/inclusiveGateway/exclusiveGateway/eventGateway + // 网关节点类型: 'gateway' (web FlowXmlUtil 不细分, 后端 save 时 flowable 启动器按 type 区分) + // parallelGateway → type='parallel' (并行, 全部通过) + // inclusiveGateway → type='inclusive' (包容, 至少一个) + // exclusiveGateway → type='exclusive' (排他, 唯一一个) + // eventGateway → type='event' (事件网关) + // 形如: + const nodeRegex = /]*>/g let match: RegExpExecArray | null while ((match = nodeRegex.exec(flowXml)) !== null) { const [, tagType, nodeId, nodeName = ''] = match + // 网关节点特殊处理 (P1-6) + if (tagType === 'parallelGateway') { + nodes[nodeId] = { nodeId, type: 'parallel', nodeName: nodeName || '并行网关' } + continue + } + if (tagType === 'inclusiveGateway') { + nodes[nodeId] = { nodeId, type: 'inclusive', nodeName: nodeName || '包容网关' } + continue + } + if (tagType === 'exclusiveGateway') { + nodes[nodeId] = { nodeId, type: 'exclusive', nodeName: nodeName || '排他网关' } + continue + } + if (tagType === 'eventGateway') { + nodes[nodeId] = { nodeId, type: 'event', nodeName: nodeName || '事件网关' } + continue + } if (tagType === 'startEvent') { nodes[nodeId] = { nodeId,