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

View File

@ -637,7 +637,7 @@ export default {
if(resource.refType&&resource.refType==='API'){
let definitionData = this.$router.resolve({
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');
}else if(resource.refType&&resource.refType==='CASE'){

View File

@ -273,7 +273,7 @@ export default {
clickResource(resource) {
let automationData = this.$router.resolve({
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');
},

View File

@ -18,7 +18,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId;
break;
case "CASE":
url += "/api/definition?caseId=" + d.id;
url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break;
}
break;
@ -28,7 +28,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId;
break;
case "CASE":
url += "/api/definition?caseId=" + d.id;
url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break;
}
break;
@ -38,7 +38,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId;
break;
case "CASE":
url += "/api/definition?caseId=" + d.id;
url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break;
}
break;
@ -48,7 +48,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId;
break;
case "CASE":
url += "/api/definition?caseId=" + d.id;
url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
break;
}
break;
@ -58,7 +58,7 @@ export function getUrl(d) {
url += "/api/definition?resourceId=" + resourceId;
break;
case "CASE":
url += "/api/definition?caseId=" + d.id;
url += "/api/definition?caseId=" + d.id+"&projectId="+d.projectId;
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 MsEditCompleteContainer from "./components/EditCompleteContainer";
import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect";
import {PROJECT_ID} from "@/common/js/constants";
export default {
@ -371,6 +372,7 @@ export default {
},
watch: {
currentProtocol() {
debugger
if (this.activeDom === 'right') {
this.activeDom = 'left';
}
@ -397,6 +399,13 @@ export default {
},
},
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();
//
if (this.$route.query.caseId) {

View File

@ -145,11 +145,17 @@
},
methods: {
initProtocol() {
this.$get('/api/module/getUserDefaultApiType/', response => {
this.condition.protocol = response.data;
if(this.$route.params.type){
this.condition.protocol = this.$route.params.type;
this.$emit('protocolChange', this.condition.protocol);
this.list();
});
}else {
this.$get('/api/module/getUserDefaultApiType/', response => {
this.condition.protocol = response.data;
this.$emit('protocolChange', this.condition.protocol);
this.list();
});
}
},
filter() {
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",
component: () => import('@/business/components/api/definition/ApiDefinition'),
},
{
path: "automation/:redirectID?/:dataType?/:dataSelectRange?",
path: "automation/:redirectID?/:dataType?/:dataSelectRange?/:projectId?",
name: "ApiAutomation",
component: () => import('@/business/components/api/automation/ApiAutomation'),
},