add.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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-post-add">
  8. <div class="form-group">
  9. <label class="col-sm-3 control-label">岗位名称:</label>
  10. <div class="col-sm-8">
  11. <input class="form-control" type="text" name="postName" id="postName">
  12. </div>
  13. </div>
  14. <div class="form-group">
  15. <label class="col-sm-3 control-label ">岗位编码:</label>
  16. <div class="col-sm-8">
  17. <input class="form-control" type="text" name="postCode" id="postCode"/>
  18. </div>
  19. </div>
  20. <div class="form-group">
  21. <label class="col-sm-3 control-label">显示顺序:</label>
  22. <div class="col-sm-8">
  23. <input class="form-control" type="text" name="postSort" id="postSort">
  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. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  30. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
  31. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label class="col-sm-3 control-label">备注:</label>
  37. <div class="col-sm-8">
  38. <input id="remark" name="remark" class="form-control" type="text">
  39. </div>
  40. </div>
  41. <div class="form-group">
  42. <div class="form-control-static col-sm-offset-9">
  43. <button type="submit" class="btn btn-primary">提交</button>
  44. <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  45. </div>
  46. </div>
  47. </form>
  48. </div>
  49. <div th:include="include::footer"></div>
  50. <script type="text/javascript">
  51. var prefix = ctx + "system/post"
  52. $("#form-post-add").validate({
  53. rules:{
  54. postName:{
  55. required:true,
  56. remote: {
  57. url: ctx + "system/post/checkPostNameUnique",
  58. type: "post",
  59. dataType: "json",
  60. data: {
  61. "postName" : function() {
  62. return $.common.trim($("#postName").val());
  63. }
  64. },
  65. dataFilter: function(data, type) {
  66. return $.validate.unique(data);
  67. }
  68. }
  69. },
  70. postCode:{
  71. required:true,
  72. remote: {
  73. url: ctx + "system/post/checkPostCodeUnique",
  74. type: "post",
  75. dataType: "json",
  76. data: {
  77. "postCode" : function() {
  78. return $.common.trim($("#postCode").val());
  79. }
  80. },
  81. dataFilter: function(data, type) {
  82. return $.validate.unique(data);
  83. }
  84. }
  85. },
  86. postSort:{
  87. required:true,
  88. digits:true
  89. },
  90. },
  91. messages: {
  92. "postCode": {
  93. remote: "岗位编码已经存在"
  94. },
  95. "postName": {
  96. remote: "岗位名称已经存在"
  97. }
  98. },
  99. submitHandler:function(form){
  100. $.operate.save(prefix + "/add", $('#form-post-add').serialize());
  101. }
  102. });
  103. </script>
  104. </body>
  105. </html>