user.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org"
  3. xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  4. <meta charset="utf-8">
  5. <head th:include="include :: header"></head>
  6. <link href="/ajax/libs/jquery-layout/jquery.layout-latest.css" th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
  7. <link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
  8. <body class="gray-bg">
  9. <div class="ui-layout-west">
  10. <div class="main-content">
  11. <div class="box box-main">
  12. <div class="box-header">
  13. <div class="box-title">
  14. <i class="fa icon-grid"></i> 组织机构
  15. </div>
  16. <div class="box-tools pull-right">
  17. <a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理机构"><i class="fa fa-edit"></i></a>
  18. <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
  19. <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
  20. <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新机构"><i class="fa fa-refresh"></i></button>
  21. </div>
  22. </div>
  23. <div class="ui-layout-content">
  24. <div id="tree" class="ztree"></div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="container-div ui-layout-center">
  30. <div class="row">
  31. <div class="col-sm-12 select-info">
  32. <form id="user-form">
  33. <input type="hidden" id="deptId" name="deptId">
  34. <input type="hidden" id="parentId" name="parentId">
  35. <div class="select-list gd">
  36. <ul>
  37. <li>
  38. 登录名称:<input type="text" name="loginName"/>
  39. </li>
  40. <li>
  41. 手机号码:<input type="text" name="phonenumber"/>
  42. </li>
  43. <li>
  44. 用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  45. <option value="">所有</option>
  46. <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
  47. </select>
  48. </li>
  49. <li class="time">
  50. <label>创建时间: </label>
  51. <input type="text" class="layui-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
  52. <span>-</span>
  53. <input type="text" class="layui-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
  54. </li>
  55. <li>
  56. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  57. <a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()"><i class="fa fa-download"></i>&nbsp;下载</a>
  58. </li>
  59. </ul>
  60. </div>
  61. </form>
  62. </div>
  63. <div class="btn-group hidden-xs" id="toolbar" role="group">
  64. <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
  65. <i class="fa fa-plus"></i> 新增
  66. </a>
  67. <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="system:user:remove">
  68. <i class="fa fa-trash-o"></i> 删除
  69. </a>
  70. </div>
  71. <div class="col-sm-12 select-info table-striped">
  72. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  73. </div>
  74. </div>
  75. </div>
  76. <div th:include="include :: footer"></div>
  77. <script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
  78. <script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
  79. <script th:inline="javascript">
  80. var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
  81. var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
  82. var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
  83. var datas = [[${@dict.getType('sys_normal_disable')}]];
  84. var prefix = ctx + "system/user"
  85. $(document).ready(function(){
  86. $('body').layout({ west__size: 185 });
  87. queryUserList();
  88. queryDeptTreeDaTa();
  89. });
  90. function queryUserList() {
  91. var options = {
  92. url: prefix + "/list",
  93. createUrl: prefix + "/add",
  94. updateUrl: prefix + "/edit/{id}",
  95. removeUrl: prefix + "/remove",
  96. exportUrl: prefix + "/export",
  97. sortName: "createTime",
  98. sortOrder: "desc",
  99. modalName: "用户",
  100. search: false,
  101. showExport: false,
  102. columns: [{
  103. checkbox: true
  104. },
  105. {
  106. field: 'userId',
  107. title: '用户ID'
  108. },
  109. {
  110. field: 'loginName',
  111. title: '登录名称',
  112. sortable: true
  113. },
  114. {
  115. field: 'userName',
  116. title: '用户名称'
  117. },
  118. {
  119. field: 'dept.deptName',
  120. title: '部门'
  121. },
  122. {
  123. field: 'email',
  124. title: '邮箱',
  125. visible: false
  126. },
  127. {
  128. field: 'phonenumber',
  129. title: '手机'
  130. },
  131. {
  132. field: 'status',
  133. title: '状态',
  134. align: 'center',
  135. formatter: function(value, row, index) {
  136. return $.table.selectDictLabel(datas, value);
  137. }
  138. },
  139. {
  140. field: 'createTime',
  141. title: '创建时间',
  142. sortable: true
  143. },
  144. {
  145. title: '操作',
  146. align: 'center',
  147. formatter: function(value, row, index) {
  148. var actions = [];
  149. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  150. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
  151. actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="#" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
  152. return actions.join('');
  153. }
  154. }]
  155. };
  156. $.table.init(options);
  157. }
  158. function queryDeptTreeDaTa()
  159. {
  160. // 树结构初始化加载
  161. var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
  162. callback:{onClick:function(event, treeId, treeNode){
  163. tree.expandNode(treeNode);
  164. $("#deptId").val(treeNode.id);
  165. $("#parentId").val(treeNode.pId);
  166. $.table.search();
  167. }}
  168. }, tree, loadTree = function(){
  169. $.get(ctx + "system/dept/treeData", function(data) {
  170. tree = $.fn.zTree.init($("#tree"), setting, data); //.expandAll(true);
  171. // 展开第一级节点
  172. var nodes = tree.getNodesByParam("level", 0);
  173. for (var i = 0; i < nodes.length; i++) {
  174. tree.expandNode(nodes[i], true, false, false);
  175. }
  176. // 展开第二级节点
  177. nodes = tree.getNodesByParam("level", 1);
  178. for (var i = 0; i < nodes.length; i++) {
  179. tree.expandNode(nodes[i], true, false, false);
  180. }
  181. }, null, null, "正在加载,请稍后...");
  182. };loadTree();
  183. $('#btnExpand').click(function() {
  184. tree.expandAll(true);
  185. $(this).hide();
  186. $('#btnCollapse').show();
  187. });
  188. $('#btnCollapse').click(function() {
  189. tree.expandAll(false);
  190. $(this).hide();
  191. $('#btnExpand').show();
  192. });
  193. $('#btnRefresh').click(function() {
  194. loadTree();
  195. });
  196. }
  197. /*用户管理-部门*/
  198. function dept() {
  199. var url = ctx + "system/dept";
  200. createMenuItem(url, "部门管理");
  201. }
  202. /*用户管理-重置密码*/
  203. function resetPwd(userId) {
  204. var url = prefix + '/resetPwd/' + userId;
  205. $.modal.open("重置密码", url, '800', '300');
  206. }
  207. </script>
  208. </body>
  209. </html>