fix 测试计划

This commit is contained in:
chenjianxing 2020-04-07 15:35:58 +08:00
parent 3c1439b749
commit c24dd94e0b
11 changed files with 61 additions and 22 deletions

View File

@ -34,6 +34,15 @@ public class TestCaseController {
return PageUtils.setPageInfo(page, testCaseService.listTestCase(request));
}
@GetMapping("recent/{count}")
public List<TestCase> recentTestPlans(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setWorkspaceId(currentWorkspaceId);
PageHelper.startPage(1, count, true);
return testCaseService.recentTestPlans(request);
}
@PostMapping("/list")
public List<TestCase> getTestCaseByNodeId(@RequestBody List<Integer> nodeIds){
return testCaseService.getTestCaseByNodeId(nodeIds);

View File

@ -6,9 +6,11 @@ import java.util.List;
public class QueryTestCaseRequest extends TestCase {
List<Integer> nodeIds;
private List<Integer> nodeIds;
String planId;
private String planId;
private String workspaceId;
public String getPlanId() {
return planId;
@ -25,4 +27,12 @@ public class QueryTestCaseRequest extends TestCase {
public void setNodeIds(List<Integer> nodeIds) {
this.nodeIds = nodeIds;
}
public String getWorkspaceId() {
return workspaceId;
}
public void setWorkspaceId(String workspaceId) {
this.workspaceId = workspaceId;
}
}

View File

@ -127,6 +127,10 @@ public class TestCaseNodeService {
testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(planId);
List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
if (testPlanTestCases.isEmpty()) {
return null;
}
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
testCaseNodeExample.createCriteria().andProjectIdEqualTo(testPlan.getProjectId());
List<TestCaseNode> nodes = testCaseNodeMapper.selectByExample(testCaseNodeExample);

View File

@ -110,4 +110,7 @@ public class TestCaseService {
}
public List<TestCase> recentTestPlans(QueryTestCaseRequest request) {
return null;
}
}

View File

@ -1,6 +1,6 @@
<template>
<el-col>
<header-menus :beaseUrl="beaseUrl"/>
<header-menus/>
<div>
<transition>
<keep-alive>

View File

@ -78,7 +78,7 @@
},
watch: {
'$route'(to, from) {
if (from.name.indexOf("Project") > 0){
if (from.name.indexOf("Project") >= 0){
this.getProjects();
}
}

View File

@ -11,10 +11,10 @@
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../../common/constants";
export default {
name: "PerformanceRecentTestPlan",
name: "RecentTestCase",
mounted() {
const rolesString = localStorage.getItem("roles");
const roles = rolesString.split(',');
@ -24,7 +24,6 @@
this.recentTestPlans = response.data;
});
}
},
data() {
return {

View File

@ -10,7 +10,7 @@
<el-submenu v-if="isCurrentWorkspaceUser"
index="3" popper-class="submenu" v-permission="['test_manager']" >
<template v-slot:title>{{$t('commons.project')}}</template>
<track-recent-project v-if="beaseUrl == 'tack'"/>
<track-recent-project/>
<el-divider/>
<el-menu-item :index="'/track/project/all'">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
@ -24,7 +24,7 @@
<el-submenu v-if="isCurrentWorkspaceUser"
index="6" popper-class="submenu" v-permission="['test_manager', 'test_user']">
<template v-slot:title>{{$t('test_track.test_case')}}</template>
<recent-case-plan/>
<recent-test-case/>
<el-divider/>
<el-menu-item :index="'/track/case/all'">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
@ -55,20 +55,13 @@
<script>
import PerformanceRecentTestPlan from "../../performance/test/PerformanceRecentTestPlan";
import ApiRecentTest from "../../api/test/ApiRecentTest";
import PerformanceRecentProject from "../../performance/project/PerformanceRecentProject";
import ApiRecentProject from "../../api/project/ApiRecentProject";
import PerformanceRecentReport from "../../performance/report/PerformanceRecentReport";
import ApiRecentReport from "../../api/report/ApiRecentReport";
import {checkoutCurrentWorkspace} from "../../../../common/utils";
import TrackRecentProject from "../../track/project/TrackRecentProject";
import RecentCasePlan from "../../track/case/RecentCasePlan";
import RecentTestCase from "../case/components/RecentTestCase";
export default {
name: "MsMenus",
components: {PerformanceRecentReport, PerformanceRecentTestPlan, ApiRecentTest, ApiRecentReport,
PerformanceRecentProject, ApiRecentProject, TrackRecentProject, RecentCasePlan},
components: {RecentTestCase, TrackRecentProject },
data() {
return {
isCurrentWorkspaceUser: false,

View File

@ -51,6 +51,13 @@
created() {
this.getNodeTreeByPlanId();
},
watch: {
'$route'(to, from) {
if (to.path.indexOf("/track/plan/view/") >= 0){
this.getNodeTreeByPlanId();
}
}
},
computed: {
planId: function () {
return this.$route.params.planId;

View File

@ -153,6 +153,11 @@
type: String
}
},
watch: {
planId() {
this.initTableData();
}
},
created: function () {
this.initTableData();
},

View File

@ -6,15 +6,14 @@
</div>
<el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/performance/test/' + p.id" :route="{name:'perPlan', params:{projectId:p.id, projectName:p.name}}">
@click="routeToTestCase(p)">
{{ p.name }}
</el-menu-item>
</el-menu>
</template>
<script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER, CURRENT_PROJECT} from "../../../../common/constants";
import {hasRoles} from "../../../../common/utils";
export default {
@ -27,15 +26,25 @@
});
}
},
methods: {},
data() {
return {
recentProjects: [],
}
},
methods: {
routeToTestCase(project) {
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
if(this.$router.currentRoute.path === '/track/case/all'){
this.$router.go(0);
} else {
this.$router.push("/track/case/all");
}
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;