admin-handle.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div class="white-box">
  3. <div class="filter-box">
  4. <filter-user
  5. :filter-types.sync="filterTypes"
  6. :filter-btn-name="$t('common.screen')"
  7. @select-value="handleFilterUser"
  8. />
  9. </div>
  10. <el-table ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()">
  11. <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
  12. <template slot-scope="scope">
  13. <template v-if="scope.row[tableHeader.index].other.tag">
  14. <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null">{{ scope.row[tableHeader.index].value }}</el-tag>
  15. </template>
  16. <template v-else>
  17. <div v-html="scope.row[tableHeader.index].value" />
  18. </template>
  19. </template>
  20. </el-table-column>
  21. </el-table>
  22. <div class="white-box-footer">
  23. <pagination
  24. :total="totalCount"
  25. :page_size="pageSize"
  26. @size-change="handleSizeChange"
  27. @current-change="handleCurrentChange"
  28. />
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import tool from '@/utils/tool'
  34. import permission from '@/utils/permission'
  35. import { fetchAdminHandle } from '@/api/log'
  36. import filterHelper from '@/utils/filterHelper'
  37. import FilterUser from '@/components/FilterUser'
  38. import Pagination from '@/components/Pagination'
  39. export default {
  40. name: 'LogAdminLogin',
  41. components: { FilterUser, Pagination },
  42. data() {
  43. return {
  44. tableHeaders: null,
  45. allData: null,
  46. tableData: null,
  47. loading: true,
  48. currentPage: 1,
  49. totalPages: 1,
  50. totalCount: 1,
  51. pageSize: 20,
  52. tool: tool,
  53. permission: permission,
  54. filterTypes: null,
  55. filterModel: {},
  56. filterData: null
  57. }
  58. },
  59. mounted() {
  60. this.getData()
  61. },
  62. methods: {
  63. handleCurrentChange(page) {
  64. this.getData(page, this.pageSize)
  65. },
  66. handleSizeChange(pageSize) {
  67. this.getData(this.currentPage, pageSize)
  68. },
  69. handleFilterUser(filterData) {
  70. filterHelper.handleFilterUser(this, filterData)
  71. },
  72. getData(page, pageSize) {
  73. const filterData = this.filterModel
  74. console.log(filterData)
  75. const vueObj = this
  76. const paramsData = Object.assign({
  77. page: (page === null || page === undefined) ? 1 : page,
  78. pageSize: (pageSize === null || pageSize === undefined) ? vueObj.pageSize : pageSize
  79. }, filterData)
  80. fetchAdminHandle(paramsData).then(response => {
  81. vueObj.filterTypes = response.data.filterTypes
  82. vueObj.tableData = response.data.list
  83. vueObj.tableHeaders = response.data.columnsShow
  84. vueObj.currentPage = page
  85. vueObj.totalPages = parseInt(response.data.totalPages)
  86. vueObj.totalCount = parseInt(response.data.totalCount)
  87. vueObj.pageSize = pageSize
  88. this.loading = false
  89. })
  90. },
  91. handleFilter() {
  92. this.getData()
  93. }
  94. }
  95. }
  96. </script>
  97. <style scoped>
  98. </style>