add.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. <textarea id="remark" name="remark" class="form-control"></textarea>
  39. </div>
  40. </div>
  41. </form>
  42. </div>
  43. <div th:include="include::footer"></div>
  44. <script type="text/javascript">
  45. var prefix = ctx + "system/post";
  46. $("#form-post-add").validate({
  47. rules:{
  48. postName:{
  49. required:true,
  50. remote: {
  51. url: ctx + "system/post/checkPostNameUnique",
  52. type: "post",
  53. dataType: "json",
  54. data: {
  55. "postName" : function() {
  56. return $.common.trim($("#postName").val());
  57. }
  58. },
  59. dataFilter: function(data, type) {
  60. return $.validate.unique(data);
  61. }
  62. }
  63. },
  64. postCode:{
  65. required:true,
  66. remote: {
  67. url: ctx + "system/post/checkPostCodeUnique",
  68. type: "post",
  69. dataType: "json",
  70. data: {
  71. "postCode" : function() {
  72. return $.common.trim($("#postCode").val());
  73. }
  74. },
  75. dataFilter: function(data, type) {
  76. return $.validate.unique(data);
  77. }
  78. }
  79. },
  80. postSort:{
  81. required:true,
  82. digits:true
  83. },
  84. },
  85. messages: {
  86. "postCode": {
  87. remote: "岗位编码已经存在"
  88. },
  89. "postName": {
  90. remote: "岗位名称已经存在"
  91. }
  92. }
  93. });
  94. function submitHandler() {
  95. if ($.validate.form("#form-post-add")) {
  96. $.operate.save(prefix + "/add", $('#form-post-add').serialize());
  97. }
  98. }
  99. </script>
  100. </body>
  101. </html>