自定义表单二次开发 === 自定义表单的页面和业务逻辑增强采用JS增强和Java增强实现。![输入图片说明](https://static.oschina.net/uploads/img/201804/23191923_hyio.png "在这里输入图片标题") ### 1.JS增强 功能说明: JS增强通过写JS方法可以对页面表单效果进行任意处理,比如弹出提示信息。 代码示例一:alert('hello jeecgjs增强'); ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192009_M9WO.png "在这里输入图片标题") 演示效果:(JS注入到表单页面中执行) ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192040_X8BI.png "在这里输入图片标题") ### 2.Java增强 ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192132_h4ZV.png "在这里输入图片标题") 通过此功能可在自定义表单的增加、修改数据时实现额外的功能,类似spring中的后置通知。 首先,实现AutoFormEnhanceJavaInter接口,execute方法将被调用,其参数为表单数据。例如,定义如下类: ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192205_ZKpx.png "在这里输入图片标题") 点击java增强 ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192234_gV61.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201804/23192256_QSUd.png "在这里输入图片标题") 表单编辑时便调用execute方法,如下: ``` [2017-04-24 18:48:25] [INFO] [org.jeecgframework.core.util.LogUtil:228] [org.jeecgframework.web.autoform.enhance.AutoFormJavaInterDemo:execute():21] ============调用[java增强]成功!========map=== {param=[{id=4028138151aef50c0151aef50c260000, op=update, formName=employee_entry_form, updateForm=}], ds=[{manager_opinion=同意!, depart_op_user=部门领导, employee_op_user=张三, manager_op_date=2015-12-17, employee_mail=zhangsan@jeecg.com, employee_birthday=2010-12-17, hr_other=1, employee_msn=zhangsan@jeecg.cm, depart_op_date=2015-12-17, employee_name=张三, create_date=2017-04-24 18:48:25, ID=4028138151aef50c0151aef50c260000, depart_opinion=同意!, hr_degree=Y, hr_tel=2, employee_job=java开发, employee_identification=111111111111111, employee_origin=北京, employee_code=U0000001, employee_phone=18500000000, employee_opinion=努力工作!, employee_op_date=2015-12-17, hr_op_user=hr, employee_degree=本科, hr_archives=N, hr_op_date=2015-12-17, manager_op_user=总经理领导, hr_identification=Y, employee_entry_date=2015-12-17, employee_depart=技术}]} ```