diff --git a/apps/web-antd/src/views/system/dept/data.ts b/apps/web-antd/src/views/system/dept/data.ts index 4a995e666..2496f276b 100644 --- a/apps/web-antd/src/views/system/dept/data.ts +++ b/apps/web-antd/src/views/system/dept/data.ts @@ -10,6 +10,8 @@ import { z } from '#/adapter/form'; import { getDeptList } from '#/api/system/dept'; import { getSimpleUserList } from '#/api/system/user'; +const userList = await getSimpleUserList(); + /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -109,9 +111,7 @@ export function useFormSchema(): VbenFormSchema[] { } /** 列表的字段 */ -export function useGridColumns( - getLeaderName?: (userId: number) => string | undefined, -): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { @@ -126,7 +126,8 @@ export function useGridColumns( field: 'leaderUserId', title: '负责人', minWidth: 150, - formatter: ({ cellValue }) => getLeaderName?.(cellValue) || '-', + formatter: ({ cellValue }) => + userList.find((user) => user.id === 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 eb8c552a2..e85b290c2 100644 --- a/apps/web-antd/src/views/system/dept/index.vue +++ b/apps/web-antd/src/views/system/dept/index.vue @@ -1,9 +1,8 @@