liding
2025-04-30 4ae5681e4a92c1cc98e811135098c71958c48a02
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
<template>
  <div class="app-container">
    <div class="search">
      <el-form :model="entity" ref="entity" size="small" :inline="true">
        <el-form-item label="产品型号" prop="productType" v-if="tabIndex === 0">
          <el-input v-model="entity.productType" clearable placeholder="请输入" size="small"
            @keyup.enter.native="goSearch($event)">
          </el-input>
        </el-form-item>
        <el-form-item label="原辅材名称" prop="entrustCode" v-if="tabIndex === 1">
          <el-input v-model="entity.entrustCode" clearable placeholder="请输入" size="small"
            @keyup.enter.native="goSearch($event)">
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" @click="goSearch()">查询</el-button>
          <el-button size="mini" @click="refresh()">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table">
      <div class="table-tab">
        <div>
          <ul class="tab">
            <li :class="{ active: tabIndex === 0 }" @click="handleTab(0)">成品</li>
            <li :class="{ active: tabIndex === 1 }" @click="handleTab(1)">原辅材</li>
          </ul>
        </div>
        <div>
          <el-button size="small" type="primary" @click="openAddDia('add')">新增</el-button>
        </div>
      </div>
      <!--成品-->
      <div class="table">
        <lims-table :tableData="tableData" :column="column" v-if="tabIndex === 0" @pagination="pagination"
          ref="tableData" :height="'calc(100vh - 290px)'" key="tableData" :page="page"
          :tableLoading="tableLoading"></lims-table>
      </div>
      <!--原辅材-->
      <div class="table">
        <lims-table :tableData="tableData1" :column="column1" v-if="tabIndex === 1" :isSelection="true"
          @pagination="pagination1" :height="'calc(100vh - 290px)'" key="tableData1" :page="page1"
          :tableLoading="tableLoading1"></lims-table>
      </div>
    </div>
    <el-dialog :visible.sync="proPlanDia" title="成品计划">
      <el-form :model="proPlanForm" ref="proPlanForm" :rules="proPlanRules" label-width="80px" size="small">
        <el-form-item label="产品名称" prop="productName">
          <el-cascader v-model="proPlanForm.productName" :options="itemParameterData.cascaderField.sample.tree"
            :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }"
            :show-all-levels="false" clearable filterable placeholder="请选择产品名称" size="small" style="width: 100%;"
            :disabled="operationType === 'review' || operationType === 'submit'" @change="handleProductNameChange">
          </el-cascader>
        </el-form-item>
        <el-form-item label="产品型号" prop="productType">
          <el-select v-model="proPlanForm.productType" clearable filterable placeholder="请选择产品型号"
            :disabled="operationType === 'review' || !proPlanForm.productName || operationType === 'submit'"
            style="width: 100%;">
            <el-option v-for="item in typeOption" :key="item.id" :label="item.modelName" :value="item.modelName">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="零件号" prop="partNo">
          <el-select v-model="proPlanForm.partNo" placeholder="请选择" clearable filterable
            :disabled="operationType === 'review' || !proPlanForm.productName || operationType === 'submit'"
            style="width: 100%;">
            <el-option v-for="item in partNoOption" :key="item.id" :label="item.partNo" :value="item.partNo">
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="审核人" prop="reviewerId">
          <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;"
            :disabled="operationType === 'review'">
            <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="foot">
        <el-button v-if="operationType !== 'review'" @click="closeProDia">取 消</el-button>
        <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
          :loading="submitProLoading" @click="submitProForm(0)">保
          存</el-button>
        <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
          @click="submitProForm(1)">提 交</el-button>
        <el-button v-if="operationType === 'review'" :loading="submitProLoading"
          @click="submitProForm(3)">不通过</el-button>
        <el-button v-if="operationType === 'review'" type="primary" :loading="submitProLoading"
          @click="submitProForm(2)">通过</el-button>
        <el-button v-if="operationType === 'review'" type="primary" :loading="submitMatLoading"
          @click="submitProForm(0)">变 更</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="materialDia" title="原辅材计划">
      <el-form :model="materialForm" ref="materialForm" :rules="materialRules" label-width="90px" size="small">
        <el-form-item label="原辅材名称" prop="materialName">
          <el-cascader v-model="materialForm.materialName" :options="itemParameterData.cascaderField.sample.tree"
            :props="{ value: 'name', label: 'name', checkStrictly: false, multiple: false, emitPath: false }"
            :show-all-levels="false" clearable filterable placeholder="请选择原辅材名称" size="small" style="width: 100%;"
            :disabled="operationType === 'review' || operationType === 'submit'" @change="handleMaterialNameChange">
          </el-cascader>
        </el-form-item>
        <el-form-item label="零件号" prop="partNo">
          <el-select v-model="materialForm.partNo" placeholder="请选择" clearable filterable
            :disabled="operationType === 'review' || !materialForm.materialName || operationType === 'submit'"
            style="width: 100%;">
            <el-option v-for="item in materialPartNoOption" :key="item.id" :label="item.partNo" :value="item.partNo">
            </el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="审核人" prop="reviewerId">
          <el-select v-model="proPlanForm.reviewerId" clearable filterable size="small" style="width: 50%;"
            :disabled="operationType === 'review'">
            <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
            </el-option>
          </el-select>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="foot">
        <el-button v-if="operationType !== 'review'" @click="closeMaterialRulesDia">取
          消</el-button>
        <el-button v-if="operationType !== 'review' && operationType !== 'submit'" type="primary"
          :loading="submitMatLoading" @click="submitMaterialRulesForm(0)">保 存</el-button>
        <el-button v-if="operationType == 'submit'" type="primary" :loading="submitProLoading"
          @click="submitMaterialRulesForm(1)">提 交</el-button>
        <el-button v-if="operationType === 'review'" :loading="submitMatLoading"
          @click="submitMaterialRulesForm(3)">不通过</el-button>
        <el-button v-if="operationType === 'review'" type="primary" :loading="submitMatLoading"
          @click="submitMaterialRulesForm(2)">通 过</el-button>
        <el-button v-if="operationType === 'review'" type="primary" :loading="submitMatLoading"
          @click="submitMaterialRulesForm(0)">变 更</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import limsTable from "@/components/Table/lims-table.vue";
import {
  addOrUpdateMaterial,
  addOrUpdateProduct, delMaterial,
  delProduct,
  selectMaterial,
  selectProduct
} from "@/api/business/reliabilityPlan";
import { selectUserCondition } from "@/api/system/user";
import { deleteAuxiliaryWorkingHours } from "@/api/performance/manHour";
import { getItemTreeProduct, getProductTypes, getPartNoList } from "@/api/structural/capability";
 
export default {
  name: '',
  // import 引入的组件需要注入到对象中才能使用
  components: { limsTable },
  data() {
    // 这里存放数据
    return {
      entity: {
        productType: null,
        entrustCode: null,
      },
      tabIndex: 0,
      // 成品table数据
      tableData: [],
      typeOption: [],
      partNoOption: [], // 添加产品型号选项数据
      materialPartNoOption:[],
      tableLoading: false,
      itemParameterData: {
        cascaderField: {
          sample: {
            tree: []
          },
        }
      },
      column: [
        { label: '产品型号', prop: 'productType' },
        { label: '产品名称', prop: 'productName' },
        { label: '零件号', prop: 'partNo' },
        {
          dataType: 'tag',
          label: '审核状态',
          prop: 'state',
          formatData: (params) => {
            if (params == 0 || !params) {
              return '待提交'
            } else if (params == 1) {
              return '待审核'
            } else if (params == 2) {
              return '通过'
            } else if (params == 3) {
              return '不通过'
            }
          },
          formatType: (params) => {
            if (params == 0 || !params) {
              return 'warning'
            } else if (params == 1) {
              return 'danger'
            } else if (params == 2) {
              return 'success'
            } else if (params == 3) {
              return 'danger'
            }
          }
        },
        {
          dataType: 'action',
          label: '操作',
          fixed: 'right',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('edit', row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
            {
              name: '计划',
              type: 'text',
              clickFun: (row) => {
                this.$router.push({
                  path: "/reliabilityPlan/plan", query: {
                    id: row.id,
                    type: '成品',
                    state: row.state
                  }
                });
              },
            },
            {
              name: '提交',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('submit', row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
            {
              name: '审核',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('review', row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDelete(row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
          ]
        }
      ],
      page: {
        total: 0,
        size: 20,
        current: 1
      },
      //
      // 原辅材table数据
      tableData1: [],
      tableLoading1: false,
      column1: [
        { label: '原辅材名称', prop: 'materialName' },
        { label: '零件号', prop: 'partNo' },
        {
          dataType: 'tag',
          label: '审核状态',
          prop: 'state',
          formatData: (params) => {
            if (params == 0 || !params) {
              return '待提交'
            } else if (params == 1) {
              return '待审核'
            } else if (params == 2) {
              return '通过'
            } else if (params == 3) {
              return '不通过'
            }
          },
          formatType: (params) => {
            if (params == 0 || !params) {
              return 'warning'
            } else if (params == 1) {
              return 'danger'
            } else if (params == 2) {
              return 'success'
            } else if (params == 3) {
              return 'danger'
            }
          }
        },
        {
          dataType: 'action',
          fixed: 'right',
          label: '操作',
          operation: [
            {
              name: '编辑',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('edit', row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
            {
              name: '计划',
              type: 'text',
              clickFun: (row) => {
                this.$router.push({
                  path: "/reliabilityPlan/plan", query: {
                    id: row.id,
                    type: '原辅材',
                    state: row.state
                  }
                });
              },
            },
            {
              name: '提交',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('submit', row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
            {
              name: '审核',
              type: 'text',
              clickFun: (row) => {
                this.openAddDia('review', row);
              },
            },
            {
              name: "删除",
              type: "text",
              clickFun: (row) => {
                this.handleDeleteM(row);
              },
              disabled: (row) => {
                return row.state > 0
              },
            },
          ]
        }
      ],
      page1: {
        total: 0,
        size: 20,
        current: 1
      },
      proPlanDia: false,
      responsibleOptions: [],
      proPlanForm: {
        id: '',
        productName: '',
        productType: '',
        partNo: '',
      },
      proPlanRules: {
 
      },
      submitProLoading: false,
      operationType: '',
      materialDia: false,
      materialForm: {
        id: '',
        materialName: '',
        partNo: '',
        state: '',
      },
      materialRules: {},
      submitMatLoading: false,
    };
  },
  mounted() {
    this.goSearch()
    this.selectTestObjectByName()
    this.getTypeOptions()
    this.getPartNoOptions()
  },
  // 方法集合
  methods: {
    // 点击查询回调
    goSearch(event) {
      if (event && typeof event.preventDefault === 'function') {
        event.preventDefault(); // 阻止默认行为
      }
      this.page.current = 1
      this.page1.current = 1
      this.refreshTable()
    },
    // 切换下单tab表格
    handleTab(m) {
      this.tabIndex = m;
      this.refreshTable()
      this.selectTestObjectByName() // 添加这行,切换tab时重新获取树形数据
    },
    pagination(page) {
      this.page.size = page.limit
      this.refreshTable()
    },
    pagination1(page) {
      this.page1.size = page.limit
      this.refreshTable()
    },
    // 查询回调
    refreshTable() {
      if (this.tabIndex === 0) {
        // 成品查询
        this.getProductOrderList()
      } else if (this.tabIndex === 1) {
        // 原辅材查询
        this.getMaterialOrderList()
      }
    },
    getProductOrderList() {
      this.tableLoading = true
      selectProduct({ ...this.entity, ...this.page }).then(response => {
        this.tableLoading = false
        this.tableData = response.data.records
      }).catch(error => {
        this.tableLoading = false
      })
    },
    getMaterialOrderList() {
      this.tableLoading1 = true
      selectMaterial({ ...this.entity, ...this.page }).then(response => {
        this.tableLoading1 = false
        this.tableData1 = response.data.records
      }).catch(err => {
        this.tableLoading1 = false
      })
    },
    // 重 置
    refresh() {
      this.resetForm('entity')
      this.refreshTable()
    },
    // 打开新增弹框
    openAddDia(type, row) {
      this.operationType = type
      if (this.tabIndex === 0) {
        this.proPlanDia = true
        if (this.operationType === 'add') {
          this.proPlanForm = {
            id: '',
            productName: '',
            productType: '',
            partNo: '',
            reviewerId: ''
          }
        } else {
          this.proPlanForm = { ...row }
          // 编辑时获取选中节点的ID并加载相关数据
          const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.productName)
          if (selectedNode) {
            this.getTypeOptions(selectedNode.id)
            this.getPartNoOptions(selectedNode.id)
          }
        }
      } else {
        this.materialDia = true
          if (this.operationType === 'add') {
            this.materialForm = {
              id: '',
              materialName: '',
              partNo: '',
              state: '',
              reviewerId: ''
            }
          } else {
            this.materialForm = { ...row }
            // 编辑时获取选中节点的ID并加载相关数据
            const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, row.materialName)
            if (selectedNode) {
              this.getMaterialPartNoOptions(selectedNode.id)
            }
          }
      }
    },
 
    //原辅材零件号选择
    handleMaterialNameChange(value) {
        if (value) {
          const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, value)
          if (selectedNode) {
            this.getMaterialPartNoOptions(selectedNode.id)
          }
        } else {
          this.materialPartNoOption = []
          this.materialForm.partNo = ''
        }
      },
 
      // 获取原辅材零件号列表
      getMaterialPartNoOptions(materialId) {
        if (!materialId) {
          this.materialPartNoOption = []
          return
        }
        getPartNoList({ productId: materialId }).then(res => {
          if (res.code === 200) {
            this.materialPartNoOption = res.data || []
            if (this.materialPartNoOption.length === 0) {
              this.materialForm.partNo = ''
            }
          }
        }).catch(() => {
          this.materialPartNoOption = []
          this.materialForm.partNo = ''
        })
      },
    // 成品信息提交
    submitProForm(state) {
      this.submitProLoading = true
      // 获取选中节点的ID
      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.proPlanForm.productName)
      const params = {
        ...this.proPlanForm,
        state: state === undefined ? null : parseInt(state),
        productId: selectedNode?.id,
        itemType: ['成品', '原辅材'][this.tabIndex] // 0成品1原辅材
      }
 
      addOrUpdateProduct(params).then(res => {
        if (res.code === 200) {
          this.closeProDia()
          this.$message.success('操作成功')
          this.goSearch()
        }
        this.submitProLoading = false
      }).catch(err => {
        console.log(err)
        this.submitProLoading = false
      })
    },
    // 关闭成品信息弹框
    closeProDia() {
      this.resetForm('proPlanDia')
      this.proPlanDia = false
    },
    // 原辅材信息提交
    submitMaterialRulesForm(state) {
      this.submitMatLoading = true
      // 获取选中节点的ID
      const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, this.materialForm.materialName)
      const params = {
        ...this.materialForm,
        state: state === undefined ? null : parseInt(state),
        materialId: selectedNode?.id
      }
      addOrUpdateMaterial(params).then(res => {
        if (res.code === 200) {
          this.closeMaterialRulesDia()
          this.$message.success('操作成功')
          this.goSearch()
        }
        this.submitMatLoading = false
      }).catch(err => {
        console.log(err)
        this.submitMatLoading = false
      })
    },
    // 关闭原辅材信息弹框
    closeMaterialRulesDia() {
      this.resetForm('materialForm')
      this.materialDia = false
    },
    handleDelete(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        delProduct({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.$message.success("删除成功");
            this.goSearch();
          }
        });
      }).catch(() => {
 
      });
    },
    handleDeleteM(row) {
      this.$confirm("是否删除该条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        delMaterial({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.$message.success("删除成功");
            this.goSearch();
          }
        });
      }).catch(() => {
 
      });
    },
    selectTestObjectByName() {
      getItemTreeProduct({ objectType: this.tabIndex === 0 ? '成品' : '原辅材' }).then(res => {
        if (res.data && res.data.length > 0) {
          res.data.forEach(a => {
            this.cascaderFieldData(a)
          })
          this.itemParameterData.cascaderField.sample.tree = res.data
        }
      }).catch(err => {
        console.error('获取数据失败:', err)
      })
    },
    cascaderFieldData(val) {
      if (val.children === undefined) {
        return
      } else if (val.children.length == 0) {
        val.label = val.name
        val.value = val.id
        delete val.children
      } else {
        val.label = val.name
        val.value = val.id
        val.children.forEach(a => {
          a.label = a.name
          a.value = a.id
          this.cascaderFieldData(a)
        })
      }
    },
 
    handleProductNameChange(value) {
      if (value) {
        const selectedNode = this.findNodeById(this.itemParameterData.cascaderField.sample.tree, value)
        if (selectedNode) {
          this.getTypeOptions(selectedNode.id)
          this.getPartNoOptions(selectedNode.id)
        }
      } else {
        this.typeOption = []
        this.partNoOption = []
        this.proPlanForm.productType = ''
        this.proPlanForm.partNo = ''
      }
    },
 
    findNodeById(tree, name) {
      for (let node of tree) {
        if (node.name === name) {
          return node
        }
        if (node.children) {
          const found = this.findNodeById(node.children, name)
          if (found) return found
        }
      }
      return null
    },
    // 获取产品型号选项
    getTypeOptions(productId) {
      if (!productId) {
        this.typeOption = []
        return
      }
      getProductTypes({ productId }).then(res => {
        if (res.code === 200) {
          this.typeOption = res.data || [] // 确保数据为空时设置为空数组
          if (this.typeOption.length === 0) {
            this.proPlanForm.productType = '' // 清空已选择的产品型号
          }
        }
      }).catch(() => {
        this.typeOption = []
        this.proPlanForm.productType = ''
      })
    },
 
    // 获取零件号列表的方法
    getPartNoOptions(productId) {
      if (!productId) {
        this.partNoOption = []
        return
      }
      getPartNoList({ productId }).then(res => {
        console.log('零件号数据:', res.data)
        if (res.code === 200) {
          this.partNoOption = res.data || []
          if (this.partNoOption.length === 0) {
            this.proPlanForm.partNo = ''
          }
        }
      }).catch(() => {
        this.partNoOption = []
        this.proPlanForm.partNo = ''
      })
    },
    // 获取负责人信息接口
    getUserList() {
      selectUserCondition().then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      });
    }
  }
};
</script>
 
<style scoped>
.table-tab {
  display: flex;
  justify-content: space-between;
}
 
.tab {
  list-style-type: none;
  display: flex;
  margin-bottom: 12px;
  margin-top: 0;
  padding-left: 0;
}
 
.tab li {
  line-height: 24px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333333;
  border: 1px solid #EEEEEE;
  cursor: pointer;
}
 
.tab li:nth-child(1) {
  border-radius: 8px 0 0 8px;
}
 
.tab li:nth-child(2) {
  border-radius: 0 8px 8px 0;
}
 
.tab li.active {
  border-color: #3A7BFA;
  color: #3A7BFA;
}
</style>