add.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <meta charset="utf-8">
  4. <head th:include="include :: header"></head>
  5. <body class="white-bg">
  6. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  7. <form class="form-horizontal m" id="form-dept-add">
  8. <input id="treeId" name="parentId" type="hidden" th:value="${dept.deptId}" />
  9. <div class="form-group">
  10. <label class="col-sm-3 control-label ">上级部门:</label>
  11. <div class="col-sm-8">
  12. <div class="input-group">
  13. <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${dept.deptName}">
  14. <span class="input-group-addon"><i class="fa fa-search"></i></span>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="form-group">
  19. <label class="col-sm-3 control-label">部门名称:</label>
  20. <div class="col-sm-8">
  21. <input class="form-control" type="text" name="deptName" id="deptName" required>
  22. </div>
  23. </div>
  24. <div class="form-group">
  25. <label class="col-sm-3 control-label">显示排序:</label>
  26. <div class="col-sm-8">
  27. <input class="form-control" type="text" name="orderNum" required>
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <label class="col-sm-3 control-label">负责人:</label>
  32. <div class="col-sm-8">
  33. <input class="form-control" type="text" name="leader">
  34. </div>
  35. </div>
  36. <div class="form-group">
  37. <label class="col-sm-3 control-label">联系电话:</label>
  38. <div class="col-sm-8">
  39. <input class="form-control" type="text" name="phone">
  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="email">
  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. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  52. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
  53. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  54. </div>
  55. </div>
  56. </div>
  57. </form>
  58. </div>
  59. <div th:include="include::footer"></div>
  60. <script type="text/javascript">
  61. var prefix = ctx + "system/dept";
  62. $("#form-dept-add").validate({
  63. rules:{
  64. deptName:{
  65. remote: {
  66. url: prefix + "/checkDeptNameUnique",
  67. type: "post",
  68. dataType: "json",
  69. data: {
  70. "parentId": function() {
  71. return $("input[name='parentId']").val();
  72. },
  73. "deptName" : function() {
  74. return $.common.trim($("#deptName").val());
  75. }
  76. },
  77. dataFilter: function(data, type) {
  78. return $.validate.unique(data);
  79. }
  80. }
  81. },
  82. orderNum:{
  83. digits:true
  84. },
  85. email:{
  86. email:true,
  87. },
  88. phone:{
  89. isPhone:true,
  90. },
  91. },
  92. messages: {
  93. "deptName": {
  94. remote: "部门已经存在"
  95. }
  96. },
  97. focusCleanup: true
  98. });
  99. function submitHandler() {
  100. if ($.validate.form()) {
  101. $.operate.save(prefix + "/add", $('#form-dept-add').serialize());
  102. }
  103. }
  104. /*部门管理-新增-选择父部门树*/
  105. function selectDeptTree() {
  106. var options = {
  107. title: '部门选择',
  108. width: "380",
  109. url: prefix + "/selectDeptTree/" + $("#treeId").val(),
  110. callBack: doSubmit
  111. };
  112. $.modal.openOptions(options);
  113. }
  114. function doSubmit(index, layero){
  115. var body = layer.getChildFrame('body', index);
  116. $("#treeId").val(body.find('#treeId').val());
  117. $("#treeName").val(body.find('#treeName').val());
  118. layer.close(index);
  119. }
  120. </script>
  121. </body>
  122. </html>