Rap 原分销系统代码Web
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

b93b13bc207cf99a0edfdf0f8b404bae8e437d8c.svn-base 3.3KB

pirms 5 mēnešiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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="time" label="请求耗时" align="center">
  39. <template slot-scope="scope">
  40. <el-tag v-if="scope.row.time <= 300">{{ scope.row.time }}ms</el-tag>
  41. <el-tag v-else-if="scope.row.time <= 1000" type="warning">{{ scope.row.time }}ms</el-tag>
  42. <el-tag v-else type="danger">{{ scope.row.time }}ms</el-tag>
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="createTime" label="创建日期" width="180px" />
  46. </el-table>
  47. <!--分页组件-->
  48. <pagination />
  49. </div>
  50. </template>
  51. <script>
  52. import Search from './search'
  53. import { delAllInfo } from '@/api/monitor/log'
  54. import CRUD, { presenter } from '@crud/crud'
  55. import crudOperation from '@crud/CRUD.operation'
  56. import pagination from '@crud/Pagination'
  57. export default {
  58. name: 'Log',
  59. components: { Search, crudOperation, pagination },
  60. cruds() {
  61. return CRUD({ title: '日志', url: 'api/logs/queryLog' })
  62. },
  63. mixins: [presenter()],
  64. created() {
  65. this.crud.optShow = {
  66. add: false,
  67. edit: false,
  68. del: false,
  69. download: true
  70. }
  71. },
  72. methods: {
  73. confirmDelAll() {
  74. this.$confirm(`确认清空所有操作日志吗?`, '提示', {
  75. confirmButtonText: '确定',
  76. cancelButtonText: '取消',
  77. type: 'warning'
  78. }).then(() => {
  79. this.crud.delAllLoading = true
  80. delAllInfo().then(res => {
  81. this.crud.delAllLoading = false
  82. this.crud.dleChangePage(1)
  83. this.crud.delSuccessNotify()
  84. this.crud.toQuery()
  85. }).catch(err => {
  86. this.crud.delAllLoading = false
  87. console.log(err.response.data.message)
  88. })
  89. }).catch(() => {
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style>
  96. .demo-table-expand {
  97. font-size: 0;
  98. }
  99. .demo-table-expand label {
  100. width: 70px;
  101. color: #99a9bf;
  102. }
  103. .demo-table-expand .el-form-item {
  104. margin-right: 0;
  105. margin-bottom: 0;
  106. width: 100%;
  107. }
  108. .demo-table-expand .el-form-item__content {
  109. font-size: 12px;
  110. }
  111. </style>