trace-down-qy.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <trace-down-qy-filter :filter="handleFilter"></trace-down-qy-filter>
  5. <el-table class="table-box" ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()">
  6. <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">
  7. <template slot-scope="scope">
  8. <template v-if="scope.row[tableHeader.index].other.tag" >
  9. <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>
  10. </template>
  11. <template v-else>
  12. <div v-html="scope.row[tableHeader.index].value"></div>
  13. </template>
  14. </template>
  15. </el-table-column>
  16. </el-table>
  17. <div class="white-box-footer">
  18. <el-button type="success" size="small" @click="handleExport" v-show="permission.hasPermission(`bonus/trace-down-qy-export`)">Export Excel</el-button>
  19. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. import network from '@/utils/network'
  26. import tool from '@/utils/tool'
  27. import TraceDownQyFilter from './trace-down-qy-filter'
  28. import baseInfo from '@/utils/baseInfo'
  29. import Pagination from '@/components/Pagination'
  30. import permission from '@/utils/permission'
  31. export default {
  32. name: 'bonus_trace-down-qy',
  33. components: {TraceDownQyFilter,Pagination},
  34. mounted () {
  35. this.loading = false
  36. },
  37. data () {
  38. return {
  39. tableHeaders: null,
  40. tableData: null,
  41. loading: true,
  42. multipleSelection: [],
  43. currentPage: 1,
  44. totalPages: 1,
  45. totalCount: 1,
  46. pageSize: 20,
  47. tool: tool,
  48. permission: permission,
  49. filterData: null,
  50. baseDecLevels: baseInfo.decLevels(),
  51. baseEmpLevels: baseInfo.empLevels(),
  52. }
  53. },
  54. methods: {
  55. handleCurrentChange (page) {
  56. this.getData(page, this.pageSize)
  57. },
  58. handleSizeChange (pageSize) {
  59. this.getData(this.currentPage, pageSize)
  60. },
  61. handleFilter (model) {
  62. this.filterData = model
  63. this.getData(1, this.pageSize)
  64. },
  65. getData (page, pageSize) {
  66. let vueObj = this
  67. network.getPageData(this, 'bonus/trace-down-qy', page, pageSize, this.filterData, function (response) {
  68. vueObj.tableData = response.list
  69. })
  70. },
  71. handleExport(){
  72. this.$confirm(`确定要导出当前数据吗?`, 'Hint', {
  73. confirmButtonText: 'confirm', // 确定
  74. cancelButtonText: 'cancel', // 取消
  75. type: 'warning'
  76. }).then(() => {
  77. return network.getData(`bonus/trace-down-qy-export`, this.filterData)
  78. }).then(response => {
  79. this.$message({
  80. message: response,
  81. type: 'success'
  82. })
  83. }).catch(response => {
  84. })
  85. },
  86. }
  87. }
  88. </script>
  89. <style scoped>
  90. .table-box .el-form-item__label {
  91. width: 100px;
  92. color: #99a9bf;
  93. }
  94. .table-box .el-form-item {
  95. width: 30%;
  96. margin-right: 0;
  97. margin-bottom: 0;
  98. }
  99. </style>