mirror of
https://gitee.com/y_project/RuoYi-Vue.git
synced 2025-12-08 15:02:29 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b5c7f4c96 | |||
| 265e3010aa | |||
| b7a36bfe8a | |||
| 3a51c53823 | |||
| df504c5c14 | |||
| baeed2e8d3 | |||
| 2903de1561 | |||
| cca2f5c62d | |||
| ce54416e4f | |||
| bd19892aff | |||
| 14a859899c | |||
| f3cb18c836 | |||
| 7d0eb3b8c7 | |||
| 654aa6b30c | |||
| b7cdd10f9f | |||
| 9bd35cb7be | |||
| 7a86c714fc | |||
| edd090a098 | |||
| 3cd886785b | |||
| ae5a0f9774 | |||
| 074b3c735d | |||
| a118738d0f | |||
| 56fa3912ae | |||
| 2116ee1822 | |||
| 57a2eb4217 | |||
| 647af5b485 | |||
| 3f33219134 | |||
| a04bb71777 | |||
| 63992ac906 | |||
| 0187344798 | |||
| a9c6ba12e6 | |||
| ba068eae65 | |||
| 1a87ee7c19 | |||
| 3c4b01ab83 | |||
| 886ce995af | |||
| 52264b6e2a | |||
| fd7e88a518 | |||
| 854a6f805f | |||
| 1caec85f46 | |||
| c86dc20743 | |||
| ecc7a8be46 | |||
| e23ad20186 | |||
| 6cf2a8edeb | |||
| 67198aede9 | |||
| 4f33da2a3f |
13
README.md
13
README.md
@ -1,13 +1,15 @@
|
|||||||
## 平台简介
|
## 平台简介
|
||||||
|
|
||||||
|
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||||
|
|
||||||
* 前端采用Vue、Element UI。
|
* 前端采用Vue、Element UI。
|
||||||
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
|
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
|
||||||
* 权限认证使用Jwt,支持多终端认证系统。
|
* 权限认证使用Jwt,支持多终端认证系统。
|
||||||
* 支持加载动态权限菜单,多方式轻松权限控制。
|
* 支持加载动态权限菜单,多方式轻松权限控制。
|
||||||
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
* 高效率开发,使用代码生成器可以一键生成前后端代码。
|
||||||
* 提供了一个Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
|
||||||
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
|
||||||
* 感谢[Vue-Element-Admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://gitee.com/elunez/eladmin-web?_from=gitee_search)。
|
* 特别鸣谢:[element](https://github.com/ElemeFE/element),[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin),[eladmin-web](https://github.com/elunez/eladmin-web)。
|
||||||
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)
|
||||||
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)
|
||||||
|
|
||||||
@ -28,8 +30,9 @@
|
|||||||
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。
|
||||||
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
14. 系统接口:根据业务代码自动生成相关的api接口文档。
|
||||||
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。
|
||||||
16. 在线构建器:拖动表单元素生成相应的HTML代码。
|
16. 缓存监控:对系统的缓存信息查询,命令统计等。
|
||||||
17. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
17. 在线构建器:拖动表单元素生成相应的HTML代码。
|
||||||
|
18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。
|
||||||
|
|
||||||
## 在线体验
|
## 在线体验
|
||||||
|
|
||||||
@ -72,7 +75,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
|
||||||
<td><img src="https://oscimg.oschina.net/oscnet/up-6d73c2140ce694e3de4c05035fdc1868d4c.png"/></td>
|
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
10
pom.xml
10
pom.xml
@ -6,24 +6,24 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</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.3.0</ruoyi.version>
|
<ruoyi.version>3.4.0</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>
|
||||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||||
<druid.version>1.2.2</druid.version>
|
<druid.version>1.2.4</druid.version>
|
||||||
<bitwalker.version>1.21</bitwalker.version>
|
<bitwalker.version>1.21</bitwalker.version>
|
||||||
<swagger.version>2.9.2</swagger.version>
|
<swagger.version>2.9.2</swagger.version>
|
||||||
<kaptcha.version>2.3.2</kaptcha.version>
|
<kaptcha.version>2.3.2</kaptcha.version>
|
||||||
<pagehelper.boot.version>1.3.0</pagehelper.boot.version>
|
<pagehelper.boot.version>1.3.0</pagehelper.boot.version>
|
||||||
<fastjson.version>1.2.74</fastjson.version>
|
<fastjson.version>1.2.75</fastjson.version>
|
||||||
<oshi.version>5.3.6</oshi.version>
|
<oshi.version>5.3.6</oshi.version>
|
||||||
<jna.version>5.6.0</jna.version>
|
<jna.version>5.6.0</jna.version>
|
||||||
<commons.io.version>2.5</commons.io.version>
|
<commons.io.version>2.5</commons.io.version>
|
||||||
@ -41,7 +41,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.1.18.RELEASE</version>
|
<version>2.2.13.RELEASE</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|||||||
@ -3,9 +3,9 @@ ruoyi:
|
|||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: RuoYi
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.3.0
|
version: 3.4.0
|
||||||
# 版权年份
|
# 版权年份
|
||||||
copyrightYear: 2020
|
copyrightYear: 2021
|
||||||
# 实例演示开关
|
# 实例演示开关
|
||||||
demoEnabled: true
|
demoEnabled: true
|
||||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||||
@ -62,6 +62,8 @@ spring:
|
|||||||
host: localhost
|
host: localhost
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
|
# 数据库索引
|
||||||
|
database: 0
|
||||||
# 密码
|
# 密码
|
||||||
password:
|
password:
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -149,7 +149,7 @@ public @interface Excel
|
|||||||
|
|
||||||
public enum ColumnType
|
public enum ColumnType
|
||||||
{
|
{
|
||||||
NUMERIC(0), STRING(1);
|
NUMERIC(0), STRING(1), IMAGE(2);
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
ColumnType(int value)
|
ColumnType(int value)
|
||||||
|
|||||||
@ -13,6 +13,9 @@ public class GenConstants
|
|||||||
/** 树表(增删改查) */
|
/** 树表(增删改查) */
|
||||||
public static final String TPL_TREE = "tree";
|
public static final String TPL_TREE = "tree";
|
||||||
|
|
||||||
|
/** 主子表(增删改查) */
|
||||||
|
public static final String TPL_SUB = "sub";
|
||||||
|
|
||||||
/** 树编码字段 */
|
/** 树编码字段 */
|
||||||
public static final String TREE_CODE = "treeCode";
|
public static final String TREE_CODE = "treeCode";
|
||||||
|
|
||||||
@ -29,8 +32,10 @@ public class GenConstants
|
|||||||
public static final String PARENT_MENU_NAME = "parentMenuName";
|
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||||
|
|
||||||
/** 数据库字符串类型 */
|
/** 数据库字符串类型 */
|
||||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2", "tinytext", "text",
|
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||||
"mediumtext", "longtext" };
|
|
||||||
|
/** 数据库文本类型 */
|
||||||
|
public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" };
|
||||||
|
|
||||||
/** 数据库时间类型 */
|
/** 数据库时间类型 */
|
||||||
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" };
|
||||||
@ -74,8 +79,11 @@ public class GenConstants
|
|||||||
/** 日期控件 */
|
/** 日期控件 */
|
||||||
public static final String HTML_DATETIME = "datetime";
|
public static final String HTML_DATETIME = "datetime";
|
||||||
|
|
||||||
/** 上传控件 */
|
/** 图片上传控件 */
|
||||||
public static final String HTML_UPLOAD_IMAGE = "uploadImage";
|
public static final String HTML_IMAGE_UPLOAD = "imageUpload";
|
||||||
|
|
||||||
|
/** 文件上传控件 */
|
||||||
|
public static final String HTML_FILE_UPLOAD = "fileUpload";
|
||||||
|
|
||||||
/** 富文本控件 */
|
/** 富文本控件 */
|
||||||
public static final String HTML_EDITOR = "editor";
|
public static final String HTML_EDITOR = "editor";
|
||||||
|
|||||||
@ -29,8 +29,8 @@ public class RepeatableFilter implements Filter
|
|||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
{
|
{
|
||||||
ServletRequest requestWrapper = null;
|
ServletRequest requestWrapper = null;
|
||||||
if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(),
|
if (request instanceof HttpServletRequest
|
||||||
MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE))
|
&& StringUtils.equalsAnyIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE))
|
||||||
{
|
{
|
||||||
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
|
|||||||
public boolean isJsonRequest()
|
public boolean isJsonRequest()
|
||||||
{
|
{
|
||||||
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
|
||||||
return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header)
|
return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header);
|
||||||
|| MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,4 +44,33 @@ public class FileTypeUtils
|
|||||||
}
|
}
|
||||||
return fileName.substring(separatorIndex + 1).toLowerCase();
|
return fileName.substring(separatorIndex + 1).toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件类型
|
||||||
|
*
|
||||||
|
* @param photoByte 文件字节码
|
||||||
|
* @return 后缀(不含".")
|
||||||
|
*/
|
||||||
|
public static String getFileExtendName(byte[] photoByte)
|
||||||
|
{
|
||||||
|
String strFileExtendName = "JPG";
|
||||||
|
if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
|
||||||
|
&& ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97))
|
||||||
|
{
|
||||||
|
strFileExtendName = "GIF";
|
||||||
|
}
|
||||||
|
else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70))
|
||||||
|
{
|
||||||
|
strFileExtendName = "JPG";
|
||||||
|
}
|
||||||
|
else if ((photoByte[0] == 66) && (photoByte[1] == 77))
|
||||||
|
{
|
||||||
|
strFileExtendName = "BMP";
|
||||||
|
}
|
||||||
|
else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71))
|
||||||
|
{
|
||||||
|
strFileExtendName = "PNG";
|
||||||
|
}
|
||||||
|
return strFileExtendName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
package com.ruoyi.common.utils.file;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import org.apache.poi.util.IOUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片处理工具类
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class ImageUtils
|
||||||
|
{
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
|
||||||
|
|
||||||
|
public static byte[] getImage(String imagePath)
|
||||||
|
{
|
||||||
|
InputStream is = getFile(imagePath);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return IOUtils.toByteArray(is);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("图片加载异常 {}", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(is);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InputStream getFile(String imagePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] result = readFile(imagePath);
|
||||||
|
result = Arrays.copyOf(result, result.length);
|
||||||
|
return new ByteArrayInputStream(result);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("获取图片异常 {}", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取文件为字节数据
|
||||||
|
*
|
||||||
|
* @param key 地址
|
||||||
|
* @return 字节数据
|
||||||
|
*/
|
||||||
|
public static byte[] readFile(String url)
|
||||||
|
{
|
||||||
|
InputStream in = null;
|
||||||
|
ByteArrayOutputStream baos = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (url.startsWith("http"))
|
||||||
|
{
|
||||||
|
// 网络地址
|
||||||
|
URL urlObj = new URL(url);
|
||||||
|
URLConnection urlConnection = urlObj.openConnection();
|
||||||
|
urlConnection.setConnectTimeout(30 * 1000);
|
||||||
|
urlConnection.setReadTimeout(60 * 1000);
|
||||||
|
urlConnection.setDoInput(true);
|
||||||
|
in = urlConnection.getInputStream();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 本机地址
|
||||||
|
String localPath = RuoYiConfig.getProfile();
|
||||||
|
String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX);
|
||||||
|
in = new FileInputStream(downloadPath);
|
||||||
|
}
|
||||||
|
return IOUtils.toByteArray(in);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("获取文件路径异常 {}", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(baos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,10 +22,12 @@ import org.apache.poi.ss.usermodel.BorderStyle;
|
|||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.CellType;
|
import org.apache.poi.ss.usermodel.CellType;
|
||||||
|
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||||
import org.apache.poi.ss.usermodel.DataValidation;
|
import org.apache.poi.ss.usermodel.DataValidation;
|
||||||
import org.apache.poi.ss.usermodel.DataValidationConstraint;
|
import org.apache.poi.ss.usermodel.DataValidationConstraint;
|
||||||
import org.apache.poi.ss.usermodel.DataValidationHelper;
|
import org.apache.poi.ss.usermodel.DataValidationHelper;
|
||||||
import org.apache.poi.ss.usermodel.DateUtil;
|
import org.apache.poi.ss.usermodel.DateUtil;
|
||||||
|
import org.apache.poi.ss.usermodel.Drawing;
|
||||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||||
import org.apache.poi.ss.usermodel.Font;
|
import org.apache.poi.ss.usermodel.Font;
|
||||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
@ -37,6 +39,7 @@ import org.apache.poi.ss.usermodel.Workbook;
|
|||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
|
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -51,6 +54,8 @@ import com.ruoyi.common.exception.CustomException;
|
|||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.DictUtils;
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.file.FileTypeUtils;
|
||||||
|
import com.ruoyi.common.utils.file.ImageUtils;
|
||||||
import com.ruoyi.common.utils.reflect.ReflectUtils;
|
import com.ruoyi.common.utils.reflect.ReflectUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,16 +107,21 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
private List<Object[]> fields;
|
private List<Object[]> fields;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大高度
|
||||||
|
*/
|
||||||
|
private short maxHeight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计列表
|
* 统计列表
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数字格式
|
* 数字格式
|
||||||
*/
|
*/
|
||||||
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
|
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实体对象
|
* 实体对象
|
||||||
*/
|
*/
|
||||||
@ -239,7 +249,15 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = Convert.toStr(val);
|
String dateFormat = field.getAnnotation(Excel.class).dateFormat();
|
||||||
|
if (StringUtils.isNotEmpty(dateFormat))
|
||||||
|
{
|
||||||
|
val = DateUtils.parseDateToStr(dateFormat, (Date) val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = Convert.toStr(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val)))
|
else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val)))
|
||||||
@ -521,6 +539,47 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
|
cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value));
|
||||||
}
|
}
|
||||||
|
else if (ColumnType.IMAGE == attr.cellType())
|
||||||
|
{
|
||||||
|
ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1),
|
||||||
|
cell.getRow().getRowNum() + 1);
|
||||||
|
String imagePath = Convert.toStr(value);
|
||||||
|
if (StringUtils.isNotEmpty(imagePath))
|
||||||
|
{
|
||||||
|
byte[] data = ImageUtils.getImage(imagePath);
|
||||||
|
getDrawingPatriarch(cell.getSheet()).createPicture(anchor,
|
||||||
|
cell.getSheet().getWorkbook().addPicture(data, getImageType(data)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取画布
|
||||||
|
*/
|
||||||
|
public static Drawing<?> getDrawingPatriarch(Sheet sheet)
|
||||||
|
{
|
||||||
|
if (sheet.getDrawingPatriarch() == null)
|
||||||
|
{
|
||||||
|
sheet.createDrawingPatriarch();
|
||||||
|
}
|
||||||
|
return sheet.getDrawingPatriarch();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取图片类型,设置图片插入类型
|
||||||
|
*/
|
||||||
|
public int getImageType(byte[] value)
|
||||||
|
{
|
||||||
|
String type = FileTypeUtils.getFileExtendName(value);
|
||||||
|
if ("JPG".equalsIgnoreCase(type))
|
||||||
|
{
|
||||||
|
return Workbook.PICTURE_TYPE_JPEG;
|
||||||
|
}
|
||||||
|
else if ("PNG".equalsIgnoreCase(type))
|
||||||
|
{
|
||||||
|
return Workbook.PICTURE_TYPE_PNG;
|
||||||
|
}
|
||||||
|
return Workbook.PICTURE_TYPE_JPEG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -536,7 +595,6 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
// 设置列宽
|
// 设置列宽
|
||||||
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
|
sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256));
|
||||||
row.setHeight((short) (attr.height() * 20));
|
|
||||||
}
|
}
|
||||||
// 如果设置了提示信息则鼠标放上去提示.
|
// 如果设置了提示信息则鼠标放上去提示.
|
||||||
if (StringUtils.isNotEmpty(attr.prompt()))
|
if (StringUtils.isNotEmpty(attr.prompt()))
|
||||||
@ -561,7 +619,7 @@ public class ExcelUtil<T>
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 设置行高
|
// 设置行高
|
||||||
row.setHeight((short) (attr.height() * 20));
|
row.setHeight(maxHeight);
|
||||||
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
|
// 根据Excel中设置情况决定是否导出,有些情况需要保持为空,希望用户填写这一列.
|
||||||
if (attr.isExport())
|
if (attr.isExport())
|
||||||
{
|
{
|
||||||
@ -737,7 +795,7 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
return StringUtils.stripEnd(propertyString.toString(), separator);
|
return StringUtils.stripEnd(propertyString.toString(), separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析字典值
|
* 解析字典值
|
||||||
*
|
*
|
||||||
@ -763,7 +821,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
return DictUtils.getDictValue(dictType, dictLabel, separator);
|
return DictUtils.getDictValue(dictType, dictLabel, separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合计统计信息
|
* 合计统计信息
|
||||||
*/
|
*/
|
||||||
@ -800,7 +858,7 @@ public class ExcelUtil<T>
|
|||||||
cell = row.createCell(0);
|
cell = row.createCell(0);
|
||||||
cell.setCellStyle(styles.get("total"));
|
cell.setCellStyle(styles.get("total"));
|
||||||
cell.setCellValue("合计");
|
cell.setCellValue("合计");
|
||||||
|
|
||||||
for (Integer key : keys)
|
for (Integer key : keys)
|
||||||
{
|
{
|
||||||
cell = row.createCell(key);
|
cell = row.createCell(key);
|
||||||
@ -916,6 +974,21 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList());
|
||||||
|
this.maxHeight = getRowHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据注解获取最大行高
|
||||||
|
*/
|
||||||
|
public short getRowHeight()
|
||||||
|
{
|
||||||
|
double maxHeight = 0;
|
||||||
|
for (Object[] os : this.fields)
|
||||||
|
{
|
||||||
|
Excel excel = (Excel) os[1];
|
||||||
|
maxHeight = maxHeight > excel.height() ? maxHeight : excel.height();
|
||||||
|
}
|
||||||
|
return (short) (maxHeight * 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -986,7 +1059,7 @@ public class ExcelUtil<T>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((Double) val % 1 > 0)
|
if ((Double) val % 1 != 0)
|
||||||
{
|
{
|
||||||
val = new BigDecimal(val.toString());
|
val = new BigDecimal(val.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,10 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis配置
|
* redis配置
|
||||||
@ -31,7 +33,7 @@ public class RedisConfig extends CachingConfigurerSupport
|
|||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
|
mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
|
||||||
serializer.setObjectMapper(mapper);
|
serializer.setObjectMapper(mapper);
|
||||||
|
|
||||||
template.setValueSerializer(serializer);
|
template.setValueSerializer(serializer);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -63,10 +63,12 @@ public class GenController extends BaseController
|
|||||||
public AjaxResult getInfo(@PathVariable Long talbleId)
|
public AjaxResult getInfo(@PathVariable Long talbleId)
|
||||||
{
|
{
|
||||||
GenTable table = genTableService.selectGenTableById(talbleId);
|
GenTable table = genTableService.selectGenTableById(talbleId);
|
||||||
|
List<GenTable> tables = genTableService.selectGenTableAll();
|
||||||
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(talbleId);
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("info", table);
|
map.put("info", table);
|
||||||
map.put("rows", list);
|
map.put("rows", list);
|
||||||
|
map.put("tables", tables);
|
||||||
return AjaxResult.success(map);
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,11 +28,17 @@ public class GenTable extends BaseEntity
|
|||||||
@NotBlank(message = "表描述不能为空")
|
@NotBlank(message = "表描述不能为空")
|
||||||
private String tableComment;
|
private String tableComment;
|
||||||
|
|
||||||
|
/** 关联父表的表名 */
|
||||||
|
private String subTableName;
|
||||||
|
|
||||||
|
/** 本表关联父表的外键名 */
|
||||||
|
private String subTableFkName;
|
||||||
|
|
||||||
/** 实体类名称(首字母大写) */
|
/** 实体类名称(首字母大写) */
|
||||||
@NotBlank(message = "实体类名称不能为空")
|
@NotBlank(message = "实体类名称不能为空")
|
||||||
private String className;
|
private String className;
|
||||||
|
|
||||||
/** 使用的模板(crud单表操作 tree树表操作) */
|
/** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */
|
||||||
private String tplCategory;
|
private String tplCategory;
|
||||||
|
|
||||||
/** 生成包路径 */
|
/** 生成包路径 */
|
||||||
@ -64,6 +70,9 @@ public class GenTable extends BaseEntity
|
|||||||
/** 主键信息 */
|
/** 主键信息 */
|
||||||
private GenTableColumn pkColumn;
|
private GenTableColumn pkColumn;
|
||||||
|
|
||||||
|
/** 子表信息 */
|
||||||
|
private GenTable subTable;
|
||||||
|
|
||||||
/** 表列信息 */
|
/** 表列信息 */
|
||||||
@Valid
|
@Valid
|
||||||
private List<GenTableColumn> columns;
|
private List<GenTableColumn> columns;
|
||||||
@ -116,6 +125,26 @@ public class GenTable extends BaseEntity
|
|||||||
this.tableComment = tableComment;
|
this.tableComment = tableComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSubTableName()
|
||||||
|
{
|
||||||
|
return subTableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubTableName(String subTableName)
|
||||||
|
{
|
||||||
|
this.subTableName = subTableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSubTableFkName()
|
||||||
|
{
|
||||||
|
return subTableFkName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubTableFkName(String subTableFkName)
|
||||||
|
{
|
||||||
|
this.subTableFkName = subTableFkName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getClassName()
|
public String getClassName()
|
||||||
{
|
{
|
||||||
return className;
|
return className;
|
||||||
@ -216,6 +245,16 @@ public class GenTable extends BaseEntity
|
|||||||
this.pkColumn = pkColumn;
|
this.pkColumn = pkColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GenTable getSubTable()
|
||||||
|
{
|
||||||
|
return subTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubTable(GenTable subTable)
|
||||||
|
{
|
||||||
|
this.subTable = subTable;
|
||||||
|
}
|
||||||
|
|
||||||
public List<GenTableColumn> getColumns()
|
public List<GenTableColumn> getColumns()
|
||||||
{
|
{
|
||||||
return columns;
|
return columns;
|
||||||
@ -286,6 +325,16 @@ public class GenTable extends BaseEntity
|
|||||||
this.parentMenuName = parentMenuName;
|
this.parentMenuName = parentMenuName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSub()
|
||||||
|
{
|
||||||
|
return isSub(this.tplCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSub(String tplCategory)
|
||||||
|
{
|
||||||
|
return tplCategory != null && StringUtils.equals(GenConstants.TPL_SUB, tplCategory);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isTree()
|
public boolean isTree()
|
||||||
{
|
{
|
||||||
return isTree(this.tplCategory);
|
return isTree(this.tplCategory);
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public class GenTableColumn extends BaseEntity
|
|||||||
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
/** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */
|
||||||
private String queryType;
|
private String queryType;
|
||||||
|
|
||||||
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、upload上传控件、editor富文本控件) */
|
/** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */
|
||||||
private String htmlType;
|
private String htmlType;
|
||||||
|
|
||||||
/** 字典类型 */
|
/** 字典类型 */
|
||||||
@ -138,6 +138,11 @@ public class GenTableColumn extends BaseEntity
|
|||||||
return javaField;
|
return javaField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCapJavaField()
|
||||||
|
{
|
||||||
|
return StringUtils.capitalize(javaField);
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsPk(String isPk)
|
public void setIsPk(String isPk)
|
||||||
{
|
{
|
||||||
this.isPk = isPk;
|
this.isPk = isPk;
|
||||||
|
|||||||
@ -34,6 +34,13 @@ public interface GenTableMapper
|
|||||||
*/
|
*/
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有表信息
|
||||||
|
*
|
||||||
|
* @return 表信息集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectGenTableAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询表ID业务信息
|
* 查询表ID业务信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -102,6 +102,17 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
return genTableMapper.selectDbTableListByNames(tableNames);
|
return genTableMapper.selectDbTableListByNames(tableNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有表信息
|
||||||
|
*
|
||||||
|
* @return 表信息集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<GenTable> selectGenTableAll()
|
||||||
|
{
|
||||||
|
return genTableMapper.selectGenTableAll();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改业务
|
* 修改业务
|
||||||
*
|
*
|
||||||
@ -185,9 +196,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
Map<String, String> dataMap = new LinkedHashMap<>();
|
Map<String, String> dataMap = new LinkedHashMap<>();
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableById(tableId);
|
GenTable table = genTableMapper.selectGenTableById(tableId);
|
||||||
// 查询列信息
|
// 设置主子表信息
|
||||||
List<GenTableColumn> columns = table.getColumns();
|
setSubTable(table);
|
||||||
setPkColumn(table, columns);
|
// 设置主键列信息
|
||||||
|
setPkColumn(table);
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||||
@ -231,9 +243,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
{
|
{
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||||
// 查询列信息
|
// 设置主子表信息
|
||||||
List<GenTableColumn> columns = table.getColumns();
|
setSubTable(table);
|
||||||
setPkColumn(table, columns);
|
// 设置主键列信息
|
||||||
|
setPkColumn(table);
|
||||||
|
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
@ -276,6 +289,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
List<String> tableColumnNames = tableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||||
|
|
||||||
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName);
|
||||||
|
if (StringUtils.isEmpty(dbTableColumns))
|
||||||
|
{
|
||||||
|
throw new CustomException("同步数据失败,原表结构不存在");
|
||||||
|
}
|
||||||
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
List<String> dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList());
|
||||||
|
|
||||||
dbTableColumns.forEach(column -> {
|
dbTableColumns.forEach(column -> {
|
||||||
@ -319,9 +336,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
{
|
{
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||||
// 查询列信息
|
// 设置主子表信息
|
||||||
List<GenTableColumn> columns = table.getColumns();
|
setSubTable(table);
|
||||||
setPkColumn(table, columns);
|
// 设置主键列信息
|
||||||
|
setPkColumn(table);
|
||||||
|
|
||||||
VelocityInitializer.initVelocity();
|
VelocityInitializer.initVelocity();
|
||||||
|
|
||||||
@ -375,6 +393,17 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
{
|
{
|
||||||
throw new CustomException("树名称字段不能为空");
|
throw new CustomException("树名称字段不能为空");
|
||||||
}
|
}
|
||||||
|
else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory()))
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(genTable.getSubTableName()))
|
||||||
|
{
|
||||||
|
throw new CustomException("关联子表的表名不能为空");
|
||||||
|
}
|
||||||
|
else if (StringUtils.isEmpty(genTable.getSubTableFkName()))
|
||||||
|
{
|
||||||
|
throw new CustomException("子表关联的外键名不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,11 +411,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
* 设置主键列信息
|
* 设置主键列信息
|
||||||
*
|
*
|
||||||
* @param table 业务表信息
|
* @param table 业务表信息
|
||||||
* @param columns 业务字段列表
|
|
||||||
*/
|
*/
|
||||||
public void setPkColumn(GenTable table, List<GenTableColumn> columns)
|
public void setPkColumn(GenTable table)
|
||||||
{
|
{
|
||||||
for (GenTableColumn column : columns)
|
for (GenTableColumn column : table.getColumns())
|
||||||
{
|
{
|
||||||
if (column.isPk())
|
if (column.isPk())
|
||||||
{
|
{
|
||||||
@ -396,7 +424,36 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
}
|
}
|
||||||
if (StringUtils.isNull(table.getPkColumn()))
|
if (StringUtils.isNull(table.getPkColumn()))
|
||||||
{
|
{
|
||||||
table.setPkColumn(columns.get(0));
|
table.setPkColumn(table.getColumns().get(0));
|
||||||
|
}
|
||||||
|
if (GenConstants.TPL_SUB.equals(table.getTplCategory()))
|
||||||
|
{
|
||||||
|
for (GenTableColumn column : table.getSubTable().getColumns())
|
||||||
|
{
|
||||||
|
if (column.isPk())
|
||||||
|
{
|
||||||
|
table.getSubTable().setPkColumn(column);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(table.getSubTable().getPkColumn()))
|
||||||
|
{
|
||||||
|
table.getSubTable().setPkColumn(table.getSubTable().getColumns().get(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置主子表信息
|
||||||
|
*
|
||||||
|
* @param table 业务表信息
|
||||||
|
*/
|
||||||
|
public void setSubTable(GenTable table)
|
||||||
|
{
|
||||||
|
String subTableName = table.getSubTableName();
|
||||||
|
if (StringUtils.isNotEmpty(subTableName))
|
||||||
|
{
|
||||||
|
table.setSubTable(genTableMapper.selectGenTableByName(subTableName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,13 @@ public interface IGenTableService
|
|||||||
*/
|
*/
|
||||||
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
public List<GenTable> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有表信息
|
||||||
|
*
|
||||||
|
* @return 表信息集合
|
||||||
|
*/
|
||||||
|
public List<GenTable> selectGenTableAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询业务信息
|
* 查询业务信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -40,13 +40,14 @@ public class GenUtils
|
|||||||
column.setCreateBy(table.getCreateBy());
|
column.setCreateBy(table.getCreateBy());
|
||||||
// 设置java字段名
|
// 设置java字段名
|
||||||
column.setJavaField(StringUtils.toCamelCase(columnName));
|
column.setJavaField(StringUtils.toCamelCase(columnName));
|
||||||
|
// 设置默认类型
|
||||||
|
column.setJavaType(GenConstants.TYPE_STRING);
|
||||||
|
|
||||||
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType))
|
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType))
|
||||||
{
|
{
|
||||||
column.setJavaType(GenConstants.TYPE_STRING);
|
|
||||||
// 字符串长度超过500设置为文本域
|
// 字符串长度超过500设置为文本域
|
||||||
Integer columnLength = getColumnLength(column.getColumnType());
|
Integer columnLength = getColumnLength(column.getColumnType());
|
||||||
String htmlType = columnLength >= 500 ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
|
String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
|
||||||
column.setHtmlType(htmlType);
|
column.setHtmlType(htmlType);
|
||||||
}
|
}
|
||||||
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType))
|
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType))
|
||||||
@ -111,10 +112,15 @@ public class GenUtils
|
|||||||
{
|
{
|
||||||
column.setHtmlType(GenConstants.HTML_SELECT);
|
column.setHtmlType(GenConstants.HTML_SELECT);
|
||||||
}
|
}
|
||||||
// 文件字段设置上传控件
|
// 图片字段设置图片上传控件
|
||||||
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
|
else if (StringUtils.endsWithIgnoreCase(columnName, "image"))
|
||||||
{
|
{
|
||||||
column.setHtmlType(GenConstants.HTML_UPLOAD_IMAGE);
|
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD);
|
||||||
|
}
|
||||||
|
// 文件字段设置文件上传控件
|
||||||
|
else if (StringUtils.endsWithIgnoreCase(columnName, "file"))
|
||||||
|
{
|
||||||
|
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD);
|
||||||
}
|
}
|
||||||
// 内容字段设置富文本控件
|
// 内容字段设置富文本控件
|
||||||
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
else if (StringUtils.endsWithIgnoreCase(columnName, "content"))
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import com.ruoyi.common.constant.Constants;
|
|||||||
/**
|
/**
|
||||||
* VelocityEngine工厂
|
* VelocityEngine工厂
|
||||||
*
|
*
|
||||||
* @author RuoYi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class VelocityInitializer
|
public class VelocityInitializer
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class VelocityUtils
|
|||||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||||
velocityContext.put("datetime", DateUtils.getDate());
|
velocityContext.put("datetime", DateUtils.getDate());
|
||||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||||
velocityContext.put("importList", getImportList(genTable.getColumns()));
|
velocityContext.put("importList", getImportList(genTable));
|
||||||
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
|
||||||
velocityContext.put("columns", genTable.getColumns());
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
@ -63,6 +63,10 @@ public class VelocityUtils
|
|||||||
{
|
{
|
||||||
setTreeVelocityContext(velocityContext, genTable);
|
setTreeVelocityContext(velocityContext, genTable);
|
||||||
}
|
}
|
||||||
|
if (GenConstants.TPL_SUB.equals(tplCategory))
|
||||||
|
{
|
||||||
|
setSubVelocityContext(velocityContext, genTable);
|
||||||
|
}
|
||||||
return velocityContext;
|
return velocityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +100,24 @@ public class VelocityUtils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setSubVelocityContext(VelocityContext context, GenTable genTable)
|
||||||
|
{
|
||||||
|
GenTable subTable = genTable.getSubTable();
|
||||||
|
String subTableName = genTable.getSubTableName();
|
||||||
|
String subTableFkName = genTable.getSubTableFkName();
|
||||||
|
String subClassName = genTable.getSubTable().getClassName();
|
||||||
|
String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
|
||||||
|
|
||||||
|
context.put("subTable", subTable);
|
||||||
|
context.put("subTableName", subTableName);
|
||||||
|
context.put("subTableFkName", subTableFkName);
|
||||||
|
context.put("subTableFkClassName", subTableFkClassName);
|
||||||
|
context.put("subTableFkclassName", StringUtils.uncapitalize(subTableFkClassName));
|
||||||
|
context.put("subClassName", subClassName);
|
||||||
|
context.put("subclassName", StringUtils.uncapitalize(subClassName));
|
||||||
|
context.put("subImportList", getImportList(genTable.getSubTable()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取模板信息
|
* 获取模板信息
|
||||||
*
|
*
|
||||||
@ -120,6 +142,11 @@ public class VelocityUtils
|
|||||||
{
|
{
|
||||||
templates.add("vm/vue/index-tree.vue.vm");
|
templates.add("vm/vue/index-tree.vue.vm");
|
||||||
}
|
}
|
||||||
|
else if (GenConstants.TPL_SUB.equals(tplCategory))
|
||||||
|
{
|
||||||
|
templates.add("vm/vue/index.vue.vm");
|
||||||
|
templates.add("vm/java/sub-domain.java.vm");
|
||||||
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +174,10 @@ public class VelocityUtils
|
|||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
||||||
}
|
}
|
||||||
|
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
||||||
|
{
|
||||||
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||||
|
}
|
||||||
else if (template.contains("mapper.java.vm"))
|
else if (template.contains("mapper.java.vm"))
|
||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||||
@ -201,13 +232,19 @@ public class VelocityUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据列类型获取导入包
|
* 根据列类型获取导入包
|
||||||
*
|
*
|
||||||
* @param columns 列集合
|
* @param genTable 业务表对象
|
||||||
* @return 返回需要导入的包列表
|
* @return 返回需要导入的包列表
|
||||||
*/
|
*/
|
||||||
public static HashSet<String> getImportList(List<GenTableColumn> columns)
|
public static HashSet<String> getImportList(GenTable genTable)
|
||||||
{
|
{
|
||||||
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
|
GenTable subGenTable = genTable.getSubTable();
|
||||||
HashSet<String> importList = new HashSet<String>();
|
HashSet<String> importList = new HashSet<String>();
|
||||||
|
if (StringUtils.isNotNull(subGenTable))
|
||||||
|
{
|
||||||
|
importList.add("java.util.List");
|
||||||
|
}
|
||||||
for (GenTableColumn column : columns)
|
for (GenTableColumn column : columns)
|
||||||
{
|
{
|
||||||
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType()))
|
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType()))
|
||||||
|
|||||||
@ -5,24 +5,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<mapper namespace="com.ruoyi.generator.mapper.GenTableMapper">
|
<mapper namespace="com.ruoyi.generator.mapper.GenTableMapper">
|
||||||
|
|
||||||
<resultMap type="GenTable" id="GenTableResult">
|
<resultMap type="GenTable" id="GenTableResult">
|
||||||
<id property="tableId" column="table_id" />
|
<id property="tableId" column="table_id" />
|
||||||
<result property="tableName" column="table_name" />
|
<result property="tableName" column="table_name" />
|
||||||
<result property="tableComment" column="table_comment" />
|
<result property="tableComment" column="table_comment" />
|
||||||
<result property="className" column="class_name" />
|
<result property="subTableName" column="sub_table_name" />
|
||||||
<result property="tplCategory" column="tpl_category" />
|
<result property="subTableFkName" column="sub_table_fk_name" />
|
||||||
<result property="packageName" column="package_name" />
|
<result property="className" column="class_name" />
|
||||||
<result property="moduleName" column="module_name" />
|
<result property="tplCategory" column="tpl_category" />
|
||||||
<result property="businessName" column="business_name" />
|
<result property="packageName" column="package_name" />
|
||||||
<result property="functionName" column="function_name" />
|
<result property="moduleName" column="module_name" />
|
||||||
<result property="functionAuthor" column="function_author" />
|
<result property="businessName" column="business_name" />
|
||||||
<result property="genType" column="gen_type" />
|
<result property="functionName" column="function_name" />
|
||||||
<result property="genPath" column="gen_path" />
|
<result property="functionAuthor" column="function_author" />
|
||||||
<result property="options" column="options" />
|
<result property="genType" column="gen_type" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="genPath" column="gen_path" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="options" column="options" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="remark" column="remark" />
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="remark" column="remark" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableVo">
|
<sql id="selectGenTableVo">
|
||||||
select table_id, table_name, table_comment, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
@ -108,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
@ -116,13 +118,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
||||||
SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
|
||||||
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
FROM gen_table t
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
||||||
|
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark,
|
||||||
|
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
|
||||||
|
FROM gen_table t
|
||||||
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
|
order by c.sort
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
|
||||||
insert into gen_table (
|
insert into gen_table (
|
||||||
<if test="tableName != null">table_name,</if>
|
<if test="tableName != null">table_name,</if>
|
||||||
@ -162,6 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<set>
|
<set>
|
||||||
<if test="tableName != null">table_name = #{tableName},</if>
|
<if test="tableName != null">table_name = #{tableName},</if>
|
||||||
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
|
||||||
|
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
|
||||||
|
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
|
||||||
<if test="className != null and className != ''">class_name = #{className},</if>
|
<if test="className != null and className != ''">class_name = #{className},</if>
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
|
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
|
||||||
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
#if($table.crud)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#end
|
#end
|
||||||
@ -41,7 +41,7 @@ public class ${ClassName}Controller extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
#if($table.crud)
|
#if($table.crud || $table.sub)
|
||||||
public TableDataInfo list(${ClassName} ${className})
|
public TableDataInfo list(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ${import};
|
|||||||
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.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
#if($table.crud)
|
#if($table.crud || $table.sub)
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
import com.ruoyi.common.core.domain.TreeEntity;
|
import com.ruoyi.common.core.domain.TreeEntity;
|
||||||
@ -18,7 +18,7 @@ import com.ruoyi.common.core.domain.TreeEntity;
|
|||||||
* @author ${author}
|
* @author ${author}
|
||||||
* @date ${datetime}
|
* @date ${datetime}
|
||||||
*/
|
*/
|
||||||
#if($table.crud)
|
#if($table.crud || $table.sub)
|
||||||
#set($Entity="BaseEntity")
|
#set($Entity="BaseEntity")
|
||||||
#elseif($table.tree)
|
#elseif($table.tree)
|
||||||
#set($Entity="TreeEntity")
|
#set($Entity="TreeEntity")
|
||||||
@ -49,6 +49,11 @@ public class ${ClassName} extends ${Entity}
|
|||||||
private $column.javaType $column.javaField;
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
/** $table.subTable.functionName信息 */
|
||||||
|
private List<${subClassName}> ${subclassName}List;
|
||||||
|
|
||||||
#end
|
#end
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if(!$table.isSuperColumn($column.javaField))
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
@ -69,6 +74,18 @@ public class ${ClassName} extends ${Entity}
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
#if($table.sub)
|
||||||
|
public List<${subClassName}> get${subClassName}List()
|
||||||
|
{
|
||||||
|
return ${subclassName}List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
|
||||||
|
{
|
||||||
|
this.${subclassName}List = ${subclassName}List;
|
||||||
|
}
|
||||||
|
|
||||||
|
#end
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -79,6 +96,9 @@ public class ${ClassName} extends ${Entity}
|
|||||||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
#end
|
#end
|
||||||
.append("${column.javaField}", get${AttrName}())
|
.append("${column.javaField}", get${AttrName}())
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
.append("${subclassName}List", get${subClassName}List())
|
||||||
#end
|
#end
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,9 @@ package ${packageName}.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
|
#if($table.sub)
|
||||||
|
import ${packageName}.domain.${subClassName};
|
||||||
|
#end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ${functionName}Mapper接口
|
* ${functionName}Mapper接口
|
||||||
@ -58,4 +61,31 @@ public interface ${ClassName}Mapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除${subTable.functionName}
|
||||||
|
*
|
||||||
|
* @param customerIds 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增${subTable.functionName}
|
||||||
|
*
|
||||||
|
* @param ${subclassName}List ${subTable.functionName}列表
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过${functionName}ID删除${subTable.functionName}信息
|
||||||
|
*
|
||||||
|
* @param roleId 角色ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,12 @@ import com.ruoyi.common.utils.DateUtils;
|
|||||||
#end
|
#end
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
#if($table.sub)
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import ${packageName}.domain.${subClassName};
|
||||||
|
#end
|
||||||
import ${packageName}.mapper.${ClassName}Mapper;
|
import ${packageName}.mapper.${ClassName}Mapper;
|
||||||
import ${packageName}.domain.${ClassName};
|
import ${packageName}.domain.${ClassName};
|
||||||
import ${packageName}.service.I${ClassName}Service;
|
import ${packageName}.service.I${ClassName}Service;
|
||||||
@ -55,6 +61,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
* @param ${className} ${functionName}
|
* @param ${className} ${functionName}
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
@Override
|
@Override
|
||||||
public int insert${ClassName}(${ClassName} ${className})
|
public int insert${ClassName}(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
@ -63,7 +72,13 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
${className}.setCreateTime(DateUtils.getNowDate());
|
${className}.setCreateTime(DateUtils.getNowDate());
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
int rows = ${className}Mapper.insert${ClassName}(${className});
|
||||||
|
insert${subClassName}(${className});
|
||||||
|
return rows;
|
||||||
|
#else
|
||||||
return ${className}Mapper.insert${ClassName}(${className});
|
return ${className}Mapper.insert${ClassName}(${className});
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,6 +87,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
* @param ${className} ${functionName}
|
* @param ${className} ${functionName}
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
@Override
|
@Override
|
||||||
public int update${ClassName}(${ClassName} ${className})
|
public int update${ClassName}(${ClassName} ${className})
|
||||||
{
|
{
|
||||||
@ -79,6 +97,10 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
#if($column.javaField == 'updateTime')
|
#if($column.javaField == 'updateTime')
|
||||||
${className}.setUpdateTime(DateUtils.getNowDate());
|
${className}.setUpdateTime(DateUtils.getNowDate());
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
||||||
|
insert${subClassName}(${className});
|
||||||
#end
|
#end
|
||||||
return ${className}Mapper.update${ClassName}(${className});
|
return ${className}Mapper.update${ClassName}(${className});
|
||||||
}
|
}
|
||||||
@ -89,9 +111,15 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}ID
|
* @param ${pkColumn.javaField}s 需要删除的${functionName}ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
#if($table.sub)
|
||||||
|
@Transactional
|
||||||
|
#end
|
||||||
@Override
|
@Override
|
||||||
public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||||
{
|
{
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
||||||
|
#end
|
||||||
return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +132,35 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||||||
@Override
|
@Override
|
||||||
public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField})
|
public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField})
|
||||||
{
|
{
|
||||||
|
#if($table.sub)
|
||||||
|
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
||||||
|
#end
|
||||||
return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField});
|
return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField});
|
||||||
}
|
}
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${subTable.functionName}信息
|
||||||
|
*
|
||||||
|
* @param ${className} ${functionName}对象
|
||||||
|
*/
|
||||||
|
public void insert${subClassName}(${ClassName} ${className})
|
||||||
|
{
|
||||||
|
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
|
||||||
|
Long ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
|
||||||
|
if (StringUtils.isNotNull(${subclassName}List))
|
||||||
|
{
|
||||||
|
List<${subClassName}> list = new ArrayList<${subClassName}>();
|
||||||
|
for (${subClassName} ${subclassName} : ${subclassName}List)
|
||||||
|
{
|
||||||
|
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
|
||||||
|
list.add(${subclassName});
|
||||||
|
}
|
||||||
|
if (list.size() > 0)
|
||||||
|
{
|
||||||
|
${className}Mapper.batch${subClassName}(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,76 @@
|
|||||||
|
package ${packageName}.domain;
|
||||||
|
|
||||||
|
#foreach ($import in $subImportList)
|
||||||
|
import ${import};
|
||||||
|
#end
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${subTable.functionName}对象 ${subTableName}
|
||||||
|
*
|
||||||
|
* @author ${author}
|
||||||
|
* @date ${datetime}
|
||||||
|
*/
|
||||||
|
public class ${subClassName} extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
#foreach ($column in $subTable.columns)
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
/** $column.columnComment */
|
||||||
|
#if($column.list)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||||
|
#elseif($column.javaType == 'Date')
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
#else
|
||||||
|
@Excel(name = "${comment}")
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
private $column.javaType $column.javaField;
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach ($column in $subTable.columns)
|
||||||
|
#if(!$table.isSuperColumn($column.javaField))
|
||||||
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
|
#set($AttrName=$column.javaField)
|
||||||
|
#else
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#end
|
||||||
|
public void set${AttrName}($column.javaType $column.javaField)
|
||||||
|
{
|
||||||
|
this.$column.javaField = $column.javaField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public $column.javaType get${AttrName}()
|
||||||
|
{
|
||||||
|
return $column.javaField;
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
#foreach ($column in $subTable.columns)
|
||||||
|
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
|
||||||
|
#set($AttrName=$column.javaField)
|
||||||
|
#else
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
#end
|
||||||
|
.append("${column.javaField}", get${AttrName}())
|
||||||
|
#end
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -38,20 +38,33 @@
|
|||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-date-picker clearable size="small" style="width: 200px"
|
<el-date-picker clearable size="small"
|
||||||
v-model="queryParams.${column.javaField}"
|
v-model="queryParams.${column.javaField}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="选择${comment}">
|
placeholder="选择${comment}">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</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
|
#end
|
||||||
#end
|
#end
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -60,6 +73,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -139,9 +153,13 @@
|
|||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "uploadImage")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<uploadImage v-model="form.${field}"/>
|
<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>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
@ -201,7 +219,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-date-picker clearable size="small" style="width: 200px"
|
<el-date-picker clearable size="small"
|
||||||
v-model="form.${field}"
|
v-model="form.${field}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
@ -230,8 +248,14 @@ import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${Busin
|
|||||||
import Treeselect from "@riophae/vue-treeselect";
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload")
|
||||||
import UploadImage from '@/components/UploadImage';
|
import ImageUpload from '@/components/ImageUpload';
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
import FileUpload from '@/components/FileUpload';
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -246,8 +270,14 @@ export default {
|
|||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
components: {
|
components: {
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload")
|
||||||
UploadImage,
|
ImageUpload,
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
FileUpload,
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -283,6 +313,10 @@ export default {
|
|||||||
#if(${column.dictType} != '')
|
#if(${column.dictType} != '')
|
||||||
// $comment字典
|
// $comment字典
|
||||||
${column.javaField}Options: [],
|
${column.javaField}Options: [],
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
// $comment时间范围
|
||||||
|
daterange${AttrName}: [],
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -329,6 +363,21 @@ export default {
|
|||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
this.queryParams.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 != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
|
||||||
|
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
|
||||||
|
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
list${BusinessName}(this.queryParams).then(response => {
|
list${BusinessName}(this.queryParams).then(response => {
|
||||||
this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
|
this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -397,6 +446,12 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
this.daterange${AttrName} = [];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
|
|||||||
@ -38,20 +38,33 @@
|
|||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN")
|
||||||
<el-form-item label="${comment}" prop="${column.javaField}">
|
<el-form-item label="${comment}" prop="${column.javaField}">
|
||||||
<el-date-picker clearable size="small" style="width: 200px"
|
<el-date-picker clearable size="small"
|
||||||
v-model="queryParams.${column.javaField}"
|
v-model="queryParams.${column.javaField}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
placeholder="选择${comment}">
|
placeholder="选择${comment}">
|
||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</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
|
#end
|
||||||
#end
|
#end
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -60,6 +73,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -69,6 +83,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -79,6 +94,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -89,13 +105,14 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['${moduleName}:${businessName}:export']"
|
v-hasPermi="['${moduleName}:${businessName}:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange">
|
||||||
@ -168,9 +185,13 @@
|
|||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "uploadImage")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
<uploadImage v-model="form.${field}"/>
|
<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>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-form-item label="${comment}">
|
||||||
@ -230,7 +251,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-date-picker clearable size="small" style="width: 200px"
|
<el-date-picker clearable size="small"
|
||||||
v-model="form.${field}"
|
v-model="form.${field}"
|
||||||
type="date"
|
type="date"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
@ -244,6 +265,38 @@
|
|||||||
#end
|
#end
|
||||||
#end
|
#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="el-icon-plus" size="mini" @click="handleAdd${subClassName}">添加</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" icon="el-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 slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.$javaField" placeholder="请输入$comment" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</el-table>
|
||||||
#end
|
#end
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -257,8 +310,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload")
|
||||||
import UploadImage from '@/components/UploadImage';
|
import ImageUpload from '@/components/ImageUpload';
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
import FileUpload from '@/components/FileUpload';
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -273,8 +332,14 @@ export default {
|
|||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
components: {
|
components: {
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "uploadImage")
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "imageUpload")
|
||||||
UploadImage,
|
ImageUpload,
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "fileUpload")
|
||||||
|
FileUpload,
|
||||||
#break
|
#break
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
@ -291,6 +356,10 @@ export default {
|
|||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
|
#if($table.sub)
|
||||||
|
// 子表选中数据
|
||||||
|
checked${subClassName}: [],
|
||||||
|
#end
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
@ -301,6 +370,10 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
// ${functionName}表格数据
|
// ${functionName}表格数据
|
||||||
${businessName}List: [],
|
${businessName}List: [],
|
||||||
|
#if($table.sub)
|
||||||
|
// ${subTable.functionName}表格数据
|
||||||
|
${subclassName}List: [],
|
||||||
|
#end
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@ -315,6 +388,10 @@ export default {
|
|||||||
#if(${column.dictType} != '')
|
#if(${column.dictType} != '')
|
||||||
// $comment字典
|
// $comment字典
|
||||||
${column.javaField}Options: [],
|
${column.javaField}Options: [],
|
||||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
// $comment时间范围
|
||||||
|
daterange${AttrName}: [],
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@ -363,6 +440,21 @@ export default {
|
|||||||
/** 查询${functionName}列表 */
|
/** 查询${functionName}列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
this.queryParams.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 != this.daterange${AttrName} && '' != this.daterange${AttrName}) {
|
||||||
|
this.queryParams.params["begin${AttrName}"] = this.daterange${AttrName}[0];
|
||||||
|
this.queryParams.params["end${AttrName}"] = this.daterange${AttrName}[1];
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#end
|
||||||
list${BusinessName}(this.queryParams).then(response => {
|
list${BusinessName}(this.queryParams).then(response => {
|
||||||
this.${businessName}List = response.rows;
|
this.${businessName}List = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
@ -404,6 +496,9 @@ export default {
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
};
|
};
|
||||||
|
#if($table.sub)
|
||||||
|
this.${subclassName}List = [];
|
||||||
|
#end
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@ -413,6 +508,12 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN")
|
||||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
|
||||||
|
this.daterange${AttrName} = [];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
@ -438,6 +539,9 @@ export default {
|
|||||||
#if($column.htmlType == "checkbox")
|
#if($column.htmlType == "checkbox")
|
||||||
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
this.form.$column.javaField = this.form.${column.javaField}.split(",");
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
this.${subclassName}List = response.data.${subclassName}List;
|
||||||
#end
|
#end
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改${functionName}";
|
this.title = "修改${functionName}";
|
||||||
@ -451,6 +555,9 @@ export default {
|
|||||||
#if($column.htmlType == "checkbox")
|
#if($column.htmlType == "checkbox")
|
||||||
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
this.form.$column.javaField = this.form.${column.javaField}.join(",");
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
this.form.${subclassName}List = this.${subclassName}List;
|
||||||
#end
|
#end
|
||||||
if (this.form.${pkColumn.javaField} != null) {
|
if (this.form.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(this.form).then(response => {
|
update${BusinessName}(this.form).then(response => {
|
||||||
@ -482,6 +589,40 @@ export default {
|
|||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
#if($table.sub)
|
||||||
|
/** ${subTable.functionName}序号 */
|
||||||
|
row${subClassName}Index({ row, rowIndex }) {
|
||||||
|
row.index = rowIndex + 1;
|
||||||
|
},
|
||||||
|
/** ${subTable.functionName}添加按钮操作 */
|
||||||
|
handleAdd${subClassName}() {
|
||||||
|
let obj = {};
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
||||||
|
#elseif($column.list && "" != $javaField)
|
||||||
|
obj.$column.javaField = "";
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
this.${subclassName}List.push(obj);
|
||||||
|
},
|
||||||
|
/** ${subTable.functionName}删除按钮操作 */
|
||||||
|
handleDelete${subClassName}() {
|
||||||
|
if (this.checked${subClassName}.length == 0) {
|
||||||
|
this.$alert("请先选择要删除的${subTable.functionName}数据", "提示", { confirmButtonText: "确定", });
|
||||||
|
} else {
|
||||||
|
this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 单选框选中数据 */
|
||||||
|
handle${subClassName}SelectionChange(selection) {
|
||||||
|
if (selection.length > 1) {
|
||||||
|
this.$refs.${subclassName}.clearSelection();
|
||||||
|
this.$refs.${subclassName}.toggleRowSelection(selection.pop());
|
||||||
|
} else {
|
||||||
|
this.checked${subClassName} = selection;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#end
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
|
|||||||
@ -9,6 +9,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="${column.javaField}" column="${column.columnName}" />
|
<result property="${column.javaField}" column="${column.columnName}" />
|
||||||
#end
|
#end
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
<resultMap id="${ClassName}${subClassName}Result" type="${ClassName}" extends="${ClassName}Result">
|
||||||
|
<collection property="${subclassName}List" notNullColumn="${subTable.pkColumn.columnName}" javaType="java.util.List" resultMap="${subClassName}Result" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap type="${subClassName}" id="${subClassName}Result">
|
||||||
|
#foreach ($column in $subTable.columns)
|
||||||
|
<result property="${column.javaField}" column="${column.columnName}" />
|
||||||
|
#end
|
||||||
|
</resultMap>
|
||||||
|
#end
|
||||||
|
|
||||||
<sql id="select${ClassName}Vo">
|
<sql id="select${ClassName}Vo">
|
||||||
select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName}
|
select#foreach($column in $columns) $column.columnName#if($velocityCount != $columns.size()),#end#end from ${tableName}
|
||||||
@ -46,9 +58,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="${ClassName}Result">
|
<select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
|
||||||
|
#if($table.crud || $table.tree)
|
||||||
<include refid="select${ClassName}Vo"/>
|
<include refid="select${ClassName}Vo"/>
|
||||||
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
|
#elseif($table.sub)
|
||||||
|
select#foreach($column in $columns) a.$column.columnName#if($velocityCount != $columns.size()),#end#end,
|
||||||
|
#foreach($column in $subTable.columns) b.$column.columnName#if($velocityCount != $subTable.columns.size()),#end#end
|
||||||
|
|
||||||
|
from ${tableName} a
|
||||||
|
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName}
|
||||||
|
where a.${pkColumn.columnName} = #{${pkColumn.javaField}}
|
||||||
|
#end
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
|
||||||
@ -91,5 +112,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{${pkColumn.javaField}}
|
#{${pkColumn.javaField}}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
|
||||||
|
delete from ${subTableName} where ${subTableFkName} in
|
||||||
|
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
|
||||||
|
#{${subTableFkclassName}}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="Long">
|
||||||
|
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="batch${subClassName}">
|
||||||
|
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($velocityCount != $subTable.columns.size()),#end#end) values
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($velocityCount != $subTable.columns.size()),#end#end)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
#end
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@
|
|||||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||||
<if test="path != null and path != ''">path = #{path},</if>
|
<if test="path != null and path != ''">path = #{path},</if>
|
||||||
<if test="component != null and component != ''">component = #{component},</if>
|
<if test="component != null">component = #{component},</if>
|
||||||
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
|
||||||
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
|
||||||
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
|
||||||
|
|||||||
@ -141,8 +141,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||||
<if test="email != null and email != ''">email = #{email},</if>
|
<if test="email != null ">email = #{email},</if>
|
||||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||||
<if test="password != null and password != ''">password = #{password},</if>
|
<if test="password != null and password != ''">password = #{password},</if>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.3.0",
|
"version": "3.4.0",
|
||||||
"description": "若依管理系统",
|
"description": "若依管理系统",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -41,15 +41,14 @@
|
|||||||
"clipboard": "2.0.6",
|
"clipboard": "2.0.6",
|
||||||
"core-js": "3.8.1",
|
"core-js": "3.8.1",
|
||||||
"echarts": "4.9.0",
|
"echarts": "4.9.0",
|
||||||
"element-ui": "2.14.1",
|
"element-ui": "2.15.0",
|
||||||
"file-saver": "2.0.4",
|
"file-saver": "2.0.4",
|
||||||
"fuse.js": "6.4.3",
|
"fuse.js": "6.4.3",
|
||||||
"highlight.js": "10.4.1",
|
"highlight.js": "9.18.5",
|
||||||
"js-beautify": "1.13.0",
|
"js-beautify": "1.13.0",
|
||||||
"js-cookie": "2.2.1",
|
"js-cookie": "2.2.1",
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
"jsencrypt": "3.0.0-rc.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"path-to-regexp": "6.2.0",
|
|
||||||
"quill": "1.3.7",
|
"quill": "1.3.7",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
@ -70,8 +69,8 @@
|
|||||||
"eslint": "7.15.0",
|
"eslint": "7.15.0",
|
||||||
"eslint-plugin-vue": "7.2.0",
|
"eslint-plugin-vue": "7.2.0",
|
||||||
"lint-staged": "10.5.3",
|
"lint-staged": "10.5.3",
|
||||||
"sass": "1.30.0",
|
|
||||||
"runjs": "4.4.2",
|
"runjs": "4.4.2",
|
||||||
|
"sass": "1.32.0",
|
||||||
"sass-loader": "10.1.0",
|
"sass-loader": "10.1.0",
|
||||||
"script-ext-html-webpack-plugin": "2.1.5",
|
"script-ext-html-webpack-plugin": "2.1.5",
|
||||||
"svg-sprite-loader": "5.1.1",
|
"svg-sprite-loader": "5.1.1",
|
||||||
|
|||||||
@ -10,8 +10,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import pathToRegexp from 'path-to-regexp'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -49,18 +47,13 @@ export default {
|
|||||||
}
|
}
|
||||||
return name.trim() === '首页'
|
return name.trim() === '首页'
|
||||||
},
|
},
|
||||||
pathCompile(path) {
|
|
||||||
const { params } = this.$route
|
|
||||||
var toPath = pathToRegexp.compile(path)
|
|
||||||
return toPath(params)
|
|
||||||
},
|
|
||||||
handleLink(item) {
|
handleLink(item) {
|
||||||
const { redirect, path } = item
|
const { redirect, path } = item
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
this.$router.push(redirect)
|
this.$router.push(redirect)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$router.push(this.pathCompile(path))
|
this.$router.push(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
179
ruoyi-ui/src/components/FileUpload/index.vue
Normal file
179
ruoyi-ui/src/components/FileUpload/index.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<template>
|
||||||
|
<div class="upload-file">
|
||||||
|
<el-upload
|
||||||
|
:action="uploadFileUrl"
|
||||||
|
:before-upload="handleBeforeUpload"
|
||||||
|
:file-list="fileList"
|
||||||
|
:limit="1"
|
||||||
|
:on-error="handleUploadError"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:on-success="handleUploadSuccess"
|
||||||
|
:show-file-list="false"
|
||||||
|
:headers="headers"
|
||||||
|
class="upload-file-uploader"
|
||||||
|
ref="upload"
|
||||||
|
>
|
||||||
|
<!-- 上传按钮 -->
|
||||||
|
<el-button size="mini" type="primary">选取文件</el-button>
|
||||||
|
<!-- 上传提示 -->
|
||||||
|
<div class="el-upload__tip" slot="tip" v-if="showTip">
|
||||||
|
请上传
|
||||||
|
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
||||||
|
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
||||||
|
的文件
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
|
||||||
|
<!-- 文件列表 -->
|
||||||
|
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||||
|
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list">
|
||||||
|
<el-link :href="file.url" :underline="false" target="_blank">
|
||||||
|
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||||
|
</el-link>
|
||||||
|
<div class="ele-upload-list__item-content-action">
|
||||||
|
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</transition-group>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// 值
|
||||||
|
value: [String, Object, Array],
|
||||||
|
// 大小限制(MB)
|
||||||
|
fileSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 5,
|
||||||
|
},
|
||||||
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
|
fileType: {
|
||||||
|
type: Array,
|
||||||
|
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
||||||
|
},
|
||||||
|
// 是否显示提示
|
||||||
|
isShowTip: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||||
|
headers: {
|
||||||
|
Authorization: "Bearer " + getToken(),
|
||||||
|
},
|
||||||
|
fileList: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 是否显示提示
|
||||||
|
showTip() {
|
||||||
|
return this.isShowTip && (this.fileType || this.fileSize);
|
||||||
|
},
|
||||||
|
// 列表
|
||||||
|
list() {
|
||||||
|
let temp = 1;
|
||||||
|
if (this.value) {
|
||||||
|
// 首先将值转为数组
|
||||||
|
const list = Array.isArray(this.value) ? this.value : [this.value];
|
||||||
|
// 然后将数组转为对象数组
|
||||||
|
return list.map((item) => {
|
||||||
|
if (typeof item === "string") {
|
||||||
|
item = { name: item, url: item };
|
||||||
|
}
|
||||||
|
item.uid = item.uid || new Date().getTime() + temp++;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.fileList = [];
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 上传前校检格式和大小
|
||||||
|
handleBeforeUpload(file) {
|
||||||
|
// 校检文件类型
|
||||||
|
if (this.fileType) {
|
||||||
|
let fileExtension = "";
|
||||||
|
if (file.name.lastIndexOf(".") > -1) {
|
||||||
|
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
||||||
|
}
|
||||||
|
const isTypeOk = this.fileType.some((type) => {
|
||||||
|
if (file.type.indexOf(type) > -1) return true;
|
||||||
|
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
if (!isTypeOk) {
|
||||||
|
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 校检文件大小
|
||||||
|
if (this.fileSize) {
|
||||||
|
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||||
|
if (!isLt) {
|
||||||
|
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
// 文件个数超出
|
||||||
|
handleExceed() {
|
||||||
|
this.$message.error(`只允许上传单个文件`);
|
||||||
|
},
|
||||||
|
// 上传失败
|
||||||
|
handleUploadError(err) {
|
||||||
|
this.$message.error("上传失败, 请重试");
|
||||||
|
},
|
||||||
|
// 上传成功回调
|
||||||
|
handleUploadSuccess(res, file) {
|
||||||
|
this.$message.success("上传成功");
|
||||||
|
this.$emit("input", res.url);
|
||||||
|
},
|
||||||
|
// 删除文件
|
||||||
|
handleDelete(index) {
|
||||||
|
this.fileList.splice(index, 1);
|
||||||
|
this.$emit("input", '');
|
||||||
|
},
|
||||||
|
// 获取文件名称
|
||||||
|
getFileName(name) {
|
||||||
|
if (name.lastIndexOf("/") > -1) {
|
||||||
|
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.fileList = this.list;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.upload-file-uploader {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
.upload-file-list .el-upload-list__item {
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
line-height: 2;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.upload-file-list .ele-upload-list__item-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
.ele-upload-list__item-content-action .el-link {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -20,7 +20,7 @@
|
|||||||
<script>
|
<script>
|
||||||
// fuse is a lightweight fuzzy-search module
|
// fuse is a lightweight fuzzy-search module
|
||||||
// make search results more in line with expectations
|
// make search results more in line with expectations
|
||||||
import Fuse from 'fuse.js'
|
import Fuse from 'fuse.js/dist/fuse.min.js'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@ -11,9 +11,28 @@
|
|||||||
:headers="headers"
|
:headers="headers"
|
||||||
style="display: inline-block; vertical-align: top"
|
style="display: inline-block; vertical-align: top"
|
||||||
>
|
>
|
||||||
<img v-if="value" :src="value" class="avatar" />
|
<el-image v-if="!value" :src="value">
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
<div slot="error" class="image-slot">
|
||||||
|
<i class="el-icon-plus" />
|
||||||
|
</div>
|
||||||
|
</el-image>
|
||||||
|
<div v-else class="image">
|
||||||
|
<el-image :src="value" :style="`width:150px;height:150px;`" fit="fill"/>
|
||||||
|
<div class="mask">
|
||||||
|
<div class="actions">
|
||||||
|
<span title="预览" @click.stop="dialogVisible = true">
|
||||||
|
<i class="el-icon-zoom-in" />
|
||||||
|
</span>
|
||||||
|
<span title="移除" @click.stop="removeImage">
|
||||||
|
<i class="el-icon-delete" />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
|
<el-dialog :visible.sync="dialogVisible" title="预览" width="800" append-to-body>
|
||||||
|
<img :src="value" style="display: block; max-width: 100%; margin: 0 auto;">
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -21,9 +40,9 @@
|
|||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer " + getToken(),
|
Authorization: "Bearer " + getToken(),
|
||||||
@ -37,6 +56,9 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
removeImage() {
|
||||||
|
this.$emit("input", "");
|
||||||
|
},
|
||||||
handleUploadSuccess(res) {
|
handleUploadSuccess(res) {
|
||||||
this.$emit("input", res.url);
|
this.$emit("input", res.url);
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
@ -61,8 +83,18 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.avatar {
|
.image {
|
||||||
width: 100%;
|
position: relative;
|
||||||
height: 100%;
|
.mask {
|
||||||
|
opacity: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
&:hover .mask {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,4 +1,3 @@
|
|||||||
<!-- @author Shiyn/ huangmx 20200807优化-->
|
|
||||||
<template>
|
<template>
|
||||||
<div class="top-right-btn">
|
<div class="top-right-btn">
|
||||||
<el-row>
|
<el-row>
|
||||||
@ -8,31 +7,74 @@
|
|||||||
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
|
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
|
||||||
<el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" />
|
<el-button size="mini" circle icon="el-icon-refresh" @click="refresh()" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
<el-tooltip class="item" effect="dark" content="显隐列" placement="top" v-if="columns">
|
||||||
|
<el-button size="mini" circle icon="el-icon-menu" @click="showColumn()" />
|
||||||
|
</el-tooltip>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
<el-dialog :title="title" :visible.sync="open" append-to-body>
|
||||||
|
<el-transfer
|
||||||
|
:titles="['显示', '隐藏']"
|
||||||
|
v-model="value"
|
||||||
|
:data="columns"
|
||||||
|
@change="dataChange"
|
||||||
|
></el-transfer>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "RightToolbar",
|
name: "RightToolbar",
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
// 显隐数据
|
||||||
|
value: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "显示/隐藏",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
showSearch: {
|
showSearch: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
//搜索
|
// 搜索
|
||||||
toggleSearch() {
|
toggleSearch() {
|
||||||
this.$emit("update:showSearch", !this.showSearch);
|
this.$emit("update:showSearch", !this.showSearch);
|
||||||
},
|
},
|
||||||
//刷新
|
// 刷新
|
||||||
refresh() {
|
refresh() {
|
||||||
this.$emit("queryTable");
|
this.$emit("queryTable");
|
||||||
},
|
},
|
||||||
|
// 右侧列表元素变化
|
||||||
|
dataChange(data) {
|
||||||
|
for (var item in this.columns) {
|
||||||
|
const key = this.columns[item].key;
|
||||||
|
this.columns[item].visible = !data.includes(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 打开显隐列dialog
|
||||||
|
showColumn() {
|
||||||
|
this.open = true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .el-transfer__button {
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 12px;
|
||||||
|
display: block;
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
::v-deep .el-transfer__button:first-child {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
<!-- @author ruoyi 20201128 支持三级以上菜单缓存 -->
|
|
||||||
<template>
|
<template>
|
||||||
<section class="app-main">
|
<section class="app-main">
|
||||||
<transition name="fade-transform" mode="out-in">
|
<transition name="fade-transform" mode="out-in">
|
||||||
<keep-alive :max="20" :exclude="notCacheName">
|
<keep-alive :include="cachedViews">
|
||||||
<router-view :key="key" />
|
<router-view :key="key" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
@ -10,119 +9,17 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Global from "@/layout/components/global.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AppMain',
|
name: 'AppMain',
|
||||||
computed: {
|
computed: {
|
||||||
notCacheName() {
|
cachedViews() {
|
||||||
var visitedViews = this.$store.state.tagsView.visitedViews;
|
return this.$store.state.tagsView.cachedViews
|
||||||
var noCacheViews = [];
|
|
||||||
Object.keys(visitedViews).some((index) => {
|
|
||||||
if (visitedViews[index].meta.noCache) {
|
|
||||||
noCacheViews.push(visitedViews[index].name);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return noCacheViews;
|
|
||||||
},
|
},
|
||||||
key() {
|
key() {
|
||||||
return this.$route.path;
|
return this.$route.path
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
mounted() {
|
}
|
||||||
// 关闭标签触发
|
|
||||||
Global.$on("removeCache", (name, view) => {
|
|
||||||
this.removeCache(name, view);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 获取有keep-alive子节点的Vnode
|
|
||||||
getVnode() {
|
|
||||||
// 判断子集非空
|
|
||||||
if (this.$children.length == 0) return false;
|
|
||||||
let vnode;
|
|
||||||
for (let item of this.$children) {
|
|
||||||
// 如果data中有key则代表找到了keep-alive下面的子集,这个key就是router-view上的key
|
|
||||||
if (item.$vnode.data.key) {
|
|
||||||
vnode = item.$vnode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return vnode ? vnode : false;
|
|
||||||
},
|
|
||||||
// 移除keep-alive缓存
|
|
||||||
removeCache(name, view = {}) {
|
|
||||||
let vnode = this.getVnode();
|
|
||||||
if (!vnode) return false;
|
|
||||||
let componentInstance = vnode.parent.componentInstance;
|
|
||||||
// 这个key是用来获取前缀用来后面正则匹配用的
|
|
||||||
let keyStart = vnode.key.split("/")[0];
|
|
||||||
let thisKey = `${keyStart}${view.fullPath}`;
|
|
||||||
let regKey = `${keyStart}${view.path}`;
|
|
||||||
|
|
||||||
this[name]({ componentInstance, thisKey, regKey });
|
|
||||||
},
|
|
||||||
// 移除其他
|
|
||||||
closeOthersTags({ componentInstance, thisKey }) {
|
|
||||||
Object.keys(componentInstance.cache).forEach((key, index) => {
|
|
||||||
if (key != thisKey) {
|
|
||||||
// 销毁实例(这里存在多个key指向一个缓存的情况可能前面一个已经清除掉了所有要加判断)
|
|
||||||
if (componentInstance.cache[key]) {
|
|
||||||
componentInstance.cache[key].componentInstance.$destroy();
|
|
||||||
}
|
|
||||||
// 删除缓存
|
|
||||||
delete componentInstance.cache[key];
|
|
||||||
// 移除key中对应的key
|
|
||||||
componentInstance.keys.splice(index, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 移除所有缓存
|
|
||||||
closeAllTags({ componentInstance }) {
|
|
||||||
// 销毁实例
|
|
||||||
Object.keys(componentInstance.cache).forEach((key) => {
|
|
||||||
if (componentInstance.cache[key]) {
|
|
||||||
componentInstance.cache[key].componentInstance.$destroy();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// 删除缓存
|
|
||||||
componentInstance.cache = {};
|
|
||||||
// 移除key中对应的key
|
|
||||||
componentInstance.keys = [];
|
|
||||||
},
|
|
||||||
// 移除单个缓存
|
|
||||||
closeSelectedTag({ componentInstance, regKey }) {
|
|
||||||
let reg = new RegExp(`^${regKey}`);
|
|
||||||
Object.keys(componentInstance.cache).forEach((key, i) => {
|
|
||||||
if (reg.test(key)) {
|
|
||||||
// 销毁实例
|
|
||||||
if (componentInstance.cache[key]) {
|
|
||||||
componentInstance.cache[key].componentInstance.$destroy();
|
|
||||||
}
|
|
||||||
// 删除缓存
|
|
||||||
delete componentInstance.cache[key];
|
|
||||||
// 移除key中对应的key
|
|
||||||
componentInstance.keys.splice(i, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 刷新单个缓存
|
|
||||||
refreshSelectedTag({ componentInstance, thisKey }) {
|
|
||||||
Object.keys(componentInstance.cache).forEach((key, index) => {
|
|
||||||
if (null != thisKey && key.replace("/redirect", "") == thisKey) {
|
|
||||||
// 1 销毁实例(这里存在多个key指向一个缓存的情况可能前面一个已经清除掉了所有要加判断)
|
|
||||||
if (componentInstance.cache[key]) {
|
|
||||||
componentInstance.cache[key].componentInstance.$destroy();
|
|
||||||
}
|
|
||||||
// 2 删除缓存
|
|
||||||
delete componentInstance.cache[key];
|
|
||||||
// 3 移除key中对应的key
|
|
||||||
componentInstance.keys.splice(index, 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -134,7 +31,7 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header + .app-main {
|
.fixed-header+.app-main {
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +41,7 @@ export default {
|
|||||||
min-height: calc(100vh - 84px);
|
min-height: calc(100vh - 84px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header + .app-main {
|
.fixed-header+.app-main {
|
||||||
padding-top: 84px;
|
padding-top: 84px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
mode="vertical"
|
mode="vertical"
|
||||||
>
|
>
|
||||||
<sidebar-item
|
<sidebar-item
|
||||||
v-for="(route, index) in permission_routes"
|
v-for="(route, index) in sidebarRouters"
|
||||||
:key="route.path + index"
|
:key="route.path + index"
|
||||||
:item="route"
|
:item="route"
|
||||||
:base-path="route.path"
|
:base-path="route.path"
|
||||||
@ -33,7 +33,7 @@ export default {
|
|||||||
components: { SidebarItem, Logo },
|
components: { SidebarItem, Logo },
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["settings"]),
|
...mapState(["settings"]),
|
||||||
...mapGetters(["permission_routes", "sidebar"]),
|
...mapGetters(["sidebarRouters", "sidebar"]),
|
||||||
activeMenu() {
|
activeMenu() {
|
||||||
const route = this.$route;
|
const route = this.$route;
|
||||||
const { meta, path } = route;
|
const { meta, path } = route;
|
||||||
|
|||||||
@ -29,7 +29,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import ScrollPane from './ScrollPane'
|
import ScrollPane from './ScrollPane'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import Global from "@/layout/components/global.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { ScrollPane },
|
components: { ScrollPane },
|
||||||
@ -145,7 +144,6 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Global.$emit("removeCache", "refreshSelectedTag", this.selectedTag);
|
|
||||||
},
|
},
|
||||||
closeSelectedTag(view) {
|
closeSelectedTag(view) {
|
||||||
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
|
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
|
||||||
@ -153,14 +151,12 @@ export default {
|
|||||||
this.toLastView(visitedViews, view)
|
this.toLastView(visitedViews, view)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Global.$emit("removeCache", "closeSelectedTag", view);
|
|
||||||
},
|
},
|
||||||
closeOthersTags() {
|
closeOthersTags() {
|
||||||
this.$router.push(this.selectedTag)
|
this.$router.push(this.selectedTag).catch(()=>{});
|
||||||
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
||||||
this.moveToCurrentTag()
|
this.moveToCurrentTag()
|
||||||
})
|
})
|
||||||
Global.$emit("removeCache", "closeOthersTags", this.selectedTag);
|
|
||||||
},
|
},
|
||||||
closeAllTags(view) {
|
closeAllTags(view) {
|
||||||
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
|
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
|
||||||
@ -169,7 +165,6 @@ export default {
|
|||||||
}
|
}
|
||||||
this.toLastView(visitedViews, view)
|
this.toLastView(visitedViews, view)
|
||||||
})
|
})
|
||||||
Global.$emit("removeCache", "closeAllTags");
|
|
||||||
},
|
},
|
||||||
toLastView(visitedViews, view) {
|
toLastView(visitedViews, view) {
|
||||||
const latestView = visitedViews.slice(-1)[0]
|
const latestView = visitedViews.slice(-1)[0]
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
import Vue from 'vue'
|
|
||||||
const global = new Vue()
|
|
||||||
export default global
|
|
||||||
@ -20,9 +20,6 @@ import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels,
|
|||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
// 自定义表格工具扩展
|
// 自定义表格工具扩展
|
||||||
import RightToolbar from "@/components/RightToolbar"
|
import RightToolbar from "@/components/RightToolbar"
|
||||||
// 代码高亮插件
|
|
||||||
import hljs from 'highlight.js'
|
|
||||||
import 'highlight.js/styles/github-gist.css'
|
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
@ -52,7 +49,6 @@ Vue.component('Pagination', Pagination)
|
|||||||
Vue.component('RightToolbar', RightToolbar)
|
Vue.component('RightToolbar', RightToolbar)
|
||||||
|
|
||||||
Vue.use(permission)
|
Vue.use(permission)
|
||||||
Vue.use(hljs.vuePlugin);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you don't want to use mock-server
|
* If you don't want to use mock-server
|
||||||
|
|||||||
@ -23,28 +23,18 @@ router.beforeEach((to, from, next) => {
|
|||||||
// 拉取user_info
|
// 拉取user_info
|
||||||
const roles = res.roles
|
const roles = res.roles
|
||||||
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
store.dispatch('GenerateRoutes', { roles }).then(accessRoutes => {
|
||||||
// 测试 默认静态页面
|
|
||||||
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
|
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||||
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
||||||
})
|
})
|
||||||
})
|
}).catch(err => {
|
||||||
.catch(err => {
|
store.dispatch('LogOut').then(() => {
|
||||||
store.dispatch('FedLogOut').then(() => {
|
|
||||||
Message.error(err)
|
Message.error(err)
|
||||||
next({ path: '/' })
|
next({ path: '/' })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
next()
|
next()
|
||||||
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
|
|
||||||
// if (hasPermission(store.getters.roles, to.meta.roles)) {
|
|
||||||
// next()
|
|
||||||
// } else {
|
|
||||||
// next({ path: '/401', replace: true, query: { noGoBack: true }})
|
|
||||||
// }
|
|
||||||
// 可删 ↑
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ const getters = {
|
|||||||
introduction: state => state.user.introduction,
|
introduction: state => state.user.introduction,
|
||||||
roles: state => state.user.roles,
|
roles: state => state.user.roles,
|
||||||
permissions: state => state.user.permissions,
|
permissions: state => state.user.permissions,
|
||||||
permission_routes: state => state.permission.routes
|
permission_routes: state => state.permission.routes,
|
||||||
|
sidebarRouters:state => state.permission.sidebarRouters,
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|||||||
@ -6,13 +6,17 @@ import ParentView from '@/components/ParentView';
|
|||||||
const permission = {
|
const permission = {
|
||||||
state: {
|
state: {
|
||||||
routes: [],
|
routes: [],
|
||||||
addRoutes: []
|
addRoutes: [],
|
||||||
|
sidebarRouters: []
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_ROUTES: (state, routes) => {
|
SET_ROUTES: (state, routes) => {
|
||||||
state.addRoutes = routes
|
state.addRoutes = routes
|
||||||
state.routes = constantRoutes.concat(routes)
|
state.routes = constantRoutes.concat(routes)
|
||||||
}
|
},
|
||||||
|
SET_SIDEBAR_ROUTERS: (state, routers) => {
|
||||||
|
state.sidebarRouters = constantRoutes.concat(routers)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
// 生成路由
|
// 生成路由
|
||||||
@ -20,10 +24,14 @@ const permission = {
|
|||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
// 向后端请求路由数据
|
// 向后端请求路由数据
|
||||||
getRouters().then(res => {
|
getRouters().then(res => {
|
||||||
const accessedRoutes = filterAsyncRouter(res.data)
|
const sdata = JSON.parse(JSON.stringify(res.data))
|
||||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
const rdata = JSON.parse(JSON.stringify(res.data))
|
||||||
commit('SET_ROUTES', accessedRoutes)
|
const sidebarRoutes = filterAsyncRouter(sdata)
|
||||||
resolve(accessedRoutes)
|
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
||||||
|
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||||
|
commit('SET_ROUTES', rewriteRoutes)
|
||||||
|
commit('SET_SIDEBAR_ROUTERS', sidebarRoutes)
|
||||||
|
resolve(rewriteRoutes)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -31,8 +39,11 @@ const permission = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 遍历后台传来的路由字符串,转换为组件对象
|
// 遍历后台传来的路由字符串,转换为组件对象
|
||||||
function filterAsyncRouter(asyncRouterMap) {
|
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||||
return asyncRouterMap.filter(route => {
|
return asyncRouterMap.filter(route => {
|
||||||
|
if (type && route.children) {
|
||||||
|
route.children = filterChildren(route.children)
|
||||||
|
}
|
||||||
if (route.component) {
|
if (route.component) {
|
||||||
// Layout ParentView 组件特殊处理
|
// Layout ParentView 组件特殊处理
|
||||||
if (route.component === 'Layout') {
|
if (route.component === 'Layout') {
|
||||||
@ -44,14 +55,41 @@ function filterAsyncRouter(asyncRouterMap) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (route.children != null && route.children && route.children.length) {
|
if (route.children != null && route.children && route.children.length) {
|
||||||
route.children = filterAsyncRouter(route.children)
|
route.children = filterAsyncRouter(route.children, route, type)
|
||||||
|
} else {
|
||||||
|
delete route['children']
|
||||||
|
delete route['redirect']
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterChildren(childrenMap, lastRouter = false) {
|
||||||
|
var children = []
|
||||||
|
childrenMap.forEach((el, index) => {
|
||||||
|
if (el.children && el.children.length) {
|
||||||
|
if (el.component === 'ParentView') {
|
||||||
|
el.children.forEach(c => {
|
||||||
|
c.path = el.path + '/' + c.path
|
||||||
|
if (c.children && c.children.length) {
|
||||||
|
children = children.concat(filterChildren(c.children, c))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
children.push(c)
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lastRouter) {
|
||||||
|
el.path = lastRouter.path + '/' + el.path
|
||||||
|
}
|
||||||
|
children = children.concat(el)
|
||||||
|
})
|
||||||
|
return children
|
||||||
|
}
|
||||||
|
|
||||||
export const loadView = (view) => { // 路由懒加载
|
export const loadView = (view) => { // 路由懒加载
|
||||||
return (resolve) => require([`@/views/${view}`], resolve)
|
return (resolve) => require([`@/views/${view}`], resolve)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default permission
|
export default permission
|
||||||
|
|||||||
@ -9,9 +9,10 @@ export function checkPermi(value) {
|
|||||||
if (value && value instanceof Array && value.length > 0) {
|
if (value && value instanceof Array && value.length > 0) {
|
||||||
const permissions = store.getters && store.getters.permissions
|
const permissions = store.getters && store.getters.permissions
|
||||||
const permissionDatas = value
|
const permissionDatas = value
|
||||||
|
const all_permission = "*:*:*";
|
||||||
|
|
||||||
const hasPermission = permissions.some(permission => {
|
const hasPermission = permissions.some(permission => {
|
||||||
return permissionDatas.includes(permission)
|
return all_permission === permission || permissionDatas.includes(permission)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!hasPermission) {
|
if (!hasPermission) {
|
||||||
@ -33,9 +34,10 @@ export function checkRole(value) {
|
|||||||
if (value && value instanceof Array && value.length > 0) {
|
if (value && value instanceof Array && value.length > 0) {
|
||||||
const roles = store.getters && store.getters.roles
|
const roles = store.getters && store.getters.roles
|
||||||
const permissionRoles = value
|
const permissionRoles = value
|
||||||
|
const super_admin = "admin";
|
||||||
|
|
||||||
const hasRole = roles.some(role => {
|
const hasRole = roles.some(role => {
|
||||||
return permissionRoles.includes(role)
|
return super_admin === role || permissionRoles.includes(role)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!hasRole) {
|
if (!hasRole) {
|
||||||
|
|||||||
@ -1,103 +1,103 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { Notification, MessageBox, Message } from 'element-ui'
|
import { Notification, MessageBox, Message } from 'element-ui'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import { getToken } from '@/utils/auth'
|
import { getToken } from '@/utils/auth'
|
||||||
import errorCode from '@/utils/errorCode'
|
import errorCode from '@/utils/errorCode'
|
||||||
|
|
||||||
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
|
||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: process.env.VUE_APP_BASE_API,
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
// 超时
|
// 超时
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
})
|
})
|
||||||
// request拦截器
|
// request拦截器
|
||||||
service.interceptors.request.use(config => {
|
service.interceptors.request.use(config => {
|
||||||
// 是否需要设置 token
|
// 是否需要设置 token
|
||||||
const isToken = (config.headers || {}).isToken === false
|
const isToken = (config.headers || {}).isToken === false
|
||||||
if (getToken() && !isToken) {
|
if (getToken() && !isToken) {
|
||||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||||
}
|
}
|
||||||
// get请求映射params参数
|
// get请求映射params参数
|
||||||
if (config.method === 'get' && config.params) {
|
if (config.method === 'get' && config.params) {
|
||||||
let url = config.url + '?';
|
let url = config.url + '?';
|
||||||
for (const propName of Object.keys(config.params)) {
|
for (const propName of Object.keys(config.params)) {
|
||||||
const value = config.params[propName];
|
const value = config.params[propName];
|
||||||
var part = encodeURIComponent(propName) + "=";
|
var part = encodeURIComponent(propName) + "=";
|
||||||
if (value && typeof(value) !== "undefined") {
|
if (value !== null && typeof(value) !== "undefined") {
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
for (const key of Object.keys(value)) {
|
for (const key of Object.keys(value)) {
|
||||||
let params = propName + '[' + key + ']';
|
let params = propName + '[' + key + ']';
|
||||||
var subPart = encodeURIComponent(params) + "=";
|
var subPart = encodeURIComponent(params) + "=";
|
||||||
url += subPart + encodeURIComponent(value[key]) + "&";
|
url += subPart + encodeURIComponent(value[key]) + "&";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
url += part + encodeURIComponent(value) + "&";
|
url += part + encodeURIComponent(value) + "&";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
url = url.slice(0, -1);
|
url = url.slice(0, -1);
|
||||||
config.params = {};
|
config.params = {};
|
||||||
config.url = url;
|
config.url = url;
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(res => {
|
service.interceptors.response.use(res => {
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || 200;
|
const code = res.data.code || 200;
|
||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||||
if (code === 401) {
|
if (code === 401) {
|
||||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||||
confirmButtonText: '重新登录',
|
confirmButtonText: '重新登录',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}
|
}
|
||||||
).then(() => {
|
).then(() => {
|
||||||
store.dispatch('LogOut').then(() => {
|
store.dispatch('LogOut').then(() => {
|
||||||
location.href = '/index';
|
location.href = '/index';
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else if (code === 500) {
|
} else if (code === 500) {
|
||||||
Message({
|
Message({
|
||||||
message: msg,
|
message: msg,
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
return Promise.reject(new Error(msg))
|
return Promise.reject(new Error(msg))
|
||||||
} else if (code !== 200) {
|
} else if (code !== 200) {
|
||||||
Notification.error({
|
Notification.error({
|
||||||
title: msg
|
title: msg
|
||||||
})
|
})
|
||||||
return Promise.reject('error')
|
return Promise.reject('error')
|
||||||
} else {
|
} else {
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
console.log('err' + error)
|
console.log('err' + error)
|
||||||
let { message } = error;
|
let { message } = error;
|
||||||
if (message == "Network Error") {
|
if (message == "Network Error") {
|
||||||
message = "后端接口连接异常";
|
message = "后端接口连接异常";
|
||||||
}
|
}
|
||||||
else if (message.includes("timeout")) {
|
else if (message.includes("timeout")) {
|
||||||
message = "系统接口请求超时";
|
message = "系统接口请求超时";
|
||||||
}
|
}
|
||||||
else if (message.includes("Request failed with status code")) {
|
else if (message.includes("Request failed with status code")) {
|
||||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||||
}
|
}
|
||||||
Message({
|
Message({
|
||||||
message: message,
|
message: message,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
duration: 5 * 1000
|
duration: 5 * 1000
|
||||||
})
|
})
|
||||||
return Promise.reject(error)
|
return Promise.reject(error)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
export default service
|
export default service
|
||||||
|
|||||||
@ -62,8 +62,8 @@ export function addDateRange(params, dateRange, propName) {
|
|||||||
search.params["beginTime"] = dateRange[0];
|
search.params["beginTime"] = dateRange[0];
|
||||||
search.params["endTime"] = dateRange[1];
|
search.params["endTime"] = dateRange[1];
|
||||||
} else {
|
} else {
|
||||||
search.params[propName + "BeginTime"] = dateRange[0];
|
search.params["begin" + propName] = dateRange[0];
|
||||||
search.params[propName + "EndTime"] = dateRange[1];
|
search.params["end" + propName] = dateRange[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return search;
|
return search;
|
||||||
|
|||||||
@ -146,6 +146,38 @@
|
|||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v3.4.0 - 2021-02-22">
|
||||||
|
<ol>
|
||||||
|
<li>代码生成模板支持主子表</li>
|
||||||
|
<li>表格右侧工具栏组件支持显隐列</li>
|
||||||
|
<li>图片组件添加预览&移除功能</li>
|
||||||
|
<li>Excel注解支持Image图片导出</li>
|
||||||
|
<li>操作按钮组调整为朴素按钮样式</li>
|
||||||
|
<li>代码生成支持文件上传组件</li>
|
||||||
|
<li>代码生成日期控件区分范围</li>
|
||||||
|
<li>代码生成数据库文本类型生成表单文本域</li>
|
||||||
|
<li>用户手机邮箱&菜单组件修改允许空字符串</li>
|
||||||
|
<li>升级SpringBoot到最新版本2.2.13 提升启动速度</li>
|
||||||
|
<li>升级druid到最新版本v1.2.4</li>
|
||||||
|
<li>升级fastjson到最新版1.2.75</li>
|
||||||
|
<li>升级element-ui到最新版本2.15.0</li>
|
||||||
|
<li>修复IE11浏览器报错问题</li>
|
||||||
|
<li>优化多级菜单之间切换无法缓存的问题</li>
|
||||||
|
<li>修复四级菜单无法显示问题</li>
|
||||||
|
<li>修正侧边栏静态路由丢失问题</li>
|
||||||
|
<li>修复角色管理-编辑角色-功能权限显示异常</li>
|
||||||
|
<li>配置文件新增redis数据库索引属性</li>
|
||||||
|
<li>权限工具类增加admin判断</li>
|
||||||
|
<li>角色非自定义权限范围清空选择值</li>
|
||||||
|
<li>修复导入数据为负浮点数时丢失精度问题</li>
|
||||||
|
<li>移除path-to-regexp正则匹配插件</li>
|
||||||
|
<li>修复生成树表代码异常</li>
|
||||||
|
<li>修改ip字段长度防止ipv6地址长度不够</li>
|
||||||
|
<li>防止get请求参数值为false或0等特殊值会导致无法正确的传参</li>
|
||||||
|
<li>登录后push添加catch防止出现检查错误</li>
|
||||||
|
<li>其他细节优化</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v3.3.0 - 2020-12-14">
|
<el-collapse-item title="v3.3.0 - 2020-12-14">
|
||||||
<ol>
|
<ol>
|
||||||
<li>新增缓存监控功能</li>
|
<li>新增缓存监控功能</li>
|
||||||
@ -493,7 +525,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 版本号
|
// 版本号
|
||||||
version: "3.3.0",
|
version: "3.4.0",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<!-- 底部 -->
|
<!-- 底部 -->
|
||||||
<div class="el-login-footer">
|
<div class="el-login-footer">
|
||||||
<span>Copyright © 2018-2020 ruoyi.vip All Rights Reserved.</span>
|
<span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -126,15 +126,12 @@ export default {
|
|||||||
Cookies.remove("password");
|
Cookies.remove("password");
|
||||||
Cookies.remove('rememberMe');
|
Cookies.remove('rememberMe');
|
||||||
}
|
}
|
||||||
this.$store
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||||
.dispatch("Login", this.loginForm)
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||||
.then(() => {
|
}).catch(() => {
|
||||||
this.$router.push({ path: this.redirect || "/" });
|
this.loading = false;
|
||||||
})
|
this.getCode();
|
||||||
.catch(() => {
|
});
|
||||||
this.loading = false;
|
|
||||||
this.getCode();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -40,6 +40,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -49,6 +50,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -59,6 +61,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -69,6 +72,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
@ -78,6 +82,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
|
plain
|
||||||
icon="el-icon-s-operation"
|
icon="el-icon-s-operation"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleJobLog"
|
@click="handleJobLog"
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -65,6 +65,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -75,6 +76,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClean"
|
@click="handleClean"
|
||||||
@ -84,6 +86,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -59,6 +59,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -69,6 +70,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClean"
|
@click="handleClean"
|
||||||
@ -78,6 +80,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -75,6 +75,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -85,6 +86,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClean"
|
@click="handleClean"
|
||||||
@ -94,6 +96,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -53,6 +53,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -62,6 +63,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -72,6 +74,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -82,6 +85,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
@ -91,6 +95,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClearCache"
|
@click="handleClearCache"
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -30,6 +30,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -40,6 +40,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -49,6 +50,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -59,6 +61,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -69,6 +72,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -59,6 +59,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -68,6 +69,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -78,6 +80,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -88,6 +91,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
@ -97,6 +101,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-refresh"
|
icon="el-icon-refresh"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClearCache"
|
@click="handleClearCache"
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -30,6 +30,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -39,6 +39,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -48,6 +49,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -58,6 +60,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -39,6 +39,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -48,6 +49,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -58,6 +60,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -68,6 +71,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -59,6 +59,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -68,6 +69,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -78,6 +80,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -88,6 +91,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
@ -209,7 +213,7 @@
|
|||||||
<el-input v-model="form.roleKey" :disabled="true" />
|
<el-input v-model="form.roleKey" :disabled="true" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="权限范围">
|
<el-form-item label="权限范围">
|
||||||
<el-select v-model="form.dataScope">
|
<el-select v-model="form.dataScope" @change="dataScopeSelectChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dataScopeOptions"
|
v-for="item in dataScopeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@ -509,12 +513,23 @@ export default {
|
|||||||
this.open = true;
|
this.open = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
roleMenu.then(res => {
|
roleMenu.then(res => {
|
||||||
this.$refs.menu.setCheckedKeys(res.checkedKeys);
|
let checkedKeys = res.checkedKeys
|
||||||
|
checkedKeys.forEach((v) => {
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
this.$refs.menu.setChecked(v, true ,false);
|
||||||
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.title = "修改角色";
|
this.title = "修改角色";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 选择角色权限范围触发 */
|
||||||
|
dataScopeSelectChange(value) {
|
||||||
|
if(value !== '2') {
|
||||||
|
this.$refs.dept.setCheckedKeys([]);
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 分配数据权限操作 */
|
/** 分配数据权限操作 */
|
||||||
handleDataScope(row) {
|
handleDataScope(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -86,6 +86,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
@ -95,6 +96,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -105,6 +107,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -115,6 +118,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
|
plain
|
||||||
icon="el-icon-upload2"
|
icon="el-icon-upload2"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleImport"
|
@click="handleImport"
|
||||||
@ -124,23 +128,24 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['system:user:export']"
|
v-hasPermi="['system:user:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column label="用户编号" align="center" prop="userId" />
|
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
||||||
<el-table-column label="用户名称" align="center" prop="userName" :show-overflow-tooltip="true" />
|
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="用户昵称" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="部门" align="center" prop="dept.deptName" :show-overflow-tooltip="true" />
|
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="手机号码" align="center" prop="phonenumber" width="120" />
|
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
||||||
<el-table-column label="状态" align="center">
|
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.status"
|
v-model="scope.row.status"
|
||||||
@ -150,7 +155,7 @@
|
|||||||
></el-switch>
|
></el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
@ -413,6 +418,16 @@ export default {
|
|||||||
status: undefined,
|
status: undefined,
|
||||||
deptId: undefined
|
deptId: undefined
|
||||||
},
|
},
|
||||||
|
// 列信息
|
||||||
|
columns: [
|
||||||
|
{ key: 0, label: `用户编号`, visible: true },
|
||||||
|
{ key: 1, label: `用户名称`, visible: true },
|
||||||
|
{ key: 2, label: `用户昵称`, visible: true },
|
||||||
|
{ key: 3, label: `部门`, visible: true },
|
||||||
|
{ key: 4, label: `手机号码`, visible: true },
|
||||||
|
{ key: 5, label: `状态`, visible: true },
|
||||||
|
{ key: 6, label: `创建时间`, visible: true }
|
||||||
|
],
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
userName: [
|
userName: [
|
||||||
|
|||||||
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updateUserPwd } from "@/api/system/user";
|
import { updateUserPwd } from "@/api/system/user";
|
||||||
import Global from "@/layout/components/global.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@ -65,7 +64,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
Global.$emit("removeCache", "closeSelectedTag", this.$route);
|
|
||||||
this.$store.dispatch("tagsView/delView", this.$route);
|
this.$store.dispatch("tagsView/delView", this.$route);
|
||||||
this.$router.push({ path: "/index" });
|
this.$router.push({ path: "/index" });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updateUserProfile } from "@/api/system/user";
|
import { updateUserProfile } from "@/api/system/user";
|
||||||
import Global from "@/layout/components/global.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -69,7 +68,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
Global.$emit("removeCache", "closeSelectedTag", this.$route);
|
|
||||||
this.$store.dispatch("tagsView/delView", this.$route);
|
this.$store.dispatch("tagsView/delView", this.$route);
|
||||||
this.$router.push({ path: "/index" });
|
this.$router.push({ path: "/index" });
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,8 @@
|
|||||||
<el-option label="单选框" value="radio" />
|
<el-option label="单选框" value="radio" />
|
||||||
<el-option label="复选框" value="checkbox" />
|
<el-option label="复选框" value="checkbox" />
|
||||||
<el-option label="日期控件" value="datetime" />
|
<el-option label="日期控件" value="datetime" />
|
||||||
<el-option label="上传控件" value="uploadImage" />
|
<el-option label="图片上传" value="imageUpload" />
|
||||||
|
<el-option label="文件上传" value="fileUpload" />
|
||||||
<el-option label="富文本控件" value="editor" />
|
<el-option label="富文本控件" value="editor" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
@ -112,7 +113,7 @@
|
|||||||
</el-table>
|
</el-table>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="生成信息" name="genInfo">
|
<el-tab-pane label="生成信息" name="genInfo">
|
||||||
<gen-info-form ref="genInfo" :info="info" :menus="menus"/>
|
<gen-info-form ref="genInfo" :info="info" :tables="tables" :menus="menus"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<el-form label-width="100px">
|
<el-form label-width="100px">
|
||||||
@ -127,7 +128,6 @@
|
|||||||
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
||||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||||
import { listMenu as getMenuTreeselect } from "@/api/system/menu";
|
import { listMenu as getMenuTreeselect } from "@/api/system/menu";
|
||||||
import Global from "@/layout/components/global.js";
|
|
||||||
import basicInfoForm from "./basicInfoForm";
|
import basicInfoForm from "./basicInfoForm";
|
||||||
import genInfoForm from "./genInfoForm";
|
import genInfoForm from "./genInfoForm";
|
||||||
import Sortable from 'sortablejs'
|
import Sortable from 'sortablejs'
|
||||||
@ -144,6 +144,8 @@ export default {
|
|||||||
activeName: "cloum",
|
activeName: "cloum",
|
||||||
// 表格的高度
|
// 表格的高度
|
||||||
tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
||||||
|
// 表信息
|
||||||
|
tables: [],
|
||||||
// 表列信息
|
// 表列信息
|
||||||
cloumns: [],
|
cloumns: [],
|
||||||
// 字典信息
|
// 字典信息
|
||||||
@ -161,6 +163,7 @@ export default {
|
|||||||
getGenTable(tableId).then(res => {
|
getGenTable(tableId).then(res => {
|
||||||
this.cloumns = res.data.rows;
|
this.cloumns = res.data.rows;
|
||||||
this.info = res.data.info;
|
this.info = res.data.info;
|
||||||
|
this.tables = res.data.tables;
|
||||||
});
|
});
|
||||||
/** 查询字典下拉列表 */
|
/** 查询字典下拉列表 */
|
||||||
getDictOptionselect().then(response => {
|
getDictOptionselect().then(response => {
|
||||||
@ -208,7 +211,6 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 关闭按钮 */
|
/** 关闭按钮 */
|
||||||
close() {
|
close() {
|
||||||
Global.$emit("removeCache", "closeSelectedTag", this.$route);
|
|
||||||
this.$store.dispatch("tagsView/delView", this.$route);
|
this.$store.dispatch("tagsView/delView", this.$route);
|
||||||
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
|
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,10 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item prop="tplCategory">
|
<el-form-item prop="tplCategory">
|
||||||
<span slot="label">生成模板</span>
|
<span slot="label">生成模板</span>
|
||||||
<el-select v-model="info.tplCategory">
|
<el-select v-model="info.tplCategory" @change="tplSelectChange">
|
||||||
<el-option label="单表(增删改查)" value="crud" />
|
<el-option label="单表(增删改查)" value="crud" />
|
||||||
<el-option label="树表(增删改查)" value="tree" />
|
<el-option label="树表(增删改查)" value="tree" />
|
||||||
|
<el-option label="主子表(增删改查)" value="sub" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -126,8 +127,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<el-select v-model="info.treeCode" placeholder="请选择">
|
<el-select v-model="info.treeCode" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="column in info.columns"
|
v-for="(column, index) in info.columns"
|
||||||
:key="column.columnName"
|
:key="index"
|
||||||
:label="column.columnName + ':' + column.columnComment"
|
:label="column.columnName + ':' + column.columnComment"
|
||||||
:value="column.columnName"
|
:value="column.columnName"
|
||||||
></el-option>
|
></el-option>
|
||||||
@ -144,8 +145,8 @@
|
|||||||
</span>
|
</span>
|
||||||
<el-select v-model="info.treeParentCode" placeholder="请选择">
|
<el-select v-model="info.treeParentCode" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="column in info.columns"
|
v-for="(column, index) in info.columns"
|
||||||
:key="column.columnName"
|
:key="index"
|
||||||
:label="column.columnName + ':' + column.columnComment"
|
:label="column.columnName + ':' + column.columnComment"
|
||||||
:value="column.columnName"
|
:value="column.columnName"
|
||||||
></el-option>
|
></el-option>
|
||||||
@ -162,8 +163,47 @@
|
|||||||
</span>
|
</span>
|
||||||
<el-select v-model="info.treeName" placeholder="请选择">
|
<el-select v-model="info.treeName" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="column in info.columns"
|
v-for="(column, index) in info.columns"
|
||||||
:key="column.columnName"
|
:key="index"
|
||||||
|
:label="column.columnName + ':' + column.columnComment"
|
||||||
|
:value="column.columnName"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row v-show="info.tplCategory == 'sub'">
|
||||||
|
<h4 class="form-header">关联信息</h4>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item>
|
||||||
|
<span slot="label">
|
||||||
|
关联子表的表名
|
||||||
|
<el-tooltip content="关联子表的表名, 如:sys_user" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
<el-select v-model="info.subTableName" placeholder="请选择" @change="subSelectChange">
|
||||||
|
<el-option
|
||||||
|
v-for="(table, index) in tables"
|
||||||
|
:key="index"
|
||||||
|
:label="table.tableName + ':' + table.tableComment"
|
||||||
|
:value="table.tableName"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item>
|
||||||
|
<span slot="label">
|
||||||
|
子表关联的外键名
|
||||||
|
<el-tooltip content="子表关联的外键名, 如:user_id" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
<el-select v-model="info.subTableFkName" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="(column, index) in subColumns"
|
||||||
|
:key="index"
|
||||||
:label="column.columnName + ':' + column.columnComment"
|
:label="column.columnName + ':' + column.columnComment"
|
||||||
:value="column.columnName"
|
:value="column.columnName"
|
||||||
></el-option>
|
></el-option>
|
||||||
@ -185,6 +225,10 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
|
tables: {
|
||||||
|
type: Array,
|
||||||
|
default: null
|
||||||
|
},
|
||||||
menus: {
|
menus: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: []
|
default: []
|
||||||
@ -192,6 +236,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
subColumns: [],
|
||||||
rules: {
|
rules: {
|
||||||
tplCategory: [
|
tplCategory: [
|
||||||
{ required: true, message: "请选择生成模板", trigger: "blur" }
|
{ required: true, message: "请选择生成模板", trigger: "blur" }
|
||||||
@ -212,6 +257,11 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
|
watch: {
|
||||||
|
'info.subTableName': function(val) {
|
||||||
|
this.setSubTableColumns(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 转换菜单数据结构 */
|
/** 转换菜单数据结构 */
|
||||||
normalizer(node) {
|
normalizer(node) {
|
||||||
@ -223,6 +273,27 @@ export default {
|
|||||||
label: node.menuName,
|
label: node.menuName,
|
||||||
children: node.children
|
children: node.children
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
/** 选择子表名触发 */
|
||||||
|
subSelectChange(value) {
|
||||||
|
this.info.subTableFkName = '';
|
||||||
|
},
|
||||||
|
/** 选择生成模板触发 */
|
||||||
|
tplSelectChange(value) {
|
||||||
|
if(value !== 'sub') {
|
||||||
|
this.info.subTableName = '';
|
||||||
|
this.info.subTableFkName = '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 设置关联外键 */
|
||||||
|
setSubTableColumns(value) {
|
||||||
|
for (var item in this.tables) {
|
||||||
|
const name = this.tables[item].tableName;
|
||||||
|
if (value === name) {
|
||||||
|
this.subColumns = this.tables[item].columns;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -41,6 +41,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleGenTable"
|
@click="handleGenTable"
|
||||||
@ -50,6 +51,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
|
plain
|
||||||
icon="el-icon-upload"
|
icon="el-icon-upload"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="openImportTable"
|
@click="openImportTable"
|
||||||
@ -59,6 +61,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@ -69,6 +72,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@ -80,7 +84,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55"></el-table-column>
|
<el-table-column type="selection" align="center" width="55"></el-table-column>
|
||||||
<el-table-column label="序号" type="index" width="50" align="center">
|
<el-table-column label="序号" type="index" width="50" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||||
@ -165,7 +169,7 @@
|
|||||||
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
:name="key.substring(key.lastIndexOf('/')+1,key.indexOf('.vm'))"
|
||||||
:key="key"
|
:key="key"
|
||||||
>
|
>
|
||||||
<highlightjs autodetect :code="value" />
|
<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>
|
||||||
@ -177,6 +181,14 @@
|
|||||||
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
|
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
|
||||||
import importTable from "./importTable";
|
import importTable from "./importTable";
|
||||||
import { downLoadZip } from "@/utils/zipdownload";
|
import { downLoadZip } from "@/utils/zipdownload";
|
||||||
|
import hljs from "highlight.js/lib/highlight";
|
||||||
|
import "highlight.js/styles/github-gist.css";
|
||||||
|
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
|
||||||
|
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
|
||||||
|
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
|
||||||
|
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml"));
|
||||||
|
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript"));
|
||||||
|
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Gen",
|
name: "Gen",
|
||||||
@ -290,6 +302,13 @@ export default {
|
|||||||
this.preview.open = true;
|
this.preview.open = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/** 高亮显示 */
|
||||||
|
highlightedCode(code, key) {
|
||||||
|
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
|
||||||
|
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
|
||||||
|
const result = hljs.highlight(language, code || "", true);
|
||||||
|
return result.value || ' ';
|
||||||
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.tableId);
|
this.ids = selection.map(item => item.tableId);
|
||||||
|
|||||||
@ -52,7 +52,7 @@ create table sys_user (
|
|||||||
password varchar(100) default '' comment '密码',
|
password varchar(100) default '' comment '密码',
|
||||||
status char(1) default '0' comment '帐号状态(0正常 1停用)',
|
status char(1) default '0' comment '帐号状态(0正常 1停用)',
|
||||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
login_ip varchar(50) default '' comment '最后登录IP',
|
login_ip varchar(128) default '' comment '最后登录IP',
|
||||||
login_date datetime comment '最后登录时间',
|
login_date datetime comment '最后登录时间',
|
||||||
create_by varchar(64) default '' comment '创建者',
|
create_by varchar(64) default '' comment '创建者',
|
||||||
create_time datetime comment '创建时间',
|
create_time datetime comment '创建时间',
|
||||||
@ -421,7 +421,7 @@ create table sys_oper_log (
|
|||||||
oper_name varchar(50) default '' comment '操作人员',
|
oper_name varchar(50) default '' comment '操作人员',
|
||||||
dept_name varchar(50) default '' comment '部门名称',
|
dept_name varchar(50) default '' comment '部门名称',
|
||||||
oper_url varchar(255) default '' comment '请求URL',
|
oper_url varchar(255) default '' comment '请求URL',
|
||||||
oper_ip varchar(50) default '' comment '主机地址',
|
oper_ip varchar(128) default '' comment '主机地址',
|
||||||
oper_location varchar(255) default '' comment '操作地点',
|
oper_location varchar(255) default '' comment '操作地点',
|
||||||
oper_param varchar(2000) default '' comment '请求参数',
|
oper_param varchar(2000) default '' comment '请求参数',
|
||||||
json_result varchar(2000) default '' comment '返回参数',
|
json_result varchar(2000) default '' comment '返回参数',
|
||||||
@ -546,7 +546,7 @@ drop table if exists sys_logininfor;
|
|||||||
create table sys_logininfor (
|
create table sys_logininfor (
|
||||||
info_id bigint(20) not null auto_increment comment '访问ID',
|
info_id bigint(20) not null auto_increment comment '访问ID',
|
||||||
user_name varchar(50) default '' comment '用户账号',
|
user_name varchar(50) default '' comment '用户账号',
|
||||||
ipaddr varchar(50) default '' comment '登录IP地址',
|
ipaddr varchar(128) default '' comment '登录IP地址',
|
||||||
login_location varchar(255) default '' comment '登录地点',
|
login_location varchar(255) default '' comment '登录地点',
|
||||||
browser varchar(50) default '' comment '浏览器类型',
|
browser varchar(50) default '' comment '浏览器类型',
|
||||||
os varchar(50) default '' comment '操作系统',
|
os varchar(50) default '' comment '操作系统',
|
||||||
@ -633,6 +633,8 @@ create table gen_table (
|
|||||||
table_id bigint(20) not null auto_increment comment '编号',
|
table_id bigint(20) not null auto_increment comment '编号',
|
||||||
table_name varchar(200) default '' comment '表名称',
|
table_name varchar(200) default '' comment '表名称',
|
||||||
table_comment varchar(500) default '' comment '表描述',
|
table_comment varchar(500) default '' comment '表描述',
|
||||||
|
sub_table_name varchar(64) default null comment '关联子表的表名',
|
||||||
|
sub_table_fk_name varchar(64) default null comment '子表关联的外键名',
|
||||||
class_name varchar(100) default '' comment '实体类名称',
|
class_name varchar(100) default '' comment '实体类名称',
|
||||||
tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)',
|
tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)',
|
||||||
package_name varchar(100) comment '生成包路径',
|
package_name varchar(100) comment '生成包路径',
|
||||||
Reference in New Issue
Block a user