fix(post): hide stale deleted user ids in post view dialog

Omit redundant field labels and exclude soft-deleted users from post bindings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-05 14:43:35 +08:00
1 parent a330903625
commit 19c6d06fa0
3 files changed
+42 -16

No files matched your search

@@ -112,7 +112,7 @@
class="view-kv"
:class="{ 'view-kv-span-2': field.span }"
>
<dt>{{ field.label }}</dt>
<dt v-if="field.label">{{ field.label }}</dt>
<dd>
<el-tag v-if="field.tagType" :type="field.tagType" size="small">{{
formatViewValue(field.value)
+10 -6
View File
@@ -493,13 +493,13 @@
if (viewBoundRoleNames.value.length > 0) {
sections.push({
title: '关联角色',
fields: [{ label: '已关联角色', value: viewBoundRoleNames.value.join('、'), span: true }]
fields: [{ label: '', value: viewBoundRoleNames.value.join('、'), span: true }]
})
}
if (viewBoundUserNames.value.length > 0) {
sections.push({
title: '关联用户',
fields: [{ label: '已关联用户', value: viewBoundUserNames.value.join('、'), span: true }]
fields: [{ label: '', value: viewBoundUserNames.value.join('、'), span: true }]
})
}
return sections
@@ -518,15 +518,19 @@
if (roleIds.length > 0) {
const roleListRes = await fetchRoleList({ page: 1, pageSize: 100 })
const idToName = new Map(
(roleListRes?.list || []).map((r: any) => [r.id, r.roleName || r.id])
(roleListRes?.list || []).map((r: any) => [r.id, r.roleName || ''])
)
viewBoundRoleNames.value = roleIds.map((id: string) => idToName.get(id) || id)
viewBoundRoleNames.value = roleIds
.map((id: string) => idToName.get(id) || '')
.filter((name: string) => Boolean(name))
}
const boundIds = boundRes?.userIds || []
if (boundIds.length === 0) return
const users = await fetchAllUsersForPostBind()
const idToName = new Map(users.map((u) => [u.id, u.nickName || u.userNo || u.id]))
viewBoundUserNames.value = boundIds.map((id: string) => idToName.get(id) || id)
const idToName = new Map(users.map((u) => [u.id, u.nickName || u.userNo || '']))
viewBoundUserNames.value = boundIds
.map((id: string) => idToName.get(id) || '')
.filter((name: string) => Boolean(name))
} catch (e) {
console.error('加载职位关联信息失败:', e)
}