edit.html 3.6 KB

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