fix: 拖拽节点到根节点报错

This commit is contained in:
chenjianxing 2021-02-04 17:43:13 +08:00
parent ad1c9d3ffe
commit 6bad2e75df
4 changed files with 57 additions and 50 deletions

View File

@ -11,6 +11,7 @@
@edit="edit"
@drag="drag"
@remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange"
ref="nodeTree">
@ -34,14 +35,14 @@
</template>
<script>
import SelectMenu from "../../../track/common/SelectMenu";
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../track/common/NodeTree";
import {buildNodePath} from "../../definition/model/NodeTree";
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
import SelectMenu from "../../../track/common/SelectMenu";
import MsAddBasisScenario from "@/business/components/api/automation/scenario/AddBasisScenario";
import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../track/common/NodeTree";
import {buildNodePath} from "../../definition/model/NodeTree";
import ModuleTrashButton from "../../definition/components/module/ModuleTrashButton";
export default {
export default {
name: 'MsApiScenarioModule',
components: {
ModuleTrashButton,

View File

@ -11,6 +11,7 @@
@edit="edit"
@drag="drag"
@remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange"
ref="nodeTree">
@ -33,16 +34,16 @@
</template>
<script>
import MsAddBasisApi from "../basis/AddBasisApi";
import SelectMenu from "../../../../track/common/SelectMenu";
import {OPTIONS} from "../../model/JsonData";
import ApiImport from "../import/ApiImport";
import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../../track/common/NodeTree";
import ApiModuleHeader from "./ApiModuleHeader";
import {buildNodePath} from "../../model/NodeTree";
import MsAddBasisApi from "../basis/AddBasisApi";
import SelectMenu from "../../../../track/common/SelectMenu";
import {OPTIONS} from "../../model/JsonData";
import ApiImport from "../import/ApiImport";
import {getCurrentProjectID} from "@/common/js/utils";
import MsNodeTree from "../../../../track/common/NodeTree";
import ApiModuleHeader from "./ApiModuleHeader";
import {buildNodePath} from "../../model/NodeTree";
export default {
export default {
name: 'MsApiModule',
components: {
ApiModuleHeader,

View File

@ -220,6 +220,10 @@ export default {
if (dropType === "none" || dropType === undefined) {
return;
}
if (dropNode.data.id === 'root' && dropType === 'before') {
this.$emit('refresh');
return false;
}
let param = this.buildParam(draggingNode, dropNode, dropType);
let list = [];
this.getNodeTree(this.treeNodes, draggingNode.data.id, list);

View File

@ -8,17 +8,18 @@
@drag="drag"
@remove="remove"
@nodeSelectEvent="nodeChange"
@refresh="list"
ref="nodeTree"/>
</template>
<script>
import NodeEdit from "./NodeEdit";
import {getCurrentProjectID} from "../../../../common/js/utils";
import MsNodeTree from "./NodeTree";
import NodeEdit from "./NodeEdit";
import {getCurrentProjectID} from "../../../../common/js/utils";
import MsNodeTree from "./NodeTree";
export default {
export default {
name: "TestCaseNodeTree",
components: {MsNodeTree, NodeEdit },
components: {MsNodeTree, NodeEdit},
data() {
return {
defaultProps: {