user_edit.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>编辑内容</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <article class="page-container">
  10. <form class="form form-horizontal" id="form-content-edit">
  11. <input type="hidden" th:name="id" th:id="uid" th:value="${user.id}"/>
  12. <div class="row cl">
  13. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账号:</label>
  14. <div class="formControls col-xs-8 col-sm-9">
  15. <input type="text" class="input-text" value="" th:value="${user.nick_name}" th:id="nick_name"
  16. placeholder="请输入用户名" th:name="nick_name"/>
  17. </div>
  18. </div>
  19. <div class="row cl" th:unless="*{user.user_type==3}">
  20. <label class="form-label col-xs-4 col-sm-2">所属部门:</label>
  21. <div class="formControls col-xs-8 col-sm-9">
  22. <select id="department_select" th:name="department_id" class="input-text">
  23. <option value="">--请选择--</option>
  24. <option th:each="item : ${departments}" th:selected="${user.department_id==item.id}"
  25. th:value="${item.id}">
  26. [[*{item.name}]]
  27. </option>
  28. </select>
  29. </div>
  30. </div>
  31. <div class="row cl" th:unless="*{user.user_type==3}">
  32. <label class="form-label col-xs-4 col-sm-2">审核层级:</label>
  33. <div class="formControls col-xs-8 col-sm-9">
  34. <select id="approve_level_select" th:name="approve_level" class="input-text">
  35. <option th:selected="${user.approve_level}==-1" th:value="-1">--请选择--</option>
  36. <option th:selected="${user.approve_level}==0" th:value="0">第一层级</option>
  37. <option th:selected="${user.approve_level}==1" th:value="1">第二层级</option>
  38. </select>
  39. </div>
  40. </div>
  41. <div class="row cl" th:unless="*{user.user_type==3}">
  42. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>角色:</label>
  43. <div class="formControls col-xs-8 col-sm-9">
  44. <select id="role_select" th:name="roleIds" multiple>
  45. <option th:each="item : ${roles}" th:value="${item.id}">
  46. [[*{item.name}]]
  47. </option>
  48. <!--</optgroup>-->
  49. </select>
  50. </div>
  51. </div>
  52. <div class="row cl" th:unless="*{user.user_type==3}">
  53. <label class="form-label col-xs-4 col-sm-2">用户组:</label>
  54. <div class="formControls col-xs-8 col-sm-9">
  55. <select id="group_select" th:name="groupIds" multiple>
  56. <option th:each="item : ${groups}" th:value="${item.id}">
  57. [[*{item.name}]]
  58. </option>
  59. </select>
  60. </div>
  61. </div>
  62. <div class="row cl">
  63. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系人:</label>
  64. <div class="formControls col-xs-8 col-sm-9">
  65. <input type="text" class="input-text" value="" th:value="${user.user_name}" placeholder="请输入联系人"
  66. th:name="user_name"/>
  67. </div>
  68. </div>
  69. <div class="row cl">
  70. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话:</label>
  71. <div class="formControls col-xs-8 col-sm-9">
  72. <input type="text" class="input-text" value="" placeholder="请输入联系电话" th:value="${user.phone}"
  73. th:name="phone"/>
  74. </div>
  75. </div>
  76. <div class="row cl" th:unless="*{user.user_type==3}">
  77. <label class="form-label col-xs-4 col-sm-2"><span>是否管理员:</span></label>
  78. <div class="formControls col-xs-8 col-sm-9">
  79. <input type="radio" name="is_admin" th:checked="${user.is_admin==false }" value="false">否</input>
  80. <input type="radio" name="is_admin" th:checked="${user.is_admin==true }" value="true">是</input>
  81. </div>
  82. </div>
  83. <div class="row cl">
  84. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  85. <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>保存</button>
  86. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
  87. </div>
  88. </div>
  89. </form>
  90. </article>
  91. <script type="text/javascript" th:src="@{/js/government/user/user_edit.js}"></script>
  92. <script th:inline="javascript">
  93. /**
  94. * 取消
  95. */
  96. function removeIframe() {
  97. var index = parent.layer.getFrameIndex(window.name);
  98. parent.layer.close(index);
  99. }
  100. $(window).load(function () {
  101. $("#department_select").select2({
  102. width: '100%',
  103. language: {
  104. noResults: function (params) {
  105. return "暂无数据";
  106. }
  107. }
  108. });
  109. $("#role_select").select2({
  110. multiple: true,
  111. width: '100%',
  112. language: {
  113. noResults: function (params) {
  114. return "暂无数据";
  115. }
  116. }
  117. });
  118. $("#group_select").select2({
  119. multiple: true,
  120. width: '100%',
  121. language: {
  122. noResults: function (params) {
  123. return "暂无数据";
  124. }
  125. }
  126. });
  127. $("#approve_level_select").select2({
  128. width: '100%',
  129. language: {
  130. noResults: function (params) {
  131. return "暂无数据";
  132. }
  133. }
  134. });
  135. });
  136. $(document).ready(function () {
  137. initRoleSelect();
  138. initGroupSelect();
  139. });
  140. function initRoleSelect() {
  141. $("#role_select").val([[${user.roleIds}]]).trigger("change");
  142. }
  143. function initGroupSelect() {
  144. $("#group_select").val([[${user.groupIds}]]).trigger("change");
  145. }
  146. </script>
  147. </body>
  148. </html>