diff --git a/frontend/src/views/org-center/OrgCenter.vue b/frontend/src/views/org-center/OrgCenter.vue index f0e1cd8..4a321b8 100644 --- a/frontend/src/views/org-center/OrgCenter.vue +++ b/frontend/src/views/org-center/OrgCenter.vue @@ -21,7 +21,7 @@ 部门 新增部门 - + + +
@@ -64,7 +66,7 @@ 批量导入
- + + + @@ -321,6 +325,8 @@ import { } from '@/api/training' import { useAuthStore } from '@/stores/auth' import ResourceIcon from '@/components/icons/ResourceIcon.vue' +import TrainingPagination from '../training/components/TrainingPagination.vue' +import { useTrainingPager } from '../training/components/useTrainingPager' const authStore = useAuthStore() const loading = ref(false) @@ -518,9 +524,10 @@ const roleText = (r: string) => roleLabelOf(r, roleDict.value, true) const deptColumns = [ { colKey: 'name', title: '部门名称' }, - { colKey: 'code', title: '编码', width: 140 }, + // 000164:编码列收窄(0001 等短编码无需过宽列,原 140px 留白明显) + { colKey: 'code', title: '编码', width: 64 }, // 窄屏下列宽超出面板时操作列随滚动固定在右侧,保证可见可点 - { colKey: 'op', title: '操作', width: 140, fixed: 'right' }, + { colKey: 'op', title: '操作', width: 116, fixed: 'right' }, ] // 管理角色额外有「企微账号/设置角色」操作,操作列随之加宽(computed 随权限就绪刷新) @@ -597,6 +604,28 @@ watch(keyword, () => { searchTimer = setTimeout(() => loadEmployees(), 300) }) +// 共用分页(000164):部门/员工档案列表默认每页 15 条; +// 查找或增删改刷新列表后回到第 1 页 +const { + page: deptPage, + pageSize: deptPageSize, + total: deptTotal, + paged: pagedDepts, + reset: resetDeptPage, +} = useTrainingPager(depts) +const { + page: employeePage, + pageSize: employeePageSize, + total: employeeTotal, + paged: pagedEmployees, + reset: resetEmployeePage, +} = useTrainingPager(employees) + +watch([depts, employees], () => { + resetDeptPage() + resetEmployeePage() +}) + const loadAll = async () => { // 平台用户一并拉取,用于姓名兜底联查(user_id → 用户名)。 const [d, u] = await Promise.all([ @@ -824,16 +853,24 @@ onMounted(() => { padding: var(--app-space-3) 0 var(--app-space-6); } -// 3/7 分栏:部门列占 3,员工档案列占 7;窄屏退化为单列 +// 分栏:部门列收窄为固定宽度(000164,原 3fr 过宽且编码列留白明显), +// 员工档案占剩余全部宽度;窄屏退化为单列 .org-layout { display: grid; - grid-template-columns: 3fr 7fr; + grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; @media (max-width: 900px) { grid-template-columns: 1fr; } + + // 000164 栅格子项收敛:员工档案表格/工具行较宽,缺省 min-width 会把 + // 栅格轨道撑出视口,右侧列与操作按钮被裁掉不可见不可点; + // 收敛后表格在面板内横向滚动,操作列 fixed:right 始终可见 + > .panel-box { + min-width: 0; + } } .panel-box {