user.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('用户列表')"/>
  5. <th:block th:include="include :: layout-latest-css"/>
  6. <th:block th:include="include :: ztree-css"/>
  7. </head>
  8. <body class="gray-bg">
  9. <div class="ui-layout-west">
  10. <div class="box box-main">
  11. <div class="box-header">
  12. <div class="box-title">
  13. <i class="fa icon-grid"></i> 组织机构
  14. </div>
  15. <div class="box-tools pull-right">
  16. <a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="管理部门"><i
  17. class="fa fa-edit"></i></a>
  18. <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i
  19. class="fa fa-chevron-up"></i></button>
  20. <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i
  21. class="fa fa-chevron-down"></i></button>
  22. <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i
  23. class="fa fa-refresh"></i></button>
  24. </div>
  25. </div>
  26. <div class="ui-layout-content">
  27. <div id="tree" class="ztree"></div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="ui-layout-center">
  32. <div class="container-div">
  33. <div class="row">
  34. <div class="col-sm-12 search-collapse">
  35. <form id="user-form">
  36. <input type="hidden" id="deptId" name="deptId">
  37. <input type="hidden" id="parentId" name="parentId">
  38. <div class="select-list">
  39. <ul>
  40. <li>
  41. 登录名称:<input type="text" name="loginName"/>
  42. </li>
  43. <li>
  44. 手机号码:<input type="text" name="phonenumber"/>
  45. </li>
  46. <li>
  47. 用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  48. <option value="">所有</option>
  49. <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
  50. th:value="${dict.dictValue}"></option>
  51. </select>
  52. </li>
  53. <li class="select-time select-time2">
  54. <label>创建时间: </label>
  55. <input type="text" class="time-input" id="startTime" placeholder="开始时间"
  56. name="params[beginTime]"/>
  57. <span>-</span>
  58. <input type="text" class="time-input" id="endTime" placeholder="结束时间"
  59. name="params[endTime]"/>
  60. </li>
  61. <li>
  62. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
  63. class="fa fa-search"></i>&nbsp;搜索</a>
  64. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
  65. class="fa fa-refresh"></i>&nbsp;重置</a>
  66. </li>
  67. </ul>
  68. </div>
  69. </form>
  70. </div>
  71. <div class="btn-group-sm" id="toolbar" role="group">
  72. <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:user:add">
  73. <i class="fa fa-plus"></i> 新增
  74. </a>
  75. <a class="btn btn-primary single disabled" onclick="$.operate.editTab()"
  76. shiro:hasPermission="system:user:edit">
  77. <i class="fa fa-edit"></i> 修改
  78. </a>
  79. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
  80. shiro:hasPermission="system:user:remove">
  81. <i class="fa fa-remove"></i> 删除
  82. </a>
  83. <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:user:import">
  84. <i class="fa fa-upload"></i> 导入
  85. </a>
  86. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
  87. <i class="fa fa-download"></i> 导出
  88. </a>
  89. </div>
  90. <div class="col-sm-12 select-table table-striped">
  91. <table id="bootstrap-table"></table>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <th:block th:include="include :: footer"/>
  97. <th:block th:include="include :: layout-latest-js"/>
  98. <th:block th:include="include :: ztree-js"/>
  99. <script th:inline="javascript">
  100. var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
  101. var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
  102. var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
  103. var prefix = ctx + "system/user";
  104. $(function () {
  105. var panehHidden = false;
  106. if ($(this).width() < 769) {
  107. panehHidden = true;
  108. }
  109. $('body').layout({initClosed: panehHidden, west__size: 185});
  110. queryUserList();
  111. queryDeptTree();
  112. });
  113. function queryUserList() {
  114. var options = {
  115. url: prefix + "/list",
  116. createUrl: prefix + "/add",
  117. updateUrl: prefix + "/edit/{id}",
  118. removeUrl: prefix + "/remove",
  119. exportUrl: prefix + "/export",
  120. importUrl: prefix + "/importData",
  121. importTemplateUrl: prefix + "/importTemplate",
  122. sortName: "createTime",
  123. sortOrder: "desc",
  124. modalName: "用户",
  125. columns: [{
  126. checkbox: true
  127. },
  128. {
  129. field: 'orgDeptName',
  130. title: '归属部门'
  131. },
  132. {
  133. field: 'postNames',
  134. title: '岗位'
  135. },
  136. // {
  137. // field: 'postSort',
  138. // title: '岗位排序'
  139. // },
  140. {
  141. field: 'loginName',
  142. title: '登录名称',
  143. sortable: true
  144. },
  145. {
  146. field: 'userName',
  147. title: '用户名称'
  148. },
  149. {
  150. field: 'phonenumber',
  151. title: '手机'
  152. },
  153. // {
  154. // field: 'userId',
  155. // title: '用户ID'
  156. // },
  157. {
  158. visible: editFlag == 'hidden' ? false : true,
  159. title: '用户状态',
  160. align: 'center',
  161. formatter: function (value, row, index) {
  162. return statusTools(row);
  163. }
  164. },
  165. {
  166. visible: editFlag == 'hidden' ? false : true,
  167. title: '是否发送短信',
  168. align: 'center',
  169. formatter: function (value, row, index) {
  170. return statusToolsIsSendMsg(row);
  171. }
  172. },
  173. {
  174. visible: editFlag == 'hidden' ? false : true,
  175. title: '是否消息推送',
  176. align: 'center',
  177. formatter: function (value, row, index) {
  178. return statusToolsIsJGMsg(row);
  179. }
  180. },
  181. {
  182. field: 'createTime',
  183. title: '创建时间',
  184. sortable: true
  185. },
  186. // {
  187. // field: 'dept.deptName',
  188. // title: '林场部门'
  189. // },
  190. // {
  191. // field: 'orgDeptName',
  192. // title: '政府部门'
  193. // },
  194. // {
  195. // field: 'email',
  196. // title: '邮箱',
  197. // visible: false
  198. // },
  199. {
  200. title: '操作',
  201. align: 'center',
  202. formatter: function (value, row, index) {
  203. var actions = [];
  204. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  205. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
  206. var more = [];
  207. more.push("<a class='btn btn-default btn-xs " + resetPwdFlag + "' href='javascript:void(0)' onclick='resetPwd(" + row.userId + ")'><i class='fa fa-key'></i>重置密码</a> ");
  208. more.push("<a class='btn btn-default btn-xs " + editFlag + "' href='javascript:void(0)' onclick='authRole(" + row.userId + ")'><i class='fa fa-check-square-o'></i>分配角色</a>");
  209. actions.push('<a tabindex="0" class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
  210. return actions.join('');
  211. }
  212. }]
  213. };
  214. $.table.init(options);
  215. }
  216. function queryDeptTree() {
  217. var url = ctx + "system/dept/treeData";
  218. var options = {
  219. url: url,
  220. expandLevel: 2,
  221. onClick: zOnClick
  222. };
  223. $.tree.init(options);
  224. function zOnClick(event, treeId, treeNode) {
  225. $("#deptId").val(treeNode.id);
  226. $("#parentId").val(treeNode.pId);
  227. $.table.search();
  228. }
  229. }
  230. $('#btnExpand').click(function () {
  231. $._tree.expandAll(true);
  232. $(this).hide();
  233. $('#btnCollapse').show();
  234. });
  235. $('#btnCollapse').click(function () {
  236. $._tree.expandAll(false);
  237. $(this).hide();
  238. $('#btnExpand').show();
  239. });
  240. $('#btnRefresh').click(function () {
  241. queryDeptTree();
  242. });
  243. /* 用户管理-部门 */
  244. function dept() {
  245. var url = ctx + "system/dept";
  246. $.modal.openTab("部门管理", url);
  247. }
  248. /* 用户管理-重置密码 */
  249. function resetPwd(userId) {
  250. var url = prefix + '/resetPwd/' + userId;
  251. $.modal.open("重置密码", url, '800', '300');
  252. }
  253. /* 用户管理-分配角色 */
  254. function authRole(userId) {
  255. var url = prefix + '/authRole/' + userId;
  256. $.modal.openTab("用户分配角色", url);
  257. }
  258. /* 用户状态显示 */
  259. function statusTools(row) {
  260. if (row.status == 1) {
  261. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
  262. } else {
  263. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
  264. }
  265. }
  266. function statusToolsIsSendMsg(row) {
  267. if (row.issendmsg == 0) {
  268. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enableSendMsg(\'' + row.userId + '\')"></i> ';
  269. } else {
  270. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="diableSendMsg(\'' + row.userId + '\')"></i> ';
  271. }
  272. }
  273. function statusToolsIsJGMsg(row) {
  274. if (row.isjgmsg == 0) {
  275. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enableJGMsg(\'' + row.userId + '\')"></i> ';
  276. } else {
  277. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="diableJGMsg(\'' + row.userId + '\')"></i> ';
  278. }
  279. }
  280. /* 用户管理-停用 */
  281. function disable(userId) {
  282. $.modal.confirm("确认要停用用户吗?", function () {
  283. $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 1});
  284. })
  285. }
  286. /* 用户管理启用 */
  287. function enable(userId) {
  288. $.modal.confirm("确认要启用用户吗?", function () {
  289. $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 0});
  290. })
  291. }
  292. function diableSendMsg(userId) {
  293. $.modal.confirm("确认要停用发送短信吗?", function () {
  294. $.operate.post(prefix + "/changeStatus", {"userId": userId, "issendmsg": 0});
  295. })
  296. }
  297. function enableSendMsg(userId) {
  298. $.modal.confirm("确认要启用发送短信吗?", function () {
  299. $.operate.post(prefix + "/changeStatus", {"userId": userId, "issendmsg": 1});
  300. })
  301. }
  302. function diableJGMsg(userId) {
  303. $.modal.confirm("确认要停用消息推送吗?", function () {
  304. $.operate.post(prefix + "/changeStatus", {"userId": userId, "isjgmsg": 0});
  305. })
  306. }
  307. function enableJGMsg(userId) {
  308. $.modal.confirm("确认要启用消息推送吗?", function () {
  309. $.operate.post(prefix + "/changeStatus", {"userId": userId, "isjgmsg": 1});
  310. })
  311. }
  312. </script>
  313. </body>
  314. <!-- 导入区域 -->
  315. <script id="importTpl" type="text/template">
  316. <form enctype="multipart/form-data" class="mt20 mb10">
  317. <div class="col-xs-offset-1">
  318. <input type="file" id="file" name="file"/>
  319. <div class="mt10 pt5">
  320. <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
  321. &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
  322. class="fa fa-file-excel-o"></i> 下载模板</a>
  323. </div>
  324. <font color="red" class="pull-left mt10">
  325. 提示:仅允许导入“xls”或“xlsx”格式文件!
  326. </font>
  327. </div>
  328. </form>
  329. </script>
  330. </html>