edit.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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-user-edit" th:object="${user}">
  8. <input name="userId" type="hidden" th:field="*{userId}" />
  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" readonly="true" th:field="*{loginName}"/>
  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" readonly="true" th:field="*{dept.deptName}">
  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="userName" id="userName" th:field="*{userName}">
  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. <input class="form-control" type="text" name="email" th:field="*{email}">
  31. </div>
  32. </div>
  33. <div class="form-group">
  34. <label class="col-sm-3 control-label">手机:</label>
  35. <div class="col-sm-8">
  36. <input class="form-control" type="text" name="phonenumber" id="phonenumber" th:field="*{phonenumber}">
  37. </div>
  38. </div>
  39. <div class="form-group">
  40. <label class="col-sm-3 control-label">性别:</label>
  41. <div class="col-sm-8">
  42. <div class="radio radio-info radio-inline">
  43. <input type="radio" id="radio1" th:field="*{sex}" name="sex" value="0">
  44. <label for="radio1">男</label>
  45. </div>
  46. <div class="radio radio-danger radio-inline">
  47. <input type="radio" id="radio2" th:field="*{sex}" name="sex" value="1">
  48. <label for="radio2">女</label>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="form-group">
  53. <div class="form-control-static col-sm-offset-9">
  54. <button type="submit" class="btn btn-primary">提交</button>
  55. <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
  56. </div>
  57. </div>
  58. </form>
  59. </div>
  60. <div th:include="include::footer"></div>
  61. <script>
  62. $("#form-user-edit").validate({
  63. rules:{
  64. userName:{
  65. required:true,
  66. },
  67. email:{
  68. required:true,
  69. email:true,
  70. remote: {
  71. url: ctx + "system/user/checkEmailUnique",
  72. type: "post",
  73. dataType: "json",
  74. data: {
  75. "userId": function() {
  76. return $("#userId").val();
  77. },
  78. "email": function() {
  79. return $.common.trim($("#email").val());
  80. }
  81. },
  82. dataFilter: function (data, type) {
  83. return $.validate.unique(data);
  84. }
  85. }
  86. },
  87. phonenumber:{
  88. required:true,
  89. isPhone:true,
  90. remote: {
  91. url: ctx + "system/user/checkPhoneUnique",
  92. type: "post",
  93. dataType: "json",
  94. data: {
  95. "userId": function() {
  96. return $("#userId").val();
  97. },
  98. "phonenumber": function() {
  99. return $.common.trim($("#phonenumber").val());
  100. }
  101. },
  102. dataFilter: function (data, type) {
  103. return $.validate.unique(data);
  104. }
  105. }
  106. },
  107. },
  108. messages: {
  109. "email": {
  110. remote: "Email已经存在"
  111. },
  112. "phonenumber":{
  113. remote: "手机号码已经存在"
  114. }
  115. },
  116. submitHandler:function(form){
  117. $.operate.save(ctx + "system/user/profile/update", $('#form-user-edit').serialize());
  118. }
  119. });
  120. </script>
  121. </body>
  122. </html>