fix(admin): 部门树首屏默认展开第一层,成员表居中消除集中空白
This commit is contained in:
1 parent
8e73031e42
commit
eb468d3c78
2 files changed
+13
-3
No files matched your search
@@ -440,15 +440,16 @@ onMounted(() => {
|
||||
width: 16rem;
|
||||
}
|
||||
.admin-dept-members__tablewrap {
|
||||
/* 宽度须与上方五列 width 之和(150+150+90+110+80)保持一致 */
|
||||
/* 宽度须与上方五列 width 之和(150+150+90+110+80)保持一致;居中使剩余空白均匀分两侧 */
|
||||
width: 580px;
|
||||
max-width: 100%;
|
||||
margin-inline: auto;
|
||||
}
|
||||
.admin-dept-members__footer {
|
||||
/* 与表格同宽对齐右缘 */
|
||||
/* 与表格同宽并同样居中,分页对齐表格右缘 */
|
||||
width: 580px;
|
||||
max-width: 100%;
|
||||
margin-left: 0;
|
||||
margin-inline: auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
@@ -67,6 +67,9 @@ export function useDepartmentsAdmin() {
|
||||
* 拉取部门树并写入 tree。
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
/** 是否已做过首屏默认展开(只做一次,之后尊重用户的展开/收起操作) */
|
||||
let expandSeeded = false;
|
||||
|
||||
const loadDepartments = async (): Promise<void> => {
|
||||
try {
|
||||
tree.value = (await listAdminDepartmentTree()) as AdminDepartmentTreeNode[];
|
||||
@@ -74,6 +77,12 @@ export function useDepartmentsAdmin() {
|
||||
console.error('Failed to load department tree', e);
|
||||
tree.value = [];
|
||||
}
|
||||
// 首屏默认展开公司组与第一层部门:树内容填满栏高(对齐 OA 展开到第一级的习惯)
|
||||
if (!expandSeeded && tree.value.length) {
|
||||
expandSeeded = true;
|
||||
expandedCompanies.value = new Set(tree.value.map((r) => r.company?.trim() || ''));
|
||||
expandedIds.value = new Set(tree.value.map((r) => r.id));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user