From 09edd1f2716d4ba21bdfc5fbe475daf9ecd254fe Mon Sep 17 00:00:00 2001 From: wood chen Date: Sat, 22 Feb 2025 02:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E8=A1=A8=E5=8D=95=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Providers.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/Providers.vue b/frontend/src/views/Providers.vue index 9931258..baaada2 100644 --- a/frontend/src/views/Providers.vue +++ b/frontend/src/views/Providers.vue @@ -164,13 +164,19 @@ const handleAdd = () => { const submitForm = async () => { try { + // 确保ID是数字类型 + const formData = { + ...form.value, + id: parseInt(form.value.id) + } + if (editingProvider.value) { if (!isAdmin.value) { ElMessage.error('只有管理员可以编辑模型厂商信息') return } // 管理员编辑模型厂商 - const { data } = await axios.put(`/api/providers/${editingProvider.value.id}`, form.value) + const { data } = await axios.put(`/api/providers/${editingProvider.value.id}`, formData) if (data.error) { ElMessage.error(data.error) return @@ -182,7 +188,7 @@ const submitForm = async () => { ElMessage.success('更新成功') } else { // 创建新模型厂商 - const { data } = await axios.post('/api/providers', form.value) + const { data } = await axios.post('/api/providers', formData) if (data.error) { ElMessage.error(data.error) return