diff --git a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java index 8f37eea8e8..5ccf448414 100644 --- a/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java +++ b/core/core-backend/src/main/java/io/dataease/datasource/server/DatasourceServer.java @@ -1282,10 +1282,13 @@ public class DatasourceServer implements DatasourceApi { try { String ClassName = "io.dataease.datasource.provider.ApiUtils"; if (!dsType.equals(DatasourceConfiguration.DatasourceType.API.name())) { - ClassName = "io.dataease.datasource.provider.LarkUtils"; + Provider provider = ProviderFactory.getProvider(dsType); + method = provider.getClass().getMethod(methodName, classes); + } else { + Class clazz = Class.forName(ClassName); + method = clazz.getMethod(methodName, classes); } - Class clazz = Class.forName(ClassName); - method = clazz.getMethod(methodName, classes); + } catch (Exception e) { DEException.throwException("Cant find method: " + e.getMessage()); } diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue index 76810c5346..11ce3de0d2 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue @@ -355,16 +355,23 @@ const saveItem = () => { const before = () => { active.value -= 1 } + const next = () => { - console.log(apiItem) if (isPlugin.value) { + xpackApiItemBasicInfo?.value?.invokeMethod({ + methodName: 'submitForm', + args: [{ eventName: 'stepNext', args: apiItem }] + }) } else { apiItemBasicInfo.value.validate(val => { - if (!val) { - return + if (val) { + stepNext() } }) } +} + +const stepNext = () => { if (apiItem.useJsonPath && !apiItem.jsonPath) { ElMessage.error(t('datasource.please_input_dataPath')) return @@ -415,20 +422,24 @@ const next = () => { console.warn(error?.message) }) } - const validate = () => { if (isPlugin.value) { xpackApiItemBasicInfo?.value?.invokeMethod({ methodName: 'submitForm', - args: [apiItem] + args: [{ eventName: 'validateItem', args: apiItem }] }) } else { apiItemBasicInfo.value.validate(val => { if (!val) { return + } else { + validateItem() } }) } +} + +const validateItem = () => { if (apiItem.useJsonPath && !apiItem.jsonPath) { ElMessage.error(t('datasource.please_input_dataPath')) return @@ -452,6 +463,20 @@ const validate = () => { ElMessage.error(t('data_source.verification_failed')) }) } + +const handleSubmit = param => { + const validateFrom = param.validate + validateFrom(val => { + if (val) { + if (param.eventName === 'validateItem') { + validateItem() + } else { + stepNext() + } + } + }) +} + const closeEditItem = () => { cancelMap['/datasource/checkApiDatasource']?.() edit_api_item.value = false @@ -760,46 +785,10 @@ defineExpose({ :jsname="jsName" :api-item="apiItem" ref="xpackApiItemBasicInfo" + @submitForm="handleSubmit" v-if="dsType !== 'API'" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (cloneDeep(defaultRule)) const api_table_title = ref('') const editApiItem = ref() -const editLarkItem = ref() -const pluginDs = ref([]) -const pluginIndex = ref('') -const isPlugin = ref(false) const xpack = ref() const visible = ref(false) const defaultApiItem = { diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/index.vue b/core/core-frontend/src/views/visualized/data/datasource/form/index.vue index e55f3c954b..eb4837fe4f 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/index.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/index.vue @@ -809,6 +809,9 @@ defineExpose({