diff --git a/apps/web-antd/src/views/system/dept/data.ts b/apps/web-antd/src/views/system/dept/data.ts index 457973942..eba3c4601 100644 --- a/apps/web-antd/src/views/system/dept/data.ts +++ b/apps/web-antd/src/views/system/dept/data.ts @@ -115,9 +115,7 @@ export function useSchema(): VbenFormSchema[] { { component: 'RadioGroup', componentProps: { - buttonStyle: 'solid', options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), - optionType: 'button', }, fieldName: 'status', label: '状态', @@ -127,6 +125,7 @@ export function useSchema(): VbenFormSchema[] { } /** 获取表格列配置 */ +const userList = await getSimpleUserList(); export function useColumns( onActionClick?: OnActionClickFn, ): VxeTableGridOptions['columns'] { @@ -139,11 +138,15 @@ export function useColumns( treeNode: true, minWidth: 150, }, - // TODO @芋艿:需要通过 userList 翻译 { - field: 'leader', + field: 'leaderUserId', title: '负责人', minWidth: 150, + formatter: (row) => { + return ( + userList.find((user) => user.id === row.cellValue)?.nickname || '-' + ); + }, }, { field: 'sort', diff --git a/apps/web-antd/src/views/system/dept/index.vue b/apps/web-antd/src/views/system/dept/index.vue index 92e1eda5f..756227d6e 100644 --- a/apps/web-antd/src/views/system/dept/index.vue +++ b/apps/web-antd/src/views/system/dept/index.vue @@ -5,6 +5,7 @@ import type { } from '#/adapter/vxe-table'; import type { SystemDeptApi } from '#/api/system/dept'; +import { ref } from 'vue'; import { $t } from '#/locales'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { deleteDept, getDeptList } from '#/api/system/dept'; @@ -92,6 +93,9 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, }, }, + rowConfig: { + keyField: 'id', + }, toolbarConfig: { custom: true, export: false, @@ -103,6 +107,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ rowField: 'id', transform: true, expandAll: true, + reserve: true, }, } as VxeTableGridOptions, }); @@ -111,8 +116,13 @@ const [Grid, gridApi] = useVbenVxeGrid({ function refreshGrid() { gridApi.query(); } -// TODO @芋艿:展开/折叠所有 -// TODO @芋艿:刷新后,就折叠起来了! + +/** 切换树形展开/收缩状态 */ +const isExpanded = ref(true); +function toggleExpand() { + isExpanded.value = !isExpanded.value; + gridApi.grid.setAllTreeExpand(isExpanded.value); +}