瀏覽代碼

add datePicker

EthnaYeh 7 年之前
父節點
當前提交
50000b47e2
共有 2 個文件被更改,包括 52 次插入3 次删除
  1. 51 2
      src/views/gambleMember/detail/index.vue
  2. 1 1
      src/views/gambleMember/index.vue

+ 51 - 2
src/views/gambleMember/detail/index.vue

1
 <template>
1
 <template>
2
   <div class="app-container">
2
   <div class="app-container">
3
+    <div class="app-container">
4
+        <div class="block">
5
+            <span class="demonstration">時間篩選</span>
6
+            <el-date-picker
7
+            v-model="date"
8
+            type="datetimerange"
9
+            :picker-options="pickerOptions"
10
+            range-separator="至"
11
+            start-placeholder="開始日期"
12
+            end-placeholder="结束日期"
13
+            align="right">
14
+            </el-date-picker>
15
+            <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
16
+        </div>
17
+    </div>
3
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
18
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
4
       <el-table-column label="場" align="center">
19
       <el-table-column label="場" align="center">
5
         <template slot-scope="scope">
20
         <template slot-scope="scope">
29
 
44
 
30
 import { mapActions } from 'vuex'
45
 import { mapActions } from 'vuex'
31
 import { fetchHistory } from '@/api/gambleMember'
46
 import { fetchHistory } from '@/api/gambleMember'
47
+import waves from '@/directive/waves' // 水波纹指令
32
 
48
 
33
 export default {
49
 export default {
50
+  directives: {
51
+    waves
52
+  },
34
   data() {
53
   data() {
35
     return {
54
     return {
36
       list: null,
55
       list: null,
37
-      listLoading: true
56
+      listLoading: true,
57
+      pickerOptions: {
58
+          shortcuts: [{
59
+            text: '最近一周',
60
+            onClick(picker) {
61
+              const end = new Date();
62
+              const start = new Date();
63
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
64
+              picker.$emit('pick', [start, end]);
65
+            }
66
+          }, {
67
+            text: '最近一個月',
68
+            onClick(picker) {
69
+              const end = new Date();
70
+              const start = new Date();
71
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
72
+              picker.$emit('pick', [start, end]);
73
+            }
74
+          }, {
75
+            text: '最近三個月',
76
+            onClick(picker) {
77
+              const end = new Date();
78
+              const start = new Date();
79
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
80
+              picker.$emit('pick', [start, end]);
81
+            }
82
+          }]
83
+        },
84
+      date: ''
38
     }
85
     }
39
   },
86
   },
40
   created() {
87
   created() {
49
       this.listLoading = true
96
       this.listLoading = true
50
       fetchHistory(this.member).then(response => {
97
       fetchHistory(this.member).then(response => {
51
         this.list = response.data
98
         this.list = response.data
52
-        console.log(response.data)
53
         this.listLoading = false
99
         this.listLoading = false
54
       })
100
       })
101
+    },
102
+    handleFilter() {
103
+      console.log(this.date)
55
     }
104
     }
56
   },
105
   },
57
   destroyed() {
106
   destroyed() {

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

13
         </el-option>
13
         </el-option>
14
       </el-select>
14
       </el-select>
15
       <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
15
       <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
16
-        <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button>
16
+      <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button>
17
     </div>
17
     </div>
18
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
18
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
19
       style="width: 100%">
19
       style="width: 100%">