From f4e9d2f5e20e2d414e8a724e3b4c7862900caea5 Mon Sep 17 00:00:00 2001
From: xingyu <xingyu4j@vip.qq.com>
Date: Wed, 24 May 2023 14:56:18 +0800
Subject: [PATCH] feat: dataSourceConfigId

---
 src/views/infra/codegen/codegen.data.ts | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/views/infra/codegen/codegen.data.ts b/src/views/infra/codegen/codegen.data.ts
index b2460368..b37e57a0 100644
--- a/src/views/infra/codegen/codegen.data.ts
+++ b/src/views/infra/codegen/codegen.data.ts
@@ -131,10 +131,16 @@ export const importTableSearchFormSchema: FormSchema[] = [
     label: '数据源',
     field: 'dataSourceConfigId',
     component: 'ApiSelect',
-    componentProps: {
-      api: () => getDataSourceConfigList(),
-      labelField: 'name',
-      valueField: 'id'
+    componentProps: ({ formModel }) => {
+      return {
+        api: async () => {
+          const res = await getDataSourceConfigList()
+          formModel.dataSourceConfigId = res[0].id
+          return res
+        },
+        labelField: 'name',
+        valueField: 'id'
+      }
     },
     colProps: { span: 8 }
   },