Skip to content

feat: 多租户改造 --story=134410224 --story=134223137#741

Merged
luofann merged 3 commits into
TencentBlueKing:dev_multi_tenantfrom
Mianhuatang8:dev_decision_display
May 20, 2026
Merged

feat: 多租户改造 --story=134410224 --story=134223137#741
luofann merged 3 commits into
TencentBlueKing:dev_multi_tenantfrom
Mianhuatang8:dev_decision_display

Conversation

@Mianhuatang8

Copy link
Copy Markdown
Collaborator

Reviewed, transaction id: 80570

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review 总结

本 PR 为多租户改造,主要变更:

  1. 升级 @blueking/bk-user-selector 到 0.1.8
  2. system/updateSpaceConfig store action 中统一注入 tenant_id
  3. 修复 props.rowrow 的 slot-scope 引用问题(Credential / DecisionTable)
  4. 新增 convertSuperusersDisplayName 方法将超级管理员 ID 转为显示名

主要问题

  • 🚨 convertSuperusersDisplayName 直接修改了 json_value,将 user ID 替换为 display name。当用户点击“编辑”时,handleEdit 读取的 json_value 已是 display name 而非原始 ID,提交后会将 display name 写回 API 导致数据错误。
  • ⚠️ Promise.all + data.data.display_name 缺乏防御性访问,单个请求异常会导致整批失败。

其余变更(slot-scope 修复、tenant_id 统一提取到 store)逻辑正确,无问题。

Comment thread frontend/src/views/admin/Space/SpaceConfig/index.vue Outdated
Comment thread frontend/src/views/admin/Space/SpaceConfig/index.vue Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review 总结(增量审查)

先前问题复核

  1. json_value 被覆盖问题已解决 — 现在改为写入 valueText 仅用于展示,不再污染原始数据。
  2. ⚠️ 防御性访问问题仍存在data.data.display_name(第 408 行)未做可选链保护,单个请求异常响应仍会导致 TypeError。

新发现问题

# 文件 级别 说明
1 MemberSelect.vue:109 Important 遗留调试 console.log 需移除
2 SpaceConfig/index.vue:408 Important data.data.display_name 仍缺防御性访问(同上次评论,未修复)

整体:tenant_id 统一收归 store、slot-scope 修复、json_value 不再被覆盖——核心逻辑改造正确。清理调试日志 + 加可选链即可合入。

Comment thread frontend/src/components/common/Individualization/MemberSelect.vue Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review 总结(增量审查)

先前问题复核

  1. json_value 被覆盖问题已解决 — 现在改为写入 valueText 仅用于展示,json_value 保持原始 user ID 数据不变。
  2. 防御性访问问题已解决 — 每个 fetch promise 已添加 .catch(() => null),且使用可选链 data?.data?.display_name || userIds[index] 做了空值回退。
  3. MemberSelect.vue 调试 console.log 已移除

新增代码审查

文件 变更 结论
system.js store tenant_id 统一注入 ✅ 正确,消除了调用处重复代码
SpaceDialog.vue 移除手动注入 tenant_id ✅ 与 store 改动配套
SpaceConfig/index.vue convertSuperusersDisplayName ✅ 逻辑完整,异常处理得当
MemberSelect.vue 缩进修复 ✅ 纯格式调整
Credential/DecisionTable props.rowrow ✅ slot-scope 引用修复

小建议(Minor)

  • SpaceConfig/index.vue:410superusersConfig.valueText = ... 多了一个空格,建议对齐。

整体:先前报告的所有问题均已修复,核心逻辑正确。可以合入。

@luofann luofann merged commit 3b4fc09 into TencentBlueKing:dev_multi_tenant May 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants