user.html 14 KB

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