From 55546dfc80bd2ec1be8786b19f53df4e1c1e44e5 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期二, 13 七月 2021 13:49:47 +0800
Subject: [PATCH] 发布 v2.5.1 针对 v2.5.0 版本新特性bug修复

---
 ruoyi-ui/src/views/system/user/index.vue |   80 +++++++++++++++++++++++++++------------
 1 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue
index 1a06eb3..605cf6e 100644
--- a/ruoyi-ui/src/views/system/user/index.vue
+++ b/ruoyi-ui/src/views/system/user/index.vue
@@ -131,6 +131,7 @@
               plain
               icon="el-icon-download"
               size="mini"
+              :loading="exportLoading"
               @click="handleExport"
               v-hasPermi="['system:user:export']"
             >瀵煎嚭</el-button>
@@ -166,7 +167,7 @@
             width="160"
             class-name="small-padding fixed-width"
           >
-            <template slot-scope="scope">
+            <template slot-scope="scope" v-if="scope.row.userId !== 1">
               <el-button
                 size="mini"
                 type="text"
@@ -175,20 +176,23 @@
                 v-hasPermi="['system:user:edit']"
               >淇敼</el-button>
               <el-button
-                v-if="scope.row.userId !== 1"
                 size="mini"
                 type="text"
                 icon="el-icon-delete"
                 @click="handleDelete(scope.row)"
                 v-hasPermi="['system:user:remove']"
               >鍒犻櫎</el-button>
-              <el-button
-                size="mini"
-                type="text"
-                icon="el-icon-key"
-                @click="handleResetPwd(scope.row)"
-                v-hasPermi="['system:user:resetPwd']"
-              >閲嶇疆</el-button>
+              <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
+                <span class="el-dropdown-link">
+                  <i class="el-icon-d-arrow-right el-icon--right"></i>鏇村
+                </span>
+                <el-dropdown-menu slot="dropdown">
+                  <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
+                    v-hasPermi="['system:user:resetPwd']">閲嶇疆瀵嗙爜</el-dropdown-item>
+                  <el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
+                    v-hasPermi="['system:user:edit']">鍒嗛厤瑙掕壊</el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
             </template>
           </el-table-column>
         </el-table>
@@ -209,7 +213,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="鐢ㄦ埛鏄电О" prop="nickName">
-              <el-input v-model="form.nickName" placeholder="璇疯緭鍏ョ敤鎴锋樀绉�" />
+              <el-input v-model="form.nickName" placeholder="璇疯緭鍏ョ敤鎴锋樀绉�" maxlength="30" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -233,12 +237,12 @@
         <el-row>
           <el-col :span="12">
             <el-form-item v-if="form.userId == undefined" label="鐢ㄦ埛鍚嶇О" prop="userName">
-              <el-input v-model="form.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" />
+              <el-input v-model="form.userName" placeholder="璇疯緭鍏ョ敤鎴峰悕绉�" maxlength="30" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item v-if="form.userId == undefined" label="鐢ㄦ埛瀵嗙爜" prop="password">
-              <el-input v-model="form.password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" type="password" />
+              <el-input v-model="form.password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" type="password" maxlength="20" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -356,6 +360,8 @@
     return {
       // 閬僵灞�
       loading: true,
+      // 瀵煎嚭閬僵灞�
+      exportLoading: false,
       // 閫変腑鏁扮粍
       ids: [],
       // 闈炲崟涓鐢�
@@ -437,7 +443,8 @@
           { required: true, message: "鐢ㄦ埛鏄电О涓嶈兘涓虹┖", trigger: "blur" }
         ],
         password: [
-          { required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }
+          { required: true, message: "鐢ㄦ埛瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" },
+          { min: 5, max: 20, message: '鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿', trigger: 'blur' }
         ],
         email: [
           {
@@ -542,7 +549,7 @@
     },
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery() {
-      this.queryParams.page = 1;
+      this.queryParams.pageNum = 1;
       this.getList();
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
@@ -557,13 +564,26 @@
       this.single = selection.length != 1;
       this.multiple = !selection.length;
     },
+    // 鏇村鎿嶄綔瑙﹀彂
+    handleCommand(command, row) {
+      switch (command) {
+        case "handleResetPwd":
+          this.handleResetPwd(row);
+          break;
+        case "handleAuthRole":
+          this.handleAuthRole(row);
+          break;
+        default:
+          break;
+      }
+    },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.reset();
       this.getTreeselect();
       getUser().then(response => {
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
+        this.postOptions = response.data.posts;
+        this.roleOptions = response.data.roles;
         this.open = true;
         this.title = "娣诲姞鐢ㄦ埛";
         this.form.password = this.initPassword;
@@ -575,11 +595,11 @@
       this.getTreeselect();
       const userId = row.userId || this.ids;
       getUser(userId).then(response => {
-        this.form = response.data;
-        this.postOptions = response.posts;
-        this.roleOptions = response.roles;
-        this.form.postIds = response.postIds;
-        this.form.roleIds = response.roleIds;
+        this.form = response.data.user;
+        this.postOptions = response.data.posts;
+        this.roleOptions = response.data.roles;
+        this.form.postIds = response.data.postIds;
+        this.form.roleIds = response.data.roleIds;
         this.open = true;
         this.title = "淇敼鐢ㄦ埛";
         this.form.password = "";
@@ -589,12 +609,20 @@
     handleResetPwd(row) {
       this.$prompt('璇疯緭鍏�"' + row.userName + '"鐨勬柊瀵嗙爜', "鎻愮ず", {
         confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷"
+        cancelButtonText: "鍙栨秷",
+        closeOnClickModal: false,
+        inputPattern: /^.{5,20}$/,
+        inputErrorMessage: "鐢ㄦ埛瀵嗙爜闀垮害蹇呴』浠嬩簬 5 鍜� 20 涔嬮棿",
       }).then(({ value }) => {
           resetUserPwd(row.userId, value).then(response => {
             this.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value);
           });
         }).catch(() => {});
+    },
+    /** 鍒嗛厤瑙掕壊鎿嶄綔 */
+    handleAuthRole: function(row) {
+      const userId = row.userId;
+      this.$router.push("/auth/role/" + userId);
     },
     /** 鎻愪氦鎸夐挳 */
     submitForm: function() {
@@ -628,7 +656,7 @@
         }).then(() => {
           this.getList();
           this.msgSuccess("鍒犻櫎鎴愬姛");
-        })
+        }).catch(() => {});
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
@@ -637,11 +665,13 @@
           confirmButtonText: "纭畾",
           cancelButtonText: "鍙栨秷",
           type: "warning"
-        }).then(function() {
+        }).then(() => {
+          this.exportLoading = true;
           return exportUser(queryParams);
         }).then(response => {
           this.download(response.msg);
-        })
+          this.exportLoading = false;
+        }).catch(() => {});
     },
     /** 瀵煎叆鎸夐挳鎿嶄綔 */
     handleImport() {

--
Gitblit v1.9.3