fix(接口测试): 修复增加mock期望时列表不刷新的问题

--bug=1020971 --user=宋天阳 【接口测试】mock期望添加后,需要刷新才能看到
https://www.tapd.cn/55049933/s/1316934
This commit is contained in:
song-tianyang 2022-12-19 17:08:15 +08:00 committed by 建国
parent 933c2ef860
commit 0f773dd7a6
2 changed files with 9 additions and 6 deletions

View File

@ -137,7 +137,8 @@ public class MockConfigService {
} }
if (request.getApiId() != null) { if (request.getApiId() != null) {
criteria.andApiIdEqualTo(request.getApiId()); criteria.andApiIdEqualTo(request.getApiId());
} else { } else if (StringUtils.isEmpty(request.getId())) {
//todo 刚子有时间把这里优化下 如果不满足什么条件需要直接返回的话增加一个check提前返回 尽可能不要在逻辑中途返回会很难维护
return new MockConfigResponse(null, new ArrayList<>()); return new MockConfigResponse(null, new ArrayList<>());
} }
if (request.getProjectId() != null) { if (request.getProjectId() != null) {

View File

@ -254,9 +254,8 @@ export default {
if (this.isTcp && this.$refs.tcpParam) { if (this.isTcp && this.$refs.tcpParam) {
this.$refs.tcpParam.saveData(); this.$refs.tcpParam.saveData();
} }
let mockConfigId = this.mockConfigId; this.mockExpectConfig.mockConfigId = this.mockConfigId;
this.mockExpectConfig.mockConfigId = mockConfigId; this.checkMockExpectForm('mockExpectForm', true);
let formCheckResult = this.checkMockExpectForm('mockExpectForm', true);
}, },
cleanMockExpectConfig() { cleanMockExpectConfig() {
this.showHeadTable = false; this.showHeadTable = false;
@ -290,7 +289,6 @@ export default {
updateMockExpectConfig(param, null, bodyFiles).then((response) => { updateMockExpectConfig(param, null, bodyFiles).then((response) => {
let returnData = response.data; let returnData = response.data;
this.mockExpectConfig.id = returnData.id; this.mockExpectConfig.id = returnData.id;
this.$emit('refreshMockInfo', param.mockConfigId);
if (clearForm) { if (clearForm) {
this.cleanMockExpectConfig(); this.cleanMockExpectConfig();
} }
@ -298,7 +296,11 @@ export default {
type: 'success', type: 'success',
message: this.$t('commons.save_success'), message: this.$t('commons.save_success'),
}); });
this.close();
this.$nextTick(() => {
this.$emit('refreshMockInfo', param.mockConfigId);
this.close();
});
}); });
}, },
getBodyUploadFiles(data) { getBodyUploadFiles(data) {