fix: memberUserIds render

pull/12/head
xingyu 2023-05-10 18:08:13 +08:00
parent 4754495f6a
commit 664e25ce66
1 changed files with 26 additions and 2 deletions

View File

@ -2,6 +2,15 @@ import { BasicColumn, FormSchema, useRender } from '@/components/Table'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { getListSimpleUsers } from '@/api/system/user'
let users: any[] = []
async function getUserList() {
const res = await getListSimpleUsers()
users = res
}
await getUserList()
export const columns: BasicColumn[] = [
{
title: '编号',
@ -22,8 +31,23 @@ export const columns: BasicColumn[] = [
title: '成员',
dataIndex: 'memberUserIds',
width: 180,
customRender: ({ text }) => {
return useRender.renderTags(text)
customRender: ({ record, 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)
}
}
},
{