refactor(ui): 简化模型权限编辑对话框交互

- 将模型权限对话框从双栏穿梭框重构为单面板多选模式
- 简化对话框尺寸,优化布局为单列显示避免模型名称截断
- 模型列表移除能力列,新增快捷添加映射按钮
- 支持从模型列表直接跳转到模型映射对话框并预选模型
This commit is contained in:
fawney19
2026-01-11 02:06:48 +08:00
parent 8d8b20aa47
commit 76ed136228
5 changed files with 337 additions and 488 deletions

View File

@@ -168,6 +168,7 @@
:provider-api-formats="providerApiFormats"
:models="models"
:editing-group="editingGroup"
:preselected-model-id="preselectedModelId"
@saved="onDialogSaved"
/>
@@ -219,6 +220,7 @@ const deleteConfirmOpen = ref(false)
const editingGroup = ref<AliasGroup | null>(null)
const deletingGroup = ref<AliasGroup | null>(null)
const testingMapping = ref<string | null>(null)
const preselectedModelId = ref<string | null>(null)
// 列表展开状态
const expandedAliasGroups = ref<Set<string>>(new Set())
@@ -311,12 +313,21 @@ function toggleAliasGroupExpand(groupKey: string) {
// 打开添加对话框
function openAddDialog() {
editingGroup.value = null
preselectedModelId.value = null
dialogOpen.value = true
}
// 打开添加对话框并预选模型(供外部调用)
function openAddDialogForModel(modelId: string) {
editingGroup.value = null
preselectedModelId.value = modelId
dialogOpen.value = true
}
// 编辑分组
function editGroup(group: AliasGroup) {
editingGroup.value = group
preselectedModelId.value = null
dialogOpen.value = true
}
@@ -416,8 +427,9 @@ onMounted(() => {
}
})
// 暴露给父组件,用于检测是否有弹窗打开
// 暴露给父组件
defineExpose({
dialogOpen: computed(() => dialogOpen.value || deleteConfirmOpen.value)
dialogOpen: computed(() => dialogOpen.value || deleteConfirmOpen.value),
openAddDialogForModel
})
</script>