From 1e66dbf8da3bf8929a93e42e9217eae35f60237c Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 08 Nov 2021 15:40:08 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/system/user.vue |   91 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 73 insertions(+), 18 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index c3ca953..aabf96d 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -99,7 +99,7 @@
             <el-tag>{{ row.roleName }}</el-tag>
           </template>
           <template slot-scope="{ row }" slot="deptName">
-            <el-tag>{{ row.deptName }}</el-tag>
+            <el-tag>{{ row.deptName.split(",").join(" ,") }}</el-tag>
           </template>
           <template slot-scope="{ row }" slot="userTypeName">
             <el-tag>{{ row.userTypeName }}</el-tag>
@@ -220,6 +220,7 @@
         callback();
       }
     };
+
     return {
       isguanli: true,
 
@@ -261,19 +262,22 @@
       treeOption: {
         nodeKey: "id",
         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,
-                };
-              })
-            );
-          });
-        },
+        treeLoad: "", //处理权限  在created中
+        //  function (node, resolve) {
+        //   const parentId = node.level === 0 ? 0 : node.data.id;
+        //   //公安局进入
+
+        //   getDeptLazyTree(parentId, jurisdiction).then((res) => {
+        //     resolve(
+        //       res.data.data.map((item) => {
+        //         return {
+        //           ...item,
+        //           leaf: !item.hasChildren,
+        //         };
+        //       })
+        //     );
+        //   });
+        // },
         addBtn: false,
         menu: false,
         size: "small",
@@ -302,6 +306,7 @@
             label: "登录账号",
             prop: "account",
             search: true,
+            width: 190,
             display: false,
           },
           {
@@ -781,6 +786,39 @@
       this.deptids = null;
       this.sizes = [5, 19];
     }
+
+    //公安局进入
+    var jurisdiction = "";
+    if (this.userInfo.role_name == "公安管理员") {
+      jurisdiction = this.userInfo.jurisdiction;
+      this.treeOption.treeLoad = function (node, resolve) {
+        const parentId = node.level === 0 ? 0 : node.data.id;
+        getDeptLazyTree(parentId, jurisdiction).then((res) => {
+          resolve(
+            res.data.data.map((item) => {
+              return {
+                ...item,
+                leaf: !item.hasChildren,
+              };
+            })
+          );
+        });
+      };
+    } else {
+      this.treeOption.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,
+              };
+            })
+          );
+        });
+      };
+    }
   },
   mounted() {
     // 非保安单位模式默认加载管理组数据
@@ -790,8 +828,12 @@
   },
   methods: {
     nodeClick(data) {
-      this.treeDeptId = data.id;
+      if (data.id == "1123598813738675201") {
+        data.id = "1372091709474910209";
+      }
+      this.treeDeptId = data;
       this.page.currentPage = 1;
+      // console.log(this.treeDeptId);
       this.onLoad(this.page);
     },
     initData(tenantId, d) {
@@ -1040,12 +1082,23 @@
     },
     onLoad(page, params = {}) {
       this.loading = true;
-      var deptid = this.deptids == null ? this.treeDeptId : this.deptids;
+      var deptid = this.deptids == null ? this.treeDeptId.id : this.deptids;
+      //公安局进入
+      if (this.userInfo.role_name == "公安管理员") {
+        params["jurisdiction"] = this.userInfo.jurisdiction;
+      }
+      var test = /派出所|分局|公安局|市公安局$/g;
+      var jurisdiction = "";
+      if (test.test(this.treeDeptId.title)) {
+        jurisdiction = this.treeDeptId.id;
+      }
+      params["status"] = 1;
       getList(
         page.currentPage,
         page.pageSize,
         Object.assign(params, this.query),
-        deptid
+        deptid,
+        jurisdiction
       ).then((res) => {
         const data = res.data.data;
         this.page.total = data.total;
@@ -1106,12 +1159,14 @@
     },
     platformOnLoad(page, params = {}) {
       this.platformLoading = true;
+      var jurisdiction = "";
       var deptid = this.deptids == null ? this.treeDeptId : this.deptids;
       getList(
         page.currentPage,
         page.pageSize,
         Object.assign(params, this.query),
-        deptid
+        deptid,
+        jurisdiction
       ).then((res) => {
         const data = res.data.data;
         this.platformPage.total = data.total;

--
Gitblit v1.9.3