fix(channel): 分组加载时序修复 — 预加载 + await 确保分组数据就绪
This commit is contained in:
@@ -839,14 +839,14 @@ function resetForm() {
|
|||||||
showPlatformMenu.value = false
|
showPlatformMenu.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function openCreateDialog() {
|
async function openCreateDialog() {
|
||||||
editingChannel.value = null
|
editingChannel.value = null
|
||||||
resetForm()
|
resetForm()
|
||||||
loadGroups()
|
await loadGroups()
|
||||||
showDialog.value = true
|
showDialog.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function openEditDialog(channel: Channel) {
|
async function openEditDialog(channel: Channel) {
|
||||||
editingChannel.value = channel
|
editingChannel.value = channel
|
||||||
form.name = channel.name
|
form.name = channel.name
|
||||||
form.description = channel.description || ''
|
form.description = channel.description || ''
|
||||||
@@ -854,9 +854,8 @@ function openEditDialog(channel: Channel) {
|
|||||||
form.restrict_models = channel.restrict_models || false
|
form.restrict_models = channel.restrict_models || false
|
||||||
form.billing_model_source = channel.billing_model_source || 'requested'
|
form.billing_model_source = channel.billing_model_source || 'requested'
|
||||||
// Must load groups first so apiToForm can map groupID → platform
|
// Must load groups first so apiToForm can map groupID → platform
|
||||||
loadGroups().then(() => {
|
await loadGroups()
|
||||||
form.platforms = apiToForm(channel)
|
form.platforms = apiToForm(channel)
|
||||||
})
|
|
||||||
showDialog.value = true
|
showDialog.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -948,6 +947,7 @@ async function confirmDelete() {
|
|||||||
// ── Lifecycle ──
|
// ── Lifecycle ──
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadChannels()
|
loadChannels()
|
||||||
|
loadGroups()
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user