whiteStaffList.vue 3.72 KB
<!-- 适用人员列表(纯展示) -->
<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>