界面优化

This commit is contained in:
chenjianxing 2020-04-09 11:44:54 +08:00
parent 51fa6ed5b0
commit f735d4c953
9 changed files with 77 additions and 74 deletions

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template>
<div>
<div v-loading="result.loading">
<el-input :placeholder="$t('test_track.search_module')" v-model="filterText"
size="small">
<template v-slot:append>
@ -74,6 +74,7 @@
name: "NodeTree",
data() {
return {
result: {},
filterText: '',
defaultProps: {
children: 'children',
@ -173,7 +174,7 @@
getNodeTree() {
if (this.currentProject) {
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;
});
}

View File

@ -1,7 +1,7 @@
<template>
<el-main>
<el-card>
<el-card v-loading="result.loading">
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">
@ -9,17 +9,11 @@
<span class="title">{{$t('test_track.test_case')}}</span>
</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
@click="$emit('openTestCaseEditDialog')" >{{$t('commons.create')}}</el-button>
</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">
<span class="search">
<el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')"
@ -161,7 +155,7 @@
if (this.currentProject) {
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;
let data = response.data;
this.total = data.itemCount;

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<template>
<el-main class="main-content">
<el-card>
<el-card v-loading="result.loading">
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">
@ -9,17 +9,11 @@
<span class="title">{{$t('test_track.test_case')}}</span>
</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
@click="$emit('openTestCaseRelevanceDialog')" >{{$t('test_track.relevance_test_case')}}</el-button>
</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">
<span class="search">
<el-input type="text" size="small" :placeholder="$t('load_test.search_by_name')"
@ -169,7 +163,7 @@
};
param.nodeIds = nodeIds;
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;
let data = response.data;
this.total = data.itemCount;

View File

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

View File

@ -2,7 +2,7 @@
<div class="testplan-container">
<el-main class="main-content">
<el-card>
<el-card v-loading="result.loading">
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">
@ -10,16 +10,11 @@
<span class="title">{{$t('test_track.test_plan')}}</span>
</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
@click="$emit('openTestPlanEditDialog')" >{{$t('commons.create')}}</el-button>
</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">
<span class="search">
@ -159,7 +154,7 @@
};
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;
let data = response.data;
this.total = data.itemCount;