fix: 编辑相同用例只开一个tab

This commit is contained in:
chenjianxing 2021-11-04 16:54:29 +08:00 committed by jianxing
parent 4bfb95e0d3
commit 049eddd540
1 changed files with 14 additions and 9 deletions

View File

@ -429,17 +429,22 @@ export default {
this.$refs.nodeTree.decrease(id);
},
editTestCase(testCase) {
this.type = "edit";
this.testCaseReadOnly = false;
if (testCase.label !== "redirect") {
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
const index = this.tabs.find(p => p.testCaseInfo && p.testCaseInfo.id === testCase.id);
if (!index) {
this.type = "edit";
this.testCaseReadOnly = false;
if (testCase.label !== "redirect") {
if (this.treeNodes.length < 1) {
this.$warning(this.$t('test_track.case.create_module_first'));
return;
}
}
let hasEditPermission = hasPermission('PROJECT_TRACK_CASE:READ+EDIT');
this.$set(testCase, 'rowClickHasPermission', hasEditPermission);
this.addTab({name: 'edit', testCaseInfo: testCase});
} else {
this.activeName = index.name;
}
let hasEditPermission = hasPermission('PROJECT_TRACK_CASE:READ+EDIT');
this.$set(testCase, 'rowClickHasPermission', hasEditPermission);
this.addTab({name: 'edit', testCaseInfo: testCase});
},
handleCaseCreateOrEdit(data, type) {
if (this.$refs.minder) {