|
| 1 | +# 界面拓展机制 |
| 2 | + |
| 3 | +支持流程组件对各类业务层面内容的界面拓展机制。 |
| 4 | + |
| 5 | +## 实现方式 |
| 6 | + |
| 7 | +``` |
| 8 | +import {ViewBindPlugin} from "@flow-engine/flow-core"; |
| 9 | +
|
| 10 | +// 界面视图 |
| 11 | +const MyView:React.FC<FormViewProps> = (props)=>{ |
| 12 | + return ( |
| 13 | + <></> |
| 14 | + ) |
| 15 | +} |
| 16 | +
|
| 17 | +// 注册,关键信息为key 和 界面ComponentType,传递的属性根据不同的界面对应查看 |
| 18 | +ViewBindPlugin.getInstance().register('MyView',MyView) |
| 19 | +``` |
| 20 | + |
| 21 | +## 拓展界面 |
| 22 | + |
| 23 | +### 流程审核 |
| 24 | + |
| 25 | +* 表单渲染 |
| 26 | +``` |
| 27 | +export interface FormViewProps { |
| 28 | + /** 表单操控对象 */ |
| 29 | + form: FormInstance; |
| 30 | + /** 表单数据更新事件 */ |
| 31 | + onValuesChange?: (values: any) => void; |
| 32 | + /** 表单元数据对象 */ |
| 33 | + meta: FlowForm; |
| 34 | + /** 是否预览模式 */ |
| 35 | + review:boolean; |
| 36 | +} |
| 37 | +
|
| 38 | +``` |
| 39 | +表单选择的key对应流程节点设置的view名称,流程引擎对default进行了模型的渲染支持。 |
| 40 | + |
| 41 | +* 流程操作 加签 |
| 42 | + |
| 43 | +``` |
| 44 | +export const VIEW_KEY = 'AddAuditViewPlugin'; |
| 45 | +
|
| 46 | +export interface AddAuditViewPlugin { |
| 47 | + /** 返回用户 */ |
| 48 | + onChange?: (value: string|string[]) => void; |
| 49 | + /** 当前用户 */ |
| 50 | + value?: string|string[]; |
| 51 | +} |
| 52 | +``` |
| 53 | +* 流程操作 委派 |
| 54 | +``` |
| 55 | +export const VIEW_KEY = 'DelegateViewPlugin'; |
| 56 | +
|
| 57 | +export interface DelegateViewPlugin { |
| 58 | + /** 返回用户 */ |
| 59 | + onChange?: (value: string|string[]) => void; |
| 60 | + /** 当前用户 */ |
| 61 | + value?: string|string[]; |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +* 流程操作 退回流程 |
| 66 | +``` |
| 67 | +export const VIEW_KEY = 'ReturnViewPlugin'; |
| 68 | +
|
| 69 | +export interface ReturnViewPlugin { |
| 70 | + /** 返回用户 */ |
| 71 | + onChange?: (value: string|string[]) => void; |
| 72 | + /** 当前用户 */ |
| 73 | + value?: string|string[]; |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +* 流程操作 提交时的获取签名界面 |
| 78 | +``` |
| 79 | +import {FlowOperator} from "@flow-engine/flow-types"; |
| 80 | +
|
| 81 | +export const VIEW_KEY = 'SignKeyViewPlugin'; |
| 82 | +
|
| 83 | +export interface SignKeyViewPlugin { |
| 84 | + /** 当前用户 */ |
| 85 | + current: FlowOperator; |
| 86 | + /** 返回签名 */ |
| 87 | + onChange?: (value: string) => void; |
| 88 | + /** 当前签名 */ |
| 89 | + value?: string; |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +* 流程操作 转办操作 |
| 94 | +``` |
| 95 | +export const VIEW_KEY = 'TransferViewPlugin'; |
| 96 | +
|
| 97 | +export interface TransferViewPlugin { |
| 98 | + /** 返回用户 */ |
| 99 | + onChange?: (value: string|string[]) => void; |
| 100 | + /** 当前用户 */ |
| 101 | + value?: string|string[]; |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +### 流程设计-节点配置 |
| 106 | + |
| 107 | +* 流程条件控制界面 |
| 108 | +``` |
| 109 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 110 | +
|
| 111 | +export const VIEW_KEY = 'ConditionViewPlugin'; |
| 112 | +
|
| 113 | +export interface ConditionViewPlugin { |
| 114 | + /** 脚本类型 */ |
| 115 | + type: ScriptType; |
| 116 | + /** 当前脚本 */ |
| 117 | + script: string; |
| 118 | + /** 变量映射列表 */ |
| 119 | + variables: GroovyVariableMapping[]; |
| 120 | + /** 确认回调 */ |
| 121 | + onChange: (script: string) => void; |
| 122 | +} |
| 123 | +``` |
| 124 | + |
| 125 | +* 异常处理逻辑界面 |
| 126 | +``` |
| 127 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 128 | +
|
| 129 | +export const VIEW_KEY = 'ErrorTriggerViewPlugin'; |
| 130 | +
|
| 131 | +export interface ErrorTriggerViewPlugin { |
| 132 | + /** 脚本类型 */ |
| 133 | + type: ScriptType; |
| 134 | + /** 当前脚本 */ |
| 135 | + script: string; |
| 136 | + /** 变量映射列表 */ |
| 137 | + variables: GroovyVariableMapping[]; |
| 138 | + /** 确认回调 */ |
| 139 | + onChange: (script: string) => void; |
| 140 | +} |
| 141 | +``` |
| 142 | + |
| 143 | +* 自定义标题界面 |
| 144 | +``` |
| 145 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 146 | +
|
| 147 | +export const VIEW_KEY = 'NodeTitleViewPlugin'; |
| 148 | +
|
| 149 | +export interface NodeTitleViewPlugin { |
| 150 | + /** 脚本类型 */ |
| 151 | + type: ScriptType; |
| 152 | + /** 当前脚本 */ |
| 153 | + script: string; |
| 154 | + /** 变量映射列表 */ |
| 155 | + variables: GroovyVariableMapping[]; |
| 156 | + /** 确认回调 */ |
| 157 | + onChange: (script: string) => void; |
| 158 | +} |
| 159 | +``` |
| 160 | + |
| 161 | +* 设置发起人范围界面 |
| 162 | + |
| 163 | +``` |
| 164 | +export const VIEW_KEY = 'OperatorCreateViewPlugin'; |
| 165 | +
|
| 166 | +export interface OperatorCreateViewPlugin { |
| 167 | + /** 当前脚本 */ |
| 168 | + script: string; |
| 169 | + /** 确认回调 */ |
| 170 | + onChange: (script: string) => void; |
| 171 | +} |
| 172 | +``` |
| 173 | + |
| 174 | +* 节点人员选择界面 |
| 175 | + |
| 176 | +``` |
| 177 | +export const VIEW_KEY = 'OperatorLoadViewPlugin'; |
| 178 | +
|
| 179 | +export interface OperatorLoadViewPlugin { |
| 180 | + /** 当前脚本 */ |
| 181 | + script: string; |
| 182 | + /** 确认回调 */ |
| 183 | + onChange: (script: string) => void; |
| 184 | +} |
| 185 | +``` |
| 186 | +* 路由配置界面 |
| 187 | + |
| 188 | +``` |
| 189 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 190 | +
|
| 191 | +export const VIEW_KEY = 'RouterViewPlugin'; |
| 192 | +
|
| 193 | +export interface RouterViewPlugin { |
| 194 | + /** 脚本类型 */ |
| 195 | + type: ScriptType; |
| 196 | + /** 当前脚本 */ |
| 197 | + script: string; |
| 198 | + /** 变量映射列表 */ |
| 199 | + variables: GroovyVariableMapping[]; |
| 200 | + /** 确认回调 */ |
| 201 | + onChange: (script: string) => void; |
| 202 | +} |
| 203 | +``` |
| 204 | +* 子流程配置界面 |
| 205 | +``` |
| 206 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 207 | +
|
| 208 | +export const VIEW_KEY = 'SubProcessViewPlugin'; |
| 209 | +
|
| 210 | +export interface SubProcessViewPlugin { |
| 211 | + /** 脚本类型 */ |
| 212 | + type: ScriptType; |
| 213 | + /** 当前脚本 */ |
| 214 | + script: string; |
| 215 | + /** 变量映射列表 */ |
| 216 | + variables: GroovyVariableMapping[]; |
| 217 | + /** 确认回调 */ |
| 218 | + onChange: (script: string) => void; |
| 219 | +} |
| 220 | +``` |
| 221 | +* 触发流程界面 |
| 222 | +``` |
| 223 | +import {GroovyVariableMapping, ScriptType} from "@/components/script/typings"; |
| 224 | +
|
| 225 | +export const VIEW_KEY = 'TriggerViewPlugin'; |
| 226 | +
|
| 227 | +export interface TriggerViewPlugin { |
| 228 | + /** 脚本类型 */ |
| 229 | + type: ScriptType; |
| 230 | + /** 当前脚本 */ |
| 231 | + script: string; |
| 232 | + /** 变量映射列表 */ |
| 233 | + variables: GroovyVariableMapping[]; |
| 234 | + /** 确认回调 */ |
| 235 | + onChange: (script: string) => void; |
| 236 | +} |
| 237 | +``` |
| 238 | + |
| 239 | +### 流程设计-动作配置 |
| 240 | + |
| 241 | +* 自定义按钮触发脚本界面 |
| 242 | +``` |
| 243 | +import {ActionSelectOption} from "@/components/script/typings"; |
| 244 | +
|
| 245 | +export const VIEW_KEY = 'ConditionCustomViewPlugin'; |
| 246 | +
|
| 247 | +export interface ConditionCustomViewPlugin { |
| 248 | + // 当前的脚本 |
| 249 | + value?: string; |
| 250 | + // 脚本更改回掉 |
| 251 | + onChange?: (value: string) => void; |
| 252 | + // 可选择的动作范围 |
| 253 | + options:ActionSelectOption[]; |
| 254 | +} |
| 255 | +``` |
| 256 | + |
| 257 | +* 拒绝动作界面 |
| 258 | +``` |
| 259 | +export const VIEW_KEY = 'ConditionRejectViewPlugin'; |
| 260 | +
|
| 261 | +export interface ConditionRejectViewPlugin { |
| 262 | + // 当前节点id |
| 263 | + nodeId:string; |
| 264 | + // 当前的脚本 |
| 265 | + value?: string; |
| 266 | + // 脚本更改回掉 |
| 267 | + onChange?: (value: string) => void; |
| 268 | +} |
| 269 | +``` |
| 270 | + |
| 271 | +* 委派/转办/加签/界面 与(节点人员选择界面一致) |
| 272 | +``` |
| 273 | +export const VIEW_KEY = 'OperatorLoadViewPlugin'; |
| 274 | +
|
| 275 | +export interface OperatorLoadViewPlugin { |
| 276 | + /** 当前脚本 */ |
| 277 | + script: string; |
| 278 | + /** 确认回调 */ |
| 279 | + onChange: (script: string) => void; |
| 280 | +} |
| 281 | +``` |
0 commit comments