fix(测试跟踪): 用例库用例项目权限问题优化
--bug=1023636 --user=陈建星 【测试跟踪】公共用例库-当前用户对无项目权限的用例进行操作-问题汇总 https://www.tapd.cn/55049933/s/1340426
This commit is contained in:
parent
85f993cbb3
commit
58d3e27ab0
|
@ -205,6 +205,9 @@ export default {
|
|||
});
|
||||
},
|
||||
getTranslateOption(item) {
|
||||
if (!item) {
|
||||
return '';
|
||||
}
|
||||
if (Array.isArray(item)) {
|
||||
let arr = [];
|
||||
item.forEach((v) => {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 + "?";
|
||||
|
|
|
@ -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(() => {});
|
||||
},
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue