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)); 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") @PostMapping("/list")
public List<TestCase> getTestCaseByNodeId(@RequestBody List<Integer> nodeIds){ public List<TestCase> getTestCaseByNodeId(@RequestBody List<Integer> nodeIds){
return testCaseService.getTestCaseByNodeId(nodeIds); return testCaseService.getTestCaseByNodeId(nodeIds);

View File

@ -6,9 +6,11 @@ import java.util.List;
public class QueryTestCaseRequest extends TestCase { public class QueryTestCaseRequest extends TestCase {
List<Integer> nodeIds; private List<Integer> nodeIds;
String planId; private String planId;
private String workspaceId;
public String getPlanId() { public String getPlanId() {
return planId; return planId;
@ -25,4 +27,12 @@ public class QueryTestCaseRequest extends TestCase {
public void setNodeIds(List<Integer> nodeIds) { public void setNodeIds(List<Integer> nodeIds) {
this.nodeIds = 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); testPlanTestCaseExample.createCriteria().andPlanIdEqualTo(planId);
List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample); List<TestPlanTestCase> testPlanTestCases = testPlanTestCaseMapper.selectByExample(testPlanTestCaseExample);
if (testPlanTestCases.isEmpty()) {
return null;
}
TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample(); TestCaseNodeExample testCaseNodeExample = new TestCaseNodeExample();
testCaseNodeExample.createCriteria().andProjectIdEqualTo(testPlan.getProjectId()); testCaseNodeExample.createCriteria().andProjectIdEqualTo(testPlan.getProjectId());
List<TestCaseNode> nodes = testCaseNodeMapper.selectByExample(testCaseNodeExample); 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> <template>
<el-col> <el-col>
<header-menus :beaseUrl="beaseUrl"/> <header-menus/>
<div> <div>
<transition> <transition>
<keep-alive> <keep-alive>

View File

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

View File

@ -11,10 +11,10 @@
</template> </template>
<script> <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 { export default {
name: "PerformanceRecentTestPlan", name: "RecentTestCase",
mounted() { mounted() {
const rolesString = localStorage.getItem("roles"); const rolesString = localStorage.getItem("roles");
const roles = rolesString.split(','); const roles = rolesString.split(',');
@ -24,7 +24,6 @@
this.recentTestPlans = response.data; this.recentTestPlans = response.data;
}); });
} }
}, },
data() { data() {
return { return {

View File

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

View File

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

View File

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

View File

@ -6,15 +6,14 @@
</div> </div>
<el-menu-item :key="p.id" v-for="p in recentProjects" <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 }} {{ p.name }}
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
</template> </template>
<script> <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"; import {hasRoles} from "../../../../common/utils";
export default { export default {
@ -27,15 +26,25 @@
}); });
} }
}, },
methods: {},
data() { data() {
return { return {
recentProjects: [], 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> </script>
<style scoped> <style scoped>
.recent-text { .recent-text {
padding-left: 10%; padding-left: 10%;