From 664e25ce66f344ca92bc95e49d1c01204c7d966e Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 10 May 2023 18:08:13 +0800 Subject: [PATCH] fix: memberUserIds render --- src/views/bpm/group/group.data.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/views/bpm/group/group.data.ts b/src/views/bpm/group/group.data.ts index 3fd47e62..f61f4e1c 100644 --- a/src/views/bpm/group/group.data.ts +++ b/src/views/bpm/group/group.data.ts @@ -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) + } } }, {