feat(workflow): add workflow engine module (Phase 4)

Implement complete workflow engine with BPMN subset support:

Backend (erp-workflow crate):
- Token-driven execution engine with exclusive/parallel gateway support
- BPMN parser with flow graph validation
- Expression evaluator for conditional branching
- Process definition CRUD with draft/publish lifecycle
- Process instance management (start, suspend, terminate)
- Task service (pending, complete, delegate)
- PostgreSQL advisory locks for concurrent safety
- 5 database tables: process_definitions, process_instances,
  tokens, tasks, process_variables
- 13 API endpoints with RBAC protection
- Timeout checker framework (placeholder)

Frontend:
- Workflow page with 4 tabs (definitions, pending, completed, monitor)
- React Flow visual process designer (@xyflow/react)
- Process viewer with active node highlighting
- 3 API client modules for workflow endpoints
- Sidebar menu integration
This commit is contained in:
iven
2026-04-11 09:54:02 +08:00
parent 0cbd08eb78
commit 91ecaa3ed7
51 changed files with 4826 additions and 12 deletions

View File

@@ -0,0 +1,25 @@
import { useState } from 'react';
import { Tabs } from 'antd';
import ProcessDefinitions from './workflow/ProcessDefinitions';
import PendingTasks from './workflow/PendingTasks';
import CompletedTasks from './workflow/CompletedTasks';
import InstanceMonitor from './workflow/InstanceMonitor';
export default function Workflow() {
const [activeKey, setActiveKey] = useState('definitions');
return (
<div style={{ padding: 24 }}>
<Tabs
activeKey={activeKey}
onChange={setActiveKey}
items={[
{ key: 'definitions', label: '流程定义', children: <ProcessDefinitions /> },
{ key: 'pending', label: '我的待办', children: <PendingTasks /> },
{ key: 'completed', label: '我的已办', children: <CompletedTasks /> },
{ key: 'instances', label: '流程监控', children: <InstanceMonitor /> },
]}
/>
</div>
);
}