diff --git a/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java b/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java index da855718b9..0a3c0aafed 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/MockConfigService.java @@ -137,7 +137,8 @@ public class MockConfigService { } if (request.getApiId() != null) { criteria.andApiIdEqualTo(request.getApiId()); - } else { + } else if (StringUtils.isEmpty(request.getId())) { + //todo 刚子有时间把这里优化下: 如果不满足什么条件需要直接返回的话,增加一个check,提前返回。 尽可能不要在逻辑中途返回。会很难维护。 return new MockConfigResponse(null, new ArrayList<>()); } if (request.getProjectId() != null) { diff --git a/api-test/frontend/src/business/definition/components/mock/MockEditDrawer.vue b/api-test/frontend/src/business/definition/components/mock/MockEditDrawer.vue index 41004a94c7..6706ba9137 100644 --- a/api-test/frontend/src/business/definition/components/mock/MockEditDrawer.vue +++ b/api-test/frontend/src/business/definition/components/mock/MockEditDrawer.vue @@ -254,9 +254,8 @@ export default { if (this.isTcp && this.$refs.tcpParam) { this.$refs.tcpParam.saveData(); } - let mockConfigId = this.mockConfigId; - this.mockExpectConfig.mockConfigId = mockConfigId; - let formCheckResult = this.checkMockExpectForm('mockExpectForm', true); + this.mockExpectConfig.mockConfigId = this.mockConfigId; + this.checkMockExpectForm('mockExpectForm', true); }, cleanMockExpectConfig() { this.showHeadTable = false; @@ -290,7 +289,6 @@ export default { updateMockExpectConfig(param, null, bodyFiles).then((response) => { let returnData = response.data; this.mockExpectConfig.id = returnData.id; - this.$emit('refreshMockInfo', param.mockConfigId); if (clearForm) { this.cleanMockExpectConfig(); } @@ -298,7 +296,11 @@ export default { type: 'success', message: this.$t('commons.save_success'), }); - this.close(); + + this.$nextTick(() => { + this.$emit('refreshMockInfo', param.mockConfigId); + this.close(); + }); }); }, getBodyUploadFiles(data) { diff --git a/framework/sdk-parent/frontend/src/utils/default-table-header.js b/framework/sdk-parent/frontend/src/utils/default-table-header.js index 0fb2e21883..13243a637a 100644 --- a/framework/sdk-parent/frontend/src/utils/default-table-header.js +++ b/framework/sdk-parent/frontend/src/utils/default-table-header.js @@ -90,7 +90,7 @@ export let CUSTOM_TABLE_HEADER = { // {id: 'versionId', key: 'f', label: 'project.version.name', xpack: true}, {id: 'creatorName', key: 'd', label: 'api_test.automation.creator'}, {id: 'principalName', key: '6', label: 'api_test.definition.api_principal'}, - // {id: 'environmentMap', key: 'e', label: 'commons.environment'}, + {id: 'environmentMap', key: 'e', label: 'commons.environment'}, {id: 'updateTime', key: '7', label: 'api_test.definition.api_last_time'}, {id: 'stepTotal', key: '8', label: 'api_test.automation.step'}, {id: 'lastResult', key: 'a', label: 'api_test.automation.last_result'}, @@ -104,6 +104,7 @@ export let CUSTOM_TABLE_HEADER = { {id: 'tags', key: '5', label: 'commons.tag'}, {id: 'creatorName', key: 'd', label: 'api_test.automation.creator'}, {id: 'principalName', key: '6', label: 'api_test.definition.api_principal'}, + {id: 'environmentMap', key: '8', label: 'commons.environment'}, {id: 'updateTime', key: '7', label: 'api_test.definition.api_last_time'}, {id: 'lastResult', key: 'a', label: 'ui.debug_result_label'}, {id: 'createTime', key: 'c', label: 'commons.create_time'},