fix: dept leaderUserId #I6R4NH
parent
1b571bd403
commit
182c447ef8
|
@ -3,6 +3,15 @@ import { getListSimpleUsers } from '@/api/system/user'
|
||||||
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
|
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
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[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '部门名称',
|
title: '部门名称',
|
||||||
|
@ -12,8 +21,19 @@ export const columns: BasicColumn[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '负责人',
|
title: '负责人',
|
||||||
dataIndex: 'leader',
|
dataIndex: 'leaderUserId',
|
||||||
width: 120
|
width: 120,
|
||||||
|
customRender: ({ text }) => {
|
||||||
|
if (!text) {
|
||||||
|
return '未设置'
|
||||||
|
}
|
||||||
|
for (const user of userOptions) {
|
||||||
|
if (text === user.id) {
|
||||||
|
return user.nickname
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '未知【' + text + '】'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '排序',
|
title: '排序',
|
||||||
|
@ -94,7 +114,7 @@ export const formSchema: FormSchema[] = [
|
||||||
field: 'leaderUserId',
|
field: 'leaderUserId',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: () => getListSimpleUsers(),
|
options: () => getListSimpleUsers(),
|
||||||
labelField: 'nickname',
|
labelField: 'nickname',
|
||||||
valueField: 'id'
|
valueField: 'id'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue