Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Captain.B 2020-04-09 12:01:10 +08:00
commit 64c46ea715
9 changed files with 77 additions and 74 deletions

View File

@ -73,6 +73,11 @@ public class TestPlanService {
public void testPlanRelevance(PlanCaseRelevanceRequest request) { public void testPlanRelevance(PlanCaseRelevanceRequest request) {
List<String> testCaseIds = request.getTestCaseIds(); List<String> testCaseIds = request.getTestCaseIds();
if (testCaseIds.isEmpty()) {
return;
}
TestCaseExample testCaseExample = new TestCaseExample(); TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andIdIn(testCaseIds); testCaseExample.createCriteria().andIdIn(testCaseIds);

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="case_container" v-loading="loadingRequire.project && loadingRequire.testCase"> <div class="case_container">
<el-container> <el-container>
<el-aside width="250px"> <el-aside width="250px">
@ -67,7 +67,6 @@
currentPage: 1, currentPage: 1,
pageSize: 5, pageSize: 5,
total: 0, total: 0,
loadingRequire: {project: true, testCase: true},
projects: [], projects: [],
currentProject: null, currentProject: null,
treeNodes: [] treeNodes: []
@ -120,7 +119,6 @@
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(this.projects[0])); localStorage.setItem(CURRENT_PROJECT, JSON.stringify(this.projects[0]));
} }
} }
this.loadingRequire.project = false;
// this.checkProject(); // this.checkProject();
}); });
}, },
@ -137,8 +135,6 @@
changeProject(project) { changeProject(project) {
this.currentProject = project; this.currentProject = project;
localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project)); localStorage.setItem(CURRENT_PROJECT, JSON.stringify(project));
this.$refs.testCaseList.initTableData();
this.$refs.nodeTree.getNodeTree();
}, },
refreshTable(data) { refreshTable(data) {
this.$refs.testCaseList.initTableData(data); this.$refs.testCaseList.initTableData(data);

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <div v-loading="result.loading">
<el-input :placeholder="$t('test_track.search_module')" v-model="filterText" <el-input :placeholder="$t('test_track.search_module')" v-model="filterText"
size="small"> size="small">
<template v-slot:append> <template v-slot:append>
@ -74,6 +74,7 @@
name: "NodeTree", name: "NodeTree",
data() { data() {
return { return {
result: {},
filterText: '', filterText: '',
defaultProps: { defaultProps: {
children: 'children', children: 'children',
@ -173,7 +174,7 @@
getNodeTree() { getNodeTree() {
if (this.currentProject) { if (this.currentProject) {
let projectId = this.currentProject.id; let projectId = this.currentProject.id;
this.$get("/case/node/list/" + projectId, response => { this.result = this.$get("/case/node/list/" + projectId, response => {
this.treeNodes = response.data; this.treeNodes = response.data;
}); });
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<el-main> <el-main>
<el-card> <el-card v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<div> <div>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
@ -9,17 +9,11 @@
<span class="title">{{$t('test_track.test_case')}}</span> <span class="title">{{$t('test_track.test_case')}}</span>
</el-col> </el-col>
<el-col :span="1" :offset="8"> <el-col :span="2" :offset="10">
<el-button icon="el-icon-circle-plus-outline" size="small" round <el-button icon="el-icon-circle-plus-outline" size="small" round
@click="$emit('openTestCaseEditDialog')" >{{$t('commons.create')}}</el-button> @click="$emit('openTestCaseEditDialog')" >{{$t('commons.create')}}</el-button>
</el-col> </el-col>
<el-col :span="1" >
<el-button
icon="el-icon-refresh" size="small" round
@click="initTableData()">{{$t('commons.refresh')}}</el-button>
</el-col>
<el-col :span="5"> <el-col :span="5">
<span class="search"> <span class="search">
<el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')" <el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')"
@ -161,7 +155,7 @@
if (this.currentProject) { if (this.currentProject) {
param.projectId = this.currentProject.id; param.projectId = this.currentProject.id;
this.$post(this.buildPagePath('/test/case/list'), param, response => { this.result = this.$post(this.buildPagePath('/test/case/list'), param, response => {
this.loadingRequire.testCase = false; this.loadingRequire.testCase = false;
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;

View File

@ -5,6 +5,7 @@
<el-aside class="node-tree" width="250px"> <el-aside class="node-tree" width="250px">
<plan-node-tree <plan-node-tree
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:plan-id="planId"
@nodeSelectEvent="getPlanCases" @nodeSelectEvent="getPlanCases"
ref="tree"></plan-node-tree> ref="tree"></plan-node-tree>
</el-aside> </el-aside>
@ -49,16 +50,6 @@
treeNodes: [] treeNodes: []
} }
}, },
created() {
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;
@ -67,20 +58,13 @@
methods: { methods: {
refresh() { refresh() {
this.getPlanCases(); this.getPlanCases();
this.getNodeTreeByPlanId(); this.$refs.tree.initTree();
}, },
getPlanCases(nodeIds) { getPlanCases(nodeIds) {
this.$refs.testCasePlanList.initTableData(nodeIds); this.$refs.testCasePlanList.initTableData(nodeIds);
}, },
openTestCaseRelevanceDialog() { openTestCaseRelevanceDialog() {
this.$refs.testCaseRelevance.openTestCaseRelevanceDialog(this.planId); this.$refs.testCaseRelevance.openTestCaseRelevanceDialog();
},
getNodeTreeByPlanId() {
if(this.planId){
this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
}, },
editTestPlanTestCase(testCase) { editTestPlanTestCase(testCase) {
let item = {}; let item = {};

View File

@ -4,6 +4,7 @@
<el-input :placeholder="$t('test_track.search_module')" v-model="filterText" size="small"></el-input> <el-input :placeholder="$t('test_track.search_module')" v-model="filterText" size="small"></el-input>
<el-tree <el-tree
v-loading="result.loading"
class="filter-tree node-tree" class="filter-tree node-tree"
:data="treeNodes" :data="treeNodes"
node-key="id" node-key="id"
@ -28,26 +29,39 @@
name: "PlanNodeTree", name: "PlanNodeTree",
data() { data() {
return { return {
result: {},
filterText: '', filterText: '',
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label'
}, },
dialogTableVisible: false, dialogTableVisible: false,
defaultKeys: [] defaultKeys: [],
treeNodes: []
}; };
}, },
props: { props: {
planId: { planId: {
type: String type: String
}, },
treeNodes: { showAll: {
Array type: Boolean
}
}, },
created() {
this.initTree();
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
},
planId() {
this.initTree();
},
'$route'(to, from) {
if (to.path.indexOf("/track/plan/view/") >= 0){
this.initTree();
}
} }
}, },
selectNode(node) { selectNode(node) {
@ -64,6 +78,13 @@
return nodeIds; return nodeIds;
}, },
methods: { methods: {
initTree() {
if (this.showAll) {
this.getAllNodeTreeByPlanId();
} else {
this.getNodeTreeByPlanId();
}
},
handleDragEnd(draggingNode, dropNode, dropType, ev) { handleDragEnd(draggingNode, dropNode, dropType, ev) {
let param = {}; let param = {};
param.id = draggingNode.data.id; param.id = draggingNode.data.id;
@ -98,9 +119,16 @@
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
getNodeTreeByNodeIds() { getNodeTreeByPlanId() {
if(this.planId){ if(this.planId){
this.$get("/case/node/list/plan/" + this.planId, response => { this.result = this.$get("/case/node/list/plan/" + this.planId, response => {
this.treeNodes = response.data;
});
}
},
getAllNodeTreeByPlanId() {
if (this.planId) {
this.result = this.$get("/case/node/list/all/plan/" + this.planId, response => {
this.treeNodes = response.data; this.treeNodes = response.data;
}); });
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<el-main class="main-content"> <el-main class="main-content">
<el-card> <el-card v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<div> <div>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
@ -9,17 +9,11 @@
<span class="title">{{$t('test_track.test_case')}}</span> <span class="title">{{$t('test_track.test_case')}}</span>
</el-col> </el-col>
<el-col :span="1" :offset="4"> <el-col :span="2" :offset="8">
<el-button icon="el-icon-circle-plus-outline" size="small" round <el-button icon="el-icon-circle-plus-outline" size="small" round
@click="$emit('openTestCaseRelevanceDialog')" >{{$t('test_track.relevance_test_case')}}</el-button> @click="$emit('openTestCaseRelevanceDialog')" >{{$t('test_track.relevance_test_case')}}</el-button>
</el-col> </el-col>
<el-col :span="1" :offset="1">
<el-button
icon="el-icon-refresh" size="small" round
@click="initTableData()">{{$t('commons.refresh')}}</el-button>
</el-col>
<el-col :span="5"> <el-col :span="5">
<span class="search"> <span class="search">
<el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')" <el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')"
@ -169,7 +163,7 @@
}; };
param.nodeIds = nodeIds; param.nodeIds = nodeIds;
param.planId = this.planId; param.planId = this.planId;
this.$post(this.buildPagePath('/test/plan/case/list'), param, response => { this.result = this.$post(this.buildPagePath('/test/plan/case/list'), param, response => {
this.loadingRequire.testCase = false; this.loadingRequire.testCase = false;
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;

View File

@ -4,18 +4,21 @@
<el-dialog :title="$t('test_track.relevance_test_case')" <el-dialog :title="$t('test_track.relevance_test_case')"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
@close="close"
width="50%"> width="50%">
<el-container class="main-content"> <el-container class="main-content">
<el-aside class="node-tree" width="250px"> <el-aside class="node-tree" width="250px">
<plan-node-tree <plan-node-tree
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:plan-id="planId"
:showAll=true
@nodeSelectEvent="getCaseNameByNodeIds" @nodeSelectEvent="getCaseNameByNodeIds"
ref="tree"></plan-node-tree> ref="tree"></plan-node-tree>
</el-aside> </el-aside>
<el-container> <el-container>
<el-main class="case-content"> <el-main class="case-content" v-loading="result.loading">
<el-scrollbar style="height:100%"> <el-scrollbar style="height:100%">
<el-table <el-table
:data="testCases" :data="testCases"
@ -70,6 +73,7 @@
components: {PlanNodeTree}, components: {PlanNodeTree},
data() { data() {
return { return {
result: {},
dialogFormVisible: false, dialogFormVisible: false,
isCheckAll: false, isCheckAll: false,
testCases: [], testCases: [],
@ -82,10 +86,14 @@
type: String type: String
} }
}, },
watch: {
planId() {
this.getCaseNames();
}
},
methods: { methods: {
openTestCaseRelevanceDialog(planId) { openTestCaseRelevanceDialog() {
this.getAllNodeTreeByPlanId(planId); this.getCaseNames();
this.getCaseNames(planId);
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
saveCaseRelevance(){ saveCaseRelevance(){
@ -93,20 +101,21 @@
param.planId = this.planId; param.planId = this.planId;
param.testCaseIds = [...this.selectIds]; param.testCaseIds = [...this.selectIds];
this.$post('/test/plan/relevance' , param, () => { this.$post('/test/plan/relevance' , param, () => {
this.dialogFormVisible = false; this.selectIds.clear();
this.$message.success("保存成功"); this.$message.success("保存成功");
this.dialogFormVisible = false;
this.$emit('refresh'); this.$emit('refresh');
}); });
}, },
getCaseNames(planId, nodeIds) { getCaseNames(nodeIds) {
let param = {}; let param = {};
if (planId) { if (this.planId) {
param.planId = planId; param.planId = this.planId;
} }
if (nodeIds && nodeIds.length > 0){ if (nodeIds && nodeIds.length > 0){
param.nodeIds = nodeIds; param.nodeIds = nodeIds;
} }
this.$post('/test/case/name', param, response => { this.result = this.$post('/test/case/name', param, response => {
this.testCases = response.data; this.testCases = response.data;
this.testCases.forEach(item => { this.testCases.forEach(item => {
item.checked = false; item.checked = false;
@ -115,7 +124,7 @@
}, },
getCaseNameByNodeIds(nodeIds) { getCaseNameByNodeIds(nodeIds) {
this.dialogFormVisible = true; this.dialogFormVisible = true;
this.getCaseNames(this.planId, nodeIds); this.getCaseNames(nodeIds);
}, },
handleSelectAll(selection) { handleSelectAll(selection) {
if(selection.length > 0){ if(selection.length > 0){
@ -133,12 +142,9 @@
this.selectIds.add(row.id); this.selectIds.add(row.id);
} }
}, },
getAllNodeTreeByPlanId(planId) { close() {
if (planId) { console.log("clear");
this.$get("/case/node/list/all/plan/" + planId, response => { this.selectIds.clear();
this.treeNodes = response.data;
});
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
<div class="testplan-container"> <div class="testplan-container">
<el-main class="main-content"> <el-main class="main-content">
<el-card> <el-card v-loading="result.loading">
<template v-slot:header> <template v-slot:header>
<div> <div>
<el-row type="flex" justify="space-between" align="middle"> <el-row type="flex" justify="space-between" align="middle">
@ -10,16 +10,11 @@
<span class="title">{{$t('test_track.test_plan')}}</span> <span class="title">{{$t('test_track.test_plan')}}</span>
</el-col> </el-col>
<el-col :span="1" :offset="8"> <el-col :span="2" :offset="10">
<el-button icon="el-icon-circle-plus-outline" size="small" round <el-button icon="el-icon-circle-plus-outline" size="small" round
@click="$emit('openTestPlanEditDialog')" >{{$t('commons.create')}}</el-button> @click="$emit('openTestPlanEditDialog')" >{{$t('commons.create')}}</el-button>
</el-col> </el-col>
<el-col :span="1" >
<el-button
icon="el-icon-refresh" size="small" round
@click="initTableData()">{{$t('commons.refresh')}}</el-button>
</el-col>
<el-col :span="5"> <el-col :span="5">
<span class="search"> <span class="search">
@ -159,7 +154,7 @@
}; };
param.nodeIds = nodeIds; param.nodeIds = nodeIds;
this.$post(this.buildPagePath(this.queryPath), param, response => { this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
this.loadingRequire.testCase = false; this.loadingRequire.testCase = false;
let data = response.data; let data = response.data;
this.total = data.itemCount; this.total = data.itemCount;