error.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :table-loading="loading"
  5. :data="data"
  6. ref="crud"
  7. :before-open="beforeOpen"
  8. v-model="form"
  9. :permission="permissionList"
  10. :page="page"
  11. @search-change="searchChange"
  12. @search-reset="searchReset"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad">
  17. </avue-crud>
  18. </basic-container>
  19. </template>
  20. <script>
  21. import {getErrorList, getErrorLogs} from "@/api/logs";
  22. import {mapGetters} from "vuex";
  23. export default {
  24. data() {
  25. return {
  26. form: {},
  27. selectionList: [],
  28. query: {},
  29. loading: true,
  30. page: {
  31. pageSize: 10,
  32. currentPage: 1,
  33. total: 0
  34. },
  35. option: {
  36. height:'auto',
  37. calcHeight:350,
  38. tip: false,
  39. searchShow: true,
  40. searchMenuSpan: 6,
  41. border: true,
  42. index: true,
  43. viewBtn: true,
  44. editBtn: false,
  45. addBtn: false,
  46. delBtn: false,
  47. menuWidth: 120,
  48. column: [
  49. {
  50. label: "服务id",
  51. prop: "serviceId",
  52. search: true,
  53. width:'120'
  54. },
  55. {
  56. label: "服务host",
  57. prop: "serverHost",
  58. search: true,
  59. width:'150'
  60. },
  61. {
  62. label: "服务ip",
  63. prop: "serverIp",
  64. width:'160'
  65. },
  66. {
  67. label: "软件环境",
  68. prop: "env",
  69. width:'80'
  70. },
  71. {
  72. label: "请求方法",
  73. prop: "method",
  74. width:'80'
  75. },
  76. {
  77. label: "请求接口",
  78. prop: "requestUri"
  79. },
  80. {
  81. label: "日志时间",
  82. prop: "createTime",
  83. width:'180'
  84. },
  85. {
  86. label: "用户代理",
  87. prop: "userAgent",
  88. span: 24,
  89. hide: true
  90. },
  91. {
  92. label: "请求数据",
  93. prop: "params",
  94. type: "textarea",
  95. span: 24,
  96. minRows: 2,
  97. hide: true
  98. },
  99. {
  100. label: "日志数据",
  101. prop: "stackTrace",
  102. type: "textarea",
  103. span: 24,
  104. minRows: 6,
  105. hide: true
  106. }
  107. ]
  108. },
  109. data: []
  110. };
  111. },
  112. computed: {
  113. ...mapGetters(["permission"]),
  114. permissionList() {
  115. return {
  116. viewBtn: this.vaildData(this.permission.log_error_view, false)
  117. };
  118. }
  119. },
  120. methods: {
  121. searchReset() {
  122. this.query = {};
  123. this.onLoad(this.page);
  124. },
  125. searchChange(params, done) {
  126. this.query = params;
  127. this.page.currentPage = 1;
  128. this.onLoad(this.page, params);
  129. done();
  130. },
  131. beforeOpen(done, type) {
  132. if (["edit", "view"].includes(type)) {
  133. getErrorLogs(this.form.id).then(res => {
  134. this.form = res.data.data;
  135. });
  136. }
  137. done();
  138. },
  139. currentChange(currentPage){
  140. this.page.currentPage = currentPage;
  141. },
  142. sizeChange(pageSize){
  143. this.page.pageSize = pageSize;
  144. },
  145. refreshChange() {
  146. this.onLoad(this.page, this.query);
  147. },
  148. onLoad(page, params = {}) {
  149. this.loading = true;
  150. getErrorList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
  151. const data = res.data.data;
  152. this.page.total = data.total;
  153. this.data = data.records;
  154. this.loading = false;
  155. });
  156. }
  157. }
  158. };
  159. </script>
  160. <style>
  161. </style>