period-perf.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <div class="filter-box">
  5. <filter-user ref="filterUser" :filter-types="filterTypes" @select-value="handleFilterUser"></filter-user>
  6. </div>
  7. <el-table :data="tableData" stripe style="width: 100%;" @selection-change="handleSelectionChange"
  8. :height="tool.getTableHeight(true)">
  9. <el-table-column type="selection" width="55" v-if="tableHeaders"></el-table-column>
  10. <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">
  11. <template slot-scope="scope">
  12. <template v-if="scope.row[tableHeader.index].other.tag" >
  13. <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>
  14. </template>
  15. <template v-else>
  16. <div v-html="scope.row[tableHeader.index].value"></div>
  17. </template>
  18. </template>
  19. </el-table-column>
  20. </el-table>
  21. <div class="white-box-footer">
  22. <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`bonus/period-perf-export`)">Export Excel</el-button>
  23. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import network from '@/utils/network'
  30. import tool from '@/utils/tool'
  31. import baseInfo from '@/utils/baseInfo'
  32. import FilterUser from '@/components/FilterUser'
  33. import permission from '@/utils/permission'
  34. import Pagination from '@/components/Pagination'
  35. import filterHelper from '@/utils/filterHelper'
  36. export default {
  37. name: 'leo-period-perf-table',
  38. components: {FilterUser,Pagination},
  39. mounted () {
  40. this.getData()
  41. },
  42. data () {
  43. return {
  44. tableHeaders: null,
  45. tableData: null,
  46. loading: true,
  47. multipleSelection: [],
  48. currentPage: 1,
  49. totalPages: 1,
  50. totalCount: 1,
  51. pageSize: 20,
  52. tool: tool,
  53. permission: permission,
  54. baseDecLevels: baseInfo.decLevels(),
  55. baseEmpLevels: baseInfo.empLevels(),
  56. filterTypes: null,
  57. filterModel: {},
  58. filterStatus: 'ALL',
  59. }
  60. },
  61. methods: {
  62. handleSelectionChange(val) {
  63. this.multipleSelection = val
  64. },
  65. handleCurrentChange(page) {
  66. this.getData(page, this.pageSize)
  67. },
  68. handleSizeChange(pageSize) {
  69. this.getData(this.currentPage, pageSize)
  70. },
  71. handleFilterUser(filterData){
  72. filterHelper.handleFilterUser(this, filterData)
  73. },
  74. getData (page, pageSize) {
  75. let filterData = this.filterModel
  76. if(window.location.href.indexOf('filter') === -1){
  77. filterData.filterType = this.filterStatus !== 'ALL' ? `=,${this.filterStatus}` : ''
  78. }
  79. network.getPageData(this, 'bonus/period-perf', page, pageSize, filterData, response=>{
  80. this.filterTypes = response.filterTypes
  81. })
  82. },
  83. handleExport () {
  84. let filterData = this.filterModel
  85. if(window.location.href.indexOf('filter') === -1){
  86. filterData.filterType = this.filterStatus !== 'ALL' ? `=,${this.filterStatus}` : ''
  87. }
  88. this.$confirm('Are you sure you want to export the current data?', 'Notice', {
  89. confirmButtonText: 'confirm', // 确定
  90. cancelButtonText: 'cancel', // 取消
  91. type: 'warning'
  92. }).then(() => {
  93. return network.getData('bonus/period-perf-export', filterData)
  94. }).then(response => {
  95. this.$message({
  96. message: response,
  97. type: 'success'
  98. })
  99. }).catch(response => {
  100. })
  101. },
  102. }
  103. }
  104. </script>
  105. <style>
  106. .leo-withdrawTable .el-form-item__label {
  107. width: 100px;
  108. color: #99a9bf;
  109. }
  110. .leo-withdrawTable .el-form-item {
  111. width: 40%;
  112. margin-right: 0;
  113. margin-bottom: 0;
  114. }
  115. </style>