mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 同步 ruoyi 新功能
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
			
		||||
package com.ruoyi.web.controller.system;
 | 
			
		||||
 | 
			
		||||
import cn.dev33.satoken.annotation.SaCheckPermission;
 | 
			
		||||
import cn.hutool.core.lang.tree.Tree;
 | 
			
		||||
import cn.hutool.core.util.ArrayUtil;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
import com.ruoyi.common.constant.UserConstants;
 | 
			
		||||
@@ -15,9 +14,7 @@ import lombok.RequiredArgsConstructor;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 部门信息
 | 
			
		||||
@@ -68,29 +65,6 @@ public class SysDeptController extends BaseController {
 | 
			
		||||
        return R.ok(deptService.selectDeptById(deptId));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取部门下拉树列表
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping("/treeselect")
 | 
			
		||||
    public R<List<Tree<Long>>> treeselect(SysDept dept) {
 | 
			
		||||
        List<SysDept> depts = deptService.selectDeptList(dept);
 | 
			
		||||
        return R.ok(deptService.buildDeptTreeSelect(depts));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 加载对应角色部门列表树
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId 角色ID
 | 
			
		||||
     */
 | 
			
		||||
    @GetMapping(value = "/roleDeptTreeselect/{roleId}")
 | 
			
		||||
    public R<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
 | 
			
		||||
        List<SysDept> depts = deptService.selectDeptList(new SysDept());
 | 
			
		||||
        Map<String, Object> ajax = new HashMap<>();
 | 
			
		||||
        ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
 | 
			
		||||
        ajax.put("depts", deptService.buildDeptTreeSelect(depts));
 | 
			
		||||
        return R.ok(ajax);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 新增部门
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,8 @@ public class SysProfileController extends BaseController {
 | 
			
		||||
        user.setUserId(getUserId());
 | 
			
		||||
        user.setUserName(null);
 | 
			
		||||
        user.setPassword(null);
 | 
			
		||||
        user.setAvatar(null);
 | 
			
		||||
        user.setDeptId(null);
 | 
			
		||||
        if (userService.updateUserProfile(user) > 0) {
 | 
			
		||||
            return R.ok();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ import com.ruoyi.common.constant.UserConstants;
 | 
			
		||||
import com.ruoyi.common.core.controller.BaseController;
 | 
			
		||||
import com.ruoyi.common.core.domain.PageQuery;
 | 
			
		||||
import com.ruoyi.common.core.domain.R;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysDept;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysRole;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.common.core.domain.model.LoginUser;
 | 
			
		||||
@@ -15,6 +16,7 @@ import com.ruoyi.common.enums.BusinessType;
 | 
			
		||||
import com.ruoyi.common.helper.LoginHelper;
 | 
			
		||||
import com.ruoyi.common.utils.poi.ExcelUtil;
 | 
			
		||||
import com.ruoyi.system.domain.SysUserRole;
 | 
			
		||||
import com.ruoyi.system.service.ISysDeptService;
 | 
			
		||||
import com.ruoyi.system.service.ISysRoleService;
 | 
			
		||||
import com.ruoyi.system.service.ISysUserService;
 | 
			
		||||
import com.ruoyi.system.service.SysPermissionService;
 | 
			
		||||
@@ -23,7 +25,9 @@ import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.*;
 | 
			
		||||
 | 
			
		||||
import javax.servlet.http.HttpServletResponse;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 角色信息
 | 
			
		||||
@@ -38,6 +42,7 @@ public class SysRoleController extends BaseController {
 | 
			
		||||
 | 
			
		||||
    private final ISysRoleService roleService;
 | 
			
		||||
    private final ISysUserService userService;
 | 
			
		||||
    private final ISysDeptService deptService;
 | 
			
		||||
    private final SysPermissionService permissionService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -215,4 +220,18 @@ public class SysRoleController extends BaseController {
 | 
			
		||||
        roleService.checkRoleDataScope(roleId);
 | 
			
		||||
        return toAjax(roleService.insertAuthUsers(roleId, userIds));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取对应角色部门树列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId 角色ID
 | 
			
		||||
     */
 | 
			
		||||
    @SaCheckPermission("system:role:list")
 | 
			
		||||
    @GetMapping(value = "/deptTree/{roleId}")
 | 
			
		||||
    public R<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
 | 
			
		||||
        Map<String, Object> ajax = new HashMap<>();
 | 
			
		||||
        ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
 | 
			
		||||
        ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
 | 
			
		||||
        return R.ok(ajax);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system;
 | 
			
		||||
import cn.dev33.satoken.annotation.SaCheckPermission;
 | 
			
		||||
import cn.dev33.satoken.secure.BCrypt;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.lang.tree.Tree;
 | 
			
		||||
import cn.hutool.core.util.ArrayUtil;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.ruoyi.common.annotation.Log;
 | 
			
		||||
@@ -23,6 +24,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 | 
			
		||||
import com.ruoyi.system.domain.vo.SysUserExportVo;
 | 
			
		||||
import com.ruoyi.system.domain.vo.SysUserImportVo;
 | 
			
		||||
import com.ruoyi.system.listener.SysUserImportListener;
 | 
			
		||||
import com.ruoyi.system.service.ISysDeptService;
 | 
			
		||||
import com.ruoyi.system.service.ISysPostService;
 | 
			
		||||
import com.ruoyi.system.service.ISysRoleService;
 | 
			
		||||
import com.ruoyi.system.service.ISysUserService;
 | 
			
		||||
@@ -52,6 +54,7 @@ public class SysUserController extends BaseController {
 | 
			
		||||
    private final ISysUserService userService;
 | 
			
		||||
    private final ISysRoleService roleService;
 | 
			
		||||
    private final ISysPostService postService;
 | 
			
		||||
    private final ISysDeptService deptService;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取用户列表
 | 
			
		||||
@@ -235,4 +238,13 @@ public class SysUserController extends BaseController {
 | 
			
		||||
        userService.insertUserAuth(userId, roleIds);
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 获取部门树列表
 | 
			
		||||
     */
 | 
			
		||||
    @SaCheckPermission("system:user:list")
 | 
			
		||||
    @GetMapping("/deptTree")
 | 
			
		||||
    public R<List<Tree<Long>>> deptTree(SysDept dept) {
 | 
			
		||||
        return R.ok(deptService.selectDeptTreeList(dept));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@ import lombok.NoArgsConstructor;
 | 
			
		||||
import javax.validation.constraints.NotBlank;
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import javax.validation.constraints.Size;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 角色表 sys_role
 | 
			
		||||
@@ -114,6 +115,11 @@ public class SysRole extends BaseEntity {
 | 
			
		||||
    @TableField(exist = false)
 | 
			
		||||
    private Long[] deptIds;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 角色菜单权限
 | 
			
		||||
     */
 | 
			
		||||
    private Set<String> permissions;
 | 
			
		||||
 | 
			
		||||
    public SysRole(Long roleId) {
 | 
			
		||||
        this.roleId = roleId;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,11 @@ import java.util.Map;
 | 
			
		||||
@Component
 | 
			
		||||
public class LogAspect {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 排除敏感属性字段
 | 
			
		||||
     */
 | 
			
		||||
    public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 处理完请求后执行
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,14 @@ public interface SysMenuMapper extends BaseMapperPlus<SysMenuMapper, SysMenu, Sy
 | 
			
		||||
     */
 | 
			
		||||
    List<String> selectMenuPermsByUserId(Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色ID查询权限
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId 角色ID
 | 
			
		||||
     * @return 权限列表
 | 
			
		||||
     */
 | 
			
		||||
    List<String> selectMenuPermsByRoleId(Long roleId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户ID查询菜单
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,14 @@ public interface ISysDeptService {
 | 
			
		||||
     */
 | 
			
		||||
    List<SysDept> selectDeptList(SysDept dept);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询部门树结构信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param dept 部门信息
 | 
			
		||||
     * @return 部门树信息集合
 | 
			
		||||
     */
 | 
			
		||||
    List<Tree<Long>> selectDeptTreeList(SysDept dept);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 构建前端所需要下拉树结构
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,14 @@ public interface ISysMenuService {
 | 
			
		||||
     */
 | 
			
		||||
    Set<String> selectMenuPermsByUserId(Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色ID查询权限
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId 角色ID
 | 
			
		||||
     * @return 权限列表
 | 
			
		||||
     */
 | 
			
		||||
    Set<String> selectMenuPermsByRoleId(Long roleId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户ID查询菜单树信息
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,12 @@
 | 
			
		||||
package com.ruoyi.system.service;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysRole;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -47,9 +49,19 @@ public class SysPermissionService {
 | 
			
		||||
        // 管理员拥有所有权限
 | 
			
		||||
        if (user.isAdmin()) {
 | 
			
		||||
            perms.add("*:*:*");
 | 
			
		||||
        } else {
 | 
			
		||||
            List<SysRole> roles = user.getRoles();
 | 
			
		||||
            if (!roles.isEmpty() && roles.size() > 1) {
 | 
			
		||||
                // 多角色设置permissions属性,以便数据权限匹配权限
 | 
			
		||||
                for (SysRole role : roles) {
 | 
			
		||||
                    Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId());
 | 
			
		||||
                    role.setPermissions(rolePerms);
 | 
			
		||||
                    perms.addAll(rolePerms);
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId()));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return perms;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -58,6 +58,18 @@ public class SysDeptServiceImpl implements ISysDeptService {
 | 
			
		||||
        return baseMapper.selectDeptList(lqw);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询部门树结构信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param dept 部门信息
 | 
			
		||||
     * @return 部门树信息集合
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Tree<Long>> selectDeptTreeList(SysDept dept) {
 | 
			
		||||
        List<SysDept> depts = this.selectDeptList(dept);
 | 
			
		||||
        return buildDeptTreeSelect(depts);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 构建前端所需要下拉树结构
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -97,6 +97,24 @@ public class SysMenuServiceImpl implements ISysMenuService {
 | 
			
		||||
        return permsSet;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色ID查询权限
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId 角色ID
 | 
			
		||||
     * @return 权限列表
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public Set<String> selectMenuPermsByRoleId(Long roleId) {
 | 
			
		||||
        List<String> perms = baseMapper.selectMenuPermsByRoleId(roleId);
 | 
			
		||||
        Set<String> permsSet = new HashSet<>();
 | 
			
		||||
        for (String perm : perms) {
 | 
			
		||||
            if (StringUtils.isNotEmpty(perm)) {
 | 
			
		||||
                permsSet.addAll(Arrays.asList(perm.trim().split(",")));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return permsSet;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户ID查询菜单
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -95,4 +95,11 @@
 | 
			
		||||
          and sur.user_id = #{userId}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
 | 
			
		||||
        select distinct m.perms
 | 
			
		||||
        from sys_menu m
 | 
			
		||||
                 left join sys_role_menu rm on m.menu_id = rm.menu_id
 | 
			
		||||
        where m.status = '0' and rm.role_id = #{roleId}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -25,22 +25,6 @@ export function getDept(deptId) {
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询部门下拉树结构
 | 
			
		||||
export function treeselect() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/dept/treeselect',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 根据角色ID查询部门树结构
 | 
			
		||||
export function roleDeptTreeselect(roleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/dept/roleDeptTreeselect/' + roleId,
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 新增部门
 | 
			
		||||
export function addDept(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
 
 | 
			
		||||
@@ -109,3 +109,11 @@ export function authUserSelectAll(data) {
 | 
			
		||||
    params: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 根据角色ID查询部门树结构
 | 
			
		||||
export function deptTreeSelect(roleId) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/role/deptTree/' + roleId,
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -125,3 +125,11 @@ export function updateAuthRole(data) {
 | 
			
		||||
    params: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询部门下拉树结构
 | 
			
		||||
export function deptTreeSelect() {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/system/user/deptTree',
 | 
			
		||||
    method: 'get'
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
      :show-file-list="false"
 | 
			
		||||
      :headers="headers"
 | 
			
		||||
      class="upload-file-uploader"
 | 
			
		||||
      ref="upload"
 | 
			
		||||
      ref="fileUpload"
 | 
			
		||||
    >
 | 
			
		||||
      <!-- 上传按钮 -->
 | 
			
		||||
      <el-button size="mini" type="primary">选取文件</el-button>
 | 
			
		||||
@@ -163,17 +163,13 @@ export default {
 | 
			
		||||
    handleUploadSuccess(res, file) {
 | 
			
		||||
      if (res.code === 200) {
 | 
			
		||||
        this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
 | 
			
		||||
        if (this.uploadList.length === this.number) {
 | 
			
		||||
          this.fileList = this.fileList.concat(this.uploadList);
 | 
			
		||||
          this.uploadList = [];
 | 
			
		||||
          this.number = 0;
 | 
			
		||||
          this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
          this.$modal.closeLoading();
 | 
			
		||||
        }
 | 
			
		||||
        this.uploadedSuccessfully();
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgError(res.msg);
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
        this.number--;
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
        this.$modal.msgError(res.msg);
 | 
			
		||||
        this.$refs.fileUpload.handleRemove(file);
 | 
			
		||||
        this.uploadedSuccessfully();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 删除文件
 | 
			
		||||
@@ -183,6 +179,16 @@ export default {
 | 
			
		||||
      this.fileList.splice(index, 1);
 | 
			
		||||
      this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
    },
 | 
			
		||||
    // 上传结束处理
 | 
			
		||||
    uploadedSuccessfully() {
 | 
			
		||||
      if (this.number > 0 && this.uploadList.length === this.number) {
 | 
			
		||||
        this.fileList = this.fileList.concat(this.uploadList);
 | 
			
		||||
        this.uploadList = [];
 | 
			
		||||
        this.number = 0;
 | 
			
		||||
        this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 获取文件名称
 | 
			
		||||
    getFileName(name) {
 | 
			
		||||
      // 如果是url那么取最后的名字 如果不是直接返回
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,8 @@
 | 
			
		||||
      :limit="limit"
 | 
			
		||||
      :on-error="handleUploadError"
 | 
			
		||||
      :on-exceed="handleExceed"
 | 
			
		||||
      name="file"
 | 
			
		||||
      :on-remove="handleRemove"
 | 
			
		||||
      ref="imageUpload"
 | 
			
		||||
      :on-remove="handleDelete"
 | 
			
		||||
      :show-file-list="true"
 | 
			
		||||
      :headers="headers"
 | 
			
		||||
      :file-list="fileList"
 | 
			
		||||
@@ -120,33 +120,6 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    // 删除图片
 | 
			
		||||
    handleRemove(file, fileList) {
 | 
			
		||||
      const findex = this.fileList.map(f => f.name).indexOf(file.name);
 | 
			
		||||
      if(findex > -1) {
 | 
			
		||||
        let ossId = this.fileList[findex].ossId;
 | 
			
		||||
        delOss(ossId);
 | 
			
		||||
        this.fileList.splice(findex, 1);
 | 
			
		||||
        this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 上传成功回调
 | 
			
		||||
    handleUploadSuccess(res) {
 | 
			
		||||
      if (res.code == 200) {
 | 
			
		||||
        this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
 | 
			
		||||
        if (this.uploadList.length === this.number) {
 | 
			
		||||
          this.fileList = this.fileList.concat(this.uploadList);
 | 
			
		||||
          this.uploadList = [];
 | 
			
		||||
          this.number = 0;
 | 
			
		||||
          this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
          this.$modal.closeLoading();
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        this.$modal.msgError(res.msg);
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
        this.number--;
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 上传前loading加载
 | 
			
		||||
    handleBeforeUpload(file) {
 | 
			
		||||
      let isImg = false;
 | 
			
		||||
@@ -182,11 +155,44 @@ export default {
 | 
			
		||||
    handleExceed() {
 | 
			
		||||
      this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
 | 
			
		||||
    },
 | 
			
		||||
    // 上传成功回调
 | 
			
		||||
    handleUploadSuccess(res, file) {
 | 
			
		||||
      if (res.code === 200) {
 | 
			
		||||
        this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
 | 
			
		||||
        this.uploadedSuccessfully();
 | 
			
		||||
      } else {
 | 
			
		||||
        this.number--;
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
        this.$modal.msgError(res.msg);
 | 
			
		||||
        this.$refs.imageUpload.handleRemove(file);
 | 
			
		||||
        this.uploadedSuccessfully();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 删除图片
 | 
			
		||||
    handleDelete(file) {
 | 
			
		||||
      const findex = this.fileList.map(f => f.name).indexOf(file.name);
 | 
			
		||||
      if(findex > -1) {
 | 
			
		||||
        let ossId = this.fileList[findex].ossId;
 | 
			
		||||
        delOss(ossId);
 | 
			
		||||
        this.fileList.splice(findex, 1);
 | 
			
		||||
        this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 上传失败
 | 
			
		||||
    handleUploadError(res) {
 | 
			
		||||
      this.$modal.msgError("上传图片失败,请重试");
 | 
			
		||||
      this.$modal.closeLoading();
 | 
			
		||||
    },
 | 
			
		||||
    // 上传结束处理
 | 
			
		||||
    uploadedSuccessfully() {
 | 
			
		||||
      if (this.number > 0 && this.uploadList.length === this.number) {
 | 
			
		||||
        this.fileList = this.fileList.concat(this.uploadList);
 | 
			
		||||
        this.uploadList = [];
 | 
			
		||||
        this.number = 0;
 | 
			
		||||
        this.$emit("input", this.listToString(this.fileList));
 | 
			
		||||
        this.$modal.closeLoading();
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 预览
 | 
			
		||||
    handlePictureCardPreview(file) {
 | 
			
		||||
      this.dialogImageUrl = file.url;
 | 
			
		||||
@@ -197,8 +203,10 @@ export default {
 | 
			
		||||
      let strs = "";
 | 
			
		||||
      separator = separator || ",";
 | 
			
		||||
      for (let i in list) {
 | 
			
		||||
        if (list[i].ossId) {
 | 
			
		||||
          strs += list[i].ossId + separator;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      return strs != "" ? strs.substr(0, strs.length - 1) : "";
 | 
			
		||||
    },
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -254,9 +254,8 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
 | 
			
		||||
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role";
 | 
			
		||||
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
 | 
			
		||||
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "Role",
 | 
			
		||||
@@ -364,12 +363,6 @@ export default {
 | 
			
		||||
        this.menuOptions = response.data;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询部门树结构 */
 | 
			
		||||
    getDeptTreeselect() {
 | 
			
		||||
      deptTreeselect().then(response => {
 | 
			
		||||
        this.deptOptions = response.data;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    // 所有菜单节点数据
 | 
			
		||||
    getMenuAllCheckedKeys() {
 | 
			
		||||
      // 目前被选中的菜单节点
 | 
			
		||||
@@ -396,8 +389,8 @@ export default {
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    /** 根据角色ID查询部门树结构 */
 | 
			
		||||
    getRoleDeptTreeselect(roleId) {
 | 
			
		||||
      return roleDeptTreeselect(roleId).then(response => {
 | 
			
		||||
    getDeptTree(roleId) {
 | 
			
		||||
      return deptTreeSelect(roleId).then(response => {
 | 
			
		||||
        this.deptOptions = response.data.depts;
 | 
			
		||||
        return response;
 | 
			
		||||
      });
 | 
			
		||||
@@ -543,12 +536,12 @@ export default {
 | 
			
		||||
    /** 分配数据权限操作 */
 | 
			
		||||
    handleDataScope(row) {
 | 
			
		||||
      this.reset();
 | 
			
		||||
      const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
 | 
			
		||||
      const deptTreeSelect = this.getDeptTree(row.roleId);
 | 
			
		||||
      getRole(row.roleId).then(response => {
 | 
			
		||||
        this.form = response.data;
 | 
			
		||||
        this.openDataScope = true;
 | 
			
		||||
        this.$nextTick(() => {
 | 
			
		||||
          roleDeptTreeselect.then(res => {
 | 
			
		||||
          deptTreeSelect.then(res => {
 | 
			
		||||
            this.$refs.dept.setCheckedKeys(res.data.checkedKeys);
 | 
			
		||||
          });
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -342,9 +342,8 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
 | 
			
		||||
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
 | 
			
		||||
import { getToken } from "@/utils/auth";
 | 
			
		||||
import { treeselect } from "@/api/system/dept";
 | 
			
		||||
import Treeselect from "@riophae/vue-treeselect";
 | 
			
		||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 | 
			
		||||
 | 
			
		||||
@@ -462,7 +461,7 @@ export default {
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.getList();
 | 
			
		||||
    this.getTreeselect();
 | 
			
		||||
    this.getDeptTree();
 | 
			
		||||
    this.getConfigKey("sys.user.initPassword").then(response => {
 | 
			
		||||
      this.initPassword = response.msg;
 | 
			
		||||
    });
 | 
			
		||||
@@ -479,8 +478,8 @@ export default {
 | 
			
		||||
      );
 | 
			
		||||
    },
 | 
			
		||||
    /** 查询部门下拉树结构 */
 | 
			
		||||
    getTreeselect() {
 | 
			
		||||
      treeselect().then(response => {
 | 
			
		||||
    getDeptTree() {
 | 
			
		||||
      deptTreeSelect().then(response => {
 | 
			
		||||
        this.deptOptions = response.data;
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
@@ -561,7 +560,6 @@ export default {
 | 
			
		||||
    /** 新增按钮操作 */
 | 
			
		||||
    handleAdd() {
 | 
			
		||||
      this.reset();
 | 
			
		||||
      this.getTreeselect();
 | 
			
		||||
      getUser().then(response => {
 | 
			
		||||
        this.postOptions = response.data.posts;
 | 
			
		||||
        this.roleOptions = response.data.roles;
 | 
			
		||||
@@ -573,7 +571,6 @@ export default {
 | 
			
		||||
    /** 修改按钮操作 */
 | 
			
		||||
    handleUpdate(row) {
 | 
			
		||||
      this.reset();
 | 
			
		||||
      this.getTreeselect();
 | 
			
		||||
      const userId = row.userId || this.ids;
 | 
			
		||||
      getUser(userId).then(response => {
 | 
			
		||||
        this.form = response.data.user;
 | 
			
		||||
 
 | 
			
		||||
@@ -642,6 +642,7 @@ insert into sys_dict_data values(14, 1,  '通知',     '1',       'sys_notice_ty
 | 
			
		||||
insert into sys_dict_data values(15, 2,  '公告',     '2',       'sys_notice_type',     '',   'success', 'N', '0', 'admin', sysdate, '', null, '公告');
 | 
			
		||||
insert into sys_dict_data values(16, 1,  '正常',     '0',       'sys_notice_status',   '',   'primary', 'Y', '0', 'admin', sysdate, '', null, '正常状态');
 | 
			
		||||
insert into sys_dict_data values(17, 2,  '关闭',     '1',       'sys_notice_status',   '',   'danger',  'N', '0', 'admin', sysdate, '', null, '关闭状态');
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate, '', null, '其他操作');
 | 
			
		||||
insert into sys_dict_data values(18, 1,  '新增',     '1',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate, '', null, '新增操作');
 | 
			
		||||
insert into sys_dict_data values(19, 2,  '修改',     '2',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate, '', null, '修改操作');
 | 
			
		||||
insert into sys_dict_data values(20, 3,  '删除',     '3',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', sysdate, '', null, '删除操作');
 | 
			
		||||
 
 | 
			
		||||
@@ -650,6 +650,7 @@ insert into sys_dict_data values(14, 1,  '通知',     '1',       'sys_notice_ty
 | 
			
		||||
insert into sys_dict_data values(15, 2,  '公告',     '2',       'sys_notice_type',     '',   'success', 'N', '0', 'admin', now(), '', null, '公告');
 | 
			
		||||
insert into sys_dict_data values(16, 1,  '正常',     '0',       'sys_notice_status',   '',   'primary', 'Y', '0', 'admin', now(), '', null, '正常状态');
 | 
			
		||||
insert into sys_dict_data values(17, 2,  '关闭',     '1',       'sys_notice_status',   '',   'danger',  'N', '0', 'admin', now(), '', null, '关闭状态');
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', now(), '', null, '其他操作');
 | 
			
		||||
insert into sys_dict_data values(18, 1,  '新增',     '1',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', now(), '', null, '新增操作');
 | 
			
		||||
insert into sys_dict_data values(19, 2,  '修改',     '2',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', now(), '', null, '修改操作');
 | 
			
		||||
insert into sys_dict_data values(20, 3,  '删除',     '3',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', now(), '', null, '删除操作');
 | 
			
		||||
 
 | 
			
		||||
@@ -499,6 +499,7 @@ insert into sys_dict_data values(14, 1,  '通知',     '1',       'sys_notice_ty
 | 
			
		||||
insert into sys_dict_data values(15, 2,  '公告',     '2',       'sys_notice_type',     '',   'success', 'N', '0', 'admin', sysdate(), '', null, '公告');
 | 
			
		||||
insert into sys_dict_data values(16, 1,  '正常',     '0',       'sys_notice_status',   '',   'primary', 'Y', '0', 'admin', sysdate(), '', null, '正常状态');
 | 
			
		||||
insert into sys_dict_data values(17, 2,  '关闭',     '1',       'sys_notice_status',   '',   'danger',  'N', '0', 'admin', sysdate(), '', null, '关闭状态');
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate(), '', null, '其他操作');
 | 
			
		||||
insert into sys_dict_data values(18, 1,  '新增',     '1',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate(), '', null, '新增操作');
 | 
			
		||||
insert into sys_dict_data values(19, 2,  '修改',     '2',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate(), '', null, '修改操作');
 | 
			
		||||
insert into sys_dict_data values(20, 3,  '删除',     '3',       'sys_oper_type',       '',   'danger',  'N', '0', 'admin', sysdate(), '', null, '删除操作');
 | 
			
		||||
 
 | 
			
		||||
@@ -702,6 +702,8 @@ INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [d
 | 
			
		||||
GO
 | 
			
		||||
INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [dict_type], [css_class], [list_class], [is_default], [status], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (17, 2, N'关闭', N'1', N'sys_notice_status', N'', N'danger', N'N', N'0', N'admin', getdate(), N'', NULL, N'关闭状态')
 | 
			
		||||
GO
 | 
			
		||||
INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [dict_type], [css_class], [list_class], [is_default], [status], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (29, 99, N'其他', N'0', N'sys_oper_type', N'', N'info', N'N', N'0', N'admin', getdate(), N'', NULL, N'其他操作');
 | 
			
		||||
GO
 | 
			
		||||
INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [dict_type], [css_class], [list_class], [is_default], [status], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (18, 1, N'新增', N'1', N'sys_oper_type', N'', N'info', N'N', N'0', N'admin', getdate(), N'', NULL, N'新增操作')
 | 
			
		||||
GO
 | 
			
		||||
INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [dict_type], [css_class], [list_class], [is_default], [status], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (19, 2, N'修改', N'2', N'sys_oper_type', N'', N'info', N'N', N'0', N'admin', getdate(), N'', NULL, N'修改操作')
 | 
			
		||||
 
 | 
			
		||||
@@ -7,3 +7,5 @@ update sys_config set config_key = 'sys.account.captchaEnabled' where config_id
 | 
			
		||||
insert into sys_menu values('1050', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock',  '#', 'admin', sysdate, '', null, '');
 | 
			
		||||
 | 
			
		||||
insert into sys_role_menu values ('2', '1050');
 | 
			
		||||
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate, '', null, '其他操作');
 | 
			
		||||
 
 | 
			
		||||
@@ -14,3 +14,6 @@ select to_timestamp($1, 'yyyy-mm-dd hh24:mi:ss');
 | 
			
		||||
$$ language sql strict ;
 | 
			
		||||
 | 
			
		||||
create cast (varchar as timestamptz) with function cast_varchar_to_timestamp as IMPLICIT;
 | 
			
		||||
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', now(), '', null, '其他操作');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,3 +12,6 @@ GO
 | 
			
		||||
 | 
			
		||||
INSERT [sys_role_menu] ([role_id], [menu_id]) VALUES (2, 1050)
 | 
			
		||||
GO
 | 
			
		||||
 | 
			
		||||
INSERT [sys_dict_data] ([dict_code], [dict_sort], [dict_label], [dict_value], [dict_type], [css_class], [list_class], [is_default], [status], [create_by], [create_time], [update_by], [update_time], [remark]) VALUES (29, 99, N'其他', N'0', N'sys_oper_type', N'', N'info', N'N', N'0', N'admin', getdate(), N'', NULL, N'其他操作');
 | 
			
		||||
GO
 | 
			
		||||
 
 | 
			
		||||
@@ -7,3 +7,5 @@ update sys_config set config_key = 'sys.account.captchaEnabled' where config_id
 | 
			
		||||
insert into sys_menu values('1050', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock',  '#', 'admin', sysdate(), '', null, '');
 | 
			
		||||
 | 
			
		||||
insert into sys_role_menu values ('2', '1050');
 | 
			
		||||
 | 
			
		||||
insert into sys_dict_data values(29, 99, '其他',     '0',       'sys_oper_type',       '',   'info',    'N', '0', 'admin', sysdate(), '', null, '其他操作');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user