|
@@ -0,0 +1,176 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="app-container calendar-list-container">
|
|
3
|
+ <div v-show="visible.firstLayer">
|
|
4
|
+ <div class="app-container">
|
|
5
|
+ <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
|
|
6
|
+ </el-input>
|
|
7
|
+ <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
|
|
8
|
+ <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建聯絡人</el-button>
|
|
9
|
+ </div>
|
|
10
|
+ <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
|
|
11
|
+ style="width: 100%">
|
|
12
|
+ <!-- <el-table-column align="center" label='ID' >
|
|
13
|
+ <template slot-scope="scope">
|
|
14
|
+ {{scope.row.GambleMember.id}}
|
|
15
|
+ </template>
|
|
16
|
+ </el-table-column> -->
|
|
17
|
+ <el-table-column label="名稱" align="center">
|
|
18
|
+ <template slot-scope="scope">
|
|
19
|
+ {{scope.row.name}}
|
|
20
|
+ </template>
|
|
21
|
+ </el-table-column>
|
|
22
|
+ <el-table-column label="微信ID" align="center">
|
|
23
|
+ <template slot-scope="scope">
|
|
24
|
+ {{scope.row.wechatId}}
|
|
25
|
+ </template>
|
|
26
|
+ </el-table-column>
|
|
27
|
+ <el-table-column label="電話" align="center">
|
|
28
|
+ <template slot-scope="scope">
|
|
29
|
+ <span>{{scope.row.phone}}</span>
|
|
30
|
+ </template>
|
|
31
|
+ </el-table-column>
|
|
32
|
+ <el-table-column align="center" label="操作" width="450">
|
|
33
|
+ </el-table-column>
|
|
34
|
+ </el-table>
|
|
35
|
+
|
|
36
|
+ <div v-show="!listLoading" class="pagination-container">
|
|
37
|
+ <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
|
|
38
|
+ :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
|
39
|
+ </el-pagination>
|
|
40
|
+ </div>
|
|
41
|
+
|
|
42
|
+ <el-dialog title="創建聯絡人" :visible.sync="dialogCreateFormVisible" :before-close="handleDialogClose" center>
|
|
43
|
+ <el-form :rules="rules" ref="createForm" :model="createFormData" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
|
44
|
+ <el-form-item label="名稱" prop="name">
|
|
45
|
+ <el-input v-model="createFormData.name"></el-input>
|
|
46
|
+ </el-form-item>
|
|
47
|
+ <el-form-item label="微信 ID">
|
|
48
|
+ <el-input v-model="createFormData.wechatId"></el-input>
|
|
49
|
+ </el-form-item>
|
|
50
|
+ <el-form-item label="電話">
|
|
51
|
+ <el-input v-model="createFormData.phone"></el-input>
|
|
52
|
+ </el-form-item>
|
|
53
|
+ </el-form>
|
|
54
|
+ <div slot="footer" class="dialog-footer">
|
|
55
|
+ <el-button @click="handleDialogClose">取 消</el-button>
|
|
56
|
+ <el-button type="primary" @click="createData">確 定</el-button>
|
|
57
|
+ </div>
|
|
58
|
+ </el-dialog>
|
|
59
|
+ </div>
|
|
60
|
+ <router-view></router-view>
|
|
61
|
+ </div>
|
|
62
|
+</template>
|
|
63
|
+
|
|
64
|
+<script>
|
|
65
|
+
|
|
66
|
+import { mapGetters, mapActions } from 'vuex'
|
|
67
|
+import { createDirectory, fetchDirectory } from '@/api/directory'
|
|
68
|
+import waves from '@/directive/waves' // 水波纹指令
|
|
69
|
+import moment from 'moment-timezone'
|
|
70
|
+import _ from 'lodash'
|
|
71
|
+import { Decimal } from 'decimal.js';
|
|
72
|
+
|
|
73
|
+export default {
|
|
74
|
+ directives: {
|
|
75
|
+ waves
|
|
76
|
+ },
|
|
77
|
+ data() {
|
|
78
|
+ return {
|
|
79
|
+ list: [],
|
|
80
|
+ total: null,
|
|
81
|
+ listLoading: true,
|
|
82
|
+ listQuery: {
|
|
83
|
+ page: 1,
|
|
84
|
+ limit: 20,
|
|
85
|
+ name: '',
|
|
86
|
+ },
|
|
87
|
+ dialogCreateFormVisible: false,
|
|
88
|
+ dialogStatus: '',
|
|
89
|
+ // agent: {},
|
|
90
|
+ rules: {
|
|
91
|
+ // rewardChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
92
|
+ // depositChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
93
|
+ // chips: [{ pattern: /^(0|[1-9][0-9]*)$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
94
|
+ // name: [{ type: 'string', required: true, message: '必填', trigger: 'change' }]
|
|
95
|
+ },
|
|
96
|
+ createFormData: {
|
|
97
|
+ name: '',
|
|
98
|
+ wechatId: '',
|
|
99
|
+ phone: ''
|
|
100
|
+ }
|
|
101
|
+ }
|
|
102
|
+ },
|
|
103
|
+ created() {
|
|
104
|
+ this.SetVisible(1)
|
|
105
|
+ this.getList()
|
|
106
|
+ },
|
|
107
|
+ computed: {
|
|
108
|
+ ...mapGetters([
|
|
109
|
+ 'visible',
|
|
110
|
+ 'data',
|
|
111
|
+ ])
|
|
112
|
+ },
|
|
113
|
+ methods: {
|
|
114
|
+ ...mapActions([
|
|
115
|
+ 'SetVisible',
|
|
116
|
+ 'SetData',
|
|
117
|
+ ]),
|
|
118
|
+ getList() {
|
|
119
|
+ this.listLoading = true
|
|
120
|
+ fetchDirectory(this.listQuery).then(response => {
|
|
121
|
+ this.list = response.data.rows
|
|
122
|
+ this.total = response.data.count
|
|
123
|
+ console.log('res', response)
|
|
124
|
+ })
|
|
125
|
+ this.listLoading = false
|
|
126
|
+ },
|
|
127
|
+ resetCreateData() {
|
|
128
|
+ this.createFormData = {
|
|
129
|
+ id: undefined,
|
|
130
|
+ name: '',
|
|
131
|
+ wechatId: '',
|
|
132
|
+ phone: ''
|
|
133
|
+ }
|
|
134
|
+ },
|
|
135
|
+ handleCreate() {
|
|
136
|
+ this.resetCreateData()
|
|
137
|
+ this.dialogCreateFormVisible = true
|
|
138
|
+ this.$nextTick(() => {
|
|
139
|
+ this.$refs['createForm'].clearValidate()
|
|
140
|
+ })
|
|
141
|
+ },
|
|
142
|
+ createData() {
|
|
143
|
+ this.$refs['createForm'].validate((valid) => {
|
|
144
|
+ if (valid) {
|
|
145
|
+ createDirectory(this.createFormData).then((response) => {
|
|
146
|
+ let user = response.data
|
|
147
|
+ this.list.unshift(user)
|
|
148
|
+ this.dialogCreateFormVisible = false
|
|
149
|
+ this.$notify({
|
|
150
|
+ title: '成功',
|
|
151
|
+ message: '創建成功',
|
|
152
|
+ type: 'success',
|
|
153
|
+ duration: 2000
|
|
154
|
+ })
|
|
155
|
+ })
|
|
156
|
+ }
|
|
157
|
+ })
|
|
158
|
+ },
|
|
159
|
+ handleFilter() {
|
|
160
|
+ this.listQuery.page = 1
|
|
161
|
+ this.getList()
|
|
162
|
+ },
|
|
163
|
+ handleSizeChange(val) {
|
|
164
|
+ this.listQuery.limit = val
|
|
165
|
+ this.getList()
|
|
166
|
+ },
|
|
167
|
+ handleCurrentChange(val) {
|
|
168
|
+ this.listQuery.page = val
|
|
169
|
+ this.getList()
|
|
170
|
+ },
|
|
171
|
+ handleDialogClose() {
|
|
172
|
+ this.dialogCreateFormVisible = false;
|
|
173
|
+ },
|
|
174
|
+ },
|
|
175
|
+}
|
|
176
|
+</script>
|