Rap 原分销系统代码Web
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

136 行
3.7KB

  1. <template>
  2. <div class="app-container">
  3. <div class="head-container">
  4. <Search />
  5. <crudOperation>
  6. <el-button
  7. slot="left"
  8. class="filter-item"
  9. type="danger"
  10. icon="el-icon-delete"
  11. size="mini"
  12. :loading="crud.delAllLoading"
  13. @click="confirmDelAll()"
  14. >
  15. 清空
  16. </el-button>
  17. </crudOperation>
  18. </div>
  19. <!--表格渲染-->
  20. <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
  21. <el-table-column type="expand">
  22. <template slot-scope="props">
  23. <el-form label-position="left" inline class="demo-table-expand">
  24. <el-form-item label="请求方法">
  25. <span>{{ props.row.method }}</span>
  26. </el-form-item>
  27. <el-form-item label="请求参数">
  28. <span>{{ props.row.params }}</span>
  29. </el-form-item>
  30. </el-form>
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="username" label="用户名" />
  34. <el-table-column prop="requestIp" label="IP" />
  35. <el-table-column :show-overflow-tooltip="true" prop="address" label="IP来源" />
  36. <el-table-column prop="description" label="描述" />
  37. <el-table-column prop="browser" label="浏览器" />
  38. <el-table-column prop="createTime" label="创建日期" />
  39. <el-table-column label="异常详情" width="100px">
  40. <template slot-scope="scope">
  41. <el-button size="mini" type="text" @click="info(scope.row.id)">查看详情</el-button>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <el-dialog :visible.sync="dialog" title="异常详情" append-to-body top="30px" width="85%">
  46. <pre>{{ errorInfo }}</pre>
  47. </el-dialog>
  48. <!--分页组件-->
  49. <pagination />
  50. </div>
  51. </template>
  52. <script>
  53. import { getErrDetail, delAllError } from '@/api/monitor/log'
  54. import Search from './search'
  55. import CRUD, { presenter } from '@crud/crud'
  56. import crudOperation from '@crud/CRUD.operation'
  57. import pagination from '@crud/Pagination'
  58. export default {
  59. name: 'ErrorLog',
  60. components: { Search, crudOperation, pagination },
  61. cruds() {
  62. return CRUD({ title: '异常日志', url: 'api/logs/error' })
  63. },
  64. mixins: [presenter()],
  65. data() {
  66. return {
  67. errorInfo: '', dialog: false
  68. }
  69. },
  70. created() {
  71. this.crud.optShow = {
  72. add: false,
  73. edit: false,
  74. del: false,
  75. download: true
  76. }
  77. },
  78. methods: {
  79. // 获取异常详情
  80. info(id) {
  81. this.dialog = true
  82. getErrDetail(id).then(res => {
  83. this.errorInfo = res.exception
  84. })
  85. },
  86. confirmDelAll() {
  87. this.$confirm(`确认清空所有异常日志吗?`, '提示', {
  88. confirmButtonText: '确定',
  89. cancelButtonText: '取消',
  90. type: 'warning'
  91. }).then(() => {
  92. this.crud.delAllLoading = true
  93. delAllError().then(res => {
  94. this.crud.delAllLoading = false
  95. this.crud.dleChangePage(1)
  96. this.crud.delSuccessNotify()
  97. this.crud.toQuery()
  98. }).catch(err => {
  99. this.crud.delAllLoading = false
  100. console.log(err.response.data.message)
  101. })
  102. }).catch(() => {
  103. })
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped>
  109. .demo-table-expand {
  110. font-size: 0;
  111. }
  112. .demo-table-expand label {
  113. width: 70px;
  114. color: #99a9bf;
  115. }
  116. .demo-table-expand .el-form-item {
  117. margin-right: 0;
  118. margin-bottom: 0;
  119. width: 100%;
  120. }
  121. .demo-table-expand .el-form-item__content {
  122. font-size: 12px;
  123. }
  124. /deep/ .el-dialog__body {
  125. padding: 0 20px 10px 20px !important;
  126. }
  127. .java.hljs {
  128. color: #444;
  129. background: #ffffff !important;
  130. height: 630px !important;
  131. }
  132. </style>