@@ -29,6 +29,7 @@ import Geofence from './Geofence';
2929import Editor from './Editor' ;
3030import Cascader from './Cascader' ;
3131import Render from '@/components/Render' ;
32+ import { tplEngine } from '@/utils/template' ;
3233
3334const Field : React . FC < any > = ( props :any ) => {
3435
@@ -95,6 +96,7 @@ const Field : React.FC<any> = (props:any) => {
9596 addonAfter = { props . addonAfter }
9697 addonBefore = { props . addonBefore }
9798 size = { props . size }
99+ onChange = { ( e ) => { onChange ( e . target . value , props . name ) } }
98100 />
99101 </ Form . Item > ;
100102 break ;
@@ -118,6 +120,7 @@ const Field : React.FC<any> = (props:any) => {
118120 onKeyPress = { ( e ) => {
119121 e . stopPropagation ( ) ;
120122 } }
123+ onChange = { ( e ) => { onChange ( e . target . value , props . name ) } }
121124 />
122125 </ Form . Item > ;
123126 break ;
@@ -141,6 +144,7 @@ const Field : React.FC<any> = (props:any) => {
141144 max = { props . max }
142145 step = { props . step }
143146 precision = { props . precision }
147+ onChange = { ( value ) => { onChange ( value , props . name ) } }
144148 />
145149 </ Form . Item > ;
146150 break ;
@@ -191,6 +195,7 @@ const Field : React.FC<any> = (props:any) => {
191195 style = { props . style ? props . style : [ ] }
192196 options = { props . options }
193197 disabled = { props . disabled }
198+ onChange = { ( value ) => { onChange ( value , props . name ) } }
194199 />
195200 </ Form . Item > ;
196201 break ;
@@ -208,6 +213,7 @@ const Field : React.FC<any> = (props:any) => {
208213 style = { props . style ? props . style : [ ] }
209214 options = { props . options }
210215 disabled = { props . disabled }
216+ onChange = { ( e ) => { onChange ( e . target . value , props . name ) } }
211217 />
212218 </ Form . Item > ;
213219 break ;
@@ -271,6 +277,7 @@ const Field : React.FC<any> = (props:any) => {
271277 disabled = { props . disabled }
272278 checkedChildren = { props . options . on }
273279 unCheckedChildren = { props . options . off }
280+ onChange = { ( value ) => { onChange ( value , props . name ) } }
274281 />
275282 </ Form . Item > ;
276283 break ;
@@ -516,7 +523,9 @@ const Field : React.FC<any> = (props:any) => {
516523
517524 // 解析when
518525 if ( props . when ) {
519- return < > { component } < Render body = { props . when } data = { window [ props . data . formKey ] ?. getFieldsValue ( ) } callback = { props . callback } /> </ > ;
526+ let fieldData :any = { } ;
527+ fieldData [ props . name ] = window [ props . data . formKey ] ?. getFieldValue ( props . name ) ;
528+ return < > { component } < Render body = { props . when } data = { fieldData } callback = { props . callback } /> </ > ;
520529 } else {
521530 return component ;
522531 }
0 commit comments