|
@@ -39,6 +39,13 @@ export default {
|
39
|
39
|
dealingRecords: [],
|
40
|
40
|
groupMember: [],
|
41
|
41
|
detail: [],
|
|
42
|
+ group: [],
|
|
43
|
+ statement: '',
|
|
44
|
+ row: 0,
|
|
45
|
+ col: 0,
|
|
46
|
+ func: '',
|
|
47
|
+ rowIndex: 0,
|
|
48
|
+ colIndex: 0
|
42
|
49
|
}
|
43
|
50
|
},
|
44
|
51
|
props: [ 'bucket' ],
|
|
@@ -48,46 +55,13 @@ export default {
|
48
|
55
|
methods: {
|
49
|
56
|
getList() {
|
50
|
57
|
this.listLoading = true
|
51
|
|
- let memberTemp ,dealingTemp ,group ,detailTemp
|
52
|
|
- fetchMemberRecords(this.bucket).then(response => {
|
53
|
|
- memberTemp = response.data.rows.filter(record => {
|
54
|
|
- return record.door >= 1 && record.door <= 6
|
55
|
|
- })
|
56
|
|
- group = _.groupBy(memberTemp, record => {
|
57
|
|
- return record.GambleMember.name;
|
58
|
|
- });
|
59
|
|
- // this.groupMember = _.values(group)
|
60
|
|
- // console.log('temp', this.groupMember)
|
61
|
|
- group = _.values(group)
|
62
|
|
- // console.log('temp', group)
|
63
|
|
- group.map(person => {
|
64
|
|
- // console.log('preson',preson)
|
65
|
|
- if(person.length !== 6){
|
66
|
|
- for(let i = 1 ; i<7 ;i++){
|
67
|
|
- if(! _.find(person, {door: i})){
|
68
|
|
- // 補上 lost
|
69
|
|
- let tempObj = Object.assign({}, person[0])
|
70
|
|
- }
|
71
|
|
- }
|
72
|
|
- }
|
73
|
|
- })
|
74
|
|
- memberTemp.map(record => {
|
75
|
|
- this.memberRecords.push(record)
|
76
|
|
- })
|
77
|
|
- })
|
78
|
|
- fetchDealingRecords(this.bucket).then(response => {
|
79
|
|
- dealingTemp = response.data.rows.filter(record => {
|
80
|
|
- return record.door !== -1
|
81
|
|
- })
|
82
|
|
- response.data.rows.map(record => {
|
83
|
|
- this.dealingRecords.push(record)
|
84
|
|
- })
|
85
|
|
- })
|
|
58
|
+ let group ,detailTemp
|
|
59
|
+
|
86
|
60
|
fetchDetails(this.bucket).then(reponse => {
|
87
|
|
- let group
|
|
61
|
+ let group, dealingTemp
|
88
|
62
|
dealingTemp = reponse.data.rows.filter(record => {
|
89
|
|
- return record.DealingRecord.door >= 1 && record.DealingRecord.door <= 6 &&
|
90
|
|
- record.MemberRecord.door >= 1 && record.MemberRecord.door <= 6 &&
|
|
63
|
+ return record.DealingRecord.door !== -1 &&
|
|
64
|
+ record.MemberRecord.door !== -1 &&
|
91
|
65
|
record.MemberRecord.door === record.DealingRecord.door
|
92
|
66
|
})
|
93
|
67
|
console.log('dddd',this.detail)
|
|
@@ -95,56 +69,60 @@ export default {
|
95
|
69
|
group = _.groupBy(dealingTemp, record => {
|
96
|
70
|
return record.MemberRecord.GambleMember.name;
|
97
|
71
|
});
|
98
|
|
- // this.groupMember = _.values(group)
|
99
|
|
- // console.log('temp', this.groupMember)
|
100
|
|
- group = _.values(group)
|
101
|
|
- console.log('temp', group)
|
102
|
72
|
|
103
|
|
-
|
104
|
|
- group.map(person => {
|
105
|
|
- // console.log('preson',preson)
|
106
|
|
- if(person.length !== 6){
|
107
|
|
- console.log('hi')
|
108
|
|
- for(let i = 1 ; i<7 ;i++){
|
109
|
|
- console.log(i)
|
110
|
|
- if(! _.find(person, {MemberRecord:{door: i}})){
|
111
|
|
- // 補上 lost
|
112
|
|
- let tempObj = Object.assign({}, person[0])
|
113
|
|
- tempObj.DealingRecord.door = i
|
114
|
|
- tempObj.MemberRecord.door = i
|
115
|
|
- console.log('lost',i,tempObj)
|
116
|
|
- this.detail.push(tempObj)
|
117
|
|
- }
|
118
|
|
- }
|
|
73
|
+ this.group = _.values(group)
|
|
74
|
+ const sum = (i) => {
|
|
75
|
+ let count = 0
|
|
76
|
+ for(let j=0 ;j<i ;j++){
|
|
77
|
+ count += this.group[j].length
|
119
|
78
|
}
|
120
|
|
- })
|
121
|
|
-
|
122
|
|
- // dealingTemp = _.sortBy(dealingTemp, 'MemberRecord.GambleMember.name');
|
|
79
|
+ return count
|
|
80
|
+ }
|
|
81
|
+ for(let i = 0 ;i < this.group.length ;i++){
|
|
82
|
+ console.log(this.group)
|
|
83
|
+ if(i === 0) {
|
|
84
|
+ this.statement =
|
|
85
|
+ `if(this.rowIndex === ${i}){
|
|
86
|
+ this.row = ${this.group[i].length},
|
|
87
|
+ this.col = 1
|
|
88
|
+ }`
|
|
89
|
+ }else if(i === this.group.length-1){
|
|
90
|
+ this.statement +=
|
|
91
|
+ `else if(this.rowIndex === ${sum(i)}){
|
|
92
|
+ this.row = ${this.group[i].length},
|
|
93
|
+ this.col = 1
|
|
94
|
+ }else {
|
|
95
|
+ this.row = 0,
|
|
96
|
+ this.col = 0
|
|
97
|
+ }`
|
|
98
|
+ }else {
|
|
99
|
+ this.statement +=
|
|
100
|
+ `else if(this.rowIndex === ${sum(i)}){
|
|
101
|
+ this.row = ${this.group[i].length},
|
|
102
|
+ this.col = 1
|
|
103
|
+ }`
|
|
104
|
+ }
|
|
105
|
+ }
|
|
106
|
+ console.log(this.statement)
|
|
107
|
+ this.func = eval(`(function() {${this.statement}})`)
|
123
|
108
|
dealingTemp.map(record => {
|
124
|
109
|
this.detail.push(record)
|
125
|
110
|
})
|
126
|
|
- console.log('ccc',this.detail)
|
127
|
111
|
this.detail = _.sortBy(this.detail, 'MemberRecord.GambleMember.name');
|
128
|
|
- console.log('AAA',this.detail)
|
129
|
112
|
})
|
130
|
|
- console.log('memberRecords', this.memberRecords )
|
131
|
|
- console.log('dealingRecords', this.dealingRecords)
|
132
|
113
|
|
133
|
114
|
this.listLoading = false
|
134
|
115
|
},
|
135
|
116
|
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
136
|
117
|
if (columnIndex === 0 || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8) {
|
137
|
|
- this.groupMember
|
138
|
|
- if (rowIndex % 6 === 0) {
|
139
|
|
- return {
|
140
|
|
- rowspan: 6,
|
141
|
|
- colspan: 1
|
142
|
|
- }
|
143
|
|
- } else {
|
144
|
|
- return {
|
145
|
|
- rowspan: 0,
|
146
|
|
- colspan: 0
|
147
|
|
- }
|
|
118
|
+ this.rowIndex = rowIndex
|
|
119
|
+ this.columnIndex = columnIndex
|
|
120
|
+ const that = this
|
|
121
|
+
|
|
122
|
+ this.func()
|
|
123
|
+ return {
|
|
124
|
+ rowspan: this.row,
|
|
125
|
+ colspan: this.col
|
148
|
126
|
}
|
149
|
127
|
}
|
150
|
128
|
}
|