mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-06 05:58:46 +08:00
fix: 模块树拖拽
This commit is contained in:
parent
bca1ef13cb
commit
7de5205b99
@ -415,7 +415,7 @@ public class TestCaseNodeService {
|
|||||||
|
|
||||||
List<TestCaseNode> updateNodes = new ArrayList<>();
|
List<TestCaseNode> updateNodes = new ArrayList<>();
|
||||||
|
|
||||||
buildUpdateTestCase(nodeTree, testCases, updateNodes, "/", null, 1);
|
buildUpdateTestCase(nodeTree, testCases, updateNodes, "/", "0", 1);
|
||||||
|
|
||||||
updateNodes = updateNodes.stream()
|
updateNodes = updateNodes.stream()
|
||||||
.filter(item -> nodeIds.contains(item.getId()))
|
.filter(item -> nodeIds.contains(item.getId()))
|
||||||
|
@ -107,6 +107,16 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
handleDragEnd(draggingNode, dropNode, dropType, ev) {
|
||||||
|
let param = this.buildParam(draggingNode, dropNode, dropType);
|
||||||
|
console.log(this.treeNodes);
|
||||||
|
this.$post("/case/node/drag", param, () => {
|
||||||
|
draggingNode.data.level = param.level;
|
||||||
|
this.refreshTable();
|
||||||
|
}, (error) => {
|
||||||
|
this.refreshNode();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildParam(draggingNode, dropNode, dropType) {
|
||||||
let param = {};
|
let param = {};
|
||||||
param.id = draggingNode.data.id;
|
param.id = draggingNode.data.id;
|
||||||
param.name = draggingNode.data.name;
|
param.name = draggingNode.data.name;
|
||||||
@ -115,7 +125,7 @@ export default {
|
|||||||
param.parentId = dropNode.data.id;
|
param.parentId = dropNode.data.id;
|
||||||
param.level = dropNode.data.level + 1;
|
param.level = dropNode.data.level + 1;
|
||||||
} else {
|
} else {
|
||||||
if (dropNode.parent.id === 0) {
|
if (!dropNode.parent.id || dropNode.parent.id === 0) {
|
||||||
param.parentId = 0;
|
param.parentId = 0;
|
||||||
param.level = 1;
|
param.level = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -135,12 +145,9 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
param.nodeIds = nodeIds;
|
param.nodeIds = nodeIds;
|
||||||
this.$post("/case/node/drag", param, () => {
|
return param;
|
||||||
this.refreshTable();
|
|
||||||
}, (error) => {
|
|
||||||
this.refreshNode();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
refreshTable() {
|
refreshTable() {
|
||||||
this.$emit('refreshTable');
|
this.$emit('refreshTable');
|
||||||
|
Loading…
Reference in New Issue
Block a user