add.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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-add">
  9. <input id="treeId" name="parentId" type="hidden" th:value="${dept?.deptId}" />
  10. <div class="form-group">
  11. <label class="col-sm-3 control-label is-required">上级部门:</label>
  12. <div class="col-sm-8">
  13. <div class="input-group">
  14. <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept?.deptName}" required>
  15. <span class="input-group-addon"><i class="fa fa-search"></i></span>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="form-group">
  20. <label class="col-sm-3 control-label is-required">部门名称:</label>
  21. <div class="col-sm-8">
  22. <input class="form-control" type="text" name="deptName" id="deptName" required>
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <label class="col-sm-3 control-label is-required">显示排序:</label>
  27. <div class="col-sm-8">
  28. <input class="form-control" type="text" name="orderNum" required>
  29. </div>
  30. </div>
  31. <div class="form-group">
  32. <label class="col-sm-3 control-label">负责人:</label>
  33. <div class="col-sm-8">
  34. <input class="form-control" type="text" name="leader">
  35. </div>
  36. </div>
  37. <div class="form-group">
  38. <label class="col-sm-3 control-label">联系电话:</label>
  39. <div class="col-sm-8">
  40. <input class="form-control" type="text" name="phone">
  41. </div>
  42. </div>
  43. <div class="form-group">
  44. <label class="col-sm-3 control-label">邮箱:</label>
  45. <div class="col-sm-8">
  46. <input class="form-control" type="text" name="email">
  47. </div>
  48. </div>
  49. <div class="form-group">
  50. <label class="col-sm-3 control-label">部门状态:</label>
  51. <div class="col-sm-8">
  52. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  53. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
  54. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  55. </div>
  56. </div>
  57. </div>
  58. </form>
  59. </div>
  60. <th:block th:include="include :: footer" />
  61. <script type="text/javascript">
  62. var prefix = ctx + "system/dept";
  63. $("#form-dept-add").validate({
  64. onkeyup: false,
  65. rules:{
  66. deptName:{
  67. remote: {
  68. url: prefix + "/checkDeptNameUnique",
  69. type: "post",
  70. dataType: "json",
  71. data: {
  72. "parentId": function() {
  73. return $("input[name='parentId']").val();
  74. },
  75. "deptName" : function() {
  76. return $.common.trim($("#deptName").val());
  77. }
  78. }
  79. }
  80. },
  81. orderNum:{
  82. digits:true
  83. },
  84. email:{
  85. email:true,
  86. },
  87. phone:{
  88. isPhone:true,
  89. },
  90. },
  91. messages: {
  92. "deptName": {
  93. remote: "部门已经存在"
  94. }
  95. },
  96. focusCleanup: true
  97. });
  98. function submitHandler() {
  99. if ($.validate.form()) {
  100. $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
  101. }
  102. }
  103. /*部门管理-新增-选择父部门树*/
  104. function selectDeptTree() {
  105. var treeId = $("#treeId").val();
  106. if ($.common.isEmpty(treeId)) {
  107. $.modal.alertWarning("请先添加用户所属的部门!");
  108. return;
  109. }
  110. var options = {
  111. title: '部门选择',
  112. width: "380",
  113. url: prefix + "/selectDeptTree/" + treeId + "/0",
  114. callBack: doSubmit
  115. };
  116. $.modal.openOptions(options);
  117. }
  118. function doSubmit(index, layero){
  119. var body = $.modal.getChildFrame(index);
  120. $("#treeId").val(body.find('#treeId').val());
  121. $("#treeName").val(body.find('#treeName').val());
  122. $.modal.close(index);
  123. }
  124. </script>
  125. </body>
  126. </html>