From 85cec9a000cae214496feaea25f71c66f5663c2a Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 06 Mar 2023 16:34:44 +0800
Subject: [PATCH] 机构管理、用户管理完成;火灾管理详情页显示,添加地图

---
 src/views/system/user.vue |  101 +++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index b3408d1..5ae2fb7 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -285,10 +285,32 @@
               display: false
             },
             {
+              label: "所属角色",
+              prop: "roleId",
+              search:true,
+              searchOrder:1,
+              searchSpan:3,
+              multiple: true,
+              type: "tree",
+              dicData: [],
+              props: {
+                label: "title"
+              },
+              checkStrictly: true,
+              slot: true,
+              hide:true,
+              rules: [{
+                required: true,
+                message: "请选择所属角色",
+                trigger: "click"
+              }]
+            },
+            {
               label: "用户名",
               prop: "account",
               search: true,
               searchSpan:4,
+              searchOrder:10,
               display: false
             },
             {
@@ -296,10 +318,11 @@
               prop: "realName",
               search: true,
               searchSpan:4,
+              searchOrder:9,
               display: false
             },
             {
-              label: "用户性别",
+              label: "性别",
               prop: "sex",
               type: "select",
               dicData: [
@@ -323,6 +346,7 @@
               prop: "phone",
               search: true,
               searchSpan:4,
+              searchOrder:8,
               display: false,
             },
             {
@@ -330,6 +354,27 @@
               prop: "deptName",
               slot: true,
               display: false
+            },
+            {
+              label: "所属单位",
+              prop: "deptId",
+              search: true,
+              searchSpan:3,
+              searchOrder:7,
+              type: "tree",
+              // multiple: true,
+              dicData: [],
+              props: {
+                label: "title",
+                value:'id'
+              },
+              checkStrictly: true,
+              slot: true,
+              rules: [{
+                required: true,
+                message: "请选择所属单位",
+                trigger: "click"
+              }]
             },
           ],
           group: [
@@ -405,7 +450,7 @@
                   overHidden: true
                 },
                 {
-                  label: "用户性别",
+                  label: "性别",
                   prop: "sex",
                   type: "select",
                   dicData: [
@@ -453,7 +498,7 @@
                   label: "所属角色",
                   prop: "roleId",
                   search:true,
-                  multiple: true,
+                  multiple: false,
                   type: "tree",
                   dicData: [],
                   props: {
@@ -674,6 +719,14 @@
       if (!website.tenantMode) {
         this.initData(website.tenantId);
       }
+      getRoleTree(this.userInfo.tenant_id).then(res => {
+        const column = this.findObject(this.option.column, "roleId");
+        column.dicData = res.data.data;
+      });
+      getDeptTree(this.userInfo.tenant_id).then(res => {
+        const column = this.findObject(this.option.column, "deptId");
+        column.dicData = res.data.data;
+      });
     },
     methods: {
       nodeClick(data) {
@@ -690,10 +743,10 @@
           const column = this.findObject(this.option.group, "deptId");
           column.dicData = res.data.data;
         });
-        getPostList(tenantId).then(res => {
-          const column = this.findObject(this.option.group, "postId");
-          column.dicData = res.data.data;
-        });
+        // getPostList(tenantId).then(res => {
+        //   const column = this.findObject(this.option.group, "postId");
+        //   column.dicData = res.data.data;
+        // });
       },
       submitRole() {
         const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
@@ -707,9 +760,9 @@
         });
       },
       rowSave(row, done, loading) {
-        row.deptId = row.deptId.join(",");
-        row.roleId = row.roleId.join(",");
-        row.postId = row.postId.join(",");
+        // row.deptId = row.deptId.join(",");
+        // row.roleId = row.roleId.join(",");
+        // row.postId = row.postId.join(",");
         add(row).then(() => {
           this.initFlag = false;
           this.onLoad(this.page);
@@ -724,9 +777,9 @@
         });
       },
       rowUpdate(row, index, done, loading) {
-        row.deptId = row.deptId.join(",");
-        row.roleId = row.roleId.join(",");
-        row.postId = row.postId.join(",");
+        // row.deptId = row.deptId.join(",");
+        // row.roleId = row.roleId.join(",");
+        // row.postId = row.postId.join(",");
         update(row).then(() => {
           this.initFlag = false;
           this.onLoad(this.page);
@@ -888,15 +941,16 @@
         if (["edit", "view"].includes(type)) {
           getUser(this.form.id).then(res => {
             this.form = res.data.data;
-            if(this.form.hasOwnProperty("deptId")){
-              this.form.deptId = this.form.deptId.split(",");
-            }
-            if(this.form.hasOwnProperty("roleId")){
-              this.form.roleId = this.form.roleId.split(",");
-            }
-            if(this.form.hasOwnProperty("postId")){
-              this.form.postId = this.form.postId.split(",");
-            }
+            //设置为多选时打开
+            // if(this.form.hasOwnProperty("deptId")){
+            //   this.form.deptId = this.form.deptId.split(",");
+            // }
+            // if(this.form.hasOwnProperty("roleId")){
+            //   this.form.roleId = this.form.roleId.split(",");
+            // }
+            // if(this.form.hasOwnProperty("postId")){
+            //   this.form.postId = this.form.postId.split(",");
+            // }
           });
         }
         this.initFlag = true;
@@ -913,6 +967,9 @@
       },
       onLoad(page, params = {}) {
         this.loading = true;
+        if (this.query.deptId){
+          this.treeDeptId = this.query.deptId
+        }
         getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
           const data = res.data.data;
           this.page.total = data.total;

--
Gitblit v1.9.3