| | |
| | | import com.ruoyi.common.core.controller.BaseController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.core.domain.entity.SysRole;
|
| | | import com.ruoyi.common.core.domain.entity.SysUser;
|
| | | import com.ruoyi.common.core.domain.model.LoginUser;
|
| | | import com.ruoyi.common.core.page.TableDataInfo;
|
| | | import com.ruoyi.common.enums.BusinessType;
|
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.framework.web.service.SysPermissionService;
|
| | | import com.ruoyi.framework.web.service.TokenService;
|
| | | import com.ruoyi.system.domain.SysUserRole;
|
| | | import com.ruoyi.system.service.ISysRoleService;
|
| | | import com.ruoyi.system.service.ISysUserService;
|
| | |
|
| | |
| | | {
|
| | | return AjaxResult.success(roleService.selectRoleAll());
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢å·²åé
ç¨æ·è§è²å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/allocatedList")
|
| | | public TableDataInfo allocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectAllocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¥è¯¢æªåé
ç¨æ·è§è²å表
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:list')")
|
| | | @GetMapping("/authUser/unallocatedList")
|
| | | public TableDataInfo unallocatedList(SysUser user)
|
| | | {
|
| | | startPage();
|
| | | List<SysUser> list = userService.selectUnallocatedList(user);
|
| | | return getDataTable(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * åæ¶ææç¨æ·
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')")
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancel")
|
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUser(userRole));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹éåæ¶ææç¨æ·
|
| | | */
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/cancelAll")
|
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹ééæ©ç¨æ·ææ
|
| | | */
|
| | | @Log(title = "è§è²ç®¡ç", businessType = BusinessType.GRANT)
|
| | | @PutMapping("/authUser/selectAll")
|
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
| | | {
|
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
| | | }
|
| | | }
|
| | |
| | | /** å²ä½ç» */
|
| | | private Long[] postIds;
|
| | |
|
| | | /** è§è²ID */
|
| | | private Long roleId;
|
| | |
|
| | | public SysUser()
|
| | | {
|
| | |
|
| | |
| | | this.postIds = postIds;
|
| | | }
|
| | |
|
| | | public Long getRoleId()
|
| | | {
|
| | | return roleId;
|
| | | }
|
| | |
|
| | | public void setRoleId(Long roleId)
|
| | | {
|
| | | this.roleId = roleId;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
| | |
| | | public List<SysUser> selectUserList(SysUser sysUser);
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢æªå·²é
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | public List<SysUser> selectAllocatedList(SysUser user);
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢æªåé
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | public List<SysUser> selectUnallocatedList(SysUser user);
|
| | |
|
| | | /**
|
| | | * éè¿ç¨æ·åæ¥è¯¢ç¨æ·
|
| | | *
|
| | | * @param userName ç¨æ·å
|
| | |
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | | import com.ruoyi.common.core.domain.entity.SysRole;
|
| | | import com.ruoyi.system.domain.SysUserRole;
|
| | |
|
| | | /**
|
| | | * è§è²ä¸å¡å±
|
| | |
| | | * @return ç»æ
|
| | | */
|
| | | public int deleteRoleByIds(Long[] roleIds);
|
| | |
|
| | | /**
|
| | | * åæ¶ææç¨æ·è§è²
|
| | | * |
| | | * @param userRole ç¨æ·åè§è²å
³èä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | public int deleteAuthUser(SysUserRole userRole);
|
| | |
|
| | | /**
|
| | | * æ¹éåæ¶ææç¨æ·è§è²
|
| | | * |
| | | * @param roleId è§è²ID
|
| | | * @param userIds éè¦åæ¶ææçç¨æ·æ°æ®ID
|
| | | * @return ç»æ
|
| | | */
|
| | | public int deleteAuthUsers(Long roleId, Long[] userIds);
|
| | |
|
| | | /**
|
| | | * æ¹ééæ©ææç¨æ·è§è²
|
| | | * |
| | | * @param roleId è§è²ID
|
| | | * @param userIds éè¦å é¤çç¨æ·æ°æ®ID
|
| | | * @return ç»æ
|
| | | */
|
| | | public int insertAuthUsers(Long roleId, Long[] userIds);
|
| | | }
|
| | |
| | | public List<SysUser> selectUserList(SysUser user);
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢å·²åé
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | public List<SysUser> selectAllocatedList(SysUser user);
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢æªåé
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | public List<SysUser> selectUnallocatedList(SysUser user);
|
| | |
|
| | | /**
|
| | | * éè¿ç¨æ·åæ¥è¯¢ç¨æ·
|
| | | *
|
| | | * @param userName ç¨æ·å
|
| | |
| | | import com.ruoyi.common.utils.spring.SpringUtils;
|
| | | import com.ruoyi.system.domain.SysRoleDept;
|
| | | import com.ruoyi.system.domain.SysRoleMenu;
|
| | | import com.ruoyi.system.domain.SysUserRole;
|
| | | import com.ruoyi.system.mapper.SysRoleDeptMapper;
|
| | | import com.ruoyi.system.mapper.SysRoleMapper;
|
| | | import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
| | |
| | | roleDeptMapper.deleteRoleDept(roleIds);
|
| | | return roleMapper.deleteRoleByIds(roleIds);
|
| | | }
|
| | |
|
| | | /**
|
| | | * åæ¶ææç¨æ·è§è²
|
| | | * |
| | | * @param userRole ç¨æ·åè§è²å
³èä¿¡æ¯
|
| | | * @return ç»æ
|
| | | */
|
| | | @Override
|
| | | public int deleteAuthUser(SysUserRole userRole)
|
| | | {
|
| | | return userRoleMapper.deleteUserRoleInfo(userRole);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹éåæ¶ææç¨æ·è§è²
|
| | | * |
| | | * @param roleId è§è²ID
|
| | | * @param userIds éè¦åæ¶ææçç¨æ·æ°æ®ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @Override
|
| | | public int deleteAuthUsers(Long roleId, Long[] userIds)
|
| | | {
|
| | | return userRoleMapper.deleteUserRoleInfos(roleId, userIds);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ¹ééæ©ææç¨æ·è§è²
|
| | | * |
| | | * @param roleId è§è²ID
|
| | | * @param userIds éè¦å é¤çç¨æ·æ°æ®ID
|
| | | * @return ç»æ
|
| | | */
|
| | | @Override
|
| | | public int insertAuthUsers(Long roleId, Long[] userIds)
|
| | | {
|
| | | // æ°å¢ç¨æ·ä¸è§è²ç®¡ç
|
| | | List<SysUserRole> list = new ArrayList<SysUserRole>();
|
| | | for (Long userId : userIds)
|
| | | {
|
| | | SysUserRole ur = new SysUserRole();
|
| | | ur.setUserId(userId);
|
| | | ur.setRoleId(roleId);
|
| | | list.add(ur);
|
| | | }
|
| | | return userRoleMapper.batchUserRole(list);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢å·²åé
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d", userAlias = "u")
|
| | | public List<SysUser> selectAllocatedList(SysUser user)
|
| | | {
|
| | | return userMapper.selectAllocatedList(user);
|
| | | }
|
| | |
|
| | | /**
|
| | | * æ ¹æ®æ¡ä»¶å页æ¥è¯¢æªåé
ç¨æ·è§è²å表
|
| | | * |
| | | * @param user ç¨æ·ä¿¡æ¯
|
| | | * @return ç¨æ·ä¿¡æ¯éåä¿¡æ¯
|
| | | */
|
| | | @Override
|
| | | @DataScope(deptAlias = "d", userAlias = "u")
|
| | | public List<SysUser> selectUnallocatedList(SysUser user)
|
| | | {
|
| | | return userMapper.selectUnallocatedList(user);
|
| | | }
|
| | |
|
| | | /**
|
| | | * éè¿ç¨æ·åæ¥è¯¢ç¨æ·
|
| | | *
|
| | | * @param userName ç¨æ·å
|
| | |
| | | * @param userId ç¨æ·ID
|
| | | * @param roleIds è§è²ç»
|
| | | */
|
| | | @Override
|
| | | public void insertUserAuth(Long userId, Long[] roleIds)
|
| | | {
|
| | | userRoleMapper.deleteUserRoleByUserId(userId);
|
| | |
| | | ${params.dataScope}
|
| | | </select>
|
| | |
|
| | | <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
| | | from sys_user u
|
| | | left join sys_dept d on u.dept_id = d.dept_id
|
| | | left join sys_user_role ur on u.user_id = ur.user_id
|
| | | left join sys_role r on r.role_id = ur.role_id
|
| | | where u.del_flag = '0' and r.role_id = #{roleId}
|
| | | <if test="userName != null and userName != ''">
|
| | | AND u.user_name like concat('%', #{userName}, '%')
|
| | | </if>
|
| | | <if test="phonenumber != null and phonenumber != ''">
|
| | | AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
| | | </if>
|
| | | <!-- æ°æ®èå´è¿æ»¤ -->
|
| | | ${params.dataScope}
|
| | | </select>
|
| | | |
| | | <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
| | | from sys_user u
|
| | | left join sys_dept d on u.dept_id = d.dept_id
|
| | | left join sys_user_role ur on u.user_id = ur.user_id
|
| | | left join sys_role r on r.role_id = ur.role_id
|
| | | where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
|
| | | and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
|
| | | <if test="userName != null and userName != ''">
|
| | | AND u.user_name like concat('%', #{userName}, '%')
|
| | | </if>
|
| | | <if test="phonenumber != null and phonenumber != ''">
|
| | | AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
| | | </if>
|
| | | <!-- æ°æ®èå´è¿æ»¤ -->
|
| | | ${params.dataScope}
|
| | | </select>
|
| | | |
| | | <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
| | | <include refid="selectUserVo"/>
|
| | | where u.user_name = #{userName}
|
| | |
| | | params: query
|
| | | })
|
| | | } |
| | |
|
| | | // æ¥è¯¢è§è²å·²ææç¨æ·å表
|
| | | export function allocatedUserList(query) {
|
| | | return request({
|
| | | url: '/system/role/authUser/allocatedList',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | | // æ¥è¯¢è§è²æªææç¨æ·å表
|
| | | export function unallocatedUserList(query) {
|
| | | return request({
|
| | | url: '/system/role/authUser/unallocatedList',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | | // åæ¶ç¨æ·ææè§è²
|
| | | export function authUserCancel(data) {
|
| | | return request({
|
| | | url: '/system/role/authUser/cancel',
|
| | | method: 'put',
|
| | | data: data
|
| | | })
|
| | | }
|
| | |
|
| | | // æ¹éåæ¶ç¨æ·ææè§è²
|
| | | export function authUserCancelAll(data) {
|
| | | return request({
|
| | | url: '/system/role/authUser/cancelAll',
|
| | | method: 'put',
|
| | | params: data
|
| | | })
|
| | | }
|
| | |
|
| | | // ææç¨æ·éæ©
|
| | | export function authUserSelectAll(data) {
|
| | | return request({
|
| | | url: '/system/role/authUser/selectAll',
|
| | | method: 'put',
|
| | | params: data
|
| | | })
|
| | | } |
| | |
| | | ]
|
| | | },
|
| | | {
|
| | | path: '/auth',
|
| | | component: Layout,
|
| | | hidden: true,
|
| | | children: [
|
| | | {
|
| | | path: 'user/:roleId(\\d+)',
|
| | | component: (resolve) => require(['@/views/system/role/authUser'], resolve),
|
| | | name: 'AuthUser',
|
| | | meta: { title: 'åé
ç¨æ·'}
|
| | | }
|
| | | ]
|
| | | },
|
| | | {
|
| | | path: '/dict',
|
| | | component: Layout,
|
| | | hidden: true,
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <div class="app-container">
|
| | | <el-form :model="queryParams" ref="queryForm" v-show="showSearch" :inline="true">
|
| | | <el-form-item label="ç¨æ·åç§°" prop="userName">
|
| | | <el-input
|
| | | v-model="queryParams.userName"
|
| | | placeholder="请è¾å
¥ç¨æ·åç§°"
|
| | | clearable
|
| | | size="small"
|
| | | style="width: 240px"
|
| | | @keyup.enter.native="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ææºå·ç " prop="phonenumber">
|
| | | <el-input
|
| | | v-model="queryParams.phonenumber"
|
| | | placeholder="请è¾å
¥ææºå·ç "
|
| | | clearable
|
| | | size="small"
|
| | | style="width: 240px"
|
| | | @keyup.enter.native="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | |
|
| | | <el-row :gutter="10" class="mb8">
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="primary"
|
| | | plain
|
| | | icon="el-icon-plus"
|
| | | size="mini"
|
| | | @click="openSelectUser"
|
| | | v-hasPermi="['system:role:add']"
|
| | | >æ·»å ç¨æ·</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="danger"
|
| | | plain
|
| | | icon="el-icon-circle-close"
|
| | | size="mini"
|
| | | :disabled="multiple"
|
| | | @click="cancelAuthUserAll"
|
| | | v-hasPermi="['system:role:remove']"
|
| | | >æ¹éåæ¶ææ</el-button>
|
| | | </el-col>
|
| | | <el-col :span="1.5">
|
| | | <el-button
|
| | | type="warning"
|
| | | plain
|
| | | icon="el-icon-close"
|
| | | size="mini"
|
| | | @click="handleClose"
|
| | | >å
³é</el-button>
|
| | | </el-col>
|
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
| | | </el-row>
|
| | |
|
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
| | | <el-table-column type="selection" width="55" align="center" />
|
| | | <el-table-column label="ç¨æ·åç§°" prop="userName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¨æ·æµç§°" prop="nickName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="é®ç®±" prop="email" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ææº" prop="phonenumber" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¶æ" align="center" prop="status">
|
| | | <template slot-scope="scope">
|
| | | <dict-tag :options="statusOptions" :value="scope.row.status"/>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180">
|
| | | <template slot-scope="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width">
|
| | | <template slot-scope="scope">
|
| | | <el-button
|
| | | size="mini"
|
| | | type="text"
|
| | | icon="el-icon-circle-close"
|
| | | @click="cancelAuthUser(scope.row)"
|
| | | v-hasPermi="['system:role:remove']"
|
| | | >åæ¶ææ</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
|
| | | <pagination
|
| | | v-show="total>0"
|
| | | :total="total"
|
| | | :page.sync="queryParams.pageNum"
|
| | | :limit.sync="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | | <select-user ref="select" :roleId="queryParams.roleId" @ok="handleQuery" />
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role";
|
| | | import selectUser from "./selectUser";
|
| | |
|
| | | export default {
|
| | | name: "AuthUser",
|
| | | components: { selectUser },
|
| | | data() {
|
| | | return {
|
| | | // é®ç½©å±
|
| | | loading: true,
|
| | | // éä¸ç¨æ·ç»
|
| | | userIds: [],
|
| | | // éå¤ä¸ªç¦ç¨
|
| | | multiple: true,
|
| | | // æ¾ç¤ºæç´¢æ¡ä»¶
|
| | | showSearch: true,
|
| | | // æ»æ¡æ°
|
| | | total: 0,
|
| | | // ç¨æ·è¡¨æ ¼æ°æ®
|
| | | userList: [],
|
| | | // ç¶ææ°æ®åå
¸
|
| | | statusOptions: [],
|
| | | // æ¥è¯¢åæ°
|
| | | queryParams: {
|
| | | pageNum: 1,
|
| | | pageSize: 10,
|
| | | roleId: undefined,
|
| | | userName: undefined,
|
| | | phonenumber: undefined
|
| | | }
|
| | | };
|
| | | },
|
| | | created() {
|
| | | const roleId = this.$route.params && this.$route.params.roleId;
|
| | | if (roleId) {
|
| | | this.queryParams.roleId = roleId;
|
| | | this.getList();
|
| | | this.getDicts("sys_normal_disable").then(response => {
|
| | | this.statusOptions = response.data;
|
| | | });
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | /** æ¥è¯¢ææç¨æ·å表 */
|
| | | getList() {
|
| | | this.loading = true;
|
| | | allocatedUserList(this.queryParams).then(response => {
|
| | | this.userList = response.rows;
|
| | | this.total = response.total;
|
| | | this.loading = false;
|
| | | }
|
| | | );
|
| | | },
|
| | | // è¿åæé®
|
| | | handleClose() {
|
| | | this.$store.dispatch("tagsView/delView", this.$route);
|
| | | this.$router.push({ path: "/system/role" });
|
| | | },
|
| | | /** æç´¢æé®æä½ */
|
| | | handleQuery() {
|
| | | this.queryParams.pageNum = 1;
|
| | | this.getList();
|
| | | },
|
| | | /** éç½®æé®æä½ */
|
| | | resetQuery() {
|
| | | this.resetForm("queryForm");
|
| | | this.handleQuery();
|
| | | },
|
| | | // å¤éæ¡é䏿°æ®
|
| | | handleSelectionChange(selection) {
|
| | | this.userIds = selection.map(item => item.userId)
|
| | | this.multiple = !selection.length
|
| | | },
|
| | | /** æå¼ææç¨æ·è¡¨å¼¹çª */
|
| | | openSelectUser() {
|
| | | this.$refs.select.show();
|
| | | },
|
| | | /** åæ¶æææé®æä½ */
|
| | | cancelAuthUser(row) {
|
| | | const roleId = this.queryParams.roleId;
|
| | | this.$confirm('确认è¦åæ¶è¯¥ç¨æ·"' + row.userName + '"è§è²åï¼', "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(function() {
|
| | | return authUserCancel({ userId: row.userId, roleId: roleId });
|
| | | }).then(() => {
|
| | | this.getList();
|
| | | this.msgSuccess("åæ¶æææå");
|
| | | }).catch(() => {});
|
| | | },
|
| | | /** æ¹éåæ¶æææé®æä½ */
|
| | | cancelAuthUserAll(row) {
|
| | | const roleId = this.queryParams.roleId;
|
| | | const userIds = this.userIds.join(",");
|
| | | this.$confirm('æ¯å¦åæ¶éä¸ç¨æ·æææ°æ®é¡¹?', "è¦å", {
|
| | | confirmButtonText: "ç¡®å®",
|
| | | cancelButtonText: "åæ¶",
|
| | | type: "warning"
|
| | | }).then(() => {
|
| | | return authUserCancelAll({ roleId: roleId, userIds: userIds });
|
| | | }).then(() => {
|
| | | this.getList();
|
| | | this.msgSuccess("åæ¶æææå");
|
| | | }).catch(() => {});
|
| | | }
|
| | | }
|
| | | };
|
| | | </script> |
| | |
| | | <el-button
|
| | | size="mini"
|
| | | type="text"
|
| | | icon="el-icon-circle-check"
|
| | | @click="handleDataScope(scope.row)"
|
| | | v-hasPermi="['system:role:edit']"
|
| | | >æ°æ®æé</el-button>
|
| | | <el-button
|
| | | size="mini"
|
| | | type="text"
|
| | | icon="el-icon-delete"
|
| | | @click="handleDelete(scope.row)"
|
| | | v-hasPermi="['system:role:remove']"
|
| | | >å é¤</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="handleDataScope" icon="el-icon-circle-check"
|
| | | v-hasPermi="['system:role:edit']">æ°æ®æé</el-dropdown-item>
|
| | | <el-dropdown-item command="handleAuthUser" icon="el-icon-user"
|
| | | v-hasPermi="['system:role:edit']">åé
ç¨æ·</el-dropdown-item>
|
| | | </el-dropdown-menu>
|
| | | </el-dropdown>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | |
| | | this.single = selection.length!=1
|
| | | this.multiple = !selection.length
|
| | | },
|
| | | // æ´å¤æä½è§¦å
|
| | | handleCommand(command, row) {
|
| | | switch (command) {
|
| | | case "handleDataScope":
|
| | | this.handleDataScope(row);
|
| | | break;
|
| | | case "handleAuthUser":
|
| | | this.handleAuthUser(row);
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | },
|
| | | // æ æéï¼å±å¼/æå ï¼
|
| | | handleCheckedTreeExpand(value, type) {
|
| | | if (type == 'menu') {
|
| | |
| | | this.title = "åé
æ°æ®æé";
|
| | | });
|
| | | },
|
| | | /** åé
ç¨æ·æä½ */
|
| | | handleAuthUser: function(row) {
|
| | | const roleId = row.roleId;
|
| | | this.$router.push("/auth/user/" + roleId);
|
| | | },
|
| | | /** æäº¤æé® */
|
| | | submitForm: function() {
|
| | | this.$refs["form"].validate(valid => {
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <!-- ææç¨æ· -->
|
| | | <el-dialog title="éæ©ç¨æ·" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
| | | <el-form :model="queryParams" ref="queryForm" :inline="true">
|
| | | <el-form-item label="ç¨æ·åç§°" prop="userName">
|
| | | <el-input
|
| | | v-model="queryParams.userName"
|
| | | placeholder="请è¾å
¥ç¨æ·åç§°"
|
| | | clearable
|
| | | size="small"
|
| | | @keyup.enter.native="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item label="ææºå·ç " prop="phonenumber">
|
| | | <el-input
|
| | | v-model="queryParams.phonenumber"
|
| | | placeholder="请è¾å
¥ææºå·ç "
|
| | | clearable
|
| | | size="small"
|
| | | @keyup.enter.native="handleQuery"
|
| | | />
|
| | | </el-form-item>
|
| | | <el-form-item>
|
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button>
|
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | <el-row>
|
| | | <el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
|
| | | <el-table-column type="selection" width="55"></el-table-column>
|
| | | <el-table-column label="ç¨æ·åç§°" prop="userName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¨æ·æµç§°" prop="nickName" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="é®ç®±" prop="email" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ææº" prop="phonenumber" :show-overflow-tooltip="true" />
|
| | | <el-table-column label="ç¶æ" align="center" prop="status">
|
| | | <template slot-scope="scope">
|
| | | <dict-tag :options="statusOptions" :value="scope.row.status"/>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180">
|
| | | <template slot-scope="scope">
|
| | | <span>{{ parseTime(scope.row.createTime) }}</span>
|
| | | </template>
|
| | | </el-table-column>
|
| | | </el-table>
|
| | | <pagination
|
| | | v-show="total>0"
|
| | | :total="total"
|
| | | :page.sync="queryParams.pageNum"
|
| | | :limit.sync="queryParams.pageSize"
|
| | | @pagination="getList"
|
| | | />
|
| | | </el-row>
|
| | | <div slot="footer" class="dialog-footer">
|
| | | <el-button type="primary" @click="handleSelectUser">ç¡® å®</el-button>
|
| | | <el-button @click="visible = false">å æ¶</el-button>
|
| | | </div>
|
| | | </el-dialog>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
|
| | | export default {
|
| | | props: {
|
| | | // è§è²ç¼å·
|
| | | roleId: {
|
| | | type: Number
|
| | | }
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | // é®ç½©å±
|
| | | visible: false,
|
| | | // é䏿°ç»å¼
|
| | | userIds: [],
|
| | | // æ»æ¡æ°
|
| | | total: 0,
|
| | | // æªææç¨æ·æ°æ®
|
| | | userList: [],
|
| | | // ç¶ææ°æ®åå
¸
|
| | | statusOptions: [],
|
| | | // æ¥è¯¢åæ°
|
| | | queryParams: {
|
| | | pageNum: 1,
|
| | | pageSize: 10,
|
| | | roleId: undefined,
|
| | | userName: undefined,
|
| | | phonenumber: undefined
|
| | | }
|
| | | };
|
| | | },
|
| | | created() {
|
| | | this.getDicts("sys_normal_disable").then(response => {
|
| | | this.statusOptions = response.data;
|
| | | });
|
| | | },
|
| | | methods: {
|
| | | // æ¾ç¤ºå¼¹æ¡
|
| | | show() {
|
| | | this.queryParams.roleId = this.roleId;
|
| | | this.getList();
|
| | | this.visible = true;
|
| | | },
|
| | | clickRow(row) {
|
| | | this.$refs.table.toggleRowSelection(row);
|
| | | },
|
| | | // å¤éæ¡é䏿°æ®
|
| | | handleSelectionChange(selection) {
|
| | | this.userIds = selection.map(item => item.userId);
|
| | | },
|
| | | // æ¥è¯¢è¡¨æ°æ®
|
| | | getList() {
|
| | | unallocatedUserList(this.queryParams).then(res => {
|
| | | this.userList = res.rows;
|
| | | this.total = res.total;
|
| | | });
|
| | | },
|
| | | /** æç´¢æé®æä½ */
|
| | | handleQuery() {
|
| | | this.queryParams.pageNum = 1;
|
| | | this.getList();
|
| | | },
|
| | | /** éç½®æé®æä½ */
|
| | | resetQuery() {
|
| | | this.resetForm("queryForm");
|
| | | this.handleQuery();
|
| | | },
|
| | | /** éæ©ææç¨æ·æä½ */
|
| | | handleSelectUser() {
|
| | | const roleId = this.queryParams.roleId;
|
| | | const userIds = this.userIds.join(",");
|
| | | authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
|
| | | this.msgSuccess(res.msg);
|
| | | if (res.code === 200) {
|
| | | this.visible = false;
|
| | | this.$emit("ok");
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | };
|
| | | </script>
|