dept.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 select-info">
  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. </li>
  25. </ul>
  26. </div>
  27. </form>
  28. </div>
  29. <div class="btn-group hidden-xs" id="toolbar" role="group">
  30. <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
  31. <i class="fa fa-plus"></i> 新增
  32. </a>
  33. </div>
  34. <div class="col-sm-12 select-table table-striped">
  35. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  36. </div>
  37. </div>
  38. </div>
  39. <div th:include="include :: footer"></div>
  40. <script th:inline="javascript">
  41. var addFlag = [[${@permission.hasPermi('system:dept:add')}]];
  42. var editFlag = [[${@permission.hasPermi('system:dept:edit')}]];
  43. var removeFlag = [[${@permission.hasPermi('system:dept:remove')}]];
  44. var datas = [[${@dict.getType('sys_normal_disable')}]];
  45. var prefix = ctx + "system/dept"
  46. $(function() {
  47. var options = {
  48. id: "deptId",
  49. parentId: "parentId",
  50. url: prefix + "/list",
  51. createUrl: prefix + "/add/{id}",
  52. updateUrl: prefix + "/edit/{id}",
  53. removeUrl: prefix + "/remove/{id}",
  54. modalName: "部门",
  55. columns: [{
  56. field: 'deptName',
  57. title: '部门名称',
  58. },
  59. {
  60. field: 'orderNum',
  61. title: '排序',
  62. align: "center"
  63. },
  64. {
  65. field: 'status',
  66. title: '状态',
  67. align: "center",
  68. formatter: function(value, item, index) {
  69. return $.table.selectDictLabel(datas, item.status);
  70. }
  71. },
  72. {
  73. field: 'createTime',
  74. title: '创建时间',
  75. align: "center"
  76. },
  77. {
  78. title: '操作',
  79. align: 'center',
  80. formatter: function(value, row, index) {
  81. if (row.parentId != 0) {
  82. var actions = [];
  83. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.deptId + '\')"><i class="fa fa-edit">编辑</i></a> ');
  84. actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.deptId + '\')"><i class="fa fa-plus">新增</i></a> ');
  85. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.deptId + '\')"><i class="fa fa-remove">删除</i></a>');
  86. return actions.join('');
  87. } else {
  88. return "";
  89. }
  90. }
  91. }]
  92. };
  93. $.treeTable.init(options);
  94. });
  95. function remove(id) {
  96. $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
  97. $.ajax({
  98. type : 'post',
  99. url: prefix + "/remove/" + id,
  100. success : function(result) {
  101. if (result.code == web_status.SUCCESS) {
  102. $.modal.alertSuccess(result.msg);
  103. $.treeTable.refresh();
  104. } else {
  105. $.modal.alertError(result.msg);
  106. }
  107. }
  108. });
  109. });
  110. }
  111. </script>
  112. </body>
  113. </html>