edit.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 is-required">显示排序:</label>
  28. <div class="col-sm-8">
  29. <input class="form-control" type="text" name="orderNum" th:field="*{orderNum}" required>
  30. </div>
  31. </div>
  32. <div class="form-group">
  33. <label class="col-sm-3 control-label">负责人:</label>
  34. <div class="col-sm-8">
  35. <input class="form-control" type="text" name="leader" th:field="*{leader}">
  36. </div>
  37. </div>
  38. <div class="form-group">
  39. <label class="col-sm-3 control-label">联系电话:</label>
  40. <div class="col-sm-8">
  41. <input class="form-control" type="text" name="phone" th:field="*{phone}">
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-sm-3 control-label">邮箱:</label>
  46. <div class="col-sm-8">
  47. <input class="form-control" type="text" name="email" th:field="*{email}">
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="col-sm-3 control-label">部门状态:</label>
  52. <div class="col-sm-8">
  53. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  54. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
  55. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  56. </div>
  57. </div>
  58. </div>
  59. </form>
  60. </div>
  61. <th:block th:include="include :: footer" />
  62. <script type="text/javascript">
  63. var prefix = ctx + "system/dept";
  64. $("#form-dept-edit").validate({
  65. onkeyup: false,
  66. rules:{
  67. deptName:{
  68. remote: {
  69. url: prefix + "/checkDeptNameUnique",
  70. type: "post",
  71. dataType: "json",
  72. data: {
  73. "deptId": function() {
  74. return $("#deptId").val();
  75. },
  76. "parentId": function() {
  77. return $("input[name='parentId']").val();
  78. },
  79. "deptName": function() {
  80. return $.common.trim($("#deptName").val());
  81. }
  82. }
  83. }
  84. },
  85. orderNum:{
  86. digits:true
  87. },
  88. email:{
  89. email:true,
  90. },
  91. phone:{
  92. isPhone:true,
  93. },
  94. },
  95. messages: {
  96. "deptName": {
  97. remote: "部门已经存在"
  98. }
  99. },
  100. focusCleanup: true
  101. });
  102. function submitHandler() {
  103. if ($.validate.form()) {
  104. $.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
  105. }
  106. }
  107. /*部门管理-修改-选择部门树*/
  108. function selectDeptTree() {
  109. var deptId = $("#treeId").val();
  110. var excludeId = $("input[name='deptId']").val();
  111. if(deptId > 0) {
  112. var options = {
  113. title: '部门选择',
  114. width: "380",
  115. url: prefix + "/selectDeptTree/" + $("#treeId").val() + "/" + excludeId,
  116. callBack: doSubmit
  117. };
  118. $.modal.openOptions(options);
  119. } else {
  120. $.modal.alertError("父部门不能选择");
  121. }
  122. }
  123. function doSubmit(index, layero){
  124. var tree = layero.find("iframe")[0].contentWindow.$._tree;
  125. if ($.tree.notAllowLastLevel(tree)) {
  126. var body = $.modal.getChildFrame(index);
  127. $("#treeId").val(body.find('#treeId').val());
  128. $("#treeName").val(body.find('#treeName').val());
  129. $.modal.close(index);
  130. }
  131. }
  132. </script>
  133. </body>
  134. </html>