From 9c7901f526aa1fefd35da044b73c1a77e4d67ff0 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期四, 01 七月 2021 18:01:36 +0800 Subject: [PATCH] 用户管理新增分配角色功能 --- ruoyi-ui/src/views/system/user/index.vue | 49 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 34 insertions(+), 15 deletions(-) diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index b2c00ef..7f419c9 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -175,21 +175,19 @@ @click="handleUpdate(scope.row)" 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="handleDelete" v-if="scope.row.userId !== 1" icon="el-icon-delete" + v-hasPermi="['system:user:remove']">删除用户</el-dropdown-item> + <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> @@ -561,6 +559,22 @@ this.single = selection.length != 1; this.multiple = !selection.length; }, + // 更多操作触发 + handleCommand(command, row) { + switch (command) { + case "handleDelete": + this.handleDelete(row); + break; + case "handleResetPwd": + this.handleResetPwd(row); + break; + case "handleAuthRole": + this.handleAuthRole(row); + break; + default: + break; + } + }, /** 新增按钮操作 */ handleAdd() { this.reset(); @@ -603,6 +617,11 @@ }); }).catch(() => {}); }, + /** 分配角色操作 */ + handleAuthRole: function(row) { + const userId = row.userId; + this.$router.push("/auth/role/" + userId); + }, /** 提交按钮 */ submitForm: function() { this.$refs["form"].validate(valid => { -- Gitblit v1.9.2