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
     <div class="app-container">
3
     <div class="app-container">
4
       <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
4
       <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
5
       </el-input>
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
         <el-option v-for="item in chipsSortOptions" :key="item.label" :label="item.label" :value="item.key">
7
         <el-option v-for="item in chipsSortOptions" :key="item.label" :label="item.label" :value="item.key">
8
         </el-option>
8
         </el-option>
9
       </el-select>
9
       </el-select>
88
       listQuery: {
88
       listQuery: {
89
         page: 1,
89
         page: 1,
90
         limit: 20,
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
       temp: {
97
       temp: {
97
-        id: undefined,
98
+        id: '',
98
         importance: 1,
99
         importance: 1,
99
         name: '',
100
         name: '',
100
         chips: '',
101
         chips: '',
106
         deposit: '儲值',
107
         deposit: '儲值',
107
         create: '新增'
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
       rules: {
112
       rules: {
112
         depositChips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
113
         depositChips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
113
         chips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
114
         chips: [{ pattern: /^\+?[1-9][0-9]*$/, required: true, message: '請輸入整數', trigger: 'change' }],
179
     createData() {
180
     createData() {
180
       this.$refs['dataForm'].validate((valid) => {
181
       this.$refs['dataForm'].validate((valid) => {
181
         if (valid) {
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
             this.dialogFormVisible = false
185
             this.dialogFormVisible = false
185
             this.$notify({
186
             this.$notify({
186
               title: '成功',
187
               title: '成功',
188
               type: 'success',
189
               type: 'success',
189
               duration: 2000
190
               duration: 2000
190
             })
191
             })
191
-            // this.getList()
192
           })
192
           })
193
         }
193
         }
194
       })
194
       })