fix(admin): 修复部门成员面板表头与分页器穿模并锁定列宽

This commit is contained in:
HTEWJ\26070045 committed 2026-10-22 09:30:09 +08:00
1 parent 194a51bc2d
commit 2cee02bec1
5 files changed
+55 -18

No files matched your search

@@ -27,7 +27,7 @@ import DepartmentFormModal from './components/DepartmentFormModal.vue';
import { useDepartmentsAdmin } from './composables/useDepartmentsAdmin';
import type { AdminDepartmentTreeNode } from '@/features/admin/types/admin.types';
const { t } = useI18n();
const { t, te } = useI18n();
const {
displayRows,
@@ -67,6 +67,13 @@ const {
setMemberPageSize,
} = useDepartmentsAdmin();
/** 成员状态 → 本地化标签;未知状态回退显示原值。 */
const statusLabel = (status?: string): string => {
if (!status) return '-';
const key = `admin.dept.members.status.${status}`;
return te(key) ? t(key) : status;
};
/** 成员面板总页数(由 total / page_size 推导)。 */
const memberTotalPages = computed(() => {
const data = memberData.value;
@@ -106,7 +113,7 @@ onMounted(() => {
<div class="flex flex-col lg:flex-row gap-4 items-start">
<!-- 左侧:组织树(公司虚拟分组 + 层级缩进) -->
<div class="w-full lg:w-[340px] shrink-0 rounded-2xl border border-subtle bg-surface flex flex-col gap-3 p-4 lg:max-h-[calc(100vh-230px)]">
<div class="w-full lg:w-[340px] shrink-0 rounded-2xl border border-subtle bg-surface flex flex-col gap-3 p-4 lg:max-h-[calc(100vh-230px)] overflow-hidden">
<div class="flex items-center gap-2">
<div class="relative flex-1 min-w-0">
<Search class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted pointer-events-none" />
@@ -131,7 +138,7 @@ onMounted(() => {
><ChevronDown class="w-4 h-4" /></button>
</div>
<div class="overflow-y-auto -mx-1 px-1 space-y-0.5">
<div class="overflow-y-auto min-h-0 -mx-1 px-1 space-y-0.5">
<div v-if="displayRows.length === 0" class="py-12 text-center text-sm text-muted">
{{ searchQuery.trim() ? t('admin.dept.noSearchResults') : t('admin.dept.noDepts') }}
</div>
@@ -215,7 +222,7 @@ onMounted(() => {
</div>
<!-- 右侧:选中部门的成员面板(OA 口径) -->
<div class="flex-1 min-w-0 w-full rounded-2xl border border-subtle bg-surface flex flex-col lg:max-h-[calc(100vh-230px)]">
<div class="flex-1 min-w-0 w-full rounded-2xl border border-subtle bg-surface flex flex-col lg:max-h-[calc(100vh-230px)] overflow-hidden">
<template v-if="!selectedDept">
<div class="flex-1 flex flex-col items-center justify-center py-24 text-muted">
<Users class="w-10 h-10 mb-3 opacity-50" />
@@ -254,9 +261,16 @@ onMounted(() => {
</div>
</div>
<div class="flex-1 overflow-y-auto">
<table class="w-full text-sm">
<thead class="text-xs text-muted bg-subtle/50 sticky top-0">
<div class="min-h-0 flex-1 overflow-y-auto">
<table class="w-full table-fixed text-sm">
<colgroup>
<col class="w-[24%]" />
<col class="w-[26%]" />
<col class="w-[16%]" />
<col class="w-[18%]" />
<col class="w-[16%]" />
</colgroup>
<thead class="text-xs text-muted sticky top-0 z-10 admin-table-sticky-head">
<tr>
<th class="px-5 py-3 text-left font-medium">{{ t('admin.dept.members.columns.name') }}</th>
<th class="px-5 py-3 text-left font-medium">{{ t('admin.dept.members.columns.contact') }}</th>
@@ -281,10 +295,10 @@ onMounted(() => {
<div class="text-xs text-muted truncate">{{ member.username }}</div>
</td>
<td class="px-5 py-3 text-muted truncate">{{ member.phone_number || member.email || '-' }}</td>
<td class="px-5 py-3 text-muted font-mono whitespace-nowrap">{{ member.employee_id || '-' }}</td>
<td class="px-5 py-3 text-muted font-mono truncate">{{ member.employee_id || '-' }}</td>
<td class="px-5 py-3 text-muted truncate">{{ member.department || '-' }}</td>
<td class="px-5 py-3">
<span class="inline-flex px-2 py-0.5 rounded-full text-xs bg-blue-50 text-blue-600 whitespace-nowrap">{{ member.status || '-' }}</span>
<span class="inline-flex px-2 py-0.5 rounded-full text-xs bg-blue-50 text-blue-600 whitespace-nowrap">{{ statusLabel(member.status) }}</span>
</td>
</tr>
</template>
@@ -295,15 +309,18 @@ onMounted(() => {
<footer v-if="memberData" class="px-5 py-3 border-t border-subtle flex items-center justify-between gap-3 flex-wrap text-sm text-muted">
<span>{{ t('admin.dept.members.total', { total: memberData.total }) }}</span>
<div class="flex items-center gap-2">
<select
:value="memberPageSize"
class="admin-table-filter-input py-1.5 px-2"
@change="setMemberPageSize(Number(($event.target as HTMLSelectElement).value))"
>
<option :value="20">20</option>
<option :value="50">50</option>
<option :value="100">100</option>
</select>
<div class="relative">
<select
:value="memberPageSize"
class="admin-table-filter-input py-1.5 pl-3 pr-8 appearance-none"
@change="setMemberPageSize(Number(($event.target as HTMLSelectElement).value))"
>
<option :value="20">20</option>
<option :value="50">50</option>
<option :value="100">100</option>
</select>
<ChevronDown class="w-4 h-4 text-muted absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none" />
</div>
<button
type="button"
class="p-1.5 rounded-lg hover:bg-subtle disabled:opacity-40 disabled:pointer-events-none"
+5
View File
@@ -1278,6 +1278,11 @@
"employeeId": "Employee ID",
"department": "Department",
"status": "Status"
},
"status": {
"active": "Active",
"pending": "Pending",
"rejected": "Rejected"
}
},
"tags": { "hidden": "Hidden" },
+5
View File
@@ -1299,6 +1299,11 @@
"employeeId": "รหัสพนักงาน",
"department": "แผนก",
"status": "สถานะ"
},
"status": {
"active": "ใช้งาน",
"pending": "รออนุมัติ",
"rejected": "ปฏิเสธ"
}
}
},
+5
View File
@@ -1406,6 +1406,11 @@
"employeeId": "工号",
"department": "部门",
"status": "状态"
},
"status": {
"active": "启用",
"pending": "待审核",
"rejected": "已拒绝"
}
},
"tags": { "hidden": "已隐藏" },
+5
View File
@@ -1299,6 +1299,11 @@
"employeeId": "工號",
"department": "部門",
"status": "狀態"
},
"status": {
"active": "啟用",
"pending": "待審核",
"rejected": "已拒絕"
}
}
},