perf-standard.vue 4.1 KB

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