zouyu
2023-11-17 d8ac6057eaad648687699e25a575f3b7b8c1b102
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
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
<template>
  <div class="mod-config">
    <basic-container>
      <ttable
        :table="table"
        @handleSelectionChange="handleSelectionChange"
        :uploadInfo="uploadInfo"
        :prelang="prelang"
        :options="options"
        :ajaxFun="ajaxFun"
        ref="unqualifiedTable"
      >
        <template #toolbar>
          <el-button
            type="primary"
            v-if="permissions.quality_unqualifiedprocess_isused"
            :loading="isusedSynsLoading"
            @click="batchUpdateResultIsUsed"
            >允许使用并移库</el-button
          >
        </template>
      </ttable>
      <!-- 弹窗, 处理新增 / 修改 -->
      <unqualifiedProcessForm
        v-if="addOrUpdateVisible"
        ref="addOrUpdate"
        @refreshDataList="getData"
      />
      <!-- 弹窗, 审批 -->
      <examineApproveForm
        v-if="addexamineVisible"
        ref="addexamine"
        @refreshDataList="getData"
      />
      <!-- 弹窗, 执行 -->
      <tableForm
        v-if="addtableVisible"
        ref="addtable"
        @refreshDataList="getData"
      />
      <!-- 损失登记弹窗 -->
      <registerLossForm
        :registerLossList="multipleSelection"
        :currshowlist.sync="showRegisterLoss"
        @refreshDataList="getData"
      />
      <!-- 零件 -->
      <part-dialog
        :currshowlist.sync="showPart"
        @listenToPartEvent="selectPart"
      />
    </basic-container>
  </div>
</template>
 
<script>
import {
  fetchListUnqualifiedProcess,
  delUnqualifiedProcess,
  launchOaUnQualified,
  rfOa,
  partDegrade
} from '@/api/quality/unqualifiedprocess'
import { batchUpdateResultBySystemNo } from '@/api/quality/result'
import unqualifiedProcessForm from './unqualifiedprocessform'
import examineApproveForm from './examineApproveform'
import registerLossForm from './registerlossform'
import tableForm from './table-form'
import PartDialog from '@/views/common/part.vue'
import { mapGetters } from 'vuex'
import ttable from '@/views/common/ztt-table.vue'
import { remote } from '@/api/admin/dict'
 
export default {
  data() {
    return {
      ajaxFun: fetchListUnqualifiedProcess,
      addOrUpdateVisible: false,
      addexamineVisible: false,
      addtableVisible: false,
      currRow: null,
      multipleSelection: [],
      uploadInfo: {
        // 是否展示上传EXCEL以及对应的url
        isShow: false,
        url: ''
      },
      prelang: 'unqualifiedTable',
      options: {
        height: 300, // 默认高度-为了表头固定
        stripe: true, // 是否为斑马纹 table
        highlightCurrentRow: false, // 是否要高亮当前行
        border: true, // 是否有纵向边框
        lazy: false, // 是否需要懒加载
        fit: true, // 列的宽度是否自撑开
        multiSelect: true, //
        seqNo: true,
        isRefresh: true, // 是否显示刷新按钮
        isShowHide: true, // 是否显示显影按钮
        isSearch: false, // 高级查询按钮
        defaultOrderBy: { column: 'processNo', direction: 'desc' }
      },
      table: {
        total: 0,
        currentPage: 1,
        pageSize: 20,
        data: [],
        // 标题
        column: [
          {
            width: '100',
            minWidth: '100',
            prop: 'processNo',
            label: '编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text',
            render: { fun: this.addOrUpdateHandle }
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'mainProcessNo',
            label: '处理编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'reason',
            label: '原因',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            minWidth: '120',
            prop: 'causeType',
            label: '原因类型',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatCauseType,
            optList: () => {
              return this.causeTypeOptions
            }
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'reportType',
            label: '汇报类型',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatReportType,
            optList: () => {
              return this.reportTypeOptions
            }
          },
          {
            minWidth: '120',
            prop: 'processMode',
            label: '申请处理方式',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatProcessMode,
            optList: () => {
              return this.processModeOptions
            }
          },
          {
            minWidth: '120',
            prop: 'type',
            label: '种类',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatType,
            optList: () => {
              return this.typeOptions
            }
          },
          {
            minWidth: '120',
            prop: 'unqualifiedType',
            label: '不合格类别',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatUnqualifiedType,
            optList: () => {
              return this.unqualifiedTypeOptions
            }
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'unqualifiedDesc',
            label: '不合格处理描述',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          // 状态
          {
            minWidth: '120',
            prop: 'state',
            label: '状态',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            optList: () => {
              return this.getStateOptionList()
            },
            formatter: (row, column, cellValue) => {
              var formatVal
              if (cellValue == '01draft') {
                formatVal = '待审核'
              } else if (cellValue == '02pending') {
                formatVal = 'OA审核中'
              } else if (cellValue == '03accepted') {
                formatVal = '通过'
              } else if (cellValue == '04reject') {
                formatVal = '退回'
              } else {
                formatVal = '已执行'
              }
              return formatVal
            }
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'systemNo',
            label: '系统编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'lotBatchNo',
            label: '零件批号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'partNo',
            label: '零件编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'partDesc',
            label: '零件名称',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'unqualifiedArrived',
            label: '不合格数量',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'workstationName',
            label: '工作站名称',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'workstationNo',
            label: '工作站编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'productionUser',
            label: '生产人员',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'productionTime',
            label: '生产日期',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'datetimerange'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'testUser',
            label: '检验人员',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'operationName',
            label: '工序名称',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'workShop',
            label: '车间',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '80',
            minWidth: '80',
            prop: 'isQualified',
            label: '检测合格',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatBoolean,
            optList: () => {
              return this.booleanOptions
            }
          },
          {
            width: '80',
            minWidth: '80',
            prop: 'isUsed',
            label: '允许使用',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'select',
            formatter: this.formatBoolean,
            optList: () => {
              return this.booleanOptions
            }
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'remark',
            label: '备注',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'examineIdea',
            label: '评审意见',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'applyNo',
            label: '检测申请编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'reportNo',
            label: '检测汇报编号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'lossRegistration',
            label: '质量损失',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'examiner',
            label: '审批人',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '140',
            minWidth: '140',
            prop: 'examineTime',
            label: '审核时间',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'datetimerange'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'handler',
            label: '执行人',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '140',
            minWidth: '140',
            prop: 'handleTime',
            label: '执行时间',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'datetimerange'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'degradePartNo',
            label: '降级后零件号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '140',
            minWidth: '140',
            prop: 'degradePartName',
            label: '降级后零件名称',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'executeSn',
            label: '处理后缆号',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '100',
            minWidth: '100',
            prop: 'createUser',
            label: '创建人',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'text'
          },
          {
            width: '140',
            minWidth: '140',
            prop: 'createTime',
            label: '创建时间',
            sort: true,
            isTrue: true,
            isSearch: true,
            searchInfoType: 'datetimerange'
          }
        ],
        toolbar: [
          {
            text: '新增处理',
            type: 'primary',
            fun: this.addOrUpdateHandle
          },
          {
            text: '损失登记',
            type: 'primary',
            fun: this.openRegisterLoss
          },
          {
            text: '推送OA',
            type: 'primary',
            loading: false,
            fun: this.launchRfOaUnQualified
          },
          {
            text: '执行',
            type: 'primary',
            loading: false,
            fun: this.implementIfsUnQualified
          },
          {
            text: '审批',
            type: 'primary',
            loading: false,
            fun: this.examineApprove
          },
          {
            text: '零件降级功能',
            type: 'primary',
            loading: false,
            fun: this.partDegradation
          }
        ],
        operator: [
          {
            text: '删除',
            type: 'text',
            size: 'small',
            fun: this.deleteHandle
          }
        ],
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 60,
          minWidth: 60
        }
      },
      booleanOptions: [
        { value: true, label: '是' },
        { value: false, label: '否' }
      ],
      stateOptionList: [
        {
          value: '01draft',
          label: '待审核'
        },
        {
          value: '02pending',
          label: 'OA审核中'
        },
        {
          value: '03accepted',
          label: '通过'
        },
        {
          value: '04reject',
          label: '退回'
        },
        {
          value: '05executed',
          label: '已执行'
        }
      ],
      showRegisterLoss: false,
      showPart: false,
      causeTypeOptions: [],
      processModeOptions: [],
      typeOptions: [],
      unqualifiedTypeOptions: [],
      isusedSynsLoading: false,
      reportTypeOptions: []
    }
  },
  components: {
    unqualifiedProcessForm,
    registerLossForm,
    ttable,
    examineApproveForm,
    tableForm,
    PartDialog
  },
  computed: {
    ...mapGetters(['permissions', 'userInfo'])
  },
  created() {
    this.getCauseType()
    this.getProcessMode()
    this.getType()
    this.getUnqualifiedType()
    this.getReportTypeDict()
  },
  methods: {
    partDegradation() {
      if (this.multipleSelection.length > 0) {
        if (this.multipleSelection.length == 1) {
          this.showPart = true
        } else {
          this.$message.error('请选择一条数据进行零件降级功能!')
        }
      } else {
        this.$message.error('请选择需要零件降级的数据!')
      }
    },
    selectPart(part) {
      console.log(part)
      if (part) {
        partDegrade(this.multipleSelection[0].id, part.id).then((res) => {
          console.log(res)
          this.$message.success('零件降级成功!')
        })
      }
    },
    formatCauseType(row, column, cellValue) {
      this.causeTypeOptions.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getCauseType() {
      remote('unqualified_reason_type').then((response) => {
        if (response.data.code === 0) {
          this.causeTypeOptions = response.data.data
        }
      })
    },
    formatProcessMode(row, column, cellValue) {
      this.processModeOptions.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getProcessMode() {
      remote('unqualified_process_mode').then((response) => {
        if (response.data.code === 0) {
          this.processModeOptions = response.data.data
        }
      })
    },
    formatType(row, column, cellValue) {
      this.typeOptions.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getType() {
      remote('unqualified_handle_type').then((response) => {
        if (response.data.code === 0) {
          this.typeOptions = response.data.data
        }
      })
    },
    formatUnqualifiedType(row, column, cellValue) {
      this.unqualifiedTypeOptions.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getUnqualifiedType() {
      remote('unqualified_handle_category').then((response) => {
        if (response.data.code === 0) {
          this.unqualifiedTypeOptions = response.data.data
        }
      })
    },
    // 获取数据列表
    getData() {
      this.$refs.unqualifiedTable.getDataList()
    },
    // 新增 / 修改
    addOrUpdateHandle(row) {
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(row == null ? null : row.id)
      })
    },
    examineApprove() {
      if (this.multipleSelection.length > 0) {
        if (this.multipleSelection.length == 1) {
          this.addexamineVisible = true
          this.$nextTick(() => {
            this.$refs.addexamine.init(this.multipleSelection)
          })
        } else {
          this.$message.error('请选择一条数据进行审批!')
        }
      } else {
        this.$message.error('请选择需要审批的数据!')
      }
    },
    getStateOptionList() {
      return this.stateOptionList
    },
    // 删除
    deleteHandle(row) {
      if (row.state === '01draft' || row.state === '02pending') {
        this.$confirm('是否确认删除处理编号为:' + row.processNo, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          closeOnClickModal: false,
          type: 'warning'
        })
          .then(function() {
            return delUnqualifiedProcess(row.id)
          })
          .then((data) => {
            this.$message.success('删除成功')
            this.getData()
          })
      } else {
        this.$message.warning('该状态下,不可进行删除')
      }
    },
    handleCurrentChange(val) {
      this.currRow = val
    },
    // boolean列中文格式化
    formatBoolean(row, column, cellValue) {
      if (cellValue == true) {
        return '是'
      }
      if (cellValue == false) {
        return '否'
      } else {
        return ''
      }
    },
    // 允许使用并移库
    batchUpdateResultIsUsed() {
      if (this.multipleSelection.length > 0) {
        this.$confirm('是否标记允许使用并移库', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          closeOnClickModal: false,
          type: 'warning'
        })
          .then(() => {
            this.isusedSynsLoading = true
            const resultList = []
            /* this.multipleSelection.forEach((e) => {
              resultList.push(
                Object.assign({
                  isUsed: true,
                  systemNo: e.systemNo,
                  applyPartId: e.applyPartId
                })
              )
            }) */
            resultList.push(
              Object.assign({
                isUsed: true,
                systemNo: this.multipleSelection[0].systemNo,
                applyPartId: this.multipleSelection[0].applyPartId,
                id: this.multipleSelection[0].resultId
              })
            )
 
            batchUpdateResultBySystemNo(resultList)
              .then((data) => {
                this.isusedSynsLoading = false
                this.$message.success('标记成功')
                this.getData()
              })
              .catch(() => {
                this.isusedSynsLoading = false
              })
          })
          .catch(() => {})
      } else {
        this.$message.warning('请选择不合格零件')
      }
    },
    // for射频
    launchRfOaUnQualified() {
      if (this.multipleSelection.length > 0) {
        if (this.multipleSelection.length === 1) {
          const currSelect = this.multipleSelection[0]
          if (
            currSelect.state === '01draft' ||
            currSelect.state === '02pending'
          ) {
            this.table.toolbar[2].loading = true
 
            const idParam = { id: currSelect.id }
            rfOa(idParam)
              .then((response) => {
                const resData = response.data
                if (resData.code === 0) {
                  this.$message.success('推送OA成功')
                  this.getData()
                } else {
                  this.$message.error('推送OA失败')
                }
                this.table.toolbar[2].loading = false
              })
              .catch(() => {
                this.table.toolbar[2].loading = false
              })
          } else {
            this.$message.warning('该状态下,无法推送OA')
          }
        } else {
          this.$message.warning('只能选择一个不合格零件')
        }
      } else {
        this.$message.warning('请选择不合格零件')
      }
    },
    launchOaUnQualified() {
      if (this.multipleSelection.length > 0) {
        this.table.toolbar[3].loading = true
        launchOaUnQualified(this.multipleSelection[0].id)
          .then((response) => {
            const resData = response.data
            if (resData.code === 0) {
              this.$message.success('推送OA成功')
              this.getData()
            } else {
              this.$message.error('推送OA失败')
            }
            this.table.toolbar[3].loading = false
          })
          .catch(() => {
            this.table.toolbar[3].loading = false
          })
      } else {
        this.$message.warning('请选择不合格零件')
      }
    },
    // 执行
    implementIfsUnQualified() {
      if (this.multipleSelection.length > 0) {
        this.addtableVisible = true
        this.$nextTick(() => {
          this.$refs.addtable.init(this.multipleSelection)
        })
      } else {
        this.$message.error('请选择不合格零件')
      }
    },
    // 打开损失登记
    openRegisterLoss() {
      if (this.permissions.quality_loss_registration) {
        if (this.multipleSelection.length > 0) {
          this.showRegisterLoss = true
        } else {
          this.$message.error('请选择不合格零件')
        }
      } else {
        this.$message.error('没有权限进行损失登记操作!')
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 汇报类型中文格式化
    formatReportType(row, column, cellValue) {
      this.reportTypeOptions.forEach((obj) => {
        if (obj.value === cellValue) {
          cellValue = obj.label
        }
      })
      return cellValue
    },
    getReportTypeDict() {
      remote('apply_report_type').then((response) => {
        if (response.data.code === 0) {
          this.reportTypeOptions = response.data.data
        } else {
          this.reportTypeOptions = []
        }
      })
    }
  }
}
</script>