From 9da3b51159a7cab036e01907b6fc27779cf31b95 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 26 Nov 2021 09:19:36 +0800
Subject: [PATCH] +

---
 src/views/securityGuardManagement/registerOnce.vue |   76 +++++++++++++++++++++++++++-----------
 1 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/src/views/securityGuardManagement/registerOnce.vue b/src/views/securityGuardManagement/registerOnce.vue
index 17d545a..606d235 100644
--- a/src/views/securityGuardManagement/registerOnce.vue
+++ b/src/views/securityGuardManagement/registerOnce.vue
@@ -1,8 +1,8 @@
 /*
  * @Author: Morpheus
  * @Date: 2021-07-05 16:31:54
- * @Last Modified by: Morpheus
- * @Last Modified time: 2021-07-10 15:41:13
+ * @Last Modified by: liu
+ * @Last Modified time: 2021-11-26 09:16:21
  * menu-name 保安员注册查询
  */
 <template>
@@ -12,11 +12,11 @@
         <div class="box">
           <el-scrollbar>
             <basic-container>
-              <avue-tree
+              <!-- <avue-tree
                 :option="treeOption"
                 :data="treeData"
                 @node-click="nodeClick"
-              />
+              /> -->
             </basic-container>
           </el-scrollbar>
         </div>
@@ -307,16 +307,42 @@
         lazy: true,
         treeLoad: function (node, resolve) {
           const parentId = node.level === 0 ? 0 : node.data.id;
-          getDeptLazyTree(parentId).then((res) => {
-            resolve(
-              res.data.data.map((item) => {
-                return {
-                  ...item,
-                  leaf: !item.hasChildren,
-                };
-              })
-            );
-          });
+
+          if (parentId == 0) {
+            getDeptLazyTree(parentId).then((res) => {
+              resolve(
+                res.data.data.map((item) => {
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+                })
+              );
+            });
+          } else if (parentId == "1372091709474910209") {
+            getDeptLazyTree(parentId).then((res) => {
+              resolve(
+                res.data.data[0].children.map((item) => {
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+                })
+              );
+            });
+          } else {
+            getDeptLazyTree(parentId).then((res) => {
+              res.data.data = [];
+              resolve(
+                res.data.data.map((item) => {
+                  return {
+                    ...item,
+                    leaf: !item.hasChildren,
+                  };
+                })
+              );
+            });
+          }
         },
         addBtn: false,
         menu: false,
@@ -777,16 +803,22 @@
     },
     initData(tenantId) {
       getRoleTree(tenantId).then((res) => {
-        const column = this.findObject(this.option.group, "roleId");
-        column.dicData = res.data.data;
+        try {
+          const column = this.findObject(this.option.group, "roleId");
+          column.dicData = res.data.data;
+        } catch (error) {}
       });
       getDeptTree(tenantId).then((res) => {
-        const column = this.findObject(this.option.group, "deptId");
-        column.dicData = res.data.data;
+        try {
+          const column = this.findObject(this.option.group, "deptId");
+          column.dicData = res.data.data;
+        } catch (error) {}
       });
       getPostList(tenantId).then((res) => {
-        const column = this.findObject(this.option.group, "postId");
-        column.dicData = res.data.data;
+        try {
+          const column = this.findObject(this.option.group, "postId");
+          column.dicData = res.data.data;
+        } catch (error) {}
       });
     },
 
@@ -879,11 +911,11 @@
       if (this.departmentid) {
         deptId = this.departmentid;
       }
+      params["deptId"] = deptId;
       getListSecurity(
         page.currentPage,
         page.pageSize,
-        Object.assign(params, this.query),
-        deptId
+        Object.assign(params, this.query)
       ).then((res) => {
         const data = res.data.data;
         this.page.total = data.total;

--
Gitblit v1.9.3