解决面包屑key重复

This commit is contained in:
chenjianxing 2020-05-14 10:09:04 +08:00
parent 8c286795f7
commit d569ef8582
6 changed files with 26 additions and 26 deletions

View File

@ -23,8 +23,8 @@
<el-main class="test-case-list">
<test-case-list
:current-project="currentProject"
:selectNodeIds="selectNodeIds"
:selectNodeNames="selectNodeNames"
:select-node-ids="selectNodeIds"
:select-parent-nodes="selectParentNodes"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@testCaseDetail="showTestCaseDetail"
@ -71,7 +71,7 @@
currentProject: null,
treeNodes: [],
selectNodeIds: [],
selectNodeNames: [],
selectParentNodes: [],
testCaseReadOnly: true,
selectNode: {},
}
@ -142,9 +142,9 @@
changeProject(project) {
this.setCurrentProject(project);
},
nodeChange(nodeIds, nodeNames) {
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
this.selectParentNodes = pNodes;
},
refreshTable() {
this.$refs.testCaseList.initTableData();
@ -171,7 +171,7 @@
},
refresh() {
this.selectNodeIds = [];
this.selectNodeNames = [];
this.selectParentNodes = [];
this.selectNode = {};
this.$refs.testCaseList.initTableData();
this.getNodeTree();

View File

@ -7,7 +7,7 @@
<ms-table-header :condition.sync="condition" @search="initTableData"
:create-tip="$t('test_track.case.create')" @create="testCaseCreate">
<template v-slot:title>
<node-breadcrumb class="table-title" :node-names="selectNodeNames" @refresh="refresh"/>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template>
<template v-slot:button>
<ms-table-button icon="el-icon-upload2" :content="$t('test_track.case.import.import')" @click="importTestCase"/>
@ -160,7 +160,7 @@
selectNodeIds: {
type: Array
},
selectNodeNames: {
selectParentNodes: {
type: Array
}
},

View File

@ -6,7 +6,8 @@
{{$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-item v-for="node in data" :key="node.id">{{node.name}}</el-breadcrumb-item>
</el-breadcrumb>
</template>
@ -19,12 +20,12 @@
}
},
props: {
nodeNames: {
nodes: {
type: Array
}
},
watch: {
nodeNames() {
nodes() {
this.filterData();
}
},
@ -33,7 +34,7 @@
this.$emit('refresh');
},
filterData() {
this.data = this.nodeNames;
this.data = this.nodes;
if (this.data.length > 4) {
let lastData = this.data[this.data.length - 1];
this.data.splice(1, this.data.length);

View File

@ -52,7 +52,6 @@
</span>
</template>
</el-tree>
<node-edit ref="nodeEdit" :tree-nodes="treeNodes" @refresh="refreshNode" />
</div>
</template>
@ -168,10 +167,10 @@ export default {
},
handleNodeSelect(node) {
let nodeIds = [];
let nodeNames = [];
let pNodes = [];
this.getChildNodeId(node, nodeIds);
this.getParentNodeName(node, nodeNames);
this.$emit("nodeSelectEvent", nodeIds, nodeNames);
this.getParentNodes(node, pNodes);
this.$emit("nodeSelectEvent", nodeIds, pNodes);
this.$emit("update:selectNode", node);
},
getChildNodeId(rootNode, nodeIds) {
@ -181,12 +180,12 @@ export default {
this.getChildNodeId(rootNode.childNodes[i], nodeIds);
}
},
getParentNodeName(rootNode, nodeNames) {
getParentNodes(rootNode, pNodes) {
if (rootNode.parent && rootNode.parent.id != 0) {
this.getParentNodeName(rootNode.parent, nodeNames);
this.getParentNodes(rootNode.parent, pNodes);
}
if (rootNode.data.name && rootNode.data.name != "") {
nodeNames.push(rootNode.data.name);
pNodes.push(rootNode.data);
}
},
filterNode(value, data) {

View File

@ -23,7 +23,7 @@
@refresh="refresh"
:plan-id="planId"
:select-node-ids="selectNodeIds"
:select-node-names="selectNodeNames"
:select-parent-nodes="selectParentNodes"
ref="testCasePlanList"/>
</el-main>
</el-container>
@ -52,7 +52,7 @@
testPlans: [],
currentPlan: {},
selectNodeIds: [],
selectNodeNames: [],
selectParentNodes: [],
treeNodes: []
}
},
@ -72,7 +72,7 @@
methods: {
refresh() {
this.selectNodeIds = [];
this.selectNodeNames = [];
this.selectParentNodes = [];
this.getNodeTreeByPlanId();
},
initData() {
@ -92,9 +92,9 @@
});
});
},
nodeChange(nodeIds, nodeNames) {
nodeChange(nodeIds, pNodes) {
this.selectNodeIds = nodeIds;
this.selectNodeNames = nodeNames;
this.selectParentNodes = pNodes;
},
changePlan(plan) {
this.currentPlan = plan;

View File

@ -3,7 +3,7 @@
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" :show-create="false">
<template v-slot:title>
<node-breadcrumb class="table-title" :node-names="selectNodeNames" @refresh="refresh"/>
<node-breadcrumb class="table-title" :nodes="selectParentNodes" @refresh="refresh"/>
</template>
<template v-slot:button>
<ms-table-button v-if="!showMyTestCase" icon="el-icon-s-custom" :content="$t('test_track.plan_view.my_case')" @click="searchMyTestCase"/>
@ -191,7 +191,7 @@
selectNodeIds: {
type: Array
},
selectNodeNames: {
selectParentNodes: {
type: Array
}
},