From eec32b73a588d8298cbbec1075a7052e5ba1af2e Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 20 Feb 2025 18:05:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A3=9E=E4=B9=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datasource/server/DatasourceServer.java | 9 ++- .../datasource/form/ApiHttpRequestDraw.vue | 73 ++++++++----------- .../data/datasource/form/EditorDetail.vue | 19 +++-- .../visualized/data/datasource/form/index.vue | 3 + 4 files changed, 53 insertions(+), 51 deletions(-) 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({