fix: dept leaderUserId #I6R4NH

pull/4/MERGE
xingyu 2023-03-28 22:43:10 +08:00
parent 1b571bd403
commit 182c447ef8
1 changed files with 23 additions and 3 deletions

View File

@ -3,6 +3,15 @@ import { getListSimpleUsers } from '@/api/system/user'
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
let userOptions: any[] = []
async function getUserList() {
const res = await getListSimpleUsers()
userOptions = res
}
await getUserList()
export const columns: BasicColumn[] = [
{
title: '部门名称',
@ -12,8 +21,19 @@ export const columns: BasicColumn[] = [
},
{
title: '负责人',
dataIndex: 'leader',
width: 120
dataIndex: 'leaderUserId',
width: 120,
customRender: ({ text }) => {
if (!text) {
return '未设置'
}
for (const user of userOptions) {
if (text === user.id) {
return user.nickname
}
}
return '未知【' + text + '】'
}
},
{
title: '排序',
@ -94,7 +114,7 @@ export const formSchema: FormSchema[] = [
field: 'leaderUserId',
component: 'ApiSelect',
componentProps: {
api: () => getListSimpleUsers(),
options: () => getListSimpleUsers(),
labelField: 'nickname',
valueField: 'id'
}