Aucune description

index.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="app-container calendar-list-container">
  3. <div class="app-container">
  4. <el-table :data="detail" :span-method="objectSpanMethod" border style="width: 100% margin-top: 20px">
  5. <el-table-column prop="MemberRecord.GambleMember.name" label="玩家" width="180">
  6. </el-table-column>
  7. <el-table-column prop="MemberRecord.door" label="押">
  8. </el-table-column>
  9. <el-table-column prop="MemberRecord.wager" label="額度">
  10. </el-table-column>
  11. <el-table-column prop="DealingRecord.totalPoints" label="點數">
  12. </el-table-column>
  13. <el-table-column prop="MemberRecord.earned" label="輸贏">
  14. </el-table-column>
  15. <el-table-column prop="amount3" label="抽水">
  16. </el-table-column>
  17. <el-table-column prop="Membehips" label="輸贏合計">
  18. </el-table-column>
  19. <el-table-column prop="amount3" label="福利">
  20. </el-table-column>
  21. <el-table-column prop="MemberRecord.GambleMember.chips" label="最終積分">
  22. </el-table-column>
  23. </el-table>
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { mapGetters, mapActions } from 'vuex'
  29. import { fetchDetails, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
  30. import _ from 'lodash'
  31. export default {
  32. data() {
  33. return {
  34. list: null,
  35. listLoading: true,
  36. total: null,
  37. memberRecords: [],
  38. dealingRecords: [],
  39. groupMember: [],
  40. detail: [],
  41. group: [],
  42. statement: '',
  43. row: 0,
  44. col: 0,
  45. func: '',
  46. rowIndex: 0,
  47. colIndex: 0
  48. }
  49. },
  50. props: [ 'bucket' ],
  51. created() {
  52. this.SetListVisble(false)
  53. this.getList()
  54. },
  55. computed: {
  56. ...mapGetters([
  57. 'listVisble',
  58. ])
  59. },
  60. methods: {
  61. ...mapActions([
  62. 'SetListVisble',
  63. ]),
  64. getList() {
  65. this.listLoading = true
  66. let group ,detailTemp
  67. fetchDetails(this.bucket).then(reponse => {
  68. let group, dealingTemp
  69. dealingTemp = reponse.data.rows.filter(record => {
  70. return record.DealingRecord.door !== -1 &&
  71. record.MemberRecord.door !== -1 &&
  72. record.MemberRecord.door === record.DealingRecord.door
  73. })
  74. group = _.groupBy(dealingTemp, record => {
  75. return record.MemberRecord.GambleMember.name;
  76. });
  77. this.group = _.values(group)
  78. const sum = (i) => {
  79. let count = 0
  80. for(let j=0 ;j<i ;j++){
  81. count += this.group[j].length
  82. }
  83. return count
  84. }
  85. for(let i = 0 ;i < this.group.length ;i++){
  86. if(i === 0) {
  87. this.statement =
  88. `if(this.rowIndex === ${i}){
  89. this.row = ${this.group[i].length},
  90. this.col = 1
  91. }`
  92. }else if(i === this.group.length-1){
  93. this.statement +=
  94. `else if(this.rowIndex === ${sum(i)}){
  95. this.row = ${this.group[i].length},
  96. this.col = 1
  97. }else {
  98. this.row = 0,
  99. this.col = 0
  100. }`
  101. }else {
  102. this.statement +=
  103. `else if(this.rowIndex === ${sum(i)}){
  104. this.row = ${this.group[i].length},
  105. this.col = 1
  106. }`
  107. }
  108. }
  109. this.func = eval(`(function() {${this.statement}})`)
  110. dealingTemp.map(record => {
  111. this.detail.push(record)
  112. })
  113. this.detail = _.sortBy(this.detail, 'MemberRecord.GambleMember.name');
  114. })
  115. this.listLoading = false
  116. },
  117. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  118. if (columnIndex === 0 || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8) {
  119. this.rowIndex = rowIndex
  120. this.columnIndex = columnIndex
  121. const that = this
  122. this.func()
  123. return {
  124. rowspan: this.row,
  125. colspan: this.col
  126. }
  127. }
  128. }
  129. },
  130. destroyed() {
  131. this.SetListVisble(true)
  132. }
  133. }
  134. </script>