From c7ce36f268d7022ea3385baff49f97d311116791 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:07:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E7=9F=A5=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89=EF=BC=8C=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=9A=84=E7=BC=BA=E9=99=B7=20(#18130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017085 --user=王孝刚 【接口管理】接口定义修改接口后提示信息跳转至编辑页面模块无提示请选择模块 https://www.tapd.cn/55049933/s/1248536 Co-authored-by: wxg0103 <727495428@qq.com> --- .../scenario/api/RelevanceScenarioList.vue | 14 +++++-------- .../api/definition/ApiDefinition.vue | 20 ++++++++++++++++++- .../definition/components/list/ApiList.vue | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/api/RelevanceScenarioList.vue b/frontend/src/business/components/api/automation/scenario/api/RelevanceScenarioList.vue index 6c03877972..42c2f71e74 100644 --- a/frontend/src/business/components/api/automation/scenario/api/RelevanceScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/api/RelevanceScenarioList.vue @@ -87,10 +87,7 @@ import MsApiReportDetail from "@/business/components/api/automation/report/ApiRe import MsTableMoreBtn from "@/business/components/api/automation/scenario/TableMoreBtn"; import PriorityTableItem from "@/business/components/track/common/tableItems/planview/PriorityTableItem"; import MsTableAdvSearchBar from "@/business/components/common/components/search/MsTableAdvSearchBar"; -import { - API_SCENARIO_CONFIGS, - TEST_PLAN_RELEVANCE_API_SCENARIO_CONFIGS -} from "@/business/components/common/components/search/search-components"; +import {API_SCENARIO_CONFIGS} from "@/business/components/common/components/search/search-components"; import {ENV_TYPE} from "@/common/js/constants"; import {getCurrentProjectID, hasLicense} from "@/common/js/utils"; import MsTable from "@/business/components/common/components/table/MsTable"; @@ -174,22 +171,21 @@ export default { this.getVersionOptions(); }, methods: { - search(projectId) { + search(currentProjectId) { this.selectRows = new Set(); this.condition.moduleIds = this.selectNodeIds; if (this.trashEnable) { this.condition.filters = {status: ["Trash"]}; this.condition.moduleIds = []; } - - if (projectId) { - this.projectId = projectId; - } if (this.projectId != null && typeof projectId === 'string') { this.condition.projectId = this.projectId; } else if (this.projectId != null) { this.condition.projectId = this.projectId; } + if (currentProjectId) { + this.condition.projectId = currentProjectId; + } let url = "/api/automation/list/" + this.currentPage + "/" + this.pageSize; if (this.condition.projectId) { diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 707caa9866..9418af867a 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -134,7 +134,7 @@ @handleTestCase="handleTestCase" @refreshTree="refreshTree" @changeSelectDataRangeAll="changeSelectDataRangeAll" - @editApi="editApi" + @editApiModule="editApiModule" @copyApi="copyApi" @handleCase="handleCase" @showExecResult="showExecResult" @@ -273,6 +273,7 @@ import ApiSchedule from "@/business/components/api/definition/components/import/ import MsEditCompleteContainer from "./components/EditCompleteContainer"; import MsEnvironmentSelect from "./components/case/MsEnvironmentSelect"; import {PROJECT_ID, WORKSPACE_ID} from "@/common/js/constants"; +import {buildTree} from "@/business/components/api/definition/model/NodeTree"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {}; @@ -808,6 +809,23 @@ export default { } } }, + editApiModule(row) { + if (this.moduleOptions && this.moduleOptions.length === 0) { + let url = "/api/module/list/" + (row.projectId ? row.projectId : this.projectId) + "/" + row.protocol; + this.$get(url, response => { + if (response.data) { + response.data.forEach(node => { + node.name = node.name === '未规划接口' ? this.$t('api_test.definition.unplanned_api') : node.name + buildTree(node, {path: ''}); + }); + this.moduleOptions = response.data; + } + this.editApi(row); + }); + } else { + this.editApi(row); + } + }, editApi(row) { const index = this.apiTabs.find(p => p.api && p.api.id === row.id); if (!index) { diff --git a/frontend/src/business/components/api/definition/components/list/ApiList.vue b/frontend/src/business/components/api/definition/components/list/ApiList.vue index efb1221f86..92ead3742f 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiList.vue @@ -777,7 +777,7 @@ export default { }, editApi(row) { - this.$emit('editApi', row); + this.$emit('editApiModule', row); }, handleCopy(row) { let obj = JSON.parse(JSON.stringify(row));