user-handle.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <div class="filter-box">
  5. <filter-user :filter-types.sync="filterTypes" filter-btn-name="Select"
  6. @select-value="handleFilterUser"></filter-user>
  7. </div>
  8. <el-table ref="multipleTable" :data="tableData" stripe style="width: 100%;" @row-click="handleExpand" :height="tool.getTableHeight()">
  9. <el-table-column type="expand" v-if="tableHeaders">
  10. <template slot-scope="scope">
  11. <el-card class="box-card">
  12. <div slot="header" class="clearfix">
  13. <span>保存前内容</span>
  14. </div>
  15. <ul class="log-content">
  16. <li v-for="(item,key) in scope.row.save_before_content" :key="key" v-if="chkLabel(item.label)"><span>{{item.label}}:</span><strong>{{item.value}}</strong></li>
  17. </ul>
  18. </el-card>
  19. <el-card class="box-card">
  20. <div slot="header" class="clearfix">
  21. <span>保存后内容</span>
  22. </div>
  23. <ul class="log-content">
  24. <li v-for="(item,key) in scope.row.save_after_content" :key="key" v-if="chkLabel(item.label)"><span>{{item.label}}:</span><strong>{{item.value}}</strong></li>
  25. </ul>
  26. </el-card>
  27. </template>
  28. </el-table-column>
  29. <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" :show-overflow-tooltip="tableHeader.other['show-overflow-tooltip'] ? tableHeader.other['show-overflow-tooltip'] : false" :min-width="tableHeader.other['min-width'] ? tableHeader.other['min-width'] : ''">
  30. <template slot-scope="scope">
  31. <template v-if="scope.row[tableHeader.index].other.tag" >
  32. <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>
  33. </template>
  34. <template v-else>
  35. <div v-html="scope.row[tableHeader.index].value"></div>
  36. </template>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. <div class="white-box-footer">
  41. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import network from '@/utils/network'
  48. import tool from '@/utils/tool'
  49. import FilterUser from '@/components/FilterUser'
  50. import Pagination from '@/components/Pagination'
  51. import permission from '@/utils/permission'
  52. import filterHelper from '@/utils/filterHelper'
  53. export default {
  54. name: 'log_user-handle',
  55. components: {FilterUser,Pagination},
  56. mounted() {
  57. this.getData()
  58. },
  59. data() {
  60. return {
  61. tableHeaders: null,
  62. allData: null,
  63. tableData: null,
  64. loading: true,
  65. currentPage: 1,
  66. totalPages: 1,
  67. totalCount: 1,
  68. pageSize: 20,
  69. tool: tool,
  70. permission: permission,
  71. filterTypes: null,
  72. filterModel: {},
  73. }
  74. },
  75. methods: {
  76. chkLabel(label){
  77. let arr = ['ID','USER_ID']
  78. return !arr.includes(label)
  79. },
  80. handleExpand(row, event, column) {
  81. this.$refs.multipleTable.toggleRowExpansion(row)
  82. },
  83. handleCurrentChange(page) {
  84. this.getData(page, this.pageSize)
  85. },
  86. handleSizeChange(pageSize) {
  87. this.getData(this.currentPage, pageSize)
  88. },
  89. handleFilterUser(filterData) {
  90. filterHelper.handleFilterUser(this, filterData)
  91. },
  92. handleFilter() {
  93. this.getData()
  94. },
  95. getData(page, pageSize) {
  96. let filterData = this.filterModel
  97. let vueObj = this
  98. network.getPageData(this, 'log/user-handle', page, pageSize, filterData, function (response) {
  99. vueObj.filterTypes = response.filterTypes
  100. vueObj.allData = response
  101. })
  102. },
  103. }
  104. }
  105. </script>
  106. <style scoped>
  107. .box-card{display: inline-block;min-width: 480px;margin-right: 20px;max-width: 45%; vertical-align: top;}
  108. .log-content{padding:0 15px;margin: 0;}
  109. .log-content li{line-height: 2;display: flex}
  110. .log-content span{display: inline-block;color: #999;width: 200px;white-space: nowrap;}
  111. .log-content strong{flex: 1;word-break: break-all;}
  112. </style>