fix(接口自动化): 修改不同项目类型跳转项目与类型显示

--bug=1008454 --user=郭雨琦 项目A导入项目B中的场景,项目B的id链接跳转后仍显示项目A --bug=1008453
【接口自动化】-dubbo 的ID链接跳转协议显示不正确,是http协议
This commit is contained in:
guoyuqi 2021-12-01 19:08:54 +08:00 committed by xiaomeinvG
parent 22f9a55d17
commit ffbec714ae
7 changed files with 34 additions and 12 deletions

View File

@ -98,6 +98,7 @@
<script> <script>
import {getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils"; import {getCurrentProjectID, getCurrentUser, getUUID, hasPermission} from "@/common/js/utils";
import {PROJECT_ID} from "@/common/js/constants";
export default { export default {
name: "ApiAutomation", name: "ApiAutomation",
@ -149,6 +150,12 @@ export default {
initApiTableOpretion: 'init', initApiTableOpretion: 'init',
}; };
}, },
created() {
let projectId = this.$route.params.projectId;
if(projectId){
sessionStorage.setItem(PROJECT_ID, projectId);
}
},
mounted() { mounted() {
this.getProject(); this.getProject();
this.getTrashCase(); this.getTrashCase();

View File

@ -637,7 +637,7 @@ export default {
if(resource.refType&&resource.refType==='API'){ if(resource.refType&&resource.refType==='API'){
let definitionData = this.$router.resolve({ let definitionData = this.$router.resolve({
name: 'ApiDefinition', name: 'ApiDefinition',
params: {redirectID: getUUID(), dataType: "api", dataSelectRange: 'edit:' + resource.id} params: {redirectID: getUUID(), dataType: "api", dataSelectRange: 'edit:' + resource.id,projectId:resource.projectId,type:resource.protocol}
}); });
window.open(definitionData.href, '_blank'); window.open(definitionData.href, '_blank');
}else if(resource.refType&&resource.refType==='CASE'){ }else if(resource.refType&&resource.refType==='CASE'){

View File

@ -273,7 +273,7 @@ export default {
clickResource(resource) { clickResource(resource) {
let automationData = this.$router.resolve({ let automationData = this.$router.resolve({
name: 'ApiAutomation', name: 'ApiAutomation',
params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id} params: {redirectID: getUUID(), dataType: "scenario", dataSelectRange: 'edit:' + resource.id,projectId:resource.projectId}
}); });
window.open(automationData.href, '_blank'); window.open(automationData.href, '_blank');
}, },

View File

@ -18,7 +18,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId; url += "/api/definition?resourceId=" + resourceId;
break; break;
case "CASE": case "CASE":
url += "/api/definition?caseId=" + d.id; url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break; break;
} }
break; break;
@ -28,7 +28,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId; url += "/api/definition?resourceId=" + resourceId;
break; break;
case "CASE": case "CASE":
url += "/api/definition?caseId=" + d.id; url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break; break;
} }
break; break;
@ -38,7 +38,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId; url += "/api/definition?resourceId=" + resourceId;
break; break;
case "CASE": case "CASE":
url += "/api/definition?caseId=" + d.id; url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break; break;
} }
break; break;
@ -48,7 +48,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId; url += "/api/definition?resourceId=" + resourceId;
break; break;
case "CASE": case "CASE":
url += "/api/definition?caseId=" + d.id; url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break; break;
} }
break; break;
@ -58,7 +58,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId; url += "/api/definition?resourceId=" + resourceId;
break; break;
case "CASE": case "CASE":
url += "/api/definition?caseId=" + d.id; url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break; break;
} }
break; break;

View File

@ -254,6 +254,7 @@ import MockConfig from "@/business/components/api/definition/components/mock/Moc
import ApiSchedule from "@/business/components/api/definition/components/import/ApiSchedule"; import ApiSchedule from "@/business/components/api/definition/components/import/ApiSchedule";
import MsEditCompleteContainer from "./components/EditCompleteContainer"; import MsEditCompleteContainer from "./components/EditCompleteContainer";
import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect"; import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect";
import {PROJECT_ID} from "@/common/js/constants";
export default { export default {
@ -371,6 +372,7 @@ export default {
}, },
watch: { watch: {
currentProtocol() { currentProtocol() {
debugger
if (this.activeDom === 'right') { if (this.activeDom === 'right') {
this.activeDom = 'left'; this.activeDom = 'left';
} }
@ -397,6 +399,13 @@ export default {
}, },
}, },
created() { created() {
let projectId = this.$route.params.projectId;
if(projectId){
sessionStorage.setItem(PROJECT_ID, projectId);
}
if (this.$route.query.projectId){
sessionStorage.setItem(PROJECT_ID, this.$route.query.projectId);
}
this.getEnv(); this.getEnv();
// //
if (this.$route.query.caseId) { if (this.$route.query.caseId) {

View File

@ -145,11 +145,17 @@
}, },
methods: { methods: {
initProtocol() { initProtocol() {
this.$get('/api/module/getUserDefaultApiType/', response => { if(this.$route.params.type){
this.condition.protocol = response.data; this.condition.protocol = this.$route.params.type;
this.$emit('protocolChange', this.condition.protocol); this.$emit('protocolChange', this.condition.protocol);
this.list(); this.list();
}); }else {
this.$get('/api/module/getUserDefaultApiType/', response => {
this.condition.protocol = response.data;
this.$emit('protocolChange', this.condition.protocol);
this.list();
});
}
}, },
filter() { filter() {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);

View File

@ -40,12 +40,12 @@ export default {
}, },
{ {
path: "definition/:redirectID?/:dataType?/:dataSelectRange?", path: "definition/:redirectID?/:dataType?/:dataSelectRange?/:projectId?/:type?",
name: "ApiDefinition", name: "ApiDefinition",
component: () => import('@/business/components/api/definition/ApiDefinition'), component: () => import('@/business/components/api/definition/ApiDefinition'),
}, },
{ {
path: "automation/:redirectID?/:dataType?/:dataSelectRange?", path: "automation/:redirectID?/:dataType?/:dataSelectRange?/:projectId?",
name: "ApiAutomation", name: "ApiAutomation",
component: () => import('@/business/components/api/automation/ApiAutomation'), component: () => import('@/business/components/api/automation/ApiAutomation'),
}, },