add.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 is-required">岗位名称:</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 is-required">岗位编码:</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 is-required">显示顺序:</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.default}">
  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. }
  61. },
  62. postCode:{
  63. remote: {
  64. url: ctx + "system/post/checkPostCodeUnique",
  65. type: "post",
  66. dataType: "json",
  67. data: {
  68. "postCode" : function() {
  69. return $.common.trim($("#postCode").val());
  70. }
  71. }
  72. }
  73. },
  74. postSort:{
  75. digits:true
  76. },
  77. },
  78. messages: {
  79. "postCode": {
  80. remote: "岗位编码已经存在"
  81. },
  82. "postName": {
  83. remote: "岗位名称已经存在"
  84. }
  85. },
  86. focusCleanup: true
  87. });
  88. function submitHandler() {
  89. if ($.validate.form()) {
  90. $.operate.save(prefix + "/add", $('#form-post-add').serialize());
  91. }
  92. }
  93. </script>
  94. </body>
  95. </html>