From 2186566a0eb1053e1bdee111743233c01c789c70 Mon Sep 17 00:00:00 2001 From: zhangtao <9480807882@qq.com> Date: Tue, 14 Oct 2025 00:31:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(gencode):=20=E7=A1=AE=E4=BF=9D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E8=A1=A8=E5=8D=95=E6=97=B6columns=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在提交表单数据时添加columns字段的默认值,避免因缺少该字段导致的问题 --- frontend/src/views/gencode/backcode/index.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/gencode/backcode/index.vue b/frontend/src/views/gencode/backcode/index.vue index 33c65950..41382360 100644 --- a/frontend/src/views/gencode/backcode/index.vue +++ b/frontend/src/views/gencode/backcode/index.vue @@ -682,7 +682,7 @@ import type { EditorConfiguration } from "codemirror"; import type { CmComponentRef } from "codemirror-editor-vue3"; import { ElMessage, ElMessageBox, type FormInstance, type TableInstance } from 'element-plus'; import { QuestionFilled, CopyDocument, Close } from '@element-plus/icons-vue'; -import GencodeAPI, { type GenTableOutVO, type DatabaseTable, type GenTableQueryParam, type GenTableColumnOutSchema } from "@/api/generator/gencode"; +import GencodeAPI, { type GenTableOutVO, type DatabaseTable, type GenTableQueryParam, type GenTableColumnOutSchema, type GenTableSchema } from "@/api/generator/gencode"; // 表格列配置接口 @@ -1416,8 +1416,12 @@ async function submitForm() { return; } - // 提交表单数据 - const response = await GencodeAPI.updateTable(info, info.id || 0); + // 提交表单数据,确保columns是必需的 + const tableData = { + ...info, + columns: info.columns || [] // 确保columns存在 + }; + const response = await GencodeAPI.updateTable(tableData as GenTableSchema, info.id || 0); if (response?.data?.code === 200) { ElMessage.success((response?.data as any)?.message || '保存成功');