edit.html.vm 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('修改${functionName}')" />
  5. #foreach($column in $columns)
  6. #if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
  7. <th:block th:include="include :: datetimepicker-css" />
  8. #break
  9. #end
  10. #end
  11. </head>
  12. <body class="white-bg">
  13. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  14. <form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
  15. <input name="${pkColumn.javaField}" th:field="*{${pkColumn.javaField}}" type="hidden">
  16. #foreach($column in $columns)
  17. #if($column.edit && !$column.pk)
  18. #if(($column.usableColumn) || (!$column.superColumn))
  19. #set($parentheseIndex=$column.columnComment.indexOf("("))
  20. #if($parentheseIndex != -1)
  21. #set($comment=$column.columnComment.substring(0, $parentheseIndex))
  22. #else
  23. #set($comment=$column.columnComment)
  24. #end
  25. #set($field=$column.javaField)
  26. #set($dictType=$column.dictType)
  27. #if("" != $treeParentCode && $column.javaField == $treeParentCode)
  28. <div class="form-group">
  29. <label class="col-sm-3 control-label">${comment}:</label>
  30. <div class="col-sm-8">
  31. <div class="input-group">
  32. #set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
  33. <input id="treeId" name="${treeParentCode}" type="hidden" th:field="*{${treeParentCode}}" />
  34. <input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:field="*{parentName}"#if($column.required) required#end>
  35. <span class="input-group-addon"><i class="fa fa-search"></i></span>
  36. </div>
  37. </div>
  38. </div>
  39. #elseif($column.htmlType == "input")
  40. <div class="form-group">
  41. <label class="col-sm-3 control-label">${comment}:</label>
  42. <div class="col-sm-8">
  43. <input name="${field}" th:field="*{${field}}" class="form-control" type="text"#if($column.required) required#end>
  44. </div>
  45. </div>
  46. #elseif($column.htmlType == "select" && "" != $dictType)
  47. <div class="form-group">
  48. <label class="col-sm-3 control-label">${comment}:</label>
  49. <div class="col-sm-8">
  50. <select name="${field}" class="form-control m-b" th:with="type=${@dict.getType('${dictType}')}"#if($column.required) required#end>
  51. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{${field}}"></option>
  52. </select>
  53. </div>
  54. </div>
  55. #elseif($column.htmlType == "select" && $dictType)
  56. <div class="form-group">
  57. <label class="col-sm-3 control-label">${comment}:</label>
  58. <div class="col-sm-8">
  59. <select name="${field}" class="form-control m-b"#if($column.required) required#end>
  60. <option value="">所有</option>
  61. </select>
  62. <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
  63. </div>
  64. </div>
  65. #elseif($column.htmlType == "radio" && "" != $dictType)
  66. <div class="form-group">
  67. <label class="col-sm-3 control-label">${comment}:</label>
  68. <div class="col-sm-8">
  69. <div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
  70. <input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:field="*{${field}}"#if($column.required) required#end>
  71. <label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
  72. </div>
  73. </div>
  74. </div>
  75. #elseif($column.htmlType == "radio" && $dictType)
  76. <div class="form-group">
  77. <label class="col-sm-3 control-label">${comment}:</label>
  78. <div class="col-sm-8">
  79. <div class="radio-box">
  80. <input type="radio" name="${field}" value=""#if($column.required) required#end>
  81. <label th:for="${field}" th:text="未知"></label>
  82. </div>
  83. <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
  84. </div>
  85. </div>
  86. #elseif($column.htmlType == "datetime")
  87. <div class="form-group">
  88. <label class="col-sm-3 control-label">${comment}:</label>
  89. <div class="col-sm-8">
  90. <div class="input-group date">
  91. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  92. <input name="${field}" th:value="${#dates.format(${className}.${field}, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"#if($column.required) required#end>
  93. </div>
  94. </div>
  95. </div>
  96. #elseif($column.htmlType == "textarea")
  97. <div class="form-group">
  98. <label class="col-sm-3 control-label">${comment}:</label>
  99. <div class="col-sm-8">
  100. <textarea name="${field}" class="form-control"#if($column.required) required#end>[[*{${field}}]]</textarea>
  101. </div>
  102. </div>
  103. #end
  104. #end
  105. #end
  106. #end
  107. </form>
  108. </div>
  109. <th:block th:include="include :: footer" />
  110. #foreach($column in $columns)
  111. #if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
  112. <th:block th:include="include :: datetimepicker-js" />
  113. #break
  114. #end
  115. #end
  116. <script type="text/javascript">
  117. var prefix = ctx + "${moduleName}/${businessName}";
  118. $("#form-${businessName}-edit").validate({
  119. focusCleanup: true
  120. });
  121. function submitHandler() {
  122. if ($.validate.form()) {
  123. $.operate.save(prefix + "/edit", $('#form-${businessName}-edit').serialize());
  124. }
  125. }
  126. #foreach($column in $columns)
  127. #if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
  128. $("input[name='$column.javaField']").datetimepicker({
  129. format: "yyyy-mm-dd",
  130. minView: "month",
  131. autoclose: true
  132. });
  133. #end
  134. #end
  135. #if($table.tree)
  136. /*${functionName}-新增-选择父部门树*/
  137. function select${BusinessName}Tree() {
  138. var options = {
  139. title: '${functionName}选择',
  140. width: "380",
  141. url: prefix + "/select${BusinessName}Tree/" + $("#treeId").val(),
  142. callBack: doSubmit
  143. };
  144. $.modal.openOptions(options);
  145. }
  146. function doSubmit(index, layero){
  147. var body = layer.getChildFrame('body', index);
  148. $("#treeId").val(body.find('#treeId').val());
  149. $("#treeName").val(body.find('#treeName').val());
  150. layer.close(index);
  151. }
  152. #end
  153. </script>
  154. </body>
  155. </html>