From 5e3647aea8cb1c6e6febb6b8777b6f7dad0d1223 Mon Sep 17 00:00:00 2001 From: shaw Date: Tue, 29 Jul 2025 16:37:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin-spa):=20=E4=BF=AE=E5=A4=8DAPI=20Key?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=90=8E=E7=9B=B4=E6=8E=A5=E6=B6=88=E5=A4=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正NewApiKeyModal组件的prop名从apiKeyData改为apiKey - 修正CreateApiKeyModal中emit的数据从result.apiKey改为result.data - 补充创建和编辑API Key时缺失的enableModelRestriction和enableClientRestriction字段 - 确保所有字段名与旧版保持一致 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue | 4 +++- web/admin-spa/src/components/apikeys/EditApiKeyModal.vue | 2 ++ web/admin-spa/src/views/ApiKeysView.vue | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue b/web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue index c07e3a17..ed2d8ec1 100644 --- a/web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue +++ b/web/admin-spa/src/components/apikeys/CreateApiKeyModal.vue @@ -557,11 +557,13 @@ const createApiKey = async () => { } // 模型限制 + data.enableModelRestriction = form.enableModelRestriction if (form.enableModelRestriction && form.restrictedModels.length > 0) { data.restrictedModels = form.restrictedModels } // 客户端限制 + data.enableClientRestriction = form.enableClientRestriction if (form.enableClientRestriction && form.allowedClients.length > 0) { data.allowedClients = form.allowedClients } @@ -570,7 +572,7 @@ const createApiKey = async () => { if (result.success) { showToast('API Key 创建成功', 'success') - emit('success', result.apiKey) + emit('success', result.data) emit('close') } else { showToast(result.message || '创建失败', 'error') diff --git a/web/admin-spa/src/components/apikeys/EditApiKeyModal.vue b/web/admin-spa/src/components/apikeys/EditApiKeyModal.vue index 8c84fc0a..3f41b3dd 100644 --- a/web/admin-spa/src/components/apikeys/EditApiKeyModal.vue +++ b/web/admin-spa/src/components/apikeys/EditApiKeyModal.vue @@ -447,6 +447,7 @@ const updateApiKey = async () => { } // 模型限制 + data.enableModelRestriction = form.enableModelRestriction if (form.enableModelRestriction && form.restrictedModels.length > 0) { data.restrictedModels = form.restrictedModels } else { @@ -454,6 +455,7 @@ const updateApiKey = async () => { } // 客户端限制 + data.enableClientRestriction = form.enableClientRestriction if (form.enableClientRestriction && form.allowedClients.length > 0) { data.allowedClients = form.allowedClients } else { diff --git a/web/admin-spa/src/views/ApiKeysView.vue b/web/admin-spa/src/views/ApiKeysView.vue index d688f30a..2bfef1c3 100644 --- a/web/admin-spa/src/views/ApiKeysView.vue +++ b/web/admin-spa/src/views/ApiKeysView.vue @@ -463,7 +463,7 @@