refactor: 代码生成导入数据库表优化

pull/75/head
puhui999 2025-04-16 12:04:44 +08:00
parent 09bf99b84c
commit dc56f97bb6
2 changed files with 12 additions and 16 deletions

View File

@ -37,15 +37,6 @@ export function useImportTableFormSchema(): VbenFormSchema[] {
autoSelect: 'first', autoSelect: 'first',
placeholder: '请选择数据源', placeholder: '请选择数据源',
}, },
dependencies: {
triggerFields: ['dataSourceConfigId'],
trigger(values, formApi) {
if (values.dataSourceConfigId === undefined) {
return;
}
formApi.submitForm(values);
},
},
rules: 'selectRequired', 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 */ /** 基本信息表单的 schema */
export function useBasicInfoFormSchema(): VbenFormSchema[] { export function useBasicInfoFormSchema(): VbenFormSchema[] {
return [ return [

View File

@ -11,7 +11,7 @@ import { reactive } from 'vue';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { useImportTableFormSchema } from '#/views/infra/codegen/data'; import { useImportTableColumns, useImportTableFormSchema } from '#/views/infra/codegen/data';
/** 定义组件事件 */ /** 定义组件事件 */
const emit = defineEmits<{ const emit = defineEmits<{
@ -27,14 +27,10 @@ const formData = reactive<InfraCodegenApi.CodegenCreateListReqVO>({
const [Grid] = useVbenVxeGrid({ const [Grid] = useVbenVxeGrid({
formOptions: { formOptions: {
schema: useImportTableFormSchema(), schema: useImportTableFormSchema(),
submitOnChange: true,
}, },
gridOptions: { gridOptions: {
// TODO @puhui999 columns: useImportTableColumns(),
columns: [
{ type: 'checkbox', width: 40 },
{ field: 'name', title: '表名称', minWidth: 200 },
{ field: 'comment', title: '表描述', minWidth: 200 },
],
height: 600, height: 600,
keepSource: true, keepSource: true,
proxyConfig: { proxyConfig: {