From 9ecc792eb82c7a94f35ea7f2056567202c6efbff Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 13 Mar 2023 11:00:19 +0800
Subject: [PATCH] 地图选点方式改变,点击按钮后根据所选行政区跳转

---
 src/views/system/user.vue |  116 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 93 insertions(+), 23 deletions(-)

diff --git a/src/views/system/user.vue b/src/views/system/user.vue
index b3408d1..7f9a84f 100644
--- a/src/views/system/user.vue
+++ b/src/views/system/user.vue
@@ -180,7 +180,6 @@
   import {exportBlob} from "@/api/common";
   import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
   import {getRoleTree} from "@/api/system/role";
-  import {getPostList} from "@/api/system/post";
   import {mapGetters} from "vuex";
   import website from '@/config/website';
   import {getToken} from '@/util/auth';
@@ -285,10 +284,33 @@
               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"
+              }],
+              display: false
+            },
+            {
               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,12 +346,46 @@
               prop: "phone",
               search: true,
               searchSpan:4,
+              searchOrder:8,
               display: false,
             },
             {
               label: "所属单位",
               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"
+              }],
+              display: false
+            },
+            {
+              label: "启用状态",
+              prop: "status",
+              type: "select",
+              dicUrl: '/api/blade-system/dict-biz/dictionary?code=user_status',
+              props: {
+                label: "dictValue",
+                value: "dictKey"
+              },
               display: false
             },
           ],
@@ -405,7 +462,7 @@
                   overHidden: true
                 },
                 {
-                  label: "用户性别",
+                  label: "性别",
                   prop: "sex",
                   type: "select",
                   dicData: [
@@ -453,7 +510,7 @@
                   label: "所属角色",
                   prop: "roleId",
                   search:true,
-                  multiple: true,
+                  multiple: false,
                   type: "tree",
                   dicData: [],
                   props: {
@@ -685,15 +742,19 @@
         getRoleTree(tenantId).then(res => {
           const column = this.findObject(this.option.group, "roleId");
           column.dicData = res.data.data;
+          const columnRole = this.findObject(this.option.column, "roleId");
+          columnRole.dicData = res.data.data;
         });
         getDeptTree(tenantId).then(res => {
           const column = this.findObject(this.option.group, "deptId");
           column.dicData = res.data.data;
+          const columnDept = this.findObject(this.option.column, "deptId");
+          columnDept.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 +768,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 +785,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 +949,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,14 +975,22 @@
       },
       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;
           this.data = data.records;
+          this.data.forEach(e=>{
+            e.status = e.status + ""
+          })
           this.loading = false;
           this.selectionClear();
         });
       },
+
+      //下面的方法业务都不需要
       platformRowUpdate(row, index, done, loading) {
         updatePlatform(row.id, row.userType, row.userExt).then(() => {
           this.platformOnLoad(this.platformPage);

--
Gitblit v1.9.3