log.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
  9. <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  10. <script src="https://unpkg.com/element-ui/lib/index.js"></script>
  11. <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  12. <style>
  13. .el-table {
  14. background: transparent !important;
  15. }
  16. .el-table table {
  17. flex-shrink: 0;
  18. width: 100% !important;
  19. }
  20. .el-table table {
  21. font-size: 14px;
  22. }
  23. .el-table th {
  24. color: #FFF;
  25. background: rgba(0, 250, 251, 0.20);
  26. border-color: transparent;
  27. }
  28. .el-table .cell {
  29. padding: 0;
  30. }
  31. .el-table tr {
  32. margin-bottom: 1px;
  33. }
  34. .el-table tr,
  35. td {
  36. padding: 0;
  37. background: rgba(0, 251, 251, .051) !important;
  38. color: #FFF;
  39. border-color: rgba(0, 250, 251, 0.20);
  40. }
  41. .el-table thead th {
  42. padding: 0;
  43. height: 34px;
  44. border-color: rgba(0, 250, 251, 0.20) !important;
  45. }
  46. .el-table .el-table__expanded-cell {
  47. padding: 10px;
  48. }
  49. .el-table .el-table__expand-icon {
  50. color: #FFF;
  51. }
  52. .el-table .cell {
  53. padding:0 10px;
  54. }
  55. .el-table .name-wrapper {
  56. white-space: nowrap;
  57. -webkit-box-sizing: border-box;
  58. box-sizing: border-box;
  59. overflow: hidden;
  60. text-overflow: ellipsis;
  61. word-break: break-all;
  62. }
  63. .el-table .el-table__body-wrapper {
  64. scrollbar-width: none;
  65. /* firefox */
  66. -ms-overflow-style: none;
  67. /* IE 10+ */
  68. overflow-x: hidden;
  69. overflow-y: auto;
  70. }
  71. .el-table .el-table__body-wrapper::-webkit-scrollbar {
  72. display: none;
  73. }
  74. html,body,#app{
  75. width: 100%;
  76. height: 100%;
  77. padding: 0;
  78. margin:0;
  79. }
  80. .home {
  81. width: 100%;
  82. height: 100%;
  83. padding: 30px;
  84. box-sizing: border-box;
  85. display: flex;
  86. flex-direction: column;
  87. }
  88. .title {
  89. font-size: 50px;
  90. line-height: 100px;
  91. text-align: center;
  92. }
  93. .search {
  94. height: 50px;
  95. }
  96. .el-input {
  97. width: 500px;
  98. }
  99. .el-button {
  100. margin-left: 10px;
  101. }
  102. .tableBox {
  103. flex: 1;
  104. width: 100%;
  105. }
  106. .el-pagination {
  107. display: flex;
  108. justify-content: flex-end;
  109. padding: 20px 20px 0;
  110. }
  111. </style>
  112. </head>
  113. <body>
  114. <div id="app">
  115. <div class="home">
  116. <!-- <el-row class="title">{{ typeList[typeFree].name }}</el-row>-->
  117. <el-row class="search" v-if="typeList[typeFree].inputList.length > 0">
  118. <el-input v-model="inputObj[item.prop]" placeholder="请输入内容" v-for="item in typeList[typeFree].inputList" :key="item.symbol"></el-input>
  119. <el-button type="primary" @click="getData()">查询</el-button>
  120. </el-row>
  121. <el-row class="tableBox">
  122. <el-table :data="tableData" border style="width: 100%" height="100%">
  123. <el-table-column type="index" align="center" width="50" label="序号">
  124. </el-table-column>
  125. <el-table-column align="center" v-for="(item, ind) in typeList[typeFree].tableDataHeader" :key="ind" :prop="item.prop" :label="item.name">
  126.  <template slot-scope="scope">{{item.prop === 'operateType' ? (scope.row[item.prop] == 1 ? '查询': scope.row[item.prop] == 2 ? '添加' : scope.row[item.prop] == 3 ? '修改' : scope.row[item.prop] ==  4 ? '删除' :'') : item.prop === 'logType' ? (scope.row[item.prop] == 1 ? '登录日志': scope.row[item.prop] == 2 ? '操作日志' : '') : scope.row[item.prop]}}</template>
  127. </el-table-column>
  128. </el-table>
  129. </el-row>
  130. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[30, 50, 100, 150]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
  131. </el-pagination>
  132. </div>
  133. </div>
  134. </body>
  135. <!-- <script src="http://172.16.120.92:8080/YtIoT/iot/log/queryLogList?callback=dosomething"></script> -->
  136. <script>
  137. var app = new Vue({
  138. el: '#app',
  139. data() {
  140. return {
  141. typeList: [{
  142. name: "操作日志查询",
  143. tableDataHeader: [{
  144. prop: "logType",
  145. name: "日志类型"
  146. }, {
  147. prop: "logContent",
  148. name: "日志内容"
  149. }, {
  150. prop: "operateType",
  151. name: "操作类型"
  152. }, {
  153. prop: "userid",
  154. name: "操作用户账号"
  155. }, {
  156. prop: "username",
  157. name: "操作用户名称"
  158. }, {
  159. prop: "ip",
  160. name: "IP"
  161. }, {
  162. prop: "costTime",
  163. name: "耗时"
  164. }, {
  165. prop: "createBy",
  166. name: "创建人"
  167. }, {
  168. prop: "createTime",
  169. name: "创建时间"
  170. }, {
  171. prop: "updateBy",
  172. name: "更新人"
  173. }, {
  174. prop: "updateTime",
  175. name: "更新时间"
  176. }, ],
  177. url: "http://47.111.81.118:8080/YtIoT/iot/log/queryLogList",
  178. inputList: [
  179. // {
  180. // prop: "unit",
  181. // name: "单位信息",
  182. // symbol: Symbol()
  183. // }
  184. ],
  185. }, ],
  186. inputObj: {},
  187. typeFree: 0,
  188. tableData: [],
  189. currentPage: 1,
  190. pageSize: 50,
  191. total: 0,
  192. };
  193. },
  194. created() {
  195. this.inputObj = {};
  196. // if (
  197. // this.$route.query.type &&
  198. // this.$route.query.type < this.typeList.length
  199. // ) {
  200. // this.typeFree = this.$route.query.type;
  201. // } else {
  202. // this.typeFree = 0;
  203. // }
  204. },
  205. mounted() {
  206. this.getData();
  207. },
  208. methods: {
  209. async getData() {
  210. let data = {
  211. current: this.currentPage,
  212. size: this.pageSize,
  213. };
  214. Object.assign(data, this.inputObj)
  215. let res = await axios.get(
  216. this.typeList[this.typeFree].url + "?current=" + this.currentPage + "&pageSize=" + this.pageSize
  217. );
  218. console.log(res)
  219. console.log(res.data.pageList)
  220. this.tableData = res.data.pageList;
  221. this.total = res.data.totalCount;
  222. },
  223. // dosomething(jsondata) {
  224. // console.log(jsondata)
  225. // // this.tableData = res.data.data.records;
  226. // // this.total = res.data.data.total;
  227. // },
  228. handleSizeChange(val) {
  229. this.pageSize = val;
  230. this.getData();
  231. console.log(`每页 ${this.pageSize} 条`);
  232. },
  233. handleCurrentChange(val) {
  234. this.currentPage = val;
  235. this.getData();
  236. console.log(`当前页: ${this.currentPage}`);
  237. },
  238. },
  239. })
  240. </script>
  241. </html>