李志伟 hace 3 años
padre
commit
461aa5194f
Se han modificado 1 ficheros con 37 adiciones y 0 borrados
  1. 37
    0
      src/views/person/index.vue

+ 37
- 0
src/views/person/index.vue Ver fichero

@@ -1,5 +1,22 @@
1 1
 <template>
2 2
   <div class="body" style="font-size:14px">
3
+    <el-card class="box-card" shadow="never">
4
+      活动时间:
5
+      <el-date-picker
6
+        v-model="daterange"
7
+        type="daterange"
8
+        range-separator="至"
9
+        start-placeholder="开始日期"
10
+        end-placeholder="结束日期"
11
+        value-format="yyyy-MM-dd"
12
+        style="margin-right: 20px"
13
+        @change="dateChange"
14
+      />
15
+      <div style="float:right">
16
+        <el-button type="primary" @click="onSearch">查询</el-button>
17
+        <el-button @click="onReset">重置</el-button>
18
+      </div>
19
+    </el-card>
3 20
     <el-table stripe :data="tableData" border style="width: 100%">
4 21
       <el-table-column prop="name" label="中奖人" />
5 22
       <el-table-column prop="phone" label="手机号" />
@@ -31,7 +48,10 @@ import { getPersonList } from '@/api/person'
31 48
 export default {
32 49
   data() {
33 50
     return {
51
+      daterange: undefined,
34 52
       tableData: [],
53
+      endDate: undefined,
54
+      startDate: undefined,
35 55
       pageSize: 10,
36 56
       currentPage: 1,
37 57
       gameTotal: 0 // 条目总数
@@ -54,6 +74,8 @@ export default {
54 74
     // 改变分页组件重新查询数据
55 75
     changePagination() {
56 76
       getPersonList({
77
+        startDate: this.startDate,
78
+        endDate: this.endDate,
57 79
         pageNum: this.currentPage,
58 80
         pageSize: this.pageSize
59 81
       }).then((res) => {
@@ -62,12 +84,27 @@ export default {
62 84
     },
63 85
     onSearch() {
64 86
       getPersonList({
87
+        startDate: this.startDate,
88
+        endDate: this.endDate,
65 89
         pageSize: this.pageSize
66 90
       }).then((res) => {
67 91
         this.tableData = res.data.records
68 92
         this.gameTotal = res.data.total
69 93
         this.pageSize = res.data.size
70 94
       })
95
+    },
96
+    onReset() {
97
+      this.title = undefined
98
+      this.daterange = undefined
99
+      this.startDate = undefined
100
+      this.endDate = undefined
101
+      this.currentPage = 1
102
+      this.pageSize = 10
103
+      this.onSearch()
104
+    },
105
+    dateChange(val) {
106
+      this.startDate = this.daterange[0]
107
+      this.endDate = this.daterange[1]
71 108
     }
72 109
   }
73 110
 }