Browse Source

refactor & lint --fix

Unknown 7 years ago
parent
commit
c379dd9182
2 changed files with 32 additions and 32 deletions
  1. 28 28
      src/views/gambleGameBucket/detail/index.vue
  2. 4 4
      src/views/gambleGameBucket/index.vue

+ 28 - 28
src/views/gambleGameBucket/detail/index.vue

@@ -53,60 +53,60 @@ export default {
53 53
       func: '',
54 54
       rowIndex: 0,
55 55
       colIndex: 0,
56
-      roundOptions: [],
56
+      roundOptions: []
57 57
     }
58 58
   },
59
-  props: [ 'bucket' ],
59
+  props: ['bucket'],
60 60
   created() {
61
-    fetchRoundCount(this.bucket).then((response)=>{
62
-      for(let i = 1 ; i<=response.data; i++){
61
+    fetchRoundCount(this.bucket).then((response) => {
62
+      for (let i = 1; i <= response.data; i++) {
63 63
         this.roundOptions.push({ label: `第 ${i} 輪`, key: i })
64 64
       }
65 65
     })
66
-    this.SetListVisble(false)    
66
+    this.SetListVisble(false)
67 67
     this.getList()
68 68
   },
69 69
   computed: {
70 70
     ...mapGetters([
71
-      'listVisble',
71
+      'listVisble'
72 72
     ])
73 73
   },
74 74
   methods: {
75 75
     ...mapActions([
76
-      'SetListVisble',
77
-    ]),    
76
+      'SetListVisble'
77
+    ]),
78 78
     getList() {
79 79
       this.listLoading = true
80
-      let group ,dealingTemp
80
+      let detailTemp
81 81
       this.detail = []
82 82
       fetchDetails(this.bucket, this.listQuery).then(reponse => {
83
-        dealingTemp = reponse.data.rows.filter(record => {
84
-          return  record.DealingRecord.door !== -1 && 
83
+        detailTemp = reponse.data.rows.filter(record => {
84
+          return record.DealingRecord.door !== -1 &&
85 85
             record.MemberRecord.door !== -1 &&
86 86
             record.MemberRecord.door === record.DealingRecord.door
87 87
         })
88 88
 
89
-        group = _.groupBy(dealingTemp, record => {
90
-          return record.MemberRecord.GambleMember.name;
91
-        });
89
+        this.group = _.groupBy(detailTemp, record => {
90
+          return record.MemberRecord.GambleMember.name
91
+        })
92 92
 
93
-        this.group = _.values(group)
93
+        this.group = _.values(this.group)
94 94
         const sum = (i) => {
95 95
           let count = 0
96
-          for(let j=0 ;j<i ;j++){
96
+          for (let j = 0; j < i; j++) {
97 97
             count += this.group[j].length
98 98
           }
99 99
           return count
100 100
         }
101
-        for(let i = 0 ;i < this.group.length ;i++){
102
-          if(i === 0) {
103
-            this.statement = 
101
+        for (let i = 0; i < this.group.length; i++) {
102
+          if (i === 0) {
103
+            this.statement =
104 104
             `if(this.rowIndex === ${i}){
105 105
               this.row = ${this.group[i].length},
106 106
               this.col = 1
107 107
             }`
108
-          }else if(i === this.group.length-1){
109
-            this.statement += 
108
+          } else if (i === this.group.length - 1) {
109
+            this.statement +=
110 110
             `else if(this.rowIndex === ${sum(i)}){
111 111
               this.row = ${this.group[i].length},
112 112
               this.col = 1
@@ -114,8 +114,8 @@ export default {
114 114
               this.row = 0,
115 115
               this.col = 0
116 116
             }`
117
-          }else {
118
-            this.statement += 
117
+          } else {
118
+            this.statement +=
119 119
             `else if(this.rowIndex === ${sum(i)}){
120 120
               this.row = ${this.group[i].length},
121 121
               this.col = 1 
@@ -123,21 +123,21 @@ export default {
123 123
           }
124 124
         }
125 125
         this.func = eval(`(function() {${this.statement}})`)
126
-        dealingTemp.map(record => {
126
+        detailTemp.map(record => {
127 127
           this.detail.push(record)
128 128
         })
129
-        this.detail =  _.sortBy(this.detail, 'MemberRecord.GambleMember.name');
129
+        this.detail = _.sortBy(this.detail, 'MemberRecord.GambleMember.name')
130 130
       })
131 131
 
132 132
       this.listLoading = false
133 133
     },
134 134
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
135
-      if (columnIndex === 0 || columnIndex === 5|| columnIndex === 6|| columnIndex === 7|| columnIndex === 8) {
135
+      if (columnIndex === 0 || columnIndex === 5 || columnIndex === 6 || columnIndex === 7 || columnIndex === 8) {
136 136
         this.rowIndex = rowIndex
137 137
         this.columnIndex = columnIndex
138 138
         const that = this
139 139
 
140
-        this.func()      
140
+        this.func()
141 141
         return {
142 142
           rowspan: this.row,
143 143
           colspan: this.col
@@ -146,7 +146,7 @@ export default {
146 146
     },
147 147
     handleFilter() {
148 148
       this.getList()
149
-    },
149
+    }
150 150
   },
151 151
   destroyed() {
152 152
     this.SetListVisble(true)

+ 4 - 4
src/views/gambleGameBucket/index.vue

@@ -40,7 +40,7 @@
40 40
 <script>
41 41
 
42 42
 import { mapGetters, mapActions } from 'vuex'
43
-import { fetchList, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
43
+import { fetchList } from '@/api/gambleGameBucket'
44 44
 
45 45
 export default {
46 46
   data() {
@@ -64,7 +64,7 @@ export default {
64 64
         name: '',
65 65
         chips: '',
66 66
         depositChips: ''
67
-      },
67
+      }
68 68
     }
69 69
   },
70 70
   created() {
@@ -72,12 +72,12 @@ export default {
72 72
   },
73 73
   computed: {
74 74
     ...mapGetters([
75
-      'listVisble',
75
+      'listVisble'
76 76
     ])
77 77
   },
78 78
   methods: {
79 79
     ...mapActions([
80
-      'SetListVisble',
80
+      'SetListVisble'
81 81
     ]),
82 82
     getList() {
83 83
       this.listLoading = true