提交 b32a6f13 编写于 作者: C chenjianxing

测试用例面包屑

上级 68c7c8f9
<template>
<el-input
class="search"
type="text"
size="small"
:placeholder="$t('commons.search_by_name')"
prefix-icon="el-icon-search"
@change="search"
maxlength="60"
v-model="condition.name" clearable/>
</template>
<script>
export default {
name: "MsTableSearchBar",
props: {
condition: {
type: Object
}
},
methods: {
search() {
this.$emit('update:condition', this.condition);
this.$emit('change');
}
}
}
</script>
<style scoped>
</style>
<template>
<el-tooltip :disabled="disabled"
:content="tip"
placement="bottom"
:effect="effect">
<el-button @click="exec()"
circle
:type="type"
......
......@@ -10,7 +10,7 @@
</select-menu>
<node-tree class="node-tree"
:current-project="currentProject"
@nodeSelectEvent="refreshTable"
@nodeSelectEvent="nodeChange"
@refresh="refreshTable"
ref="nodeTree">
</node-tree>
......@@ -122,6 +122,10 @@
changeProject(project) {
this.setCurrentProject(project);
},
nodeChange(nodeIds, nodeNames) {
this.$refs.testCaseList.selectNodeNames = nodeNames;
this.$refs.testCaseList.initTableData(nodeIds);
},
refreshTable(data) {
this.$refs.testCaseList.initTableData(data);
},
......
......@@ -148,8 +148,11 @@
},
selectNode(node) {
let nodeIds = [];
let nodeNames = [];
this.getChildNodeId(node, nodeIds);
this.$emit("nodeSelectEvent", nodeIds);
this.getParentNodeName(node, nodeNames);
this.$emit("nodeSelectEvent", nodeIds, nodeNames);
},
getChildNodeId(rootNode, nodeIds) {
//递归获取所有子节点ID
......@@ -157,7 +160,12 @@
for (let i = 0; i < rootNode.childNodes.length; i++) {
this.getChildNodeId(rootNode.childNodes[i], nodeIds);
}
return nodeIds;
},
getParentNodeName(rootNode, nodeNames) {
if (rootNode.parent && rootNode.parent.id != 0) {
this.getParentNodeName(rootNode.parent, nodeNames)
}
nodeNames.push(rootNode.data.name);
},
filterNode(value, data) {
if (!value) return true;
......
......@@ -5,20 +5,18 @@
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">
<span class="title">{{$t('test_track.case.test_case')}}
<ms-create-box :tips="$t('test_track.case.create')" :exec="testCaseCreate"/></span>
<node-breadcrumb
:node-names="selectNodeNames"
@refresh="refresh"/>
<span class="operate-button">
<ms-create-box :tips="$t('test_track.case.create')" :exec="testCaseCreate"/>
<test-case-import :projectId="currentProject == null? null : currentProject.id"
@refresh="refresh"/>
<test-case-export/>
<el-input type="text" size="small"
class="search"
:placeholder="$t('load_test.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition"
@change="search" clearable/></span>
<ms-table-search-bar :condition.sync="condition" @change="initTableData"/>
</span>
</el-row>
</div>
</template>
......@@ -94,17 +92,19 @@
import TestCaseImport from '../components/TestCaseImport';
import TestCaseExport from '../components/TestCaseExport';
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
import MsTableSearchBar from '../../../../components/common/components/MsTableSearchBar';
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
export default {
name: "TestCaseList",
components: {MsCreateBox, TestCaseImport, TestCaseExport, MsTablePagination},
components: {MsCreateBox, TestCaseImport, TestCaseExport, MsTablePagination, NodeBreadcrumb, MsTableSearchBar},
data() {
return {
result: {},
deletePath: "/test/case/delete",
condition: "",
condition: {},
tableData: [],
selectNodeNames: [],
currentPage: 1,
pageSize: 5,
total: 0,
......@@ -125,14 +125,11 @@
},
methods: {
initTableData(nodeIds) {
let param = {
name: this.condition,
};
param.nodeIds = nodeIds;
this.condition.nodeIds = nodeIds;
if (this.currentProject) {
param.projectId = this.currentProject.id;
this.result = this.$post(this.buildPagePath('/test/case/list'), param, response => {
this.condition.projectId = this.currentProject.id;
this.result = this.$post(this.buildPagePath('/test/case/list'), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
......@@ -172,6 +169,8 @@
});
},
refresh() {
this.selectNodeNames = [];
this.condition = {};
this.$emit('refresh');
}
}
......
<template>
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item>
<a @click="showAll">
<i class="el-icon-s-home"></i>&nbsp;
{{$t('test_track.plan_view.all_case')}}
</a>
</el-breadcrumb-item>
<el-breadcrumb-item v-for="nodeName in data" :key="nodeName">{{nodeName}}</el-breadcrumb-item>
</el-breadcrumb>
</template>
<script>
export default {
name: "NodeBreadcrumb",
data() {
return {
data: []
}
},
props: {
nodeNames: {
type: Array
}
},
watch: {
nodeNames() {
this.filterData();
}
},
methods: {
showAll() {
this.$emit('refresh');
},
filterData() {
this.data = this.nodeNames;
if (this.data.length > 4) {
let lastData = this.data[this.data.length - 1];
this.data.splice(1, this.data.length);
this.data.push('...');
this.data.push(lastData);
}
}
}
}
</script>
<style scoped>
</style>
......@@ -24,6 +24,7 @@
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-node-names="selectNodeNames"
ref="testCasePlanList"></test-plan-test-case-list>
</el-main>
</el-container>
......@@ -51,7 +52,8 @@
return {
testPlans: [],
currentPlan: {},
selectNodeIds: []
selectNodeIds: [],
selectNodeNames: []
}
},
computed: {
......@@ -70,9 +72,11 @@
methods: {
refresh() {
this.selectNodeIds = [];
this.selectNodeNames = [];
this.$refs.tree.initTree();
},
selectNodeIdsChange(nodeIds) {
selectNodeIdsChange(nodeIds, nodeNames) {
this.selectNodeNames = nodeNames;
this.selectNodeIds = nodeIds;
},
openTestCaseRelevanceDialog() {
......
......@@ -105,8 +105,10 @@
},
selectNode(node) {
let nodeIds = [];
let nodeNames = [];
this.getChildNodeId(node, nodeIds);
this.$emit("nodeSelectEvent", nodeIds);
this.getParentNodeName(node, nodeNames);
this.$emit("nodeSelectEvent", nodeIds, nodeNames);
},
getChildNodeId(rootNode, nodeIds) {
//递归获取所有子节点ID
......@@ -114,7 +116,12 @@
for (let i = 0; i < rootNode.childNodes.length; i++){
this.getChildNodeId(rootNode.childNodes[i], nodeIds);
}
return nodeIds;
},
getParentNodeName(rootNode, nodeNames) {
if (rootNode.parent && rootNode.parent.id != 0) {
this.getParentNodeName(rootNode.parent, nodeNames)
}
nodeNames.push(rootNode.data.name);
},
filterNode(value, data) {
if (!value) return true;
......
......@@ -5,13 +5,18 @@
<template v-slot:header>
<div>
<el-row type="flex" justify="space-between" align="middle">
<span class="title">{{$t('test_track.case.test_case')}}
<span class="title">
<node-breadcrumb
:node-names="selectNodeNames"
@refresh="refresh"/>&nbsp;
<ms-tip-button v-if="!showMyTestCase"
:tip="$t('test_track.plan_view.my_case')"
icon="el-icon-s-custom" @click="searchMyTestCase"/>
<ms-tip-button v-if="showMyTestCase"
:tip="$t('test_track.plan_view.all_case')"
icon="el-icon-files" @click="searchMyTestCase"/></span>
icon="el-icon-files" @click="searchMyTestCase"/>
</span>
<span class="operate-button">
<el-button icon="el-icon-connection" size="small" round
......@@ -23,23 +28,12 @@
<el-button icon="el-icon-user" size="small" round
@click="handleBatch('executor')" >{{$t('test_track.plan_view.change_executor')}}</el-button>
<el-input type="text" size="small"
class="search"
:placeholder="$t('load_test.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition.name" @change="search" clearable/>
<ms-table-search-bar :condition.sync="condition" @change="initTableData"/>
</span>
</el-row>
<executor-edit
ref="executorEdit"
:select-ids="selectIds"
@refresh="refresh"/>
<status-edit
ref="statusEdit"
:select-ids="selectIds"
@refresh="refresh"/>
<executor-edit ref="executorEdit" :select-ids="selectIds" @refresh="refresh"/>
<status-edit ref="statusEdit" :select-ids="selectIds" @refresh="refresh"/>
</div>
</template>
......@@ -168,11 +162,15 @@
import TestPlanTestCaseEdit from "../components/TestPlanTestCaseEdit";
import MsTipButton from '../../../../components/common/components/MsTipButton';
import MsTablePagination from '../../../../components/common/pagination/TablePagination';
import MsTableSearchBar from '../../../../components/common/components/MsTableSearchBar';
import NodeBreadcrumb from '../../common/NodeBreadcrumb';
import {TokenKey} from '../../../../../common/js/constants';
export default {
name: "TestPlanTestCaseList",
components: {PlanNodeTree, StatusEdit, ExecutorEdit, MsTipButton, MsTablePagination, TestPlanTestCaseEdit},
components: {PlanNodeTree, StatusEdit, ExecutorEdit, MsTipButton, MsTablePagination,
TestPlanTestCaseEdit, MsTableSearchBar, NodeBreadcrumb},
data() {
return {
result: {},
......@@ -192,6 +190,9 @@
},
selectNodeIds: {
type: Array
},
selectNodeNames: {
type: Array
}
},
watch: {
......@@ -199,7 +200,7 @@
this.initTableData();
},
selectNodeIds() {
this.refresh();
this.search();
}
},
created: function () {
......@@ -219,7 +220,7 @@
},
refresh() {
this.condition = {};
this.initTableData();
this.$emit('refresh');
},
search() {
this.initTableData();
......@@ -303,4 +304,8 @@
}
.el-breadcrumb {
display: inline-block;
}
</style>
......@@ -46,7 +46,8 @@ export default {
'refresh': 'Refresh',
'remark': 'Remark',
'delete': 'Delete',
'not_filled': 'Not filled'
'not_filled': 'Not filled',
'search_by_name': 'Search by name',
},
workspace: {
'create': 'Create Workspace',
......
......@@ -48,6 +48,7 @@ export default {
'delete': '删除',
'not_filled': '未填写',
'please_select': '请选择',
'search_by_name': '根据名称搜索',
},
workspace: {
'create': '创建工作空间',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册