From aa79031605cec2cf345093ff7d678fe3b39b6dfe Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 25 Nov 2021 16:15:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=E4=B8=ADTEST=E5=8F=A6?= =?UTF-8?q?=E5=AD=98=E4=B8=BA=E6=96=B0=E7=94=A8=E4=BE=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?tab=E9=A1=B5=E5=85=B3=E4=B8=8D=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1007724 --user=王孝刚 【接口测试】测试定义- TEST -另存为新用例后,tab页关不掉【+github#7660】 https://www.tapd.cn/55049933/s/1075200 --- .../api/definition/ApiDefinition.vue | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index f9664ab10d..32b6125566 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -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;