edit.html 3.7 KB

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