This commit is contained in:
guochunsi
2026-01-08 19:00:25 +08:00
parent 8a1faabd70
commit 98fcd368f9
45 changed files with 1818 additions and 2354 deletions

View File

@@ -5,7 +5,7 @@
:label="label"
v-bind="$attrs"
>
<template v-for="(_, name) in $slots" :key="name" #[name]="slotProps">
<template v-for="(_, name) in $slots" #[name]="slotProps">
<slot :name="name" v-bind="slotProps" />
</template>
</el-table-column>
@@ -31,35 +31,13 @@ const isColumnVisible = inject<(propOrLabel: string) => boolean>('isColumnVisibl
// 计算是否应该显示该列
const shouldShow = computed(() => {
// 优先使用 prop如果没有 prop 则使用 label
let key = props.prop || props.label || ''
const key = props.prop || props.label || ''
if (!key) {
// 如果没有 prop 和 label默认显示可能是序号列等特殊列
return true
}
// 如果 key 是 label尝试通过 labelToPropMap 映射到 prop
// 这样可以确保与 useTableColumns 的提取逻辑一致
if (!props.prop && props.label) {
const labelToPropMap: Record<string, string> = {
'是否退休': 'tied',
'姓名/工号': 'nameNo',
'性别': 'sex',
'部门': 'deptName',
'学历学位': 'dgreeName',
'职称等级': 'professionalTitle',
'岗位级别': 'stationLevelName',
'职业资格等级': 'levelName',
'职业资格工种': 'workName',
'用工性质': 'employmentNatureName',
'手机': 'telPhone',
'家庭住址': 'homeAddress',
'授课类型': 'teacherCate',
'操作': 'action',
}
// 如果 label 在映射表中,使用映射后的 prop否则使用 label
key = labelToPropMap[props.label] || props.label
}
// isColumnVisible 函数会同时匹配 prop 和 label所以直接传递即可
return isColumnVisible(key)
})
</script>