add.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 ">上级部门:</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}">
  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">部门名称:</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">显示排序:</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.isDefault == 'Y' ? true : false}">
  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. dataFilter: function(data, type) {
  80. return $.validate.unique(data);
  81. }
  82. }
  83. },
  84. orderNum:{
  85. digits:true
  86. },
  87. email:{
  88. email:true,
  89. },
  90. phone:{
  91. isPhone:true,
  92. },
  93. },
  94. messages: {
  95. "deptName": {
  96. remote: "部门已经存在"
  97. }
  98. },
  99. focusCleanup: true
  100. });
  101. function submitHandler() {
  102. if ($.validate.form()) {
  103. $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
  104. }
  105. }
  106. /*部门管理-新增-选择父部门树*/
  107. function selectDeptTree() {
  108. var options = {
  109. title: '部门选择',
  110. width: "380",
  111. url: prefix + "/selectDeptTree/" + $("#treeId").val(),
  112. callBack: doSubmit
  113. };
  114. $.modal.openOptions(options);
  115. }
  116. function doSubmit(index, layero){
  117. var body = layer.getChildFrame('body', index);
  118. $("#treeId").val(body.find('#treeId').val());
  119. $("#treeName").val(body.find('#treeName').val());
  120. layer.close(index);
  121. }
  122. </script>
  123. </body>
  124. </html>