@@ -4,6 +4,8 @@ import {Form, Input, message, Modal} from "antd";
44import { useApprovalContext } from "@coding-flow/flow-approval-presenter" ;
55import { SignKeyView } from "@/plugins/view/sign-key-view" ;
66import { CustomStyleButton } from "@/components/flow-approval/components/custom-style-button" ;
7+ import { NodeOption } from "@coding-flow/flow-types" ;
8+ import { ManualView } from "@/plugins/view/manual-view" ;
79
810const { TextArea} = Input ;
911
@@ -20,6 +22,10 @@ export const PassAction: React.FC<FlowActionProps> = (props) => {
2022
2123 const [ modalVisible , setModalVisible ] = React . useState ( false ) ;
2224
25+ const [ options , setOptions ] = React . useState < NodeOption [ ] > ( [ ] ) ;
26+
27+ const [ request , setRequest ] = React . useState < any > ( { } ) ;
28+
2329 const isStartNode = state . flow ?. nodeType === 'START' ;
2430
2531 const currentOperator = state . flow ?. currentOperator ;
@@ -29,9 +35,15 @@ export const PassAction: React.FC<FlowActionProps> = (props) => {
2935 const handleSubmit = ( params ?: any ) => {
3036 actionPresenter . action ( action . id , params ) . then ( ( res ) => {
3137 if ( res . success ) {
32- message . success ( "操作成功" ) ;
33- setModalVisible ( false ) ;
34- context . close ( ) ;
38+ const options = res . data ?. options || [ ] ;
39+ if ( options . length > 0 ) {
40+ setRequest ( params ) ;
41+ setOptions ( options ) ;
42+ } else {
43+ message . success ( "操作成功" ) ;
44+ setModalVisible ( false ) ;
45+ context . close ( ) ;
46+ }
3547 }
3648 } ) ;
3749 }
@@ -108,6 +120,23 @@ export const PassAction: React.FC<FlowActionProps> = (props) => {
108120 </ Form >
109121
110122 </ Modal >
123+
124+
125+ { options && options . length > 0 && (
126+ < ManualView
127+ options = { options }
128+ onChange = { ( value ) => {
129+ setOptions ( [ ] ) ;
130+ if ( value ) {
131+ handleSubmit ( {
132+ ...request ,
133+ manualNodeId :value ,
134+ } ) ;
135+ }
136+ } }
137+ />
138+ ) }
139+
111140 </ >
112141 )
113142}
0 commit comments