@@ -97,24 +97,36 @@ export class FlowData extends FlowWorkData {
9797 this . formParams = formParams ;
9898 }
9999
100+ // 是否可以审批
100101 canHandle = ( ) => {
101102 return this . data . canHandle ;
102103 }
103104
105+ // 是否是开始节点
104106 isStartFlow = ( ) => {
105107 if ( this . data ) {
106108 return this . data . flowNode . startNode ;
107109 }
108110 return false ;
109111 }
110112
113+ // 获取当前节点的code
114+ getNodeCode = ( ) => {
115+ if ( this . data ) {
116+ return this . data . flowNode . code ;
117+ }
118+ return null ;
119+ }
120+
121+ // 获取当前节点的按钮
111122 getNodeButtons = ( ) => {
112123 if ( this . data ) {
113124 return this . data . flowNode . buttons ;
114125 }
115126 return null ;
116127 }
117128
129+ // 获取当前节点的标题
118130 getCurrentNodeTitle = ( ) => {
119131 if ( this . data ) {
120132 const node = this . data . flowNode ;
@@ -125,6 +137,7 @@ export class FlowData extends FlowWorkData {
125137 return null ;
126138 }
127139
140+ // 获取当前节点的视图 (内部使用)
128141 getFlowFormView ( view : React . ComponentType < FlowFormViewProps > | FlowFormView ) {
129142 if ( typeof view === 'object' ) {
130143 const nodeView = this . data . flowNode . view ;
@@ -133,7 +146,7 @@ export class FlowData extends FlowWorkData {
133146 return view ;
134147 }
135148
136-
149+ // 获取当前节点是否可编辑
137150 getFlowNodeEditable = ( ) => {
138151 if ( this . data ) {
139152 const node = this . data . flowNode ;
@@ -144,14 +157,15 @@ export class FlowData extends FlowWorkData {
144157 return false
145158 }
146159
160+ // 获取当前节点的表单数据
147161 getFlowData = ( ) => {
148162 return {
149163 ...this . data . bindData ,
150164 ...this . formParams
151165 }
152166 }
153167
154-
168+ // 获取当前节点的表单数据 (内部使用)
155169 getNodeState = ( code : string ) => {
156170 const historyRecords = this . data . historyRecords || [ ] ;
157171
@@ -160,9 +174,9 @@ export class FlowData extends FlowWorkData {
160174 return "done" ;
161175 }
162176
163- for ( const record of historyRecords ) {
164- if ( record . nodeCode === code ) {
165- if ( record . flowType === 'TODO' ) {
177+ for ( const record of historyRecords ) {
178+ if ( record . nodeCode === code ) {
179+ if ( record . flowType === 'TODO' ) {
166180 return "wait" ;
167181 }
168182 return "done" ;
@@ -172,6 +186,7 @@ export class FlowData extends FlowWorkData {
172186 return "wait" ;
173187 }
174188
189+ // 获取当前节点的流程图
175190 getFlowSchema = ( ) => {
176191
177192 if ( this . data . flowWork . schema ) {
@@ -186,39 +201,46 @@ export class FlowData extends FlowWorkData {
186201 return null ;
187202 }
188203
204+ // 是否存在数据
189205 hasData ( ) {
190206 return ! ! this . data ;
191207 }
192208
209+ // 获取当前的详情的记录数据
193210 getCurrentFlowRecord = ( ) => {
194211 return this . data . flowRecord ;
195212 }
196213
214+ // 获取历史记录
197215 getHistoryRecords = ( ) => {
198216 return this . data . historyRecords ;
199217 }
200218
219+ // 是否是审批完成
201220 isDone ( ) {
202221 if ( this . data . flowRecord ) {
203222 return this . data . flowRecord . flowStatus === 'FINISH' || this . data . flowRecord . flowType === 'DONE' ;
204223 }
205224 return false ;
206225 }
207226
227+ // 是否是结束节点
208228 private isFinished ( ) {
209229 if ( this . data . flowRecord ) {
210230 return this . data . flowRecord . flowStatus === 'FINISH' ;
211231 }
212232 return false ;
213233 }
214234
235+ // 是否需要展示流转记录 (内部使用)
215236 showHistory ( ) {
216- if ( this . isDone ( ) ) {
237+ if ( this . isDone ( ) ) {
217238 return true ;
218239 }
219240 return ! this . isStartFlow ( ) ;
220241 }
221242
243+ // 是否展示审批意见 (内部使用)
222244 showOpinion ( ) {
223245 return this . canHandle ( ) && ! this . isStartFlow ( ) ;
224246 }
0 commit comments