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) {
|
getTranslateOption(item) {
|
||||||
|
if (!item) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
item.forEach((v) => {
|
item.forEach((v) => {
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="follow-row head-opt"
|
class="follow-row head-opt"
|
||||||
v-if="!showFollow"
|
v-if="!showFollow && !isPublicShow"
|
||||||
@click="saveFollow"
|
@click="saveFollow"
|
||||||
>
|
>
|
||||||
<div class="icon-row">
|
<div class="icon-row">
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="follow-row head-opt"
|
class="follow-row head-opt"
|
||||||
v-if="showFollow"
|
v-if="showFollow && !isPublicShow"
|
||||||
@click="saveFollow"
|
@click="saveFollow"
|
||||||
>
|
>
|
||||||
<div class="icon-row">
|
<div class="icon-row">
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
<div
|
<div
|
||||||
class="edit-public-row head-opt"
|
class="edit-public-row head-opt"
|
||||||
v-if="isPublicShow"
|
v-if="isPublicShow"
|
||||||
@click="editPublicCase()"
|
@click="editPublicCase"
|
||||||
>
|
>
|
||||||
<div class="icon-row">
|
<div class="icon-row">
|
||||||
<img src="/assets/module/figma/icon_edit_outlined.svg" alt="" />
|
<img src="/assets/module/figma/icon_edit_outlined.svg" alt="" />
|
||||||
|
@ -567,7 +567,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
routeProjectId() {
|
routeProjectId() {
|
||||||
return this.$route.params.projectId;
|
return this.$route.query.projectId;
|
||||||
},
|
},
|
||||||
moduleOptions() {
|
moduleOptions() {
|
||||||
return store.testCaseModuleOptions;
|
return store.testCaseModuleOptions;
|
||||||
|
@ -795,16 +795,17 @@ export default {
|
||||||
|
|
||||||
this.checkVersionEnable();
|
this.checkVersionEnable();
|
||||||
},
|
},
|
||||||
editPublicCase(type) {
|
editPublicCase() {
|
||||||
// 这个接口会校验权限
|
// 这个接口会校验权限
|
||||||
getEditSimpleTestCase(this.caseId)
|
getEditSimpleTestCase(this.caseId)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
openCaseEdit({caseId: this.caseId, type}, this);
|
openCaseEdit({caseId: this.caseId}, this);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
copyPublicCase() {
|
copyPublicCase() {
|
||||||
this.editPublicCase('copy');
|
// 这里复制使用当前项目,不使用 projectId ,可能没有权限
|
||||||
|
openCaseEdit({caseId: this.caseId, type: 'copy', projectId: getCurrentProjectID()}, this);
|
||||||
},
|
},
|
||||||
closePublicCase() {
|
closePublicCase() {
|
||||||
this.$emit("close");
|
this.$emit("close");
|
||||||
|
@ -986,11 +987,26 @@ export default {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.projectId = this.routeProjectId;
|
this.projectId = this.routeProjectId;
|
||||||
if (this.routeProjectId) {
|
// 创建和复制
|
||||||
// 创建时会带 projectId,校验是否是当前项目
|
if (this.isCopy || this.isAdd) {
|
||||||
if (getCurrentProjectID() !== this.projectId) {
|
// 带了 routeProjectId 校验是否是当前项目
|
||||||
setCurrentProjectID(this.projectId);
|
if (this.routeProjectId) {
|
||||||
location.reload();
|
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) {
|
} else if (this.caseId) {
|
||||||
// 接口会校验是否有改用例的编辑权限
|
// 接口会校验是否有改用例的编辑权限
|
||||||
|
@ -1559,7 +1575,7 @@ export default {
|
||||||
this.saveCase();
|
this.saveCase();
|
||||||
},
|
},
|
||||||
copyRow() {
|
copyRow() {
|
||||||
openCaseEdit({caseId: this.testCase.id, type: 'copy'}, this);
|
openCaseEdit({caseId: this.testCase.id, type: 'copy', projectId: this.projectId}, this);
|
||||||
},
|
},
|
||||||
deleteRow() {
|
deleteRow() {
|
||||||
getTestCaseVersions(this.testCase.id)
|
getTestCaseVersions(this.testCase.id)
|
||||||
|
|
|
@ -844,8 +844,8 @@ export default {
|
||||||
reloadTable() {
|
reloadTable() {
|
||||||
this.$refs.table.resetHeader();
|
this.$refs.table.resetHeader();
|
||||||
},
|
},
|
||||||
handleEdit(testCase, type) {
|
handleEdit(testCase) {
|
||||||
openCaseEdit({caseId: testCase.id, type}, this);
|
openCaseEdit({caseId: testCase.id}, this);
|
||||||
},
|
},
|
||||||
getCase(id) {
|
getCase(id) {
|
||||||
this.$refs.testCasePreview.open();
|
this.$refs.testCasePreview.open();
|
||||||
|
@ -870,7 +870,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleCopy(testCase) {
|
handleCopy(testCase) {
|
||||||
this.handleEdit(testCase, 'copy');
|
openCaseEdit({caseId: testCase.id, type: 'copy', projectId: this.projectId}, this);
|
||||||
},
|
},
|
||||||
handleDelete(testCase) {
|
handleDelete(testCase) {
|
||||||
let title = this.$t('test_track.case.case_delete_completely_confirm') + ": " + testCase.name + "?";
|
let title = this.$t('test_track.case.case_delete_completely_confirm') + ": " + testCase.name + "?";
|
||||||
|
|
|
@ -447,11 +447,11 @@ export default {
|
||||||
callBackSelectAll(selection) {
|
callBackSelectAll(selection) {
|
||||||
this.selectCounts = this.$refs.table.selectDataCounts;
|
this.selectCounts = this.$refs.table.selectDataCounts;
|
||||||
},
|
},
|
||||||
handleEdit(testCase, type) {
|
handleEdit(testCase) {
|
||||||
// 这个接口会校验权限
|
// 这个接口会校验权限
|
||||||
getEditSimpleTestCase(testCase.id)
|
getEditSimpleTestCase(testCase.id)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
openCaseEdit({caseId: testCase.id, type}, this);
|
openCaseEdit({caseId: testCase.id}, this);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,7 +64,11 @@ export function openCaseEdit(query, v) {
|
||||||
if (!query.type) {
|
if (!query.type) {
|
||||||
delete query.type;
|
delete query.type;
|
||||||
}
|
}
|
||||||
delete query.projectId;
|
if (query.type !== 'copy') {
|
||||||
|
// 编辑不带项目id,会检查用例的权限
|
||||||
|
// 复制需要带项目id,复制到当前项目,包括用例库的复制
|
||||||
|
delete query.projectId;
|
||||||
|
}
|
||||||
let path = '/track/case/edit/' + query.caseId;
|
let path = '/track/case/edit/' + query.caseId;
|
||||||
delete query.caseId;
|
delete query.caseId;
|
||||||
let TestCaseData = v.$router.resolve({
|
let TestCaseData = v.$router.resolve({
|
||||||
|
|
Loading…
Reference in New Issue