fix(接口测试): 编辑接口自定义字段第一次保存关闭提示未保存
This commit is contained in:
parent
f1b188316e
commit
ae91ceef96
|
@ -783,6 +783,7 @@ export default {
|
|||
} else {
|
||||
if (id) {
|
||||
store.apiMap.delete(id);
|
||||
store.saveMap.delete(id);
|
||||
}
|
||||
this.handleTabRemove(targetName);
|
||||
}
|
||||
|
@ -1053,6 +1054,7 @@ export default {
|
|||
store.apiStatus.set('fromChange', false);
|
||||
store.apiStatus.set('requestChange', false);
|
||||
store.apiStatus.set('responseChange', false);
|
||||
store.apiStatus.set('customFormChange', false);
|
||||
store.apiMap.set(data.id, store.apiStatus);
|
||||
// 保存后将保存状态置为true
|
||||
store.saveMap.set(data.id, true);
|
||||
|
|
|
@ -95,7 +95,6 @@ import MsSelectTree from 'metersphere-frontend/src/components/select-tree/Select
|
|||
import MsInputTag from 'metersphere-frontend/src/components/MsInputTag';
|
||||
import CustomFiledFormRow from 'metersphere-frontend/src/components/form/CustomFiledFormRow';
|
||||
import { useApiStore } from '@/store';
|
||||
import { hasLicense } from 'metersphere-frontend/src/utils/permission';
|
||||
import { API_STATUS, REQ_METHOD } from '../../model/JsonData';
|
||||
|
||||
const store = useApiStore();
|
||||
|
@ -217,7 +216,7 @@ export default {
|
|||
},
|
||||
customFieldForm: {
|
||||
handler(v, v1) {
|
||||
if (v && v1 && store.apiMap && this.basicForm.id) {
|
||||
if (v && v1 ) {
|
||||
this.customApiMapStatus();
|
||||
}
|
||||
},
|
||||
|
@ -231,12 +230,30 @@ export default {
|
|||
store.apiMap.set(this.basicForm.id, store.apiStatus);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 自定义字段的状态
|
||||
* 有此方法是因为自定义字段点击保存按钮后会再次触发watch方法,导致customFromChange为true
|
||||
*/
|
||||
customApiMapStatus() {
|
||||
if(store.saveMap.get(this.basicForm.id)){
|
||||
if(store.saveMap.has(this.basicForm.id) === false){
|
||||
// 首次进入页面,若saveMap不存在,初始化saveMap,
|
||||
store.saveMap.set(this.basicForm.id, false);
|
||||
store.apiStatus.set('customFormChange',false );
|
||||
} else {
|
||||
if (this.basicForm.id && this.isFormAlive) {
|
||||
// 初始化 customFromChange 为true
|
||||
store.apiStatus.set('customFormChange', true);
|
||||
store.apiMap.set(this.basicForm.id, store.apiStatus);
|
||||
}
|
||||
} else {
|
||||
// 不是首次进入页面,若 saveMap 为True,说明已经保存过
|
||||
if(store.saveMap.get(this.basicForm.id) === true){
|
||||
store.saveMap.set(this.basicForm.id,false);
|
||||
return;
|
||||
}
|
||||
// 不是首次进入页面,若 saveMap 为False,说明未保存过
|
||||
if (this.basicForm.id && this.isFormAlive) {
|
||||
store.apiStatus.set('customFormChange', true);
|
||||
store.apiMap.set(this.basicForm.id, store.apiStatus);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue