feat: 多租户改造 --story=134410224 --story=134223137#741
Merged
luofann merged 3 commits intoMay 20, 2026
Conversation
# Reviewed, transaction id: 80570
There was a problem hiding this comment.
Code Review 总结
本 PR 为多租户改造,主要变更:
- 升级
@blueking/bk-user-selector到 0.1.8 - 在
system/updateSpaceConfigstore action 中统一注入tenant_id - 修复
props.row→row的 slot-scope 引用问题(Credential / DecisionTable) - 新增
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)逻辑正确,无问题。
# Reviewed, transaction id: 80586
There was a problem hiding this comment.
Code Review 总结(增量审查)
先前问题复核
- ✅
json_value被覆盖问题已解决 — 现在改为写入valueText仅用于展示,不再污染原始数据。 ⚠️ 防御性访问问题仍存在 —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 不再被覆盖——核心逻辑改造正确。清理调试日志 + 加可选链即可合入。
# Reviewed, transaction id: 80594
There was a problem hiding this comment.
Code Review 总结(增量审查)
先前问题复核
- ✅
json_value被覆盖问题已解决 — 现在改为写入valueText仅用于展示,json_value保持原始 user ID 数据不变。 - ✅ 防御性访问问题已解决 — 每个 fetch promise 已添加
.catch(() => null),且使用可选链data?.data?.display_name || userIds[index]做了空值回退。 - ✅ MemberSelect.vue 调试
console.log已移除。
新增代码审查
| 文件 | 变更 | 结论 |
|---|---|---|
system.js store |
tenant_id 统一注入 |
✅ 正确,消除了调用处重复代码 |
SpaceDialog.vue |
移除手动注入 tenant_id |
✅ 与 store 改动配套 |
SpaceConfig/index.vue |
convertSuperusersDisplayName |
✅ 逻辑完整,异常处理得当 |
MemberSelect.vue |
缩进修复 | ✅ 纯格式调整 |
Credential/DecisionTable |
props.row → row |
✅ slot-scope 引用修复 |
小建议(Minor)
SpaceConfig/index.vue:410:superusersConfig.valueText = ...多了一个空格,建议对齐。
整体:先前报告的所有问题均已修复,核心逻辑正确。可以合入。
luofann
approved these changes
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reviewed, transaction id: 80570