user.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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. <style>
  8. .div_tdContent{
  9. white-space:nowrap;
  10. overflow:hidden;
  11. text-overflow:ellipsis;
  12. }
  13. .tooltip-inner{
  14. word-wrap: break-word;
  15. }
  16. </style>
  17. </head>
  18. <body class="gray-bg">
  19. <div class="ui-layout-west">
  20. <div class="box box-main">
  21. <div class="box-header">
  22. <div class="box-title">
  23. <i class="fa icon-grid"></i> 组织机构
  24. </div>
  25. <div class="box-tools pull-right">
  26. <a type="button" class="btn btn-box-tool" href="#" onclick="dept()" title="管理部门"><i class="fa fa-edit"></i></a>
  27. <button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
  28. <button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
  29. <button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
  30. </div>
  31. </div>
  32. <div class="ui-layout-content">
  33. <div id="tree" class="ztree"></div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="ui-layout-center">
  38. <div class="container-div">
  39. <div class="row">
  40. <div class="col-sm-12 search-collapse">
  41. <form id="user-form">
  42. <input type="hidden" id="deptId" name="deptId">
  43. <input type="hidden" id="parentId" name="parentId">
  44. <div class="select-list">
  45. <ul>
  46. <li>
  47. 登录名称:<input type="text" name="loginName"/>
  48. </li>
  49. <li>
  50. 用户名称:<input type="text" name="userName"/>
  51. </li>
  52. <li>
  53. 手机号码:<input type="text" name="phonenumber"/>
  54. </li>
  55. <li>
  56. 组织Code:<input type="text" name="sysUserExt.orgCode"/>
  57. </li>
  58. <li>
  59. 用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  60. <option value="">所有</option>
  61. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  62. </select>
  63. </li>
  64. <li>
  65. 用户级别:<select name="sysUserExt.salesLevel" th:with="type=${@dict.getType('sales_level')}">
  66. <option value="">所有</option>
  67. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  68. </select>
  69. </li>
  70. <li>
  71. 经销商是否认证:<select name="isOrgAuthentication">
  72. <option value="">所有</option>
  73. <option value="1">是</option>
  74. <option value="0">否</option>
  75. </select>
  76. </li>
  77. <li class="select-time">
  78. <label>创建时间: </label>
  79. <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
  80. <span>-</span>
  81. <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
  82. </li>
  83. <li>
  84. 经销商类型:<select name="sysUserExt.identity">
  85. <option value="">所有</option>
  86. <option value="1">DIY</option>
  87. <option value="2">厨卫</option>
  88. <option value="3">两者都是</option>
  89. </select>
  90. </li>
  91. <li>
  92. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  93. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  94. </li>
  95. </ul>
  96. </div>
  97. </form>
  98. </div>
  99. <div class="btn-group-sm" id="toolbar" role="group">
  100. <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="system:user:add">
  101. <i class="fa fa-plus"></i> 新增
  102. </a>
  103. <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:user:edit">
  104. <i class="fa fa-edit"></i> 修改
  105. </a>
  106. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
  107. <i class="fa fa-remove"></i> 删除
  108. </a>
  109. <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:user:import">
  110. <i class="fa fa-upload"></i> 导入
  111. </a>
  112. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
  113. <i class="fa fa-download"></i> 导出
  114. </a>
  115. </div>
  116. <div class="col-sm-12 select-table table-striped">
  117. <table id="bootstrap-table" style='table-layout:fixed;'></table>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <th:block th:include="include :: footer" />
  123. <th:block th:include="include :: layout-latest-js" />
  124. <th:block th:include="include :: ztree-js" />
  125. <script th:inline="javascript">
  126. var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
  127. var authorFlag = [[${@permission.hasPermi('system:author:config')}]];
  128. var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
  129. var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
  130. var bondedFlag = [[${@permission.hasPermi('system:user:bonded')}]];//接触绑定
  131. var salesLevelDict = [[${@dict.getType('sales_level')}]];//销售人员等级
  132. var prefix = ctx + "system/user";
  133. $(function() {
  134. var panehHidden = false;
  135. if ($(this).width() < 769) {
  136. panehHidden = true;
  137. }
  138. $('body').layout({ initClosed: panehHidden, west__size: 185 });
  139. queryUserList();
  140. queryDeptTree();
  141. });
  142. function queryUserList() {
  143. var options = {
  144. url: prefix + "/list",
  145. createUrl: prefix + "/add",
  146. updateUrl: prefix + "/edit/{id}",
  147. removeUrl: prefix + "/remove",
  148. exportUrl: prefix + "/export",
  149. importUrl: prefix + "/importData",
  150. importTemplateUrl: prefix + "/importTemplate",
  151. responseHandler: responseHandler,
  152. sortName: "createTime",
  153. sortOrder: "desc",
  154. modalName: "用户",
  155. columns: [{
  156. checkbox: true
  157. },
  158. {
  159. field: 'userId',
  160. title: '用户ID',
  161. visible: false
  162. },
  163. {
  164. field: 'loginName',
  165. title: '登录名称',
  166. width:90,
  167. sortable: true
  168. },
  169. {
  170. field: 'userName',
  171. width: 70,
  172. title: '用户名称'
  173. },
  174. {
  175. field: 'dept.deptName',
  176. width: 70,
  177. title: '部门'
  178. },
  179. {
  180. field: 'email',
  181. title: '邮箱',
  182. visible: false
  183. },
  184. {
  185. field: 'phonenumber',
  186. width: 100,
  187. title: '手机'
  188. },
  189. {
  190. visible: editFlag == 'hidden' ? false : true,
  191. title: '用户状态',
  192. width: 70,
  193. align: 'center',
  194. formatter: function (value, row, index) {
  195. return statusTools(row);
  196. }
  197. },
  198. {
  199. field: 'sysUserExt.salesLevel',
  200. width: 90,
  201. title: '销售人员等级',
  202. formatter: function(value, row, index) {
  203. return $.table.selectDictLabel(salesLevelDict, value);
  204. }
  205. },
  206. {
  207. field: 'sysUserExt.orgName',
  208. title: '组织名称',
  209. formatter: function(value, row, index) {
  210. var reg = new RegExp( '"' , "g" )
  211. if(value!==null&&value!=""){
  212. value = value.replace(reg,'&quot;');
  213. var htmlStr = '<div data-original-title="'+value+'"' +
  214. 'data-placement="bottom" data-toggle="tooltip" data-html="true"'+
  215. 'class="div_tdContent">'+value+'</div>';
  216. return htmlStr;
  217. }
  218. }
  219. },
  220. {
  221. field: 'sysUserExt.orgCode',
  222. width: 90,
  223. title: '组织code'
  224. },
  225. {
  226. field: 'isOrgAuthentication',
  227. width: 90,
  228. title: '经销商是否认证',
  229. align: 'center',
  230. formatter: function(value, row, index) {
  231. if (value==0){
  232. return '否';
  233. }else if(value==1){
  234. return '是';
  235. }else{
  236. return '未注册';
  237. }
  238. }
  239. },
  240. {
  241. title: '操作',
  242. align: 'center',
  243. width: "180px",
  244. formatter: function(value, row, index) {
  245. var actions = [];
  246. actions.push('<a class="btn btn-success btn-xs ' + authorFlag + '" href="javascript:void(0)" onclick="authorTree(\'' + row.userId + '\')"><i class="fa fa-edit"></i>权限</a> ');
  247. 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> ');
  248. 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> ');
  249. actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="javascript:void(0)" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
  250. return actions.join('');
  251. }
  252. }]
  253. };
  254. $.table.init(options);
  255. }
  256. /* 权限树 */
  257. function authorTree(userId) {
  258. var url = prefix + '/author/' + userId;
  259. $.modal.open("用户权限管理", url,500);
  260. }
  261. function queryDeptTree()
  262. {
  263. var url = ctx + "system/dept/treeData";
  264. var options = {
  265. url: url,
  266. expandLevel: 2,
  267. onClick : zOnClick
  268. };
  269. $.tree.init(options);
  270. function zOnClick(event, treeId, treeNode) {
  271. $("#deptId").val(treeNode.id);
  272. $("#parentId").val(treeNode.pId);
  273. $.table.search();
  274. }
  275. }
  276. $('#btnExpand').click(function() {
  277. $._tree.expandAll(true);
  278. $(this).hide();
  279. $('#btnCollapse').show();
  280. });
  281. $('#btnCollapse').click(function() {
  282. $._tree.expandAll(false);
  283. $(this).hide();
  284. $('#btnExpand').show();
  285. });
  286. $('#btnRefresh').click(function() {
  287. queryDeptTree();
  288. });
  289. /* 用户管理-部门 */
  290. function dept() {
  291. var url = ctx + "system/dept";
  292. $.modal.openTab("部门管理", url);
  293. }
  294. /* 用户管理-重置密码 */
  295. function resetPwd(userId) {
  296. var url = prefix + '/resetPwd/' + userId;
  297. $.modal.open("重置密码", url, '800', '300');
  298. }
  299. /* 用户状态显示 */
  300. function statusTools(row) {
  301. if (row.status == 1) {
  302. return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
  303. } else {
  304. return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
  305. }
  306. }
  307. /* 用户管理-停用 */
  308. function disable(userId) {
  309. $.modal.confirm("确认要停用用户吗?", function() {
  310. $.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
  311. })
  312. }
  313. /* 用户管理启用 */
  314. function enable(userId) {
  315. $.modal.confirm("确认要启用用户吗?", function() {
  316. $.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
  317. })
  318. }
  319. /* 查看微信信息 */
  320. function wxDetail(userId) {
  321. var options = {
  322. title: "用户微信详情",
  323. url: ctx + "wxqyuser/wxdetail/"+userId,
  324. btn: ['关闭'],
  325. yes: function (index, layero) {
  326. layer.close(index);
  327. }
  328. };
  329. $.modal.openOptions(options);
  330. }
  331. /* 用户管理启用 */
  332. function bonded(userId) {
  333. $.modal.confirm("确认要解绑用户微信吗?", function() {
  334. $.operate.post(ctx + "wxqyuser/bonded/"+userId);
  335. $.table.refresh();
  336. })
  337. }
  338. function responseHandler(){
  339. $('[data-toggle="tooltip"]').tooltip();
  340. }
  341. </script>
  342. </body>
  343. <!-- 导入区域 -->
  344. <script id="importTpl" type="text/template">
  345. <form enctype="multipart/form-data" class="mt20 mb10">
  346. <div class="col-xs-offset-1">
  347. <input type="file" id="file" name="file"/>
  348. <div class="mt10 pt5">
  349. <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
  350. &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
  351. </div>
  352. <font color="red" class="pull-left mt10">
  353. 提示:仅允许导入“xls”或“xlsx”格式文件!
  354. </font>
  355. </div>
  356. </form>
  357. </script>
  358. </html>