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) {