diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 8016a97d25..0903f68ceb 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -296,11 +296,12 @@ export default { nodeChange(node) { this.activeName = "default"; }, - refreshTable() { + refreshTable(data) { if (this.$refs.testCaseList) { this.$refs.testCaseList.initTableData(); } this.$refs.nodeTree.list(); + this.setTable(data); }, editTestCase(testCase) { this.type = "edit"; @@ -345,15 +346,16 @@ export default { refresh(data) { this.$store.commit('setTestCaseSelectNode', {}); this.$store.commit('setTestCaseSelectNodeIds', []); - this.refreshTable(); - this.setTable(data); + this.refreshTable(data); }, setTable(data) { - for (let index in this.tabs) { - let tab = this.tabs[index]; - if (tab.name === this.activeName) { - tab.label = data.name; - break; + if (data) { + for (let index in this.tabs) { + let tab = this.tabs[index]; + if (tab.name === this.activeName) { + tab.label = data.name; + break; + } } } }, diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 9219b63b41..f19c87a0f0 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -389,10 +389,11 @@ if (!valid) { this.saveCase(); } else { - this.saveCase(); - let tab = {} - tab.name = 'add' - this.$emit('addTab', tab) + this.saveCase(function(t) { + let tab = {}; + tab.name = 'add'; + t.$emit('addTab', tab); + }); } }) } else { @@ -571,7 +572,7 @@ removeGoBackListener(this.close); this.dialogFormVisible = false; }, - saveCase() { + saveCase(callback) { let isValidate = true; this.$refs['caseFrom'].validate((valid) => { if (!valid) { @@ -586,10 +587,10 @@ } }); if (isValidate) { - this._saveCase(); + this._saveCase(callback); } }, - _saveCase() { + _saveCase(callback) { let param = this.buildParam(); if (this.validate(param)) { let option = this.getOption(param); @@ -610,6 +611,10 @@ } else { this.$emit("caseEdit", param); } + + if (callback) { + callback(this); + } // 保存用例后刷新附件 this.$refs.otherInfo.getFileMetaData(this.form.id); }); diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index a7951d3ef5..50c6cec45d 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -511,7 +511,6 @@ export default { confirmButtonText: this.$t('commons.confirm'), callback: (action) => { if (action === 'confirm') { - this.$emit('refreshTable'); this._handleDelete(testCase); } } @@ -537,9 +536,9 @@ export default { _handleDelete(testCase) { let testCaseId = testCase.id; this.$post('/test/case/delete/' + testCaseId, {}, () => { + this.$emit('refreshTable'); this.initTableData(); this.$success(this.$t('commons.delete_success')); - }); }, refresh() {