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(() => {