Browse Source

adjust UI & fix Create display lost ID & refactor Vue data()

EthnaYeh 7 years ago
parent
commit
84c067541a
1 changed files with 11 additions and 11 deletions
  1. 11 11
      src/views/gambleMember/index.vue

+ 11 - 11
src/views/gambleMember/index.vue

@@ -3,7 +3,7 @@
3 3
     <div class="app-container">
4 4
       <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
5 5
       </el-input>
6
-      <el-select clearable @change='handleFilter' style="width: 90px" class="filter-item" v-model="listQuery.chipsSort" placeholder="點數">
6
+      <el-select clearable @change='handleFilter' style="width: 120px" class="filter-item" v-model="listQuery.chipsSort" placeholder="點數">
7 7
         <el-option v-for="item in chipsSortOptions" :key="item.label" :label="item.label" :value="item.key">
8 8
         </el-option>
9 9
       </el-select>
@@ -88,13 +88,14 @@ export default {
88 88
       listQuery: {
89 89
         page: 1,
90 90
         limit: 20,
91
-        importance: undefined,
92
-        title: undefined,
93
-        type: undefined,
94
-        sort: '+id'
91
+        importance: '',
92
+        title: '',
93
+        type: '',
94
+        chipsSort: '',
95
+        updatedSort: ''
95 96
       },
96 97
       temp: {
97
-        id: undefined,
98
+        id: '',
98 99
         importance: 1,
99 100
         name: '',
100 101
         chips: '',
@@ -106,8 +107,8 @@ export default {
106 107
         deposit: '儲值',
107 108
         create: '新增'
108 109
       },
109
-      chipsSortOptions: [{ label: '多到少', key: 'DESC' }, { label: '少到多', key: 'ASC' }],
110
-      updatedSortOptions: [{ label: '新到舊', key: 'DESC' }, { label: '舊到新', key: 'ASC' }],
110
+      chipsSortOptions: [{ label: '多 -> 少', key: 'DESC' }, { label: '少 -> 多', key: 'ASC' }],
111
+      updatedSortOptions: [{ label: '新 -> 舊', key: 'DESC' }, { label: '舊 -> 新', key: 'ASC' }],
111 112
       rules: {
112 113
         depositChips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
113 114
         chips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
@@ -179,8 +180,8 @@ export default {
179 180
     createData() {
180 181
       this.$refs['dataForm'].validate((valid) => {
181 182
         if (valid) {
182
-          createGambleMember(this.temp).then(() => {
183
-            this.list.unshift(this.temp)
183
+          createGambleMember(this.temp).then((response) => {
184
+            this.list.unshift(response.data)
184 185
             this.dialogFormVisible = false
185 186
             this.$notify({
186 187
               title: '成功',
@@ -188,7 +189,6 @@ export default {
188 189
               type: 'success',
189 190
               duration: 2000
190 191
             })
191
-            // this.getList()
192 192
           })
193 193
         }
194 194
       })