zjf
2023-03-03 26e972196ed6046bcb7fb341be86241c8300fd2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
/** crm自定义列表 公共逻辑 */
import {
  mapGetters
} from 'vuex'
// import crmTypeModel from '@/views/clients/model/crmTypeModel'
import CRMListHead from '../components/CRMListHead'
import CRMTableHead from '../components/CRMTableHead'
import FieldsSet from '../components/fieldsManager/FieldsSet'
import Lockr from 'lockr'
import { Loading } from 'element-ui'
// import { moneyFormat } from '@/utils'
import { GetCustomerPageList } from '@/api/customermanagement/customerManage'
import { GetContacterList } from '@/api/customermanagement/contacts'
import { GetSalesChanceList } from '@/api/customermanagement/business'
import { GetAgreementList, GetManagementAgreementList } from '@/api/customermanagement/contract'
import { GetQuotationSheetList, GetManagementQuotationSheetList } from '@/api/customermanagement/offer'
import { GetOtherCustomerPageList, GetOtherSalesChanceList, GetOtherAgreementList } from '@/api/businessIntelligence/index'
import { downloadFile } from '@/utils'
 
export default {
  components: {
    CRMListHead,
    CRMTableHead,
    FieldsSet
  },
  data () {
    return {
      loading: false, // 加载动画
      tableHeight: document.documentElement.clientHeight - 360, // 表的高度
      list: [],
      fieldList: [],
      sortData: {}, // 字段排序
      currentPage: 1,
      // Lockr.get('crmPageSizes')
      pageSize: 10,
      pageSizes: [10, 30, 60, 100],
      total: 0,
      search: '', // 搜索内容
      /** 控制详情展示 */
      rowID: '', // 行信息
      rowType: '', // 详情类型
      showDview: false,
      /** 高级筛选 */
      filterObj: {}, // 筛选确定数据
      headObj: {}, // 筛选顶部数据
      sceneId: '', // 场景筛选ID
      sceneName: '', // 场景名字
      /** 列表展示字段管理 */
      showFieldSet: false,
      /** 勾选行 */
      // 勾选数据 用于全局导出
      selectionList: [],
      /** 格式化规则 */
      formatterRules: {},
      isCreate: false,
      editData: {},
      filterFormerData: {} // 筛选值
    }
  },
 
  computed: {
    ...mapGetters(['crm'])
  },
 
  mounted () {
    /** 控制table的高度 */
    window.onresize = () => {
      this.updateTableHeight()
    }
    this.getList()
  },
 
  methods: {
    /** 获取列表数据 */
    getList (data) {
      let isFilter
      if (data) {
        this.currentPage = 1
        this.pageSize = 10
        if (data.list) {
          // 头部筛选
          isFilter = 1
          this.filterFormerData = data.list
        } else if (data.tableType) {
          // 表头筛选
          isFilter = 2
        }
      }
      let isFilterBoo = Object.values(this.filterFormerData).length > 0
      this.loading = true
      let crmIndexRequest = this.getIndexRequest()
      let params = {}
      if (this.crmType === 'customer' || this.crmType === 'businessCustomer') {
        params = {
          'PageIndex': this.currentPage,
          'PageSize': this.pageSize,
          'SelectOwnedType': isFilterBoo ? this.filterFormerData.customer : 0,
          'SalesChanceStage': isFilterBoo ? this.filterFormerData.businessType : '',
          'Name': isFilterBoo ? this.filterFormerData.user : '',
          'ProvinceCode': isFilterBoo ? this.filterFormerData.area : '',
          'CreateStartTime': '',
          'CreateEndTime': '',
          'StartFollowTime': '',
          'EndFolowTime': '',
          'CompanyType': isFilter === 2 ? Lockr.get('comType') : '',
          'CustomerIndustry': isFilter === 2 ? Lockr.get('casType') : ''
        }
        if (isFilterBoo) {
          params['DepartmentUserType'] = this.filterFormerData.userType
          params['Id'] = this.filterFormerData.customer
          params['BrachUserId'] = this.filterFormerData.BrachUserId
        }
      } else if (this.crmType === 'contacts') {
        params = {
          'PageIndex': this.currentPage,
          'PageSize': this.pageSize,
          'SalesChanceStage': isFilterBoo ? this.filterFormerData.businessType : '',
          'SelectOwnedType': isFilterBoo ? this.filterFormerData.customer : 0,
          'BrachUserId': isFilterBoo ? this.filterFormerData.BrachUserId : '',
          'ProvinceCode': isFilterBoo ? this.filterFormerData.area : '',
          'Name': isFilterBoo ? this.filterFormerData.user : ''
        }
      } else if (this.crmType === 'business' || this.crmType === 'businessChances') {
        params = {
          'PageIndex': this.currentPage,
          'PageSize': this.pageSize,
          'SalesChanceStage': isFilterBoo ? this.filterFormerData.businessType : '',
          'SelectOwnedType': isFilterBoo ? this.filterFormerData.customer : 0,
          'Name': isFilterBoo ? this.filterFormerData.user : '',
          'SalesChanceType': isFilterBoo ? this.filterFormerData.businessType : '',
          'ProvinceCode': isFilterBoo ? this.filterFormerData.area : '',
          'CreateStartTime': '',
          'CreateEndTime': '',
          'ProjectProperty': isFilter === 2 ? (data.tableType === '项目属性' ? data.value : '') : '',
          'UploadStatusName': isFilter === 2 ? (data.tableType === '提交' ? data.value : '') : '',
          'ReportStatusName': isFilter === 2 ? (data.tableType === '审批' ? data.value : '') : ''
        }
        if (isFilterBoo) {
          params['DepartmentUserType'] = this.filterFormerData.userType
          params['Id'] = this.filterFormerData.customer
          params['BrachUserId'] = this.filterFormerData.BrachUserId
        }
      } else if (this.crmType === 'contract' || this.crmType === 'offers' || this.crmType === 'businessContract') {
        params = {
          'PageIndex': this.currentPage,
          'PageSize': this.pageSize,
          'SelectOwnedType': isFilterBoo ? this.filterFormerData.customer : 0,
          'AuditStatus': 0,
          'SealStatus': 0,
          'Name': isFilterBoo ? this.filterFormerData.user : '',
          'CreateStartTime': '',
          'CreateEndTime': ''
        }
        if (isFilterBoo) {
          params['DepartmentUserType'] = this.filterFormerData.userType
          params['Id'] = this.filterFormerData.customer
          params['BrachUserId'] = this.filterFormerData.BrachUserId
        }
        if (isFilter === 2) {
          params['SealType'] = data.value
        }
      } else if (this.crmType === 'sealContract' || this.crmType === 'sealOffers') {
        params = {
          'PageIndex': this.currentPage,
          'PageSize': this.pageSize,
          'AuditStatus': 0,
          'SealStatus': 0,
          'Name': isFilterBoo ? this.filterFormerData.user : '',
          'CreateStartTime': '',
          'CreateEndTime': ''
        }
        if (isFilterBoo) {
          params['DepartmentUserType'] = this.filterFormerData.userType
          params['Id'] = this.filterFormerData.customer
        }
        if (isFilter === 2) {
          params['SealType'] = data.value
        }
      }
      crmIndexRequest(params)
        .then(res => {
          if (res.data.ErrorCode === 200) {
            if (res.data.Result.Count > 0) {
              this.list = res.data.Result.List
            } else {
              this.list = []
            }
            this.total = res.data.Result.Count
            this.loading = false
          } else {
            this.$message.error(res.data.Message)
            this.loading = false
          }
        })
        .catch(() => {
          this.loading = false
        })
    },
    // 列表编辑
    editList (row) {
      console.log(row)
      this.isCreate = true
      this.editData = row
    },
    /** 获取列表请求 */
    getIndexRequest () {
      if (this.crmType === 'leads') {
        // return crmLeadsIndex
      } else if (this.crmType === 'customer') {
        return GetCustomerPageList
      } else if (this.crmType === 'contacts') {
        return GetContacterList
      } else if (this.crmType === 'business') {
        return GetSalesChanceList
      } else if (this.crmType === 'contract') {
        return GetAgreementList
      } else if (this.crmType === 'offers') {
        return GetQuotationSheetList
      } else if (this.crmType === 'sealContract') {
        return GetManagementAgreementList
      } else if (this.crmType === 'sealOffers') {
        return GetManagementQuotationSheetList
      } else if (this.crmType === 'receivables') {
        // return crmReceivablesIndex
      } else if (this.crmType === 'businessCustomer') {
        return GetOtherCustomerPageList
      } else if (this.crmType === 'businessContract') {
        return GetOtherAgreementList
      } else if (this.crmType === 'businessChances') {
        return GetOtherSalesChanceList
      }
    },
    /** 获取字段 */
    getFieldList () {
      if (this.fieldList.length === 0) {
        this.loading = true
      } else {
        // 获取好字段开始请求数据
        this.getList()
      }
    },
    /** 格式化字段 */
    fieldFormatter (row, column) {
      // var aRules = this.formatterRules[column.property]
      // if (aRules) {
      //   return aRules.formatter(row[column.property])
      // }
      if (column.property === 'ReportStatus') {
        switch (row[column.property]) {
          case 0:
            row[column.property] = '--'
            break
          case 1:
            row[column.property] = '待提交'
            break
          case 2:
            row[column.property] = '已提交'
            break
          case 3:
            row[column.property] = '报备成功'
            break
          case 4:
            row[column.property] = '报备失败'
            break
        }
      } else if (column.property === 'SalesChanceStage') {
        switch (row[column.property]) {
          case 0:
            row[column.property] = '--'
            break
          case 1:
            row[column.property] = '初期沟通'
            break
          case 2:
            row[column.property] = '需求分析'
            break
          case 3:
            row[column.property] = '方案报价'
            break
          case 4:
            row[column.property] = '商务谈判'
            break
 
          case 5:
            row[column.property] = '成功'
            break
          case 6:
            row[column.property] = '搁置'
            break
        }
      } else if (column.property === 'UploadStatus') {
        switch (row[column.property]) {
          case 0:
            row[column.property] = '--'
            break
          case 1:
            row[column.property] = '待上传'
            break
          case 2:
            row[column.property] = '审核中'
            break
          case 3:
            row[column.property] = '已上传'
            break
        }
      } else if (column.property === 'Sex') {
        return { 1: '男', 2: '女' }[row.Sex]
      } else if (column.property === 'IsCustomerDefault') {
        return { true: '是', false: '否' }[row.IsCustomerDefault]
      } else if (column.property === 'CompanyType') {
        return {0: '暂无', 1: '国企', 2: '外企', 3: '民营', 4: '其他'}[row.CompanyType]
      } else if (column.property === 'ExpectedAmount') {
        return '¥' + JSON.parse(row.ExpectedAmount)
      } else if (column.property === 'ChanceRequestType') {
        switch (row[column.property]) {
          case 0:
            row[column.property] = 'Other'
            break
          case 1:
            row[column.property] = 'LC'
            break
          case 2:
            row[column.property] = 'ACAD'
            break
          case 3:
            row[column.property] = 'AEC'
            break
          case 4:
            row[column.property] = 'MFG'
            break
          case 5:
            row[column.property] = 'MNE'
            break
        }
      } else if (column.property === 'AuditStatus') {
        switch (row[column.property]) {
          case 0:
            row[column.property] = '--'
            break
          case 1:
            row[column.property] = '审批中'
            break
          case 2:
            row[column.property] = '通过'
            break
          case 3:
            row[column.property] = '驳回'
            break
        }
      } else if (column.property === 'SealType') {
        switch (row[column.property]) {
          case 1:
            row[column.property] = '合同章'
            break
          case 2:
            row[column.property] = '公章'
            break
        }
      } else if (column.property === 'IsSeal') {
        switch (row[column.property]) {
          case false:
            row[column.property] = '否'
            break
          case true:
            row[column.property] = '是'
            break
        }
      } else if (column.property === 'TrackStatus') {
        switch (row['IsAutoPassed']) {
          case false:
            row[column.property] = row[column.property]
            break
          case true:
            row[column.property] = '通过'
            break
        }
      }
      // 如果需要格式化
      return row[column.property] || '--'
    },
    /** */
    /** */
    /** 搜索操作 */
    crmSearch (value) {
      this.currentPage = 1
      this.search = value
      if (this.fieldList.length) {
        this.getList()
      }
    },
    /** 列表操作 */
    // 当某一行被点击时会触发该事件
    handleRowClick (row, column, event) {
      console.log(row)
      if (column.type === 'selection') {
        return // 多选布局不能点击
      }
      if (this.crmType === 'leads') {
        if (column.property === 'leadsName') {
          this.rowID = row.leadsId
          this.showDview = true
        } else {
          this.showDview = false
        }
      } else if (this.crmType === 'customer') {
        if (column.property === 'businessCheck' && row.businessCount > 0) {
          return // 列表查看商机不展示详情
        }
        if (column.property === 'CustomerName') {
          this.rowID = row.Id
          this.rowType = 'customer'
          this.showDview = true
          console.log('yesss')
        }
      } else if (this.crmType === 'contacts') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'customer'
          this.showDview = true
        } else if (column.property === 'RealName') {
          this.rowID = row.Id
          this.rowType = 'contacts'
          this.showDview = true
        } else {
          this.showDview = false
        }
      } else if (this.crmType === 'business') {
        if (column.property === 'CustomerName') {
          this.isFollow = false
          this.rowID = row.CustomerId
          this.rowType = 'customer'
          this.showDview = true
        } else if (column.property === 'ChanceName') {
          this.isFollow = false
          this.rowID = row.Id
          this.rowType = 'business'
          this.showDview = true
        }
      } else if (this.crmType === 'contract') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'customer'
          this.showDview = true
        } else if (column.property === 'SalesChanceName') {
          this.rowID = row.SalesChanceId
          this.rowType = 'business'
          this.showDview = true
        } else if (column.property === 'ContacterName') {
          this.rowID = row.contactsId
          this.rowType = 'contacts'
          this.showDview = true
        } else if (column.property === 'BeforeSealFile' || column.property === 'SealFile') {
          if (column.property === 'BeforeSealFile' && row.BeforeSealFile !== '') {
            this.handleFile(column, row)
          }
          if (column.property === 'SealFile' && row.SealFile !== '') {
            this.handleFile(column, row)
          }
        }
      } else if (this.crmType === 'offers') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'customer'
          this.showDview = true
        } else if (column.property === 'SalesChanceName') {
          this.rowID = row.SalesChanceId
          this.rowType = 'business'
          this.showDview = true
        } else if (column.property === 'ContacterName') {
          this.rowID = row.contactsId
          this.rowType = 'contacts'
          this.showDview = true
        } else if (column.property === 'BeforeSealFile' || column.property === 'SealFile') {
          if (column.property === 'BeforeSealFile' && row.BeforeSealFile !== '') {
            this.handleFile(column, row)
          }
          if (column.property === 'SealFile' && row.SealFile !== '') {
            this.handleFile(column, row)
          }
        }
      } else if (this.crmType === 'sealContract') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'businessCustomer'
          this.showDview = true
        } else if (column.property === 'SalesChanceName') {
          this.rowID = row.SalesChanceId
          this.rowType = 'businessChances'
          this.showDview = true
        } else if (column.property === 'BeforeSealFile' || column.property === 'SealFile') {
          if (column.property === 'BeforeSealFile' && row.BeforeSealFile !== '') {
            this.handleFile(column, row)
          }
          if (column.property === 'SealFile' && row.SealFile !== '') {
            this.handleFile(column, row)
          }
        }
      } else if (this.crmType === 'sealOffers') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'businessCustomer'
          this.showDview = true
        } else if (column.property === 'SalesChanceName') {
          this.rowID = row.SalesChanceId
          this.rowType = 'businessChances'
          this.showDview = true
        } else if (column.property === 'BeforeSealFile' || column.property === 'SealFile') {
          if (column.property === 'BeforeSealFile' && row.BeforeSealFile !== '') {
            this.handleFile(column, row)
          }
          if (column.property === 'SealFile' && row.SealFile !== '') {
            this.handleFile(column, row)
          }
        }
      } else if (this.crmType === 'businessCustomer') {
        if (column.property === 'businessCheck' && row.businessCount > 0) {
          return // 列表查看商机不展示详情
        }
        if (column.property === 'CustomerName') {
          this.rowID = row.Id
          this.rowType = 'businessCustomer'
          this.showDview = true
          console.log('yesss')
        }
      } else if (this.crmType === 'businessChances') {
        if (column.property === 'CustomerName') {
          this.isFollow = false
          this.rowID = row.CustomerId
          this.rowType = 'businessCustomer'
          this.showDview = true
        } else if (column.property === 'ChanceName') {
          this.isFollow = false
          this.rowID = row.Id
          this.rowType = 'businessChances'
          this.showDview = true
        }
      } else if (this.crmType === 'businessContract') {
        if (column.property === 'CustomerName') {
          this.rowID = row.CustomerId
          this.rowType = 'businessCustomer'
          this.showDview = true
        } else if (column.property === 'SalesChanceName') {
          this.rowID = row.SalesChanceId
          this.rowType = 'businessChances'
          this.showDview = true
        } else if (column.property === 'BeforeSealFile' || column.property === 'SealFile') {
          if (column.property === 'BeforeSealFile' && row.BeforeSealFile !== '') {
            this.handleFile(column, row)
          }
          if (column.property === 'SealFile' && row.SealFile !== '') {
            this.handleFile(column, row)
          }
        }
      } else if (this.crmType === 'receivables') {
        if (column.property === 'CustomerName') {
          this.rowID = row.Id
          this.rowType = 'customer'
          this.showDview = true
        } else if (column.property === 'contractNum') {
          this.rowID = row.contractId
          this.rowType = 'contract'
          this.showDview = true
        } else if (column.property === 'number') {
          this.rowID = row.receivablesId
          this.rowType = 'receivables'
          this.showDview = true
        } else {
          this.showDview = false
        }
      }
      if (this.showDview) {
        this.timer = new Date().getTime()
      }
    },
    handleFile (column, data) {
      if (column.property === 'BeforeSealFile') {
        downloadFile({ path: data.BeforeSealFile, name: data.BeforeSealFile })
      } else if (column.property === 'SealFile') {
        downloadFile({ path: data.SealFile, name: data.SealFile })
      }
    },
    /**
     * 导出 线索 客户 联系人 产品
     * @param {*} data
     */
    // 导出操作
    exportInfos () {
      var params = {
        search: this.search
      }
      if (this.sceneId) {
        params.sceneId = this.sceneId
      }
      if (this.filterObj && Object.keys(this.filterObj).length > 0) {
        params.data = this.filterObj
      }
      let request
      // 公海的请求
      // if (this.isSeas) {
      //   request = crmCustomerPoolExcelAllExport
      // } else {
      //   request = {
      //     customer: crmCustomerExcelAllExport,
      //     leads: crmLeadsExcelAllExport,
      //     contacts: crmContactsExcelAllExport,
      //     product: crmProductExcelAllExport
      //   }[this.crmType]
      // }
      const loading = Loading.service({ fullscreen: true, text: '导出中...' })
      request(params)
        .then(res => {
          var blob = new Blob([res.data], {
            type: 'application/vnd.ms-excel;charset=utf-8'
          })
          var downloadElement = document.createElement('a')
          var href = window.URL.createObjectURL(blob) // 创建下载的链接
          downloadElement.href = href
          downloadElement.download =
            decodeURI(
              res.headers['content-disposition'].split('filename=')[1]
            ) || '' // 下载后文件名
          document.body.appendChild(downloadElement)
          downloadElement.click() // 点击下载
          document.body.removeChild(downloadElement) // 下载完成移除元素
          window.URL.revokeObjectURL(href) // 释放掉blob对象
          loading.close()
        })
        .catch(() => {
          loading.close()
        })
    },
    /** 筛选操作 */
    handleFilter (data) {
      this.filterObj = data
      var offsetHei = document.documentElement.clientHeight
      var removeHeight = Object.keys(this.filterObj).length > 0 ? 310 : 240
      this.tableHeight = offsetHei - removeHeight
      this.currentPage = 1
      this.getList()
    },
    /** 场景操作 */
    handleScene (data) {
      this.sceneId = data.id
      this.sceneName = data.name
      this.currentPage = 1
      this.getFieldList()
    },
    /** 勾选操作 */
    handleHandle (data) {
      if (data.type === 'alloc' || data.type === 'get' || data.type === 'transfer' || data.type === 'transform' || data.type === 'delete' || data.type === 'put_seas') {
        this.showDview = false
      }
 
      if (data.type !== 'edit') {
        this.getList()
      }
    },
    /** 自定义字段管理 */
    setSave () {
      this.fieldList = []
      this.getFieldList()
    },
    /** */
    /** 页面头部操作 */
    listHeadHandle (data) {
      console.log('cvvvvvvvvvvvvv', data)
      // if (data.type === 'save-success') {
      // 重新请求第一页数据
      this.currentPage = 1
      this.getList()
      // }
    },
    // 设置点击
    handleTableSet () {
      this.showFieldSet = true
    },
    /**
     * 字段排序
     */
    sortChange (column, prop, order) {
      this.currentPage = 1
      this.sortData = column
      this.getList()
    },
    /** 勾选操作 */
    // 当选择项发生变化时会触发该事件
    handleSelectionChange (val) {
      console.log(val)
      this.selectionList = val // 勾选的行
      this.$refs.crmTableHead.headSelectionChange(val)
    },
    // 当拖动表头改变了列的宽度的时候会触发该事件
    handleHeaderDragend (newWidth, oldWidth, column, event) {
      if (column.property) {
        // const crmType = this.isSeas ? this.crmType + '_pool' : this.crmType
        // crmFieldColumnWidth({
        //   types: 'crm_' + crmType,
        //   field: column.property,
        //   width: newWidth
        // })
        //   .then(res => {
        //   })
        //   .catch(() => { })
      }
    },
    // 更改每页展示数量
    handleSizeChange (val) {
      // Lockr.set('crmPageSizes', val)
      this.pageSize = val
      this.getList()
    },
    // 更改当前页数
    handleCurrentChange (val) {
      this.currentPage = val
      this.getList()
    },
    // 0待审核、1审核中、2审核通过、3已拒绝 4已撤回 5未提交 修正 以 getStatusName 为准
    getStatusStyle (status) {
      if (status === 0) {
        return {
          'border-color': '#E6A23C',
          'background-color': '#FDF6EC',
          'color': '#E6A23C'
        }
      } else if (status === 3) {
        return {
          'border-color': '#409EFF',
          'background-color': '#ECF5FF',
          'color': '#409EFF'
        }
      } else if (status === 1) {
        return {
          'border-color': '#67C23A',
          'background-color': '#F0F9EB',
          'color': '#67C23A'
        }
      } else if (status === 2) {
        return {
          'border-color': '#F56C6B',
          'background-color': '#FEF0F0',
          'color': '#F56C6B'
        }
      } else if (status === 4 || status === 5) {
        return {
          'background-color': '#FFFFFF'
        }
      } else if (status === 6) {
        return {
          'border-color': '#E9E9EB',
          'background-color': '#F4F4F5',
          'color': '#909399'
        }
      }
    },
    getStatusName (status) {
      if (status === 0) {
        return '待审核'
      } else if (status === 1) {
        return '通过'
      } else if (status === 2) {
        return '拒绝'
      } else if (status === 3) {
        return '审核中'
      } else if (status === 4) {
        return '撤回'
      } else if (status === 5) {
        return '未提交'
      } else if (status === 6) {
        return '已作废'
      }
      return ''
    },
 
    /**
     * 更新表高
     */
    updateTableHeight () {
      var offsetHei = document.documentElement.clientHeight
      var removeHeight = Object.keys(this.filterObj).length > 0 ? 310 : 240
      this.tableHeight = offsetHei - removeHeight
    },
    /**
     * 导出
     */
    exportData (params) {
      this.$refs.listHead.handleTypeDrop('out', params)
    }
  },
 
  beforeDestroy () { }
}