Merge remote-tracking branch 'origin/master' into only-master
This commit is contained in:
commit
fe2da50666
|
|
@ -9,8 +9,8 @@ usage() {
|
||||||
|
|
||||||
# copy sql
|
# copy sql
|
||||||
echo "begin copy sql "
|
echo "begin copy sql "
|
||||||
cp ../sql/ry_20210908.sql ./mysql/db
|
cp ../sql/ry_20220814.sql ./mysql/db
|
||||||
cp ../sql/ry_config_20220114.sql ./mysql/db
|
cp ../sql/ry_config_20220510.sql ./mysql/db
|
||||||
|
|
||||||
# copy html
|
# copy html
|
||||||
echo "begin copy html "
|
echo "begin copy html "
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ management.metrics.export.influx.enabled=false
|
||||||
server.tomcat.accesslog.enabled=true
|
server.tomcat.accesslog.enabled=true
|
||||||
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
|
||||||
|
|
||||||
server.tomcat.basedir=
|
server.tomcat.basedir=/home/ruoyi/nacos/tomcat/logs
|
||||||
|
|
||||||
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||||
|
|
||||||
|
|
|
||||||
6
pom.xml
6
pom.xml
|
|
@ -17,12 +17,12 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<spring-boot.version>2.7.1</spring-boot.version>
|
<spring-boot.version>2.7.2</spring-boot.version>
|
||||||
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
<spring-cloud.version>2021.0.3</spring-cloud.version>
|
||||||
<spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
|
<spring-cloud-alibaba.version>2021.0.1.0</spring-cloud-alibaba.version>
|
||||||
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
|
<alibaba.nacos.version>2.0.4</alibaba.nacos.version>
|
||||||
<alibaba.seata.version>1.5.1</alibaba.seata.version>
|
<alibaba.seata.version>1.5.1</alibaba.seata.version>
|
||||||
<spring-boot-admin.version>2.7.2</spring-boot-admin.version>
|
<spring-boot-admin.version>2.7.3</spring-boot-admin.version>
|
||||||
<spring-boot.mybatis>2.2.2</spring-boot.mybatis>
|
<spring-boot.mybatis>2.2.2</spring-boot.mybatis>
|
||||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||||
<swagger.core.version>1.6.2</swagger.core.version>
|
<swagger.core.version>1.6.2</swagger.core.version>
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<commons.io.version>2.11.0</commons.io.version>
|
<commons.io.version>2.11.0</commons.io.version>
|
||||||
<commons.fileupload.version>1.4</commons.fileupload.version>
|
<commons.fileupload.version>1.4</commons.fileupload.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
<fastjson.version>2.0.9</fastjson.version>
|
<fastjson.version>2.0.12</fastjson.version>
|
||||||
<jjwt.version>0.9.1</jjwt.version>
|
<jjwt.version>0.9.1</jjwt.version>
|
||||||
<minio.version>8.2.2</minio.version>
|
<minio.version>8.2.2</minio.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public class SysDictData extends BaseEntity
|
||||||
|
|
||||||
public boolean getDefault()
|
public boolean getDefault()
|
||||||
{
|
{
|
||||||
return UserConstants.YES.equals(this.isDefault) ? true : false;
|
return UserConstants.YES.equals(this.isDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIsDefault()
|
public String getIsDefault()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.system.api.domain;
|
package com.ruoyi.system.api.domain;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
|
@ -59,6 +60,9 @@ public class SysRole extends BaseEntity
|
||||||
/** 部门组(数据权限) */
|
/** 部门组(数据权限) */
|
||||||
private Long[] deptIds;
|
private Long[] deptIds;
|
||||||
|
|
||||||
|
/** 角色菜单权限 */
|
||||||
|
private Set<String> permissions;
|
||||||
|
|
||||||
public SysRole()
|
public SysRole()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -204,6 +208,16 @@ public class SysRole extends BaseEntity
|
||||||
this.deptIds = deptIds;
|
this.deptIds = deptIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<String> getPermissions()
|
||||||
|
{
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(Set<String> permissions)
|
||||||
|
{
|
||||||
|
this.permissions = permissions;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
||||||
|
|
@ -59,16 +59,17 @@ public class SysLoginService
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
|
||||||
|
|
||||||
if (R.FAIL == userResult.getCode())
|
|
||||||
{
|
|
||||||
throw new ServiceException(userResult.getMsg());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
|
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
|
||||||
{
|
{
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (R.FAIL == userResult.getCode())
|
||||||
|
{
|
||||||
|
throw new ServiceException(userResult.getMsg());
|
||||||
|
}
|
||||||
|
|
||||||
LoginUser userInfo = userResult.getData();
|
LoginUser userInfo = userResult.getData();
|
||||||
SysUser user = userResult.getData().getSysUser();
|
SysUser user = userResult.getData().getSysUser();
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ public class SysPasswordService
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
private int maxRetryCount = CacheConstants.passwordMaxRetryCount;
|
private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT;
|
||||||
|
|
||||||
private Long lockTime = CacheConstants.passwordLockTime;
|
private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysRecordLogService recordLogService;
|
private SysRecordLogService recordLogService;
|
||||||
|
|
@ -60,7 +60,7 @@ public class SysPasswordService
|
||||||
if (!matches(user, password))
|
if (!matches(user, password))
|
||||||
{
|
{
|
||||||
retryCount = retryCount + 1;
|
retryCount = retryCount + 1;
|
||||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", maxRetryCount));
|
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("密码输入错误%s次", retryCount));
|
||||||
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
|
||||||
throw new ServiceException("用户不存在/密码错误");
|
throw new ServiceException("用户不存在/密码错误");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,11 @@ public @interface Excel
|
||||||
*/
|
*/
|
||||||
public String[] combo() default {};
|
public String[] combo() default {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否需要纵向合并单元格,应对需求:含有list集合单元格)
|
||||||
|
*/
|
||||||
|
public boolean needMerge() default false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ public class CacheConstants
|
||||||
/**
|
/**
|
||||||
* 密码最大错误次数
|
* 密码最大错误次数
|
||||||
*/
|
*/
|
||||||
public final static int passwordMaxRetryCount = 5;
|
public final static int PASSWORD_MAX_RETRY_COUNT = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码锁定时间,默认10(分钟)
|
* 密码锁定时间,默认10(分钟)
|
||||||
*/
|
*/
|
||||||
public final static long passwordLockTime = 10;
|
public final static long PASSWORD_LOCK_TIME = 10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限缓存前缀
|
* 权限缓存前缀
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,11 @@ public class Constants
|
||||||
*/
|
*/
|
||||||
public static final String GBK = "GBK";
|
public static final String GBK = "GBK";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* www主域
|
||||||
|
*/
|
||||||
|
public static final String WWW = "www.";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RMI 远程方法调用
|
* RMI 远程方法调用
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,9 @@ public class SecurityConstants
|
||||||
* 登录用户
|
* 登录用户
|
||||||
*/
|
*/
|
||||||
public static final String LOGIN_USER = "login_user";
|
public static final String LOGIN_USER = "login_user";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色权限
|
||||||
|
*/
|
||||||
|
public static final String ROLE_PERMISSION = "role_permission";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,16 @@ public class SecurityContextHolder
|
||||||
set(SecurityConstants.USER_KEY, userKey);
|
set(SecurityConstants.USER_KEY, userKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getPermission()
|
||||||
|
{
|
||||||
|
return get(SecurityConstants.ROLE_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setPermission(String permissions)
|
||||||
|
{
|
||||||
|
set(SecurityConstants.ROLE_PERMISSION, permissions);
|
||||||
|
}
|
||||||
|
|
||||||
public static void remove()
|
public static void remove()
|
||||||
{
|
{
|
||||||
THREAD_LOCAL.remove();
|
THREAD_LOCAL.remove();
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||||
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
|
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断给定的set列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value
|
||||||
|
*
|
||||||
|
* @param set 给定的集合
|
||||||
|
* @param array 给定的数组
|
||||||
|
* @return boolean 结果
|
||||||
|
*/
|
||||||
|
public static boolean containsAny(Collection<String> collection, String... array)
|
||||||
|
{
|
||||||
|
if (isEmpty(collection) || isEmpty(array))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (String str : array)
|
||||||
|
{
|
||||||
|
if (collection.contains(str))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 驼峰转下划线命名
|
* 驼峰转下划线命名
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ public final class HTMLFilter
|
||||||
final String name = m.group(1).toLowerCase();
|
final String name = m.group(1).toLowerCase();
|
||||||
if (allowed(name))
|
if (allowed(name))
|
||||||
{
|
{
|
||||||
if (false == inArray(name, vSelfClosingTags))
|
if (!inArray(name, vSelfClosingTags))
|
||||||
{
|
{
|
||||||
if (vTagCounts.containsKey(name))
|
if (vTagCounts.containsKey(name))
|
||||||
{
|
{
|
||||||
|
|
@ -387,7 +387,7 @@ public final class HTMLFilter
|
||||||
{
|
{
|
||||||
paramValue = processParamProtocol(paramValue);
|
paramValue = processParamProtocol(paramValue);
|
||||||
}
|
}
|
||||||
params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\"");
|
params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\\\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -20,6 +22,7 @@ import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.RegExUtils;
|
import org.apache.commons.lang3.RegExUtils;
|
||||||
|
import org.apache.commons.lang3.reflect.FieldUtils;
|
||||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
|
|
@ -126,6 +129,26 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
private short maxHeight;
|
private short maxHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并后最后行数
|
||||||
|
*/
|
||||||
|
private int subMergedLastRowNum = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并后开始行数
|
||||||
|
*/
|
||||||
|
private int subMergedFirstRowNum = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象的子列表方法
|
||||||
|
*/
|
||||||
|
private Method subMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象的子列表属性
|
||||||
|
*/
|
||||||
|
private List<Field> subFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计列表
|
* 统计列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -175,6 +198,7 @@ public class ExcelUtil<T>
|
||||||
createExcelField();
|
createExcelField();
|
||||||
createWorkbook();
|
createWorkbook();
|
||||||
createTitle();
|
createTitle();
|
||||||
|
createSubHead();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -184,13 +208,48 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotEmpty(title))
|
if (StringUtils.isNotEmpty(title))
|
||||||
{
|
{
|
||||||
|
subMergedFirstRowNum++;
|
||||||
|
subMergedLastRowNum++;
|
||||||
|
int titleLastCol = this.fields.size() - 1;
|
||||||
|
if (isSubList())
|
||||||
|
{
|
||||||
|
titleLastCol = titleLastCol + subFields.size() - 1;
|
||||||
|
}
|
||||||
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0);
|
||||||
titleRow.setHeightInPoints(30);
|
titleRow.setHeightInPoints(30);
|
||||||
Cell titleCell = titleRow.createCell(0);
|
Cell titleCell = titleRow.createCell(0);
|
||||||
titleCell.setCellStyle(styles.get("title"));
|
titleCell.setCellStyle(styles.get("title"));
|
||||||
titleCell.setCellValue(title);
|
titleCell.setCellValue(title);
|
||||||
sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(),
|
sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(), titleLastCol));
|
||||||
this.fields.size() - 1));
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建对象的子列表名称
|
||||||
|
*/
|
||||||
|
public void createSubHead()
|
||||||
|
{
|
||||||
|
if (isSubList())
|
||||||
|
{
|
||||||
|
subMergedFirstRowNum++;
|
||||||
|
subMergedLastRowNum++;
|
||||||
|
Row subRow = sheet.createRow(rownum);
|
||||||
|
int excelNum = 0;
|
||||||
|
for (Object[] objects : fields)
|
||||||
|
{
|
||||||
|
Excel attr = (Excel) objects[1];
|
||||||
|
Cell headCell1 = subRow.createCell(excelNum);
|
||||||
|
headCell1.setCellValue(attr.name());
|
||||||
|
headCell1.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
|
||||||
|
excelNum++;
|
||||||
|
}
|
||||||
|
int headFirstRow = excelNum - 1;
|
||||||
|
int headLastRow = headFirstRow + subFields.size() - 1;
|
||||||
|
if (headLastRow > headFirstRow)
|
||||||
|
{
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, headFirstRow, headLastRow));
|
||||||
|
}
|
||||||
|
rownum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -378,7 +437,6 @@ public class ExcelUtil<T>
|
||||||
* @param list 导出数据集合
|
* @param list 导出数据集合
|
||||||
* @param sheetName 工作表的名称
|
* @param sheetName 工作表的名称
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
|
||||||
{
|
{
|
||||||
|
|
@ -393,7 +451,6 @@ public class ExcelUtil<T>
|
||||||
* @param sheetName 工作表的名称
|
* @param sheetName 工作表的名称
|
||||||
* @param title 标题
|
* @param title 标题
|
||||||
* @return 结果
|
* @return 结果
|
||||||
* @throws IOException
|
|
||||||
*/
|
*/
|
||||||
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
|
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
|
||||||
{
|
{
|
||||||
|
|
@ -468,8 +525,20 @@ public class ExcelUtil<T>
|
||||||
// 写入各个字段的列头名称
|
// 写入各个字段的列头名称
|
||||||
for (Object[] os : fields)
|
for (Object[] os : fields)
|
||||||
{
|
{
|
||||||
|
Field field = (Field) os[0];
|
||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
this.createCell(excel, row, column++);
|
if (Collection.class.isAssignableFrom(field.getType()))
|
||||||
|
{
|
||||||
|
for (Field subField : subFields)
|
||||||
|
{
|
||||||
|
Excel subExcel = subField.getAnnotation(Excel.class);
|
||||||
|
this.createHeadCell(subExcel, row, column++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.createHeadCell(excel, row, column++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Type.EXPORT.equals(type))
|
if (Type.EXPORT.equals(type))
|
||||||
{
|
{
|
||||||
|
|
@ -485,21 +554,60 @@ public class ExcelUtil<T>
|
||||||
* @param index 序号
|
* @param index 序号
|
||||||
* @param row 单元格行
|
* @param row 单元格行
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void fillExcelData(int index, Row row)
|
public void fillExcelData(int index, Row row)
|
||||||
{
|
{
|
||||||
int startNo = index * sheetSize;
|
int startNo = index * sheetSize;
|
||||||
int endNo = Math.min(startNo + sheetSize, list.size());
|
int endNo = Math.min(startNo + sheetSize, list.size());
|
||||||
|
int rowNo = (1 + rownum) - startNo;
|
||||||
for (int i = startNo; i < endNo; i++)
|
for (int i = startNo; i < endNo; i++)
|
||||||
{
|
{
|
||||||
row = sheet.createRow(i + 1 + rownum - startNo);
|
rowNo = i > 1 ? rowNo + 1 : rowNo + i;
|
||||||
|
row = sheet.createRow(rowNo);
|
||||||
// 得到导出对象.
|
// 得到导出对象.
|
||||||
T vo = (T) list.get(i);
|
T vo = (T) list.get(i);
|
||||||
|
Collection<?> subList = null;
|
||||||
|
if (isSubListValue(vo))
|
||||||
|
{
|
||||||
|
subList = getListCellValue(vo);
|
||||||
|
subMergedLastRowNum = subMergedLastRowNum + subList.size();
|
||||||
|
}
|
||||||
|
|
||||||
int column = 0;
|
int column = 0;
|
||||||
for (Object[] os : fields)
|
for (Object[] os : fields)
|
||||||
{
|
{
|
||||||
Field field = (Field) os[0];
|
Field field = (Field) os[0];
|
||||||
Excel excel = (Excel) os[1];
|
Excel excel = (Excel) os[1];
|
||||||
this.addCell(excel, row, vo, field, column++);
|
if (Collection.class.isAssignableFrom(field.getType()) && StringUtils.isNotNull(subList))
|
||||||
|
{
|
||||||
|
boolean subFirst = false;
|
||||||
|
for (Object obj : subList)
|
||||||
|
{
|
||||||
|
if (subFirst)
|
||||||
|
{
|
||||||
|
rowNo++;
|
||||||
|
row = sheet.createRow(rowNo);
|
||||||
|
}
|
||||||
|
List<Field> subFields = FieldUtils.getFieldsListWithAnnotation(obj.getClass(), Excel.class);
|
||||||
|
int subIndex = 0;
|
||||||
|
for (Field subField : subFields)
|
||||||
|
{
|
||||||
|
if (subField.isAnnotationPresent(Excel.class))
|
||||||
|
{
|
||||||
|
subField.setAccessible(true);
|
||||||
|
Excel attr = subField.getAnnotation(Excel.class);
|
||||||
|
this.addCell(attr, row, (T) obj, subField, column + subIndex);
|
||||||
|
}
|
||||||
|
subIndex++;
|
||||||
|
}
|
||||||
|
subFirst = true;
|
||||||
|
}
|
||||||
|
this.subMergedFirstRowNum = this.subMergedFirstRowNum + subList.size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.addCell(excel, row, vo, field, column++);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -634,7 +742,7 @@ public class ExcelUtil<T>
|
||||||
/**
|
/**
|
||||||
* 创建单元格
|
* 创建单元格
|
||||||
*/
|
*/
|
||||||
public Cell createCell(Excel attr, Row row, int column)
|
public Cell createHeadCell(Excel attr, Row row, int column)
|
||||||
{
|
{
|
||||||
// 创建列
|
// 创建列
|
||||||
Cell cell = row.createCell(column);
|
Cell cell = row.createCell(column);
|
||||||
|
|
@ -642,6 +750,15 @@ public class ExcelUtil<T>
|
||||||
cell.setCellValue(attr.name());
|
cell.setCellValue(attr.name());
|
||||||
setDataValidation(attr, row, column);
|
setDataValidation(attr, row, column);
|
||||||
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
|
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
|
||||||
|
if (isSubList())
|
||||||
|
{
|
||||||
|
// 填充默认样式,防止合并单元格样式失效
|
||||||
|
sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor())));
|
||||||
|
if (attr.needMerge())
|
||||||
|
{
|
||||||
|
sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column));
|
||||||
|
}
|
||||||
|
}
|
||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,6 +866,11 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
// 创建cell
|
// 创建cell
|
||||||
cell = row.createCell(column);
|
cell = row.createCell(column);
|
||||||
|
if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge())
|
||||||
|
{
|
||||||
|
CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column);
|
||||||
|
sheet.addMergedRegion(cellAddress);
|
||||||
|
}
|
||||||
cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor())));
|
cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor())));
|
||||||
|
|
||||||
// 用于读取对象中的属性
|
// 用于读取对象中的属性
|
||||||
|
|
@ -766,7 +888,7 @@ public class ExcelUtil<T>
|
||||||
}
|
}
|
||||||
else if (value instanceof BigDecimal && -1 != attr.scale())
|
else if (value instanceof BigDecimal && -1 != attr.scale())
|
||||||
{
|
{
|
||||||
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
|
cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue());
|
||||||
}
|
}
|
||||||
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
{
|
{
|
||||||
|
|
@ -839,7 +961,7 @@ public class ExcelUtil<T>
|
||||||
for (String item : convertSource)
|
for (String item : convertSource)
|
||||||
{
|
{
|
||||||
String[] itemArray = item.split("=");
|
String[] itemArray = item.split("=");
|
||||||
if (StringUtils.containsAny(separator, propertyValue))
|
if (StringUtils.containsAny(propertyValue, separator))
|
||||||
{
|
{
|
||||||
for (String value : propertyValue.split(separator))
|
for (String value : propertyValue.split(separator))
|
||||||
{
|
{
|
||||||
|
|
@ -876,7 +998,7 @@ public class ExcelUtil<T>
|
||||||
for (String item : convertSource)
|
for (String item : convertSource)
|
||||||
{
|
{
|
||||||
String[] itemArray = item.split("=");
|
String[] itemArray = item.split("=");
|
||||||
if (StringUtils.containsAny(separator, propertyValue))
|
if (StringUtils.containsAny(propertyValue, separator))
|
||||||
{
|
{
|
||||||
for (String value : propertyValue.split(separator))
|
for (String value : propertyValue.split(separator))
|
||||||
{
|
{
|
||||||
|
|
@ -1049,6 +1171,13 @@ public class ExcelUtil<T>
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
fields.add(new Object[] { field, attr });
|
fields.add(new Object[] { field, attr });
|
||||||
}
|
}
|
||||||
|
if (Collection.class.isAssignableFrom(field.getType()))
|
||||||
|
{
|
||||||
|
subMethod = getSubMethod(field.getName(), clazz);
|
||||||
|
ParameterizedType pt = (ParameterizedType) field.getGenericType();
|
||||||
|
Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0];
|
||||||
|
this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多注解
|
// 多注解
|
||||||
|
|
@ -1227,4 +1356,61 @@ public class ExcelUtil<T>
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有对象的子列表
|
||||||
|
*/
|
||||||
|
public boolean isSubList()
|
||||||
|
{
|
||||||
|
return StringUtils.isNotNull(subFields) && subFields.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有对象的子列表,集合不为空
|
||||||
|
*/
|
||||||
|
public boolean isSubListValue(T vo)
|
||||||
|
{
|
||||||
|
return StringUtils.isNotNull(subFields) && subFields.size() > 0 && StringUtils.isNotNull(getListCellValue(vo)) && getListCellValue(vo).size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取集合的值
|
||||||
|
*/
|
||||||
|
public Collection<?> getListCellValue(Object obj)
|
||||||
|
{
|
||||||
|
Object value;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
value = subMethod.invoke(obj, new Object[] {});
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return new ArrayList<Object>();
|
||||||
|
}
|
||||||
|
return (Collection<?>) value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对象的子列表方法
|
||||||
|
*
|
||||||
|
* @param name 名称
|
||||||
|
* @param pojoClass 类对象
|
||||||
|
* @return 子列表方法
|
||||||
|
*/
|
||||||
|
public Method getSubMethod(String name, Class<?> pojoClass)
|
||||||
|
{
|
||||||
|
StringBuffer getMethodName = new StringBuffer("get");
|
||||||
|
getMethodName.append(name.substring(0, 1).toUpperCase());
|
||||||
|
getMethodName.append(name.substring(1));
|
||||||
|
Method method = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
method = pojoClass.getMethod(getMethodName.toString(), new Class[] {});
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("获取对象异常{}", e.getMessage());
|
||||||
|
}
|
||||||
|
return method;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,9 @@ public @interface DataScope
|
||||||
* 用户表的别名
|
* 用户表的别名
|
||||||
*/
|
*/
|
||||||
public String userAlias() default "";
|
public String userAlias() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||||
|
*/
|
||||||
|
public String permission() default "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import com.ruoyi.common.core.context.SecurityContextHolder;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.core.utils.StringUtils;
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||||
|
|
@ -70,8 +72,9 @@ public class DataScopeAspect
|
||||||
// 如果是超级管理员,则不过滤数据
|
// 如果是超级管理员,则不过滤数据
|
||||||
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
||||||
{
|
{
|
||||||
|
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission());
|
||||||
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
|
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
|
||||||
controllerDataScope.userAlias());
|
controllerDataScope.userAlias(), permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -83,8 +86,9 @@ public class DataScopeAspect
|
||||||
* @param user 用户
|
* @param user 用户
|
||||||
* @param deptAlias 部门别名
|
* @param deptAlias 部门别名
|
||||||
* @param userAlias 用户别名
|
* @param userAlias 用户别名
|
||||||
|
* @param permission 权限字符
|
||||||
*/
|
*/
|
||||||
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias)
|
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
|
||||||
{
|
{
|
||||||
StringBuilder sqlString = new StringBuilder();
|
StringBuilder sqlString = new StringBuilder();
|
||||||
List<String> conditions = new ArrayList<String>();
|
List<String> conditions = new ArrayList<String>();
|
||||||
|
|
@ -96,6 +100,11 @@ public class DataScopeAspect
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(permission) && StringUtils.isNotEmpty(role.getPermissions())
|
||||||
|
&& !StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission)))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (DATA_SCOPE_ALL.equals(dataScope))
|
if (DATA_SCOPE_ALL.equals(dataScope))
|
||||||
{
|
{
|
||||||
sqlString = new StringBuilder();
|
sqlString = new StringBuilder();
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.ruoyi.common.core.utils.StringUtils;
|
||||||
import com.ruoyi.common.core.utils.ip.IpUtils;
|
import com.ruoyi.common.core.utils.ip.IpUtils;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessStatus;
|
import com.ruoyi.common.log.enums.BusinessStatus;
|
||||||
|
import com.ruoyi.common.log.filter.PropertyPreExcludeFilter;
|
||||||
import com.ruoyi.common.log.service.AsyncLogService;
|
import com.ruoyi.common.log.service.AsyncLogService;
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
|
|
@ -36,6 +37,9 @@ public class LogAspect
|
||||||
{
|
{
|
||||||
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
|
||||||
|
|
||||||
|
/** 排除敏感属性字段 */
|
||||||
|
public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AsyncLogService asyncLogService;
|
private AsyncLogService asyncLogService;
|
||||||
|
|
||||||
|
|
@ -162,7 +166,7 @@ public class LogAspect
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object jsonObj = JSON.toJSON(o);
|
String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter());
|
||||||
params += jsonObj.toString() + " ";
|
params += jsonObj.toString() + " ";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
@ -174,6 +178,14 @@ public class LogAspect
|
||||||
return params.trim();
|
return params.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略敏感属性
|
||||||
|
*/
|
||||||
|
public PropertyPreExcludeFilter excludePropertyPreFilter()
|
||||||
|
{
|
||||||
|
return new PropertyPreExcludeFilter().addExcludes(EXCLUDE_PROPERTIES);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否需要过滤的对象。
|
* 判断是否需要过滤的对象。
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.common.log.filter;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.filter.SimplePropertyPreFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排除JSON敏感属性
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class PropertyPreExcludeFilter extends SimplePropertyPreFilter
|
||||||
|
{
|
||||||
|
public PropertyPreExcludeFilter()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropertyPreExcludeFilter addExcludes(String... filters)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < filters.length; i++)
|
||||||
|
{
|
||||||
|
this.getExcludes().add(filters[i]);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -124,9 +124,9 @@ public class RedisService
|
||||||
* @param collection 多个对象
|
* @param collection 多个对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long deleteObject(final Collection collection)
|
public boolean deleteObject(final Collection collection)
|
||||||
{
|
{
|
||||||
return redisTemplate.delete(collection);
|
return redisTemplate.delete(collection) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -243,6 +243,18 @@ public class RedisService
|
||||||
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
return redisTemplate.opsForHash().multiGet(key, hKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除Hash中的某条数据
|
||||||
|
*
|
||||||
|
* @param key Redis键
|
||||||
|
* @param hKey Hash键
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
public boolean deleteCacheMapValue(final String key, final String hKey)
|
||||||
|
{
|
||||||
|
return redisTemplate.opsForHash().delete(key, hKey) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得缓存的基本对象列表
|
* 获得缓存的基本对象列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.util.PatternMatchUtils;
|
import org.springframework.util.PatternMatchUtils;
|
||||||
|
import com.ruoyi.common.core.context.SecurityContextHolder;
|
||||||
import com.ruoyi.common.core.exception.auth.NotLoginException;
|
import com.ruoyi.common.core.exception.auth.NotLoginException;
|
||||||
import com.ruoyi.common.core.exception.auth.NotPermissionException;
|
import com.ruoyi.common.core.exception.auth.NotPermissionException;
|
||||||
import com.ruoyi.common.core.exception.auth.NotRoleException;
|
import com.ruoyi.common.core.exception.auth.NotRoleException;
|
||||||
|
|
@ -134,6 +135,7 @@ public class AuthLogic
|
||||||
*/
|
*/
|
||||||
public void checkPermi(RequiresPermissions requiresPermissions)
|
public void checkPermi(RequiresPermissions requiresPermissions)
|
||||||
{
|
{
|
||||||
|
SecurityContextHolder.setPermission(StringUtils.join(requiresPermissions.value(), ","));
|
||||||
if (requiresPermissions.logical() == Logical.AND)
|
if (requiresPermissions.logical() == Logical.AND)
|
||||||
{
|
{
|
||||||
checkPermiAnd(requiresPermissions.value());
|
checkPermiAnd(requiresPermissions.value());
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ public class FeignRequestInterceptor implements RequestInterceptor
|
||||||
{
|
{
|
||||||
requestTemplate.header(SecurityConstants.DETAILS_USER_ID, userId);
|
requestTemplate.header(SecurityConstants.DETAILS_USER_ID, userId);
|
||||||
}
|
}
|
||||||
|
String userKey = headers.get(SecurityConstants.USER_KEY);
|
||||||
|
if (StringUtils.isNotEmpty(userKey))
|
||||||
|
{
|
||||||
|
requestTemplate.header(SecurityConstants.USER_KEY, userKey);
|
||||||
|
}
|
||||||
String userName = headers.get(SecurityConstants.DETAILS_USERNAME);
|
String userName = headers.get(SecurityConstants.DETAILS_USERNAME);
|
||||||
if (StringUtils.isNotEmpty(userName))
|
if (StringUtils.isNotEmpty(userName))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -55,16 +54,7 @@ public class SysDeptController extends BaseController
|
||||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||||
{
|
{
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||||
Iterator<SysDept> it = depts.iterator();
|
depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
|
||||||
while (it.hasNext())
|
|
||||||
{
|
|
||||||
SysDept d = (SysDept) it.next();
|
|
||||||
if (d.getDeptId().intValue() == deptId
|
|
||||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
|
||||||
{
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return AjaxResult.success(depts);
|
return AjaxResult.success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,29 +69,6 @@ public class SysDeptController extends BaseController
|
||||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取部门下拉树列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/treeselect")
|
|
||||||
public AjaxResult treeselect(SysDept dept)
|
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
|
||||||
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载对应角色部门列表树
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
|
||||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
|
||||||
{
|
|
||||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
|
||||||
AjaxResult ajax = AjaxResult.success();
|
|
||||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
|
||||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
|
||||||
return ajax;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增部门
|
* 新增部门
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,14 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.core.constant.CacheConstants;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.redis.service.RedisService;
|
||||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
import com.ruoyi.system.api.domain.SysLogininfor;
|
import com.ruoyi.system.api.domain.SysLogininfor;
|
||||||
|
|
@ -33,6 +35,9 @@ public class SysLogininforController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysLogininforService logininforService;
|
private ISysLogininforService logininforService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
@RequiresPermissions("system:logininfor:list")
|
@RequiresPermissions("system:logininfor:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysLogininfor logininfor)
|
public TableDataInfo list(SysLogininfor logininfor)
|
||||||
|
|
@ -69,6 +74,15 @@ public class SysLogininforController extends BaseController
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:logininfor:unlock")
|
||||||
|
@Log(title = "账户解锁", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping("/unlock/{userName}")
|
||||||
|
public AjaxResult unlock(@PathVariable("userName") String userName)
|
||||||
|
{
|
||||||
|
redisService.deleteObject(CacheConstants.PWD_ERR_CNT_KEY + userName);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
@InnerAuth
|
@InnerAuth
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SysLogininfor logininfor)
|
public AjaxResult add(@RequestBody SysLogininfor logininfor)
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ public class SysProfileController extends BaseController
|
||||||
}
|
}
|
||||||
user.setUserId(sysUser.getUserId());
|
user.setUserId(sysUser.getUserId());
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
|
user.setAvatar(null);
|
||||||
|
user.setDeptId(null);
|
||||||
if (userService.updateUserProfile(user) > 0)
|
if (userService.updateUserProfile(user) > 0)
|
||||||
{
|
{
|
||||||
// 更新缓存用户信息
|
// 更新缓存用户信息
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,11 @@ import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.system.api.domain.SysDept;
|
||||||
import com.ruoyi.system.api.domain.SysRole;
|
import com.ruoyi.system.api.domain.SysRole;
|
||||||
import com.ruoyi.system.api.domain.SysUser;
|
import com.ruoyi.system.api.domain.SysUser;
|
||||||
import com.ruoyi.system.domain.SysUserRole;
|
import com.ruoyi.system.domain.SysUserRole;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
|
||||||
|
|
@ -42,6 +44,9 @@ public class SysRoleController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService userService;
|
private ISysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
@RequiresPermissions("system:role:list")
|
@RequiresPermissions("system:role:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(SysRole role)
|
public TableDataInfo list(SysRole role)
|
||||||
|
|
@ -219,4 +224,17 @@ public class SysRoleController extends BaseController
|
||||||
roleService.checkRoleDataScope(roleId);
|
roleService.checkRoleDataScope(roleId);
|
||||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取对应角色部门树列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:role:query")
|
||||||
|
@GetMapping(value = "/deptTree/{roleId}")
|
||||||
|
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||||
|
{
|
||||||
|
AjaxResult ajax = AjaxResult.success();
|
||||||
|
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||||
|
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||||
|
return ajax;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -29,10 +29,12 @@ import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.ruoyi.common.security.annotation.InnerAuth;
|
import com.ruoyi.common.security.annotation.InnerAuth;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||||
|
import com.ruoyi.system.api.domain.SysDept;
|
||||||
import com.ruoyi.system.api.domain.SysRole;
|
import com.ruoyi.system.api.domain.SysRole;
|
||||||
import com.ruoyi.system.api.domain.SysUser;
|
import com.ruoyi.system.api.domain.SysUser;
|
||||||
import com.ruoyi.system.api.model.LoginUser;
|
import com.ruoyi.system.api.model.LoginUser;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import com.ruoyi.system.service.ISysDeptService;
|
||||||
import com.ruoyi.system.service.ISysPermissionService;
|
import com.ruoyi.system.service.ISysPermissionService;
|
||||||
import com.ruoyi.system.service.ISysPostService;
|
import com.ruoyi.system.service.ISysPostService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
|
@ -53,6 +55,9 @@ public class SysUserController extends BaseController
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysRoleService roleService;
|
private ISysRoleService roleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysPostService postService;
|
private ISysPostService postService;
|
||||||
|
|
||||||
|
|
@ -116,9 +121,9 @@ public class SysUserController extends BaseController
|
||||||
return R.fail("用户名或密码错误");
|
return R.fail("用户名或密码错误");
|
||||||
}
|
}
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(sysUser.getUserId());
|
Set<String> roles = permissionService.getRolePermission(sysUser);
|
||||||
// 权限集合
|
// 权限集合
|
||||||
Set<String> permissions = permissionService.getMenuPermission(sysUser.getUserId());
|
Set<String> permissions = permissionService.getMenuPermission(sysUser);
|
||||||
LoginUser sysUserVo = new LoginUser();
|
LoginUser sysUserVo = new LoginUser();
|
||||||
sysUserVo.setSysUser(sysUser);
|
sysUserVo.setSysUser(sysUser);
|
||||||
sysUserVo.setRoles(roles);
|
sysUserVo.setRoles(roles);
|
||||||
|
|
@ -153,13 +158,13 @@ public class SysUserController extends BaseController
|
||||||
@GetMapping("getInfo")
|
@GetMapping("getInfo")
|
||||||
public AjaxResult getInfo()
|
public AjaxResult getInfo()
|
||||||
{
|
{
|
||||||
Long userId = SecurityUtils.getUserId();
|
SysUser user = userService.selectUserById(SecurityUtils.getUserId());
|
||||||
// 角色集合
|
// 角色集合
|
||||||
Set<String> roles = permissionService.getRolePermission(userId);
|
Set<String> roles = permissionService.getRolePermission(user);
|
||||||
// 权限集合
|
// 权限集合
|
||||||
Set<String> permissions = permissionService.getMenuPermission(userId);
|
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("user", userService.selectUserById(userId));
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
return ajax;
|
return ajax;
|
||||||
|
|
@ -309,4 +314,14 @@ public class SysUserController extends BaseController
|
||||||
userService.insertUserAuth(userId, roleIds);
|
userService.insertUserAuth(userId, roleIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门树列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:user:list")
|
||||||
|
@GetMapping("/deptTree")
|
||||||
|
public AjaxResult deptTree(SysDept dept)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(deptService.selectDeptTreeList(dept));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,14 @@ public interface SysMenuMapper
|
||||||
*/
|
*/
|
||||||
public List<SysMenu> selectMenuListByUserId(SysMenu menu);
|
public List<SysMenu> selectMenuListByUserId(SysMenu menu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色ID查询权限
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public List<String> selectMenuPermsByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询权限
|
* 根据用户ID查询权限
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,14 @@ public interface ISysDeptService
|
||||||
*/
|
*/
|
||||||
public List<SysDept> selectDeptList(SysDept dept);
|
public List<SysDept> selectDeptList(SysDept dept);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门树结构信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门树信息集合
|
||||||
|
*/
|
||||||
|
public List<TreeSelect> selectDeptTreeList(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,14 @@ public interface ISysMenuService
|
||||||
*/
|
*/
|
||||||
public Set<String> selectMenuPermsByUserId(Long userId);
|
public Set<String> selectMenuPermsByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色ID查询权限
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
public Set<String> selectMenuPermsByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID查询菜单树信息
|
* 根据用户ID查询菜单树信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,13 @@ package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.ruoyi.system.api.domain.SysUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 权限信息 服务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
public interface ISysPermissionService
|
public interface ISysPermissionService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
@ -10,7 +17,7 @@ public interface ISysPermissionService
|
||||||
* @param userId 用户Id
|
* @param userId 用户Id
|
||||||
* @return 角色权限信息
|
* @return 角色权限信息
|
||||||
*/
|
*/
|
||||||
public Set<String> getRolePermission(Long userId);
|
public Set<String> getRolePermission(SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取菜单数据权限
|
* 获取菜单数据权限
|
||||||
|
|
@ -18,5 +25,5 @@ public interface ISysPermissionService
|
||||||
* @param userId 用户Id
|
* @param userId 用户Id
|
||||||
* @return 菜单权限信息
|
* @return 菜单权限信息
|
||||||
*/
|
*/
|
||||||
public Set<String> getMenuPermission(Long userId);
|
public Set<String> getMenuPermission(SysUser user);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,19 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
return deptMapper.selectDeptList(dept);
|
return deptMapper.selectDeptList(dept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询部门树结构信息
|
||||||
|
*
|
||||||
|
* @param dept 部门信息
|
||||||
|
* @return 部门树信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TreeSelect> selectDeptTreeList(SysDept dept)
|
||||||
|
{
|
||||||
|
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||||
|
return buildDeptTreeSelect(depts);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,27 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
return permsSet;
|
return permsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据角色ID查询权限
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 权限列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Set<String> selectMenuPermsByRoleId(Long roleId)
|
||||||
|
{
|
||||||
|
List<String> perms = menuMapper.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查询菜单
|
* 根据用户ID查询菜单
|
||||||
*
|
*
|
||||||
|
|
@ -504,7 +525,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
*/
|
*/
|
||||||
public String innerLinkReplaceEach(String path)
|
public String innerLinkReplaceEach(String path)
|
||||||
{
|
{
|
||||||
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS },
|
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." },
|
||||||
new String[] { "", "" });
|
new String[] { "", "", "", "/" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,21 @@
|
||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.system.api.domain.SysRole;
|
||||||
import com.ruoyi.system.api.domain.SysUser;
|
import com.ruoyi.system.api.domain.SysUser;
|
||||||
import com.ruoyi.system.service.ISysMenuService;
|
import com.ruoyi.system.service.ISysMenuService;
|
||||||
import com.ruoyi.system.service.ISysPermissionService;
|
import com.ruoyi.system.service.ISysPermissionService;
|
||||||
import com.ruoyi.system.service.ISysRoleService;
|
import com.ruoyi.system.service.ISysRoleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户权限处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysPermissionServiceImpl implements ISysPermissionService
|
public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
{
|
{
|
||||||
|
|
@ -25,17 +32,17 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
* @return 角色权限信息
|
* @return 角色权限信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getRolePermission(Long userId)
|
public Set<String> getRolePermission(SysUser user)
|
||||||
{
|
{
|
||||||
Set<String> roles = new HashSet<String>();
|
Set<String> roles = new HashSet<String>();
|
||||||
// 管理员拥有所有权限
|
// 管理员拥有所有权限
|
||||||
if (SysUser.isAdmin(userId))
|
if (user.isAdmin())
|
||||||
{
|
{
|
||||||
roles.add("admin");
|
roles.add("admin");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
roles.addAll(roleService.selectRolePermissionByUserId(userId));
|
roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId()));
|
||||||
}
|
}
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
@ -47,17 +54,31 @@ public class SysPermissionServiceImpl implements ISysPermissionService
|
||||||
* @return 菜单权限信息
|
* @return 菜单权限信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getMenuPermission(Long userId)
|
public Set<String> getMenuPermission(SysUser user)
|
||||||
{
|
{
|
||||||
Set<String> perms = new HashSet<String>();
|
Set<String> perms = new HashSet<String>();
|
||||||
// 管理员拥有所有权限
|
// 管理员拥有所有权限
|
||||||
if (SysUser.isAdmin(userId))
|
if (user.isAdmin())
|
||||||
{
|
{
|
||||||
perms.add("*:*:*");
|
perms.add("*:*:*");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
perms.addAll(menuService.selectMenuPermsByUserId(userId));
|
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;
|
return perms;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} limit 1
|
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="SysDept">
|
<insert id="insertDept" parameterType="SysDept">
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,13 @@
|
||||||
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
||||||
</select>
|
</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>
|
||||||
|
|
||||||
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
|
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
|
||||||
<include refid="selectMenuVo"/>
|
<include refid="selectMenuVo"/>
|
||||||
where menu_id = #{menuId}
|
where menu_id = #{menuId}
|
||||||
|
|
|
||||||
|
|
@ -85,12 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="selectRoleVo"/>
|
||||||
where r.role_name=#{roleName} limit 1
|
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
||||||
<include refid="selectRoleVo"/>
|
<include refid="selectRoleVo"/>
|
||||||
where r.role_key=#{roleKey} limit 1
|
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
||||||
|
|
@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteRoleById" parameterType="Long">
|
<delete id="deleteRoleById" parameterType="Long">
|
||||||
update sys_role set del_flag = '2' where role_id = #{roleId}
|
update sys_role set del_flag = '2' where role_id = #{roleId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteRoleByIds" parameterType="Long">
|
<delete id="deleteRoleByIds" parameterType="Long">
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.user_name = #{userName}
|
where u.user_name = #{userName} and u.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
|
|
@ -131,15 +131,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
<select id="checkUserNameUnique" parameterType="String" resultType="int">
|
||||||
select count(1) from sys_user where user_name = #{userName} limit 1
|
select count(1) from sys_user where user_name = #{userName} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
|
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||||
select user_id, email from sys_user where email = #{email} limit 1
|
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||||
|
|
@ -208,7 +208,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteUserById" parameterType="Long">
|
<delete id="deleteUserById" parameterType="Long">
|
||||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteUserByIds" parameterType="Long">
|
<delete id="deleteUserByIds" parameterType="Long">
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
export function addDept(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,13 @@ export function delLogininfor(infoId) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解锁用户登录状态
|
||||||
|
export function unlockLogininfor(userName) {
|
||||||
|
return request({
|
||||||
|
url: '/system/logininfor/unlock/' + userName,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
// 清空登录日志
|
// 清空登录日志
|
||||||
export function cleanLogininfor() {
|
export function cleanLogininfor() {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -109,3 +109,11 @@ export function authUserSelectAll(data) {
|
||||||
params: 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
|
params: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询部门下拉树结构
|
||||||
|
export function deptTreeSelect() {
|
||||||
|
return request({
|
||||||
|
url: '/system/user/deptTree',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fade-transform */
|
/* fade-transform */
|
||||||
|
.fade-transform--move,
|
||||||
.fade-transform-leave-active,
|
.fade-transform-leave-active,
|
||||||
.fade-transform-enter-active {
|
.fade-transform-enter-active {
|
||||||
transition: all .5s;
|
transition: all .5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fade-transform-leave-active {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.fade-transform-enter {
|
.fade-transform-enter {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateX(-30px);
|
transform: translateX(-30px);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
class="upload-file-uploader"
|
class="upload-file-uploader"
|
||||||
ref="upload"
|
ref="fileUpload"
|
||||||
>
|
>
|
||||||
<!-- 上传按钮 -->
|
<!-- 上传按钮 -->
|
||||||
<el-button size="mini" type="primary">选取文件</el-button>
|
<el-button size="mini" type="primary">选取文件</el-button>
|
||||||
|
|
@ -72,7 +72,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
number: 0,
|
number: 0,
|
||||||
uploadList: [],
|
uploadList: [],
|
||||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址
|
uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", // 上传文件服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
},
|
},
|
||||||
|
|
@ -146,18 +146,20 @@ export default {
|
||||||
},
|
},
|
||||||
// 上传失败
|
// 上传失败
|
||||||
handleUploadError(err) {
|
handleUploadError(err) {
|
||||||
this.$modal.msgError("上传图片失败,请重试");
|
this.$modal.msgError("上传文件失败,请重试");
|
||||||
this.$modal.closeLoading()
|
this.$modal.closeLoading()
|
||||||
},
|
},
|
||||||
// 上传成功回调
|
// 上传成功回调
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res, file) {
|
||||||
this.uploadList.push({ name: res.data.url, url: res.data.url });
|
if (res.code === 200) {
|
||||||
if (this.uploadList.length === this.number) {
|
this.uploadList.push({ name: res.data.url, url: res.data.url });
|
||||||
this.fileList = this.fileList.concat(this.uploadList);
|
this.uploadedSuccessfully();
|
||||||
this.uploadList = [];
|
} else {
|
||||||
this.number = 0;
|
this.number--;
|
||||||
this.$emit("input", this.listToString(this.fileList));
|
|
||||||
this.$modal.closeLoading();
|
this.$modal.closeLoading();
|
||||||
|
this.$modal.msgError(res.msg);
|
||||||
|
this.$refs.fileUpload.handleRemove(file);
|
||||||
|
this.uploadedSuccessfully();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 删除文件
|
// 删除文件
|
||||||
|
|
@ -165,6 +167,16 @@ export default {
|
||||||
this.fileList.splice(index, 1);
|
this.fileList.splice(index, 1);
|
||||||
this.$emit("input", this.listToString(this.fileList));
|
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) {
|
getFileName(name) {
|
||||||
if (name.lastIndexOf("/") > -1) {
|
if (name.lastIndexOf("/") > -1) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
src: {
|
src: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
default: ""
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
|
|
@ -30,10 +30,16 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
realSrc() {
|
realSrc() {
|
||||||
|
if (!this.src) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let real_src = this.src.split(",")[0];
|
let real_src = this.src.split(",")[0];
|
||||||
return real_src;
|
return real_src;
|
||||||
},
|
},
|
||||||
realSrcList() {
|
realSrcList() {
|
||||||
|
if (!this.src) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let real_src_list = this.src.split(",");
|
let real_src_list = this.src.split(",");
|
||||||
let srcList = [];
|
let srcList = [];
|
||||||
real_src_list.forEach(item => {
|
real_src_list.forEach(item => {
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
:limit="limit"
|
:limit="limit"
|
||||||
:on-error="handleUploadError"
|
:on-error="handleUploadError"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
name="file"
|
ref="imageUpload"
|
||||||
:on-remove="handleRemove"
|
:on-remove="handleDelete"
|
||||||
:show-file-list="true"
|
:show-file-list="true"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:file-list="fileList"
|
:file-list="fileList"
|
||||||
|
|
@ -112,25 +112,6 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 删除图片
|
|
||||||
handleRemove(file, fileList) {
|
|
||||||
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
|
||||||
if(findex > -1) {
|
|
||||||
this.fileList.splice(findex, 1);
|
|
||||||
this.$emit("input", this.listToString(this.fileList));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 上传成功回调
|
|
||||||
handleUploadSuccess(res) {
|
|
||||||
this.uploadList.push({ name: res.data.url, url: res.data.url });
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 上传前loading加载
|
// 上传前loading加载
|
||||||
handleBeforeUpload(file) {
|
handleBeforeUpload(file) {
|
||||||
let isImg = false;
|
let isImg = false;
|
||||||
|
|
@ -166,11 +147,42 @@ export default {
|
||||||
handleExceed() {
|
handleExceed() {
|
||||||
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
|
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
|
||||||
},
|
},
|
||||||
|
// 上传成功回调
|
||||||
|
handleUploadSuccess(res, file) {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.uploadList.push({ name: res.data.url, url: res.data.url });
|
||||||
|
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) {
|
||||||
|
this.fileList.splice(findex, 1);
|
||||||
|
this.$emit("input", this.listToString(this.fileList));
|
||||||
|
}
|
||||||
|
},
|
||||||
// 上传失败
|
// 上传失败
|
||||||
handleUploadError() {
|
handleUploadError() {
|
||||||
this.$modal.msgError("上传图片失败,请重试");
|
this.$modal.msgError("上传图片失败,请重试");
|
||||||
this.$modal.closeLoading();
|
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) {
|
handlePictureCardPreview(file) {
|
||||||
this.dialogImageUrl = file.url;
|
this.dialogImageUrl = file.url;
|
||||||
|
|
@ -181,7 +193,9 @@ export default {
|
||||||
let strs = "";
|
let strs = "";
|
||||||
separator = separator || ",";
|
separator = separator || ",";
|
||||||
for (let i in list) {
|
for (let i in list) {
|
||||||
strs += list[i].url + separator;
|
if (list[i].url) {
|
||||||
|
strs += list[i].url.replace(this.baseUrl, "") + separator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,19 @@
|
||||||
<section class="app-main">
|
<section class="app-main">
|
||||||
<transition name="fade-transform" mode="out-in">
|
<transition name="fade-transform" mode="out-in">
|
||||||
<keep-alive :include="cachedViews">
|
<keep-alive :include="cachedViews">
|
||||||
<router-view :key="key" />
|
<router-view v-if="!$route.meta.link" :key="key" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
|
<iframe-toggle />
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import iframeToggle from "./IframeToggle/index"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppMain',
|
name: 'AppMain',
|
||||||
|
components: { iframeToggle },
|
||||||
computed: {
|
computed: {
|
||||||
cachedViews() {
|
cachedViews() {
|
||||||
return this.$store.state.tagsView.cachedViews
|
return this.$store.state.tagsView.cachedViews
|
||||||
|
|
@ -31,7 +35,7 @@ export default {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header+.app-main {
|
.fixed-header + .app-main {
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +45,7 @@ export default {
|
||||||
min-height: calc(100vh - 84px);
|
min-height: calc(100vh - 84px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header+.app-main {
|
.fixed-header + .app-main {
|
||||||
padding-top: 84px;
|
padding-top: 84px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
<template>
|
||||||
|
<transition-group name="fade-transform" mode="out-in">
|
||||||
|
<inner-link
|
||||||
|
v-for="(item, index) in iframeViews"
|
||||||
|
:key="item.path"
|
||||||
|
:iframeId="'iframe' + index"
|
||||||
|
v-show="$route.path === item.path"
|
||||||
|
:src="item.meta.link"
|
||||||
|
></inner-link>
|
||||||
|
</transition-group>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import InnerLink from "../InnerLink/index"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { InnerLink },
|
||||||
|
computed: {
|
||||||
|
iframeViews() {
|
||||||
|
return this.$store.state.tagsView.iframeViews
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -1,27 +1,47 @@
|
||||||
|
<template>
|
||||||
|
<div :style="'height:' + height" v-loading="loading" element-loading-text="正在加载页面,请稍候!">
|
||||||
|
<iframe
|
||||||
|
:id="iframeId"
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
:src="src"
|
||||||
|
frameborder="no"
|
||||||
|
></iframe>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
props: {
|
||||||
return {};
|
src: {
|
||||||
},
|
type: String,
|
||||||
render() {
|
default: "/"
|
||||||
const { $route: { meta: { link } }, } = this;
|
},
|
||||||
if ({ link }.link === "") {
|
iframeId: {
|
||||||
return "404";
|
type: String
|
||||||
}
|
}
|
||||||
let url = { link }.link;
|
|
||||||
const height = document.documentElement.clientHeight - 94.5 + "px";
|
|
||||||
const style = { height: height };
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={style}>
|
|
||||||
<iframe
|
|
||||||
src={url}
|
|
||||||
frameborder="no"
|
|
||||||
style="width: 100%; height: 100%"
|
|
||||||
scrolling="auto"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
height: document.documentElement.clientHeight - 94.5 + "px;"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
var _this = this;
|
||||||
|
const iframeId = ("#" + this.iframeId).replace(/\//g, "\\/");
|
||||||
|
const iframe = document.querySelector(iframeId);
|
||||||
|
// iframe页面loading控制
|
||||||
|
if (iframe.attachEvent) {
|
||||||
|
this.loading = true;
|
||||||
|
iframe.attachEvent("onload", function () {
|
||||||
|
_this.loading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.loading = true;
|
||||||
|
iframe.onload = function () {
|
||||||
|
_this.loading = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,9 @@ export default {
|
||||||
const { name } = this.$route
|
const { name } = this.$route
|
||||||
if (name) {
|
if (name) {
|
||||||
this.$store.dispatch('tagsView/addView', this.$route)
|
this.$store.dispatch('tagsView/addView', this.$route)
|
||||||
|
if (this.$route.meta.link) {
|
||||||
|
this.$store.dispatch('tagsView/addIframeView', this.$route)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
|
@ -153,6 +156,9 @@ export default {
|
||||||
},
|
},
|
||||||
refreshSelectedTag(view) {
|
refreshSelectedTag(view) {
|
||||||
this.$tab.refreshPage(view);
|
this.$tab.refreshPage(view);
|
||||||
|
if (this.$route.meta.link) {
|
||||||
|
this.$store.dispatch('tagsView/delIframeView', this.$route)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
closeSelectedTag(view) {
|
closeSelectedTag(view) {
|
||||||
this.$tab.closePage(view).then(({ visitedViews }) => {
|
this.$tab.closePage(view).then(({ visitedViews }) => {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,18 @@
|
||||||
const state = {
|
const state = {
|
||||||
visitedViews: [],
|
visitedViews: [],
|
||||||
cachedViews: []
|
cachedViews: [],
|
||||||
|
iframeViews: []
|
||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
ADD_IFRAME_VIEW: (state, view) => {
|
||||||
|
if (state.iframeViews.some(v => v.path === view.path)) return
|
||||||
|
state.iframeViews.push(
|
||||||
|
Object.assign({}, view, {
|
||||||
|
title: view.meta.title || 'no-name'
|
||||||
|
})
|
||||||
|
)
|
||||||
|
},
|
||||||
ADD_VISITED_VIEW: (state, view) => {
|
ADD_VISITED_VIEW: (state, view) => {
|
||||||
if (state.visitedViews.some(v => v.path === view.path)) return
|
if (state.visitedViews.some(v => v.path === view.path)) return
|
||||||
state.visitedViews.push(
|
state.visitedViews.push(
|
||||||
|
|
@ -18,7 +27,6 @@ const mutations = {
|
||||||
state.cachedViews.push(view.name)
|
state.cachedViews.push(view.name)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DEL_VISITED_VIEW: (state, view) => {
|
DEL_VISITED_VIEW: (state, view) => {
|
||||||
for (const [i, v] of state.visitedViews.entries()) {
|
for (const [i, v] of state.visitedViews.entries()) {
|
||||||
if (v.path === view.path) {
|
if (v.path === view.path) {
|
||||||
|
|
@ -26,6 +34,10 @@ const mutations = {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
state.iframeViews = state.iframeViews.filter(item => item.path !== view.path)
|
||||||
|
},
|
||||||
|
DEL_IFRAME_VIEW: (state, view) => {
|
||||||
|
state.iframeViews = state.iframeViews.filter(item => item.path !== view.path)
|
||||||
},
|
},
|
||||||
DEL_CACHED_VIEW: (state, view) => {
|
DEL_CACHED_VIEW: (state, view) => {
|
||||||
const index = state.cachedViews.indexOf(view.name)
|
const index = state.cachedViews.indexOf(view.name)
|
||||||
|
|
@ -36,6 +48,7 @@ const mutations = {
|
||||||
state.visitedViews = state.visitedViews.filter(v => {
|
state.visitedViews = state.visitedViews.filter(v => {
|
||||||
return v.meta.affix || v.path === view.path
|
return v.meta.affix || v.path === view.path
|
||||||
})
|
})
|
||||||
|
state.iframeViews = state.iframeViews.filter(item => item.path === view.path)
|
||||||
},
|
},
|
||||||
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
|
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
|
||||||
const index = state.cachedViews.indexOf(view.name)
|
const index = state.cachedViews.indexOf(view.name)
|
||||||
|
|
@ -45,16 +58,15 @@ const mutations = {
|
||||||
state.cachedViews = []
|
state.cachedViews = []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DEL_ALL_VISITED_VIEWS: state => {
|
DEL_ALL_VISITED_VIEWS: state => {
|
||||||
// keep affix tags
|
// keep affix tags
|
||||||
const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
|
const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
|
||||||
state.visitedViews = affixTags
|
state.visitedViews = affixTags
|
||||||
|
state.iframeViews = []
|
||||||
},
|
},
|
||||||
DEL_ALL_CACHED_VIEWS: state => {
|
DEL_ALL_CACHED_VIEWS: state => {
|
||||||
state.cachedViews = []
|
state.cachedViews = []
|
||||||
},
|
},
|
||||||
|
|
||||||
UPDATE_VISITED_VIEW: (state, view) => {
|
UPDATE_VISITED_VIEW: (state, view) => {
|
||||||
for (let v of state.visitedViews) {
|
for (let v of state.visitedViews) {
|
||||||
if (v.path === view.path) {
|
if (v.path === view.path) {
|
||||||
|
|
@ -63,7 +75,6 @@ const mutations = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
DEL_RIGHT_VIEWS: (state, view) => {
|
DEL_RIGHT_VIEWS: (state, view) => {
|
||||||
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
|
|
@ -77,10 +88,13 @@ const mutations = {
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
state.cachedViews.splice(i, 1)
|
state.cachedViews.splice(i, 1)
|
||||||
}
|
}
|
||||||
|
if(item.meta.link) {
|
||||||
|
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
||||||
|
state.iframeViews.splice(fi, 1)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
DEL_LEFT_VIEWS: (state, view) => {
|
DEL_LEFT_VIEWS: (state, view) => {
|
||||||
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
const index = state.visitedViews.findIndex(v => v.path === view.path)
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
|
|
@ -94,6 +108,10 @@ const mutations = {
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
state.cachedViews.splice(i, 1)
|
state.cachedViews.splice(i, 1)
|
||||||
}
|
}
|
||||||
|
if(item.meta.link) {
|
||||||
|
const fi = state.iframeViews.findIndex(v => v.path === item.path)
|
||||||
|
state.iframeViews.splice(fi, 1)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -104,13 +122,15 @@ const actions = {
|
||||||
dispatch('addVisitedView', view)
|
dispatch('addVisitedView', view)
|
||||||
dispatch('addCachedView', view)
|
dispatch('addCachedView', view)
|
||||||
},
|
},
|
||||||
|
addIframeView({ commit }, view) {
|
||||||
|
commit('ADD_IFRAME_VIEW', view)
|
||||||
|
},
|
||||||
addVisitedView({ commit }, view) {
|
addVisitedView({ commit }, view) {
|
||||||
commit('ADD_VISITED_VIEW', view)
|
commit('ADD_VISITED_VIEW', view)
|
||||||
},
|
},
|
||||||
addCachedView({ commit }, view) {
|
addCachedView({ commit }, view) {
|
||||||
commit('ADD_CACHED_VIEW', view)
|
commit('ADD_CACHED_VIEW', view)
|
||||||
},
|
},
|
||||||
|
|
||||||
delView({ dispatch, state }, view) {
|
delView({ dispatch, state }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
dispatch('delVisitedView', view)
|
dispatch('delVisitedView', view)
|
||||||
|
|
@ -127,13 +147,18 @@ const actions = {
|
||||||
resolve([...state.visitedViews])
|
resolve([...state.visitedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
delIframeView({ commit, state }, view) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
commit('DEL_IFRAME_VIEW', view)
|
||||||
|
resolve([...state.iframeViews])
|
||||||
|
})
|
||||||
|
},
|
||||||
delCachedView({ commit, state }, view) {
|
delCachedView({ commit, state }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('DEL_CACHED_VIEW', view)
|
commit('DEL_CACHED_VIEW', view)
|
||||||
resolve([...state.cachedViews])
|
resolve([...state.cachedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
delOthersViews({ dispatch, state }, view) {
|
delOthersViews({ dispatch, state }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
dispatch('delOthersVisitedViews', view)
|
dispatch('delOthersVisitedViews', view)
|
||||||
|
|
@ -156,7 +181,6 @@ const actions = {
|
||||||
resolve([...state.cachedViews])
|
resolve([...state.cachedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
delAllViews({ dispatch, state }, view) {
|
delAllViews({ dispatch, state }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
dispatch('delAllVisitedViews', view)
|
dispatch('delAllVisitedViews', view)
|
||||||
|
|
@ -179,18 +203,15 @@ const actions = {
|
||||||
resolve([...state.cachedViews])
|
resolve([...state.cachedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
updateVisitedView({ commit }, view) {
|
updateVisitedView({ commit }, view) {
|
||||||
commit('UPDATE_VISITED_VIEW', view)
|
commit('UPDATE_VISITED_VIEW', view)
|
||||||
},
|
},
|
||||||
|
|
||||||
delRightTags({ commit }, view) {
|
delRightTags({ commit }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('DEL_RIGHT_VIEWS', view)
|
commit('DEL_RIGHT_VIEWS', view)
|
||||||
resolve([...state.visitedViews])
|
resolve([...state.visitedViews])
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
delLeftTags({ commit }, view) {
|
delLeftTags({ commit }, view) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
commit('DEL_LEFT_VIEWS', view)
|
commit('DEL_LEFT_VIEWS', view)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,17 @@
|
||||||
v-hasPermi="['system:logininfor:remove']"
|
v-hasPermi="['system:logininfor:remove']"
|
||||||
>清空</el-button>
|
>清空</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-unlock"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUnlock"
|
||||||
|
v-hasPermi="['system:logininfor:unlock']"
|
||||||
|
>解锁</el-button>
|
||||||
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
|
@ -115,7 +126,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list, delLogininfor, cleanLogininfor } from "@/api/system/logininfor";
|
import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/system/logininfor";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Logininfor",
|
name: "Logininfor",
|
||||||
|
|
@ -126,8 +137,12 @@ export default {
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
// 选择用户名
|
||||||
|
selectName: "",
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
|
|
@ -177,7 +192,9 @@ export default {
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.infoId)
|
this.ids = selection.map(item => item.infoId)
|
||||||
|
this.single = selection.length!=1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
|
this.selectName = selection.map(item => item.userName);
|
||||||
},
|
},
|
||||||
/** 排序触发事件 */
|
/** 排序触发事件 */
|
||||||
handleSortChange(column, prop, order) {
|
handleSortChange(column, prop, order) {
|
||||||
|
|
@ -204,6 +221,15 @@ export default {
|
||||||
this.$modal.msgSuccess("清空成功");
|
this.$modal.msgSuccess("清空成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
|
/** 解锁按钮操作 */
|
||||||
|
handleUnlock() {
|
||||||
|
const username = this.selectName;
|
||||||
|
this.$modal.confirm('是否确认解锁用户"' + username + '"数据项?').then(function() {
|
||||||
|
return unlockLogininfor(username);
|
||||||
|
}).then(() => {
|
||||||
|
this.$modal.msgSuccess("用户" + username + "解锁成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('system/logininfor/export', {
|
this.download('system/logininfor/export', {
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="上级菜单">
|
<el-form-item label="上级菜单" prop="parentId">
|
||||||
<treeselect
|
<treeselect
|
||||||
v-model="form.parentId"
|
v-model="form.parentId"
|
||||||
:options="menuOptions"
|
:options="menuOptions"
|
||||||
|
|
@ -159,7 +159,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item prop="isFrame">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
|
|
@ -195,7 +195,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'M'">
|
<el-col :span="12" v-if="form.menuType != 'M'">
|
||||||
<el-form-item>
|
<el-form-item prop="perms">
|
||||||
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
||||||
|
|
@ -206,7 +206,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item>
|
<el-form-item prop="query">
|
||||||
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
|
<el-input v-model="form.query" placeholder="请输入路由参数" maxlength="255" />
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
|
<el-tooltip content='访问路由的默认传递参数,如:`{"id": 1, "name": "ry"}`' placement="top">
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType == 'C'">
|
<el-col :span="12" v-if="form.menuType == 'C'">
|
||||||
<el-form-item>
|
<el-form-item prop="isCache">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
|
|
@ -231,7 +231,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item prop="visible">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
|
|
@ -248,7 +248,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" v-if="form.menuType != 'F'">
|
<el-col :span="12" v-if="form.menuType != 'F'">
|
||||||
<el-form-item>
|
<el-form-item prop="status">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
||||||
<i class="el-icon-question"></i>
|
<i class="el-icon-question"></i>
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
|
||||||
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Role",
|
name: "Role",
|
||||||
|
|
@ -364,12 +363,6 @@ export default {
|
||||||
this.menuOptions = response.data;
|
this.menuOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询部门树结构 */
|
|
||||||
getDeptTreeselect() {
|
|
||||||
deptTreeselect().then(response => {
|
|
||||||
this.deptOptions = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 所有菜单节点数据
|
// 所有菜单节点数据
|
||||||
getMenuAllCheckedKeys() {
|
getMenuAllCheckedKeys() {
|
||||||
// 目前被选中的菜单节点
|
// 目前被选中的菜单节点
|
||||||
|
|
@ -396,8 +389,8 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 根据角色ID查询部门树结构 */
|
/** 根据角色ID查询部门树结构 */
|
||||||
getRoleDeptTreeselect(roleId) {
|
getDeptTree(roleId) {
|
||||||
return roleDeptTreeselect(roleId).then(response => {
|
return deptTreeSelect(roleId).then(response => {
|
||||||
this.deptOptions = response.depts;
|
this.deptOptions = response.depts;
|
||||||
return response;
|
return response;
|
||||||
});
|
});
|
||||||
|
|
@ -543,12 +536,12 @@ export default {
|
||||||
/** 分配数据权限操作 */
|
/** 分配数据权限操作 */
|
||||||
handleDataScope(row) {
|
handleDataScope(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
|
const deptTreeSelect = this.getDeptTree(row.roleId);
|
||||||
getRole(row.roleId).then(response => {
|
getRole(row.roleId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.openDataScope = true;
|
this.openDataScope = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
roleDeptTreeselect.then(res => {
|
deptTreeSelect.then(res => {
|
||||||
this.$refs.dept.setCheckedKeys(res.checkedKeys);
|
this.$refs.dept.setCheckedKeys(res.checkedKeys);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -342,9 +342,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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 { getToken } from "@/utils/auth";
|
||||||
import { treeselect } from "@/api/system/dept";
|
|
||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
|
@ -462,7 +461,7 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getTreeselect();
|
this.getDeptTree();
|
||||||
this.getConfigKey("sys.user.initPassword").then(response => {
|
this.getConfigKey("sys.user.initPassword").then(response => {
|
||||||
this.initPassword = response.msg;
|
this.initPassword = response.msg;
|
||||||
});
|
});
|
||||||
|
|
@ -479,8 +478,8 @@ export default {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
getTreeselect() {
|
getDeptTree() {
|
||||||
treeselect().then(response => {
|
deptTreeSelect().then(response => {
|
||||||
this.deptOptions = response.data;
|
this.deptOptions = response.data;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -561,7 +560,6 @@ export default {
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
|
||||||
getUser().then(response => {
|
getUser().then(response => {
|
||||||
this.postOptions = response.posts;
|
this.postOptions = response.posts;
|
||||||
this.roleOptions = response.roles;
|
this.roleOptions = response.roles;
|
||||||
|
|
@ -573,7 +571,6 @@ export default {
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.getTreeselect();
|
|
||||||
const userId = row.userId || this.ids;
|
const userId = row.userId || this.ids;
|
||||||
getUser(userId).then(response => {
|
getUser(userId).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
<userInfo :user="user" />
|
<userInfo :user="user" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="修改密码" name="resetPwd">
|
<el-tab-pane label="修改密码" name="resetPwd">
|
||||||
<resetPwd :user="user" />
|
<resetPwd />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
|
||||||
|
|
@ -234,29 +234,30 @@ insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', 1,
|
||||||
-- 操作日志按钮
|
-- 操作日志按钮
|
||||||
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:query', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:query', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:remove', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:remove', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1041', '日志导出', '500', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:export', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:operlog:export', '#', 'admin', sysdate(), '', null, '');
|
||||||
-- 登录日志按钮
|
-- 登录日志按钮
|
||||||
insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:query', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:query', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:remove', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:export', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:export', '#', 'admin', sysdate(), '', null, '');
|
||||||
|
insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:logininfor:unlock', '#', 'admin', sysdate(), '', null, '');
|
||||||
-- 在线用户按钮
|
-- 在线用户按钮
|
||||||
insert into sys_menu values('1045', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1046', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1047', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, '');
|
||||||
-- 定时任务按钮
|
-- 定时任务按钮
|
||||||
insert into sys_menu values('1048', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1049', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1050', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1051', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1052', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1053', '任务导出', '110', '7', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, '');
|
||||||
-- 代码生成按钮
|
-- 代码生成按钮
|
||||||
insert into sys_menu values('1054', '生成查询', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1055', '生成查询', '115', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1055', '生成修改', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1056', '生成修改', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1056', '生成删除', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1057', '生成删除', '115', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1057', '导入代码', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1058', '导入代码', '115', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1058', '预览代码', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1059', '预览代码', '115', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, '');
|
||||||
insert into sys_menu values('1059', '生成代码', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
insert into sys_menu values('1060', '生成代码', '115', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, '');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
@ -372,6 +373,7 @@ insert into sys_role_menu values ('2', '1056');
|
||||||
insert into sys_role_menu values ('2', '1057');
|
insert into sys_role_menu values ('2', '1057');
|
||||||
insert into sys_role_menu values ('2', '1058');
|
insert into sys_role_menu values ('2', '1058');
|
||||||
insert into sys_role_menu values ('2', '1059');
|
insert into sys_role_menu values ('2', '1059');
|
||||||
|
insert into sys_role_menu values ('2', '1060');
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 8、角色和部门关联表 角色1-N部门
|
-- 8、角色和部门关联表 角色1-N部门
|
||||||
|
|
@ -464,6 +466,7 @@ insert into sys_dict_type values(8, '通知状态', 'sys_notice_status', '0',
|
||||||
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表');
|
insert into sys_dict_type values(9, '操作类型', 'sys_oper_type', '0', 'admin', sysdate(), '', null, '操作类型列表');
|
||||||
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表');
|
insert into sys_dict_type values(10, '系统状态', 'sys_common_status', '0', 'admin', sysdate(), '', null, '登录状态列表');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 12、字典数据表
|
-- 12、字典数据表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
|
@ -504,17 +507,18 @@ 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(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(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(17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', '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(18, 99, '其他', '0', '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(19, 1, '新增', '1', '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, '删除操作');
|
insert into sys_dict_data values(20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '修改操作');
|
||||||
insert into sys_dict_data values(21, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作');
|
insert into sys_dict_data values(21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '删除操作');
|
||||||
insert into sys_dict_data values(22, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作');
|
insert into sys_dict_data values(22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '授权操作');
|
||||||
insert into sys_dict_data values(23, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作');
|
insert into sys_dict_data values(23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导出操作');
|
||||||
insert into sys_dict_data values(24, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作');
|
insert into sys_dict_data values(24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '导入操作');
|
||||||
insert into sys_dict_data values(25, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作');
|
insert into sys_dict_data values(25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '强退操作');
|
||||||
insert into sys_dict_data values(26, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作');
|
insert into sys_dict_data values(26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', sysdate(), '', null, '生成操作');
|
||||||
insert into sys_dict_data values(27, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态');
|
insert into sys_dict_data values(27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '清空操作');
|
||||||
insert into sys_dict_data values(28, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
insert into sys_dict_data values(28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '正常状态');
|
||||||
|
insert into sys_dict_data values(29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '停用状态');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
Loading…
Reference in New Issue