data.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 :: select2-css" />
  6. </head>
  7. <body class="gray-bg">
  8. <div class="container-div">
  9. <div class="row">
  10. <div class="col-sm-12 search-collapse">
  11. <form id="data-form">
  12. <div class="select-list">
  13. <ul>
  14. <li>
  15. 字典名称:<select id="dictType" name="dictType" class="form-control">
  16. <option th:each="dict : ${dictList}" th:text="${dict['dictName']}" th:value="${dict['dictType']}" th:field="*{dict.dictType}"></option>
  17. </select>
  18. </li>
  19. <li>
  20. 字典标签:<input type="text" name="dictLabel"/>
  21. </li>
  22. <li>
  23. 数据状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
  24. <option value="">所有</option>
  25. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  26. </select>
  27. </li>
  28. <li>
  29. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  30. <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  31. </li>
  32. </ul>
  33. </div>
  34. </form>
  35. </div>
  36. <div class="btn-group-sm" id="toolbar" role="group">
  37. <a class="btn btn-success" onclick="add()" shiro:hasPermission="system:dict:add">
  38. <i class="fa fa-plus"></i> 新增
  39. </a>
  40. <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:dict:edit">
  41. <i class="fa fa-edit"></i> 修改
  42. </a>
  43. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:dict:remove">
  44. <i class="fa fa-remove"></i> 删除
  45. </a>
  46. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:dict:export">
  47. <i class="fa fa-download"></i> 导出
  48. </a>
  49. <a class="btn btn-danger" onclick="closeItem()">
  50. <i class="fa fa-reply-all"></i> 关闭
  51. </a>
  52. </div>
  53. <div class="col-sm-12 select-table table-striped">
  54. <table id="bootstrap-table"></table>
  55. </div>
  56. </div>
  57. </div>
  58. <th:block th:include="include :: footer" />
  59. <th:block th:include="include :: select2-js" />
  60. <script th:inline="javascript">
  61. var editFlag = [[${@permission.hasPermi('system:dict:edit')}]];
  62. var removeFlag = [[${@permission.hasPermi('system:dict:remove')}]];
  63. var datas = [[${@dict.getType('sys_normal_disable')}]];
  64. var prefix = ctx + "system/dict/data";
  65. $(function() {
  66. var options = {
  67. url: prefix + "/list",
  68. createUrl: prefix + "/add/{id}",
  69. updateUrl: prefix + "/edit/{id}",
  70. removeUrl: prefix + "/remove",
  71. exportUrl: prefix + "/export",
  72. queryParams: queryParams,
  73. sortName: "dictSort",
  74. sortOrder: "asc",
  75. modalName: "数据",
  76. columns: [{
  77. checkbox: true
  78. },
  79. {
  80. field: 'dictCode',
  81. title: '字典编码'
  82. },
  83. {
  84. field: 'dictLabel',
  85. title: '字典标签',
  86. formatter: function(value, row, index) {
  87. var listClass = $.common.equals("default", row.listClass) || $.common.isEmpty(row.listClass) ? "" : "badge badge-" + row.listClass;
  88. return $.common.sprintf("<span class='%s'>%s</span>", listClass, value);
  89. }
  90. },
  91. {
  92. field: 'dictValue',
  93. title: '字典键值'
  94. },
  95. {
  96. field: 'dictSort',
  97. title: '字典排序'
  98. },
  99. {
  100. field: 'status',
  101. title: '状态',
  102. align: 'center',
  103. formatter: function(value, row, index) {
  104. return $.table.selectDictLabel(datas, value);
  105. }
  106. },
  107. {
  108. field: 'remark',
  109. title: '备注'
  110. },
  111. {
  112. field: 'createTime',
  113. title: '创建时间',
  114. sortable: true
  115. },
  116. {
  117. title: '操作',
  118. align: 'center',
  119. formatter: function(value, row, index) {
  120. var actions = [];
  121. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.dictCode + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  122. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.dictCode + '\')"><i class="fa fa-remove"></i>删除</a>');
  123. return actions.join('');
  124. }
  125. }]
  126. };
  127. $.table.init(options);
  128. });
  129. function queryParams(params) {
  130. var search = $.table.queryParams(params);
  131. search.dictType = $("#dictType").val();
  132. return search;
  133. }
  134. /*字典数据-新增字典*/
  135. function add() {
  136. var dictType = $("#dictType option:selected").val();
  137. $.operate.add(dictType);
  138. }
  139. function resetPre() {
  140. $.form.reset();
  141. $("#dictType").val($("#dictType").val()).trigger("change");
  142. }
  143. </script>
  144. </body>
  145. </html>