edit.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('修改部门')" />
  5. </head>
  6. <body class="white-bg">
  7. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  8. <form class="form-horizontal m" id="form-dept-edit" th:object="${dept}">
  9. <input name="deptId" type="hidden" th:field="*{deptId}" />
  10. <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
  11. <div class="form-group">
  12. <label class="col-sm-3 control-label">上级部门:</label>
  13. <div class="col-sm-8">
  14. <div class="input-group">
  15. <input class="form-control" type="text" id="treeName" onclick="selectDeptTree()" readonly="true" th:field="*{parentName}">
  16. <span class="input-group-addon"><i class="fa fa-search"></i></span>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="form-group">
  21. <label class="col-sm-3 control-label is-required">部门名称:</label>
  22. <div class="col-sm-8">
  23. <input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName" required>
  24. </div>
  25. </div>
  26. <div class="form-group">
  27. <label class="col-sm-3 control-label">林场部门类型:</label>
  28. <div class="col-sm-8">
  29. <select name="forestdeptType" class="form-control m-b" th:with="type=${@dict.getType('forestdept_type')}">
  30. <option value="">所有</option>
  31. <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
  32. th:value="${dict.dictValue}" th:field="*{forestdeptType}"></option>
  33. </select>
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-3 control-label is-required">显示排序:</label>
  38. <div class="col-sm-8">
  39. <input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
  40. </div>
  41. </div>
  42. <div class="form-group">
  43. <label class="col-sm-3 control-label">负责人:</label>
  44. <div class="col-sm-8">
  45. <input class="form-control" type="text" name="leader" th:field="*{leader}">
  46. </div>
  47. </div>
  48. <div class="form-group">
  49. <label class="col-sm-3 control-label">联系电话:</label>
  50. <div class="col-sm-8">
  51. <input class="form-control" type="text" name="phone" th:field="*{phone}">
  52. </div>
  53. </div>
  54. <div class="form-group">
  55. <label class="col-sm-3 control-label">邮箱:</label>
  56. <div class="col-sm-8">
  57. <input class="form-control" type="text" name="email" th:field="*{email}">
  58. </div>
  59. </div>
  60. <div class="form-group">
  61. <label class="col-sm-3 control-label">部门状态:</label>
  62. <div class="col-sm-8">
  63. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  64. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
  65. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  66. </div>
  67. </div>
  68. </div>
  69. </form>
  70. </div>
  71. <th:block th:include="include :: footer" />
  72. <script type="text/javascript">
  73. var prefix = ctx + "system/dept";
  74. $("#form-dept-edit").validate({
  75. onkeyup: false,
  76. rules:{
  77. deptName:{
  78. remote: {
  79. url: prefix + "/checkDeptNameUnique",
  80. type: "post",
  81. dataType: "json",
  82. data: {
  83. "deptId": function() {
  84. return $("#deptId").val();
  85. },
  86. "parentId": function() {
  87. return $("input[name='parentId']").val();
  88. },
  89. "deptName": function() {
  90. return $.common.trim($("#deptName").val());
  91. }
  92. },
  93. dataFilter: function(data, type) {
  94. return $.validate.unique(data);
  95. }
  96. }
  97. },
  98. orderNum:{
  99. digits:true
  100. },
  101. email:{
  102. email:true,
  103. },
  104. phone:{
  105. isPhone:true,
  106. },
  107. },
  108. messages: {
  109. "deptName": {
  110. remote: "部门已经存在"
  111. }
  112. },
  113. focusCleanup: true
  114. });
  115. function submitHandler() {
  116. if ($.validate.form()) {
  117. $.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
  118. }
  119. }
  120. /*部门管理-修改-选择部门树*/
  121. function selectDeptTree() {
  122. var deptId = $("#treeId").val();
  123. var excludeId = $("input[name='deptId']").val();
  124. if(deptId > 0) {
  125. var options = {
  126. title: '部门选择',
  127. width: "380",
  128. url: prefix + "/selectDeptTree/" + $("#treeId").val() + "/" + excludeId,
  129. callBack: doSubmit
  130. };
  131. $.modal.openOptions(options);
  132. } else {
  133. $.modal.alertError("父部门不能选择");
  134. }
  135. }
  136. function doSubmit(index, layero){
  137. var tree = layero.find("iframe")[0].contentWindow.$._tree;
  138. if ($.tree.notAllowLastLevel(tree)) {
  139. var body = layer.getChildFrame('body', index);
  140. $("#treeId").val(body.find('#treeId').val());
  141. $("#treeName").val(body.find('#treeName').val());
  142. layer.close(index);
  143. }
  144. }
  145. </script>
  146. </body>
  147. </html>