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