From 2c461eb9efb980d55dfd7407ee70088fc90a4a7a Mon Sep 17 00:00:00 2001
From: 钟日健 <5689795+arsn@user.noreply.gitee.com>
Date: Tue, 08 Feb 2022 14:24:31 +0800
Subject: [PATCH] 保安员详情修改

---
 src/views/system/user.vue |  102 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 70 insertions(+), 32 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index 3e43dd0..3ed7870 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -14,7 +14,11 @@
       </div>
     </el-col>
     <el-col :span="sizes[1]">
-      <basic-container>
+      <basic-container
+        :class="[
+          $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
+        ]"
+      >
         <avue-crud
           :option="option"
           :search.sync="search"
@@ -196,7 +200,7 @@
   resetPassword,
   getJurisdiction,
 } from "@/api/system/user";
-import { getDeptTree, getDeptLazyTree } from "@/api/system/dept";
+import { getSecurityDeptTree, getDeptLazyTree } from "@/api/system/dept";
 import { getRoleTree } from "@/api/system/role";
 import { getPostList } from "@/api/system/post";
 import { mapGetters } from "vuex";
@@ -242,11 +246,13 @@
         pageSize: 10,
         currentPage: 1,
         total: 0,
+        ...this.$store.state.control.changePageSize,
       },
       platformPage: {
         pageSize: 10,
         currentPage: 1,
         total: 0,
+        ...this.$store.state.control.changePageSize,
       },
       init: {
         roleTree: [],
@@ -262,7 +268,8 @@
       treeData: [],
       treeOption: {
         nodeKey: "id",
-        defaultExpandAll:true,
+        defaultExpandedKeys: [],
+        // defaultExpandAll:true,
         // lazy: false,
         // treeLoad: "", //处理权限  在created中
         //  function (node, resolve) {
@@ -323,6 +330,7 @@
         viewBtn: true,
         //dialogType: 'drawer',
         dialogClickModal: false,
+        ...this.$store.state.control.clearOtherBut,
         column: [
           {
             label: "登录账号",
@@ -364,13 +372,13 @@
                 label: "所属组织机构",
                 prop: "deptId",
                 type: "tree",
-                defaultExpandAll:true,
+                defaultExpandAll: true,
                 // dicUrl: "/api/blade-system/dept/lazy-tree",
                 props: {
                   label: "title",
                   value: "id",
                 },
-                dicData:[],
+                dicData: [],
                 // hide: !website.tenantMode,
                 // addDisplay: website.tenantMode,
                 // editDisplay: website.tenantMode,
@@ -514,7 +522,6 @@
                   },
                 ],
               },
-              
             ],
           },
         ],
@@ -690,13 +697,16 @@
     },
   },
   created() {
-    console.log(this.userInfo.role_name);
-    if (this.userInfo.role_name == "保安公司管理员") {
+    // console.log(this.userInfo.role_name);
+    if (
+      this.userInfo.role_name == "保安公司管理员" ||
+      this.userInfo.role_name == "分公司管理员"
+    ) {
       this.deptids = this.userInfo.dept_id;
       this.sizes = [0, 24];
       this.isguanli = false;
       this.option.group[0].column[0]["value"] = this.userInfo.dept_id;
-      this.option.group[0].column[0]["disabled"] = true;
+      // this.option.group[0].column[0]["disabled"] = true;
       // this.option.group[2].column[1]["disabled"] = true;
     } else {
       this.deptids = null;
@@ -706,10 +716,14 @@
     var that = this;
     //公安局进入
     if (this.userInfo.role_name == "公安管理员") {
-      var  parentId = this.userInfo.dept_id;
-      var  userId = this.userInfo.Id;
+      var parentId = this.userInfo.dept_id;
+      var userId = this.userInfo.Id;
       getDeptLazyTree(parentId, userId).then((res) => {
         that.treeData = res.data.data;
+        that.treeOption.defaultExpandedKeys = [];
+        res.data.data.forEach((item) => {
+          that.treeOption.defaultExpandedKeys.push(item.id);
+        });
       });
     } else {
       // this.treeOption.treeLoad = function (node, resolve) {
@@ -728,7 +742,10 @@
       getDeptLazyTree(0).then((res) => {
         that.treeData = res.data.data;
       });
-      this.treeOption.defaultExpandAll = false;
+      // var parentId1 = this.userInfo.dept_id;
+      // getSecurityDeptTree(null,null,this.userInfo.dept_id).then((res) => {
+      //   that.treeData = res.data.data;
+      // });
     }
   },
   mounted() {
@@ -755,37 +772,58 @@
         if (d == "保安公司管理员") {
           // console.log(k);
           for (var n in k) {
-            if (k[n].title == "保安" || k[n].title == "保安公司管理员") {
+            if (k[n].title == "保安" || k[n].title == "保安公司管理员" || k[n].title == "分公司管理员") {
               b.push(k[n]);
             }
           }
           column.dicData = b;
-        } else if(d == "公安管理员"){
+        } else if (d == "分公司管理员") {
+          for (var j in k) {
+            if (k[j].title == "分公司管理员" || k[j].title == "保安") {
+              b.push(k[j]);
+            }
+            if(k[j].children){
+              for (var h in k[j].children) {
+                if (k[j].children[h].title == "分公司管理员" || k[j].children[h].title == "保安") {
+                  b.push(k[j].children[h]);
+                }
+              }
+            }
+          }
+          column.dicData = b;
+        }else if (d == "公安管理员") {
           for (var i in k) {
             if (k[i].title == "公安管理员") {
               b.push(k[i]);
             }
           }
           column.dicData = b;
-        }else {
+        } else {
           column.dicData = k;
         }
       });
-
+// this.userInfo.role_name == "保安公司管理员"
       //公安局进入
-    if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "保安公司管理员") {
-      var  parentId = this.userInfo.dept_id;
-      var  userId = this.userInfo.Id;
-      getDeptLazyTree(parentId, userId).then((res) => {
-        const column = this.findObject(this.option.group, "deptId");
-        column.dicData = res.data.data;
-      });
-    } else {
-      getDeptLazyTree(0).then((res) => {
-        const column = this.findObject(this.option.group, "deptId");
-        column.dicData = res.data.data;
-      });
-    }
+      if (
+        this.userInfo.role_name == "公安管理员"
+      ) {
+        var parentId = this.userInfo.dept_id;
+        var userId = this.userInfo.Id;
+        getDeptLazyTree(parentId, userId).then((res) => {
+          const column = this.findObject(this.option.group, "deptId");
+          column.dicData = res.data.data;
+        });
+      } else if( this.userInfo.role_name == "administrator"){
+        getDeptLazyTree(0).then((res) => {
+          const column = this.findObject(this.option.group, "deptId");
+          column.dicData = res.data.data;
+        });
+      }else {
+        getSecurityDeptTree(null,null,this.userInfo.dept_id).then((res) => {
+            const column = this.findObject(this.option.group, "deptId");
+            column.dicData = res.data.data;
+        });
+      }
       // getDeptTree(tenantId).then((res) => {
       //   const column = this.findObject(this.option.group, "deptId");
       //   column.dicData = res.data.data;
@@ -985,11 +1023,11 @@
     },
     beforeOpen(done, type) {
       if (["edit", "view"].includes(type)) {
-        if(this.userInfo.role_name!="公安管理员"){
+        if (this.userInfo.role_name != "公安管理员") {
           const column = this.findObject(this.option.group, "code");
           column.display = false;
         }
-        
+
         getUser(this.form.id).then((res) => {
           this.form = res.data.data;
           if (this.form.hasOwnProperty("deptId")) {
@@ -1004,7 +1042,7 @@
         });
       }
       if (["add"].includes(type)) {
-        if(this.userInfo.role_name!="公安管理员"){
+        if (this.userInfo.role_name != "公安管理员") {
           const column = this.findObject(this.option.group, "code");
           column.display = false;
         }

--
Gitblit v1.9.3