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
| <!-- 表格组件封装 -->
| <template>
| <el-table
| :data="currentList"
| style="width: 1158px"
| :header-cell-style="{
| background: '#f3f6fb',
| color: '#666',
| height: '42px',
| 'font-weight': 400,
| }"
| :highlight-current-row="true"
| empty-text="暂无数据"
| >
| <el-table-column type="index" :index="indexMethod" label="序号" width="80">
| </el-table-column>
| <el-table-column
| v-for="(item, index) in tableLabel"
| :key="index"
| :prop="item.prop"
| :width="item.width"
| :label="item.label"
| :formatter="formatData"
| >
| </el-table-column>
| <el-table-column label="操作" width="100">
| <template slot-scope="scope">
| <el-button type="text" @click.native="$emit('details', scope.row)"
| >查看详情</el-button
| >
| </template>
| </el-table-column>
| </el-table>
| </template>
|
| <script>
| import dayjs from "dayjs";
| export default {
| data() {
| return {};
| },
| props: {
| currentList: {
| type: Array,
| required: true,
| },
| tableLabel: {
| type: Array,
| default: () => [],
| },
| currentIndex: {
| type: Number,
| required: true,
| },
| },
| created() {},
|
| methods: {
| indexMethod(index) {
| return parseInt(this.currentIndex) - 9 + index;
| },
| // 数据过滤
| formatData(row, column, cellValue) {
| if (column.property === "createType") {
| if (cellValue === 1) {
| return "自动";
| }
| return "手动";
| }
| if (column.property === "createTime") {
| return dayjs(cellValue).format("YYYY.MM.DD HH:mm:ss");
| }
| return cellValue;
| },
| },
| };
| </script>
|
| <style lang="scss">
| .el-table td,
| .el-table th.is-leaf {
| border-bottom: unset;
| }
| .el-table td,
| .el-table th {
| padding: 5px 0;
| }
| .el-table thead {
| font-weight: 400;
| color: #666;
| }
| .dialog-footer {
| width: 100%;
| padding: 10px 20px 20px;
| text-align: center !important;
| -webkit-box-sizing: border-box;
| box-sizing: border-box;
| }
| </style>
|
|
|