fix(测试跟踪): 用例库用例项目权限问题优化

--bug=1023636 --user=陈建星 【测试跟踪】公共用例库-当前用户对无项目权限的用例进行操作-问题汇总 https://www.tapd.cn/55049933/s/1340426
This commit is contained in:
chenjianxing 2023-02-22 11:51:24 +08:00 committed by CaptainB
parent a304d2c0ec
commit 0dccf22eca
5 changed files with 42 additions and 19 deletions

View File

@ -205,6 +205,9 @@ export default {
});
},
getTranslateOption(item) {
if (!item) {
return '';
}
if (Array.isArray(item)) {
let arr = [];
item.forEach((v) => {

View File

@ -79,7 +79,7 @@
</div>
<div
class="follow-row head-opt"
v-if="!showFollow"
v-if="!showFollow && !isPublicShow"
@click="saveFollow"
>
<div class="icon-row">
@ -89,7 +89,7 @@
</div>
<div
class="follow-row head-opt"
v-if="showFollow"
v-if="showFollow && !isPublicShow"
@click="saveFollow"
>
<div class="icon-row">
@ -150,7 +150,7 @@
<div
class="edit-public-row head-opt"
v-if="isPublicShow"
@click="editPublicCase()"
@click="editPublicCase"
>
<div class="icon-row">
<img src="/assets/module/figma/icon_edit_outlined.svg" alt="" />
@ -567,7 +567,7 @@ export default {
},
computed: {
routeProjectId() {
return this.$route.params.projectId;
return this.$route.query.projectId;
},
moduleOptions() {
return store.testCaseModuleOptions;
@ -795,16 +795,17 @@ export default {
this.checkVersionEnable();
},
editPublicCase(type) {
editPublicCase() {
//
getEditSimpleTestCase(this.caseId)
.then(() => {
openCaseEdit({caseId: this.caseId, type}, this);
openCaseEdit({caseId: this.caseId}, this);
})
.catch(() => {});
},
copyPublicCase() {
this.editPublicCase('copy');
// 使使 projectId
openCaseEdit({caseId: this.caseId, type: 'copy', projectId: getCurrentProjectID()}, this);
},
closePublicCase() {
this.$emit("close");
@ -986,11 +987,26 @@ export default {
});
} else {
this.projectId = this.routeProjectId;
//
if (this.isCopy || this.isAdd) {
// routeProjectId
if (this.routeProjectId) {
// projectId
if (getCurrentProjectID() !== this.projectId) {
setCurrentProjectID(this.projectId);
location.reload();
return;
}
} else {
// routeProjectId 使
this.projectId = getCurrentProjectID();
}
if (this.caseId) {
// copy
await getSimpleTestCase(this.caseId).then((response) => {
let testCase = response.data;
// ID
testCase.projectId = this.projectId;
});
}
} else if (this.caseId) {
//
@ -1559,7 +1575,7 @@ export default {
this.saveCase();
},
copyRow() {
openCaseEdit({caseId: this.testCase.id, type: 'copy'}, this);
openCaseEdit({caseId: this.testCase.id, type: 'copy', projectId: this.projectId}, this);
},
deleteRow() {
getTestCaseVersions(this.testCase.id)

View File

@ -844,8 +844,8 @@ export default {
reloadTable() {
this.$refs.table.resetHeader();
},
handleEdit(testCase, type) {
openCaseEdit({caseId: testCase.id, type}, this);
handleEdit(testCase) {
openCaseEdit({caseId: testCase.id}, this);
},
getCase(id) {
this.$refs.testCasePreview.open();
@ -870,7 +870,7 @@ export default {
});
},
handleCopy(testCase) {
this.handleEdit(testCase, 'copy');
openCaseEdit({caseId: testCase.id, type: 'copy', projectId: this.projectId}, this);
},
handleDelete(testCase) {
let title = this.$t('test_track.case.case_delete_completely_confirm') + ": " + testCase.name + "?";

View File

@ -447,11 +447,11 @@ export default {
callBackSelectAll(selection) {
this.selectCounts = this.$refs.table.selectDataCounts;
},
handleEdit(testCase, type) {
handleEdit(testCase) {
//
getEditSimpleTestCase(testCase.id)
.then(() => {
openCaseEdit({caseId: testCase.id, type}, this);
openCaseEdit({caseId: testCase.id}, this);
})
.catch(() => {});
},

View File

@ -64,7 +64,11 @@ export function openCaseEdit(query, v) {
if (!query.type) {
delete query.type;
}
if (query.type !== 'copy') {
// 编辑不带项目id会检查用例的权限
// 复制需要带项目id复制到当前项目包括用例库的复制
delete query.projectId;
}
let path = '/track/case/edit/' + query.caseId;
delete query.caseId;
let TestCaseData = v.$router.resolve({