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) { nodeChange(node) {
this.activeName = "default"; this.activeName = "default";
}, },
refreshTable() { refreshTable(data) {
if (this.$refs.testCaseList) { if (this.$refs.testCaseList) {
this.$refs.testCaseList.initTableData(); this.$refs.testCaseList.initTableData();
} }
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();
this.setTable(data);
}, },
editTestCase(testCase) { editTestCase(testCase) {
this.type = "edit"; this.type = "edit";
@ -345,10 +346,10 @@ export default {
refresh(data) { refresh(data) {
this.$store.commit('setTestCaseSelectNode', {}); this.$store.commit('setTestCaseSelectNode', {});
this.$store.commit('setTestCaseSelectNodeIds', []); this.$store.commit('setTestCaseSelectNodeIds', []);
this.refreshTable(); this.refreshTable(data);
this.setTable(data);
}, },
setTable(data) { setTable(data) {
if (data) {
for (let index in this.tabs) { for (let index in this.tabs) {
let tab = this.tabs[index]; let tab = this.tabs[index];
if (tab.name === this.activeName) { if (tab.name === this.activeName) {
@ -356,6 +357,7 @@ export default {
break; break;
} }
} }
}
}, },
refreshAll() { refreshAll() {
this.$refs.nodeTree.list(); this.$refs.nodeTree.list();

View File

@ -389,10 +389,11 @@
if (!valid) { if (!valid) {
this.saveCase(); this.saveCase();
} else { } else {
this.saveCase(); this.saveCase(function(t) {
let tab = {} let tab = {};
tab.name = 'add' tab.name = 'add';
this.$emit('addTab', tab) t.$emit('addTab', tab);
});
} }
}) })
} else { } else {
@ -571,7 +572,7 @@
removeGoBackListener(this.close); removeGoBackListener(this.close);
this.dialogFormVisible = false; this.dialogFormVisible = false;
}, },
saveCase() { saveCase(callback) {
let isValidate = true; let isValidate = true;
this.$refs['caseFrom'].validate((valid) => { this.$refs['caseFrom'].validate((valid) => {
if (!valid) { if (!valid) {
@ -586,10 +587,10 @@
} }
}); });
if (isValidate) { if (isValidate) {
this._saveCase(); this._saveCase(callback);
} }
}, },
_saveCase() { _saveCase(callback) {
let param = this.buildParam(); let param = this.buildParam();
if (this.validate(param)) { if (this.validate(param)) {
let option = this.getOption(param); let option = this.getOption(param);
@ -610,6 +611,10 @@
} else { } else {
this.$emit("caseEdit", param); this.$emit("caseEdit", param);
} }
if (callback) {
callback(this);
}
// //
this.$refs.otherInfo.getFileMetaData(this.form.id); this.$refs.otherInfo.getFileMetaData(this.form.id);
}); });

View File

@ -511,7 +511,6 @@ export default {
confirmButtonText: this.$t('commons.confirm'), confirmButtonText: this.$t('commons.confirm'),
callback: (action) => { callback: (action) => {
if (action === 'confirm') { if (action === 'confirm') {
this.$emit('refreshTable');
this._handleDelete(testCase); this._handleDelete(testCase);
} }
} }
@ -537,9 +536,9 @@ export default {
_handleDelete(testCase) { _handleDelete(testCase) {
let testCaseId = testCase.id; let testCaseId = testCase.id;
this.$post('/test/case/delete/' + testCaseId, {}, () => { this.$post('/test/case/delete/' + testCaseId, {}, () => {
this.$emit('refreshTable');
this.initTableData(); this.initTableData();
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
}); });
}, },
refresh() { refresh() {