Drew 6 years ago
parent
commit
6587463a9d
1 changed files with 15 additions and 8 deletions
  1. 15 8
      src/main/vue/src/views/Menus.vue

+ 15 - 8
src/main/vue/src/views/Menus.vue

@@ -194,22 +194,27 @@ export default {
             };
             };
             if (node.previousSibling) {
             if (node.previousSibling) {
                 this.loading = true;
                 this.loading = true;
+                let sort0 = node.previousSibling.data.sort,
+                    sort1 = node.data.sort;
                 Promise.all([
                 Promise.all([
                     this.$http.post("/menu/save", {
                     this.$http.post("/menu/save", {
                         ...node.data,
                         ...node.data,
                         children: null,
                         children: null,
-                        sort: node.previousSibling.data.sort
+                        sort: sort0
                     }),
                     }),
                     this.$http.post("/menu/save", {
                     this.$http.post("/menu/save", {
                         ...node.previousSibling.data,
                         ...node.previousSibling.data,
                         children: null,
                         children: null,
-                        sort: node.data.sort
+                        sort: sort1
                     })
                     })
                 ])
                 ])
                     .then(_ => {
                     .then(_ => {
                         this.loading = false;
                         this.loading = false;
-                        let tmp = { ...node.previousSibling.data };
-                        node.previousSibling.data = { ...node.data };
+                        let tmp = { ...node.previousSibling.data, sort: sort1 };
+                        node.previousSibling.data = {
+                            ...node.data,
+                            sort: sort0
+                        };
                         node.data = tmp;
                         node.data = tmp;
                     })
                     })
                     .catch(e => {
                     .catch(e => {
@@ -231,22 +236,24 @@ export default {
             };
             };
             if (node.nextSibling) {
             if (node.nextSibling) {
                 this.loading = true;
                 this.loading = true;
+                let sort0 = node.data.sort,
+                    sort1 = node.nextSibling.data.sort;
                 Promise.all([
                 Promise.all([
                     this.$http.post("/menu/save", {
                     this.$http.post("/menu/save", {
                         ...node.data,
                         ...node.data,
                         children: null,
                         children: null,
-                        sort: node.nextSibling.data.sort
+                        sort: sort1
                     }),
                     }),
                     this.$http.post("/menu/save", {
                     this.$http.post("/menu/save", {
                         ...node.nextSibling.data,
                         ...node.nextSibling.data,
                         children: null,
                         children: null,
-                        sort: node.data.sort
+                        sort: sort0
                     })
                     })
                 ])
                 ])
                     .then(_ => {
                     .then(_ => {
                         this.loading = false;
                         this.loading = false;
-                        let tmp = { ...node.nextSibling.data };
-                        node.nextSibling.data = { ...node.data };
+                        let tmp = { ...node.nextSibling.data, sort: sort1 };
+                        node.nextSibling.data = { ...node.data, sort: sort0 };
                         node.data = tmp;
                         node.data = tmp;
                     })
                     })
                     .catch(e => {
                     .catch(e => {