Aucune description

index.vue 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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.getList()
  53. },
  54. computed: {
  55. ...mapGetters([
  56. 'listVisble',
  57. ])
  58. },
  59. methods: {
  60. ...mapActions([
  61. 'SetListVisble',
  62. ]),
  63. getList() {
  64. this.listLoading = true
  65. let group ,detailTemp
  66. fetchDetails(this.bucket).then(reponse => {
  67. let group, dealingTemp
  68. dealingTemp = reponse.data.rows.filter(record => {
  69. return record.DealingRecord.door !== -1 &&
  70. record.MemberRecord.door !== -1 &&
  71. record.MemberRecord.door === record.DealingRecord.door
  72. })
  73. console.log('dddd',this.detail)
  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. console.log(this.group)
  87. if(i === 0) {
  88. this.statement =
  89. `if(this.rowIndex === ${i}){
  90. this.row = ${this.group[i].length},
  91. this.col = 1
  92. }`
  93. }else if(i === this.group.length-1){
  94. this.statement +=
  95. `else if(this.rowIndex === ${sum(i)}){
  96. this.row = ${this.group[i].length},
  97. this.col = 1
  98. }else {
  99. this.row = 0,
  100. this.col = 0
  101. }`
  102. }else {
  103. this.statement +=
  104. `else if(this.rowIndex === ${sum(i)}){
  105. this.row = ${this.group[i].length},
  106. this.col = 1
  107. }`
  108. }
  109. }
  110. console.log(this.statement)
  111. this.func = eval(`(function() {${this.statement}})`)
  112. dealingTemp.map(record => {
  113. this.detail.push(record)
  114. })
  115. this.detail = _.sortBy(this.detail, 'MemberRecord.GambleMember.name');
  116. })
  117. this.listLoading = false
  118. },
  119. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  120. if (columnIndex === 0 || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8) {
  121. this.rowIndex = rowIndex
  122. this.columnIndex = columnIndex
  123. const that = this
  124. this.func()
  125. return {
  126. rowspan: this.row,
  127. colspan: this.col
  128. }
  129. }
  130. }
  131. },
  132. destroyed() {
  133. this.SetListVisble(true)
  134. }
  135. }
  136. </script>