pageEdit.jsp 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 package=model.variables.package>
  6. <#assign commonList=model.commonList>
  7. <#assign system=vars.system>
  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. <%@ taglib prefix="ht" tagdir="/WEB-INF/tags/wf"%>
  18. <html>
  19. <head>
  20. <title>编辑 ${tabcomment}</title>
  21. <%@include file="/commons/include/form.jsp" %>
  22. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/CustomValid.js"></script>
  23. <#if func.isSubTableExist( subtables)>
  24. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/formdata.js"></script>
  25. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/subform.js"></script>
  26. </#if>
  27. <#if func.supportFlow(model)>
  28. <script type="text/javascript" src="<#noparse>${ctx}</#noparse>/js/hotent/platform/bpm/BpmImageDialog.js"></script>
  29. </#if>
  30. <script type="text/javascript">
  31. var returnUrl="<#noparse>${returnUrl}</#noparse>";
  32. $(function() {
  33. <#--支持工作流 -->
  34. <#if func.supportFlow(model)>
  35. $("a.save").click(function() {
  36. $("#saveData").val(1);
  37. submitForm();
  38. });
  39. $("a.run").click(function() {
  40. $("#saveData").val(0);
  41. submitForm();
  42. });
  43. <#else>
  44. $("a.save").click(function() {
  45. submitForm();
  46. });
  47. </#if>
  48. });
  49. //提交表单
  50. function submitForm(){
  51. var options={};
  52. if(showResponse){
  53. options.success=showResponse;
  54. }
  55. var frm=$('#frmSubmit').form();
  56. frm.ajaxForm(options);
  57. if(frm.valid()){
  58. <#if func.isSubTableExist( subtables)>
  59. frm.sortList();
  60. </#if>
  61. frm.submit();
  62. }
  63. }
  64. function showResponse(responseText) {
  65. var obj = new com.hotent.form.ResultMessage(responseText);
  66. if (!obj.isSuccess()) {
  67. $.topCall.error(obj.getMessage(),"提示信息");
  68. return ;
  69. }
  70. $.topCall.success(obj.getMessage(),"提示信息", function(rtn) {
  71. if(rtn){
  72. if(window.opener){
  73. window.opener.location.reload();
  74. window.close();
  75. }else{
  76. this.close();
  77. window.location.href="list.ht";
  78. }
  79. }
  80. });
  81. }
  82. </script>
  83. </head>
  84. <body>
  85. <form id="frmSubmit" method="post" action="save.ht">
  86. <div class="panel">
  87. <div class="panel-top">
  88. <div class="tbar-title">
  89. <c:choose>
  90. <c:when test="<#noparse>${</#noparse>${classVar}.${pkVar} !=null}">
  91. <span class="tbar-label">编辑${tabcomment}</span>
  92. </c:when>
  93. <c:otherwise>
  94. <span class="tbar-label">添加${tabcomment}</span>
  95. </c:otherwise>
  96. </c:choose>
  97. </div>
  98. <div class="panel-toolbar">
  99. <div class="toolBar">
  100. <ht:incToolBar ></ht:incToolBar>
  101. <div class="group"><a class="link back" href="history.back(-1);"><span></span>返回</a></div>
  102. </div>
  103. </div>
  104. </div>
  105. <div class="panel-body">
  106. <#--主表部分-->
  107. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
  108. <#list commonList as col>
  109. <#assign colName=func.convertUnderLine(col.columnName)>
  110. <#if (col.colType=="java.util.Date") >
  111. <tr>
  112. <th width="20%">${col.comment}: <#if (col.isNotNull) > <span class="required">*</span></#if></th>
  113. <td><input type="text" id="${colName}" name="${colName}" value="<fmt:formatDate value='<#noparse>${</#noparse>${classVar}.${colName}}' pattern='yyyy-MM-dd'/>" validate="{<#if col.isNotNull>required:true<#else>required:false</#if>,date:true}" class="inputText date"/></td>
  114. </tr>
  115. <#else>
  116. <tr>
  117. <th width="20%">${col.comment}: <#if (col.isNotNull) > <span class="required">*</span></#if></th>
  118. <td><input type="text" id="${colName}" name="${colName}" value="<#noparse>${</#noparse>${classVar}.${colName}}" 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>}" class="inputText"/></td>
  119. </tr>
  120. </#if>
  121. </#list>
  122. </table>
  123. <#--子表部分-->
  124. <#if func.isSubTableExist( subtables)>
  125. <#list subtables as table>
  126. <table class="table-grid table-list" cellpadding="1" cellspacing="1" type="subtable" formtype="page" id="${table.variables.classVar}">
  127. <tr>
  128. <td colspan="${table.columnList?size-1}">
  129. <div class="group" align="left">
  130. <a id="btnAdd" class="link add">添加</a>
  131. </div>
  132. <div align="center">
  133. ${func.getComment(table) }
  134. </div>
  135. </td>
  136. </tr>
  137. <tr>
  138. <#list table.columnList as col>
  139. <#assign colName=func.convertUnderLine(col.columnName?lower_case)>
  140. <#assign foreignKey=func.convertUnderLine(table.foreignKey)>
  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. <#assign foreignKey=func.convertUnderLine(table.foreignKey)>
  151. <#if !(col.isPK)&&colName?lower_case!=foreignKey?lower_case>
  152. <#if (col.colType=="java.util.Date")>
  153. <td style="text-align: center"><input type="text" name="${colName}" value="<fmt:formatDate value='<#noparse>${</#noparse>${table.variables.classVar}Item.${colName?lower_case}}' pattern='yyyy-MM-dd'/>" validate="{<#if col.isNotNull>required:true<#else>required:false</#if>,date:true}" class="inputText date"/></td>
  154. <#else>
  155. <td style="text-align: center"><input type="text" name="${colName}" value="<#noparse>${</#noparse>${table.variables.classVar}Item.${colName}}" 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>}" class="inputText"/></td>
  156. </#if>
  157. </#if>
  158. </#list>
  159. </tr>
  160. </c:forEach>
  161. <#--子表添加模版-->
  162. <tr type="append" style="display:none;">
  163. <#list table.columnList as col>
  164. <#assign colName=func.convertUnderLine(col.columnName)>
  165. <#assign foreignKey=func.convertUnderLine(table.foreignKey)>
  166. <#if !(col.isPK)&&colName?lower_case!=foreignKey?lower_case>
  167. <#if (col.colType=="java.util.Date")>
  168. <td style="text-align: center"><input type="text" name="${colName}" value="<fmt:formatDate value='<#noparse>${</#noparse>${table.variables.classVar}Item.${colName?lower_case}}' pattern='yyyy-MM-dd'/>" validate="{<#if col.isNotNull>required:true<#else>required:false</#if>,date:true}" class="inputText date"/></td>
  169. <#else>
  170. <td style="text-align: center"><input type="text" name="${colName}" value="" 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>}" class="inputText"/></td>
  171. </#if>
  172. </#if>
  173. </#list>
  174. </tr>
  175. </table>
  176. </#list>
  177. </#if>
  178. <input type="hidden" name="${pkVar}" value="<#noparse>${</#noparse>${classVar}.${pkVar}<#noparse>}</#noparse>" />
  179. </div>
  180. </div>
  181. </form>
  182. </body>
  183. </html>