whiteStaffList.vue
3.72 KB
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
<!-- 适用人员列表(纯展示) -->
<template>
<div class="white-staff-list">
<baseDialog :config="footerConfig"
:dialog-config="dialogConfig"
:is-show.sync="visible">
<el-table border
:cell-style="bodyCellStyle"
class="staff-table"
:data="displayList"
:header-cell-style="headerCellStyle"
:max-height="tableMaxHeight">
<el-table-column align="center"
label="序号"
type="index"
width="72" />
<el-table-column align="center"
label="员工姓名"
min-width="120"
prop="staffName"
show-overflow-tooltip />
<el-table-column align="center"
label="手机号"
min-width="140"
prop="staffPhone"
show-overflow-tooltip />
</el-table>
</baseDialog>
</div>
</template>
<script>
/** 表头背景色 */
const HEADER_BG = "#F2F4F7";
/** 表格最大高度(px),超出后表体内部滚动、表头固定 */
const TABLE_MAX_HEIGHT = 420;
export default {
name: "WhiteStaffList",
props: {
staffListVisible: {
type: Boolean,
default: false,
},
/** 行数据字段:staffName、staffPhone(可按需扩展列) */
staffList: {
type: Array,
default: () => [],
},
},
data() {
return {
dialogConfig: {
title: "适用人员",
width: "720px",
},
footerConfig: {
isShowFooter: true,
hideConfirmBtn: true,
cancel_name: "关闭",
},
headerCellStyle: {
background: HEADER_BG,
},
tableMaxHeight: TABLE_MAX_HEIGHT,
};
},
computed: {
visible: {
get() {
return this.staffListVisible;
},
set(val) {
this.$emit("dialogClose", {
flag: val,
attrName: "staffListVisible",
});
},
},
displayList() {
return Array.isArray(this.staffList) ? this.staffList : [];
},
},
methods: {
bodyCellStyle() {
return {
color: "#333333",
fontSize: "14px",
};
},
},
};
</script>
<style scoped lang="scss">
.white-staff-list {
$table-border: #e5e5e5;
.staff-table {
width: 100%;
}
::v-deep .el-table--border,
::v-deep .el-table--border::after,
::v-deep .el-table--border::before {
border-color: $table-border;
}
::v-deep .el-table--border td,
::v-deep .el-table--border th {
border-color: $table-border;
}
/* 表头/表体单元格上下内边距 14px(覆盖 public.scss 等全局对 td 的 !important) */
::v-deep .staff-table.el-table thead th,
::v-deep .staff-table.el-table tbody td {
padding-top: 14px !important;
padding-bottom: 14px !important;
}
::v-deep .staff-table.el-table .cell {
color: #333333;
font-size: 14px;
font-weight: 400;
text-align: center;
}
/* 底部关闭按钮:靠右;样式见需求 */
::v-deep .dialog-footer {
align-items: center;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
padding: 14px 20px 14px;
}
::v-deep .dialog-footer .el-button {
background: #e8e8e8;
border: 1px solid #d1d1d1;
border-radius: 4px;
box-sizing: border-box;
color: #666666;
font-size: 14px;
font-weight: 400;
height: 32px;
line-height: 30px;
min-width: 64px !important;
opacity: 1;
padding: 0;
width: 64px;
}
::v-deep .dialog-footer .el-button:hover,
::v-deep .dialog-footer .el-button:focus {
background: #e0e0e0;
border-color: #d1d1d1;
color: #666666;
}
}
</style>