user_list.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. <style>
  8. /* .conditionLabel {
  9. display: inline-block;
  10. } */
  11. .inline-block {
  12. display: inline-block;
  13. line-height: 40px;
  14. }
  15. </style>
  16. </head>
  17. <body layout:fragment="content">
  18. <nav class="breadcrumb">
  19. <i class="Hui-iconfont">&#xe67f;</i>
  20. 首页
  21. <span class="c-gray en">&gt;</span>系统管理
  22. <span class="c-gray en">&gt;</span>用户管理
  23. <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
  24. href="javascript:location.replace(location.href);" title="刷新">
  25. <i class="Hui-iconfont">&#xe68f;</i>
  26. </a>
  27. </nav>
  28. <form id="myForm" th:action="@{/admin/user/list}" th:method="get">
  29. <div class="page-container">
  30. <div class="text-c">
  31. <th:block th:if="${user_type==0}">
  32. <div class="inline-block">
  33. <label class="conditionLabel">用户类型:</label>
  34. <span class="select-box" style="width:200px;line-height: 10px;">
  35. <select th:id="user_type" class="select" th:name="user_type">
  36. <option value="">--请选择用户类型--</option>
  37. <option th:selected="${searchCondition.user_type==0}" value="0">政府用户</option>
  38. <option th:selected="${searchCondition.user_type==3}" value="3">企业用户</option>
  39. </select>
  40. </span>
  41. </div>
  42. <div class="inline-block">
  43. <label class="conditionLabel">所属板块:</label>
  44. <span class="select-box" style="width:200px;line-height: 10px;">
  45. <select th:id="street_id" class="select" th:name="street_id">
  46. <option value="">--请选择所属板块--</option>
  47. <option th:if="${item.is_start}" th:each="item : ${streetList}" th:value="${item.id}"
  48. th:text="${item.name}" th:selected="${searchCondition.street_id==item.id}">
  49. </select>
  50. </span>
  51. </div>
  52. </th:block>
  53. <th:block th:if="${user_type==2||user_type==4}">
  54. <div class="inline-block">
  55. <label class="conditionLabel">用户类型:</label>
  56. <span class="select-box" style="width:200px;line-height: 10px;">
  57. <select th:id="user_type" class="select" th:name="user_type">
  58. <option value="">--请选择用户类型--</option>
  59. <option th:selected="${searchCondition.user_type==0}" value="0"
  60. th:if="${user_type==2}">政府用户</option>
  61. <option th:selected="${searchCondition.user_type==4}" value="4">街道用户</option>
  62. <option th:selected="${searchCondition.user_type==1}" value="1"
  63. th:if="${user_type==2}">园区用户</option>
  64. <option th:selected="${searchCondition.user_type==3}" value="3">企业用户</option>
  65. </select>
  66. </span>
  67. </div>
  68. <div class="inline-block" th:if="${user_type==2}">
  69. <label class="conditionLabel">所属板块:</label>
  70. <span class="select-box" style="width:200px;line-height: 10px;">
  71. <select th:id="street_id" class="select" th:name="street_id">
  72. <option value="">--请选择所属板块--</option>
  73. <option th:if="${item.is_start}" th:each="item : ${streetList}" th:value="${item.id}"
  74. th:text="${item.name}" th:selected="${searchCondition.street_id==item.id}">
  75. </select>
  76. </span>
  77. </div>
  78. <div class="inline-block" th:if="${user_type==2}">
  79. <label class="conditionLabel">角色:</label>
  80. <span class="select-box" style="width:200px;line-height: 10px;">
  81. <select th:id="role_id" class="select" th:name="role_id">
  82. <option value="">--请选择角色--</option>
  83. <option th:unless="${item.user_type==3}" th:each="item : ${roles}" th:value="${item.id}"
  84. th:text="${item.name}" th:selected="${searchCondition.role_id==item.id}">
  85. </select>
  86. </span>
  87. </div>
  88. </th:block>
  89. <div class="inline-block">
  90. <label th:unless="${user_type==2}" class="conditionLabel">角色:</label>
  91. <span th:unless="${user_type==2}" class="select-box" style="width:200px;line-height: 10px;">
  92. <select th:id="role_id" class="select" th:name="role_id">
  93. <option value="">--请选择角色--</option>
  94. <option th:each="item : ${roles}" th:value="${item.id}" th:text="${item.name}" th:selected="${searchCondition.role_id==item.id}">
  95. </select>
  96. </span>
  97. </div>
  98. <div class="inline-block">
  99. <label class="conditionLabel">单位名称:</label>
  100. <input type="text" class="input-text" style="width:200px" placeholder="请输入单位名称" name="company_name"
  101. th:value="${searchCondition.company_name}"/>
  102. </div>
  103. <div class="inline-block">
  104. <label class="conditionLabel">用户:</label>
  105. <input type="text" class="input-text" style="width:200px" placeholder="请输入姓名,账号,联系方式" name="keyword"
  106. th:value="${keyword}"/>
  107. </div>
  108. <button type="submit" class="btn btn-primary">
  109. 搜索
  110. </button>
  111. </div>
  112. <div class="cl pd-5 bg-1 bk-gray mt-20">
  113. <span class="l">
  114. <a onClick="user_start('/admin/user/startBatch')" class="btn btn-primary radius"><i
  115. class="Hui-iconfont">&#xe605;</i> 启用</a>
  116. <a onClick="user_stop('/admin/user/stopBatch')" class="btn btn-default radius"><i class="Hui-iconfont">&#xe60e;</i> 禁用</a>
  117. <a onClick="user_del('/admin/user/deleteBatch')" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 删除</a>
  118. <a th:onclick="'javascript:user_dialog(\'新增\',\'/admin/user/add\',\'800\',\'500\');'"
  119. class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 新增</a>
  120. </span>
  121. <span class="r">共有数据:<strong th:text="${pageInfo.total}" id="total">54</strong> 条</span>
  122. </div>
  123. <table class="table table-border table-bordered table-bg table-hover">
  124. <thead>
  125. <tr class="text-c">
  126. <th width="25"><input type="checkbox" name="" value=""/></th>
  127. <th>账号</th>
  128. <th>姓名</th>
  129. <th>联系方式</th>
  130. <th>创建日期</th>
  131. <th th:if="${user_type==2||user_type==4}">用户类型</th>
  132. <th>角色</th>
  133. <th>单位名称</th>
  134. <th>所属板块</th>
  135. <th>管理员</th>
  136. <th>状态</th>
  137. <th width="150">操作</th>
  138. </tr>
  139. </thead>
  140. <tbody>
  141. <tr class="text-c" th:each="model,iterStat:${pageInfo.list}" th:object="${model}">
  142. <td>
  143. <input type="checkbox" th:value="*{id}" th:id="${iterStat.index+1}" name="id"/>
  144. </td>
  145. <td th:text="*{nick_name}"></td>
  146. <td th:text="*{user_name}"></td>
  147. <td th:text="*{phone}"></td>
  148. <td th:text="*{create_time}"></td>
  149. <td th:if="${user_type==2||user_type==4}">
  150. <span th:if="*{user_type==0}">政府用户</span>
  151. <span th:if="*{user_type==4}">街道用户</span>
  152. <span th:if="*{user_type==1}">园区用户</span>
  153. <span th:if="*{user_type==3}">企业用户</span>
  154. </td>
  155. <td th:text="*{role_names}"></td>
  156. <td th:text="*{super_department_name}"></td>
  157. <!--<td th:if="${user_type==2}" th:text="*{super_department_name}"></td>
  158. <td th:unless="${user_type==2}" th:text="*{department_name}"></td>-->
  159. <td th:text="*{street_name}"></td>
  160. <td><span th:if="*{is_admin}">是</span><span th:unless="*{is_admin}">否</span></td>
  161. <td class="td-status">
  162. <span class="label radius" th:unless="*{is_start}">禁用</span>
  163. <span class="label radius label-success" th:if="*{is_start}">启用</span>
  164. </td>
  165. <td class="td-manage">
  166. <a title="编辑"
  167. th:onclick="'javascript:user_dialog(\'编辑\',\'/admin/user/edit/'+*{id}+'\',\'800\',\'500\');'"
  168. class="ml-5" style="text-decoration:none">编辑</a>
  169. <a title="详情"
  170. th:onclick="'javascript:user_dialog(\'详情\',\'/admin/user/check/'+*{id}+'\',\'800\',\'500\');'"
  171. class="ml-5" style="text-decoration:none">详情</a>
  172. <a title="重置密码" th:onclick="'javascript:user_reset(\'/admin/user/resetPassword/'+*{id}+'\');'"
  173. class="ml-5" style="text-decoration:none">重置密码</a>
  174. </td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. <div th:replace="admin/common/page :: page"></div>
  179. </div>
  180. </form>
  181. <script type="text/javascript" th:src="@{/js/common/page.js}"></script>
  182. <script type="text/javascript" th:src="@{/js/sys/user/user_list.js}"></script>
  183. <script th:inline="javascript">
  184. var user_type = [[${searchCondition.user_type}]];
  185. var street_id = [[${searchCondition.street_id}]];
  186. var role_id = [[${searchCondition.role_id}]];
  187. $(function () {
  188. if (user_type != null || street_id != null){
  189. roleList(user_type, street_id);
  190. }
  191. });
  192. $("#user_type").change(function(){
  193. var user_type = $("#user_type").val();
  194. var street_id = $("#street_id").val();
  195. roleList(user_type, street_id);
  196. });
  197. $("#street_id").change(function(){
  198. var street_id = $("#street_id").val();
  199. var user_type = $("#user_type").val();
  200. roleList(user_type, street_id);
  201. });
  202. function roleList(user_type, street_id) {
  203. $.ajax({
  204. url: pagePath + "/admin/user/role",
  205. type: "get",
  206. data: {
  207. 'user_type': user_type,
  208. 'street_id': street_id
  209. },
  210. dataType: "json",
  211. success: function (result) {
  212. if (result.success) {
  213. var roles = result.obj;
  214. $("#role_id").empty();
  215. $("#role_id").append(new Option("--请选择角色--", ""));
  216. for (var i = 0; i< roles.length; i++){
  217. var opt = new Option(roles[i].name, roles[i].id);
  218. $("#role_id").append(opt);
  219. }
  220. if (role_id != null){
  221. $("#role_id").find("option[value="+role_id+"]").attr("selected",true);
  222. }
  223. } else {
  224. errorMessage(result.message);
  225. }
  226. },
  227. error: function () {
  228. errorMessage('系统错误!');
  229. }
  230. });
  231. }
  232. </script>
  233. </body>
  234. </html>