From 98aec0baaef46392f6bede8f507466fc75eca137 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期四, 23 三月 2023 14:37:57 +0800
Subject: [PATCH] 顶部菜单修改,目录管理批量导入修改

---
 src/views/datamanage/catalogueManage.vue |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/views/datamanage/catalogueManage.vue b/src/views/datamanage/catalogueManage.vue
index f223bd7..2bf0266 100644
--- a/src/views/datamanage/catalogueManage.vue
+++ b/src/views/datamanage/catalogueManage.vue
@@ -493,8 +493,11 @@
           exts: res[i].exts,
           orderNum: null,
           pid: null,
+          tid: parseInt(value[2]) + 1,
+          sid: parseInt(value[3]) + 1
         })
       }
+
       this.tableData = arr;
       this.setInsertData(this.tableData);
 
@@ -511,19 +514,20 @@
         }
       }
       if (chLevel == 1) {
-        return [res['L' + chLevel], null]
+        return [res['L' + chLevel], null, flag, -1]
       } else {
         faLevel = chLevel - 1;
         for (var i = flag; i >= 0; i--) {
           var val = result[i]
           if (val['L' + faLevel]) {
-            return [res['L' + chLevel], val['L' + faLevel]]
+            return [res['L' + chLevel], val['L' + faLevel], flag, i]
             break;
           }
         }
       }
     },
     setInsertData(res) {
+
       var list = this.excelData(res);
 
       if (list.length != 0) {
@@ -531,7 +535,7 @@
           return this.$message.error("涓婁紶鏁版嵁閿欒锛岀涓�鏉℃暟鎹笉涓虹┖");
         }
 
-        this.getAllNodeId(list);
+        this.getAllNodeId(res);
       }
     },
     async getAllNodeId(res) {
@@ -542,8 +546,9 @@
           val.orderNum = this.dirList[this.dirList.length - 1].orderNum + 1;
           val.pid = 0;
         } else {
+
           this.tableData.filter((child) => {
-            if (child.name == val.pname) {
+            if (child.tid == val.sid) {
               val.pid = child.id;
               val.orderNum = i + 1;
             }
@@ -553,29 +558,31 @@
         const data = await insertDir(val);
         if (data.code != 200) {
         }
+
         this.tableData.filter((child) => {
-          if (child.name == val.name && child.pname == val.pname) {
+
+          if (child.name == val.name && child.tid == val.tid) {
             child.id = data.result;
           }
         });
         this.itemaName = data.result;
         this.getDirTree();
 
-        if (res[i].children) {
-          this.getAllNodeId(res[i].children);
-        }
+        // if (res[i].children) {
+        //   this.getAllNodeId(res[i].children);
+        // }
       }
     },
     excelData(source) {
       let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕
       return cloneData.filter((father) => {
         // 寰幆鎵�鏈夐」
-        let branchArr = cloneData.filter((child) => father.name == child.pname); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁
+        let branchArr = cloneData.filter((child) => father.tid == child.sid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁
 
         branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊�
         // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛�
         // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋�
-        return father.pname == null; // 杩斿洖涓�绾ц彍鍗�
+        return father.sid == 0; // 杩斿洖涓�绾ц彍鍗�
       });
     },
     readFile(file) {

--
Gitblit v1.9.3