fix(测试用例): 保存用例后Tab名称未更新

This commit is contained in:
shiziyuan9527 2021-06-03 16:51:45 +08:00 committed by 刘瑞斌
parent f77ec0dd2c
commit ee33703457
3 changed files with 23 additions and 17 deletions

View File

@ -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;
}
}
}
},

View File

@ -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);
});

View File

@ -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() {