测试详情添加测试计划菜单栏

This commit is contained in:
chenjianxing 2020-04-09 13:51:04 +08:00
parent f735d4c953
commit 3c59765b2a
7 changed files with 125 additions and 37 deletions

View File

@ -34,6 +34,12 @@ public class TestPlanController {
return PageUtils.setPageInfo(page, testPlanService.listTestPlan(request));
}
@PostMapping("/list/all")
public List<TestPlan> listAll() {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
return testPlanService.listTestAllPlan(currentWorkspaceId);
}
@GetMapping("recent/{count}")
public List<TestPlan> recentTestPlans(@PathVariable int count) {

View File

@ -116,4 +116,10 @@ public class TestPlanService {
testPlanTestCaseExample.setOrderByClause("update_time desc");
return testPlanMapper.selectByExample(testPlanTestCaseExample);
}
public List<TestPlan> listTestAllPlan(String currentWorkspaceId) {
TestPlanExample testPlanExample = new TestPlanExample();
testPlanExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId);
return testPlanMapper.selectByExample(testPlanExample);
}
}

View File

@ -130,6 +130,7 @@
let orgId = data.id;
this.$post("/user/switch/source/org/" + orgId, {}, response => {
localStorage.setItem(TokenKey, JSON.stringify(response.data));
this.$router.push('/');
window.location.reload();
})
},
@ -141,6 +142,7 @@
this.$post("/user/switch/source/ws/" + workspaceId, {}, response => {
localStorage.setItem(TokenKey, JSON.stringify(response.data));
localStorage.setItem("workspace_id", workspaceId);
this.$router.push('/');
window.location.reload();
})
}

View File

@ -3,29 +3,19 @@
<el-container>
<el-aside width="250px">
<el-menu :unique-opened="true" mode="horizontal" active-text-color="write"
class="project_menu">
<el-submenu index="1" popper-class="submenu">
<template v-slot:title>
{{currentProject == null ? '' : currentProject.name}}
</template>
<div style="height:400px;">
<el-scrollbar style="height:100%">
<label v-for="(item,index) in projects" :key="index">
<el-menu-item @click="changeProject(item)">
{{item.name}}
<i class="el-icon-check" v-if="currentProject && item.id === currentProject.id"></i>
</el-menu-item>
</label>
</el-scrollbar>
</div>
</el-submenu>
</el-menu>
<select-menu
:data="projects"
:current-data="currentProject"
:title="'项目'"
@dataChange="changeProject">
</select-menu>
<node-tree class="node_tree"
:current-project="currentProject"
@nodeSelectEvent="refreshTable"
@refresh="refreshTable"
ref="nodeTree"></node-tree>
ref="nodeTree">
</node-tree>
</el-aside>
<el-main class="main-content">
@ -34,10 +24,10 @@
:current-project="currentProject"
@openTestCaseEditDialog="openTestCaseEditDialog"
@testCaseEdit="openTestCaseEditDialog"
ref="testCaseList"></test-case-list>
ref="testCaseList">
</test-case-list>
</el-main>
</el-container>
<test-case-edit
@ -53,10 +43,11 @@
import TestCaseEdit from './components/TestCaseEdit';
import {WORKSPACE_ID,CURRENT_PROJECT} from '../../../../common/constants';
import TestCaseList from "./components/TestCaseList";
import SelectMenu from "../common/SelectMenu";
export default {
name: "TestCase",
components: {TestCaseList, NodeTree, TestCaseEdit},
components: {TestCaseList, NodeTree, TestCaseEdit, SelectMenu},
comments: {},
data() {
return {
@ -208,7 +199,7 @@
}
.node_tree {
margin: 10%;
margin: 5%;
}
.project_menu {

View File

@ -0,0 +1,53 @@
<template>
<el-menu :unique-opened="true" mode="horizontal" active-text-color="write"
class="project_menu">
<el-submenu index="1" popper-class="submenu">
<template v-slot:title>
<span class="menu-title">{{'[' + title + ']'}}</span>
<span> {{currentData == null ? '' : currentData.name}} </span>
</template>
<template v-slot:default>
<div style="height:400px;">
<el-scrollbar style="height:100%">
<label v-for="(item,index) in data" :key="index">
<el-menu-item @click="changeData(item)">
{{item.name}}
<i class="el-icon-check" v-if="currentData && item.id === currentData.id"></i>
</el-menu-item>
</label>
</el-scrollbar>
</div>
</template>
</el-submenu>
</el-menu>
</template>
<script>
export default {
name: "SelectMenu",
props: {
data: {
type: Array
},
currentData: {
type: Object
},
title: {
type: String
}
},
methods: {
changeData(data) {
this.$emit("dataChange", data);
}
}
}
</script>
<style scoped>
.menu-title {
color: darkgrey;
}
</style>

View File

@ -2,12 +2,21 @@
<div class="plan_container">
<el-container>
<el-aside class="node-tree" width="250px">
<el-aside class="aside-container" width="250px">
<select-menu
:data="testPlans"
:current-data="currentPlan"
:title="'计划'"
@dataChange="changePlan">
</select-menu>
<plan-node-tree
:tree-nodes="treeNodes"
class="node_tree"
:plan-id="planId"
@nodeSelectEvent="getPlanCases"
ref="tree"></plan-node-tree>
ref="tree">
</plan-node-tree>
</el-aside>
<el-main>
@ -30,7 +39,6 @@
@refresh="refresh">
</test-plan-test-case-edit>
</div>
</template>
@ -41,13 +49,15 @@
import TestCasePlanList from "./components/TestCasePlanList";
import TestCaseRelevance from "./components/TestCaseRelevance";
import TestPlanTestCaseEdit from "./components/TestPlanTestCaseEdit";
import SelectMenu from "../common/SelectMenu";
export default {
name: "TestPlanView",
components: {PlanNodeTree, TestCasePlanList, TestCaseRelevance, TestPlanTestCaseEdit},
components: {PlanNodeTree, TestCasePlanList, TestCaseRelevance, TestPlanTestCaseEdit, SelectMenu},
data() {
return {
treeNodes: []
testPlans: [],
currentPlan: {}
}
},
computed: {
@ -55,6 +65,14 @@
return this.$route.params.planId;
}
},
created() {
this.getTestPlans();
},
watch: {
planId() {
this.getTestPlans();
}
},
methods: {
refresh() {
this.getPlanCases();
@ -71,7 +89,6 @@
Object.assign(item, testCase);
item.results = JSON.parse(item.results);
item.steps = JSON.parse(item.steps);
item.steptResults = [];
for (let i = 0; i < item.steps.length; i++){
if(item.results[i]){
@ -82,6 +99,20 @@
}
this.$refs.testPlanTestCaseEdit.testCase = item;
this.$refs.testPlanTestCaseEdit.dialog = true;
},
getTestPlans() {
this.result = this.$post('/test/plan/list/all', {}, response => {
this.testPlans = response.data;
this.testPlans.forEach(plan => {
if (this.planId && plan.id === this.planId) {
this.currentPlan = plan;
}
});
});
},
changePlan(plan) {
this.currentPlan = plan;
this.$router.push('/track/plan/view/' + plan.id);
}
}
}
@ -94,9 +125,12 @@
height: 600px;
}
.node-tree {
margin-top: 2%;
.aside-container {
margin-left: 15px;
}
.node_tree {
margin: 3%;
}
</style>

View File

@ -139,7 +139,6 @@
currentPage: 1,
pageSize: 5,
total: 0,
loadingRequire: {project: true, testCase: true},
testId: null,
}
},
@ -148,14 +147,11 @@
this.initTableData();
},
methods: {
initTableData(nodeIds) {
initTableData() {
let param = {
name: this.condition,
};
param.nodeIds = nodeIds;
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
this.loadingRequire.testCase = false;
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;