add.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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-post-add">
  9. <div class="form-group">
  10. <label class="col-sm-3 control-label">岗位名称:</label>
  11. <div class="col-sm-8">
  12. <input class="form-control" type="text" name="postName" id="postName" required>
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-3 control-label ">岗位编码:</label>
  17. <div class="col-sm-8">
  18. <input class="form-control" type="text" name="postCode" id="postCode" required>
  19. </div>
  20. </div>
  21. <div class="form-group">
  22. <label class="col-sm-3 control-label">显示顺序:</label>
  23. <div class="col-sm-8">
  24. <input class="form-control" type="text" name="postSort" id="postSort" required>
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label class="col-sm-3 control-label">岗位状态:</label>
  29. <div class="col-sm-8">
  30. <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
  31. <input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
  32. <label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
  33. </div>
  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. <textarea id="remark" name="remark" class="form-control"></textarea>
  40. </div>
  41. </div>
  42. </form>
  43. </div>
  44. <th:block th:include="include :: footer" />
  45. <script type="text/javascript">
  46. var prefix = ctx + "system/post";
  47. $("#form-post-add").validate({
  48. onkeyup: false,
  49. rules:{
  50. postName:{
  51. remote: {
  52. url: ctx + "system/post/checkPostNameUnique",
  53. type: "post",
  54. dataType: "json",
  55. data: {
  56. "postName" : function() {
  57. return $.common.trim($("#postName").val());
  58. }
  59. },
  60. dataFilter: function(data, type) {
  61. return $.validate.unique(data);
  62. }
  63. }
  64. },
  65. postCode:{
  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. digits:true
  82. },
  83. },
  84. messages: {
  85. "postCode": {
  86. remote: "岗位编码已经存在"
  87. },
  88. "postName": {
  89. remote: "岗位名称已经存在"
  90. }
  91. },
  92. focusCleanup: true
  93. });
  94. function submitHandler() {
  95. if ($.validate.form()) {
  96. $.operate.save(prefix + "/add", $('#form-post-add').serialize());
  97. }
  98. }
  99. </script>
  100. </body>
  101. </html>