diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 72d3a06e38..edb7e5ec9b 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -306,6 +306,9 @@ or test_case.num like CONCAT('%', #{request.name},'%') or test_case.tags like CONCAT('%', #{request.name},'%')) + + AND test_case.create_time >= #{request.createTime} + and test_case.node_id in @@ -316,6 +319,12 @@ and test_case.project_id = #{request.projectId} + + and test_case.test_id is null and test_case.type != 'functional' + + + and test_case.test_id is not null and test_case.type != 'functional' + diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java index e0b265d662..e024a581b0 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/QueryTestCaseRequest.java @@ -22,4 +22,10 @@ public class QueryTestCaseRequest extends BaseQueryRequest { private String userId; private String reviewId; + + private boolean isSelectThisWeedData = false; + + private String caseCoverage; + + private long createTime = 0; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index ba87ffbfb4..42db5f06e8 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -5,7 +5,6 @@ import com.alibaba.excel.EasyExcelFactory; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.github.pagehelper.PageHelper; -import io.metersphere.api.dto.definition.ApiBatchRequest; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; @@ -14,10 +13,7 @@ import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.constants.TestCaseReviewStatus; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.user.SessionUser; -import io.metersphere.commons.utils.BeanUtils; -import io.metersphere.commons.utils.LogUtil; -import io.metersphere.commons.utils.ServiceUtils; -import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.commons.utils.*; import io.metersphere.controller.request.OrderRequest; import io.metersphere.excel.domain.ExcelErrData; import io.metersphere.excel.domain.ExcelResponse; @@ -189,6 +185,7 @@ public class TestCaseService { } public List listTestCase(QueryTestCaseRequest request) { + this.initRequest(request, true); List orderList = ServiceUtils.getDefaultOrder(request.getOrders()); OrderRequest order = new OrderRequest(); // 对模板导入的测试用例排序 @@ -199,6 +196,25 @@ public class TestCaseService { return extTestCaseMapper.list(request); } + /** + * 初始化部分参数 + * + * @param request + * @param checkThisWeekData + * @return + */ + private void initRequest(QueryTestCaseRequest request, boolean checkThisWeekData) { + if (checkThisWeekData) { + if (request.isSelectThisWeedData()) { + Map weekFirstTimeAndLastTime = DateUtils.getWeedFirstTimeAndLastTime(new Date()); + Date weekFirstTime = weekFirstTimeAndLastTime.get("firstTime"); + if (weekFirstTime != null) { + request.setCreateTime(weekFirstTime.getTime()); + } + } + } + } + public List listTestCaseMthod(QueryTestCaseRequest request) { return extTestCaseMapper.listByMethod(request); } diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 653d8be041..2b658eae4e 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -136,5 +136,8 @@ update schedule sch inner join load_test ldt on update schedule sch inner join api_test apiTest on apiTest.id = sch.resource_id set sch.name = apiTest.name; +update schedule sch inner join swagger_url_project sup on + sup.id = sch.resource_id + set sch.name = LEFT(SUBSTRING_INDEX(sup.swagger_url, '/', 3), 100); -- delete an unused colum alter table schedule drop column custom_data; \ No newline at end of file diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 02cd375d81..13483fd82c 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -312,6 +312,7 @@ export default { currentCaseId: null, projectId: "", selectDataCounts: 0, + selectDataRange: "all" } }, props: { @@ -326,10 +327,27 @@ export default { }, moduleOptions: { type: Array + }, + trashEnable: { + type: Boolean, + default: false, } }, created: function () { this.$emit('setCondition', this.condition); + if (this.trashEnable) { + this.condition.filters = {status: ["Trash"]}; + } else { + this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]}; + } + this.initTableData(); + }, + activated() { + if (this.trashEnable) { + this.condition.filters = {status: ["Trash"]}; + } else { + this.condition.filters = {status: ["Prepare", "Pass", "UnPass"]}; + } this.initTableData(); }, watch: { @@ -345,6 +363,11 @@ export default { customHeader() { this.$refs.headerCustom.open(this.tableLabel) }, + getSelectDataRange() { + let dataRange = this.$route.params.dataSelectRange; + let dataType = this.$route.params.dataType; + this.selectDataRange = dataType === 'case' ? dataRange : 'all'; + }, initTableData() { this.projectId = getCurrentProjectID(); this.condition.planId = ""; @@ -363,6 +386,29 @@ export default { this.getData(); }, getData() { + this.getSelectDataRange(); + this.condition.selectThisWeedData = false; + this.condition.caseCoverage = null; + switch (this.selectDataRange) { + case 'thisWeekCount': + this.condition.selectThisWeedData = true; + break; + case 'uncoverage': + this.condition.caseCoverage = 'uncoverage'; + break; + case 'coverage': + this.condition.caseCoverage = 'coverage'; + break; + case 'Prepare': + this.condition.filters.status = [this.selectDataRange]; + break; + case 'Pass': + this.condition.filters.status = [this.selectDataRange]; + break; + case 'UnPass': + this.condition.filters.status = [this.selectDataRange]; + break; + } if (this.projectId) { this.condition.projectId = this.projectId; this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => { diff --git a/frontend/src/business/components/track/home/TrackHome.vue b/frontend/src/business/components/track/home/TrackHome.vue index 084aff62dd..4d50ed46c2 100644 --- a/frontend/src/business/components/track/home/TrackHome.vue +++ b/frontend/src/business/components/track/home/TrackHome.vue @@ -29,12 +29,12 @@
- +
- +
@@ -73,7 +73,7 @@ import MsMainContainer from "@/business/components/common/components/MsMainConta import MsContainer from "@/business/components/common/components/MsContainer"; import CaseCountCard from "@/business/components/track/home/components/CaseCountCard"; import RelevanceCaseCard from "@/business/components/track/home/components/RelevanceCaseCard"; -import {getCurrentProjectID} from "@/common/js/utils"; +import {getCurrentProjectID, getUUID} from "@/common/js/utils"; import CaseMaintenance from "@/business/components/track/home/components/CaseMaintenance"; import {COUNT_NUMBER, COUNT_NUMBER_SHALLOW} from "@/common/js/constants"; import BugCountCard from "@/business/components/track/home/components/BugCountCard"; @@ -185,8 +185,14 @@ export default { }] }; this.caseOption = option; + }, + redirectPage(page,dataType,selectType){ + switch (page){ + case "case": + this.$router.push({name:'testCase',params:{dataType:dataType,dataSelectRange:selectType, projectId: getCurrentProjectID()}}); + break; + } } - } } diff --git a/frontend/src/business/components/track/home/components/CaseCountCard.vue b/frontend/src/business/components/track/home/components/CaseCountCard.vue index b1caeed243..fe96b3d429 100644 --- a/frontend/src/business/components/track/home/components/CaseCountCard.vue +++ b/frontend/src/business/components/track/home/components/CaseCountCard.vue @@ -83,27 +83,27 @@ - {{$t('api_test.home_page.detail_card.running')}} + 未评审 {{"\xa0\xa0"}} - + {{trackCountData.prepareCount}} - {{$t('api_test.home_page.detail_card.not_started')}} + 未通过 {{"\xa0\xa0"}} - + {{trackCountData.passCount}} - {{$t('api_test.home_page.detail_card.finished')}} + 已通过 {{"\xa0\xa0"}} - + {{trackCountData.unPassCount}} @@ -133,7 +133,7 @@ export default { }, methods: { redirectPage(clickType){ - this.$emit("redirectPage","api","api",clickType); + this.$emit("redirectPage","case", "case",clickType); } } } diff --git a/frontend/src/business/components/track/home/components/RelevanceCaseCard.vue b/frontend/src/business/components/track/home/components/RelevanceCaseCard.vue index d82ef603af..be96f80db9 100644 --- a/frontend/src/business/components/track/home/components/RelevanceCaseCard.vue +++ b/frontend/src/business/components/track/home/components/RelevanceCaseCard.vue @@ -68,7 +68,7 @@ 未覆盖 {{"\xa0\xa0"}} - + {{relevanceCountData.uncoverageCount}} @@ -77,7 +77,7 @@ 已覆盖 {{"\xa0\xa0"}} - + {{relevanceCountData.coverageCount}} @@ -107,7 +107,7 @@ export default { }, methods: { redirectPage(clickType){ - this.$emit("redirectPage","api","api",clickType); + this.$emit("redirectPage","case","case",clickType); } } }