chore: updateschema

This commit is contained in:
dap 2024-10-07 18:53:22 +08:00
parent eba762c023
commit 460020bee2
2 changed files with 25 additions and 3 deletions

View File

@ -3,7 +3,6 @@ import type { FormSchemaGetter, VxeGridProps } from '#/adapter';
export const querySchema: FormSchemaGetter = () => [
{
component: 'Select',
defaultValue: '',
fieldName: 'dataName',
label: '数据源',
},

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
@ -10,7 +10,13 @@ import { message, Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter';
import { batchGenCode, generatedList, genRemove, syncDb } from '#/api/tool/gen';
import {
batchGenCode,
generatedList,
genRemove,
getDataSourceNames,
syncDb,
} from '#/api/tool/gen';
import { downloadByData } from '#/utils/file/download';
import codePreviewModal from './code-preview-modal.vue';
@ -84,6 +90,23 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
},
});
onMounted(async () => {
//
const ret = await getDataSourceNames();
const dataSourceOptions = [{ label: '全部', value: '' }];
const transOptions = ret.map((item) => ({ label: item, value: item }));
dataSourceOptions.push(...transOptions);
// selectOptions
tableApi.formApi.updateSchema([
{
fieldName: 'dataName',
componentProps: {
options: dataSourceOptions,
},
},
]);
});
const [CodePreviewModal, previewModalApi] = useVbenModal({
connectedComponent: codePreviewModal,
});