edit.jsp 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <#import "function.ftl" as func>
  2. <#assign class=model.variables.class>
  3. <#assign tabcomment=model.tabComment>
  4. <#assign classVar=model.variables.classVar>
  5. <#assign system=vars.system>
  6. <#assign package=model.variables.package>
  7. <#assign commonList=model.commonList>
  8. <#assign pk=func.getPk(model) >
  9. <#assign pkVar=func.convertUnderLine(pk) >
  10. <#assign subtables=model.subTableList>
  11. <%--
  12. time:${date?string("yyyy-MM-dd HH:mm:ss")}
  13. desc:edit the ${tabcomment}
  14. --%>
  15. <%@page language="java" pageEncoding="UTF-8"%>
  16. <%@include file="/commons/include/html_doctype.html"%>
  17. <html>
  18. <head>
  19. <title>编辑 ${tabcomment}</title>
  20. <%@include file="/commons/include/form.jsp" %>
  21. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/CustomValid.js"></script>
  22. <#if subtables?exists && subtables?size!=0>
  23. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/formdata.js"></script>
  24. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/subform.js"></script>
  25. </#if>
  26. <#if model.variables.flowKey?exists>
  27. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/platform/bpm/FlowDetailWindow.js"></script>
  28. </#if>
  29. <script type="text/javascript">
  30. $(function() {
  31. $("a.save").click(function() {
  32. $("#${classVar}Form").attr("action","save.ht");
  33. $("#saveData").val(1);
  34. submitForm();
  35. });
  36. <#if model.variables.flowKey?exists>
  37. $("a.run").click(function() {
  38. $("#${classVar}Form").attr("action","run.ht");
  39. $("#saveData").val(0);
  40. submitForm();
  41. });
  42. </#if>
  43. });
  44. //提交表单
  45. function submitForm(){
  46. var options={};
  47. if(showResponse){
  48. options.success=showResponse;
  49. }
  50. var frm=$('#${classVar}Form').form();
  51. frm.ajaxForm(options);
  52. if(frm.valid()){
  53. <#if subtables?exists && subtables?size!=0>
  54. frm.sortList();
  55. </#if>
  56. frm.submit();
  57. }
  58. }
  59. function showResponse(responseText) {
  60. var obj = new com.hotent.form.ResultMessage(responseText);
  61. if(!obj.isSuccess()){
  62. $.ligerDialog.err("提示信息"," ${tabcomment}保存失败!",obj.getMessage());
  63. return;
  64. }
  65. $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  66. if(rtn){
  67. window.location.href = window.location.href;
  68. }else{
  69. window.location.href = "<#noparse>${ctx}</#noparse>/${system}/${package}/${classVar}/list.ht";
  70. }
  71. });
  72. }
  73. </script>
  74. </head>
  75. <body>
  76. <div class="panel">
  77. <div class="panel-top">
  78. <div class="tbar-title">
  79. <c:choose>
  80. <c:when test="<#noparse>${</#noparse>${classVar}.${pkVar} !=null}">
  81. <span class="tbar-label"><span></span>编辑${tabcomment}</span>
  82. </c:when>
  83. <c:otherwise>
  84. <span class="tbar-label"><span></span>添加${tabcomment}</span>
  85. </c:otherwise>
  86. </c:choose>
  87. </div>
  88. <div class="panel-toolbar">
  89. <div class="toolBar">
  90. <div class="group"><a class="link save" id="dataFormSave" href="#"><span></span>保存</a></div>
  91. <div class="l-bar-separator"></div>
  92. <#if model.variables.flowKey?exists>
  93. <c:if test="<#noparse>${</#noparse>runId==0}">
  94. <div class="group"><a class="link run" href="#"><span></span>提交</a></div>
  95. <div class="l-bar-separator"></div>
  96. </c:if>
  97. <c:if test="<#noparse>${</#noparse>runId!=0}">
  98. <div class="group"><a class="link detail" onclick="FlowDetailWindow({runId:<#noparse>${</#noparse>runId}})"" href="#"><span></span>流程明细</a></div>
  99. <div class="l-bar-separator"></div>
  100. </c:if>
  101. </#if>
  102. <div class="group"><a class="link back" href="list.ht"><span></span>返回</a></div>
  103. </div>
  104. </div>
  105. </div>
  106. <div class="panel-body">
  107. <form id="${classVar}Form" method="post" action="save.ht">
  108. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
  109. <#list commonList as col>
  110. <#assign colName=func.convertUnderLine(col.columnName)>
  111. <#if (col.colType=="java.util.Date") >
  112. <tr>
  113. <th width="20%">${col.comment}: <#if (col.isNotNull) > <span class="required">*</span></#if></th>
  114. <td><input type="text" id="${colName}" name="${colName}" value="<fmt:formatDate value='<#noparse>${</#noparse>${classVar}.${colName}}' pattern='yyyy-MM-dd'/>" class="inputText date" validate="{date:true<#if col.isNotNull>,required:true</#if>}" /></td>
  115. </tr>
  116. <#else>
  117. <tr>
  118. <th width="20%">${col.comment}: <#if (col.isNotNull) > <span class="required">*</span></#if></th>
  119. <td><input type="text" id="${colName}" name="${colName}" value="<#noparse>${</#noparse>${classVar}.${colName}}" class="inputText" validate="{<#if col.isNotNull>required:true<#else>required:false</#if><#if col.colType=='String'&& col.length<1000>,maxlength:${col.length}</#if><#if col.colType=='Integer'|| col.colType=='Long'||col.colType=='Float'>,number:true<#if col.scale!=0>,maxDecimalLen:${col.scale}</#if><#if col.precision!=0>,maxIntLen:${col.precision}</#if></#if>}" /></td>
  120. </tr>
  121. </#if>
  122. </#list>
  123. </table>
  124. <#if subtables?exists && subtables?size != 0>
  125. <#list subtables as table>
  126. <#assign foreignKey=func.convertUnderLine(table.foreignKey) >
  127. <table class="table-grid table-list" cellpadding="1" cellspacing="1" id="${table.variables.classVar}" formtype="form" type="subtable">
  128. <tr>
  129. <td colspan="${table.columnList?size-1}">
  130. <div class="group" align="left">
  131. <a id="btnAdd" class="link add">添加</a>
  132. </div>
  133. <div align="center">
  134. <#if table.tabComment?exists>${table.tabComment}<#else>${table.tableName}</#if>
  135. </div>
  136. </td>
  137. </tr>
  138. <tr>
  139. <#list table.columnList as col>
  140. <#assign colName=func.convertUnderLine(col.columnName?lower_case)>
  141. <#if !(col.isPK)&& colName?lower_case!=(foreignKey)?lower_case>
  142. <th>${col.comment}</th>
  143. </#if>
  144. </#list>
  145. </tr>
  146. <c:forEach items="<#noparse>${</#noparse>${table.variables.classVar}List}" var="${table.variables.classVar}Item" varStatus="status">
  147. <tr type="subdata">
  148. <#list table.columnList as col>
  149. <#assign colName=func.convertUnderLine(col.columnName)>
  150. <#if ( !col.isPK && colName?lower_case!=foreignKey?lower_case)>
  151. <#if (col.colType=="java.util.Date")>
  152. <td style="text-align: center" name="${colName}"><fmt:formatDate value='<#noparse>${</#noparse>${table.variables.classVar}Item.${colName}}' pattern='yyyy-MM-dd'/></td>
  153. <#else >
  154. <td style="text-align: center" name="${colName}"><#noparse>${</#noparse>${table.variables.classVar}Item.${colName}}</td>
  155. </#if>
  156. </#if>
  157. </#list>
  158. <#list table.columnList as col>
  159. <#assign colName=func.convertUnderLine(col.columnName)>
  160. <#if ( !col.isPK && colName?lower_case!=foreignKey?lower_case)>
  161. <#if (col.colType=="java.util.Date")>
  162. <input type="hidden" name="${colName}" value="<fmt:formatDate value='<#noparse>${</#noparse>${table.variables.classVar}Item.${colName}}' pattern='yyyy-MM-dd'/>" class="inputText date"/>
  163. <#else >
  164. <input type="hidden" name="${colName}" value="<#noparse>${</#noparse>${table.variables.classVar}Item.${colName}}"/>
  165. </#if>
  166. </#if>
  167. </#list>
  168. </tr>
  169. </c:forEach>
  170. <tr type="append">
  171. <#list table.columnList as col>
  172. <#assign colName=func.convertUnderLine(col.columnName)>
  173. <#assign foreignKey=func.convertUnderLine(table.foreignKey) >
  174. <#if ( !col.isPK && colName?lower_case!=foreignKey?lower_case)>
  175. <#if (col.colType=="java.util.Date")>
  176. <td style="text-align: center" name="${colName}"></td>
  177. <#else >
  178. <td style="text-align: center" name="${colName}"></td>
  179. </#if>
  180. </#if>
  181. </#list>
  182. <#list table.columnList as col>
  183. <#assign colName=func.convertUnderLine(col.columnName)>
  184. <#assign foreignKey=func.convertUnderLine(table.foreignKey) >
  185. <#if ( !col.isPK && colName?lower_case!=foreignKey?lower_case)>
  186. <#if (col.colType=="java.util.Date")>
  187. <input type="hidden" name="${colName}" value="" class="inputText date"/>
  188. <#else >
  189. <input type="hidden" name="${colName}" value=""/>
  190. </#if>
  191. </#if>
  192. </#list>
  193. </tr>
  194. </table>
  195. </#list>
  196. </#if>
  197. <input type="hidden" name="${pkVar}" value="<#noparse>${</#noparse>${classVar}.${pkVar}<#noparse>}</#noparse>" />
  198. <input type="hidden" name="saveData" id="saveData" />
  199. <input type="hidden" name="executeType" value="start" />
  200. </form>
  201. </div>
  202. <#if subtables?exists && subtables?size != 0>
  203. <#list subtables as table>
  204. <#assign foreignKey=func.convertUnderLine(table.foreignKey) >
  205. <form id="${table.variables.classVar}Form" style="display:none" title="<#if table.tabComment?exists>${table.tabComment }<#else>${table.tableName }</#if>">
  206. <table class="table-detail" cellpadding="0" cellspacing="0" border="0">
  207. <#list table.columnList as col>
  208. <#assign colName=func.convertUnderLine(col.columnName)>
  209. <#if !col.isPK && colName?lower_case!=foreignKey?lower_case>
  210. <#if (col.colType=="java.util.Date")>
  211. <tr>
  212. <th width="20%">${col.comment}: <#if col.isNotNull> <span class="required">*</span></#if></th>
  213. <td><input type="text" name="${colName}" value="" class="inputText date" validate="{date:true<#if col.isNotNull>,required:true</#if>}"/></td>
  214. </tr>
  215. <#else>
  216. <tr>
  217. <th width="20%">${col.comment}: <#if col.isNotNull> <span class="required">*</span></#if></th>
  218. <td><input type="text" name="${colName}" value="" class="inputText" validate="{<#if col.isNotNull>required:true<#else>required:false</#if><#if col.colType=='String' && col.length<1000>,maxlength:${col.length}</#if><#if col.colType=='Integer'|| col.colType=='Long'||col.colType=='Float'>,number:true<#if col.scale!=0>,maxDecimalLen:${col.scale}</#if><#if col.precision!=0>,maxIntLen:${col.precision}</#if> </#if>}"/></td>
  219. </tr>
  220. </#if>
  221. </#if>
  222. </#list>
  223. </table>
  224. </form>
  225. </#list>
  226. </#if>
  227. </div>
  228. </body>
  229. </html>