data.html 4.6 KB

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