fix(接口测试): 接口自定义修改首次保存后关闭提示未保存

This commit is contained in:
RubyLiu 2023-06-25 16:52:49 +08:00 committed by fit2-zhao
parent dcf7dbbb8a
commit bb9f798e7a
4 changed files with 20 additions and 6 deletions

View File

@ -753,7 +753,8 @@ export default {
if (
store.apiMap.get(t.api.id).get('responseChange') === true ||
store.apiMap.get(t.api.id).get('requestChange') === true ||
store.apiMap.get(t.api.id).get('fromChange') === true
store.apiMap.get(t.api.id).get('fromChange') === true ||
store.apiMap.get(t.api.id).get('customFormChange') === true
) {
message += t.api.name;
id = t.api.id;
@ -1049,6 +1050,12 @@ export default {
t.isCopy = false;
}
});
store.apiStatus.set('fromChange', false);
store.apiStatus.set('requestChange', false);
store.apiStatus.set('responseChange', false);
store.apiMap.set(data.id, store.apiStatus);
// true
store.saveMap.set(data.id, true);
},
showExecResult(row) {

View File

@ -375,10 +375,6 @@ export default {
});
this.responseCount = 0;
this.count = 0;
store.apiStatus.set('fromChange', false);
store.apiStatus.set('requestChange', false);
store.apiStatus.set('responseChange', false);
store.apiMap.set(this.currentApi.id, store.apiStatus);
},
handleSave() {
if (this.$refs.httpApi) {

View File

@ -218,7 +218,7 @@ export default {
customFieldForm: {
handler(v, v1) {
if (v && v1 && store.apiMap && this.basicForm.id) {
this.apiMapStatus();
this.customApiMapStatus();
}
},
deep: true,
@ -231,6 +231,15 @@ export default {
store.apiMap.set(this.basicForm.id, store.apiStatus);
}
},
customApiMapStatus() {
if(store.saveMap.get(this.basicForm.id)){
store.saveMap.set(this.basicForm.id, false);
store.apiStatus.set('customFormChange',false );
} else {
store.apiStatus.set('customFormChange',true );
}
},
setModule(id, data) {
this.basicForm.moduleId = id;
this.basicForm.modulePath = data.path;

View File

@ -10,6 +10,8 @@ export default {
apiStatus: new Map(),
apiCaseMap: new Map(),
forceRerenderIndex: '',
// 存储保存状态的map只针对自定义属性change。
saveMap: new Map(),
}),
getters: {
currentApi(store) {