From a79e85a2de679cc4886d82eb70d0b90d3e2a8861 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 08 五月 2023 09:33:51 +0800
Subject: [PATCH] 图层管理上移下移修改

---
 src/views/datamanage/layerManagement.vue |   46 +++++++++++++++++++++++++++++-----------------
 1 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/src/views/datamanage/layerManagement.vue b/src/views/datamanage/layerManagement.vue
index 3cbc504..1da5a84 100644
--- a/src/views/datamanage/layerManagement.vue
+++ b/src/views/datamanage/layerManagement.vue
@@ -438,19 +438,24 @@
           if (currentId != 0) {
             const tempChildrenNodex1 = pchildNodes[currentId - 1];
             const tempChildrenNodex2 = pchildNodes[currentId];
-            tempChildrenNodex2.orderNum =
-              pchildNodes[currentId - 1].data.orderNum;
-            tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
+            // tempChildrenNodex2.orderNum =
+            //   pchildNodes[currentId - 1].data.orderNum;
+            // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
             var arr = [];
             this.oriData.filter((res) => {
               if (res.id == tempChildrenNodex2.data.id) {
-                res.orderNum = tempChildrenNodex2.orderNum;
+                // res.orderNum = tempChildrenNodex2.orderNum;
                 arr.push(res);
               } else if (res.id == tempChildrenNodex1.data.id) {
-                res.orderNum = tempChildrenNodex1.orderNum;
+                // res.orderNum = tempChildrenNodex1.orderNum;
                 arr.push(res);
               }
             });
+
+            const orderNum = arr[1].orderNum
+            arr[1].orderNum = arr[0].orderNum
+            arr[0].orderNum = orderNum
+
             this.newData = arr;
             this.sendChange();
           } else {
@@ -464,19 +469,22 @@
           if (currentId < pchildNodes.length - 1) {
             const tempChildrenNodex1 = pchildNodes[currentId + 1];
             const tempChildrenNodex2 = pchildNodes[currentId];
-            tempChildrenNodex2.orderNum =
-              pchildNodes[currentId + 1].data.orderNum;
-            tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
+            // tempChildrenNodex2.orderNum =
+            //   pchildNodes[currentId + 1].data.orderNum;
+            // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum;
             var arr = [];
             this.oriData.filter((res) => {
               if (res.id == tempChildrenNodex2.data.id) {
-                res.orderNum = tempChildrenNodex2.orderNum;
+                // res.orderNum = tempChildrenNodex2.orderNum;
                 arr.push(res);
               } else if (res.id == tempChildrenNodex1.data.id) {
-                res.orderNum = tempChildrenNodex1.orderNum;
+                // res.orderNum = tempChildrenNodex1.orderNum;
                 arr.push(res);
               }
             });
+            const orderNum = arr[1].orderNum
+            arr[1].orderNum = arr[0].orderNum
+            arr[0].orderNum = orderNum
             this.newData = arr;
             this.sendChange();
           } else {
@@ -622,13 +630,17 @@
       });
     },
     layerFormInline(res) {
+
       var val = JSON.parse(JSON.stringify(res))
-      this.backUpData = JSON.stringify(res)
-      this.currentData = JSON.stringify(res)
-      this.formInline = val;
-      this.formInline.type = val.type.toString();
-      this.formInline.isShow = val.isShow.toString();
-      this.formInline.isProject = val.isProject.toString();
+
+      var data = this.$refs.tree.getNode(val.id).data;
+
+      this.backUpData = JSON.stringify(data)
+      this.currentData = JSON.stringify(data)
+      this.formInline = data;
+      this.formInline.type = data.type.toString();
+      this.formInline.isShow = data.isShow.toString();
+      this.formInline.isProject = data.isProject.toString();
     },
     //鍥惧眰鍒楄〃鐐瑰嚮浜嬩欢
     handleNodeClick(data, node) {
@@ -643,7 +655,7 @@
 
           branchArr.sort(function (a, b) {
 
-            return b.orderNum - a.orderNum
+            return a.orderNum - b.orderNum
           })
         }
 

--
Gitblit v1.9.3