阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.3 KiB

2 years ago
  1. <template>
  2. <div style="height: calc(100vh - 236px);">
  3. <Search :is-log-type="isLogType" @handleClearData="handleDelt" />
  4. <el-table
  5. ref="table"
  6. :data="crud.data"
  7. style="width: 100%;"
  8. height="calc(100vh - 396px)"
  9. @row-click="clickRowHandler"
  10. @selection-change="crud.selectionChangeHandler"
  11. >
  12. <el-table-column type="selection" width="55" align="center" />
  13. <el-table-column prop="account" label="账号" min-width="150" align="center" />
  14. <el-table-column prop="username" label="用户名" align="center" min-width="150" />
  15. <el-table-column prop="fondsName" label="所属全宗" align="center" min-width="150" />
  16. <el-table-column prop="det" label="所属部门" align="center" min-width="180" />
  17. <el-table-column prop="roleNames" label="用户角色" align="center" min-width="150">
  18. <template slot-scope="scope">
  19. <div>{{ scope.row.roleNames | parseRole }}</div>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="requestIp" label="IP" align="center" min-width="180" />
  23. <el-table-column prop="createTime" label="操作时间" align="center" min-width="180">
  24. <template slot-scope="scope">
  25. <div>{{ scope.row.createTime | parseTime }}</div>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <pagination v-if="crud.data.length !== 0" />
  30. </div>
  31. </template>
  32. <script>
  33. import { FetchClearLoginLog } from '@/api/system/logs'
  34. import CRUD, { presenter, crud, header } from '@crud/crud'
  35. import pagination from '@crud/Pagination'
  36. import Search from '@/views/system/log/search.vue'
  37. // import { parseTime, saveAs, getBlob } from '@/utils/index'
  38. export default {
  39. name: 'LoginLog',
  40. components: { pagination, Search },
  41. filters: {
  42. parseRole(val) {
  43. const regex = /name=(.*)\)/
  44. const match = regex.exec(val)
  45. let role = ''
  46. if (match) {
  47. role = match[1]
  48. } else {
  49. role = val
  50. }
  51. return role
  52. }
  53. },
  54. mixins: [presenter(), crud(), header()],
  55. cruds() {
  56. return CRUD({
  57. url: 'api/log/initLoginLog',
  58. sort: [],
  59. optShow: {
  60. add: false,
  61. edit: false,
  62. del: false,
  63. download: false,
  64. reset: false,
  65. group: false
  66. }
  67. })
  68. },
  69. data() {
  70. return {
  71. isLogType: 'login',
  72. selections: []
  73. }
  74. },
  75. methods: {
  76. handleDelt() {
  77. this.$confirm('此操作将清空所选数据' + this.crud.title + '<span>你是否还要继续?</span>', '提示', {
  78. confirmButtonText: '继续',
  79. cancelButtonText: '取消',
  80. type: 'warning',
  81. dangerouslyUseHTMLString: true
  82. }).then(() => {
  83. this.crud.delAllLoading = true
  84. FetchClearLoginLog().then(() => {
  85. this.crud.notify('清空成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
  86. this.crud.delAllLoading = false
  87. this.crud.refresh()
  88. }).catch(err => {
  89. this.crud.delAllLoading = false
  90. console.log(err)
  91. })
  92. }).catch(() => {
  93. })
  94. },
  95. clickRowHandler(row) {
  96. this.$refs.table.toggleRowSelection(row) // 单击选中
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. ::v-deep .el-pagination{
  103. margin: 24px 0 10px 0 !important
  104. }
  105. </style>