log.jsp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"
  2. pageEncoding="UTF-8"%>
  3. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <jsp:include page="../common/common-meta-include.jsp"></jsp:include>
  8. <jsp:include page="../common/common-js-include.jsp"></jsp:include>
  9. <jsp:include page="../common/common-css-include.jsp"></jsp:include>
  10. <!--[if lt IE 9]>
  11. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  12. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  13. <![endif]-->
  14. </head>
  15. <body>
  16. <div id="app"></div>
  17. <template id="template">
  18. <div class="layui-layout layui-layout-admin pd0">
  19. <!-- 内容区域 -->
  20. <div class="right_title">
  21. <div class="txt">日志查询<div class="top-breadcrumb"></div></div>
  22. <%-- <button class="btn btn_add" @click="add"><i class="layui-icon layui-icon-add-circle"></i> 新增</button>--%>
  23. <div class="layui-collapse search_form">
  24. <div class="layui-colla-item">
  25. <%-- <h2 class="layui-colla-title">筛选</h2>--%>
  26. <div class="layui-colla-content layui-show">
  27. <form class="layui-form" lay-filter="searchForm">
  28. <div class="layui-row">
  29. <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
  30. <div class="layui-form-item">
  31. <label class="layui-form-label">登录名</label>
  32. <div class="layui-input-block">
  33. <input type="text" name="loginName" placeholder="请输入" autocomplete="off" class="layui-input">
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. <div class="layui-row">
  39. <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
  40. <button type="button" class="layui-btn layui-btn-normal" @click="search">查询</button>
  41. </div>
  42. </div>
  43. </form>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="table_box" style="padding-top: 0;">
  49. <div class="table_process">
  50. <table id="table1" lay-filter="test"></table>
  51. <div class="pagination-box" id="pagination"></div>
  52. </div>
  53. </div>
  54. <div style="height: 20px;"></div>
  55. </div>
  56. </template>
  57. <script type="text/html" id="statusTemplate">
  58. {{# if(d.status){ }}
  59. 成功
  60. {{# } else { }}
  61. 失败
  62. {{# } }}
  63. </script>
  64. <script>
  65. new Vue({
  66. el: "#app",
  67. template: "#template",
  68. data: {
  69. winH: 0,
  70. dataList : [],
  71. amtSum:"",
  72. tableName : 'test',
  73. pageNo : 1,
  74. indusKind : {},
  75. propKind : {},
  76. sortZje: '',
  77. sortCe: '',
  78. sortTime: '',
  79. sort: {
  80. field: 'amtTatol',
  81. type: null
  82. },
  83. kind: {},
  84. pageSize : 10
  85. },
  86. mounted : function() {
  87. this.init();
  88. },
  89. methods: {
  90. init : function() {
  91. this.winH = document.body.clientHeight
  92. this.getData();
  93. //window.toDetail = this.toDetail;
  94. window.addEventListener('message', this.receiveMessage, false);
  95. window.parent.postMessage('init loaded')
  96. },
  97. getData : function(){
  98. var self = this;
  99. var param = layui.form.getValue("searchForm");
  100. param.pageNo = this.pageNo;
  101. param.pageSize = this.pageSize;
  102. App.postJson("/api/loginlog/list",param, function(res){
  103. self.dataList = res.rows;
  104. self.loadPage(res.total);
  105. self.loadTable();
  106. });
  107. },
  108. loadTable : function(){
  109. var self = this;
  110. layui.table.render({
  111. elem: '#table1', // 指定原始表格元素选择器(推荐id选择器)
  112. even: true,
  113. autoSort: false,
  114. initSort: self.sort,
  115. cols: [[ // 设置表头
  116. {type: 'numbers', align: 'center',title:'序号',width:44},
  117. {field: 'loginname', title: '登录名', minWidth: 300},
  118. {field: 'ip', title: 'ip', minWidth: 100},
  119. {field: 'remark', title: '备注', minWidth: 100},
  120. {field: 'createTime', title: '登录时间', minWidth: 100},
  121. {field: 'status', title: '登录状态', minWidth: 300, templet:'#statusTemplate'},
  122. ]],
  123. fixed:true,
  124. data : self.dataList,
  125. done: function (res, curr, count) {
  126. res.data.forEach(function (item, index) {
  127. $(".layui-table-body tr").resize(function () {
  128. $(".layui-table-body tr").each(function (index, val) {
  129. $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
  130. });
  131. });
  132. //初始化高度,使得冻结行表体高度一致
  133. $(".layui-table-body tr").each(function (index, val) {
  134. $($(".layui-table-fixed .layui-table-body table tr")[index]).height($(val).height());
  135. });
  136. });
  137. }
  138. });
  139. layui.table.on('tool('+this.tableName+')', function(obj){
  140. var event = obj.event;
  141. self[event].call(this, obj);
  142. });
  143. },
  144. loadPage : function(totalCount){
  145. var self = this;
  146. layui.laypage.render({
  147. elem: 'pagination',
  148. count: totalCount,
  149. curr : self.pageNo,
  150. limit : self.pageSize,
  151. layout: ['count', 'prev', 'page', 'next', 'skip'],
  152. jump: function(obj, first) {
  153. //首次不执行
  154. if(!first) {
  155. self.pageNo = obj.curr;
  156. self.getData();
  157. }
  158. }
  159. });
  160. },
  161. search : function(){
  162. this.pageNo = 1;
  163. this.getData();
  164. },
  165. receiveMessage (e) {
  166. console.log('cb receiveMessage: ', e.data)
  167. if (e.data.topBreadcrumb) {
  168. $(".top-breadcrumb").html(e.data.topBreadcrumb)
  169. }
  170. }
  171. }
  172. });
  173. </script>
  174. </body>
  175. </html>