@@ -46,6 +46,7 @@ const getUploadURL = import.meta.env.VITE_API_BASE_URL + '/datasource/uploadExce
4646const saveLoading = ref <boolean >(false )
4747const uploadLoading = ref (false )
4848const { t } = useI18n ()
49+ const schemaList = ref <any >([])
4950
5051const rules = reactive <FormRules >({
5152 name: [
@@ -340,6 +341,16 @@ const check = () => {
340341 })
341342}
342343
344+ const getSchema = () => {
345+ schemaList .value = []
346+ const requestObj = buildConf ()
347+ datasourceApi .getSchema (requestObj ).then ((res : any ) => {
348+ for (let item of res ) {
349+ schemaList .value .push ({ label: item , value: item })
350+ }
351+ })
352+ }
353+
343354onBeforeUnmount (() => (saveLoading .value = false ))
344355
345356const next = debounce (async (formEl : FormInstance | undefined ) => {
@@ -644,13 +655,30 @@ defineExpose({
644655 "
645656 />
646657 </el-form-item >
647- <el-form-item v-if =" haveSchema.includes(form.type)" label =" Schema" prop =" dbSchema" >
648- <el-input
658+ <el-form-item v-if =" haveSchema.includes(form.type)" class =" schema-label" prop =" dbSchema" >
659+ <template #label >
660+ <span class =" name" >Schema<i class =" required" /></span >
661+ <el-button text size =" small" @click =" getSchema" >
662+ <template #icon >
663+ <Icon name =" icon_add_outlined" >
664+ <Plus class =" svg-icon" />
665+ </Icon >
666+ </template >
667+ {{ t('datasource.get_schema') }}
668+ </el-button >
669+ </template >
670+ <el-select
649671 v-model =" form.dbSchema"
650- clearable
672+ filterable
651673 :placeholder =" $t('datasource.please_enter') + $t('common.empty') + 'Schema'"
652- />
653- <el-button v-if =" false" link type =" primary" :icon =" Plus" >Get Schema</el-button >
674+ >
675+ <el-option
676+ v-for =" item in schemaList"
677+ :key =" item.value"
678+ :label =" item.label"
679+ :value =" item.value"
680+ />
681+ </el-select >
654682 </el-form-item >
655683 <el-form-item :label =" t('ds.form.timeout')" prop =" timeout" >
656684 <el-input-number
@@ -905,4 +933,24 @@ defineExpose({
905933 }
906934 }
907935}
936+
937+ .schema-label {
938+ ::v- deep(.ed-form-item__label ) {
939+ display : flex !important ;
940+ justify-content : space-between ;
941+ padding-right : 0 ;
942+
943+ & ::after {
944+ display : none ;
945+ }
946+
947+ .name {
948+ .required ::after {
949+ content : ' *' ;
950+ color : #f54a45 ;
951+ margin-left : 2px ;
952+ }
953+ }
954+ }
955+ }
908956 </style >
0 commit comments