edit.html.vm 7.3 KB

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