chore: dataName

This commit is contained in:
dap 2024-10-09 16:46:06 +08:00
parent cf53a4f3bd
commit 2af01881ab
2 changed files with 18 additions and 5 deletions

View File

@ -5,6 +5,7 @@ export const querySchema: FormSchemaGetter = () => [
component: 'Select',
fieldName: 'dataName',
label: '数据源',
defaultValue: '',
},
{
component: 'Input',

View File

@ -2,7 +2,11 @@
import { useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter';
import { importTable, readyToGenList } from '#/api/tool/gen';
import {
getDataSourceNames,
importTable,
readyToGenList,
} from '#/api/tool/gen';
const emit = defineEmits<{ reload: [] }>();
@ -93,6 +97,16 @@ const [BasicModal, modalApi] = useVbenModal({
tableApi.grid.clearCheckboxRow();
return null;
}
const ret = await getDataSourceNames();
const dataSourceOptions = ret.map((item) => ({ label: item, value: item }));
tableApi.formApi.updateSchema([
{
fieldName: 'dataName',
componentProps: {
options: dataSourceOptions,
},
},
]);
},
onConfirm: handleSubmit,
});
@ -106,10 +120,8 @@ async function handleSubmit() {
return;
}
modalApi.modalLoading(true);
// const data = await validate();
// const dataSource = data.dataName;
// TODO:
await importTable(tables.join(','), 'master');
const { dataName } = await tableApi.formApi.getValues();
await importTable(tables.join(','), dataName);
emit('reload');
modalApi.close();
} catch (error) {