fix(接口测试): 修复场景描述多写个1时关闭不会提示保存的缺陷

--bug=1009996 --user=王孝刚 【接口测试】场景描述多写个1,关闭不会提示保存
https://www.tapd.cn/55049933/s/1098586
This commit is contained in:
wxg0103 2022-01-26 11:04:32 +08:00 committed by 刘瑞斌
parent 21c7bff0af
commit 581217262a
4 changed files with 15 additions and 8 deletions

View File

@ -369,7 +369,7 @@ export default {
},
closeConfirm(targetName) {
let t = this.tabs.filter(tab => tab.name === targetName);
if (t && this.$store.state.scenarioMap.has(t[0].currentScenario.id) && this.$store.state.scenarioMap.get(t[0].currentScenario.id) > 1) {
if (t && this.$store.state.scenarioMap.has(t[0].currentScenario.id) && this.$store.state.scenarioMap.get(t[0].currentScenario.id) > 0) {
this.$alert(this.$t('commons.scenario') + " [ " + t[0].currentScenario.name + " ] " + this.$t('commons.confirm_info'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),

View File

@ -307,7 +307,7 @@ export default {
},
'httpForm.description': {
handler(v, v1) {
if (v && v1 && v !== v1) {
if (v && v1 !== undefined && v !== v1) {
this.apiMapStatus();
}
}

View File

@ -448,7 +448,7 @@ export default {
},
closeConfirm(targetName) {
let t = this.tabs.filter(tab => tab.name === targetName);
if (t && this.$store.state.testCaseMap.has(t[0].testCaseInfo.id) && this.$store.state.testCaseMap.get(t[0].testCaseInfo.id) > 1) {
if (t && this.$store.state.testCaseMap.has(t[0].testCaseInfo.id) && this.$store.state.testCaseMap.get(t[0].testCaseInfo.id) > 0) {
this.$alert(this.$t('commons.track') + " [ " + t[0].testCaseInfo.name + " ] " + this.$t('commons.confirm_info'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),

View File

@ -358,7 +358,7 @@ export default {
watch: {
form: {
handler(val) {
if (val && this.$store.state.testCaseMap) {
if (val && this.$store.state.testCaseMap && this.form.id) {
let change = this.$store.state.testCaseMap.get(this.form.id);
change = change + 1;
this.$store.state.testCaseMap.set(this.form.id, change);
@ -368,7 +368,7 @@ export default {
},
'testCaseTemplate.customFields': {
handler(val) {
if (val && this.$store.state.testCaseMap) {
if (val && this.$store.state.testCaseMap && this.form.id) {
let change = this.$store.state.testCaseMap.get(this.form.id);
change = change + 1;
this.$store.state.testCaseMap.set(this.form.id, change);
@ -404,7 +404,10 @@ export default {
if (!(this.$store.state.testCaseMap instanceof Map)) {
this.$store.state.testCaseMap = new Map();
}
this.$store.state.testCaseMap.set(this.form.id, 0);
if (this.form.id) {
this.$store.state.testCaseMap.set(this.form.id, 0);
}
},
created() {
if (!this.projectList || this.projectList.length === 0) { //
@ -513,7 +516,9 @@ export default {
if (!this.form.remark) {
this.form.remark = "";
}
this.$store.state.testCaseMap.set(this.form.id, 0);
if (this.form.id) {
this.$store.state.testCaseMap.set(this.form.id, 0);
}
},
handleCommand(e) {
if (e === "ADD_AND_CREATE") {
@ -560,7 +565,9 @@ export default {
this.isStepTableAlive = false;
this.$nextTick(() => {
this.isStepTableAlive = true;
this.$store.state.testCaseMap.set(this.form.id, 0);
if (this.form.id) {
this.$store.state.testCaseMap.set(this.form.id, 0);
}
});
},
reloadForm() {