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));