diff --git a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue index 1a115a3a2d..81f6b5a194 100644 --- a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue +++ b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue @@ -2,6 +2,11 @@
+ +
+ {{ api.num }} +
+
{ + if (res.data) { + this.getWorkspaceId(resource, res.data, isTurnSpace, workspaceId); + } + }); + }, + checkPermission(resource, workspaceId, isTurnSpace) { + getOwnerProjectIds().then((res) => { + const project = res.data.find((p) => p === resource.projectId); + if (!project) { + this.$warning(this.$t('commons.no_permission')); + } else { + this.gotoTurn(resource, workspaceId, isTurnSpace); + } + }); + }, + getWorkspaceId(resource, data, isTurnSpace, workspaceId) { + resource.projectId = data.projectId; + if (data.projectId !== getCurrentProjectID()) { + isTurnSpace = false; + getProject(data.projectId).then((response) => { + if (response.data) { + workspaceId = response.data.workspaceId; + isTurnSpace = true; + this.checkPermission(resource, workspaceId, isTurnSpace); + } + }); + } else { + this.checkPermission(resource, workspaceId, isTurnSpace); + } + }, + gotoTurn(resource, workspaceId, isTurnSpace) { + if (resource.protocol === 'dubbo://') { + resource.protocol = 'DUBBO'; + } + let definitionData = this.$router.resolve({ + name: 'ApiDefinitionWithQuery', + params: { + versionId: 'default', + redirectID: getUUID(), + dataType: 'api', + dataSelectRange: 'edit:' + resource.id, + projectId: resource.projectId, + type: resource.protocol, + workspaceId: workspaceId, + }, + }); + if (isTurnSpace) { + window.open(definitionData.href, '_blank'); + } + }, }, };