fix(接口测试): 接口定义中TEST另存为新用例后,tab页关不掉

--bug=1007724 --user=王孝刚 【接口测试】测试定义- TEST -另存为新用例后,tab页关不掉【+github#7660】
https://www.tapd.cn/55049933/s/1075200
This commit is contained in:
wxg0103 2021-11-25 16:15:26 +08:00 committed by 刘瑞斌
parent 05da7c49c4
commit aa79031605
1 changed files with 20 additions and 20 deletions

View File

@ -555,28 +555,28 @@ export default {
}
},
closeConfirm(targetName) {
let tabs = this.apiTabs;
if(!tabs[1].api) {
this.handleTabRemove(targetName);
}
if (tabs[1].api && this.$store.state.apiMap.size > 0) {
if (this.$store.state.apiMap.get(tabs[1].api.id).get("responseChange") === true || this.$store.state.apiMap.get(tabs[1].api.id).get("requestChange") === true ||
this.$store.state.apiMap.get(tabs[1].api.id).get("fromChange") === true) {
this.$alert("接口[ " + tabs[1].api.name + " ]未保存,是否确认关闭?", '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
callback: (action) => {
if (action === 'confirm') {
this.$store.state.apiMap.delete(tabs[1].api.id);
this.handleTabRemove(targetName);
}
let tab = this.apiTabs;
tab.forEach(t => {
if (t.name === targetName) {
if (t.api && this.$store.state.apiMap.size > 0 && this.$store.state.apiMap.has(t.api.id)) {
if (this.$store.state.apiMap.get(t.api.id).get("responseChange") === true || this.$store.state.apiMap.get(t.api.id).get("requestChange") === true ||
this.$store.state.apiMap.get(t.api.id).get("fromChange") === true) {
this.$alert("接口[ " + t.api.name + " ]未保存,是否确认关闭?", '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
callback: (action) => {
if (action === 'confirm') {
this.$store.state.apiMap.delete(t.api.id);
this.handleTabRemove(targetName);
}
}
});
}
});
} else {
this.handleTabRemove(targetName);
}
}
} else{
this.handleTabRemove(targetName);
}
})
},
handleTabRemove(targetName) {
let tabs = this.apiTabs;