dept.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="dept-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 部门名称:<input type="text" name="deptName"/>
  15. </li>
  16. <li>
  17. 部门状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  18. <option value="">所有</option>
  19. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  20. </select>
  21. </li>
  22. <li>
  23. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  24. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  25. </li>
  26. </ul>
  27. </div>
  28. </form>
  29. </div>
  30. <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
  31. <a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
  32. <i class="fa fa-plus"></i> 新增
  33. </a>
  34. <a class="btn btn-primary" onclick="$.operate.editTree()" shiro:hasPermission="system:dept:edit">
  35. <i class="fa fa-edit"></i> 修改
  36. </a>
  37. <a class="btn btn-info" id="expandAllBtn">
  38. <i class="fa fa-exchange"></i> 展开/折叠
  39. </a>
  40. </div>
  41. <div class="col-sm-12 select-table table-striped">
  42. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  43. </div>
  44. </div>
  45. </div>
  46. <div th:include="include :: footer"></div>
  47. <script th:inline="javascript">
  48. var addFlag = [[${@permission.hasPermi('system:dept:add')}]];
  49. var editFlag = [[${@permission.hasPermi('system:dept:edit')}]];
  50. var removeFlag = [[${@permission.hasPermi('system:dept:remove')}]];
  51. var datas = [[${@dict.getType('sys_normal_disable')}]];
  52. var prefix = ctx + "system/dept"
  53. $(function() {
  54. var options = {
  55. id: "deptId",
  56. parentId: "parentId",
  57. url: prefix + "/list",
  58. createUrl: prefix + "/add/{id}",
  59. updateUrl: prefix + "/edit/{id}",
  60. removeUrl: prefix + "/remove/{id}",
  61. modalName: "部门",
  62. columns: [{
  63. field: 'selectItem',
  64. radio: true
  65. },
  66. {
  67. field: 'deptName',
  68. title: '部门名称',
  69. align: "left"
  70. },
  71. {
  72. field: 'orderNum',
  73. title: '排序',
  74. align: "left"
  75. },
  76. {
  77. field: 'status',
  78. title: '状态',
  79. align: "left",
  80. formatter: function(value, item, index) {
  81. return $.table.selectDictLabel(datas, item.status);
  82. }
  83. },
  84. {
  85. field: 'createTime',
  86. title: '创建时间',
  87. align: "left"
  88. },
  89. {
  90. title: '操作',
  91. align: 'left',
  92. formatter: function(value, row, index) {
  93. if (row.parentId != 0) {
  94. var actions = [];
  95. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit">编辑</i></a> ');
  96. actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus">新增</i></a> ');
  97. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.deptId + '\')"><i class="fa fa-remove">删除</i></a>');
  98. return actions.join('');
  99. } else {
  100. return "";
  101. }
  102. }
  103. }]
  104. };
  105. $.treeTable.init(options);
  106. });
  107. function remove(id) {
  108. $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
  109. $.ajax({
  110. type : 'post',
  111. url: prefix + "/remove/" + id,
  112. success : function(result) {
  113. if (result.code == web_status.SUCCESS) {
  114. $.modal.msgSuccess(result.msg);
  115. $.treeTable.refresh();
  116. } else {
  117. $.modal.msgError(result.msg);
  118. }
  119. }
  120. });
  121. });
  122. }
  123. </script>
  124. </body>
  125. </html>