fix(接口测试): 解决场景编辑-接口列表导入-切换工作空间后点击模块-模块树发生变更的问题

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001017124
This commit is contained in:
guoyuqi 2022-09-23 10:33:55 +08:00 committed by xiaomeinvG
parent 607e370d03
commit c2f7147977
3 changed files with 33 additions and 7 deletions

View File

@ -10,6 +10,7 @@
@protocolChange="handleProtocolChange" @protocolChange="handleProtocolChange"
@refreshTable="refresh" @refreshTable="refresh"
@setModuleOptions="setModuleOptions" @setModuleOptions="setModuleOptions"
:select-project-id="projectId"
:is-relevance="true" :is-relevance="true"
:is-read-only="true" :is-read-only="true"
ref="nodeTree"/> ref="nodeTree"/>
@ -90,9 +91,9 @@ export default {
ScenarioRelevanceApiList, ScenarioRelevanceApiList,
MsMainContainer, MsAsideContainer, MsContainer, MsApiModule, ScenarioRelevanceCaseList MsMainContainer, MsAsideContainer, MsContainer, MsApiModule, ScenarioRelevanceCaseList
}, },
props:{ props: {
isAcrossSpace:{ isAcrossSpace: {
type:Boolean, type: Boolean,
default() { default() {
return false; return false;
} }
@ -234,6 +235,7 @@ export default {
/deep/ .filter-input { /deep/ .filter-input {
width: 140px !important; width: 140px !important;
} }
.version-select { .version-select {
padding-left: 10px; padding-left: 10px;
} }

View File

@ -35,6 +35,7 @@
:options="options" :options="options"
:total="total" :total="total"
:is-trash-data="isTrashData" :is-trash-data="isTrashData"
:select-project-id="projectId"
@exportAPI="exportAPI" @exportAPI="exportAPI"
@saveAsEdit="saveAsEdit" @saveAsEdit="saveAsEdit"
@refreshTable="$emit('refreshTable')" @refreshTable="$emit('refreshTable')"
@ -115,6 +116,12 @@ export default {
default() { default() {
return OPTIONS; return OPTIONS;
} }
},
selectProjectId: {
type: String,
default() {
return getCurrentProjectID();
}
} }
}, },
computed: { computed: {
@ -128,7 +135,11 @@ export default {
return this.reviewId ? true : false; return this.reviewId ? true : false;
}, },
projectId() { projectId() {
return getCurrentProjectID(); if (this.selectProjectId) {
return this.selectProjectId;
} else {
return getCurrentProjectID();
}
} }
}, },
mounted() { mounted() {
@ -202,6 +213,9 @@ export default {
this.$refs.nodeTree.filter(this.condition.filterText); this.$refs.nodeTree.filter(this.condition.filterText);
}, },
list(projectId) { list(projectId) {
if (!projectId) {
projectId = this.projectId ? this.projectId : getCurrentProjectID();
}
let url = undefined; let url = undefined;
if (this.isPlanModel) { if (this.isPlanModel) {
url = '/api/module/list/plan/' + this.planId + '/' + this.condition.protocol; url = '/api/module/list/plan/' + this.planId + '/' + this.condition.protocol;
@ -209,10 +223,10 @@ export default {
url = "/api/module/list/" + this.relevanceProjectId + "/" + this.condition.protocol + url = "/api/module/list/" + this.relevanceProjectId + "/" + this.condition.protocol +
(this.currentVersion ? '/' + this.currentVersion : ''); (this.currentVersion ? '/' + this.currentVersion : '');
} else if (this.isTrashData) { } else if (this.isTrashData) {
url = "/api/module/trash/list/" + (projectId ? projectId : this.projectId) + "/" + this.condition.protocol + url = "/api/module/trash/list/" + projectId + "/" + this.condition.protocol +
(this.currentVersion ? '/' + this.currentVersion : ''); (this.currentVersion ? '/' + this.currentVersion : '');
} else { } else {
url = "/api/module/list/" + (projectId ? projectId : this.projectId) + "/" + this.condition.protocol + url = "/api/module/list/" + projectId + "/" + this.condition.protocol +
(this.currentVersion ? '/' + this.currentVersion : ''); (this.currentVersion ? '/' + this.currentVersion : '');
if (!this.projectId) { if (!this.projectId) {
return; return;

View File

@ -179,11 +179,21 @@ export default {
default() { default() {
return OPTIONS; return OPTIONS;
} }
},
selectProjectId: {
type: String,
default() {
return getCurrentProjectID();
}
} }
}, },
computed: { computed: {
projectId() { projectId() {
return getCurrentProjectID(); if (this.selectProjectId) {
return this.selectProjectId;
} else {
return getCurrentProjectID();
}
}, },
showTrashNode() { showTrashNode() {
return (!this.isReadOnly && !this.isTrashData); return (!this.isReadOnly && !this.isTrashData);