mirror of
https://gitee.com/y_project/RuoYi-Vue.git
synced 2025-12-08 15:02:29 +08:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6353f4ff09 | |||
| bb1af390a7 | |||
| f65cd6245d | |||
| 530b2a51d5 | |||
| d51e7cbb51 | |||
| f244fe1855 | |||
| 1294f68265 | |||
| 0e771a6c1b | |||
| e4df0c6da1 | |||
| 7b23b6db6f | |||
| be412faf6c | |||
| fd3a699ad8 | |||
| c28aa299bd | |||
| a028b566ed | |||
| ca2405c104 | |||
| e5647793ce | |||
| 903b5aebca | |||
| 7492dcc9e6 | |||
| 8978012f9d | |||
| 7cf4a5da87 | |||
| 47b67331d4 | |||
| 6e14601c7c | |||
| fef7ead0d5 | |||
| 06aef0587a | |||
| bf7c259cdd | |||
| 43d76e5990 | |||
| d365a52cd6 | |||
| e1c7115d8c | |||
| bb4d75aff0 | |||
| 2743785aaf | |||
| 2a235917dc | |||
| 44ce6774dc | |||
| b911d7f78f | |||
| 4644176e26 | |||
| 850b98337b | |||
| 7f2921f26b | |||
| 836017f2b9 | |||
| 4de4763baf | |||
| 965ebd0f03 | |||
| 2c3f1c28e5 |
26
pom.xml
26
pom.xml
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
|
|
||||||
<name>ruoyi</name>
|
<name>ruoyi</name>
|
||||||
<url>http://www.ruoyi.vip</url>
|
<url>http://www.ruoyi.vip</url>
|
||||||
<description>若依管理系统</description>
|
<description>若依管理系统</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<ruoyi.version>3.8.0</ruoyi.version>
|
<ruoyi.version>3.8.1</ruoyi.version>
|
||||||
<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>
|
||||||
@ -24,14 +24,15 @@
|
|||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
<mybatis-spring-boot.version>2.2.0</mybatis-spring-boot.version>
|
<mybatis-spring-boot.version>2.2.0</mybatis-spring-boot.version>
|
||||||
<pagehelper.boot.version>1.4.0</pagehelper.boot.version>
|
<pagehelper.boot.version>1.4.0</pagehelper.boot.version>
|
||||||
<fastjson.version>1.2.78</fastjson.version>
|
<fastjson.version>1.2.79</fastjson.version>
|
||||||
<oshi.version>5.8.2</oshi.version>
|
<oshi.version>5.8.6</oshi.version>
|
||||||
<jna.version>5.9.0</jna.version>
|
<jna.version>5.10.0</jna.version>
|
||||||
<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>
|
||||||
<commons.collections.version>3.2.2</commons.collections.version>
|
<commons.collections.version>3.2.2</commons.collections.version>
|
||||||
<poi.version>4.1.2</poi.version>
|
<poi.version>4.1.2</poi.version>
|
||||||
<velocity.version>2.3</velocity.version>
|
<velocity.version>2.3</velocity.version>
|
||||||
|
<log4j2.version>2.17.1</log4j2.version>
|
||||||
<jwt.version>0.9.1</jwt.version>
|
<jwt.version>0.9.1</jwt.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -43,7 +44,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>2.5.6</version>
|
<version>2.5.8</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -150,6 +151,19 @@
|
|||||||
<version>${fastjson.version}</version>
|
<version>${fastjson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- log4j日志组件 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-api</artifactId>
|
||||||
|
<version>${log4j2.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
<artifactId>log4j-to-slf4j</artifactId>
|
||||||
|
<version>${log4j2.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Token生成与解析-->
|
<!-- Token生成与解析-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ ruoyi:
|
|||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.8.0
|
version: 3.8.1
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2021
|
copyrightYear: 2021
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
@ -25,10 +25,13 @@ server:
|
|||||||
tomcat:
|
tomcat:
|
||||||
# tomcat的URI编码
|
# tomcat的URI编码
|
||||||
uri-encoding: UTF-8
|
uri-encoding: UTF-8
|
||||||
# tomcat最大线程数,默认为200
|
# 连接数满后的排队数,默认为100
|
||||||
max-threads: 800
|
accept-count: 1000
|
||||||
# Tomcat启动初始化的线程数,默认值25
|
threads:
|
||||||
min-spare-threads: 30
|
# tomcat最大线程数,默认为200
|
||||||
|
max: 800
|
||||||
|
# Tomcat启动初始化的线程数,默认值10
|
||||||
|
min-spare: 100
|
||||||
|
|
||||||
# 日志配置
|
# 日志配置
|
||||||
logging:
|
logging:
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.ruoyi.common.core.page.PageDomain;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.page.TableSupport;
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.sql.SqlUtil;
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
@ -51,15 +52,7 @@ public class BaseController
|
|||||||
*/
|
*/
|
||||||
protected void startPage()
|
protected void startPage()
|
||||||
{
|
{
|
||||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
PageUtils.startPage();
|
||||||
Integer pageNum = pageDomain.getPageNum();
|
|
||||||
Integer pageSize = pageDomain.getPageSize();
|
|
||||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
|
||||||
{
|
|
||||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
|
||||||
Boolean reasonable = pageDomain.getReasonable();
|
|
||||||
PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,9 +2,7 @@ package com.ruoyi.common.core.domain.entity;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.*;
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.Size;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
@ -14,6 +12,7 @@ import com.ruoyi.common.annotation.Excel.ColumnType;
|
|||||||
import com.ruoyi.common.annotation.Excel.Type;
|
import com.ruoyi.common.annotation.Excel.Type;
|
||||||
import com.ruoyi.common.annotation.Excels;
|
import com.ruoyi.common.annotation.Excels;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.xss.Xss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户对象 sys_user
|
* 用户对象 sys_user
|
||||||
@ -135,6 +134,7 @@ public class SysUser extends BaseEntity
|
|||||||
this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Xss(message = "用户昵称不能包含脚本字符")
|
||||||
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
|
||||||
public String getNickName()
|
public String getNickName()
|
||||||
{
|
{
|
||||||
@ -146,6 +146,7 @@ public class SysUser extends BaseEntity
|
|||||||
this.nickName = nickName;
|
this.nickName = nickName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Xss(message = "用户账号不能包含脚本字符")
|
||||||
@NotBlank(message = "用户账号不能为空")
|
@NotBlank(message = "用户账号不能为空")
|
||||||
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
|
||||||
public String getUserName()
|
public String getUserName()
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.common.utils;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.common.core.page.PageDomain;
|
||||||
|
import com.ruoyi.common.core.page.TableSupport;
|
||||||
|
import com.ruoyi.common.utils.sql.SqlUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class PageUtils extends PageHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 设置请求分页数据
|
||||||
|
*/
|
||||||
|
public static void startPage()
|
||||||
|
{
|
||||||
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||||
|
Integer pageNum = pageDomain.getPageNum();
|
||||||
|
Integer pageSize = pageDomain.getPageSize();
|
||||||
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
|
||||||
|
{
|
||||||
|
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||||
|
PageHelper.startPage(pageNum, pageSize, orderBy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.common.utils.bean;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.validation.ConstraintViolation;
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
import javax.validation.Validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bean对象属性验证
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class BeanValidators
|
||||||
|
{
|
||||||
|
public static void validateWithException(Validator validator, Object object, Class<?>... groups)
|
||||||
|
throws ConstraintViolationException
|
||||||
|
{
|
||||||
|
Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups);
|
||||||
|
if (!constraintViolations.isEmpty())
|
||||||
|
{
|
||||||
|
throw new ConstraintViolationException(constraintViolations);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,11 @@ import com.ruoyi.common.utils.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class SqlUtil
|
public class SqlUtil
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 定义常用的 sql关键字
|
||||||
|
*/
|
||||||
|
public static String SQL_REGEX = "select |insert |delete |update |drop |count |exec |chr |mid |master |truncate |char |and |declare ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
|
* 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
|
||||||
*/
|
*/
|
||||||
@ -34,4 +39,23 @@ public class SqlUtil
|
|||||||
{
|
{
|
||||||
return value.matches(SQL_PATTERN);
|
return value.matches(SQL_PATTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQL关键字检查
|
||||||
|
*/
|
||||||
|
public static void filterKeyword(String value)
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(value))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|");
|
||||||
|
for (int i = 0; i < sqlKeywords.length; i++)
|
||||||
|
{
|
||||||
|
if (StringUtils.indexOfIgnoreCase(value, sqlKeywords[i]) > -1)
|
||||||
|
{
|
||||||
|
throw new UtilException("参数存在SQL注入风险");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
27
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
Normal file
27
ruoyi-common/src/main/java/com/ruoyi/common/xss/Xss.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package com.ruoyi.common.xss;
|
||||||
|
|
||||||
|
import javax.validation.Constraint;
|
||||||
|
import javax.validation.Payload;
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义xss校验注解
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER })
|
||||||
|
@Constraint(validatedBy = { XssValidator.class })
|
||||||
|
public @interface Xss
|
||||||
|
{
|
||||||
|
String message()
|
||||||
|
|
||||||
|
default "不允许任何脚本运行";
|
||||||
|
|
||||||
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.ruoyi.common.xss;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintValidator;
|
||||||
|
import javax.validation.ConstraintValidatorContext;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义xss校验注解实现
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class XssValidator implements ConstraintValidator<Xss, String>
|
||||||
|
{
|
||||||
|
private final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext)
|
||||||
|
{
|
||||||
|
return !containsHtml(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsHtml(String value)
|
||||||
|
{
|
||||||
|
Pattern pattern = Pattern.compile(HTML_PATTERN);
|
||||||
|
Matcher matcher = pattern.matcher(value);
|
||||||
|
return matcher.matches();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -60,14 +60,10 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
|
|||||||
String url = request.getRequestURI();
|
String url = request.getRequestURI();
|
||||||
|
|
||||||
// 唯一值(没有消息头则使用请求地址)
|
// 唯一值(没有消息头则使用请求地址)
|
||||||
String submitKey = request.getHeader(header);
|
String submitKey = StringUtils.trimToEmpty(request.getHeader(header));
|
||||||
if (StringUtils.isEmpty(submitKey))
|
|
||||||
{
|
|
||||||
submitKey = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 唯一标识(指定key + 消息头)
|
// 唯一标识(指定key + url + 消息头)
|
||||||
String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey;
|
String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey;
|
||||||
|
|
||||||
Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
|
Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
|
||||||
if (sessionObj != null)
|
if (sessionObj != null)
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.ruoyi.generator.util;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ruoyi.common.constant.GenConstants;
|
import com.ruoyi.common.constant.GenConstants;
|
||||||
@ -270,7 +271,7 @@ public class VelocityUtils
|
|||||||
public static String getDicts(GenTable genTable)
|
public static String getDicts(GenTable genTable)
|
||||||
{
|
{
|
||||||
List<GenTableColumn> columns = genTable.getColumns();
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
List<String> dicts = new ArrayList<String>();
|
Set<String> dicts = new HashSet<String>();
|
||||||
for (GenTableColumn column : columns)
|
for (GenTableColumn column : columns)
|
||||||
{
|
{
|
||||||
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
|
if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny(
|
||||||
|
|||||||
465
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
Normal file
465
ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm
Normal file
@ -0,0 +1,465 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.${column.javaField}"
|
||||||
|
placeholder="请输入${comment}"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
|
<el-option label="请选择字典生成" value="" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-date-picker clearable size="small"
|
||||||
|
v-model="queryParams.${column.javaField}"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择${comment}">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterange${AttrName}"
|
||||||
|
size="small"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="${businessName}List"
|
||||||
|
row-key="${treeCode}"
|
||||||
|
default-expand-all
|
||||||
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||||
|
>
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.pk)
|
||||||
|
#elseif($column.list && $column.htmlType == "datetime")
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#elseif($column.list && "" != $column.dictType)
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
|
<template #default="scope">
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
||||||
|
#else
|
||||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
#end
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#elseif($column.list && "" != $javaField)
|
||||||
|
#if(${foreach.index} == 1)
|
||||||
|
<el-table-column label="${comment}" prop="${javaField}" />
|
||||||
|
#else
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="Plus"
|
||||||
|
@click="handleAdd(scope.row)"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#if($column.insert && !$column.pk)
|
||||||
|
#if(($column.usableColumn) || (!$column.superColumn))
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
|
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||||
|
<tree-select
|
||||||
|
v-model:value="form.${treeParentCode}"
|
||||||
|
:options="${businessName}Options"
|
||||||
|
:objMap="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||||
|
placeholder="请选择${comment}"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "input")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<imageUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<fileUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "editor")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
|
<el-option label="请选择字典生成" value="" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-checkbox-group v-model="form.${field}">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value">
|
||||||
|
{{dict.label}}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-checkbox-group v-model="form.${field}">
|
||||||
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-radio-group v-model="form.${field}">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-radio-group v-model="form.${field}">
|
||||||
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-date-picker clearable size="small"
|
||||||
|
v-model="form.${field}"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择${comment}">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="${BusinessName}">
|
||||||
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
#if(${dicts} != '')
|
||||||
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
|
const { ${dictsNoSymbol} } = proxy.useDict(${dicts});
|
||||||
|
#end
|
||||||
|
|
||||||
|
const ${businessName}List = ref([]);
|
||||||
|
const ${businessName}Options = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const title = ref("");
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
const daterange${AttrName} = ref([]);
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.required)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
$column.javaField: [
|
||||||
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
||||||
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询${functionName}列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
queryParams.value.params = {};
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
if (null != daterange${AttrName} && '' != daterange${AttrName}) {
|
||||||
|
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0];
|
||||||
|
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1];
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
list${BusinessName}(queryParams.value).then(response => {
|
||||||
|
${businessName}List.value = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}");
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 查询${functionName}下拉树结构 */
|
||||||
|
async function getTreeselect() {
|
||||||
|
await list${BusinessName}().then(response => {
|
||||||
|
${businessName}Options.value = [];
|
||||||
|
const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] };
|
||||||
|
data.children = proxy.handleTree(response.data, "${treeCode}", "${treeParentCode}");
|
||||||
|
${businessName}Options.value.push(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "radio")
|
||||||
|
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "checkbox")
|
||||||
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
#else
|
||||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
};
|
||||||
|
proxy.resetForm("${businessName}Ref");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
daterange${AttrName}.value = [];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
async function handleAdd(row) {
|
||||||
|
reset();
|
||||||
|
await getTreeselect();
|
||||||
|
if (row != null && row.${treeCode}) {
|
||||||
|
form.value.${treeParentCode} = row.${treeCode};
|
||||||
|
} else {
|
||||||
|
form.value.${treeParentCode} = 0;
|
||||||
|
}
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加${functionName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
async function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
await getTreeselect();
|
||||||
|
if (row != null) {
|
||||||
|
form.value.${treeParentCode} = row.${treeCode};
|
||||||
|
}
|
||||||
|
get${BusinessName}(row.${pkColumn.javaField}).then(response => {
|
||||||
|
form.value = response.data;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
form.value.$column.javaField = form.value.${column.javaField}.split(",");
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改${functionName}";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
form.value.$column.javaField = form.value.${column.javaField}.join(",");
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
if (form.value.${pkColumn.javaField} != null) {
|
||||||
|
update${BusinessName}(form.value).then(response => {
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
add${BusinessName}(form.value).then(response => {
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?').then(function() {
|
||||||
|
return del${BusinessName}(row.${pkColumn.javaField});
|
||||||
|
}).then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
567
ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
Normal file
567
ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm
Normal file
@ -0,0 +1,567 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.${column.javaField}"
|
||||||
|
placeholder="请输入${comment}"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
|
||||||
|
<el-option label="请选择字典生成" value="" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
|
<el-date-picker clearable size="small"
|
||||||
|
v-model="queryParams.${column.javaField}"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择${comment}">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterange${AttrName}"
|
||||||
|
size="small"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="Plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="Edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="Delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="Download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.pk)
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||||
|
#elseif($column.list && $column.htmlType == "datetime")
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#elseif($column.list && "" != $column.dictType)
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}">
|
||||||
|
<template #default="scope">
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/>
|
||||||
|
#else
|
||||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/>
|
||||||
|
#end
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#elseif($column.list && "" != $javaField)
|
||||||
|
<el-table-column label="${comment}" align="center" prop="${javaField}" />
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="Edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="Delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['${moduleName}:${businessName}:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
v-model:p:page="queryParams.pageNum"
|
||||||
|
v-model:p:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#if($column.insert && !$column.pk)
|
||||||
|
#if(($column.usableColumn) || (!$column.superColumn))
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#if($column.htmlType == "input")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<imageUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "fileUpload")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<fileUpload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "editor")
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):value="parseInt(dict.value)"#else:value="dict.value"#end
|
||||||
|
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
|
<el-option label="请选择字典生成" value="" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-checkbox-group v-model="form.${field}">
|
||||||
|
<el-checkbox
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value">
|
||||||
|
{{dict.label}}
|
||||||
|
</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-checkbox-group v-model="form.${field}">
|
||||||
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-radio-group v-model="form.${field}">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long"):label="parseInt(dict.value)"#else:label="dict.value"#end
|
||||||
|
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
<el-form-item label="${comment}">
|
||||||
|
<el-radio-group v-model="form.${field}">
|
||||||
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-date-picker clearable size="small"
|
||||||
|
v-model="form.${field}"
|
||||||
|
type="date"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
placeholder="选择${comment}">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
#elseif($column.htmlType == "textarea")
|
||||||
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" icon="Plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" icon="Delete" size="mini" @click="handleDelete${subClassName}">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.pk || $javaField == ${subTableFkclassName})
|
||||||
|
#elseif($column.list && "" != $javaField)
|
||||||
|
<el-table-column label="$comment" prop="${javaField}">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</el-table>
|
||||||
|
#end
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="${BusinessName}">
|
||||||
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
#if(${dicts} != '')
|
||||||
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
|
const { ${dictsNoSymbol} } = proxy.useDict(${dicts});
|
||||||
|
#end
|
||||||
|
|
||||||
|
const ${businessName}List = ref([]);
|
||||||
|
#if($table.sub)
|
||||||
|
const ${subclassName}List = ref([]);
|
||||||
|
#end
|
||||||
|
const open = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref([]);
|
||||||
|
#if($table.sub)
|
||||||
|
const checked${subClassName} = ref([]);
|
||||||
|
#end
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const title = ref("");
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
const daterange${AttrName} = ref([]);
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.query)
|
||||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.required)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
$column.javaField: [
|
||||||
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select")"change"#else"blur"#end }
|
||||||
|
]#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询${functionName}列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
queryParams.value.params = {};
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
if (null != daterange${AttrName} && '' != daterange${AttrName}) {
|
||||||
|
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0];
|
||||||
|
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1];
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
list${BusinessName}(queryParams.value).then(response => {
|
||||||
|
${businessName}List.value = response.rows;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "radio")
|
||||||
|
$column.javaField: #if($column.javaType == "Integer" || $column.javaType == "Long")0#else"0"#end#if($foreach.count != $columns.size()),#end
|
||||||
|
#elseif($column.htmlType == "checkbox")
|
||||||
|
$column.javaField: []#if($foreach.count != $columns.size()),#end
|
||||||
|
#else
|
||||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
};
|
||||||
|
#if($table.sub)
|
||||||
|
${subclassName}List.value = [];
|
||||||
|
#end
|
||||||
|
proxy.resetForm("${businessName}Ref");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
daterange${AttrName}.value = [];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.${pkColumn.javaField});
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加${functionName}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
reset();
|
||||||
|
const ${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value
|
||||||
|
get${BusinessName}(${pkColumn.javaField}).then(response => {
|
||||||
|
form.value = response.data;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
form.value.$column.javaField = form.value.${column.javaField}.split(",");
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
${subclassName}List.value = response.data.${subclassName}List;
|
||||||
|
#end
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改${functionName}";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
form.value.$column.javaField = form.value.${column.javaField}.join(",");
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
form.value.${subclassName}List = ${subclassName}List.value;
|
||||||
|
#end
|
||||||
|
if (form.value.${pkColumn.javaField} != null) {
|
||||||
|
update${BusinessName}(form.value).then(response => {
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
add${BusinessName}(form.value).then(response => {
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const ${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value;
|
||||||
|
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?').then(function() {
|
||||||
|
return del${BusinessName}(${pkColumn.javaField}s);
|
||||||
|
}).then(() => {
|
||||||
|
getList();
|
||||||
|
proxy.#[[$modal]]#.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
#if($table.sub)
|
||||||
|
/** ${subTable.functionName}序号 */
|
||||||
|
function row${subClassName}Index({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ${subTable.functionName}添加按钮操作 */
|
||||||
|
function handleAdd${subClassName}() {
|
||||||
|
let obj = {};
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
||||||
|
#elseif($column.list && "" != $javaField)
|
||||||
|
obj.$column.javaField = "";
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
${subclassName}List.value.push(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ${subTable.functionName}删除按钮操作 */
|
||||||
|
function handleDelete${subClassName}() {
|
||||||
|
if (checked${subClassName}.value.length == 0) {
|
||||||
|
proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据");
|
||||||
|
} else {
|
||||||
|
const ${subclassName}s = ${subclassName}List.value;
|
||||||
|
const checked${subClassName}s = checked${subClassName}.value;
|
||||||
|
${subclassName}List.value = ${subclassName}s.filter(function(item) {
|
||||||
|
return checked${subClassName}s.indexOf(item.index) == -1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 复选框选中数据 */
|
||||||
|
function handle${subClassName}SelectionChange(selection) {
|
||||||
|
checked${subClassName}.value = selection.map(item => item.index)
|
||||||
|
}
|
||||||
|
|
||||||
|
#end
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('${moduleName}/${businessName}/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
1
ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt
Normal file
1
ruoyi-generator/src/main/resources/vm/vue/v3/readme.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>RuoYi-Vue3ǰ<33>ˣ<EFBFBD><CBA3><EFBFBD>ô<EFBFBD><C3B4>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>һ<EFBFBD>´<EFBFBD>Ŀ¼<C4BF><C2BC>ģ<EFBFBD><C4A3>index.vue.vm<76><6D>index-tree.vue.vm<76>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ϼ<EFBFBD>vueĿ¼<C4BF><C2BC>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ public class ScheduleConfig
|
|||||||
prop.put("org.quartz.threadPool.threadCount", "20");
|
prop.put("org.quartz.threadPool.threadCount", "20");
|
||||||
prop.put("org.quartz.threadPool.threadPriority", "5");
|
prop.put("org.quartz.threadPool.threadPriority", "5");
|
||||||
// JobStore配置
|
// JobStore配置
|
||||||
prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
|
prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
|
||||||
// 集群配置
|
// 集群配置
|
||||||
prop.put("org.quartz.jobStore.isClustered", "true");
|
prop.put("org.quartz.jobStore.isClustered", "true");
|
||||||
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public class JobInvokeUtil
|
|||||||
/**
|
/**
|
||||||
* 校验是否为为class包名
|
* 校验是否为为class包名
|
||||||
*
|
*
|
||||||
* @param str 名称
|
* @param invokeTarget 名称
|
||||||
* @return true是 false否
|
* @return true是 false否
|
||||||
*/
|
*/
|
||||||
public static boolean isValidClassName(String invokeTarget)
|
public static boolean isValidClassName(String invokeTarget)
|
||||||
@ -110,30 +110,30 @@ public class JobInvokeUtil
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String[] methodParams = methodStr.split(",(?=(?:[^\']*\"[^\']*\')*[^\']*$)");
|
String[] methodParams = methodStr.split(",(?=([^\"']*[\"'][^\"']*[\"'])*[^\"']*$)");
|
||||||
List<Object[]> classs = new LinkedList<>();
|
List<Object[]> classs = new LinkedList<>();
|
||||||
for (int i = 0; i < methodParams.length; i++)
|
for (int i = 0; i < methodParams.length; i++)
|
||||||
{
|
{
|
||||||
String str = StringUtils.trimToEmpty(methodParams[i]);
|
String str = StringUtils.trimToEmpty(methodParams[i]);
|
||||||
// String字符串类型,包含'
|
// String字符串类型,以'或"开头
|
||||||
if (StringUtils.contains(str, "'"))
|
if (StringUtils.startsWithAny(str, "'", "\""))
|
||||||
{
|
{
|
||||||
classs.add(new Object[] { StringUtils.replace(str, "'", ""), String.class });
|
classs.add(new Object[] { StringUtils.substring(str, 1, str.length() - 1), String.class });
|
||||||
}
|
}
|
||||||
// boolean布尔类型,等于true或者false
|
// boolean布尔类型,等于true或者false
|
||||||
else if (StringUtils.equals(str, "true") || StringUtils.equalsIgnoreCase(str, "false"))
|
else if ("true".equalsIgnoreCase(str) || "false".equalsIgnoreCase(str))
|
||||||
{
|
{
|
||||||
classs.add(new Object[] { Boolean.valueOf(str), Boolean.class });
|
classs.add(new Object[] { Boolean.valueOf(str), Boolean.class });
|
||||||
}
|
}
|
||||||
// long长整形,包含L
|
// long长整形,以L结尾
|
||||||
else if (StringUtils.containsIgnoreCase(str, "L"))
|
else if (StringUtils.endsWith(str, "L"))
|
||||||
{
|
{
|
||||||
classs.add(new Object[] { Long.valueOf(StringUtils.replaceIgnoreCase(str, "L", "")), Long.class });
|
classs.add(new Object[] { Long.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Long.class });
|
||||||
}
|
}
|
||||||
// double浮点类型,包含D
|
// double浮点类型,以D结尾
|
||||||
else if (StringUtils.containsIgnoreCase(str, "D"))
|
else if (StringUtils.endsWith(str, "D"))
|
||||||
{
|
{
|
||||||
classs.add(new Object[] { Double.valueOf(StringUtils.replaceIgnoreCase(str, "D", "")), Double.class });
|
classs.add(new Object[] { Double.valueOf(StringUtils.substring(str, 0, str.length() - 1)), Double.class });
|
||||||
}
|
}
|
||||||
// 其他类型归类为整形
|
// 其他类型归类为整形
|
||||||
else
|
else
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.8.0</version>
|
<version>3.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import javax.validation.constraints.Size;
|
|||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import com.ruoyi.common.xss.Xss;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
@ -45,6 +46,7 @@ public class SysNotice extends BaseEntity
|
|||||||
this.noticeTitle = noticeTitle;
|
this.noticeTitle = noticeTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Xss(message = "公告标题不能包含脚本字符")
|
||||||
@NotBlank(message = "公告标题不能为空")
|
@NotBlank(message = "公告标题不能为空")
|
||||||
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
|
||||||
public String getNoticeTitle()
|
public String getNoticeTitle()
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public interface SysDeptMapper
|
|||||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
* @param deptCheckStrictly 部门树选择项是否关联显示
|
||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
public List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public interface SysMenuMapper
|
|||||||
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
public List<Long> selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据菜单ID查询信息
|
* 根据菜单ID查询信息
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public interface SysPostMapper
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 选中岗位ID列表
|
* @return 选中岗位ID列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectPostListByUserId(Long userId);
|
public List<Long> selectPostListByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户所属岗位组
|
* 查询用户所属岗位组
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public interface ISysDeptService
|
|||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectDeptListByRoleId(Long roleId);
|
public List<Long> selectDeptListByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据部门ID查询信息
|
* 根据部门ID查询信息
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public interface ISysMenuService
|
|||||||
* @param roleId 角色ID
|
* @param roleId 角色ID
|
||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectMenuListByRoleId(Long roleId);
|
public List<Long> selectMenuListByRoleId(Long roleId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端路由所需要的菜单
|
* 构建前端路由所需要的菜单
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public interface ISysPostService
|
|||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 选中岗位ID列表
|
* @return 选中岗位ID列表
|
||||||
*/
|
*/
|
||||||
public List<Integer> selectPostListByUserId(Long userId);
|
public List<Long> selectPostListByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位名称
|
* 校验岗位名称
|
||||||
|
|||||||
@ -100,7 +100,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
* @return 选中部门列表
|
* @return 选中部门列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> selectDeptListByRoleId(Long roleId)
|
public List<Long> selectDeptListByRoleId(Long roleId)
|
||||||
{
|
{
|
||||||
SysRole role = roleMapper.selectRoleById(roleId);
|
SysRole role = roleMapper.selectRoleById(roleId);
|
||||||
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
|
return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly());
|
||||||
|
|||||||
@ -128,7 +128,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||||||
* @return 选中菜单列表
|
* @return 选中菜单列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> selectMenuListByRoleId(Long roleId)
|
public List<Long> selectMenuListByRoleId(Long roleId)
|
||||||
{
|
{
|
||||||
SysRole role = roleMapper.selectRoleById(roleId);
|
SysRole role = roleMapper.selectRoleById(roleId);
|
||||||
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
|
return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly());
|
||||||
|
|||||||
@ -67,7 +67,7 @@ public class SysPostServiceImpl implements ISysPostService
|
|||||||
* @return 选中岗位ID列表
|
* @return 选中岗位ID列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Integer> selectPostListByUserId(Long userId)
|
public List<Long> selectPostListByUserId(Long userId)
|
||||||
{
|
{
|
||||||
return postMapper.selectPostListByUserId(userId);
|
return postMapper.selectPostListByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,14 @@ package com.ruoyi.system.service.impl;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import javax.validation.Validator;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
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 org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||||
@ -14,6 +17,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.system.domain.SysPost;
|
import com.ruoyi.system.domain.SysPost;
|
||||||
import com.ruoyi.system.domain.SysUserPost;
|
import com.ruoyi.system.domain.SysUserPost;
|
||||||
@ -54,6 +58,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysConfigService configService;
|
private ISysConfigService configService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected Validator validator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
@ -127,16 +134,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
public String selectUserRoleGroup(String userName)
|
public String selectUserRoleGroup(String userName)
|
||||||
{
|
{
|
||||||
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
||||||
StringBuffer idsStr = new StringBuffer();
|
if (CollectionUtils.isEmpty(list))
|
||||||
for (SysRole role : list)
|
|
||||||
{
|
{
|
||||||
idsStr.append(role.getRoleName()).append(",");
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(idsStr.toString()))
|
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
|
||||||
{
|
|
||||||
return idsStr.substring(0, idsStr.length() - 1);
|
|
||||||
}
|
|
||||||
return idsStr.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,16 +151,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
public String selectUserPostGroup(String userName)
|
public String selectUserPostGroup(String userName)
|
||||||
{
|
{
|
||||||
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
||||||
StringBuffer idsStr = new StringBuffer();
|
if (CollectionUtils.isEmpty(list))
|
||||||
for (SysPost post : list)
|
|
||||||
{
|
{
|
||||||
idsStr.append(post.getPostName()).append(",");
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(idsStr.toString()))
|
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
|
||||||
{
|
|
||||||
return idsStr.substring(0, idsStr.length() - 1);
|
|
||||||
}
|
|
||||||
return idsStr.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -521,6 +518,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
||||||
if (StringUtils.isNull(u))
|
if (StringUtils.isNull(u))
|
||||||
{
|
{
|
||||||
|
BeanValidators.validateWithException(validator, user);
|
||||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||||
user.setCreateBy(operName);
|
user.setCreateBy(operName);
|
||||||
this.insertUser(user);
|
this.insertUser(user);
|
||||||
@ -529,6 +527,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
}
|
}
|
||||||
else if (isUpdateSupport)
|
else if (isUpdateSupport)
|
||||||
{
|
{
|
||||||
|
BeanValidators.validateWithException(validator, user);
|
||||||
user.setUpdateBy(operName);
|
user.setUpdateBy(operName);
|
||||||
this.updateUser(user);
|
this.updateUser(user);
|
||||||
successNum++;
|
successNum++;
|
||||||
|
|||||||
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by d.parent_id, d.order_num
|
order by d.parent_id, d.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptListByRoleId" resultType="Integer">
|
<select id="selectDeptListByRoleId" resultType="Long">
|
||||||
select d.dept_id
|
select d.dept_id
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
left join sys_role_dept rd on d.dept_id = rd.dept_id
|
||||||
|
|||||||
@ -84,7 +84,7 @@
|
|||||||
order by m.parent_id, m.order_num
|
order by m.parent_id, m.order_num
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectMenuListByRoleId" resultType="Integer">
|
<select id="selectMenuListByRoleId" resultType="Long">
|
||||||
select m.menu_id
|
select m.menu_id
|
||||||
from sys_menu m
|
from sys_menu m
|
||||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||||
|
|||||||
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
where post_id = #{postId}
|
where post_id = #{postId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
|
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
||||||
select p.post_id
|
select p.post_id
|
||||||
from sys_post p
|
from sys_post p
|
||||||
left join sys_user_post up on up.post_id = p.post_id
|
left join sys_user_post up on up.post_id = p.post_id
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.8.0",
|
"version": "3.8.1",
|
||||||
"description": "若依管理系统",
|
"description": "若依管理系统",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -38,7 +38,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@riophae/vue-treeselect": "0.4.0",
|
"@riophae/vue-treeselect": "0.4.0",
|
||||||
"axios": "0.24.0",
|
"axios": "0.24.0",
|
||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.8",
|
||||||
"core-js": "3.19.1",
|
"core-js": "3.19.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.15.6",
|
"element-ui": "2.15.6",
|
||||||
@ -65,7 +65,9 @@
|
|||||||
"@vue/cli-plugin-eslint": "4.4.6",
|
"@vue/cli-plugin-eslint": "4.4.6",
|
||||||
"@vue/cli-service": "4.4.6",
|
"@vue/cli-service": "4.4.6",
|
||||||
"babel-eslint": "10.1.0",
|
"babel-eslint": "10.1.0",
|
||||||
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
||||||
"chalk": "4.1.0",
|
"chalk": "4.1.0",
|
||||||
|
"compression-webpack-plugin": "5.0.2",
|
||||||
"connect": "3.6.6",
|
"connect": "3.6.6",
|
||||||
"eslint": "7.15.0",
|
"eslint": "7.15.0",
|
||||||
"eslint-plugin-vue": "7.2.0",
|
"eslint-plugin-vue": "7.2.0",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import { praseStrEmpty } from "@/utils/ruoyi";
|
import { parseStrEmpty } from "@/utils/ruoyi";
|
||||||
|
|
||||||
// 查询用户列表
|
// 查询用户列表
|
||||||
export function listUser(query) {
|
export function listUser(query) {
|
||||||
@ -13,7 +13,7 @@ export function listUser(query) {
|
|||||||
// 查询用户详细
|
// 查询用户详细
|
||||||
export function getUser(userId) {
|
export function getUser(userId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/user/' + praseStrEmpty(userId),
|
url: '/system/user/' + parseStrEmpty(userId),
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,114 +1,114 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form size="small">
|
<el-form size="small">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="1">
|
<el-radio v-model='radioValue' :label="1">
|
||||||
小时,允许的通配符[, - * /]
|
小时,允许的通配符[, - * /]
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="2">
|
<el-radio v-model='radioValue' :label="2">
|
||||||
周期从
|
周期从
|
||||||
<el-input-number v-model='cycle01' :min="0" :max="22" /> -
|
<el-input-number v-model='cycle01' :min="0" :max="22" /> -
|
||||||
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
|
<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="3">
|
<el-radio v-model='radioValue' :label="3">
|
||||||
从
|
从
|
||||||
<el-input-number v-model='average01' :min="0" :max="22" /> 小时开始,每
|
<el-input-number v-model='average01' :min="0" :max="22" /> 小时开始,每
|
||||||
<el-input-number v-model='average02' :min="1" :max="23 - average01 || 0" /> 小时执行一次
|
<el-input-number v-model='average02' :min="1" :max="23 - average01 || 0" /> 小时执行一次
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio v-model='radioValue' :label="4">
|
<el-radio v-model='radioValue' :label="4">
|
||||||
指定
|
指定
|
||||||
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
<el-option v-for="item in 60" :key="item" :value="item-1">{{item-1}}</el-option>
|
<el-option v-for="item in 24" :key="item" :value="item-1">{{item-1}}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
radioValue: 1,
|
radioValue: 1,
|
||||||
cycle01: 0,
|
cycle01: 0,
|
||||||
cycle02: 1,
|
cycle02: 1,
|
||||||
average01: 0,
|
average01: 0,
|
||||||
average02: 1,
|
average02: 1,
|
||||||
checkboxList: [],
|
checkboxList: [],
|
||||||
checkNum: this.$options.propsData.check
|
checkNum: this.$options.propsData.check
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
name: 'crontab-hour',
|
name: 'crontab-hour',
|
||||||
props: ['check', 'cron'],
|
props: ['check', 'cron'],
|
||||||
methods: {
|
methods: {
|
||||||
// 单选按钮值变化时
|
// 单选按钮值变化时
|
||||||
radioChange() {
|
radioChange() {
|
||||||
switch (this.radioValue) {
|
switch (this.radioValue) {
|
||||||
case 1:
|
case 1:
|
||||||
this.$emit('update', 'hour', '*')
|
this.$emit('update', 'hour', '*')
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.$emit('update', 'hour', this.cycleTotal);
|
this.$emit('update', 'hour', this.cycleTotal);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.$emit('update', 'hour', this.averageTotal);
|
this.$emit('update', 'hour', this.averageTotal);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
this.$emit('update', 'hour', this.checkboxString);
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 周期两个值变化时
|
// 周期两个值变化时
|
||||||
cycleChange() {
|
cycleChange() {
|
||||||
if (this.radioValue == '2') {
|
if (this.radioValue == '2') {
|
||||||
this.$emit('update', 'hour', this.cycleTotal);
|
this.$emit('update', 'hour', this.cycleTotal);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 平均两个值变化时
|
// 平均两个值变化时
|
||||||
averageChange() {
|
averageChange() {
|
||||||
if (this.radioValue == '3') {
|
if (this.radioValue == '3') {
|
||||||
this.$emit('update', 'hour', this.averageTotal);
|
this.$emit('update', 'hour', this.averageTotal);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// checkbox值变化时
|
// checkbox值变化时
|
||||||
checkboxChange() {
|
checkboxChange() {
|
||||||
if (this.radioValue == '4') {
|
if (this.radioValue == '4') {
|
||||||
this.$emit('update', 'hour', this.checkboxString);
|
this.$emit('update', 'hour', this.checkboxString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'radioValue': 'radioChange',
|
'radioValue': 'radioChange',
|
||||||
'cycleTotal': 'cycleChange',
|
'cycleTotal': 'cycleChange',
|
||||||
'averageTotal': 'averageChange',
|
'averageTotal': 'averageChange',
|
||||||
'checkboxString': 'checkboxChange'
|
'checkboxString': 'checkboxChange'
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 计算两个周期值
|
// 计算两个周期值
|
||||||
cycleTotal: function () {
|
cycleTotal: function () {
|
||||||
const cycle01 = this.checkNum(this.cycle01, 0, 22)
|
const cycle01 = this.checkNum(this.cycle01, 0, 22)
|
||||||
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
|
const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
|
||||||
return cycle01 + '-' + cycle02;
|
return cycle01 + '-' + cycle02;
|
||||||
},
|
},
|
||||||
// 计算平均用到的值
|
// 计算平均用到的值
|
||||||
averageTotal: function () {
|
averageTotal: function () {
|
||||||
const average01 = this.checkNum(this.average01, 0, 22)
|
const average01 = this.checkNum(this.average01, 0, 22)
|
||||||
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
|
const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
|
||||||
return average01 + '/' + average02;
|
return average01 + '/' + average02;
|
||||||
},
|
},
|
||||||
// 计算勾选的checkbox值合集
|
// 计算勾选的checkbox值合集
|
||||||
checkboxString: function () {
|
checkboxString: function () {
|
||||||
let str = this.checkboxList.join();
|
let str = this.checkboxList.join();
|
||||||
return str == '' ? '*' : str;
|
return str == '' ? '*' : str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -273,7 +273,7 @@ export default {
|
|||||||
insValue = 5;
|
insValue = 5;
|
||||||
} else {
|
} else {
|
||||||
this.$refs[refName].checkboxList = value.split(",");
|
this.$refs[refName].checkboxList = value.split(",");
|
||||||
insValue = 7;
|
insValue = 6;
|
||||||
}
|
}
|
||||||
} else if (name == "year") {
|
} else if (name == "year") {
|
||||||
if (value == "") {
|
if (value == "") {
|
||||||
|
|||||||
@ -60,7 +60,7 @@
|
|||||||
<el-radio v-model='radioValue' :label="6">
|
<el-radio v-model='radioValue' :label="6">
|
||||||
指定
|
指定
|
||||||
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
|
||||||
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
|
<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="String(item.key)">{{item.value}}</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-radio>
|
</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
67
ruoyi-ui/src/components/ImagePreview/index.vue
Normal file
67
ruoyi-ui/src/components/ImagePreview/index.vue
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<template>
|
||||||
|
<el-image :src="`${realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="[`${realSrc}`]">
|
||||||
|
<div slot="error" class="image-slot">
|
||||||
|
<i class="el-icon-picture-outline"></i>
|
||||||
|
</div>
|
||||||
|
</el-image>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { isExternal } from '@/utils/validate'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ImagePreview',
|
||||||
|
props: {
|
||||||
|
src: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
realSrc() {
|
||||||
|
if (isExternal(this.src)) {
|
||||||
|
return this.src
|
||||||
|
}
|
||||||
|
return process.env.VUE_APP_BASE_API + this.src
|
||||||
|
},
|
||||||
|
realWidth() {
|
||||||
|
return typeof this.width == 'string' ? this.width : `${this.width}px`
|
||||||
|
},
|
||||||
|
realHeight() {
|
||||||
|
return typeof this.height == 'string' ? this.height : `${this.height}px`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.el-image {
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: #ebeef5;
|
||||||
|
box-shadow: 0 0 5px 1px #ccc;
|
||||||
|
::v-deep .el-image__inner {
|
||||||
|
transition: all 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
transform: scale(1.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
::v-deep .image-slot {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
color: #909399;
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -3,10 +3,12 @@ import hasPermi from './permission/hasPermi'
|
|||||||
import dialogDrag from './dialog/drag'
|
import dialogDrag from './dialog/drag'
|
||||||
import dialogDragWidth from './dialog/dragWidth'
|
import dialogDragWidth from './dialog/dragWidth'
|
||||||
import dialogDragHeight from './dialog/dragHeight'
|
import dialogDragHeight from './dialog/dragHeight'
|
||||||
|
import clipboard from './module/clipboard'
|
||||||
|
|
||||||
const install = function(Vue) {
|
const install = function(Vue) {
|
||||||
Vue.directive('hasRole', hasRole)
|
Vue.directive('hasRole', hasRole)
|
||||||
Vue.directive('hasPermi', hasPermi)
|
Vue.directive('hasPermi', hasPermi)
|
||||||
|
Vue.directive('clipboard', clipboard)
|
||||||
Vue.directive('dialogDrag', dialogDrag)
|
Vue.directive('dialogDrag', dialogDrag)
|
||||||
Vue.directive('dialogDragWidth', dialogDragWidth)
|
Vue.directive('dialogDragWidth', dialogDragWidth)
|
||||||
Vue.directive('dialogDragHeight', dialogDragHeight)
|
Vue.directive('dialogDragHeight', dialogDragHeight)
|
||||||
|
|||||||
54
ruoyi-ui/src/directive/module/clipboard.js
Normal file
54
ruoyi-ui/src/directive/module/clipboard.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/**
|
||||||
|
* v-clipboard 文字复制剪贴
|
||||||
|
* Copyright (c) 2021 ruoyi
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Clipboard from 'clipboard'
|
||||||
|
export default {
|
||||||
|
bind(el, binding, vnode) {
|
||||||
|
switch (binding.arg) {
|
||||||
|
case 'success':
|
||||||
|
el._vClipBoard_success = binding.value;
|
||||||
|
break;
|
||||||
|
case 'error':
|
||||||
|
el._vClipBoard_error = binding.value;
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
const clipboard = new Clipboard(el, {
|
||||||
|
text: () => binding.value,
|
||||||
|
action: () => binding.arg === 'cut' ? 'cut' : 'copy'
|
||||||
|
});
|
||||||
|
clipboard.on('success', e => {
|
||||||
|
const callback = el._vClipBoard_success;
|
||||||
|
callback && callback(e);
|
||||||
|
});
|
||||||
|
clipboard.on('error', e => {
|
||||||
|
const callback = el._vClipBoard_error;
|
||||||
|
callback && callback(e);
|
||||||
|
});
|
||||||
|
el._vClipBoard = clipboard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update(el, binding) {
|
||||||
|
if (binding.arg === 'success') {
|
||||||
|
el._vClipBoard_success = binding.value;
|
||||||
|
} else if (binding.arg === 'error') {
|
||||||
|
el._vClipBoard_error = binding.value;
|
||||||
|
} else {
|
||||||
|
el._vClipBoard.text = function () { return binding.value; };
|
||||||
|
el._vClipBoard.action = () => binding.arg === 'cut' ? 'cut' : 'copy';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
unbind(el, binding) {
|
||||||
|
if (!el._vClipboard) return
|
||||||
|
if (binding.arg === 'success') {
|
||||||
|
delete el._vClipBoard_success;
|
||||||
|
} else if (binding.arg === 'error') {
|
||||||
|
delete el._vClipBoard_error;
|
||||||
|
} else {
|
||||||
|
el._vClipBoard.destroy();
|
||||||
|
delete el._vClipBoard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,6 +29,8 @@ import Editor from "@/components/Editor"
|
|||||||
import FileUpload from "@/components/FileUpload"
|
import FileUpload from "@/components/FileUpload"
|
||||||
// 图片上传组件
|
// 图片上传组件
|
||||||
import ImageUpload from "@/components/ImageUpload"
|
import ImageUpload from "@/components/ImageUpload"
|
||||||
|
// 图片预览组件
|
||||||
|
import ImagePreview from "@/components/ImagePreview"
|
||||||
// 字典标签组件
|
// 字典标签组件
|
||||||
import DictTag from '@/components/DictTag'
|
import DictTag from '@/components/DictTag'
|
||||||
// 头部标签组件
|
// 头部标签组件
|
||||||
@ -54,6 +56,7 @@ Vue.component('RightToolbar', RightToolbar)
|
|||||||
Vue.component('Editor', Editor)
|
Vue.component('Editor', Editor)
|
||||||
Vue.component('FileUpload', FileUpload)
|
Vue.component('FileUpload', FileUpload)
|
||||||
Vue.component('ImageUpload', ImageUpload)
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
|
Vue.component('ImagePreview', ImagePreview)
|
||||||
|
|
||||||
Vue.use(directive)
|
Vue.use(directive)
|
||||||
Vue.use(plugins)
|
Vue.use(plugins)
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import axios from 'axios'
|
|||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
|
import errorCode from '@/utils/errorCode'
|
||||||
import { blobValidate } from "@/utils/ruoyi";
|
import { blobValidate } from "@/utils/ruoyi";
|
||||||
|
|
||||||
const baseURL = process.env.VUE_APP_BASE_API
|
const baseURL = process.env.VUE_APP_BASE_API
|
||||||
@ -20,7 +21,7 @@ export default {
|
|||||||
const blob = new Blob([res.data])
|
const blob = new Blob([res.data])
|
||||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -37,7 +38,7 @@ export default {
|
|||||||
const blob = new Blob([res.data])
|
const blob = new Blob([res.data])
|
||||||
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
this.saveAs(blob, decodeURI(res.headers['download-filename']))
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -54,12 +55,18 @@ export default {
|
|||||||
const blob = new Blob([res.data], { type: 'application/zip' })
|
const blob = new Blob([res.data], { type: 'application/zip' })
|
||||||
this.saveAs(blob, name)
|
this.saveAs(blob, name)
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
this.printErrMsg(res.data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveAs(text, name, opts) {
|
saveAs(text, name, opts) {
|
||||||
saveAs(text, name, opts);
|
saveAs(text, name, opts);
|
||||||
|
},
|
||||||
|
async printErrMsg(data) {
|
||||||
|
const resText = await data.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,8 @@ import Layout from '@/layout'
|
|||||||
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
* redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
|
||||||
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
* name:'router-name' // 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
|
||||||
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
|
* query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
|
||||||
|
* roles: ['admin', 'common'] // 访问路由的角色权限
|
||||||
|
* permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限
|
||||||
* meta : {
|
* meta : {
|
||||||
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
noCache: true // 如果设置为true,则不会被 <keep-alive> 缓存(默认 false)
|
||||||
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字
|
||||||
@ -35,28 +37,28 @@ export const constantRoutes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/redirect/:path(.*)',
|
path: '/redirect/:path(.*)',
|
||||||
component: (resolve) => require(['@/views/redirect'], resolve)
|
component: () => import('@/views/redirect')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
component: (resolve) => require(['@/views/login'], resolve),
|
component: () => import('@/views/login'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/register',
|
path: '/register',
|
||||||
component: (resolve) => require(['@/views/register'], resolve),
|
component: () => import('@/views/register'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/404',
|
||||||
component: (resolve) => require(['@/views/error/404'], resolve),
|
component: () => import('@/views/error/404'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/401',
|
path: '/401',
|
||||||
component: (resolve) => require(['@/views/error/401'], resolve),
|
component: () => import('@/views/error/401'),
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -66,7 +68,7 @@ export const constantRoutes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: (resolve) => require(['@/views/index'], resolve),
|
component: () => import('@/views/index'),
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
meta: { title: '首页', icon: 'dashboard', affix: true }
|
||||||
}
|
}
|
||||||
@ -80,20 +82,25 @@ export const constantRoutes = [
|
|||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'profile',
|
path: 'profile',
|
||||||
component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
|
component: () => import('@/views/system/user/profile/index'),
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
meta: { title: '个人中心', icon: 'user' }
|
meta: { title: '个人中心', icon: 'user' }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
// 动态路由,基于用户权限动态去加载
|
||||||
|
export const dynamicRoutes = [
|
||||||
{
|
{
|
||||||
path: '/system/user-auth',
|
path: '/system/user-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
permissions: ['system:user:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'role/:userId(\\d+)',
|
path: 'role/:userId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/user/authRole'], resolve),
|
component: () => import('@/views/system/user/authRole'),
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
meta: { title: '分配角色', activeMenu: '/system/user' }
|
meta: { title: '分配角色', activeMenu: '/system/user' }
|
||||||
}
|
}
|
||||||
@ -103,10 +110,11 @@ export const constantRoutes = [
|
|||||||
path: '/system/role-auth',
|
path: '/system/role-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
permissions: ['system:role:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'user/:roleId(\\d+)',
|
path: 'user/:roleId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/role/authUser'], resolve),
|
component: () => import('@/views/system/role/authUser'),
|
||||||
name: 'AuthUser',
|
name: 'AuthUser',
|
||||||
meta: { title: '分配用户', activeMenu: '/system/role' }
|
meta: { title: '分配用户', activeMenu: '/system/role' }
|
||||||
}
|
}
|
||||||
@ -116,10 +124,11 @@ export const constantRoutes = [
|
|||||||
path: '/system/dict-data',
|
path: '/system/dict-data',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
permissions: ['system:dict:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:dictId(\\d+)',
|
path: 'index/:dictId(\\d+)',
|
||||||
component: (resolve) => require(['@/views/system/dict/data'], resolve),
|
component: () => import('@/views/system/dict/data'),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '字典数据', activeMenu: '/system/dict' }
|
meta: { title: '字典数据', activeMenu: '/system/dict' }
|
||||||
}
|
}
|
||||||
@ -129,10 +138,11 @@ export const constantRoutes = [
|
|||||||
path: '/monitor/job-log',
|
path: '/monitor/job-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
permissions: ['monitor:job:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: (resolve) => require(['@/views/monitor/job/log'], resolve),
|
component: () => import('@/views/monitor/job/log'),
|
||||||
name: 'JobLog',
|
name: 'JobLog',
|
||||||
meta: { title: '调度日志', activeMenu: '/monitor/job' }
|
meta: { title: '调度日志', activeMenu: '/monitor/job' }
|
||||||
}
|
}
|
||||||
@ -142,10 +152,11 @@ export const constantRoutes = [
|
|||||||
path: '/tool/gen-edit',
|
path: '/tool/gen-edit',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
permissions: ['tool:gen:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
|
component: () => import('@/views/tool/gen/editTable'),
|
||||||
name: 'GenEdit',
|
name: 'GenEdit',
|
||||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import { constantRoutes } from '@/router'
|
import auth from '@/plugins/auth'
|
||||||
|
import router, { constantRoutes, dynamicRoutes } from '@/router'
|
||||||
import { getRouters } from '@/api/menu'
|
import { getRouters } from '@/api/menu'
|
||||||
import Layout from '@/layout/index'
|
import Layout from '@/layout/index'
|
||||||
import ParentView from '@/components/ParentView'
|
import ParentView from '@/components/ParentView'
|
||||||
@ -42,7 +43,9 @@ const permission = {
|
|||||||
const rdata = JSON.parse(JSON.stringify(res.data))
|
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||||
const sidebarRoutes = filterAsyncRouter(sdata)
|
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||||
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||||
|
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
|
||||||
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||||
|
router.addRoutes(asyncRoutes);
|
||||||
commit('SET_ROUTES', rewriteRoutes)
|
commit('SET_ROUTES', rewriteRoutes)
|
||||||
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
|
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
|
||||||
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
|
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
|
||||||
@ -106,6 +109,23 @@ function filterChildren(childrenMap, lastRouter = false) {
|
|||||||
return children
|
return children
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 动态路由遍历,验证是否具备权限
|
||||||
|
export function filterDynamicRoutes(routes) {
|
||||||
|
const res = []
|
||||||
|
routes.forEach(route => {
|
||||||
|
if (route.permissions) {
|
||||||
|
if (auth.hasPermiOr(route.permissions)) {
|
||||||
|
res.push(route)
|
||||||
|
}
|
||||||
|
} else if (route.roles) {
|
||||||
|
if (auth.hasRoleOr(route.roles)) {
|
||||||
|
res.push(route)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
export const loadView = (view) => {
|
export const loadView = (view) => {
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
return (resolve) => require([`@/views/${view}`], resolve)
|
return (resolve) => require([`@/views/${view}`], resolve)
|
||||||
|
|||||||
@ -108,7 +108,10 @@ export function download(url, params, filename) {
|
|||||||
const blob = new Blob([data])
|
const blob = new Blob([data])
|
||||||
saveAs(blob, filename)
|
saveAs(blob, filename)
|
||||||
} else {
|
} else {
|
||||||
Message.error('无效的会话,或者会话已过期,请重新登录。');
|
const resText = await data.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||||
|
Message.error(errMsg);
|
||||||
}
|
}
|
||||||
downloadLoadingInstance.close();
|
downloadLoadingInstance.close();
|
||||||
}).catch((r) => {
|
}).catch((r) => {
|
||||||
|
|||||||
@ -108,7 +108,7 @@ export function sprintf(str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 转换字符串,undefined,null等转化为""
|
// 转换字符串,undefined,null等转化为""
|
||||||
export function praseStrEmpty(str) {
|
export function parseStrEmpty(str) {
|
||||||
if (!str || str == "undefined" || str == "null") {
|
if (!str || str == "undefined" || str == "null") {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,6 +147,39 @@
|
|||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v3.8.1 - 2022-01-01">
|
||||||
|
<ol>
|
||||||
|
<li>新增Vue3前端代码生成模板</li>
|
||||||
|
<li>新增图片预览组件</li>
|
||||||
|
<li>新增压缩插件实现打包Gzip</li>
|
||||||
|
<li>自定义xss校验注解实现</li>
|
||||||
|
<li>自定义文字复制剪贴指令</li>
|
||||||
|
<li>代码生成预览支持复制内容</li>
|
||||||
|
<li>路由支持单独配置菜单或角色权限</li>
|
||||||
|
<li>用户管理部门查询选择节点后分页参数初始</li>
|
||||||
|
<li>修复用户分配角色属性错误</li>
|
||||||
|
<li>修复打包后字体图标偶现的乱码问题</li>
|
||||||
|
<li>修复菜单管理重置表单出现的错误</li>
|
||||||
|
<li>修复版本差异导致的懒加载报错问题</li>
|
||||||
|
<li>修复Cron组件中周回显问题</li>
|
||||||
|
<li>修复定时任务多参数逗号分隔的问题</li>
|
||||||
|
<li>修复根据ID查询列表可能出现的主键溢出问题</li>
|
||||||
|
<li>修复tomcat配置参数已过期问题</li>
|
||||||
|
<li>升级clipboard到最新版本2.0.8</li>
|
||||||
|
<li>升级oshi到最新版本v5.8.6</li>
|
||||||
|
<li>升级fastjson到最新版1.2.79</li>
|
||||||
|
<li>升级spring-boot到最新版本2.5.8</li>
|
||||||
|
<li>升级log4j2到2.17.1,防止漏洞风险</li>
|
||||||
|
<li>优化下载解析blob异常提示</li>
|
||||||
|
<li>优化代码生成字典组重复问题</li>
|
||||||
|
<li>优化查询用户的角色组&岗位组代码</li>
|
||||||
|
<li>优化定时任务cron表达式小时设置24</li>
|
||||||
|
<li>优化用户导入提示溢出则显示滚动条</li>
|
||||||
|
<li>优化防重复提交标识组合为(key+url+header)</li>
|
||||||
|
<li>优化分页方法设置成通用方便灵活调用</li>
|
||||||
|
<li>其他细节优化</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v3.8.0 - 2021-12-01">
|
<el-collapse-item title="v3.8.0 - 2021-12-01">
|
||||||
<ol>
|
<ol>
|
||||||
<li>新增配套并同步的Vue3前端版本</li>
|
<li>新增配套并同步的Vue3前端版本</li>
|
||||||
@ -717,7 +750,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 版本号
|
// 版本号
|
||||||
version: "3.8.0",
|
version: "3.8.1",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@ -204,7 +204,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="错误策略" prop="misfirePolicy">
|
<el-form-item label="执行策略" prop="misfirePolicy">
|
||||||
<el-radio-group v-model="form.misfirePolicy" size="small">
|
<el-radio-group v-model="form.misfirePolicy" size="small">
|
||||||
<el-radio-button label="1">立即执行</el-radio-button>
|
<el-radio-button label="1">立即执行</el-radio-button>
|
||||||
<el-radio-button label="2">执行一次</el-radio-button>
|
<el-radio-button label="2">执行一次</el-radio-button>
|
||||||
|
|||||||
@ -128,7 +128,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24" v-if="form.menuType != 'F'">
|
<el-col :span="24" v-if="form.menuType != 'F'">
|
||||||
<el-form-item label="菜单图标">
|
<el-form-item label="菜单图标" prop="icon">
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom-start"
|
placement="bottom-start"
|
||||||
width="460"
|
width="460"
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8" :offset="2">
|
<el-col :span="8" :offset="2">
|
||||||
<el-form-item label="登录账号" prop="phonenumber">
|
<el-form-item label="登录账号" prop="userName">
|
||||||
<el-input v-model="form.userName" disabled />
|
<el-input v-model="form.userName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@ -495,7 +495,7 @@ export default {
|
|||||||
// 节点单击事件
|
// 节点单击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
this.queryParams.deptId = data.id;
|
this.queryParams.deptId = data.id;
|
||||||
this.getList();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
// 用户状态修改
|
// 用户状态修改
|
||||||
handleStatusChange(row) {
|
handleStatusChange(row) {
|
||||||
@ -663,7 +663,7 @@ export default {
|
|||||||
this.upload.open = false;
|
this.upload.open = false;
|
||||||
this.upload.isUploading = false;
|
this.upload.isUploading = false;
|
||||||
this.$refs.upload.clearFiles();
|
this.$refs.upload.clearFiles();
|
||||||
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 提交上传文件
|
// 提交上传文件
|
||||||
|
|||||||
@ -169,7 +169,8 @@
|
|||||||
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
||||||
:key="key"
|
:key="key"
|
||||||
>
|
>
|
||||||
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
|
<el-link :underline="false" icon="el-icon-document-copy" v-clipboard:copy="value" v-clipboard:success="clipboardSuccess" style="float:right">复制</el-link>
|
||||||
|
<pre><code class="hljs" v-html="highlightedCode(value, key)"></code></pre>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -306,6 +307,10 @@ export default {
|
|||||||
const result = hljs.highlight(language, code || "", true);
|
const result = hljs.highlight(language, code || "", true);
|
||||||
return result.value || ' ';
|
return result.value || ' ';
|
||||||
},
|
},
|
||||||
|
/** 复制代码成功 */
|
||||||
|
clipboardSuccess(){
|
||||||
|
this.$modal.msgSuccess("复制成功");
|
||||||
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.tableId);
|
this.ids = selection.map(item => item.tableId);
|
||||||
|
|||||||
@ -5,6 +5,8 @@ function resolve(dir) {
|
|||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CompressionPlugin = require('compression-webpack-plugin')
|
||||||
|
|
||||||
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
|
const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题
|
||||||
|
|
||||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
||||||
@ -42,13 +44,29 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
disableHostCheck: true
|
disableHostCheck: true
|
||||||
},
|
},
|
||||||
|
css: {
|
||||||
|
loaderOptions: {
|
||||||
|
sass: {
|
||||||
|
sassOptions: { outputStyle: "expanded" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
name: name,
|
name: name,
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve('src')
|
'@': resolve('src')
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
plugins: [
|
||||||
|
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
|
||||||
|
new CompressionPlugin({
|
||||||
|
test: /\.(js|css|html)?$/i, // 压缩文件格式
|
||||||
|
filename: '[path].gz[query]', // 压缩后的文件名
|
||||||
|
algorithm: 'gzip', // 使用gzip压缩
|
||||||
|
minRatio: 0.8 // 压缩率小于1才会压缩
|
||||||
|
})
|
||||||
|
],
|
||||||
},
|
},
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
config.plugins.delete('preload') // TODO: need test
|
config.plugins.delete('preload') // TODO: need test
|
||||||
|
|||||||
Reference in New Issue
Block a user