Преглед на файлове

fix:上移下移、升降级增加state,防止快速操作时出错

vian преди 5 години
родител
ревизия
36e23fab80
променени са 1 файла, в които са добавени 19 реда и са изтрити 1 реда
  1. 19 1
      web/building_saas/pm/js/pm_newMain.js

+ 19 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -45,7 +45,8 @@ const STATE = {
     addingProject: false,
     addingFolder: false,
     deleting: false,
-    importing: false
+    importing: false,
+    moving: false,
 };
 const projTreeObj = {
     tree: null,
@@ -503,11 +504,16 @@ const projTreeObj = {
             }
             projTreeObj.moveTo(selected, null, parent, next, null, action);
             $.bootstrapLoading.end();
+            STATE.moving = false;
             projTreeObj.emitTreeChange();
         });
     },
     //升级后选中节点的后兄弟节点不成为其子节点,因为有层级类型限制(相当于选中节点移动到父项后成为其后兄弟)
     upLevel: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent.parent,
             next = selected.parent.nextSibling,
@@ -524,6 +530,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap});
     },
     downLevel: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = null,
             next = null,
@@ -546,6 +556,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap}, 'downLevel');
     },
     upMove: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent,
             next = selected.preSibling(),
@@ -563,6 +577,10 @@ const projTreeObj = {
         this.doAfterTreeOpr({selected, parent, next, projectMap});
     },
     downMove: function () {
+        if (STATE.moving) {
+            return;
+        }
+        STATE.moving = true;
         let selected = projTreeObj.tree.selected,
             parent = selected.parent,
             next = selected.nextSibling.nextSibling,