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', component: 'Select',
fieldName: 'dataName', fieldName: 'dataName',
label: '数据源', label: '数据源',
defaultValue: '',
}, },
{ {
component: 'Input', component: 'Input',

View File

@ -2,7 +2,11 @@
import { useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter'; 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: [] }>(); const emit = defineEmits<{ reload: [] }>();
@ -93,6 +97,16 @@ const [BasicModal, modalApi] = useVbenModal({
tableApi.grid.clearCheckboxRow(); tableApi.grid.clearCheckboxRow();
return null; 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, onConfirm: handleSubmit,
}); });
@ -106,10 +120,8 @@ async function handleSubmit() {
return; return;
} }
modalApi.modalLoading(true); modalApi.modalLoading(true);
// const data = await validate(); const { dataName } = await tableApi.formApi.getValues();
// const dataSource = data.dataName; await importTable(tables.join(','), dataName);
// TODO:
await importTable(tables.join(','), 'master');
emit('reload'); emit('reload');
modalApi.close(); modalApi.close();
} catch (error) { } catch (error) {