fix: 修复编辑账户时分组调度选择不生效的问题

- 为 Claude Console 和 Gemini 账户的更新接口添加分组处理逻辑
- 处理账户类型变更时的分组关系(从旧分组移除,添加到新分组)
- 修复前端编辑账户时分组 ID 的初始化问题
- 优化删除账户时自动从分组中移除的逻辑

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shaw
2025-08-05 19:02:27 +08:00
parent f46653a461
commit 4ebe6abd96
2 changed files with 95 additions and 9 deletions

View File

@@ -1395,15 +1395,20 @@ watch(() => props.account, (newAccount) => {
if (newAccount.accountType === 'group') {
// 先加载分组列表
loadGroups().then(() => {
// 查找账户所属的分组
groups.value.forEach(group => {
apiClient.get(`/admin/account-groups/${group.id}/members`).then(response => {
const members = response.data || []
if (members.some(m => m.id === newAccount.id)) {
form.value.groupId = group.id
}
}).catch(() => {})
})
// 如果账户有 groupInfo直接使用它的 groupId
if (newAccount.groupInfo && newAccount.groupInfo.id) {
form.value.groupId = newAccount.groupInfo.id
} else {
// 否则查找账户所属的分组
groups.value.forEach(group => {
apiClient.get(`/admin/account-groups/${group.id}/members`).then(response => {
const members = response.data || []
if (members.some(m => m.id === newAccount.id)) {
form.value.groupId = group.id
}
}).catch(() => {})
})
}
})
}
}