From dc56f97bb6135e18cc65d56031afec432d6d812f Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 16 Apr 2025 12:04:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=AF=BC=E5=85=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/infra/codegen/data.ts | 18 +++++++++--------- .../infra/codegen/modules/import-table.vue | 10 +++------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/apps/web-antd/src/views/infra/codegen/data.ts b/apps/web-antd/src/views/infra/codegen/data.ts index 7086bbc64..809441938 100644 --- a/apps/web-antd/src/views/infra/codegen/data.ts +++ b/apps/web-antd/src/views/infra/codegen/data.ts @@ -37,15 +37,6 @@ export function useImportTableFormSchema(): VbenFormSchema[] { autoSelect: 'first', placeholder: '请选择数据源', }, - dependencies: { - triggerFields: ['dataSourceConfigId'], - trigger(values, formApi) { - if (values.dataSourceConfigId === undefined) { - return; - } - formApi.submitForm(values); - }, - }, rules: 'selectRequired', }, { @@ -69,6 +60,15 @@ export function useImportTableFormSchema(): VbenFormSchema[] { ]; } +/** 导入数据库表表格列定义 */ +export function useImportTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'checkbox', width: 40 }, + { field: 'name', title: '表名称', minWidth: 200 }, + { field: 'comment', title: '表描述', minWidth: 200 }, + ]; +} + /** 基本信息表单的 schema */ export function useBasicInfoFormSchema(): VbenFormSchema[] { return [ diff --git a/apps/web-antd/src/views/infra/codegen/modules/import-table.vue b/apps/web-antd/src/views/infra/codegen/modules/import-table.vue index be853e9af..6a52f116b 100644 --- a/apps/web-antd/src/views/infra/codegen/modules/import-table.vue +++ b/apps/web-antd/src/views/infra/codegen/modules/import-table.vue @@ -11,7 +11,7 @@ import { reactive } from 'vue'; import { $t } from '@vben/locales'; -import { useImportTableFormSchema } from '#/views/infra/codegen/data'; +import { useImportTableColumns, useImportTableFormSchema } from '#/views/infra/codegen/data'; /** 定义组件事件 */ const emit = defineEmits<{ @@ -27,14 +27,10 @@ const formData = reactive({ const [Grid] = useVbenVxeGrid({ formOptions: { schema: useImportTableFormSchema(), + submitOnChange: true, }, gridOptions: { - // TODO @puhui999:这个要不也挪出去,保持统一? - columns: [ - { type: 'checkbox', width: 40 }, - { field: 'name', title: '表名称', minWidth: 200 }, - { field: 'comment', title: '表描述', minWidth: 200 }, - ], + columns: useImportTableColumns(), height: 600, keepSource: true, proxyConfig: {