From 31b647535e49f0a7b85d87a8c1e34c5ab92ca9d0 Mon Sep 17 00:00:00 2001
From: shikeying <pxzsky@163.com>
Date: 星期五, 10 三月 2023 14:54:25 +0800
Subject: [PATCH] 修改数据字典 支持树结构

---
 src/views/system/user/index.vue |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index f5f512f..63b646b 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -425,7 +425,7 @@
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 15,
         userName: undefined,
         phonenumber: undefined,
         status: undefined,
@@ -498,10 +498,18 @@
       );
     },
     /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
-    getTreeselect() {
-      treeselect(this.queryParams.deptId).then(response => {
+    getTreeselect(deptId) {
+      // treeselect(this.queryParams.deptId).then(response => {
+      //   this.deptOptions = response.data;
+      // });
+      if(deptId == undefined || deptId == ""){
+        this.$modal.alert("璇烽�夋嫨涓�涓儴闂�");
+        return false;
+      }
+      treeselect(deptId).then(response => {
         this.deptOptions = response.data;
       });
+      return true;
     },
 
     // 2022-12-08锛屽姞杞介《绾ф満鏋勬爲鍒楄〃
@@ -594,7 +602,9 @@
       //   this.$modal.msgSuccess("璇峰厛閫夋嫨涓�涓《绾ф満鏋�");
       //   return;
       // }
-      this.getTreeselect();
+      if(!this.getTreeselect(this.queryParams.deptId)){
+        return;
+      }
       // getUser().then(response => {
       getNewUserRoles(this.queryParams.deptId).then(response => {
         // this.postOptions = response.posts;
@@ -603,11 +613,12 @@
         this.title = "娣诲姞鐢ㄦ埛";
         this.form.password = this.initPassword;
       });
+
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
       this.reset();
-      this.getTreeselect();
+      // this.getTreeselect();
       // const userId = row.id || this.ids;
       const userId = row.id;
       getUser(userId).then(response => {
@@ -619,6 +630,7 @@
         this.open = true;
         this.title = "淇敼鐢ㄦ埛";
         this.form.password = "";
+        this.getTreeselect(this.form.dept_id);
       });
     },
     /** 閲嶇疆瀵嗙爜鎸夐挳鎿嶄綔 */

--
Gitblit v1.9.1