fix: dept leaderUser

This commit is contained in:
xingyu4j
2025-10-09 18:33:01 +08:00
parent d2f50c9388
commit 378cdd4c38
4 changed files with 14 additions and 38 deletions

View File

@@ -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 [
@@ -111,9 +113,7 @@ export function useFormSchema(): VbenFormSchema[] {
}
/** 列表的字段 */
export function useGridColumns(
getLeaderName?: (userId: number) => string | undefined,
): VxeTableGridOptions<SystemDeptApi.Dept>['columns'] {
export function useGridColumns(): VxeTableGridOptions<SystemDeptApi.Dept>['columns'] {
return [
{ type: 'checkbox', width: 40 },
{
@@ -128,7 +128,8 @@ export function useGridColumns(
field: 'leaderUserId',
title: '负责人',
minWidth: 150,
formatter: ({ cellValue }) => getLeaderName?.(cellValue) || '-',
formatter: ({ cellValue }) =>
userList.find((user) => user.id === cellValue)?.nickname || '-',
},
{
field: 'sort',