From 45737dbed1184ae1184ee5afa74b6ba220780301 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 24 Mar 2023 15:40:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=90=8E=E6=A8=A1=E5=9D=97=E6=A0=91=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=B7=9F=E7=9D=80=E5=88=B7=E6=96=B0=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1020480 --user=王孝刚 【接口测试】github #20341接口测试首页-未覆盖链接无法根据协议类型准确筛选并显示,很容易造成误解 https://www.tapd.cn/55049933/s/1355617 --- .../service/definition/ApiModuleService.java | 5 +- .../definition/components/list/ApiList.vue | 70 ++++++++++--------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiModuleService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiModuleService.java index bd9c851035..2bba469d93 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiModuleService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiModuleService.java @@ -153,11 +153,14 @@ public class ApiModuleService extends NodeTreeService { request.setProtocol(protocol); Map> filters = new LinkedHashMap<>(); filters.put(ApiTestConstants.STATUS, ApiTestConstants.STATUS_ALL); - request.setFilters(filters); + if (MapUtils.isEmpty(request.getFilters()) || !request.getFilters().containsKey(ApiTestConstants.STATUS)) { + request.setFilters(filters); + } request.setModuleIds(new ArrayList<>()); if (StringUtils.isNotBlank(versionId)) { request.setVersionId(versionId); } + apiDefinitionService.checkFilterHasCoverage(request); List countMNodes = extApiDefinitionMapper.moduleCountByCollection(request); return getNodeTrees(apiModules, getCountMap(countMNodes)); } diff --git a/api-test/frontend/src/business/definition/components/list/ApiList.vue b/api-test/frontend/src/business/definition/components/list/ApiList.vue index 585e477bba..6692b78149 100644 --- a/api-test/frontend/src/business/definition/components/list/ApiList.vue +++ b/api-test/frontend/src/business/definition/components/list/ApiList.vue @@ -47,7 +47,7 @@ :fields-width="fieldsWidth" v-if="this.trashEnable" :label="$t('commons.delete_user')" - min-width="120" /> + min-width="120"/> @@ -183,7 +183,7 @@ :field="item" :fields-width="fieldsWidth" min-width="100px" - :label="$t('api_test.definition.api_case_number')" /> + :label="$t('api_test.definition.api_case_number')"/> @@ -220,9 +220,9 @@ :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize" - :total="total" /> + :total="total"/> - + { - buildNodePath(node, { path: '' }, moduleOptions); + buildNodePath(node, {path: ''}, moduleOptions); }); return moduleOptions; }, @@ -571,23 +571,25 @@ export default { } if (this.trashEnable) { this.tableOperatorButtons = this.tableTrashOperatorButtons; - this.condition.filters = { status: ['Trash'] }; + this.condition.filters = {status: ['Trash']}; } else { this.tableOperatorButtons = this.tableUsualOperatorButtons; - this.condition.filters = { status: ['Prepare', 'Underway', 'Completed'] }; + this.condition.filters = {status: ['Prepare', 'Underway', 'Completed']}; } this.condition.orders = getLastTableSortField(this.tableHeaderKey); // 切换tab之后版本查询 this.condition.versionId = this.currentVersion; let protocol; if (this.$route && this.$route.params && this.$route.params.type) { - protocol = this.$route.params.type; + protocol = this.$route.params.type; } this.initTable(protocol); this.getMaintainerOptions(); this.getVersionOptions(); this.checkVersionEnable(); this.getProtocolFilter(); + //为了跳转的时候把参数传递到模块 + this.$EventBus.$emit('apiConditionBus', this.condition); // 通知过来的数据跳转到编辑 if (this.$route.query.resourceId) { @@ -625,7 +627,7 @@ export default { trashEnable() { if (this.trashEnable) { this.tableOperatorButtons = this.tableTrashOperatorButtons; - this.condition.filters = { status: ['Trash'] }; + this.condition.filters = {status: ['Trash']}; this.condition.moduleIds = []; } else { this.tableOperatorButtons = this.tableUsualOperatorButtons; @@ -642,7 +644,7 @@ export default { setAdvSearchParam() { let comp = this.condition.components.find((c) => c.key === 'moduleIds'); if (comp) { - comp.options.params = { protocol: this.currentProtocol }; + comp.options.params = {protocol: this.currentProtocol}; } let method = this.condition.components.find((c) => c.key === 'method'); if (method) { @@ -699,7 +701,7 @@ export default { this.condition.projectId = this.projectId; if (currentProtocol && ["HTTP", "DUBBO", "SQL", "TCP"].includes(currentProtocol)) { this.condition.protocol = currentProtocol; - }else if (this.currentProtocol != null) { + } else if (this.currentProtocol != null) { this.condition.protocol = this.currentProtocol; } this.enableOrderDrag = !(this.condition.orders && this.condition.orders.length > 0); @@ -862,7 +864,7 @@ export default { getMaintainer().then((response) => { this.valueArr.userId = response.data; this.userFilters = response.data.map((u) => { - return { text: u.name, value: u.id }; + return {text: u.name, value: u.id}; }); }); }, @@ -873,11 +875,11 @@ export default { this.versionFilters = response.data .filter((u) => u.id === currentVersion) .map((u) => { - return { text: u.name, value: u.id }; + return {text: u.name, value: u.id}; }); } else { this.versionFilters = response.data.map((u) => { - return { text: u.name, value: u.id }; + return {text: u.name, value: u.id}; }); } }); @@ -957,7 +959,7 @@ export default { }, reductionApi(row) { let tmp = JSON.parse(JSON.stringify(row)); - let rows = { ids: [tmp.id] }; + let rows = {ids: [tmp.id]}; rows.projectId = getCurrentProjectID(); rows.protocol = this.currentProtocol; definitionReduction(rows).then(() => {