Przeglądaj źródła

零号线列表+新增+编辑

zhangming 1 rok temu
rodzic
commit
8a635daa31
3 zmienionych plików z 341 dodań i 2 usunięć
  1. 16 2
      src/api/user.js
  2. 6 0
      src/router/modules/user.js
  3. 319 0
      src/views/zeroLine/list/index.vue

+ 16 - 2
src/api/user.js

@@ -301,6 +301,20 @@ export function registerHuanxinApi() {
301 301
 /**
302 302
  * @description 获取零号线用户
303 303
  */
304
-export function getZeroLineUserList() {
305
-  return request.get(`user/getZeroLineUserList`)
304
+export function getZeroLineUserList(data) {
305
+  return request.get(`user/getZeroLineUserList`,data)
306
+}
307
+
308
+/**
309
+ * @description 设置0号线团队
310
+ */
311
+export function setZeroLineUser(data) {
312
+  return request.post(`user/setZeroLineUser`,data)
313
+}
314
+
315
+/**
316
+ * @description 模糊搜索
317
+ */
318
+export function getUserListByFuzzy(data) {
319
+  return request.get(`user/getUserListByFuzzy`,data)
306 320
 }

+ 6 - 0
src/router/modules/user.js

@@ -33,6 +33,12 @@ const userRouter =
33 33
         component: () => import('@/views/user/bangfu'),
34 34
         name: 'UserBangfu',
35 35
         meta: { title: '帮扶中心', noCache: true }
36
+      },
37
+      {
38
+        path: 'zero',
39
+        component: () => import('@/views/zeroLine/list'),
40
+        name: 'UserZero',
41
+        meta: { title: '0号线', noCache: true }
36 42
       }
37 43
     ]
38 44
   }

+ 319 - 0
src/views/zeroLine/list/index.vue

@@ -0,0 +1,319 @@
1
+<template>
2
+    <div class="zero-box">
3
+        <el-card class="box-card">
4
+            <el-form inline size="small" label-width="100px">
5
+            <el-row>
6
+              <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
7
+                <el-form-item label="昵称:">
8
+                  <el-input v-model="userFrom.team_name" placeholder="请输入" clearable class="selWidth"/>
9
+                </el-form-item>
10
+              </el-col>
11
+
12
+              <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
13
+                <el-form-item label="手机号:">
14
+                  <el-input v-model="userFrom.account" placeholder="请输入" clearable class="selWidth"/>
15
+                </el-form-item>
16
+              </el-col>
17
+
18
+              <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
19
+                <el-form-item label="状态:">
20
+                  <el-select v-model="userFrom.status" placeholder="全部" class="selWidth">
21
+                    <!-- <el-option v-for="option in creatorOptions" :key="option" :value="option"/> -->
22
+                    <el-option value="" label="选择状态"/>
23
+                    <el-option value="0" label="失效"/>
24
+                    <el-option value="1" label="正常"/>
25
+                    <el-option value="2" label="合并"/>
26
+                  </el-select>
27
+                </el-form-item>
28
+              </el-col>
29
+
30
+              <el-col :xs="24" :sm="24" :md="24" :lg="6" :xl="6" class="text-right userFrom">
31
+                <el-form-item>
32
+                    <el-button type="primary" icon="ios-search" label="default" class="mr15" size="small"
33
+                             @click="onEdit(0,0)">添加
34
+                    </el-button>
35
+                    <el-button type="primary" icon="ios-search" label="default" class="mr15" size="small"
36
+                                @click="userSearchs">搜索
37
+                    </el-button>
38
+                    <el-button class="ResetSearch mr10" size="small" @click="getList">重置</el-button>
39
+                </el-form-item>
40
+              </el-col>
41
+            </el-row>
42
+          </el-form>
43
+        <!-- 列表 -->
44
+         <el-table
45
+        :data="tableData.data"
46
+        style="width: 100%" v-loading="listLoading">
47
+        <el-table-column
48
+            prop="date"
49
+            label="姓名"
50
+            width="140">
51
+            <template slot-scope="scope">
52
+            <span>{{scope.row.team_name}}</span>
53
+          </template>
54
+        </el-table-column>
55
+        <el-table-column
56
+            prop="account"
57
+            label="手机号"
58
+            width="180">
59
+            <template slot-scope="scope">
60
+            <div class="listPic">
61
+                <span>{{scope.row.account}}</span>
62
+            </div>
63
+          </template>
64
+        </el-table-column>
65
+        <el-table-column
66
+            prop="num"
67
+            label="人数"
68
+            width="120">
69
+            <template slot-scope="scope">
70
+            <div class="listPic">
71
+                <span>{{scope.row.team_user_num}}</span>
72
+            </div>
73
+          </template>
74
+        </el-table-column>
75
+        <el-table-column
76
+            prop="status"
77
+            label="状态"
78
+            width="120">
79
+            <template slot-scope="scope">
80
+            <div class="listPic">
81
+                <span v-if="scope.row.status==0">失效</span>
82
+                <span v-else-if="scope.row.status==1">正常</span>
83
+                <span v-else>合并</span>
84
+            </div>
85
+          </template>
86
+        </el-table-column>
87
+        <el-table-column
88
+            prop="createDate"
89
+            label="创建时间"
90
+            width="180">
91
+            <template slot-scope="scope">
92
+            <div class="listPic">
93
+                <span>{{scope.row.create_time}}</span>
94
+            </div>
95
+          </template>
96
+        </el-table-column>
97
+        <el-table-column
98
+            prop="upDate"
99
+            label="更新时间"
100
+            width="180">
101
+            <template slot-scope="scope">
102
+            <div class="listPic">
103
+                <span>{{scope.row.update_time}}</span>
104
+            </div>
105
+          </template>
106
+        </el-table-column>
107
+        <el-table-column
108
+            prop="address"
109
+            label="操作">
110
+            <template slot-scope="scope">
111
+            <el-button type="text" size="small" @click="onEdit(scope.row)">编辑</el-button>
112
+          </template>
113
+        </el-table-column>
114
+        </el-table>
115
+        <!-- 弹框 -->
116
+        <el-dialog
117
+        :title="str"
118
+        width="50%"
119
+        :visible.sync="dialogVisible"
120
+        left>
121
+            <el-form ref="form" :model="infoForm" label-width="80px">
122
+                <el-form-item label="团长名称" v-if="str=='添加信息'">
123
+                    <el-select
124
+                        maxlength="15"
125
+                        minlength="1"
126
+                        v-model="seletItem"
127
+                        filterable
128
+                        remote
129
+                        placeholder="请输入关键词"
130
+                        :remote-method="remoteMethod"
131
+                        @change="changeSel"
132
+                        :loading="loading">
133
+                        <el-option
134
+                        v-for="item in searchList"
135
+                        :key="item.uidt"
136
+                        :label="item.nickname"
137
+                        :value="item.account">
138
+                        </el-option>
139
+                    </el-select>
140
+                </el-form-item>
141
+                <el-form-item label="团长名称" v-else>
142
+                  <el-input v-model="infoForm.team_name" ></el-input>
143
+                </el-form-item>
144
+                <el-form-item label="团长状态">
145
+                    <el-radio-group v-model="infoForm.status">
146
+                        <el-radio :label="0" :value="0">失效</el-radio>
147
+                        <el-radio :label="1" :value="1">正常</el-radio>
148
+                        <el-radio :label="2" :value="2">合并</el-radio>
149
+                    </el-radio-group>
150
+                </el-form-item>
151
+            </el-form>
152
+            <span slot="footer" class="dialog-footer">
153
+                <el-button @click="dialogVisibleFalae">取 消</el-button>
154
+                <el-button type="primary" @click="editChage">确 定</el-button>
155
+            </span>
156
+        </el-dialog>
157
+        <div class="block">
158
+        <el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="tableData.limit" :current-page="tableData.page"
159
+                       layout="total, sizes, prev, pager, next, jumper" :total="tableData.data.length"
160
+                       @size-change="handleSizeChange"
161
+                       @current-change="pageChange"/>
162
+        </div>
163
+        </el-card>
164
+    </div>
165
+</template>
166
+<script>
167
+import {
168
+  getZeroLineUserList,setZeroLineUser,getUserListByFuzzy
169
+} from '@/api/user'
170
+    export default{
171
+        name:"UserZeroo",
172
+        data(){
173
+            return{
174
+                dialogVisible:false,
175
+                storeClass:[],
176
+                listLoading:false,//查询的loading
177
+                ridio:1,
178
+                str:"添加信息",
179
+                searchList:[],
180
+                userFrom: {
181
+                    team_name:"",//姓名
182
+                    account: "", // 手机号
183
+                    status:1,//状态
184
+                },
185
+                tableData:{
186
+                    limit:20,//每页数据个数
187
+                    page:1,//页数
188
+                    total:0,//总计
189
+                    data:[],
190
+                },
191
+                infoForm:{
192
+                    team_name:"",
193
+                    team_uid:"",
194
+                    status:1,
195
+                },
196
+                seletItem:"",
197
+                options: [],
198
+                value: [],
199
+                list: [],
200
+                loading: false,
201
+            }
202
+        },
203
+        mounted(){
204
+            this.getList();
205
+        },
206
+        methods:{
207
+            // 默认列表
208
+            getList() {
209
+                this.userFrom= {
210
+                    team_name:"",//姓名
211
+                    account: "", // 手机号
212
+                    status:"",//状态
213
+                },
214
+                this.listLoading = true;
215
+                getZeroLineUserList().then(res => {
216
+                    this.tableData.data = res.data
217
+                    console.log(this.tableData.data.length)
218
+                    this.listLoading = false
219
+                    console.log(res);
220
+                }).catch(res => {
221
+                    this.listLoading = false
222
+                    this.$message.error(res.message)
223
+                })
224
+            },
225
+            // 弹框
226
+            onEdit(scope,edit=true){
227
+                if(edit){
228
+                    this.infoForm=scope;
229
+                    this.str="修改信息";
230
+                }else{
231
+                    this.str="添加信息";
232
+                }
233
+                console.log(this.infoForm);
234
+                this.dialogVisible=true;
235
+            },
236
+            // 修改
237
+            editChage(){
238
+                this.searchList=[];
239
+                this.seletItem="";
240
+                const Obj={
241
+                    team_name:this.infoForm.team_name,
242
+                    team_uid:this.infoForm.team_uid,
243
+                    status:this.infoForm.status
244
+                    };
245
+                setZeroLineUser(Obj).then(res=>{
246
+                    console.log(res);
247
+                    this.infoForm={
248
+                        team_name:"",
249
+                        team_uid:"",
250
+                        status:1,
251
+                    }
252
+                    this.dialogVisible=false;
253
+                }).catch(err=>{
254
+                    this.$message.error(err.message);
255
+                })
256
+            },
257
+            // 每页显示个数
258
+            handleSizeChange(val){
259
+                console.log(val)
260
+            },
261
+            // 当前页数
262
+            pageChange(page){
263
+                console.log(page)
264
+            },
265
+            // 搜索
266
+            userSearchs(){
267
+                if(this.userFrom.team_name==""||this.userFrom.team_uid==""||this.userFrom.status=="")return
268
+                getZeroLineUserList(this.userFrom).then(res => {
269
+                    this.tableData.data = res.data
270
+                    this.listLoading = false
271
+                    console.log(res);
272
+                }).catch(res => {
273
+                    this.listLoading = false
274
+                    this.$message.error(res.message)
275
+                })
276
+            },
277
+            // 远程搜索
278
+            remoteMethod(val){
279
+                console.log(val);
280
+                const data={fuzzy:val};
281
+                getUserListByFuzzy(data).then(res=>{
282
+                    this.searchList=res.data;
283
+                    console.log(this.searchList)
284
+                })
285
+            },
286
+            // 选中值时触发
287
+            changeSel(val,i,item){
288
+                // this.infoForm=val;
289
+                this.searchList.filter((e,i)=>{
290
+                    console.log(e);
291
+                    if(val==e.account){this.infoForm=e}
292
+                })
293
+            },
294
+            // 取消
295
+            dialogVisibleFalae(){
296
+                this.infoForm={
297
+                    team_name:"",
298
+                    team_uid:"",
299
+                    status:1,
300
+                }
301
+                this.searchList=[];
302
+                this.dialogVisible=false
303
+            }
304
+        }
305
+    }
306
+</script>
307
+<style scoped lang="scss">
308
+.zero-box{
309
+    margin: 1rem;
310
+}
311
+.text-right{
312
+    width: 100%;
313
+    text-align: right;
314
+}
315
+.block{
316
+    width: 100%;
317
+    text-align: right;
318
+}
319
+</style>