@@ -7,6 +7,7 @@ import {FlowUser} from "@/components/flow/types";
7
7
import { FlowSubmitResultParser } from "@/components/flow/domain/FlowResultParser" ;
8
8
import { UserSelectMode } from "@/components/flow/store/FlowSlice" ;
9
9
import { FlowTriggerContext } from "@/components/flow/domain/FlowTriggerContext" ;
10
+ import FormInstance from "@/components/form/domain/FormInstance" ;
10
11
11
12
/**
12
13
* 流程的事件控制上下文对象
@@ -15,28 +16,28 @@ export class FlowEventContext {
15
16
16
17
private readonly flowRecordContext : FlowRecordContext ;
17
18
private readonly flowTriggerContext : FlowTriggerContext ;
18
- private readonly flowAction : React . RefObject < FormAction > ;
19
- private readonly opinionAction : React . RefObject < FormAction > ;
19
+ private readonly flowInstance : FormInstance ;
20
+ private readonly opinionInstance : FormInstance ;
20
21
private readonly flowStateContext : FlowStateContext ;
21
22
22
23
constructor ( flowViewContext : FlowRecordContext ,
23
24
flowTriggerContext :FlowTriggerContext ,
24
- flowAction : React . RefObject < FormAction > ,
25
- opinionAction : React . RefObject < FormAction > ,
25
+ flowInstance : FormInstance ,
26
+ opinionInstance : FormInstance ,
26
27
flowStateContext : FlowStateContext ) {
27
28
this . flowRecordContext = flowViewContext ;
28
29
this . flowTriggerContext = flowTriggerContext ;
29
- this . flowAction = flowAction ;
30
- this . opinionAction = opinionAction ;
30
+ this . flowInstance = flowInstance ;
31
+ this . opinionInstance = opinionInstance ;
31
32
this . flowStateContext = flowStateContext ;
32
33
}
33
34
34
35
private getRequestBody = ( ) => {
35
- const formData = this . flowAction . current ? .getFieldsValue ( ) ;
36
+ const formData = this . opinionInstance . getFieldsValue ( ) ;
36
37
const flowData = this . flowRecordContext . getFlowFormParams ( ) ;
37
38
const workCode = this . flowRecordContext . getWorkCode ( ) ;
38
39
const recordId = this . flowStateContext . getRecordId ( ) ;
39
- const advice = this . opinionAction . current ? .getFieldsValue ( ) ;
40
+ const advice = this . opinionInstance . getFieldsValue ( ) ;
40
41
41
42
return {
42
43
recordId,
@@ -51,8 +52,8 @@ export class FlowEventContext {
51
52
52
53
53
54
private validateForm = async ( ) => {
54
- const formState = await this . flowAction . current ? .validate ( ) ;
55
- const opinionState = await this . opinionAction . current ? .validate ( ) ;
55
+ const formState = await this . flowInstance . validate ( ) ;
56
+ const opinionState = await this . opinionInstance . validate ( ) ;
56
57
return formState && opinionState ;
57
58
}
58
59
0 commit comments