fix: memberUserIds render
parent
4754495f6a
commit
664e25ce66
|
@ -2,6 +2,15 @@ import { BasicColumn, FormSchema, useRender } from '@/components/Table'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import { getListSimpleUsers } from '@/api/system/user'
|
import { getListSimpleUsers } from '@/api/system/user'
|
||||||
|
|
||||||
|
let users: any[] = []
|
||||||
|
|
||||||
|
async function getUserList() {
|
||||||
|
const res = await getListSimpleUsers()
|
||||||
|
users = res
|
||||||
|
}
|
||||||
|
|
||||||
|
await getUserList()
|
||||||
|
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '编号',
|
title: '编号',
|
||||||
|
@ -22,8 +31,23 @@ export const columns: BasicColumn[] = [
|
||||||
title: '成员',
|
title: '成员',
|
||||||
dataIndex: 'memberUserIds',
|
dataIndex: 'memberUserIds',
|
||||||
width: 180,
|
width: 180,
|
||||||
customRender: ({ text }) => {
|
customRender: ({ record, text }) => {
|
||||||
return useRender.renderTags(text)
|
const names: any[] = []
|
||||||
|
if (text) {
|
||||||
|
for (const userId of record.memberUserIds) {
|
||||||
|
let isUser = false
|
||||||
|
users.forEach((user) => {
|
||||||
|
if (userId === user.id) {
|
||||||
|
names.push(user.nickname)
|
||||||
|
isUser = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!isUser) {
|
||||||
|
names.push('未知(' + userId + ')')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return useRender.renderTags(names)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue