log.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. html,
  14. body,
  15. #app {
  16. width: 100%;
  17. height: 100%;
  18. padding: 0;
  19. margin: 0;
  20. }
  21. .home {
  22. width: 100%;
  23. height: 100%;
  24. padding: 30px;
  25. box-sizing: border-box;
  26. display: flex;
  27. flex-direction: column;
  28. }
  29. .title {
  30. font-size: 50px;
  31. line-height: 100px;
  32. text-align: center;
  33. }
  34. .search {
  35. height: 50px;
  36. }
  37. .el-input {
  38. width: 500px;
  39. }
  40. .el-button {
  41. margin-left: 10px;
  42. }
  43. .tableBox {
  44. flex: 1;
  45. width: 100%;
  46. }
  47. .el-pagination {
  48. display: flex;
  49. justify-content: flex-end;
  50. padding: 20px 20px 0;
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <div id="app">
  56. <div class="home">
  57. <el-row class="title">{{ typeList[typeFree].name }}</el-row>
  58. <el-row class="search" v-if="typeList[typeFree].inputList.length > 0">
  59. <el-input v-model="inputObj[item.prop]" placeholder="请输入内容" v-for="item in typeList[typeFree].inputList" :key="item.symbol"></el-input>
  60. <el-button type="primary" @click="getData()">查询</el-button>
  61. </el-row>
  62. <el-row class="tableBox">
  63. <el-table :data="tableData" border style="width: 100%" height="100%">
  64. <el-table-column type="index" align="center" width="50" label="序号">
  65. </el-table-column>
  66. <el-table-column align="center" v-for="(item, ind) in typeList[typeFree].tableDataHeader" :key="ind" :prop="item.prop" :label="item.name"></el-table-column>
  67. </el-table>
  68. </el-row>
  69. <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">
  70. </el-pagination>
  71. </div>
  72. </div>
  73. </body>
  74. <!-- <script src="http://172.16.120.92:8080/YtIoT/iot/log/queryLogList?callback=dosomething"></script> -->
  75. <script>
  76. var app = new Vue({
  77. el: '#app',
  78. data() {
  79. return {
  80. typeList: [{
  81. name: "操作日志查询",
  82. tableDataHeader: [{
  83. prop: "logType",
  84. name: "日志类型"
  85. }, {
  86. prop: "logContent",
  87. name: "日志内容"
  88. }, {
  89. prop: "operateType",
  90. name: "操作类型"
  91. }, {
  92. prop: "userid",
  93. name: "操作用户账号"
  94. }, {
  95. prop: "username",
  96. name: "操作用户名称"
  97. }, {
  98. prop: "ip",
  99. name: "IP"
  100. }, {
  101. prop: "costTime",
  102. name: "耗时"
  103. }, {
  104. prop: "createBy",
  105. name: "创建人"
  106. }, {
  107. prop: "createTime",
  108. name: "创建时间"
  109. // }, {
  110. // prop: "updateBy",
  111. // name: "更新人"
  112. // }, {
  113. // prop: "updateTime",
  114. // name: "更新时间"
  115. }, ],
  116. url: "http://localhost:8080/YtIoT/iot/log/queryLogList",
  117. inputList: [
  118. // {
  119. // prop: "unit",
  120. // name: "单位信息",
  121. // symbol: Symbol()
  122. // }
  123. ],
  124. }, ],
  125. inputObj: {},
  126. typeFree: 0,
  127. tableData: [],
  128. currentPage: 1,
  129. pageSize: 50,
  130. total: 0,
  131. };
  132. },
  133. created() {
  134. this.inputObj = {};
  135. // if (
  136. // this.$route.query.type &&
  137. // this.$route.query.type < this.typeList.length
  138. // ) {
  139. // this.typeFree = this.$route.query.type;
  140. // } else {
  141. // this.typeFree = 0;
  142. // }
  143. },
  144. mounted() {
  145. this.getData();
  146. },
  147. methods: {
  148. async getData() {
  149. let data = {
  150. current: this.currentPage,
  151. size: this.pageSize,
  152. };
  153. Object.assign(data, this.inputObj)
  154. let res = await axios.get(
  155. this.typeList[this.typeFree].url + "?pageNo=" + this.currentPage + "&pageSize=" + this.pageSize
  156. );
  157. console.log(res)
  158. console.log(res.data.pageList)
  159. this.tableData = res.data.pageList.map(val => {
  160. return {
  161. ...val,
  162. operateType: val.operateType  ==  1  ?  '查询' :  val.operateType  ==  2  ?  '添加'  : val.operateType  ==  3  ?  '修改' :  val.operateType  ?  '删除'  : '',
  163. logType: val.logType  ==  1  ?  '登录日志' :  val.logType  ==  2  ?  '操作日志'  :  '',
  164. logContent: val.logContent == 1 ? '单位详情页数据获取' : val.logContent == 2 ? '电器火灾告警处理' : val.logContent == 3 ? '水警告警处理' : val.logContent == 4 ? 'RTU告警处理' : val.logContent == 5 ? '视频告警处理' : val.logContent == 6 ? '视频离线告警处理' : val.logContent == 7 ? '用户登录' : '',
  165. createTime: new Date(val.createTime.time).toLocaleString('chinese', {
  166. hour12: false
  167. })
  168. }
  169. });
  170. this.total = res.data.totalCount;
  171. },
  172. // dosomething(jsondata) {
  173. // console.log(jsondata)
  174. // // this.tableData = res.data.data.records;
  175. // // this.total = res.data.data.total;
  176. // },
  177. handleSizeChange(val) {
  178. this.pageSize = val;
  179. this.getData();
  180. console.log(`每页 ${this.pageSize} 条`);
  181. },
  182. handleCurrentChange(val) {
  183. this.currentPage = val;
  184. this.getData();
  185. console.log(`当前页: ${this.currentPage}`);
  186. },
  187. },
  188. })
  189. </script>
  190. </html>