浏览代码

解决冲突

liuxiaona 2 年之前
父节点
当前提交
375dfc906b

+ 5 - 2
project/src/components/assembly/tagDialog.vue

@@ -8,9 +8,9 @@
8 8
         <el-radio :label="3">无任何标签</el-radio>
9 9
       </el-radio-group>
10 10
     </div> -->
11
-    <div class="self-hint" style="border:none">
11
+    <div class="self-hint" style="border:none;margin-top:-10px">
12 12
       <i class="el-icon-message-solid"></i>
13
-      <span>将给选择的1个客户批量{{tagType==1?'打':'移除'}}标签,请选择标签</span>
13
+      <span>将给选择的{{userLength}}个客户批量{{tagType==1?'打':'移除'}}标签,请选择标签</span>
14 14
     </div>
15 15
     <template v-if="radio!=3">
16 16
       <div class="self-input">
@@ -40,6 +40,9 @@ export default {
40 40
     tagType: {
41 41
       type: Number | String,
42 42
       default: 1
43
+    },
44
+    userLength: {
45
+      type: Number
43 46
     }
44 47
   },
45 48
   data () {

+ 93 - 10
project/src/components/customManage/customerTransfer.vue

@@ -2,8 +2,8 @@
2 2
   <div v-loading="loading">
3 3
     <div class="topTagBox flex">
4 4
       <div class="left flex-align-center">
5
-        <div :class="['tagItem',type==1?'tagItem_active':'']" @click="type=1;resetEvent()">离职迁移</div>
6
-        <div :class="['tagItem',type==2?'tagItem_active':'']" @click="type=2;resetEvent()">在职迁移</div>
5
+        <div :class="['tagItem',type==1?'tagItem_active':'']" @click="changeType(1);">离职迁移</div>
6
+        <div :class="['tagItem',type==2?'tagItem_active':'']" @click="changeType(2);">在职迁移</div>
7 7
       </div>
8 8
       <div class="right">
9 9
         <el-button type="primary" size="mini" @click="goReord"><i class="el-icon-document"></i> 分配记录</el-button>
@@ -46,19 +46,19 @@
46 46
           <!-- <div class="smalLine"></div> -->
47 47
           <!-- <el-button type="primary" plain size="mini"><i class="el-icon-refresh-right"></i> 更新数据</el-button> -->
48 48
         </div>
49
-        <div class="selectCustom">已择0个客户</div>
49
+        <div class="selectCustom">已择{{multipleArr.length}}个客户</div>
50 50
       </div>
51 51
       <div class="flex">
52
-        <el-button type="primary" size="mini">分配</el-button>
52
+        <el-button type="primary" size="mini" @click="toDistribution">分配</el-button>
53 53
       </div>
54 54
     </div>
55 55
     <!-- table -->
56
-    <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
56
+    <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange" @select-all="handleSelectAll">
57 57
       <el-table-column type="selection" width="55" align="center"></el-table-column>
58 58
       <el-table-column width="200" fixed="left">
59 59
         <template slot-scope="scope" slot="header">
60
-          <div class="customTitle" slot="reference">{{pageOptionValue==2?'选择当前页面客户':'选择全部客户'}}<i class="el-icon-arrow-down"></i>
61
-            <el-select v-model="pageOptionValue" class="customTitleSelect" placeholder="请选择" size="mini">
60
+          <div class="customTitle" slot="reference">{{old_pageOptionValue==2?'选择当前页面客户':'选择全部客户'}}<i class="el-icon-arrow-down"></i>
61
+            <el-select v-model="pageOptionValue" class="customTitleSelect" placeholder="请选择" size="mini" @change="pageOptionSelect" @visible-change="pageOptionValue=''">
62 62
               <el-option v-for="item in pageOptions" :key="item.id" :label="item.name" :value="item.id">
63 63
               </el-option>
64 64
             </el-select>
@@ -94,7 +94,7 @@
94 94
         <template slot-scope="scope">
95 95
           <div class="customerServiceTagBox biaoqian">
96 96
             <div class="customerServiceTag" v-if="scope.row.gender==1||scope.row.gender==2">{{scope.row.gender==1?'男':scope.row.gender==2?'女':''}}</div>
97
-            <div class="customerServiceTag" v-for="(item) in scope.row.tag_list" :key="item">{{item}}</div>
97
+            <div class="customerServiceTag" v-for="(item,index) in scope.row.tag_list" :key="index">{{item}}</div>
98 98
           </div>
99 99
         </template>
100 100
       </el-table-column>
@@ -174,6 +174,7 @@ export default {
174 174
         { name: '当前页面', id: 2 },
175 175
       ],
176 176
       pageOptionValue: 2,
177
+      old_pageOptionValue: 2,
177 178
       input_keyword: '',
178 179
       tableData: [],
179 180
       user_id_list: [],//客服user_id列表
@@ -189,6 +190,10 @@ export default {
189 190
       resetFlag: false,//重置
190 191
       otherData: {},
191 192
       shieldingData: {},//拉黑的数据
193
+      multipleSelection: {},
194
+      exclude_multiple_selection: {},
195
+      multipleArr: [],
196
+      isAll: false,//是否选择全部
192 197
     }
193 198
   },
194 199
   created () {
@@ -237,6 +242,17 @@ export default {
237 242
       this.pay_num_max = '';
238 243
       this.init(1)
239 244
     },
245
+    changeType (type) {
246
+      this.type = type;
247
+      this.multipleSelection = {};
248
+      this.exclude_multiple_selection = {};
249
+      this.multipleArr = [];
250
+      this.isAll = false;
251
+      this.resetEvent()
252
+    },
253
+    toDistribution () {//去分配
254
+
255
+    },
240 256
     shieldingUserCancel (type) {
241 257
       if (type == 'update') {
242 258
         this.init(1)
@@ -327,6 +343,27 @@ export default {
327 343
           }
328 344
           this.total = res.rst.pageInfo.total;
329 345
           this.pages = res.rst.pageInfo.pages;
346
+
347
+
348
+          // 回显选择
349
+          let page_multiple_data = [];
350
+          if (this.isAll && (!this.multipleSelection[this.page])) {
351
+            page_multiple_data = this.tableData
352
+          } else {
353
+            let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
354
+              return v.user_id + '-' + v.customer_id
355
+            }) : []
356
+            this.tableData.forEach((item) => {
357
+              if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
358
+                page_multiple_data.push(item)
359
+              }
360
+            })
361
+          }
362
+          this.$nextTick(() => {
363
+            page_multiple_data.forEach((row) => {
364
+              this.$refs.multipleTable.toggleRowSelection(row, true);
365
+            })
366
+          })
330 367
         } else if (res.errno != 4002) {
331 368
           this.$message({
332 369
             message: res.err,
@@ -340,8 +377,54 @@ export default {
340 377
     handleCurrentChange (val) {
341 378
       this.init(val)
342 379
     },
343
-    handleSelectionChange () {
344
-
380
+    handleSelectionChange (row) {
381
+      this.multipleSelection[this.page] = row && row.length != 0 ? row : null;
382
+      if (this.isAll) {//全选状态下被排除的用户
383
+        let page_multiple_data = [];
384
+        let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
385
+          return v.user_id + '-' + v.customer_id
386
+        }) : []
387
+        this.tableData.forEach((item) => {
388
+          if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
389
+            page_multiple_data.push(item)
390
+          }
391
+        })
392
+        this.exclude_multiple_selection[this.page] = page_multiple_data
393
+      }
394
+      this.userChange()
395
+    },
396
+    pageOptionSelect (val) {//选择
397
+      if (val && val != '') {
398
+        this.old_pageOptionValue = val;
399
+      }
400
+      this.exclude_multiple_selection = {}
401
+      if (this.pageOptionValue == 1) {
402
+        this.isAll = true
403
+      } else {//选择当前页面
404
+        this.isAll = false
405
+        let current_page_data = this.multipleSelection[this.page];
406
+        this.multipleSelection = {};
407
+        this.multipleSelection[this.page] = current_page_data ? current_page_data : null;
408
+      }
409
+      this.tableData.forEach((row) => {
410
+        this.$refs.multipleTable.toggleRowSelection(row, true);
411
+      });
412
+      this.userChange()
413
+    },
414
+    handleSelectAll (row) {//点击了全选
415
+      if (this.isAll && row.length == 0) {
416
+        this.multipleSelection = {}
417
+        this.exclude_multiple_selection = {}
418
+        this.isAll = false
419
+        this.userChange()
420
+      }
421
+    },
422
+    userChange () {
423
+      let multipleArr = []
424
+      for (var i in this.multipleSelection) {
425
+        multipleArr = multipleArr.concat(this.multipleSelection[1] ? this.multipleSelection[1] : [])
426
+      }
427
+      this.multipleArr = multipleArr;
345 428
     },
346 429
   }
347 430
 }

+ 161 - 85
project/src/components/customManage/manage.vue

@@ -34,12 +34,12 @@
34 34
           <!-- <div class="smalLine"></div> -->
35 35
           <!-- <el-button type="primary" plain size="mini"><i class="el-icon-refresh-right"></i> 更新数据</el-button> -->
36 36
         </div>
37
-        <div class="selectCustom">已择0个客户</div>
37
+        <div class="selectCustom">已择{{multipleArr.length}}个客户</div>
38 38
       </div>
39 39
       <div class="flex">
40 40
         <el-button type="primary" plain size="mini" @click="setCustomerTag(1)">批量打标签</el-button>
41 41
         <el-button type="primary" plain size="mini" @click="setCustomerTag(2)">批量移除标签</el-button>
42
-        <el-button type="primary" plain size="mini">导出Excel</el-button>
42
+        <el-button type="primary" plain size="mini" @click="init(1,'export')">导出Excel</el-button>
43 43
       </div>
44 44
     </div>
45 45
     <!-- table -->
@@ -135,7 +135,7 @@
135 135
     </el-drawer>
136 136
     <!-- 批量打标签 -->
137 137
     <el-dialog :title="tagType==1?'批量打标签':'批量移除标签'" :visible.sync="tagVisible" width="600px" center top="15vh">
138
-      <tag-dialog @closeTagDialog="closeTagDialog" :tagType='tagType'></tag-dialog>
138
+      <tag-dialog @closeTagDialog="closeTagDialog" :tagType='tagType' :userLength='multipleArr.length'></tag-dialog>
139 139
     </el-dialog>
140 140
   </div>
141 141
 </template>
@@ -163,7 +163,7 @@ export default {
163 163
       page: 1,
164 164
       pages: 0,
165 165
       total: 0,
166
-      page_size: 2,
166
+      page_size: 20,
167 167
       shieldingFlag: false,
168 168
       pageOptions: [
169 169
         { name: '全部', id: 1 },
@@ -188,8 +188,9 @@ export default {
188 188
       shieldingData: {},//拉黑的数据
189 189
       multipleSelection: {},
190 190
       exclude_multiple_selection: {},
191
+      multipleArr: [],
191 192
       isAll: false,//是否选择全部
192
-      tagVisible: true,
193
+      tagVisible: false,
193 194
       tagType: 1
194 195
     }
195 196
   },
@@ -215,56 +216,37 @@ export default {
215 216
     },
216 217
     closeTagDialog (val) {
217 218
       if (val && val.length != 0) {
218
-        this.page = page ? page : this.page;
219
-        this.loading = true
220
-        this.$axios.get(this.URL.BASEURL + this.URL.customer_setCustomerTag, {
221
-          params: {
222
-            user_id_list: this.user_id_list,
223
-            customer_name: this.input_keyword,
224
-            add_date_start: this.add_date_start,
225
-            add_date_end: this.add_date_end,
226
-            add_way: this.add_way,
227
-            pay_status: this.pay_status,
228
-            pay_num_min: this.pay_num_min,
229
-            pay_num_max: this.pay_num_max,
230
-            tag_type: this.tag_type,
231
-            tag_id_list: this.tag_id_list,
232
-            loss_status: this.loss_status,
233
-            page: this.page,
234
-            page_size: this.page_size
235
-          }
219
+        let customer_list = [];
220
+        customer_list = this.multipleArr.map((v) => {
221
+          return { customer_id: v.customer_id, user_id: v.user_id }
222
+        })
223
+        this.$loading(this.$loadingConfig);
224
+        this.$axios.post(this.URL.BASEURL + this.URL.customer_setCustomerTag, {
225
+          // user_id_list: this.user_id_list,
226
+          // customer_name: this.input_keyword,
227
+          // add_date_start: this.add_date_start,
228
+          // add_date_end: this.add_date_end,
229
+          // add_way: this.add_way,
230
+          // pay_status: this.pay_status,
231
+          // pay_num_min: this.pay_num_min,
232
+          // pay_num_max: this.pay_num_max,
233
+          // tag_type: this.tag_type,
234
+          // tag_id_list: this.tag_id_list,
235
+          // loss_status: this.loss_status,
236
+
237
+          type: this.tagType,
238
+          tag_list: val,
239
+          customer_list: customer_list
236 240
         }).then((res) => {
237 241
           var res = res.data
238
-          this.loading = false
242
+          this.$loading(this.$loadingConfig).close();
239 243
           if (res && res.errno == 0) {
240
-            this.tableData = res.rst.data.list;
241
-            this.otherData = {
242
-              count: res.rst.data.count,
243
-              exclude_count: res.rst.data.exclude_count
244
-            }
245
-            this.total = res.rst.pageInfo.total;
246
-            this.pages = res.rst.pageInfo.pages;
247
-
248
-            // 回显选择
249
-            let page_multiple_data = [];
250
-            if (this.isAll && (!this.multipleSelection[this.page])) {
251
-              page_multiple_data = this.tableData
252
-            } else {
253
-              let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
254
-                return v.user_id + '-' + v.customer_id
255
-              }) : []
256
-              this.tableData.forEach((item) => {
257
-                if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
258
-                  page_multiple_data.push(item)
259
-                }
260
-              })
261
-            }
262
-            this.$nextTick(() => {
263
-              page_multiple_data.forEach((row) => {
264
-                this.$refs.multipleTable.toggleRowSelection(row, true);
265
-              })
266
-            })
267
-
244
+            this.$notify.info({
245
+              title: '提示',
246
+              message: `批量${this.tagType == 1 ? '打' : '移除'}标签进行中,请耐心等待!`,
247
+              duration: 0
248
+            });
249
+            this.customer_batchMarkTagResult(res.rst.id)
268 250
           } else if (res.errno != 4002) {
269 251
             this.$message({
270 252
               message: res.err,
@@ -272,11 +254,64 @@ export default {
272 254
             })
273 255
           }
274 256
         }).catch((err) => {
275
-          this.loading = false
257
+          this.$loading(this.$loadingConfig).close();
276 258
         });
277 259
       }
278 260
       this.tagVisible = false
279 261
     },
262
+    customer_batchMarkTagResult (id) {//批量编辑标签结果
263
+      this.$axios.get(this.URL.BASEURL + this.URL.customer_batchMarkTagResult, {
264
+        params: {
265
+          id: id
266
+        }
267
+      }).then((res) => {
268
+        var res = res.data
269
+        if (res && res.errno == 0) {
270
+          if (res.rst.status == 3) {
271
+            this.$notify.closeAll()
272
+            this.$notify({
273
+              title: '成功',
274
+              message: '标签编辑成功!',
275
+              type: 'success',
276
+              duration: 0
277
+            });
278
+            this.multipleSelection = {};
279
+            this.exclude_multiple_selection = {};
280
+            this.multipleArr = [];
281
+            this.isAll = false;
282
+            this.init(this.page)
283
+          } else if (res.rst.status == 3) {
284
+            this.$notify.closeAll()
285
+            this.$notify.error({
286
+              title: '错误',
287
+              message: '标签编辑失败!',
288
+              type: 'success',
289
+              duration: 0
290
+            });
291
+          } else {
292
+            setTimeout(() => {
293
+              this.customer_batchMarkTagResult(id)
294
+            }, 2000)
295
+          }
296
+        } else if (res.errno != 4002) {
297
+          this.$notify.closeAll()
298
+          this.$notify.error({
299
+            title: '错误',
300
+            message: res.err,
301
+            type: 'success',
302
+            duration: 0
303
+          });
304
+        }
305
+      }).catch((err) => {
306
+        this.$notify.closeAll()
307
+        this.$notify.error({
308
+          title: '错误',
309
+          message: '标签编辑失败,服务器错误!',
310
+          type: 'success',
311
+          duration: 0
312
+        });
313
+      });
314
+    },
280 315
     resetEvent () {//重置
281 316
       this.resetFlag = !this.resetFlag
282 317
       this.input_keyword = '';
@@ -344,8 +379,18 @@ export default {
344 379
       }
345 380
       this.init(1)
346 381
     },
347
-    init (page) {
348
-      this.page = page ? page : this.page;
382
+    init (page, type) {
383
+      if (type != 'export') {
384
+        this.page = page ? page : this.page;
385
+      } else {
386
+        if (this.total == 0) {
387
+          this.$message({
388
+            message: '暂无数据可导出',
389
+            type: "warning"
390
+          })
391
+          return
392
+        }
393
+      }
349 394
       this.loading = true
350 395
       this.$axios.get(this.URL.BASEURL + this.URL.customerList, {
351 396
         params: {
@@ -360,41 +405,44 @@ export default {
360 405
           tag_type: this.tag_type,
361 406
           tag_id_list: this.tag_id_list,
362 407
           loss_status: this.loss_status,
363
-          page: this.page,
364
-          page_size: this.page_size
408
+          page: type == 'export' ? 1 : this.page,
409
+          page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size
365 410
         }
366 411
       }).then((res) => {
367 412
         var res = res.data
368 413
         this.loading = false
369 414
         if (res && res.errno == 0) {
370
-          this.tableData = res.rst.data.list;
371
-          this.otherData = {
372
-            count: res.rst.data.count,
373
-            exclude_count: res.rst.data.exclude_count
374
-          }
375
-          this.total = res.rst.pageInfo.total;
376
-          this.pages = res.rst.pageInfo.pages;
377
-
378
-          // 回显选择
379
-          let page_multiple_data = [];
380
-          if (this.isAll && (!this.multipleSelection[this.page])) {
381
-            page_multiple_data = this.tableData
415
+          if (type == 'export') {
416
+            this.exportEvent(res.rst.data.list)
382 417
           } else {
383
-            let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
384
-              return v.user_id + '-' + v.customer_id
385
-            }) : []
386
-            this.tableData.forEach((item) => {
387
-              if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
388
-                page_multiple_data.push(item)
389
-              }
418
+            this.tableData = res.rst.data.list;
419
+            this.otherData = {
420
+              count: res.rst.data.count,
421
+              exclude_count: res.rst.data.exclude_count
422
+            }
423
+            this.total = res.rst.pageInfo.total;
424
+            this.pages = res.rst.pageInfo.pages;
425
+
426
+            // 回显选择
427
+            let page_multiple_data = [];
428
+            if (this.isAll && (!this.multipleSelection[this.page])) {
429
+              page_multiple_data = this.tableData
430
+            } else {
431
+              let multiple_id = this.multipleSelection[this.page] ? this.multipleSelection[this.page].map((v) => {
432
+                return v.user_id + '-' + v.customer_id
433
+              }) : []
434
+              this.tableData.forEach((item) => {
435
+                if (multiple_id.indexOf((item.user_id + '-' + item.customer_id)) != -1) {
436
+                  page_multiple_data.push(item)
437
+                }
438
+              })
439
+            }
440
+            this.$nextTick(() => {
441
+              page_multiple_data.forEach((row) => {
442
+                this.$refs.multipleTable.toggleRowSelection(row, true);
443
+              })
390 444
             })
391 445
           }
392
-          this.$nextTick(() => {
393
-            page_multiple_data.forEach((row) => {
394
-              this.$refs.multipleTable.toggleRowSelection(row, true);
395
-            })
396
-          })
397
-
398 446
         } else if (res.errno != 4002) {
399 447
           this.$message({
400 448
             message: res.err,
@@ -405,13 +453,17 @@ export default {
405 453
         this.loading = false
406 454
       });
407 455
     },
408
-    setCustomerTag (type) {//批量打标签、移除标签
409
-      //type 操作类型 1添加标签 2移除标签
456
+    userChange () {
410 457
       let multipleArr = []
411 458
       for (var i in this.multipleSelection) {
412 459
         multipleArr = multipleArr.concat(this.multipleSelection[1] ? this.multipleSelection[1] : [])
413 460
       }
414
-      if (multipleArr.length == 0) {
461
+      this.multipleArr = multipleArr;
462
+    },
463
+    setCustomerTag (type) {//批量打标签、移除标签
464
+      //type 操作类型 1添加标签 2移除标签
465
+      this.userChange()
466
+      if (this.multipleArr.length == 0) {
415 467
         this.$message({
416 468
           message: '请选择客户!',
417 469
           type: "warning"
@@ -429,6 +481,7 @@ export default {
429 481
         this.multipleSelection = {}
430 482
         this.exclude_multiple_selection = {}
431 483
         this.isAll = false
484
+        this.userChange()
432 485
       }
433 486
     },
434 487
     handleSelectionChange (row) {//点击选择变化
@@ -445,6 +498,7 @@ export default {
445 498
         })
446 499
         this.exclude_multiple_selection[this.page] = page_multiple_data
447 500
       }
501
+      this.userChange()
448 502
     },
449 503
     pageOptionSelect (val) {//选择
450 504
       if (val && val != '') {
@@ -462,7 +516,29 @@ export default {
462 516
       this.tableData.forEach((row) => {
463 517
         this.$refs.multipleTable.toggleRowSelection(row, true);
464 518
       });
519
+      this.userChange()
465 520
     },
521
+    exportEvent (data) {
522
+      let list = data;
523
+      let tHeader = ['客户id', '客户名称', '客户备注', '客户头像', '外部联系人的类型', '客户状态', '所属客服', '客服ID', '所属部门', '标签', '性别', '添加时间', '添加渠道', '付费情况']
524
+      let filterVal = ['customer_id', 'name', 'remark', 'avatar', 'self_type', 'self_customer_enable', 'self_user_name', 'user_id', 'department_list', 'tag_list', 'self_gender', 'createtime', 'add_way', 'self_pay_num']
525
+      list.forEach((item) => {
526
+        item.self_pay_num = item.pay_num > 0 ? ('已付费(' + item.pay_num + '次)') : '未付费';
527
+        item.self_gender = item.gender == 1 ? '男' : item.gender == 2 ? '女' : '';
528
+        item.self_user_name = item.user_list.name;
529
+        item.self_type = item.type == 1 ? '微信用户' : item.type == 2 ? '' : '企业微信';
530
+        item.self_customer_enable = item.customer_enable == 0 ? '禁用' : item.customer_enable == 1 ? '可用' : item.customer_enable == 3 ? '已流失' : ''
531
+      })
532
+      let excelDatas = [
533
+        {
534
+          tHeader: tHeader, // sheet表一头部
535
+          filterVal: filterVal, // 表一的数据字段
536
+          tableDatas: list, // 表一的整体json数据
537
+          sheetName: ''// 表一的sheet名字
538
+        }
539
+      ]
540
+      this.$exportOrder({ excelDatas, name: `客户管理(导出时间:${this.$getDay(0)})` })
541
+    }
466 542
   }
467 543
 }
468 544
 </script>

+ 1 - 3
project/src/components/detials/customerProfile.vue

@@ -187,9 +187,7 @@ export default {
187 187
       }
188 188
     }
189 189
   },
190
-  created() {
191
-    this.init()
192
-  },
190
+
193 191
   methods:{
194 192
     init(){
195 193
       this.loading = true