mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-04-26 09:17:52 +08:00
Compare commits
17 Commits
f02efef9ef
...
springboot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97c94ffc8 | ||
|
|
fc9d7cb4d8 | ||
|
|
24f28090e0 | ||
|
|
48d94f7b48 | ||
|
|
44fa3cebc3 | ||
|
|
6f17a6077e | ||
|
|
c922c9d68c | ||
|
|
c58a9eacde | ||
|
|
f3b34285f3 | ||
|
|
2b26b1457e | ||
|
|
8befe8a1c3 | ||
|
|
6f57599599 | ||
|
|
3b35a0d76a | ||
|
|
27d87d3101 | ||
|
|
a57fbeb1a3 | ||
|
|
9753007f94 | ||
|
|
37143acc77 |
@@ -1,11 +1,11 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
|
<img alt="logo" src="https://oscimg.oschina.net/oscnet/up-b99b286755aef70355a7084753f89cdb7c9.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.7</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">RuoYi v3.6.8</h1>
|
||||||
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
|
<h4 align="center">基于 Vue/Element UI 和 Spring Boot/Spring Cloud & Alibaba 前后端分离的分布式微服务架构</h4>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud/stargazers"><img src="https://gitee.com/y_project/RuoYi-Cloud/badge/star.svg?theme=dark"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.7-brightgreen.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud"><img src="https://img.shields.io/badge/RuoYi-v3.6.8-brightgreen.svg"></a>
|
||||||
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
<a href="https://gitee.com/y_project/RuoYi-Cloud/blob/master/LICENSE"><img src="https://img.shields.io/github/license/mashape/apistatus.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ usage() {
|
|||||||
|
|
||||||
# copy sql
|
# copy sql
|
||||||
echo "begin copy sql "
|
echo "begin copy sql "
|
||||||
cp ../sql/ry_20250523.sql ./mysql/db
|
cp ../sql/ry_20260402.sql ./mysql/db
|
||||||
cp ../sql/ry_config_20250902.sql ./mysql/db
|
cp ../sql/ry_config_20260311.sql ./mysql/db
|
||||||
|
|
||||||
# copy html
|
# copy html
|
||||||
echo "begin copy html "
|
echo "begin copy html "
|
||||||
|
|||||||
4
pom.xml
4
pom.xml
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</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.6.7</ruoyi.version>
|
<ruoyi.version>3.6.8</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>17</java.version>
|
<java.version>17</java.version>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-api</artifactId>
|
<artifactId>ruoyi-api</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.api.domain;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.validation.constraints.*;
|
import jakarta.validation.constraints.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.ruoyi.common.core.annotation.Excel;
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
@@ -68,6 +69,7 @@ public class SysUser extends BaseEntity
|
|||||||
private String loginIp;
|
private String loginIp;
|
||||||
|
|
||||||
/** 最后登录时间 */
|
/** 最后登录时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -142,4 +142,35 @@ public class Constants
|
|||||||
*/
|
*/
|
||||||
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
|
||||||
"org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" };
|
"org.springframework", "org.apache", "com.ruoyi.common.core.utils.file" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门相关常量
|
||||||
|
*/
|
||||||
|
public static class Dept
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 全部数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_ALL = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_CUSTOM = "2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_DEPT = "3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门及以下数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅本人数据权限
|
||||||
|
*/
|
||||||
|
public static final String DATA_SCOPE_SELF = "5";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ public class GenConstants
|
|||||||
/** 上级菜单名称字段 */
|
/** 上级菜单名称字段 */
|
||||||
public static final String PARENT_MENU_NAME = "parentMenuName";
|
public static final String PARENT_MENU_NAME = "parentMenuName";
|
||||||
|
|
||||||
|
/** 生成详情页开关 */
|
||||||
|
public static final String GEN_VIEW = "genView";
|
||||||
|
|
||||||
/** 数据库字符串类型 */
|
/** 数据库字符串类型 */
|
||||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.ruoyi.common.core.utils.poi;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多 Sheet 导出时的数据信息
|
||||||
|
*
|
||||||
|
* 使用示例:
|
||||||
|
* <pre>
|
||||||
|
* List<ExcelSheet<?>> sheets = new ArrayList<>();
|
||||||
|
* sheets.add(new ExcelSheet<>("参数数据", configList, Config.class, "参数信息"));
|
||||||
|
* sheets.add(new ExcelSheet<>("岗位数据", postList, Post.class, "岗位信息"));
|
||||||
|
* return ExcelUtil.exportMultiSheet(sheets);
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public class ExcelSheet<T>
|
||||||
|
{
|
||||||
|
/** Sheet 名称 */
|
||||||
|
private String sheetName;
|
||||||
|
|
||||||
|
/** 导出数据集合 */
|
||||||
|
private List<T> list;
|
||||||
|
|
||||||
|
/** 数据对应的实体 Class */
|
||||||
|
private Class<T> clazz;
|
||||||
|
|
||||||
|
/** Sheet 顶部大标题(可为空) */
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public ExcelSheet(String sheetName, List<T> list, Class<T> clazz)
|
||||||
|
{
|
||||||
|
this(sheetName, list, clazz, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExcelSheet(String sheetName, List<T> list, Class<T> clazz, String title)
|
||||||
|
{
|
||||||
|
this.sheetName = sheetName;
|
||||||
|
this.list = list != null ? list : new ArrayList<>();
|
||||||
|
this.clazz = clazz;
|
||||||
|
this.title = title != null ? title : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSheetName()
|
||||||
|
{
|
||||||
|
return sheetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getList()
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<T> getClazz()
|
||||||
|
{
|
||||||
|
return clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSheetName(String sheetName)
|
||||||
|
{
|
||||||
|
this.sheetName = sheetName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<T> list)
|
||||||
|
{
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClazz(Class<T> clazz)
|
||||||
|
{
|
||||||
|
this.clazz = clazz;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -502,6 +502,82 @@ public class ExcelUtil<T>
|
|||||||
exportExcel(response);
|
exportExcel(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多 Sheet 导出 —— 将多个不同类型的数据集合写入同一 Excel,直接输出到 HttpServletResponse
|
||||||
|
*
|
||||||
|
* @param response HTTP 响应
|
||||||
|
* @param sheets Sheet 描述列表
|
||||||
|
*/
|
||||||
|
public static void exportMultiSheet(HttpServletResponse response, List<ExcelSheet<?>> sheets)
|
||||||
|
{
|
||||||
|
if (sheets == null || sheets.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SXSSFWorkbook wb = buildWorkbook(sheets);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
wb.write(response.getOutputStream());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.error("多Sheet导出Excel异常{}", e.getMessage());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtils.closeQuietly(wb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建多 Sheet Workbook —— 创建 SXSSFWorkbook 并将所有 Sheet 数据写入
|
||||||
|
*
|
||||||
|
* @param sheets Sheet 描述列表
|
||||||
|
* @return 已写入所有 Sheet 数据的 SXSSFWorkbook
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
private static SXSSFWorkbook buildWorkbook(List<ExcelSheet<?>> sheets)
|
||||||
|
{
|
||||||
|
SXSSFWorkbook wb = new SXSSFWorkbook(500);
|
||||||
|
for (ExcelSheet<?> excelSheet : sheets)
|
||||||
|
{
|
||||||
|
ExcelUtil util = new ExcelUtil(excelSheet.getClazz());
|
||||||
|
util.initWithWorkbook(wb, excelSheet.getList(), excelSheet.getSheetName(), excelSheet.getTitle());
|
||||||
|
util.writeSheet();
|
||||||
|
}
|
||||||
|
return wb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用外部传入的 Workbook 初始化(多 Sheet 导出专用)
|
||||||
|
* 与 init() 的区别:不新建 Workbook,而是在已有 wb 上追加新 Sheet
|
||||||
|
*
|
||||||
|
* @param wb 已有工作簿
|
||||||
|
* @param list 数据集合
|
||||||
|
* @param sheetName Sheet 名称
|
||||||
|
* @param title 大标题(可为空)
|
||||||
|
*/
|
||||||
|
public void initWithWorkbook(SXSSFWorkbook wb, List<T> list, String sheetName, String title)
|
||||||
|
{
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
list = new ArrayList<T>();
|
||||||
|
}
|
||||||
|
this.list = list;
|
||||||
|
this.sheetName = sheetName;
|
||||||
|
this.title = title != null ? title : "";
|
||||||
|
this.type = Type.EXPORT;
|
||||||
|
this.rownum = 0;
|
||||||
|
this.wb = wb;
|
||||||
|
this.sheet = wb.createSheet(sheetName);
|
||||||
|
createExcelField();
|
||||||
|
this.styles = createStyles(wb);
|
||||||
|
createTitle();
|
||||||
|
createSubHead();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对list数据源将其里面的数据导入到excel表单
|
* 对list数据源将其里面的数据导入到excel表单
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,25 @@ import java.lang.annotation.Target;
|
|||||||
@Documented
|
@Documented
|
||||||
public @interface DataScope
|
public @interface DataScope
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* 用户表的别名
|
||||||
|
*/
|
||||||
|
public String userAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门表的别名
|
* 部门表的别名
|
||||||
*/
|
*/
|
||||||
public String deptAlias() default "";
|
public String deptAlias() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户表的别名
|
* 用户字段名
|
||||||
*/
|
*/
|
||||||
public String userAlias() default "";
|
public String userField() default "user_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门字段名
|
||||||
|
*/
|
||||||
|
public String deptField() default "dept_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.aspectj.lang.JoinPoint;
|
|||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import com.ruoyi.common.core.constant.Constants;
|
||||||
import com.ruoyi.common.core.constant.UserConstants;
|
import com.ruoyi.common.core.constant.UserConstants;
|
||||||
import com.ruoyi.common.core.context.SecurityContextHolder;
|
import com.ruoyi.common.core.context.SecurityContextHolder;
|
||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
@@ -26,31 +27,6 @@ import com.ruoyi.system.api.model.LoginUser;
|
|||||||
@Component
|
@Component
|
||||||
public class DataScopeAspect
|
public class DataScopeAspect
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 全部数据权限
|
|
||||||
*/
|
|
||||||
public static final String DATA_SCOPE_ALL = "1";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定数据权限
|
|
||||||
*/
|
|
||||||
public static final String DATA_SCOPE_CUSTOM = "2";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门数据权限
|
|
||||||
*/
|
|
||||||
public static final String DATA_SCOPE_DEPT = "3";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门及以下数据权限
|
|
||||||
*/
|
|
||||||
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅本人数据权限
|
|
||||||
*/
|
|
||||||
public static final String DATA_SCOPE_SELF = "5";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据权限过滤关键字
|
* 数据权限过滤关键字
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +50,7 @@ public class DataScopeAspect
|
|||||||
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin())
|
||||||
{
|
{
|
||||||
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission());
|
String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission());
|
||||||
dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), controllerDataScope.userAlias(), permission);
|
dataScopeFilter(joinPoint, currentUser, controllerDataScope.userAlias(), controllerDataScope.deptAlias(), controllerDataScope.userField(), controllerDataScope.deptField(), permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,13 +64,13 @@ public class DataScopeAspect
|
|||||||
* @param userAlias 用户别名
|
* @param userAlias 用户别名
|
||||||
* @param permission 权限字符
|
* @param permission 权限字符
|
||||||
*/
|
*/
|
||||||
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission)
|
public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String userAlias, String deptAlias, String userField, String deptField, String permission)
|
||||||
{
|
{
|
||||||
StringBuilder sqlString = new StringBuilder();
|
StringBuilder sqlString = new StringBuilder();
|
||||||
List<String> conditions = new ArrayList<String>();
|
List<String> conditions = new ArrayList<String>();
|
||||||
List<String> scopeCustomIds = new ArrayList<String>();
|
List<String> scopeCustomIds = new ArrayList<String>();
|
||||||
user.getRoles().forEach(role -> {
|
user.getRoles().forEach(role -> {
|
||||||
if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && (StringUtils.isEmpty(permission) || StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))))
|
if (Constants.Dept.DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.equals(role.getStatus(), UserConstants.ROLE_NORMAL) && (StringUtils.isEmpty(permission) || StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))))
|
||||||
{
|
{
|
||||||
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
|
scopeCustomIds.add(Convert.toStr(role.getRoleId()));
|
||||||
}
|
}
|
||||||
@@ -111,42 +87,42 @@ public class DataScopeAspect
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DATA_SCOPE_ALL.equals(dataScope))
|
if (Constants.Dept.DATA_SCOPE_ALL.equals(dataScope))
|
||||||
{
|
{
|
||||||
sqlString = new StringBuilder();
|
sqlString = new StringBuilder();
|
||||||
conditions.add(dataScope);
|
conditions.add(dataScope);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (DATA_SCOPE_CUSTOM.equals(dataScope))
|
else if (Constants.Dept.DATA_SCOPE_CUSTOM.equals(dataScope))
|
||||||
{
|
{
|
||||||
if (scopeCustomIds.size() > 1)
|
if (scopeCustomIds.size() > 1)
|
||||||
{
|
{
|
||||||
// 多个自定数据权限使用in查询,避免多次拼接。
|
// 多个自定数据权限使用in查询,避免多次拼接。
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptAlias, String.join(",", scopeCustomIds)));
|
sqlString.append(StringUtils.format(" OR {}.{} IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptAlias, deptField, String.join(",", scopeCustomIds)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, role.getRoleId()));
|
sqlString.append(StringUtils.format(" OR {}.{} IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, deptField, role.getRoleId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (DATA_SCOPE_DEPT.equals(dataScope))
|
else if (Constants.Dept.DATA_SCOPE_DEPT.equals(dataScope))
|
||||||
{
|
{
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
sqlString.append(StringUtils.format(" OR {}.{} = {} ", deptAlias, deptField, user.getDeptId()));
|
||||||
}
|
}
|
||||||
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
|
else if (Constants.Dept.DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
|
||||||
{
|
{
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptAlias, user.getDeptId(), user.getDeptId()));
|
sqlString.append(StringUtils.format(" OR {}.{} IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptAlias, deptField, user.getDeptId(), user.getDeptId()));
|
||||||
}
|
}
|
||||||
else if (DATA_SCOPE_SELF.equals(dataScope))
|
else if (Constants.Dept.DATA_SCOPE_SELF.equals(dataScope))
|
||||||
{
|
{
|
||||||
if (StringUtils.isNotBlank(userAlias))
|
if (StringUtils.isNotBlank(userAlias))
|
||||||
{
|
{
|
||||||
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
sqlString.append(StringUtils.format(" OR {}.{} = {} ", userAlias, userField, user.getUserId()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
sqlString.append(StringUtils.format(" OR {}.{} = 0 ", deptAlias, deptField));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conditions.add(dataScope);
|
conditions.add(dataScope);
|
||||||
@@ -155,7 +131,7 @@ public class DataScopeAspect
|
|||||||
// 角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据
|
// 角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据
|
||||||
if (StringUtils.isEmpty(conditions))
|
if (StringUtils.isEmpty(conditions))
|
||||||
{
|
{
|
||||||
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
sqlString.append(StringUtils.format(" OR {}.{} = 0 ", deptAlias, deptField));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(sqlString.toString()))
|
if (StringUtils.isNotBlank(sqlString.toString()))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ public class GenTable extends BaseEntity
|
|||||||
@NotBlank(message = "作者不能为空")
|
@NotBlank(message = "作者不能为空")
|
||||||
private String functionAuthor;
|
private String functionAuthor;
|
||||||
|
|
||||||
|
/** 表单布局(单列 双列 三列) */
|
||||||
|
private Integer formColNum;
|
||||||
|
|
||||||
/** 生成代码方式(0zip压缩包 1自定义路径) */
|
/** 生成代码方式(0zip压缩包 1自定义路径) */
|
||||||
private String genType;
|
private String genType;
|
||||||
|
|
||||||
@@ -98,6 +101,9 @@ public class GenTable extends BaseEntity
|
|||||||
/** 上级菜单名称字段 */
|
/** 上级菜单名称字段 */
|
||||||
private String parentMenuName;
|
private String parentMenuName;
|
||||||
|
|
||||||
|
/** 是否生成详情页 */
|
||||||
|
private boolean isView;
|
||||||
|
|
||||||
public Long getTableId()
|
public Long getTableId()
|
||||||
{
|
{
|
||||||
return tableId;
|
return tableId;
|
||||||
@@ -228,6 +234,16 @@ public class GenTable extends BaseEntity
|
|||||||
this.functionAuthor = functionAuthor;
|
this.functionAuthor = functionAuthor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getFormColNum()
|
||||||
|
{
|
||||||
|
return formColNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormColNum(Integer formColNum)
|
||||||
|
{
|
||||||
|
this.formColNum = formColNum;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGenType()
|
public String getGenType()
|
||||||
{
|
{
|
||||||
return genType;
|
return genType;
|
||||||
@@ -338,6 +354,16 @@ public class GenTable extends BaseEntity
|
|||||||
this.parentMenuName = parentMenuName;
|
this.parentMenuName = parentMenuName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isView()
|
||||||
|
{
|
||||||
|
return isView;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setView(boolean isView)
|
||||||
|
{
|
||||||
|
this.isView = isView;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSub()
|
public boolean isSub()
|
||||||
{
|
{
|
||||||
return isSub(this.tplCategory);
|
return isSub(this.tplCategory);
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||||
for (String template : templates)
|
for (String template : templates)
|
||||||
{
|
{
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
@@ -253,10 +253,10 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||||
for (String template : templates)
|
for (String template : templates)
|
||||||
{
|
{
|
||||||
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm"))
|
if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "api.ts.vm", "type.ts.vm", "index.ts.vm", "index.vue.vm", "index-tree.vue.vm", "view.vue.vm"))
|
||||||
{
|
{
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
@@ -371,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||||
|
|
||||||
// 获取模板列表
|
// 获取模板列表
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||||
for (String template : templates)
|
for (String template : templates)
|
||||||
{
|
{
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
@@ -524,12 +524,14 @@ public class GenTableServiceImpl implements IGenTableService
|
|||||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||||
Long parentMenuId = paramsObj.getLongValue(GenConstants.PARENT_MENU_ID);
|
Long parentMenuId = paramsObj.getLongValue(GenConstants.PARENT_MENU_ID);
|
||||||
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
|
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
|
||||||
|
boolean isView = paramsObj.getBooleanValue(GenConstants.GEN_VIEW);
|
||||||
|
|
||||||
genTable.setTreeCode(treeCode);
|
genTable.setTreeCode(treeCode);
|
||||||
genTable.setTreeParentCode(treeParentCode);
|
genTable.setTreeParentCode(treeParentCode);
|
||||||
genTable.setTreeName(treeName);
|
genTable.setTreeName(treeName);
|
||||||
genTable.setParentMenuId(parentMenuId);
|
genTable.setParentMenuId(parentMenuId);
|
||||||
genTable.setParentMenuName(parentMenuName);
|
genTable.setParentMenuName(parentMenuName);
|
||||||
|
genTable.setView(isView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.ruoyi.gen.domain.GenTable;
|
|||||||
import com.ruoyi.gen.domain.GenTableColumn;
|
import com.ruoyi.gen.domain.GenTableColumn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板工具类
|
* 模板处理工具类
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +60,7 @@ public class VelocityUtils
|
|||||||
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
||||||
velocityContext.put("packageName", packageName);
|
velocityContext.put("packageName", packageName);
|
||||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||||
|
velocityContext.put("colSpan", getColSpan(genTable.getFormColNum()));
|
||||||
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));
|
velocityContext.put("importList", getImportList(genTable));
|
||||||
@@ -67,6 +68,7 @@ public class VelocityUtils
|
|||||||
velocityContext.put("columns", genTable.getColumns());
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
velocityContext.put("dicts", getDicts(genTable));
|
velocityContext.put("dicts", getDicts(genTable));
|
||||||
|
setExtensionsContext(velocityContext, genTable.getOptions());
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory))
|
if (GenConstants.TPL_TREE.equals(tplCategory))
|
||||||
{
|
{
|
||||||
@@ -79,6 +81,13 @@ public class VelocityUtils
|
|||||||
return velocityContext;
|
return velocityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setExtensionsContext(VelocityContext context, String options)
|
||||||
|
{
|
||||||
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
||||||
|
boolean genView = genView(paramsObj);
|
||||||
|
context.put("genView", genView);
|
||||||
|
}
|
||||||
|
|
||||||
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
|
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
|
||||||
{
|
{
|
||||||
String options = genTable.getOptions();
|
String options = genTable.getOptions();
|
||||||
@@ -133,8 +142,12 @@ public class VelocityUtils
|
|||||||
* @param tplWebType 前端类型
|
* @param tplWebType 前端类型
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getTemplateList(String tplCategory, String tplWebType)
|
public static List<String> getTemplateList(GenTable table)
|
||||||
{
|
{
|
||||||
|
String tplWebType = table.getTplWebType();
|
||||||
|
String tplCategory = table.getTplCategory();
|
||||||
|
JSONObject paramsObj = JSONObject.parseObject(table.getOptions());
|
||||||
|
boolean isView = genView(paramsObj);
|
||||||
String useWebType = "vm/vue";
|
String useWebType = "vm/vue";
|
||||||
String apiTemplate = "vm/js/api.js.vm";
|
String apiTemplate = "vm/js/api.js.vm";
|
||||||
if (StringUtils.equals(ELEMENT_PLUS, tplWebType))
|
if (StringUtils.equals(ELEMENT_PLUS, tplWebType))
|
||||||
@@ -173,6 +186,10 @@ public class VelocityUtils
|
|||||||
templates.add(useWebType + "/index.vue.vm");
|
templates.add(useWebType + "/index.vue.vm");
|
||||||
templates.add("vm/java/sub-domain.java.vm");
|
templates.add("vm/java/sub-domain.java.vm");
|
||||||
}
|
}
|
||||||
|
if (isView)
|
||||||
|
{
|
||||||
|
templates.add(useWebType + "/view.vue.vm");
|
||||||
|
}
|
||||||
return templates;
|
return templates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +269,10 @@ public class VelocityUtils
|
|||||||
{
|
{
|
||||||
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName);
|
||||||
}
|
}
|
||||||
|
else if (template.contains("view.vue.vm"))
|
||||||
|
{
|
||||||
|
fileName = StringUtils.format("{}/views/{}/{}/view.vue", vuePath, moduleName, businessName);
|
||||||
|
}
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,6 +414,21 @@ public class VelocityUtils
|
|||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展功能/生成详情页
|
||||||
|
*
|
||||||
|
* @param paramsObj 生成其他选项
|
||||||
|
* @return 是否生成详细页
|
||||||
|
*/
|
||||||
|
public static boolean genView(JSONObject paramsObj)
|
||||||
|
{
|
||||||
|
if (StringUtils.isNotNull(paramsObj) && paramsObj.containsKey(GenConstants.GEN_VIEW))
|
||||||
|
{
|
||||||
|
return paramsObj.getBoolean(GenConstants.GEN_VIEW);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取树名称
|
* 获取树名称
|
||||||
*
|
*
|
||||||
@@ -434,4 +470,23 @@ public class VelocityUtils
|
|||||||
}
|
}
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表单 el-col span
|
||||||
|
*
|
||||||
|
* @param formColNum 表单布局方式(1单列 2双列 3三列)
|
||||||
|
* @return span 数值字符串
|
||||||
|
*/
|
||||||
|
public static String getColSpan(int formColNum)
|
||||||
|
{
|
||||||
|
if (formColNum == 2)
|
||||||
|
{
|
||||||
|
return "12";
|
||||||
|
}
|
||||||
|
else if (formColNum == 3)
|
||||||
|
{
|
||||||
|
return "8";
|
||||||
|
}
|
||||||
|
return "24";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<set>
|
<set>
|
||||||
<if test="columnComment != null">column_comment = #{columnComment},</if>
|
<if test="columnComment != null">column_comment = #{columnComment},</if>
|
||||||
<if test="javaType != null">java_type = #{javaType},</if>
|
<if test="javaType != null">java_type = #{javaType},</if>
|
||||||
|
<if test="columnType != null">column_type = #{columnType},</if>
|
||||||
<if test="javaField != null">java_field = #{javaField},</if>
|
<if test="javaField != null">java_field = #{javaField},</if>
|
||||||
<if test="isInsert != null">is_insert = #{isInsert},</if>
|
<if test="isInsert != null">is_insert = #{isInsert},</if>
|
||||||
<if test="isEdit != null">is_edit = #{isEdit},</if>
|
<if test="isEdit != null">is_edit = #{isEdit},</if>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="businessName" column="business_name" />
|
<result property="businessName" column="business_name" />
|
||||||
<result property="functionName" column="function_name" />
|
<result property="functionName" column="function_name" />
|
||||||
<result property="functionAuthor" column="function_author" />
|
<result property="functionAuthor" column="function_author" />
|
||||||
|
<result property="formColNum" column="form_col_num" />
|
||||||
<result property="genType" column="gen_type" />
|
<result property="genType" column="gen_type" />
|
||||||
<result property="genPath" column="gen_path" />
|
<result property="genPath" column="gen_path" />
|
||||||
<result property="options" column="options" />
|
<result property="options" column="options" />
|
||||||
@@ -55,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableVo">
|
<sql id="selectGenTableVo">
|
||||||
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, tpl_web_type, 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, tpl_web_type, package_name, module_name, business_name, function_name, function_author, form_col_num, 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">
|
||||||
@@ -112,7 +113,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.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, 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.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.form_col_num, 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
|
||||||
@@ -120,7 +121,7 @@ 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.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.tpl_web_type, 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.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.form_col_num, 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
|
||||||
@@ -128,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<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.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, 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.tpl_web_type, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.form_col_num, 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
|
||||||
@@ -147,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="businessName != null and businessName != ''">business_name,</if>
|
<if test="businessName != null and businessName != ''">business_name,</if>
|
||||||
<if test="functionName != null and functionName != ''">function_name,</if>
|
<if test="functionName != null and functionName != ''">function_name,</if>
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
|
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
|
||||||
|
<if test="formColNum != null">form_col_num,</if>
|
||||||
<if test="genType != null and genType != ''">gen_type,</if>
|
<if test="genType != null and genType != ''">gen_type,</if>
|
||||||
<if test="genPath != null and genPath != ''">gen_path,</if>
|
<if test="genPath != null and genPath != ''">gen_path,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
@@ -163,6 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
<if test="businessName != null and businessName != ''">#{businessName},</if>
|
||||||
<if test="functionName != null and functionName != ''">#{functionName},</if>
|
<if test="functionName != null and functionName != ''">#{functionName},</if>
|
||||||
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
|
||||||
|
<if test="formColNum != null">#{formColNum},</if>
|
||||||
<if test="genType != null and genType != ''">#{genType},</if>
|
<if test="genType != null and genType != ''">#{genType},</if>
|
||||||
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
@@ -180,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</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="formColNum != null">form_col_num = #{formColNum},</if>
|
||||||
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
|
||||||
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
||||||
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
||||||
|
|||||||
@@ -139,6 +139,15 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-view"
|
||||||
|
@click="handleViewData(scope.row)"
|
||||||
|
v-hasPermi="['${permissionPrefix}:query']"
|
||||||
|
>详情</el-button>
|
||||||
|
#end
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -164,9 +173,21 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -179,100 +200,127 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
<el-col :span="${colSpan}">
|
||||||
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
|
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||||
</el-form-item>
|
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "input")
|
#elseif($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="yyyy-MM-dd"
|
type="date"
|
||||||
placeholder="选择${comment}">
|
value-format="yyyy-MM-dd"
|
||||||
</el-date-picker>
|
placeholder="选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
@@ -284,6 +332,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
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"
|
||||||
|
|
||||||
@@ -293,6 +344,9 @@ export default {
|
|||||||
dicts: [${dicts}],
|
dicts: [${dicts}],
|
||||||
#end
|
#end
|
||||||
components: {
|
components: {
|
||||||
|
#if($genView)
|
||||||
|
${BusinessName}ViewDrawer,
|
||||||
|
#end
|
||||||
Treeselect
|
Treeselect
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -448,6 +502,12 @@ export default {
|
|||||||
this.refreshTable = true
|
this.refreshTable = true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
#if($genView)
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
handleViewData(row) {
|
||||||
|
this.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
},
|
||||||
|
#end
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset()
|
this.reset()
|
||||||
|
|||||||
@@ -153,6 +153,15 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-view"
|
||||||
|
@click="handleViewData(scope.row)"
|
||||||
|
v-hasPermi="['${permissionPrefix}:query']"
|
||||||
|
>详情</el-button>
|
||||||
|
#end
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -179,9 +188,21 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -194,96 +215,121 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if($column.htmlType == "input")
|
#if($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in dict.type.${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in dict.type.${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="yyyy-MM-dd"
|
type="date"
|
||||||
placeholder="请选择${comment}">
|
value-format="yyyy-MM-dd"
|
||||||
</el-date-picker>
|
placeholder="请选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@@ -354,9 +400,15 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "${BusinessName}",
|
name: "${BusinessName}",
|
||||||
|
#if($genView)
|
||||||
|
components: { ${BusinessName}ViewDrawer },
|
||||||
|
#end
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
dicts: [${dicts}],
|
dicts: [${dicts}],
|
||||||
#end
|
#end
|
||||||
@@ -493,7 +545,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.${pkColumn.javaField})
|
this.ids = selection.map(item => item.${pkColumn.javaField})
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
@@ -590,6 +642,12 @@ export default {
|
|||||||
handle${subClassName}SelectionChange(selection) {
|
handle${subClassName}SelectionChange(selection) {
|
||||||
this.checked${subClassName} = selection.map(item => item.index)
|
this.checked${subClassName} = selection.map(item => item.index)
|
||||||
},
|
},
|
||||||
|
#end
|
||||||
|
#if($genView)
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
handleViewData(row) {
|
||||||
|
this.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
},
|
||||||
#end
|
#end
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
|
|||||||
@@ -136,6 +136,9 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button link type="primary" icon="View" @click="handleViewData(scope.row)" v-hasPermi="['${permissionPrefix}:query']">详情</el-button>
|
||||||
|
#end
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
|
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
@@ -143,9 +146,21 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" v-model="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -158,107 +173,134 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
<el-col :span="${colSpan}">
|
||||||
<el-tree-select
|
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||||
v-model="form.${treeParentCode}"
|
<el-tree-select
|
||||||
:data="${businessName}Options"
|
v-model="form.${treeParentCode}"
|
||||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
:data="${businessName}Options"
|
||||||
value-key="${treeCode}"
|
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||||
placeholder="请选择${comment}"
|
value-key="${treeCode}"
|
||||||
check-strictly
|
placeholder="请选择${comment}"
|
||||||
/>
|
check-strictly
|
||||||
</el-form-item>
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "input")
|
#elseif($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in ${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="YYYY-MM-DD"
|
type="date"
|
||||||
placeholder="选择${comment}">
|
value-format="YYYY-MM-DD"
|
||||||
</el-date-picker>
|
placeholder="选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -272,11 +314,14 @@
|
|||||||
|
|
||||||
<script setup name="${BusinessName}">
|
<script setup name="${BusinessName}">
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const ${businessName}List = ref([])
|
const ${businessName}List = ref([])
|
||||||
@@ -299,7 +344,7 @@ const data = reactive({
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@@ -356,13 +401,13 @@ function getTreeselect() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
@@ -414,6 +459,13 @@ function toggleExpandAll() {
|
|||||||
refreshTable.value = true
|
refreshTable.value = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
#if($genView)
|
||||||
|
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
function handleViewData(row) {
|
||||||
|
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
async function handleUpdate(row) {
|
async function handleUpdate(row) {
|
||||||
@@ -444,13 +496,13 @@ function submitForm() {
|
|||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
if (form.value.${pkColumn.javaField} != null) {
|
if (form.value.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(form.value).then(response => {
|
update${BusinessName}(form.value).then(() => {
|
||||||
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(form.value).then(response => {
|
add${BusinessName}(form.value).then(() => {
|
||||||
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
|
|||||||
@@ -148,6 +148,9 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button link type="primary" icon="View" @click="handleViewData(scope.row)" v-hasPermi="['${permissionPrefix}:query']">详情</el-button>
|
||||||
|
#end
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -162,9 +165,21 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" v-model="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -177,96 +192,121 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if($column.htmlType == "input")
|
#if($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in ${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="YYYY-MM-DD"
|
type="date"
|
||||||
placeholder="请选择${comment}">
|
value-format="YYYY-MM-DD"
|
||||||
</el-date-picker>
|
placeholder="请选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@@ -277,9 +317,13 @@
|
|||||||
<el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">删除</el-button>
|
<el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
<el-table :data="${subclassName}List" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
||||||
<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="index" width="50"/>
|
<el-table-column label="序号" width="60">
|
||||||
|
<template #default="{ $index }">
|
||||||
|
{{ $index + 1 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
#foreach($column in $subTable.columns)
|
#foreach($column in $subTable.columns)
|
||||||
#set($javaField=$column.javaField)
|
#set($javaField=$column.javaField)
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
@@ -344,11 +388,14 @@
|
|||||||
|
|
||||||
<script setup name="${BusinessName}">
|
<script setup name="${BusinessName}">
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const ${businessName}List = ref([])
|
const ${businessName}List = ref([])
|
||||||
@@ -380,7 +427,7 @@ const data = reactive({
|
|||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
#if($column.query)
|
#if($column.query)
|
||||||
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
},
|
},
|
||||||
@@ -428,13 +475,13 @@ function getList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
@@ -469,7 +516,7 @@ function resetQuery() {
|
|||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.${pkColumn.javaField})
|
ids.value = selection.map(item => item.${pkColumn.javaField})
|
||||||
single.value = selection.length != 1
|
single.value = selection.length != 1
|
||||||
@@ -515,13 +562,13 @@ function submitForm() {
|
|||||||
form.value.${subclassName}List = ${subclassName}List.value
|
form.value.${subclassName}List = ${subclassName}List.value
|
||||||
#end
|
#end
|
||||||
if (form.value.${pkColumn.javaField} != null) {
|
if (form.value.${pkColumn.javaField} != null) {
|
||||||
update${BusinessName}(form.value).then(response => {
|
update${BusinessName}(form.value).then(() => {
|
||||||
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
add${BusinessName}(form.value).then(response => {
|
add${BusinessName}(form.value).then(() => {
|
||||||
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
@@ -543,18 +590,13 @@ function handleDelete(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
/** ${subTable.functionName}序号 */
|
|
||||||
function row${subClassName}Index({ row, rowIndex }) {
|
|
||||||
row.index = rowIndex + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
/** ${subTable.functionName}添加按钮操作 */
|
/** ${subTable.functionName}添加按钮操作 */
|
||||||
function handleAdd${subClassName}() {
|
function handleAdd${subClassName}() {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
#foreach($column in $subTable.columns)
|
#foreach($column in $subTable.columns)
|
||||||
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
||||||
#elseif($column.list && "" != $javaField)
|
#elseif($column.list && "" != $javaField)
|
||||||
obj.$column.javaField = ""
|
obj.$column.javaField = undefined
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
${subclassName}List.value.push(obj)
|
${subclassName}List.value.push(obj)
|
||||||
@@ -578,6 +620,13 @@ function handle${subClassName}SelectionChange(selection) {
|
|||||||
checked${subClassName}.value = selection.map(item => item.index)
|
checked${subClassName}.value = selection.map(item => item.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#end
|
||||||
|
#if($genView)
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
function handleViewData(row) {
|
||||||
|
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
}
|
||||||
|
|
||||||
#end
|
#end
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="${functionName}详情" v-model="visible" direction="rtl" size="60%" append-to-body :before-close="handleClose" class="detail-drawer">
|
||||||
|
<div v-loading="loading" class="drawer-content">
|
||||||
|
<h4 class="section-header">基本信息</h4>
|
||||||
|
#set($i = 0)
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if(!$column.pk && $column.list)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#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($i % 2 == 0)
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
#end
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">${comment}:</label>
|
||||||
|
<span class="info-value plaintext">
|
||||||
|
#if("" != $dictType)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="${dictType}" :value="info.${javaField} ? info.${javaField}.split(',') : []" />
|
||||||
|
#else
|
||||||
|
<dict-tag :options="${dictType}" :value="info.${javaField}" />
|
||||||
|
#end
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
{{ parseTime(info.${javaField}, '{y}-{m}-{d}') }}
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<image-preview :src="info.${javaField}" :width="60" :height="60" />
|
||||||
|
#else
|
||||||
|
{{ info.${javaField} }}
|
||||||
|
#end
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
#set($i = $i + 1)
|
||||||
|
#if($i % 2 == 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($i % 2 != 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="${BusinessName}ViewDrawer">
|
||||||
|
import { get${BusinessName} } from '@/api/${moduleName}/${businessName}'
|
||||||
|
|
||||||
|
#if(${dicts} != '')
|
||||||
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
|
#end
|
||||||
|
|
||||||
|
const visible = ref(false)
|
||||||
|
const loading = ref(false)
|
||||||
|
const info = reactive({})
|
||||||
|
|
||||||
|
const open = async (${pkColumn.javaField}) => {
|
||||||
|
visible.value = true
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await get${BusinessName}(${pkColumn.javaField})
|
||||||
|
Object.assign(info, res.data || {})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取${functionName}信息失败:', error)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
visible.value = false
|
||||||
|
Object.keys(info).forEach(key => delete info[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
@@ -136,6 +136,9 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button link type="primary" icon="View" @click="handleViewData(scope.row)" v-hasPermi="['${permissionPrefix}:query']">详情</el-button>
|
||||||
|
#end
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
|
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['${permissionPrefix}:add']">新增</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
@@ -143,9 +146,21 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" v-model="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -158,107 +173,134 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
<el-col :span="${colSpan}">
|
||||||
<el-tree-select
|
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||||
v-model="form.${treeParentCode}"
|
<el-tree-select
|
||||||
:data="${businessName}Options"
|
v-model="form.${treeParentCode}"
|
||||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
:data="${businessName}Options"
|
||||||
value-key="${treeCode}"
|
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||||
placeholder="请选择${comment}"
|
value-key="${treeCode}"
|
||||||
check-strictly
|
placeholder="请选择${comment}"
|
||||||
/>
|
check-strictly
|
||||||
</el-form-item>
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "input")
|
#elseif($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in ${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="YYYY-MM-DD"
|
type="date"
|
||||||
placeholder="选择${comment}">
|
value-format="YYYY-MM-DD"
|
||||||
</el-date-picker>
|
placeholder="选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -272,13 +314,16 @@
|
|||||||
|
|
||||||
<script setup lang="ts" name="${BusinessName}">
|
<script setup lang="ts" name="${BusinessName}">
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||||
import type { TreeSelect } from '@/types/api/common'
|
import type { TreeSelect } from '@/types/api/common'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const ${businessName}List = ref<any[]>([])
|
const ${businessName}List = ref<any[]>([])
|
||||||
@@ -358,13 +403,13 @@ function getTreeselect() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
@@ -416,6 +461,13 @@ function toggleExpandAll() {
|
|||||||
refreshTable.value = true
|
refreshTable.value = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
#if($genView)
|
||||||
|
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
function handleViewData(row: ${ClassName}) {
|
||||||
|
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
async function handleUpdate(row: ${ClassName}) {
|
async function handleUpdate(row: ${ClassName}) {
|
||||||
|
|||||||
@@ -148,6 +148,9 @@
|
|||||||
#end
|
#end
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
#if($genView)
|
||||||
|
<el-button link type="primary" icon="View" @click="handleViewData(scope.row)" v-hasPermi="['${permissionPrefix}:query']">详情</el-button>
|
||||||
|
#end
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${permissionPrefix}:edit']">修改</el-button>
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
@@ -162,9 +165,21 @@
|
|||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
#if($genView)
|
||||||
|
<!-- ${functionName}详情抽屉 -->
|
||||||
|
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||||
|
#end
|
||||||
<!-- 添加或修改${functionName}对话框 -->
|
<!-- 添加或修改${functionName}对话框 -->
|
||||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
#if($table.formColNum == 2)
|
||||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
#set($dialogWidth = "800px")
|
||||||
|
#elseif($table.formColNum == 3)
|
||||||
|
#set($dialogWidth = "1100px")
|
||||||
|
#else
|
||||||
|
#set($dialogWidth = "500px")
|
||||||
|
#end
|
||||||
|
<el-dialog :title="title" v-model="open" width="${dialogWidth}" append-to-body>
|
||||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-row>
|
||||||
#foreach($column in $columns)
|
#foreach($column in $columns)
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
#if($column.insert && !$column.pk)
|
#if($column.insert && !$column.pk)
|
||||||
@@ -177,96 +192,121 @@
|
|||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
#if($column.htmlType == "input")
|
#if($column.htmlType == "input")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "imageUpload")
|
#elseif($column.htmlType == "imageUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<image-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<image-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "fileUpload")
|
#elseif($column.htmlType == "fileUpload")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<file-upload v-model="form.${field}"/>
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<file-upload v-model="form.${field}"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "editor")
|
#elseif($column.htmlType == "editor")
|
||||||
<el-form-item label="${comment}">
|
<el-col :span="24">
|
||||||
<editor v-model="form.${field}" :min-height="192"/>
|
<el-form-item label="${comment}">
|
||||||
</el-form-item>
|
<editor v-model="form.${field}" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
v-for="dict in ${dictType}"
|
<el-option
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.label"
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:value="parseInt(dict.value)"
|
:value="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
#end
|
#end
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "select" && $dictType)
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||||
</el-select>
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox
|
<el-checkbox-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-checkbox
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
:label="dict.value">
|
:key="dict.value"
|
||||||
{{dict.label}}
|
:label="dict.value">
|
||||||
</el-checkbox>
|
{{dict.label}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-checkbox-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-checkbox>请选择字典生成</el-checkbox>
|
<el-checkbox-group v-model="form.${field}">
|
||||||
</el-checkbox-group>
|
<el-checkbox>请选择字典生成</el-checkbox>
|
||||||
</el-form-item>
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio
|
<el-radio-group v-model="form.${field}">
|
||||||
v-for="dict in ${dictType}"
|
<el-radio
|
||||||
:key="dict.value"
|
v-for="dict in ${dictType}"
|
||||||
|
:key="dict.value"
|
||||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||||
:label="parseInt(dict.value)"
|
:label="parseInt(dict.value)"
|
||||||
#else
|
#else
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
#end
|
#end
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "radio" && $dictType)
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-radio-group v-model="form.${field}">
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
<el-radio label="1">请选择字典生成</el-radio>
|
<el-radio-group v-model="form.${field}">
|
||||||
</el-radio-group>
|
<el-radio label="1">请选择字典生成</el-radio>
|
||||||
</el-form-item>
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "datetime")
|
#elseif($column.htmlType == "datetime")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="${colSpan}">
|
||||||
<el-date-picker clearable
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
v-model="form.${field}"
|
<el-date-picker clearable
|
||||||
type="date"
|
v-model="form.${field}"
|
||||||
value-format="YYYY-MM-DD"
|
type="date"
|
||||||
placeholder="请选择${comment}">
|
value-format="YYYY-MM-DD"
|
||||||
</el-date-picker>
|
placeholder="请选择${comment}">
|
||||||
</el-form-item>
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#elseif($column.htmlType == "textarea")
|
#elseif($column.htmlType == "textarea")
|
||||||
<el-form-item label="${comment}" prop="${field}">
|
<el-col :span="24">
|
||||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
<el-form-item label="${comment}" prop="${field}">
|
||||||
</el-form-item>
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
</el-row>
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@@ -346,18 +386,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts" name="Config">
|
<script setup lang="ts" name="${BusinessName}">
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
import type { ${ClassName}, ${subClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
import type { ${ClassName}, ${subClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||||
#else
|
#else
|
||||||
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||||
#end
|
#end
|
||||||
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"
|
||||||
|
#if($genView)
|
||||||
|
import ${BusinessName}ViewDrawer from "./view"
|
||||||
|
#end
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
#if(${dicts} != '')
|
#if(${dicts} != '')
|
||||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
#end
|
#end
|
||||||
|
|
||||||
const ${businessName}List = ref<${ClassName}[]>([])
|
const ${businessName}List = ref<${ClassName}[]>([])
|
||||||
@@ -437,13 +480,13 @@ function getList() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消按钮
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false
|
open.value = false
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单重置
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
#foreach ($column in $columns)
|
#foreach ($column in $columns)
|
||||||
@@ -478,7 +521,7 @@ function resetQuery() {
|
|||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 多选框选中数据
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection: ${ClassName}[]) {
|
function handleSelectionChange(selection: ${ClassName}[]) {
|
||||||
ids.value = selection.map(item => item.${pkColumn.javaField})
|
ids.value = selection.map(item => item.${pkColumn.javaField})
|
||||||
single.value = selection.length != 1
|
single.value = selection.length != 1
|
||||||
@@ -582,6 +625,13 @@ function handle${subClassName}SelectionChange(selection: any[]) {
|
|||||||
checked${subClassName}.value = selection.map(item => item.index)
|
checked${subClassName}.value = selection.map(item => item.index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#end
|
||||||
|
#if($genView)
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
function handleViewData(row: ${ClassName}) {
|
||||||
|
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||||
|
}
|
||||||
|
|
||||||
#end
|
#end
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="${functionName}详情" v-model="visible" direction="rtl" size="60%" append-to-body :before-close="handleClose" class="detail-drawer">
|
||||||
|
<div v-loading="loading" class="drawer-content">
|
||||||
|
<h4 class="section-header">基本信息</h4>
|
||||||
|
#set($i = 0)
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if(!$column.pk && $column.list)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#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($i % 2 == 0)
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
#end
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">${comment}:</label>
|
||||||
|
<span class="info-value plaintext">
|
||||||
|
#if("" != $dictType)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="${dictType}" :value="info.${javaField} ? info.${javaField}.split(',') : []" />
|
||||||
|
#else
|
||||||
|
<dict-tag :options="${dictType}" :value="info.${javaField}" />
|
||||||
|
#end
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
{{ parseTime(info.${javaField}, '{y}-{m}-{d}') }}
|
||||||
|
#elseif($column.htmlType == "imageUpload")
|
||||||
|
<image-preview :src="info.${javaField}" :width="60" :height="60" />
|
||||||
|
#else
|
||||||
|
{{ info.${javaField} }}
|
||||||
|
#end
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
#set($i = $i + 1)
|
||||||
|
#if($i % 2 == 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($i % 2 != 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts" name="${BusinessName}ViewDrawer">
|
||||||
|
import type { ${ClassName} } from "@/types/api/${moduleName}/${businessName}"
|
||||||
|
import { get${BusinessName} } from '@/api/${moduleName}/${businessName}'
|
||||||
|
#if(${dicts} != '')
|
||||||
|
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||||
|
|
||||||
|
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||||
|
#end
|
||||||
|
|
||||||
|
const visible = ref<boolean>(false)
|
||||||
|
const loading = ref<boolean>(false)
|
||||||
|
const info = reactive<Partial<${ClassName}>>({})
|
||||||
|
|
||||||
|
const open = async (#if($pkColumn.javaType == "Long" || $pkColumn.javaType == "Integer")${pkColumn.javaField}: number#else${pkColumn.javaField}: string#end): Promise<void> => {
|
||||||
|
visible.value = true
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const res = await get${BusinessName}(${pkColumn.javaField})
|
||||||
|
Object.assign(info, res.data ?? {})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取${functionName}信息失败:', error)
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = (): void => {
|
||||||
|
visible.value = false
|
||||||
|
Object.keys(info).forEach(key => delete (info as any)[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ open })
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="${functionName}详情" :visible.sync="visible" direction="rtl" size="60%" append-to-body :before-close="handleClose" custom-class="detail-drawer">
|
||||||
|
<div v-loading="loading" class="drawer-content">
|
||||||
|
<h4 class="section-header">基本信息</h4>
|
||||||
|
#set($i = 0)
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if(!$column.pk && $column.list)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#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($i % 2 == 0)
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
#end
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">${comment}:</label>
|
||||||
|
<span class="info-value plaintext">
|
||||||
|
#if("" != $dictType)
|
||||||
|
#if($column.htmlType == "checkbox")
|
||||||
|
<dict-tag :options="dict.type.${dictType}" :value="info.${javaField} ? info.${javaField}.split(',') : []" />
|
||||||
|
#else
|
||||||
|
<dict-tag :options="dict.type.${dictType}" :value="info.${javaField}" />
|
||||||
|
#end
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
{{ parseTime(info.${javaField}, '{y}-{m}-{d}') }}
|
||||||
|
#else
|
||||||
|
{{ info.${javaField} }}
|
||||||
|
#end
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
#set($i = $i + 1)
|
||||||
|
#if($i % 2 == 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($i % 2 != 0)
|
||||||
|
</el-row>
|
||||||
|
#end
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { get${BusinessName} } from '@/api/${moduleName}/${businessName}'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: '${BusinessName}ViewDrawer',
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if("" != $column.dictType)
|
||||||
|
#set($hasDicts = true)
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($hasDicts)
|
||||||
|
dicts: [#foreach($column in $columns)#if("" != $column.dictType)'${column.dictType}'#if($foreach.hasNext), #end#end#end],
|
||||||
|
#end
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
info: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(${pkColumn.javaField}) {
|
||||||
|
this.visible = true
|
||||||
|
this.loading = true
|
||||||
|
get${BusinessName}(${pkColumn.javaField}).then(res => {
|
||||||
|
this.info = res.data || {}
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-modules</artifactId>
|
<artifactId>ruoyi-modules</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ public class SysNoticeController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 根据通知公告编号获取详细信息
|
* 根据通知公告编号获取详细信息
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:query")
|
|
||||||
@GetMapping(value = "/{noticeId}")
|
@GetMapping(value = "/{noticeId}")
|
||||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||||
{
|
{
|
||||||
@@ -125,6 +124,19 @@ public class SysNoticeController extends BaseController
|
|||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已读用户列表数据
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:notice:list")
|
||||||
|
@GetMapping("/readUsers/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo readUsersList(Long noticeId, String searchValue)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<?> list = noticeReadService.selectReadUsersByNoticeId(noticeId, searchValue);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除通知公告
|
* 删除通知公告
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -189,11 +189,18 @@ public class SysUserController extends BaseController
|
|||||||
ajax.put("user", user);
|
ajax.put("user", user);
|
||||||
ajax.put("roles", roles);
|
ajax.put("roles", roles);
|
||||||
ajax.put("permissions", permissions);
|
ajax.put("permissions", permissions);
|
||||||
|
ajax.put("pwdChrtype", getSysAccountChrtype());
|
||||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||||
return ajax;
|
return ajax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取用户密码自定义配置规则
|
||||||
|
public String getSysAccountChrtype()
|
||||||
|
{
|
||||||
|
return Convert.toStr(configService.selectConfigByKey("sys.account.chrtype"), "0");
|
||||||
|
}
|
||||||
|
|
||||||
// 检查初始密码是否提醒修改
|
// 检查初始密码是否提醒修改
|
||||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.ruoyi.system.domain.SysNoticeRead;
|
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.domain.SysNoticeRead;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告已读记录 数据层
|
* 公告已读记录 数据层
|
||||||
@@ -55,6 +56,15 @@ public interface SysNoticeReadMapper
|
|||||||
*/
|
*/
|
||||||
public List<SysNotice> selectNoticeListWithReadStatus(@Param("userId") Long userId, @Param("limit") int limit);
|
public List<SysNotice> selectNoticeListWithReadStatus(@Param("userId") Long userId, @Param("limit") int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已阅读某公告的用户列表
|
||||||
|
*
|
||||||
|
* @param noticeId 公告ID
|
||||||
|
* @param searchValue 搜索值
|
||||||
|
* @return 已读用户列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectReadUsersByNoticeId(@Param("noticeId") Long noticeId, @Param("searchValue") String searchValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告删除时清理对应已读记录
|
* 公告删除时清理对应已读记录
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +44,15 @@ public interface ISysNoticeReadService
|
|||||||
*/
|
*/
|
||||||
public void markReadBatch(Long userId, Long[] noticeIds);
|
public void markReadBatch(Long userId, Long[] noticeIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已阅读某公告的用户列表
|
||||||
|
*
|
||||||
|
* @param noticeId 公告ID
|
||||||
|
* @param searchValue 搜索值
|
||||||
|
* @return 已读用户列表
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> selectReadUsersByNoticeId(Long noticeId, String searchValue);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除公告时清理对应已读记录
|
* 删除公告时清理对应已读记录
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public interface ISysNoticeService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeById(Long noticeId);
|
public int deleteNoticeById(Long noticeId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除公告信息
|
* 批量删除公告信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.system.domain.SysNoticeRead;
|
|
||||||
import com.ruoyi.system.domain.SysNotice;
|
import com.ruoyi.system.domain.SysNotice;
|
||||||
|
import com.ruoyi.system.domain.SysNoticeRead;
|
||||||
import com.ruoyi.system.mapper.SysNoticeReadMapper;
|
import com.ruoyi.system.mapper.SysNoticeReadMapper;
|
||||||
import com.ruoyi.system.service.ISysNoticeReadService;
|
import com.ruoyi.system.service.ISysNoticeReadService;
|
||||||
|
|
||||||
@@ -62,6 +63,15 @@ public class SysNoticeReadServiceImpl implements ISysNoticeReadService
|
|||||||
noticeReadMapper.insertNoticeReadBatch(userId, noticeIds);
|
noticeReadMapper.insertNoticeReadBatch(userId, noticeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已阅读某公告的用户列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectReadUsersByNoticeId(Long noticeId, String searchValue)
|
||||||
|
{
|
||||||
|
return noticeReadMapper.selectReadUsersByNoticeId(noticeId, searchValue);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除公告时清理对应已读记录
|
* 删除公告时清理对应已读记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -63,4 +63,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!-- 查询已阅读某公告的用户列表,支持按登录名/用户名模糊筛选 -->
|
||||||
|
<select id="selectReadUsersByNoticeId" resultType="java.util.Map">
|
||||||
|
select
|
||||||
|
u.user_id as userId,
|
||||||
|
u.user_name as userName,
|
||||||
|
u.nick_name as nickName,
|
||||||
|
d.dept_name as deptName,
|
||||||
|
u.phonenumber as phonenumber,
|
||||||
|
r.read_time as readTime
|
||||||
|
from sys_notice_read r
|
||||||
|
inner join sys_user u on u.user_id = r.user_id and u.del_flag = '0'
|
||||||
|
left join sys_dept d on d.dept_id = u.dept_id
|
||||||
|
where r.notice_id = #{noticeId}
|
||||||
|
<if test="searchValue != null and searchValue != ''">
|
||||||
|
and (
|
||||||
|
u.user_name like concat('%', #{searchValue}, '%')
|
||||||
|
or u.nick_name like concat('%', #{searchValue}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
order by r.read_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<sql id="selectUserVo">
|
||||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.remark,
|
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.pwd_update_date, u.create_by, u.create_time, u.update_by, u.update_time, u.remark,
|
||||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||||
from sys_user u
|
from sys_user u
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi",
|
"name": "ruoyi",
|
||||||
"version": "3.6.7",
|
"version": "3.6.8",
|
||||||
"description": "若依管理系统",
|
"description": "若依管理系统",
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -40,7 +40,6 @@
|
|||||||
"quill": "2.0.2",
|
"quill": "2.0.2",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
"splitpanes": "2.4.1",
|
|
||||||
"vue": "2.6.12",
|
"vue": "2.6.12",
|
||||||
"vue-count-to": "1.0.13",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
|
|||||||
@@ -68,3 +68,12 @@ export function markNoticeReadAll(ids) {
|
|||||||
params: { ids }
|
params: { ids }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询公告已读用户列表
|
||||||
|
export function listNoticeReadUsers(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/notice/readUsers/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -233,6 +233,55 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 详细卡片样式 */
|
/** 详细卡片样式 */
|
||||||
|
.detail-drawer {
|
||||||
|
.el-drawer__header {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
padding: 8px 12px 6px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #303133;
|
||||||
|
background: #f8f8f8;
|
||||||
|
}
|
||||||
|
.section-header {
|
||||||
|
font-size: 15px;
|
||||||
|
color: #6379bb;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
margin: 12px 0 16px 0;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
.drawer-content {
|
||||||
|
padding: 0 20px 20px 20px;
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 8px 0;
|
||||||
|
min-height: 40px;
|
||||||
|
}
|
||||||
|
.info-label {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 200px;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding-top: 4px;
|
||||||
|
text-align: right;
|
||||||
|
margin-right: 14px;
|
||||||
|
}
|
||||||
|
.info-value {
|
||||||
|
flex: 1;
|
||||||
|
color: #303133;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.6;
|
||||||
|
word-break: break-all;
|
||||||
|
padding-top: 4px;
|
||||||
|
min-height: 1.6em;
|
||||||
|
&.plaintext {
|
||||||
|
border-bottom: 1px dashed #dde1e6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.detail-wrap { padding: 0 4px; }
|
.detail-wrap { padding: 0 4px; }
|
||||||
|
|
||||||
.detail-card {
|
.detail-card {
|
||||||
@@ -324,6 +373,28 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* tree-sidebar content */
|
||||||
|
.tree-sidebar-manage-wrap {
|
||||||
|
display: flex;
|
||||||
|
gap: 0;
|
||||||
|
min-height: calc(100vh - 130px);
|
||||||
|
padding: 0 !important;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-sidebar-content {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.content-inner {
|
||||||
|
padding: 12px 16px;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* error */
|
/* error */
|
||||||
.error-title { color: #c0392b !important; }
|
.error-title { color: #c0392b !important; }
|
||||||
.error-title i { color: #c0392b !important; }
|
.error-title i { color: #c0392b !important; }
|
||||||
@@ -398,6 +469,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 拖拽列样式 */
|
/* 拖拽列样式 */
|
||||||
|
.allowDrag { cursor: grab; }
|
||||||
|
.allowDrag:active { cursor: grabbing; }
|
||||||
|
|
||||||
.sortable-ghost {
|
.sortable-ghost {
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
@@ -408,8 +482,3 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 分割面板样式 */
|
|
||||||
.splitpanes.default-theme .splitpanes__pane {
|
|
||||||
background-color: #fff!important;
|
|
||||||
}
|
|
||||||
|
|||||||
126
ruoyi-ui/src/components/ExcelImportDialog/index.vue
Normal file
126
ruoyi-ui/src/components/ExcelImportDialog/index.vue
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :visible.sync="visible" :width="width" append-to-body @close="handleClose">
|
||||||
|
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="headers" :action="uploadUrl" :disabled="isUploading" :on-progress="handleProgress" :on-success="handleSuccess" :auto-upload="false" drag>
|
||||||
|
<i class="el-icon-upload"></i>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
<div class="el-upload__tip text-center" slot="tip">
|
||||||
|
<div class="el-upload__tip" slot="tip">
|
||||||
|
<el-checkbox v-model="updateSupport"> {{ updateSupportLabel }} </el-checkbox>
|
||||||
|
</div>
|
||||||
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
|
<el-link v-if="templateUrl" type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="handleDownloadTemplate">下载模板</el-link>
|
||||||
|
</div>
|
||||||
|
</el-upload>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleSubmit">确 定</el-button>
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getToken } from '@/utils/auth'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
// 对话框标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '数据导入'
|
||||||
|
},
|
||||||
|
// 对话框宽度
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '400px'
|
||||||
|
},
|
||||||
|
// 上传接口地址(必传)
|
||||||
|
action: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
// 模板下载接口地址,不传则不显示下载模板链接
|
||||||
|
templateAction: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 模板文件名
|
||||||
|
templateFileName: {
|
||||||
|
type: String,
|
||||||
|
default: 'template'
|
||||||
|
},
|
||||||
|
// 覆盖更新勾选框的说明文字
|
||||||
|
updateSupportLabel: {
|
||||||
|
type: String,
|
||||||
|
default: '是否更新已经存在的数据'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
isUploading: false,
|
||||||
|
updateSupport: false,
|
||||||
|
headers: { Authorization: 'Bearer ' + getToken() }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
uploadUrl() {
|
||||||
|
return process.env.VUE_APP_BASE_API + this.action + '?updateSupport=' + (this.updateSupport ? 1 : 0)
|
||||||
|
},
|
||||||
|
templateUrl() {
|
||||||
|
return !!this.templateAction
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 打开对话框(供父组件通过 ref 调用)
|
||||||
|
open() {
|
||||||
|
this.updateSupport = false
|
||||||
|
this.isUploading = false
|
||||||
|
this.visible = true
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (this.$refs.uploadRef) {
|
||||||
|
this.$refs.uploadRef.clearFiles()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 关闭时清理
|
||||||
|
handleClose() {
|
||||||
|
this.isUploading = false
|
||||||
|
if (this.$refs.uploadRef) {
|
||||||
|
this.$refs.uploadRef.clearFiles()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下载模板
|
||||||
|
handleDownloadTemplate() {
|
||||||
|
this.download(this.templateAction, {}, `${this.templateFileName}_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
// 上传进度
|
||||||
|
handleProgress() {
|
||||||
|
this.isUploading = true
|
||||||
|
},
|
||||||
|
// 上传成功
|
||||||
|
handleSuccess(response) {
|
||||||
|
this.visible = false
|
||||||
|
this.isUploading = false
|
||||||
|
if (this.$refs.uploadRef) {
|
||||||
|
this.$refs.uploadRef.clearFiles()
|
||||||
|
}
|
||||||
|
this.$alert("<div style='overflow:auto;overflow-x:hidden;max-height:70vh;padding:10px 20px 0;'>" + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
|
||||||
|
this.$emit('success')
|
||||||
|
},
|
||||||
|
// 提交上传
|
||||||
|
handleSubmit() {
|
||||||
|
const files = this.$refs.uploadRef.uploadFiles
|
||||||
|
if (!files || files.length === 0) {
|
||||||
|
this.$modal.msgError('请选择要上传的文件。')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const name = files[0].name.toLowerCase()
|
||||||
|
if (!name.endsWith('.xls') && !name.endsWith('.xlsx')) {
|
||||||
|
this.$modal.msgError('请选择后缀为 "xls" 或 "xlsx" 的文件。')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$refs.uploadRef.submit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -38,6 +38,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "RightToolbar",
|
name: "RightToolbar",
|
||||||
data() {
|
data() {
|
||||||
@@ -76,6 +78,11 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
default: 10
|
default: 10
|
||||||
},
|
},
|
||||||
|
/* 列显隐状态记忆的 localStorage key(传入则启用记忆,不传则不记忆) */
|
||||||
|
storageKey: {
|
||||||
|
type: String,
|
||||||
|
default: ""
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
style() {
|
style() {
|
||||||
@@ -103,6 +110,23 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
// 如果传入了 storageKey,从 localStorage 恢复列显隐状态
|
||||||
|
if (this.storageKey) {
|
||||||
|
try {
|
||||||
|
const saved = cache.local.getJSON(this.storageKey)
|
||||||
|
if (saved && typeof saved === 'object') {
|
||||||
|
if (Array.isArray(this.columns)) {
|
||||||
|
this.columns.forEach((col, index) => {
|
||||||
|
if (saved[index] !== undefined) col.visible = saved[index]
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Object.keys(this.columns).forEach(key => {
|
||||||
|
if (saved[key] !== undefined) this.columns[key].visible = saved[key]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
if (this.showColumnsType == 'transfer') {
|
if (this.showColumnsType == 'transfer') {
|
||||||
// transfer穿梭显隐列初始默认隐藏列
|
// transfer穿梭显隐列初始默认隐藏列
|
||||||
if (Array.isArray(this.columns)) {
|
if (Array.isArray(this.columns)) {
|
||||||
@@ -168,6 +192,7 @@ export default {
|
|||||||
this.columns[key].visible = !data.includes(index)
|
this.columns[key].visible = !data.includes(index)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.saveStorage()
|
||||||
},
|
},
|
||||||
// 打开显隐列dialog
|
// 打开显隐列dialog
|
||||||
showColumn() {
|
showColumn() {
|
||||||
@@ -180,6 +205,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.columns[key].visible = event
|
this.columns[key].visible = event
|
||||||
}
|
}
|
||||||
|
this.saveStorage()
|
||||||
},
|
},
|
||||||
// 切换全选/反选
|
// 切换全选/反选
|
||||||
toggleCheckAll() {
|
toggleCheckAll() {
|
||||||
@@ -189,6 +215,20 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
Object.values(this.columns).forEach((col) => (col.visible = newValue))
|
Object.values(this.columns).forEach((col) => (col.visible = newValue))
|
||||||
}
|
}
|
||||||
|
this.saveStorage()
|
||||||
|
},
|
||||||
|
// 将当前列显隐状态持久化到 localStorage
|
||||||
|
saveStorage() {
|
||||||
|
if (!this.storageKey) return
|
||||||
|
try {
|
||||||
|
let state = {}
|
||||||
|
if (Array.isArray(this.columns)) {
|
||||||
|
this.columns.forEach((col, index) => { state[index] = col.visible })
|
||||||
|
} else {
|
||||||
|
Object.keys(this.columns).forEach(key => { state[key] = this.columns[key].visible })
|
||||||
|
}
|
||||||
|
cache.local.setJSON(this.storageKey, state)
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
709
ruoyi-ui/src/components/TreePanel/index.vue
Normal file
709
ruoyi-ui/src/components/TreePanel/index.vue
Normal file
@@ -0,0 +1,709 @@
|
|||||||
|
<template>
|
||||||
|
<div class="tree-sidebar" :class="{ collapsed: collapsed, resizing: isResizing, 'no-initial-transition': isLoadingFromStorage}" :style="{ width: sidebarWidth + 'px' }">
|
||||||
|
<!-- 右侧拖动条 -->
|
||||||
|
<div v-if="!collapsed" class="resize-handle" @mousedown="startResize" @touchstart="startResize" :class="{ active: isResizing }" />
|
||||||
|
<div class="tree-header">
|
||||||
|
<span class="tree-title" v-show="!collapsed">
|
||||||
|
<i :class="titleIconClass"></i> {{ title }}
|
||||||
|
</span>
|
||||||
|
<div class="tree-actions" v-show="!collapsed">
|
||||||
|
<el-tooltip :content="isExpandedAll ? '收起全部' : '展开全部'" placement="right">
|
||||||
|
<i class="tree-action-icon" :class="isExpandedAll ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" @click="toggleExpandAll" />
|
||||||
|
</el-tooltip>
|
||||||
|
<el-tooltip content="刷新" placement="right">
|
||||||
|
<i class="tree-action-icon el-icon-refresh" @click="handleRefresh" />
|
||||||
|
</el-tooltip>
|
||||||
|
<slot name="actions"></slot>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 侧边栏展开/收起按钮 -->
|
||||||
|
<div class="collapse-button-container">
|
||||||
|
<el-tooltip :content="collapsed ? '展开' : '收起'" placement="right">
|
||||||
|
<i class="collapse-button" :class="collapsed ? 'el-icon-d-arrow-right' : 'el-icon-d-arrow-left'" @click="toggleCollapsed" />
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tree-search" v-show="!collapsed" v-if="showSearch">
|
||||||
|
<el-input v-model="searchKeyword" :placeholder="searchPlaceholder" clearable size="small" prefix-icon="el-icon-search" @input="onSearch" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tree-wrap" v-show="!collapsed">
|
||||||
|
<el-tree
|
||||||
|
ref="treeRef"
|
||||||
|
:data="treeData"
|
||||||
|
:props="treeProps"
|
||||||
|
:expand-on-click-node="expandOnClickNode"
|
||||||
|
:filter-node-method="filterNodeMethod"
|
||||||
|
:default-expand-all="defaultExpandAll"
|
||||||
|
:default-expanded-keys="defaultExpandedKeys"
|
||||||
|
:node-key="nodeKey"
|
||||||
|
:check-strictly="checkStrictly"
|
||||||
|
:show-checkbox="showCheckbox"
|
||||||
|
@node-click="onNodeClick"
|
||||||
|
@check="onCheck"
|
||||||
|
@node-expand="onNodeExpand"
|
||||||
|
@node-collapse="onNodeCollapse"
|
||||||
|
>
|
||||||
|
<span class="tree-node" slot-scope="{ node, data }">
|
||||||
|
<slot name="node" :node="node" :data="data">
|
||||||
|
<i :class="data.children && data.children.length ? 'el-icon-folder' : 'el-icon-document'" class="node-icon" />
|
||||||
|
<span class="node-label" :title="node.label">{{ node.label }}</span>
|
||||||
|
</slot>
|
||||||
|
</span>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "TreeSidebar",
|
||||||
|
props: {
|
||||||
|
// 树形数据
|
||||||
|
treeData: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
// 标题
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '树形结构'
|
||||||
|
},
|
||||||
|
// 标题图标类名
|
||||||
|
titleIconClass: {
|
||||||
|
type: String,
|
||||||
|
default: 'el-icon-office-building'
|
||||||
|
},
|
||||||
|
// 是否显示搜索框
|
||||||
|
showSearch: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 搜索框占位符
|
||||||
|
searchPlaceholder: {
|
||||||
|
type: String,
|
||||||
|
default: '请输入名称'
|
||||||
|
},
|
||||||
|
// 是否默认收起侧边栏
|
||||||
|
defaultCollapsed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 树配置项
|
||||||
|
treeProps: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
children: "children",
|
||||||
|
label: "label"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 节点唯一标识字段
|
||||||
|
nodeKey: {
|
||||||
|
type: String,
|
||||||
|
default: 'id'
|
||||||
|
},
|
||||||
|
// 是否在点击节点时展开或收起
|
||||||
|
expandOnClickNode: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 是否显示复选框
|
||||||
|
showCheckbox: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 是否严格的遵循父子不互相关联
|
||||||
|
checkStrictly: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 是否默认展开所有节点
|
||||||
|
defaultExpandAll: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 默认展开的节点的key数组
|
||||||
|
defaultExpandedKeys: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
// 默认宽度
|
||||||
|
defaultWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 220
|
||||||
|
},
|
||||||
|
// 收起时的宽度
|
||||||
|
collapsedWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 20
|
||||||
|
},
|
||||||
|
// 最小宽度
|
||||||
|
minWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 180
|
||||||
|
},
|
||||||
|
// 最大宽度
|
||||||
|
maxWidth: {
|
||||||
|
type: Number,
|
||||||
|
default: 400
|
||||||
|
},
|
||||||
|
// 本地存储的宽度key
|
||||||
|
storageKey: {
|
||||||
|
type: String,
|
||||||
|
default: 'tree-sidebar-width'
|
||||||
|
},
|
||||||
|
// 是否启用本地存储宽度
|
||||||
|
enableStorage: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
// 自定义过滤方法
|
||||||
|
filterMethod: {
|
||||||
|
type: Function,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchKeyword: "",
|
||||||
|
collapsed: this.defaultCollapsed,
|
||||||
|
sidebarWidth: this.defaultCollapsed ? this.collapsedWidth : this.defaultWidth,
|
||||||
|
isResizing: false,
|
||||||
|
startX: 0,
|
||||||
|
startWidth: 0,
|
||||||
|
saveWidthTimer: null,
|
||||||
|
rafId: null,
|
||||||
|
isLoadingFromStorage: false,
|
||||||
|
expandedAll: this.defaultExpandAll
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 计算当前是否全部展开
|
||||||
|
isExpandedAll: {
|
||||||
|
get() {
|
||||||
|
return this.expandedAll;
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.expandedAll = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
collapsed(newVal, oldVal) {
|
||||||
|
if (newVal !== oldVal) {
|
||||||
|
this.handleCollapseChange(newVal);
|
||||||
|
this.$emit("collapsed-change", newVal);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 监听内部展开状态变化,触发实际树的展开/收起
|
||||||
|
expandedAll(newVal) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
if (newVal) {
|
||||||
|
this.expandAllNodes();
|
||||||
|
} else {
|
||||||
|
this.collapseAllNodes();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.$emit("expanded-all-change", newVal);
|
||||||
|
},
|
||||||
|
// 监听搜索关键词
|
||||||
|
searchKeyword(val) {
|
||||||
|
if (this.$refs.treeRef) {
|
||||||
|
this.$refs.treeRef.filter(val);
|
||||||
|
this.$emit("search", val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.isLoadingFromStorage = true
|
||||||
|
if (!this.collapsed && this.enableStorage) {
|
||||||
|
const savedWidth = this.getSavedWidth();
|
||||||
|
if (savedWidth !== null) {
|
||||||
|
this.sidebarWidth = savedWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.isLoadingFromStorage = false
|
||||||
|
})
|
||||||
|
if (this.expandedAll) {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.expandAllNodes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.cleanup();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 节点过滤方法
|
||||||
|
filterNodeMethod(value, data) {
|
||||||
|
if (this.filterMethod) {
|
||||||
|
return this.filterMethod(value, data);
|
||||||
|
}
|
||||||
|
if (!value) return true;
|
||||||
|
return data.label && data.label.indexOf(value) !== -1;
|
||||||
|
},
|
||||||
|
// 清理定时器和动画帧
|
||||||
|
cleanup() {
|
||||||
|
if (this.rafId) {
|
||||||
|
cancelAnimationFrame(this.rafId);
|
||||||
|
this.rafId = null;
|
||||||
|
}
|
||||||
|
if (this.saveWidthTimer) {
|
||||||
|
clearTimeout(this.saveWidthTimer);
|
||||||
|
this.saveWidthTimer = null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 处理收起/展开状态变化
|
||||||
|
handleCollapseChange(isCollapsed) {
|
||||||
|
if (isCollapsed) {
|
||||||
|
this.saveWidthToStorage();
|
||||||
|
this.sidebarWidth = this.collapsedWidth;
|
||||||
|
} else {
|
||||||
|
const savedWidth = this.getSavedWidth();
|
||||||
|
this.sidebarWidth = savedWidth !== null ? savedWidth : this.defaultWidth;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取保存的宽度
|
||||||
|
getSavedWidth() {
|
||||||
|
if (!this.enableStorage) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const savedWidth = localStorage.getItem(this.storageKey);
|
||||||
|
if (savedWidth) {
|
||||||
|
const width = parseInt(savedWidth, 10);
|
||||||
|
if (!isNaN(width) && width >= this.minWidth && width <= this.maxWidth) {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Failed to load sidebar width from storage with key ${this.storageKey}:`, error);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
// 保存宽度到本地存储
|
||||||
|
saveWidthToStorage() {
|
||||||
|
if (this.collapsed || !this.enableStorage) return;
|
||||||
|
try {
|
||||||
|
localStorage.setItem(this.storageKey, this.sidebarWidth.toString());
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`Failed to save sidebar width to storage with key ${this.storageKey}:`, error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 切换侧边栏收起/展开状态
|
||||||
|
toggleCollapsed() {
|
||||||
|
this.collapsed = !this.collapsed;
|
||||||
|
},
|
||||||
|
// 切换展开/折叠所有节点
|
||||||
|
toggleExpandAll() {
|
||||||
|
this.isExpandedAll = !this.isExpandedAll;
|
||||||
|
},
|
||||||
|
// 展开所有节点
|
||||||
|
expandAllNodes() {
|
||||||
|
if (!this.$refs.treeRef) return;
|
||||||
|
const allNodes = this.getAllNodes(this.$refs.treeRef.root);
|
||||||
|
allNodes.forEach(node => {
|
||||||
|
if (node.expanded !== undefined && !node.expanded) {
|
||||||
|
node.expanded = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取所有节点
|
||||||
|
getAllNodes(rootNode) {
|
||||||
|
const nodes = [];
|
||||||
|
const traverse = (node) => {
|
||||||
|
if (!node) return;
|
||||||
|
nodes.push(node);
|
||||||
|
if (node.childNodes && node.childNodes.length) {
|
||||||
|
node.childNodes.forEach(child => traverse(child));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
traverse(rootNode);
|
||||||
|
return nodes;
|
||||||
|
},
|
||||||
|
// 收起所有节点
|
||||||
|
collapseAllNodes() {
|
||||||
|
if (!this.$refs.treeRef) return;
|
||||||
|
const allNodes = this.getAllNodes(this.$refs.treeRef.root);
|
||||||
|
allNodes.forEach(node => {
|
||||||
|
if (node.expanded !== undefined && node.expanded) {
|
||||||
|
node.expanded = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 处理刷新操作
|
||||||
|
handleRefresh() {
|
||||||
|
this.$emit("refresh");
|
||||||
|
},
|
||||||
|
// 节点点击事件
|
||||||
|
onNodeClick(data, node, e) {
|
||||||
|
this.$emit("node-click", data, node, e);
|
||||||
|
},
|
||||||
|
// 复选框选中事件
|
||||||
|
onCheck(data, checkedInfo) {
|
||||||
|
this.$emit("check", data, checkedInfo);
|
||||||
|
},
|
||||||
|
// 节点展开事件
|
||||||
|
onNodeExpand(data, node, e) {
|
||||||
|
this.$emit("node-expand", data, node, e);
|
||||||
|
},
|
||||||
|
// 节点折叠事件
|
||||||
|
onNodeCollapse(data, node, e) {
|
||||||
|
this.$emit("node-collapse", data, node, e);
|
||||||
|
},
|
||||||
|
// 搜索处理
|
||||||
|
onSearch() {
|
||||||
|
// 搜索逻辑已在 watch 中处理
|
||||||
|
},
|
||||||
|
// 设置当前选中的节点
|
||||||
|
setCurrentKey(key) {
|
||||||
|
if (this.$refs.treeRef) {
|
||||||
|
this.$refs.treeRef.setCurrentKey(key);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取当前选中的节点
|
||||||
|
getCurrentNode() {
|
||||||
|
if (this.$refs.treeRef) {
|
||||||
|
return this.$refs.treeRef.getCurrentNode();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
// 获取当前选中的节点的key
|
||||||
|
getCurrentKey() {
|
||||||
|
if (this.$refs.treeRef) {
|
||||||
|
return this.$refs.treeRef.getCurrentKey();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
// 设置选中的节点keys(复选框)
|
||||||
|
setCheckedKeys(keys) {
|
||||||
|
if (this.$refs.treeRef && this.showCheckbox) {
|
||||||
|
this.$refs.treeRef.setCheckedKeys(keys);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取选中的节点keys(复选框)
|
||||||
|
getCheckedKeys() {
|
||||||
|
if (this.$refs.treeRef && this.showCheckbox) {
|
||||||
|
return this.$refs.treeRef.getCheckedKeys();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
// 获取选中的节点(复选框)
|
||||||
|
getCheckedNodes() {
|
||||||
|
if (this.$refs.treeRef && this.showCheckbox) {
|
||||||
|
return this.$refs.treeRef.getCheckedNodes();
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
// 清空搜索
|
||||||
|
clearSearch() {
|
||||||
|
this.searchKeyword = "";
|
||||||
|
if (this.$refs.treeRef) {
|
||||||
|
this.$refs.treeRef.filter("");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 过滤树
|
||||||
|
filter(value) {
|
||||||
|
this.searchKeyword = value;
|
||||||
|
},
|
||||||
|
// 开始调整大小
|
||||||
|
startResize(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
this.isResizing = true;
|
||||||
|
this.startX = e.type === 'mousedown' ? e.clientX : e.touches[0].clientX;
|
||||||
|
this.startWidth = this.sidebarWidth;
|
||||||
|
|
||||||
|
if (e.type === 'mousedown') {
|
||||||
|
document.addEventListener('mousemove', this.handleResizeMove);
|
||||||
|
document.addEventListener('mouseup', this.stopResize);
|
||||||
|
} else {
|
||||||
|
document.addEventListener('touchmove', this.handleResizeMove, { passive: false });
|
||||||
|
document.addEventListener('touchend', this.stopResize);
|
||||||
|
}
|
||||||
|
this.disableUserSelect();
|
||||||
|
},
|
||||||
|
// 处理调整大小移动
|
||||||
|
handleResizeMove(e) {
|
||||||
|
if (!this.isResizing) return;
|
||||||
|
if (this.rafId) {
|
||||||
|
cancelAnimationFrame(this.rafId);
|
||||||
|
}
|
||||||
|
this.rafId = requestAnimationFrame(() => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
const clientX = e.type === 'mousemove' ? e.clientX : e.touches[0].clientX;
|
||||||
|
const deltaX = clientX - this.startX;
|
||||||
|
const newWidth = this.startWidth + deltaX;
|
||||||
|
const clampedWidth = Math.max(this.minWidth, Math.min(this.maxWidth, newWidth));
|
||||||
|
if (Math.abs(clampedWidth - this.sidebarWidth) >= 1) {
|
||||||
|
this.sidebarWidth = clampedWidth;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 停止调整大小
|
||||||
|
stopResize() {
|
||||||
|
if (!this.isResizing) return;
|
||||||
|
this.isResizing = false;
|
||||||
|
if (this.rafId) {
|
||||||
|
cancelAnimationFrame(this.rafId);
|
||||||
|
this.rafId = null;
|
||||||
|
}
|
||||||
|
this.startX = 0;
|
||||||
|
this.startWidth = 0;
|
||||||
|
document.removeEventListener('mousemove', this.handleResizeMove);
|
||||||
|
document.removeEventListener('mouseup', this.stopResize);
|
||||||
|
document.removeEventListener('touchmove', this.handleResizeMove);
|
||||||
|
document.removeEventListener('touchend', this.stopResize);
|
||||||
|
this.enableUserSelect();
|
||||||
|
this.saveWidthToStorage();
|
||||||
|
},
|
||||||
|
// 禁用用户选择
|
||||||
|
disableUserSelect() {
|
||||||
|
document.body.style.userSelect = 'none';
|
||||||
|
document.body.style.webkitUserSelect = 'none';
|
||||||
|
document.body.style.mozUserSelect = 'none';
|
||||||
|
document.body.style.msUserSelect = 'none';
|
||||||
|
},
|
||||||
|
// 启用用户选择
|
||||||
|
enableUserSelect() {
|
||||||
|
document.body.style.userSelect = '';
|
||||||
|
document.body.style.webkitUserSelect = '';
|
||||||
|
document.body.style.mozUserSelect = '';
|
||||||
|
document.body.style.msUserSelect = '';
|
||||||
|
},
|
||||||
|
// 重置宽度到默认值
|
||||||
|
resetWidth() {
|
||||||
|
this.sidebarWidth = this.defaultWidth;
|
||||||
|
this.saveWidthToStorage();
|
||||||
|
},
|
||||||
|
// 获取当前宽度
|
||||||
|
getCurrentWidth() {
|
||||||
|
return this.sidebarWidth;
|
||||||
|
},
|
||||||
|
// 设置宽度
|
||||||
|
setWidth(width) {
|
||||||
|
if (typeof width === 'number' && width >= this.minWidth && width <= this.maxWidth) {
|
||||||
|
this.sidebarWidth = width;
|
||||||
|
if (!this.collapsed) {
|
||||||
|
this.saveWidthToStorage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.tree-sidebar {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 220px;
|
||||||
|
background: #fff;
|
||||||
|
border-right: 1px solid #e8eaed;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
transition: width 0.25s ease;
|
||||||
|
|
||||||
|
&.collapsed {
|
||||||
|
width: 42px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.resizing {
|
||||||
|
transition: none;
|
||||||
|
will-change: width;
|
||||||
|
|
||||||
|
* {
|
||||||
|
pointer-events: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.no-initial-transition {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.resize-handle {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 6px;
|
||||||
|
height: 100%;
|
||||||
|
cursor: col-resize;
|
||||||
|
z-index: 20;
|
||||||
|
background: transparent;
|
||||||
|
transition: background 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba(64, 158, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: rgba(64, 158, 255, 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-button-container {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 0;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
z-index: 100;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 15px;
|
||||||
|
height: 20px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
|
||||||
|
.tree-sidebar.collapsed & {
|
||||||
|
right: 0;
|
||||||
|
background: #f7f8fa;
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-sidebar.resizing & {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-button {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #909399;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #409eff;
|
||||||
|
background: #ecf5ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0 10px;
|
||||||
|
height: 40px;
|
||||||
|
border-bottom: 1px solid #e8eaed;
|
||||||
|
background: #f7f8fa;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
.tree-title {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
|
||||||
|
i {
|
||||||
|
color: #409eff;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-action-icon {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #909399;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #409eff;
|
||||||
|
background: #ecf5ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-search {
|
||||||
|
padding: 10px 10px 4px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-wrap {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 6px 6px 12px;
|
||||||
|
|
||||||
|
.tree-sidebar.resizing & {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background: #dcdfe6;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #c0c4cc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-tree-node__content {
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 1px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f0f7ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-tree-node.is-current > .el-tree-node__content {
|
||||||
|
background: #e6f0fd;
|
||||||
|
color: #409eff;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
.node-icon {
|
||||||
|
color: #409eff !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-node {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 13px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.node-icon {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #f5a623;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.node-label {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .el-icon-document.node-icon {
|
||||||
|
color: #909399 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
362
ruoyi-ui/src/layout/components/HeaderNotice/DetailView.vue
Normal file
362
ruoyi-ui/src/layout/components/HeaderNotice/DetailView.vue
Normal file
@@ -0,0 +1,362 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="公告详情" :visible.sync="visible" direction="rtl" size="50%" append-to-body :before-close="handleClose" custom-class="notice-detail-drawer">
|
||||||
|
<div v-loading="loading" class="notice-detail-drawer__body">
|
||||||
|
<div v-if="!detail" class="notice-empty">
|
||||||
|
<i class="el-icon-document"></i>
|
||||||
|
<span>暂无数据</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="notice-page">
|
||||||
|
<div class="notice-type-wrap">
|
||||||
|
<span v-if="detail.noticeType === '1'" class="notice-type-tag type-notify">
|
||||||
|
<i class="el-icon-bell"></i> 通知
|
||||||
|
</span>
|
||||||
|
<span v-else-if="detail.noticeType === '2'" class="notice-type-tag type-announce">
|
||||||
|
<i class="el-icon-message"></i> 公告
|
||||||
|
</span>
|
||||||
|
<span v-else class="notice-type-tag type-notify">
|
||||||
|
<i class="el-icon-document"></i> 消息
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1 class="notice-title">{{ detail.noticeTitle }}</h1>
|
||||||
|
|
||||||
|
<div class="notice-meta">
|
||||||
|
<span class="meta-item">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
<span>{{ detail.createBy || '—' }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="meta-item">
|
||||||
|
<i class="el-icon-time"></i>
|
||||||
|
<span>{{ detail.createTime || '—' }}</span>
|
||||||
|
</span>
|
||||||
|
<span class="meta-item">
|
||||||
|
<span :class="['status-dot', isStatusNormal ? 'status-ok' : 'status-off']"></span>
|
||||||
|
<span>{{ isStatusNormal ? '正常' : '已关闭' }}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notice-divider">
|
||||||
|
<span class="notice-divider-dot"></span>
|
||||||
|
<span class="notice-divider-dot"></span>
|
||||||
|
<span class="notice-divider-dot"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notice-body">
|
||||||
|
<div v-if="hasContent" class="notice-content" v-html="detail.noticeContent" />
|
||||||
|
<div v-else class="notice-empty notice-empty--inner">
|
||||||
|
<i class="el-icon-document"></i> 暂无内容
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getNotice } from '@/api/system/notice'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'NoticeDetailView',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
detail: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isStatusNormal() {
|
||||||
|
const s = this.detail && this.detail.status
|
||||||
|
return s === '0' || s === 0
|
||||||
|
},
|
||||||
|
hasContent() {
|
||||||
|
const c = this.detail && this.detail.noticeContent
|
||||||
|
return c != null && String(c).trim() !== ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(payload) {
|
||||||
|
let id = null
|
||||||
|
let preset = null
|
||||||
|
if (payload != null && typeof payload === 'object') {
|
||||||
|
id = payload.noticeId
|
||||||
|
if (payload.noticeContent != null) {
|
||||||
|
preset = payload
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
id = payload
|
||||||
|
}
|
||||||
|
this.visible = true
|
||||||
|
if (preset) {
|
||||||
|
this.detail = preset
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (id == null || id === '') {
|
||||||
|
this.detail = null
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
this.detail = null
|
||||||
|
getNotice(id).then(res => {
|
||||||
|
this.detail = res.data
|
||||||
|
}).catch(() => {
|
||||||
|
this.detail = null
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.visible = false
|
||||||
|
this.detail = null
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.notice-page {
|
||||||
|
max-width: 760px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 8px 8px 20px;
|
||||||
|
animation: notice-fade-up 0.28s ease both;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes notice-fade-up {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(14px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-type-tag {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-notify {
|
||||||
|
background: #fff8e6;
|
||||||
|
color: #b7791f;
|
||||||
|
border-left: 3px solid #d97706;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-announce {
|
||||||
|
background: #e8f5e9;
|
||||||
|
color: #276749;
|
||||||
|
border-left: 3px solid #38a169;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-title {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a202c;
|
||||||
|
line-height: 1.45;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
letter-spacing: -0.2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 12px 0;
|
||||||
|
border-top: 1px solid #e9ecef;
|
||||||
|
border-bottom: 1px solid #e9ecef;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #718096;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-item i {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #a0aec0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-dot {
|
||||||
|
display: inline-block;
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-ok {
|
||||||
|
background: #38a169;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-off {
|
||||||
|
background: #e53e3e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-divider {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-divider::before,
|
||||||
|
.notice-divider::after {
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: linear-gradient(to right, transparent, #dee2e6, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-divider-dot {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #cbd5e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-body {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 28px 32px;
|
||||||
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
|
||||||
|
min-height: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.85;
|
||||||
|
color: #2d3748;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep p {
|
||||||
|
margin: 0 0 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep h1,
|
||||||
|
.notice-content ::v-deep h2,
|
||||||
|
.notice-content ::v-deep h3 {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1a202c;
|
||||||
|
margin: 1.4em 0 0.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep h1 {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep h3 {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep a {
|
||||||
|
color: #3182ce;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep a:hover {
|
||||||
|
color: #2b6cb0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep img {
|
||||||
|
max-width: 100%;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep ul,
|
||||||
|
.notice-content ::v-deep ol {
|
||||||
|
padding-left: 20px;
|
||||||
|
margin: 0 0 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep li {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep blockquote {
|
||||||
|
border-left: 3px solid #cbd5e0;
|
||||||
|
margin: 1em 0;
|
||||||
|
padding: 6px 16px;
|
||||||
|
color: #718096;
|
||||||
|
background: #f7fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
margin: 1em 0;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep table th,
|
||||||
|
.notice-content ::v-deep table td {
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
padding: 7px 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content ::v-deep table th {
|
||||||
|
background: #f7fafc;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px 0;
|
||||||
|
color: #a0aec0;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-empty i {
|
||||||
|
font-size: 28px;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-empty--inner {
|
||||||
|
padding: 32px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-empty--inner i {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .notice-detail-drawer {
|
||||||
|
.el-drawer__header {
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding: 16px 20px;
|
||||||
|
border-bottom: 1px solid #ebeef5;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
.el-drawer__body {
|
||||||
|
background: #f5f6f8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-detail-drawer__body {
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 10px 16px 22px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -23,38 +23,24 @@
|
|||||||
<span v-if="unreadCount > 0" class="notice-badge">{{ unreadCount }}</span>
|
<span v-if="unreadCount > 0" class="notice-badge">{{ unreadCount }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog :title="previewTitle" :visible.sync="previewVisible" width="680px" append-to-body custom-class="notice-preview-dialog">
|
<notice-detail-view ref="noticeViewRef" />
|
||||||
<div class="notice-preview-meta">
|
|
||||||
<el-tag size="small" :type="previewNoticeType === '1' ? 'warning' : 'success'">
|
|
||||||
{{ previewNoticeType === '1' ? '通知' : '公告' }}
|
|
||||||
</el-tag>
|
|
||||||
<span class="notice-preview-info"><i class="el-icon-user"></i> {{ previewCreateBy }}</span>
|
|
||||||
<span class="notice-preview-info"><i class="el-icon-time"></i> {{ previewCreateTime }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="notice-preview-divider"></div>
|
|
||||||
<div class="notice-preview-content" v-html="previewContent"></div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listNoticeTop, markNoticeRead, markNoticeReadAll, getNotice } from '@/api/system/notice'
|
import NoticeDetailView from './DetailView'
|
||||||
|
import { listNoticeTop, markNoticeRead, markNoticeReadAll } from '@/api/system/notice'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HeaderNotice',
|
name: 'HeaderNotice',
|
||||||
|
components: { NoticeDetailView },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
noticeList: [], // 通知列表
|
noticeList: [], // 通知列表
|
||||||
unreadCount: 0, // 未读数量
|
unreadCount: 0, // 未读数量
|
||||||
noticeLoading: false, // 加载状态
|
noticeLoading: false, // 加载状态
|
||||||
noticeVisible: false, // 弹出层显示状态
|
noticeVisible: false, // 弹出层显示状态
|
||||||
noticeLeaveTimer: null, // 鼠标离开计时器
|
noticeLeaveTimer: null // 鼠标离开计时器
|
||||||
previewVisible: false, // 预览弹窗显示状态
|
|
||||||
previewTitle: '', // 预览弹窗标题
|
|
||||||
previewContent: '', // 预览弹窗内容
|
|
||||||
previewNoticeType: '', // 预览弹窗类型
|
|
||||||
previewCreateBy: '', // 预览弹窗创建人
|
|
||||||
previewCreateTime: '' // 预览弹窗创建时间
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -99,15 +85,7 @@ export default {
|
|||||||
if (idx !== -1) this.$set(this.noticeList, idx, { ...item, isRead: true })
|
if (idx !== -1) this.$set(this.noticeList, idx, { ...item, isRead: true })
|
||||||
this.unreadCount = Math.max(0, this.unreadCount - 1)
|
this.unreadCount = Math.max(0, this.unreadCount - 1)
|
||||||
}
|
}
|
||||||
getNotice(item.noticeId).then(res => {
|
this.$refs.noticeViewRef.open(item.noticeId)
|
||||||
const notice = res.data
|
|
||||||
this.previewTitle = notice.noticeTitle
|
|
||||||
this.previewContent = notice.noticeContent
|
|
||||||
this.previewNoticeType = notice.noticeType
|
|
||||||
this.previewCreateBy = notice.createBy
|
|
||||||
this.previewCreateTime = notice.createTime
|
|
||||||
this.previewVisible = true
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 全部已读
|
// 全部已读
|
||||||
markAllRead() {
|
markAllRead() {
|
||||||
@@ -200,30 +178,4 @@ export default {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
::v-deep .notice-preview-dialog {
|
|
||||||
.el-dialog__body { padding: 0 20px 20px; }
|
|
||||||
.notice-preview-meta {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 14px;
|
|
||||||
padding: 12px 0;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #888;
|
|
||||||
.notice-preview-info { display: flex; align-items: center; gap: 4px; }
|
|
||||||
}
|
|
||||||
.notice-preview-divider {
|
|
||||||
height: 1px;
|
|
||||||
background: linear-gradient(to right, transparent, #e2e8f0, transparent);
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
.notice-preview-content {
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: 1.85;
|
|
||||||
color: #2d3748;
|
|
||||||
word-break: break-word;
|
|
||||||
img { max-width: 100%; border-radius: 4px; }
|
|
||||||
p { margin: 0 0 1em; }
|
|
||||||
a { color: #409EFF; text-decoration: underline; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import Breadcrumb from '@/components/Breadcrumb'
|
import Breadcrumb from '@/components/Breadcrumb'
|
||||||
import TopNav from '@/components/TopNav'
|
import TopNav from './TopNav'
|
||||||
import TopBar from './TopBar'
|
import TopBar from './TopBar'
|
||||||
import Logo from './Sidebar/Logo'
|
import Logo from './Sidebar/Logo'
|
||||||
import Hamburger from '@/components/Hamburger'
|
import Hamburger from '@/components/Hamburger'
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
<h3 class="drawer-title">系统布局配置</h3>
|
<h3 class="drawer-title">系统布局配置</h3>
|
||||||
|
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>开启 Tags-Views</span>
|
<span>开启页签</span>
|
||||||
<el-switch v-model="tagsView" class="drawer-switch" />
|
<el-switch v-model="tagsView" class="drawer-switch" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -75,6 +75,14 @@
|
|||||||
<el-switch v-model="tagsIcon" :disabled="!tagsView" class="drawer-switch" />
|
<el-switch v-model="tagsIcon" :disabled="!tagsView" class="drawer-switch" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="drawer-item">
|
||||||
|
<span>标签页样式</span>
|
||||||
|
<el-radio-group v-model="tagsViewStyle" :disabled="!tagsView" size="mini" class="drawer-switch">
|
||||||
|
<el-radio-button label="card">卡片</el-radio-button>
|
||||||
|
<el-radio-button label="chrome">谷歌</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="drawer-item">
|
<div class="drawer-item">
|
||||||
<span>固定 Header</span>
|
<span>固定 Header</span>
|
||||||
<el-switch v-model="fixedHeader" class="drawer-switch" />
|
<el-switch v-model="fixedHeader" class="drawer-switch" />
|
||||||
@@ -163,6 +171,17 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
tagsViewStyle: {
|
||||||
|
get() {
|
||||||
|
return this.$store.state.settings.tagsViewStyle
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$store.dispatch('settings/changeSetting', {
|
||||||
|
key: 'tagsViewStyle',
|
||||||
|
value: val
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
sidebarLogo: {
|
sidebarLogo: {
|
||||||
get() {
|
get() {
|
||||||
return this.$store.state.settings.sidebarLogo
|
return this.$store.state.settings.sidebarLogo
|
||||||
@@ -256,6 +275,7 @@ export default {
|
|||||||
"navType":${this.navType},
|
"navType":${this.navType},
|
||||||
"tagsView":${this.tagsView},
|
"tagsView":${this.tagsView},
|
||||||
"tagsIcon":${this.tagsIcon},
|
"tagsIcon":${this.tagsIcon},
|
||||||
|
"tagsViewStyle":"${this.tagsViewStyle}",
|
||||||
"tagsViewPersist":${this.tagsViewPersist},
|
"tagsViewPersist":${this.tagsViewPersist},
|
||||||
"fixedHeader":${this.fixedHeader},
|
"fixedHeader":${this.fixedHeader},
|
||||||
"sidebarLogo":${this.sidebarLogo},
|
"sidebarLogo":${this.sidebarLogo},
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="tags-view-container" class="tags-view-container">
|
<div id="tags-view-container" class="tags-view-container" :class="{ 'tags-view-container--chrome': tagsViewStyle === 'chrome' }" :style="chromeVars">
|
||||||
<!-- 左切换箭头 -->
|
<!-- 左切换箭头 -->
|
||||||
<span class="tags-nav-btn tags-nav-btn--left" :class="{ disabled: !canScrollLeft }" @click="scrollLeft">
|
<span class="tags-nav-btn tags-nav-btn--left" :class="{ disabled: !canScrollLeft }" @click="scrollLeft">
|
||||||
<i class="el-icon-arrow-left" />
|
<i class="el-icon-arrow-left" />
|
||||||
@@ -15,11 +15,11 @@
|
|||||||
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
||||||
tag="span"
|
tag="span"
|
||||||
class="tags-view-item"
|
class="tags-view-item"
|
||||||
:style="activeStyle(tag)"
|
:style="tagActiveStyle(tag)"
|
||||||
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
|
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
|
||||||
@contextmenu.prevent.native="openMenu(tag, $event)"
|
@contextmenu.prevent.native="openMenu(tag, $event)"
|
||||||
>
|
>
|
||||||
<svg-icon v-if="tagsIcon && tag.meta && tag.meta.icon && tag.meta.icon !== '#'" :icon-class="tag.meta.icon" />
|
<svg-icon v-if="tagsIcon && tag.meta && tag.meta.icon && tag.meta.icon !== '#'" :icon-class="tag.meta.icon" style="margin-right: 3px;" />
|
||||||
{{ tag.title }}
|
{{ tag.title }}
|
||||||
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
|
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
|
||||||
</router-link>
|
</router-link>
|
||||||
@@ -97,8 +97,20 @@ export default {
|
|||||||
tagsIcon() {
|
tagsIcon() {
|
||||||
return this.$store.state.settings.tagsIcon
|
return this.$store.state.settings.tagsIcon
|
||||||
},
|
},
|
||||||
|
tagsViewStyle() {
|
||||||
|
return this.$store.state.settings.tagsViewStyle
|
||||||
|
},
|
||||||
selectedDropdownTag() {
|
selectedDropdownTag() {
|
||||||
return this.visitedViews.find(v => this.isActive(v)) || {}
|
return this.visitedViews.find(v => this.isActive(v)) || {}
|
||||||
|
},
|
||||||
|
chromeVars() {
|
||||||
|
if (this.tagsViewStyle !== 'chrome') return {}
|
||||||
|
const primary = this.theme || '#409EFF'
|
||||||
|
return {
|
||||||
|
'--chrome-tab-active-bg': this.mixHexWithWhite(primary, 0.15),
|
||||||
|
'--chrome-tab-text-active': primary,
|
||||||
|
'--chrome-wing-r': '14px'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -136,11 +148,21 @@ export default {
|
|||||||
this.toggleFullscreen()
|
this.toggleFullscreen()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mixHexWithWhite(hex, ratio) {
|
||||||
|
const clean = hex.replace('#', '')
|
||||||
|
const r = parseInt(clean.substring(0, 2), 16)
|
||||||
|
const g = parseInt(clean.substring(2, 4), 16)
|
||||||
|
const b = parseInt(clean.substring(4, 6), 16)
|
||||||
|
const mr = Math.round(r * ratio + 255 * (1 - ratio))
|
||||||
|
const mg = Math.round(g * ratio + 255 * (1 - ratio))
|
||||||
|
const mb = Math.round(b * ratio + 255 * (1 - ratio))
|
||||||
|
return `rgb(${mr}, ${mg}, ${mb})`
|
||||||
|
},
|
||||||
isActive(route) {
|
isActive(route) {
|
||||||
return route.path === this.$route.path
|
return route.path === this.$route.path
|
||||||
},
|
},
|
||||||
activeStyle(tag) {
|
tagActiveStyle(tag) {
|
||||||
if (!this.isActive(tag)) return {}
|
if (!this.isActive(tag) || this.tagsViewStyle !== 'card') return {}
|
||||||
return {
|
return {
|
||||||
"background-color": this.theme,
|
"background-color": this.theme,
|
||||||
"border-color": this.theme
|
"border-color": this.theme
|
||||||
@@ -367,13 +389,16 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
$tags-bar-height: 34px;
|
||||||
|
|
||||||
.tags-view-container {
|
.tags-view-container {
|
||||||
height: 34px;
|
height: $tags-bar-height;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-bottom: 1px solid #d8dce5;
|
border-bottom: 1px solid #d8dce5;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
$btn-width: 28px;
|
$btn-width: 28px;
|
||||||
$btn-color: #71717a;
|
$btn-color: #71717a;
|
||||||
@@ -388,7 +413,7 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: $btn-width;
|
width: $btn-width;
|
||||||
height: 34px;
|
height: $tags-bar-height;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: $btn-color;
|
color: $btn-color;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -405,18 +430,14 @@ export default {
|
|||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--left {
|
&--left { border-right: $divider; }
|
||||||
border-right: $divider;
|
&--right { border-left: $divider; }
|
||||||
}
|
|
||||||
|
|
||||||
&--right {
|
|
||||||
border-left: $divider;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags-view-wrapper {
|
.tags-view-wrapper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
.tags-view-item {
|
.tags-view-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -432,31 +453,27 @@ export default {
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
|
||||||
&:first-of-type {
|
&:first-of-type { margin-left: 6px; }
|
||||||
margin-left: 6px;
|
&:last-of-type { margin-right: 15px; }
|
||||||
}
|
}
|
||||||
&:last-of-type {
|
}
|
||||||
margin-right: 15px;
|
&:not(.tags-view-container--chrome) .tags-view-wrapper .tags-view-item.active {
|
||||||
}
|
background-color: #42b983;
|
||||||
&.active {
|
color: #fff;
|
||||||
background-color: #42b983;
|
border-color: #42b983;
|
||||||
color: #fff;
|
&::before {
|
||||||
border-color: #42b983;
|
content: '';
|
||||||
&::before {
|
background: #fff;
|
||||||
content: '';
|
display: inline-block;
|
||||||
background: #fff;
|
width: 8px;
|
||||||
display: inline-block;
|
height: 8px;
|
||||||
width: 8px;
|
border-radius: 50%;
|
||||||
height: 8px;
|
position: relative;
|
||||||
border-radius: 50%;
|
margin-right: 2px;
|
||||||
position: relative;
|
|
||||||
margin-right: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags-view-item.active.has-icon::before {
|
&:not(.tags-view-container--chrome) .tags-view-wrapper .tags-view-item.active.has-icon::before {
|
||||||
content: none !important;
|
content: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,7 +488,7 @@ export default {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: $btn-width;
|
width: $btn-width;
|
||||||
height: 34px;
|
height: $tags-bar-height;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: $btn-color;
|
color: $btn-color;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
@@ -511,11 +528,174 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.tags-view-container--chrome {
|
||||||
|
--chrome-strip-bg: #ffffff;
|
||||||
|
--chrome-strip-border: #e4e7ed;
|
||||||
|
--chrome-tab-text: #606266;
|
||||||
|
|
||||||
|
overflow: visible;
|
||||||
|
background: var(--chrome-strip-bg);
|
||||||
|
border-bottom: 1px solid var(--chrome-strip-border);
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.tags-nav-btn {
|
||||||
|
align-self: stretch;
|
||||||
|
height: auto;
|
||||||
|
min-height: $tags-bar-height;
|
||||||
|
border-color: var(--chrome-strip-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-action-btn {
|
||||||
|
border-color: var(--chrome-strip-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-view-wrapper {
|
||||||
|
.tags-view-item {
|
||||||
|
display: inline-flex !important;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
height: 30px;
|
||||||
|
min-height: 30px;
|
||||||
|
margin: 0 0 -1px;
|
||||||
|
padding: 0 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.2;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent !important;
|
||||||
|
color: var(--chrome-tab-text) !important;
|
||||||
|
padding-top: 0 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transition: background 0.12s ease, color 0.12s ease, border-radius 0.12s ease;
|
||||||
|
|
||||||
|
&::before,
|
||||||
|
&::after {
|
||||||
|
content: '' !important;
|
||||||
|
display: block !important;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: var(--chrome-wing-r);
|
||||||
|
height: var(--chrome-wing-r);
|
||||||
|
margin: 0 !important;
|
||||||
|
pointer-events: none;
|
||||||
|
background: transparent !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
transition: box-shadow 0.12s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
left: calc(-1 * var(--chrome-wing-r));
|
||||||
|
border-bottom-right-radius: var(--chrome-wing-r) !important;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
right: calc(-1 * var(--chrome-wing-r));
|
||||||
|
border-bottom-left-radius: var(--chrome-wing-r) !important;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:first-of-type { margin-left: 6px; }
|
||||||
|
&:last-of-type { margin-right: 10px; }
|
||||||
|
|
||||||
|
&:not(.active) + .tags-view-item:not(.active) {
|
||||||
|
border-left: 1px solid #e4e7ed;
|
||||||
|
padding-left: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover:not(.active) {
|
||||||
|
background: #f5f7fa !important;
|
||||||
|
border-radius: 6px 6px 0 0;
|
||||||
|
color: #303133 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
height: 31px;
|
||||||
|
min-height: 31px;
|
||||||
|
padding: 0 14px;
|
||||||
|
color: var(--chrome-tab-text-active) !important;
|
||||||
|
font-weight: 500;
|
||||||
|
background: var(--chrome-tab-active-bg) !important;
|
||||||
|
border: none !important;
|
||||||
|
border-radius: var(--chrome-wing-r) var(--chrome-wing-r) 0 0;
|
||||||
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
box-shadow: calc(var(--chrome-wing-r) * 0.5) calc(var(--chrome-wing-r) * 0.5) 0 calc(var(--chrome-wing-r) * 0.5) var(--chrome-tab-active-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
box-shadow: calc(var(--chrome-wing-r) * -0.5) calc(var(--chrome-wing-r) * 0.5) 0 calc(var(--chrome-wing-r) * 0.5) var(--chrome-tab-active-bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.el-icon-close {
|
||||||
|
margin-left: 3px;
|
||||||
|
&:before {
|
||||||
|
vertical-align: -2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.tags-view-wrapper {
|
.tags-view-wrapper {
|
||||||
|
.el-scrollbar {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__wrap {
|
||||||
|
height: 34px !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
|
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags-view-container:hover & {
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::-webkit-scrollbar-thumb {
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border-radius: 3px;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollbar-width: none;
|
||||||
|
-ms-overflow-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-scrollbar__bar {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s;
|
||||||
|
|
||||||
|
.tags-view-container:hover & {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.tags-view-item {
|
.tags-view-item {
|
||||||
.el-icon-close {
|
.el-icon-close {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
@@ -546,6 +726,8 @@ export default {
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-container.fullscreen-mode .fixed-header {
|
.main-container.fullscreen-mode .fixed-header {
|
||||||
@@ -556,6 +738,7 @@ export default {
|
|||||||
right: 0;
|
right: 0;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-container.fullscreen-mode .fixed-header .navbar {
|
.main-container.fullscreen-mode .fixed-header .navbar {
|
||||||
@@ -574,4 +757,4 @@ export default {
|
|||||||
min-height: calc(100vh - 34px) !important;
|
min-height: calc(100vh - 34px) !important;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -34,6 +34,11 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
tagsIcon: false,
|
tagsIcon: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签页样式:card 卡片(默认)、chrome 谷歌浏览器风格
|
||||||
|
*/
|
||||||
|
tagsViewStyle: 'card',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否固定头部
|
* 是否固定头部
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
||||||
|
|
||||||
const { sideTheme, showSettings, navType, tagsView, tagsViewPersist, tagsIcon, fixedHeader, sidebarLogo, dynamicTitle, footerVisible, footerContent } = defaultSettings
|
const { sideTheme, showSettings, navType, tagsView, tagsViewPersist, tagsIcon, tagsViewStyle, fixedHeader, sidebarLogo, dynamicTitle, footerVisible, footerContent } = defaultSettings
|
||||||
|
|
||||||
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
||||||
const state = {
|
const state = {
|
||||||
@@ -13,6 +13,7 @@ const state = {
|
|||||||
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
||||||
tagsViewPersist: storageSetting.tagsViewPersist === undefined ? tagsViewPersist : storageSetting.tagsViewPersist,
|
tagsViewPersist: storageSetting.tagsViewPersist === undefined ? tagsViewPersist : storageSetting.tagsViewPersist,
|
||||||
tagsIcon: storageSetting.tagsIcon === undefined ? tagsIcon : storageSetting.tagsIcon,
|
tagsIcon: storageSetting.tagsIcon === undefined ? tagsIcon : storageSetting.tagsIcon,
|
||||||
|
tagsViewStyle: storageSetting.tagsViewStyle === undefined ? tagsViewStyle : storageSetting.tagsViewStyle,
|
||||||
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
||||||
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
||||||
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
|
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
import cache from '@/plugins/cache'
|
||||||
import { MessageBox, } from 'element-ui'
|
import { MessageBox, } from 'element-ui'
|
||||||
import { login, logout, getInfo, refreshToken } from '@/api/login'
|
import { login, logout, getInfo, refreshToken } from '@/api/login'
|
||||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||||
@@ -82,6 +83,7 @@ const user = {
|
|||||||
commit('SET_NAME', user.userName)
|
commit('SET_NAME', user.userName)
|
||||||
commit('SET_NICK_NAME', user.nickName)
|
commit('SET_NICK_NAME', user.nickName)
|
||||||
commit('SET_AVATAR', avatar)
|
commit('SET_AVATAR', avatar)
|
||||||
|
cache.session.set('pwrChrtype', res.pwdChrtype)
|
||||||
/* 初始密码提示 */
|
/* 初始密码提示 */
|
||||||
if(res.isDefaultModifyPwd) {
|
if(res.isDefaultModifyPwd) {
|
||||||
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
MessageBox.confirm('您的密码还是初始密码,请修改密码!', '安全提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
|
||||||
|
|||||||
71
ruoyi-ui/src/utils/passwordRule.js
Normal file
71
ruoyi-ui/src/utils/passwordRule.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* 密码强度规则
|
||||||
|
* 根据参数 chrtype 动态生成校验规则
|
||||||
|
*
|
||||||
|
* chrtype 说明:
|
||||||
|
* 0 - 任意字符(默认)
|
||||||
|
* 1 - 纯数字(0-9)
|
||||||
|
* 2 - 纯字母(a-z / A-Z)
|
||||||
|
* 3 - 字母 + 数字(必须同时包含)
|
||||||
|
* 4 - 字母 + 数字 + 特殊字符(必须同时包含,特殊字符:~!@#$%^&*()-=_+)
|
||||||
|
*/
|
||||||
|
import cache from '@/plugins/cache'
|
||||||
|
|
||||||
|
// 各类型对应的正则、错误提示
|
||||||
|
const PWD_RULES = {
|
||||||
|
'0': { pattern: /^[^<>"'|\\]+$/, message: '密码不能包含非法字符:< > " \' \\ |' },
|
||||||
|
'1': { pattern: /^[0-9]+$/, message: '密码只能为数字(0-9)' },
|
||||||
|
'2': { pattern: /^[a-zA-Z]+$/, message: '密码只能为英文字母(a-z、A-Z)' },
|
||||||
|
'3': { pattern: /^(?=.*[a-zA-Z])(?=.*[0-9])[a-zA-Z0-9]+$/, message: '密码必须同时包含字母和数字' },
|
||||||
|
'4': { pattern: /^(?=.*[A-Za-z])(?=.*\d)(?=.*[~!@#$%^&*()\-=_+])[A-Za-z\d~!@#$%^&*()\-=_+]+$/, message: '密码必须同时包含字母、数字和特殊字符(~!@#$%^&*()-=_+)' }
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 密码限制类型
|
||||||
|
pwdChrType: cache.session.get('pwrChrtype') || '0'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// 默认密码校验
|
||||||
|
pwdValidator() {
|
||||||
|
const rule = PWD_RULES[this.pwdChrType] || PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '密码不能为空', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 校验prompt的inputValidator函数
|
||||||
|
pwdPromptValidator() {
|
||||||
|
const rule = PWD_RULES['0']
|
||||||
|
return (value) => {
|
||||||
|
if (!value || value.length < 6 || value.length > 20) {
|
||||||
|
return '密码长度必须介于 6 和 20 之间'
|
||||||
|
}
|
||||||
|
if (!rule.pattern.test(value)) {
|
||||||
|
return rule.message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 个人中心密码校验
|
||||||
|
infoPwdValidator() {
|
||||||
|
const rule = PWD_RULES[this.pwdChrType] || PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '新密码不能为空', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '新密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// 注册页面密码校验
|
||||||
|
registerPwdValidator() {
|
||||||
|
const rule = PWD_RULES['0']
|
||||||
|
return [
|
||||||
|
{ required: true, message: '请输入您的密码', trigger: 'blur' },
|
||||||
|
{ min: 6, max: 20, message: '用户密码长度必须介于 6 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: rule.pattern, message: rule.message, trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,12 @@
|
|||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
*/
|
*/
|
||||||
export function isPathMatch(pattern, path) {
|
export function isPathMatch(pattern, path) {
|
||||||
const regexPattern = pattern.replace(/\//g, '\\/').replace(/\*\*/g, '.*').replace(/\*/g, '[^\\/]*')
|
const regexPattern = pattern
|
||||||
|
.replace(/([.+^${}()|\[\]\\])/g, '\\$1')
|
||||||
|
.replace(/\*\*/g, '__DOUBLE_STAR__')
|
||||||
|
.replace(/\*/g, '[^/]*')
|
||||||
|
.replace(/__DOUBLE_STAR__/g, '.*')
|
||||||
|
.replace(/\?/g, '[^/]')
|
||||||
const regex = new RegExp(`^${regexPattern}$`)
|
const regex = new RegExp(`^${regexPattern}$`)
|
||||||
return regex.test(path)
|
return regex.test(path)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,41 @@
|
|||||||
<span>更新日志</span>
|
<span>更新日志</span>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse accordion>
|
<el-collapse accordion>
|
||||||
|
<el-collapse-item title="v3.6.8 - 2026-03-30">
|
||||||
|
<ol>
|
||||||
|
<li>新增锁定屏幕功能</li>
|
||||||
|
<li>首页新增通知公告消息提醒</li>
|
||||||
|
<li>添加持久化标签页开关功能</li>
|
||||||
|
<li>菜单搜索支持文本高亮&数量提示</li>
|
||||||
|
<li>添加菜单路由地址和名称的校验规则</li>
|
||||||
|
<li>字典类型列表新增抽屉效果详细信息</li>
|
||||||
|
<li>升级axios到最新版本0.30.3</li>
|
||||||
|
<li>升级spring-cloud到最新版2025.1.0</li>
|
||||||
|
<li>升级spring-cloud-alibaba到最新版2025.1.0.0</li>
|
||||||
|
<li>升级spring-boot-admin到最新版4.0.2</li>
|
||||||
|
<li>升级dynamic-ds到最新版本4.5.0</li>
|
||||||
|
<li>升级springdoc到最新版本3.0.2</li>
|
||||||
|
<li>升级transmittable-thread-local到最新版本2.14.5</li>
|
||||||
|
<li>升级spring-boot到最新版本4.0.3</li>
|
||||||
|
<li>升级druid到最新版本1.2.28</li>
|
||||||
|
<li>升级pagehelper到最新版2.1.1</li>
|
||||||
|
<li>优化操作日志详细页面</li>
|
||||||
|
<li>部门管理支持批量保存排序</li>
|
||||||
|
<li>菜单管理支持批量保存排序</li>
|
||||||
|
<li>菜单管理列表新增类型显示</li>
|
||||||
|
<li>代码生成模板支持TypeScript版本</li>
|
||||||
|
<li>优化菜单主题风格显示</li>
|
||||||
|
<li>优化点击任务名称查看详细</li>
|
||||||
|
<li>优化字典类型属性提醒说明</li>
|
||||||
|
<li>优化防重提交间隔时间可自定义</li>
|
||||||
|
<li>优化页签功能&支持全屏按钮操作</li>
|
||||||
|
<li>优化RightToolbar搜索栏切换动画</li>
|
||||||
|
<li>修复Excel自定义格式样式污染问题</li>
|
||||||
|
<li>优化isAdmin方法统一到SecurityUtils</li>
|
||||||
|
<li>优化定时任务详情页展示&补充执行时间字段</li>
|
||||||
|
<li>其他细节优化</li>
|
||||||
|
</ol>
|
||||||
|
</el-collapse-item>
|
||||||
<el-collapse-item title="v3.6.7 - 2025-12-22">
|
<el-collapse-item title="v3.6.7 - 2025-12-22">
|
||||||
<ol>
|
<ol>
|
||||||
<li>支持防盗链功能</li>
|
<li>支持防盗链功能</li>
|
||||||
@@ -987,7 +1022,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 版本号
|
// 版本号
|
||||||
version: "3.6.7"
|
version: "3.6.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.jobId != undefined) {
|
if (this.form.jobId != undefined) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password" :rules="registerPwdValidator">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="registerForm.password"
|
v-model="registerForm.password"
|
||||||
type="password"
|
type="password"
|
||||||
@@ -68,18 +68,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg, register } from "@/api/login"
|
import { getCodeImg, register } from "@/api/login"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Register",
|
mixins: [passwordRule],
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
|
||||||
if (this.registerForm.password !== value) {
|
|
||||||
callback(new Error("两次输入的密码不一致"))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
title: process.env.VUE_APP_TITLE,
|
title: process.env.VUE_APP_TITLE,
|
||||||
footerContent: defaultSettings.footerContent,
|
footerContent: defaultSettings.footerContent,
|
||||||
@@ -91,24 +85,31 @@ export default {
|
|||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: ""
|
||||||
},
|
},
|
||||||
registerRules: {
|
loading: false,
|
||||||
|
captchaEnabled: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
registerRules() {
|
||||||
|
return {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||||
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
|
||||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
|
||||||
{ min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
{ required: true, message: "请再次输入您的密码", trigger: "blur" },
|
||||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (this.registerForm.password !== value) {
|
||||||
|
callback(new Error("两次输入的密码不一致"))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}, trigger: "blur"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||||
},
|
}
|
||||||
loading: false,
|
|
||||||
captchaEnabled: true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.configId)
|
this.ids = selection.map(item => item.configId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
@@ -297,7 +297,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.configId != undefined) {
|
if (this.form.configId != undefined) {
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.deptId != undefined) {
|
if (this.form.deptId != undefined) {
|
||||||
|
|||||||
@@ -345,7 +345,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.dictCode)
|
this.ids = selection.map(item => item.dictCode)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
@@ -359,7 +359,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictCode != undefined) {
|
if (this.form.dictCode != undefined) {
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.dictId)
|
this.ids = selection.map(item => item.dictId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 字典数据抽屉显示信息 */
|
/** 字典数据抽屉显示信息 */
|
||||||
@@ -328,7 +328,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictId != undefined) {
|
if (this.form.dictId != undefined) {
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.menuId != undefined) {
|
if (this.form.menuId != undefined) {
|
||||||
|
|||||||
109
ruoyi-ui/src/views/system/notice/ReadUsers.vue
Normal file
109
ruoyi-ui/src/views/system/notice/ReadUsers.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="`「${noticeTitle}」已读用户`" :visible.sync="visible" width="760px" top="6vh" append-to-body @close="handleClose">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" style="margin-bottom: 4px;">
|
||||||
|
<el-form-item prop="searchValue">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.searchValue"
|
||||||
|
placeholder="登录名称 / 用户名称"
|
||||||
|
clearable
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
style="width: 220px;"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
@clear="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="float: right; margin-right: 0;">
|
||||||
|
<span class="read-stat">
|
||||||
|
共 <strong>{{ total }}</strong> 人已读
|
||||||
|
</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-table v-loading="loading" :data="userList" size="small" stripe height="340px">
|
||||||
|
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||||
|
<el-table-column label="登录名称" prop="userName" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="用户名称" prop="nickName" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="所属部门" prop="deptName" align="center" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机号码" prop="phonenumber" align="center" width="120" />
|
||||||
|
<el-table-column label="阅读时间" prop="readTime" align="center" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.readTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" style="padding: 6px 0px;"/>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listNoticeReadUsers } from "@/api/system/notice"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ReadUsers",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
noticeId: undefined,
|
||||||
|
noticeTitle: "",
|
||||||
|
total: 0,
|
||||||
|
userList: [],
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
noticeId: undefined,
|
||||||
|
searchValue: undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(row) {
|
||||||
|
this.noticeId = row.noticeId
|
||||||
|
this.noticeTitle = row.noticeTitle
|
||||||
|
this.queryParams.noticeId = row.noticeId
|
||||||
|
this.queryParams.searchValue = undefined
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.visible = true
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.loading = true
|
||||||
|
listNoticeReadUsers(this.queryParams).then(res => {
|
||||||
|
this.userList = res.rows
|
||||||
|
this.total = res.total
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm")
|
||||||
|
this.handleQuery()
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.userList = []
|
||||||
|
this.total = 0
|
||||||
|
this.queryParams.searchValue = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.read-stat {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #606266;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
.read-stat strong {
|
||||||
|
color: #409eff;
|
||||||
|
font-size: 15px;
|
||||||
|
margin: 0 2px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -72,12 +72,11 @@
|
|||||||
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
||||||
<el-table-column
|
<el-table-column label="公告标题" align="center" :show-overflow-tooltip="true">
|
||||||
label="公告标题"
|
<template slot-scope="scope">
|
||||||
align="center"
|
<a class="link-type" style="cursor:pointer" @click="handleViewData(scope.row)">{{ scope.row.noticeTitle }}</a>
|
||||||
prop="noticeTitle"
|
</template>
|
||||||
:show-overflow-tooltip="true"
|
</el-table-column>
|
||||||
/>
|
|
||||||
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
||||||
@@ -96,6 +95,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-user"
|
||||||
|
@click="handleReadUsers(scope.row)"
|
||||||
|
v-hasPermi="['system:notice:list']"
|
||||||
|
>阅读用户</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
@@ -166,14 +172,20 @@
|
|||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<notice-detail-view ref="noticeViewRef" />
|
||||||
|
<read-users-dialog ref="readUsersRef" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import NoticeDetailView from "@/layout/components/HeaderNotice/DetailView"
|
||||||
|
import ReadUsersDialog from "./ReadUsers"
|
||||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
|
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Notice",
|
name: "Notice",
|
||||||
|
components: { NoticeDetailView, ReadUsersDialog },
|
||||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -258,7 +270,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.noticeId)
|
this.ids = selection.map(item => item.noticeId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
@@ -278,7 +290,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.noticeId != undefined) {
|
if (this.form.noticeId != undefined) {
|
||||||
@@ -297,6 +309,14 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
/** 查看公告详情 */
|
||||||
|
handleViewData(row) {
|
||||||
|
this.$refs.noticeViewRef.open(row)
|
||||||
|
},
|
||||||
|
/** 查看已读用户 */
|
||||||
|
handleReadUsers(row) {
|
||||||
|
this.$refs.readUsersRef.open(row)
|
||||||
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const noticeIds = row.noticeId || this.ids
|
const noticeIds = row.noticeId || this.ids
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.postId)
|
this.ids = selection.map(item => item.postId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
@@ -269,7 +269,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.postId != undefined) {
|
if (this.form.postId != undefined) {
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.roleId)
|
this.ids = selection.map(item => item.roleId)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length != 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
// 更多操作触发
|
// 更多操作触发
|
||||||
@@ -547,12 +547,12 @@ export default {
|
|||||||
this.title = "分配数据权限"
|
this.title = "分配数据权限"
|
||||||
},
|
},
|
||||||
/** 分配用户操作 */
|
/** 分配用户操作 */
|
||||||
handleAuthUser: function(row) {
|
handleAuthUser(row) {
|
||||||
const roleId = row.roleId
|
const roleId = row.roleId
|
||||||
this.$router.push("/system/role-auth/user/" + roleId)
|
this.$router.push("/system/role-auth/user/" + roleId)
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.roleId != undefined) {
|
if (this.form.roleId != undefined) {
|
||||||
@@ -574,7 +574,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 提交按钮(数据权限) */
|
/** 提交按钮(数据权限) */
|
||||||
submitDataScope: function() {
|
submitDataScope() {
|
||||||
if (this.form.roleId != undefined) {
|
if (this.form.roleId != undefined) {
|
||||||
this.form.deptIds = this.getDeptAllCheckedKeys()
|
this.form.deptIds = this.getDeptAllCheckedKeys()
|
||||||
dataScope(this.form).then(() => {
|
dataScope(this.form).then(() => {
|
||||||
|
|||||||
@@ -1,98 +1,86 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container tree-sidebar-manage-wrap">
|
||||||
<el-row :gutter="20">
|
<tree-panel title="组织机构" :tree-data="deptOptions" search-placeholder="请输入部门名称" storage-key="dept-sidebar-width" :defaultExpandAll="true" @node-click="handleNodeClick" @refresh="getDeptTree" ref="deptTreeRef" />
|
||||||
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
|
<div class="tree-sidebar-content">
|
||||||
<!--部门数据-->
|
<div class="content-inner">
|
||||||
<pane size="16">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-col>
|
<el-form-item label="用户名称" prop="userName">
|
||||||
<div class="head-container">
|
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
|
||||||
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
<div class="head-container">
|
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
|
||||||
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
|
</el-form-item>
|
||||||
</div>
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
||||||
|
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</pane>
|
<el-col :span="1.5">
|
||||||
<!--用户数据-->
|
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']">修改</el-button>
|
||||||
<pane size="84">
|
|
||||||
<el-col>
|
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
||||||
<el-form-item label="用户名称" prop="userName">
|
|
||||||
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="手机号码" prop="phonenumber">
|
|
||||||
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
|
||||||
<el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="创建时间">
|
|
||||||
<el-date-picker v-model="dateRange" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['system:user:edit']">修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
|
||||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns.userId.visible" />
|
|
||||||
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns.userName.visible" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns.nickName.visible" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns.deptName.visible" :show-overflow-tooltip="true" />
|
|
||||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns.phonenumber.visible" width="120" />
|
|
||||||
<el-table-column label="状态" align="center" key="status" v-if="columns.status.visible">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns.createTime.visible" width="160">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
|
|
||||||
<template slot-scope="scope" v-if="scope.row.userId !== 1">
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>
|
|
||||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
|
||||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
|
||||||
<el-dropdown-menu slot="dropdown">
|
|
||||||
<el-dropdown-item command="handleResetPwd" icon="el-icon-key" v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
|
|
||||||
<el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check" v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
|
|
||||||
</el-dropdown-menu>
|
|
||||||
</el-dropdown>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</pane>
|
<el-col :span="1.5">
|
||||||
</splitpanes>
|
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
</el-row>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['system:user:import']">导入</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:user:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
|
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns.userId.visible" />
|
||||||
|
<el-table-column label="用户名称" align="center" key="userName" v-if="columns.userName.visible" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<a class="link-type" style="cursor:pointer" @click="handleViewData(scope.row)">{{ scope.row.userName }}</a>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns.nickName.visible" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns.deptName.visible" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns.phonenumber.visible" width="120" />
|
||||||
|
<el-table-column label="状态" align="center" key="status" v-if="columns.status.visible">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns.createTime.visible" width="160">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope" v-if="scope.row.userId !== 1">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
|
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item command="handleResetPwd" icon="el-icon-key" v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check" v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 添加或修改用户配置对话框 -->
|
<!-- 添加或修改用户配置对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||||
@@ -128,7 +116,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password" :rules="pwdValidator">
|
||||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -179,39 +167,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 用户详情抽屉 -->
|
||||||
|
<user-view-drawer ref="userViewRef" />
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
<excel-import-dialog ref="importUserRef" title="用户导入" action="/system/user/importData" template-action="/system/user/importTemplate" template-file-name="user_template" update-support-label="是否更新已经存在的用户数据" @success="getList" />
|
||||||
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
|
||||||
<i class="el-icon-upload"></i>
|
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
||||||
<div class="el-upload__tip text-center" slot="tip">
|
|
||||||
<div class="el-upload__tip" slot="tip">
|
|
||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
|
||||||
</div>
|
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
||||||
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板</el-link>
|
|
||||||
</div>
|
|
||||||
</el-upload>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
||||||
<el-button @click="upload.open = false">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"
|
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user"
|
||||||
import { getToken } from "@/utils/auth"
|
|
||||||
import Treeselect from "@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"
|
||||||
import { Splitpanes, Pane } from "splitpanes"
|
import TreePanel from "@/components/TreePanel"
|
||||||
import "splitpanes/dist/splitpanes.css"
|
import ExcelImportDialog from "@/components/ExcelImportDialog"
|
||||||
|
import UserViewDrawer from "./view"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "User",
|
name: "User",
|
||||||
|
mixins: [passwordRule],
|
||||||
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||||
components: { Treeselect, Splitpanes, Pane },
|
components: { Treeselect, TreePanel, ExcelImportDialog, UserViewDrawer },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
@@ -236,8 +212,6 @@ export default {
|
|||||||
enabledDeptOptions: undefined,
|
enabledDeptOptions: undefined,
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 部门名称
|
|
||||||
deptName: undefined,
|
|
||||||
// 默认密码
|
// 默认密码
|
||||||
initPassword: undefined,
|
initPassword: undefined,
|
||||||
// 日期范围
|
// 日期范围
|
||||||
@@ -248,25 +222,6 @@ export default {
|
|||||||
roleOptions: [],
|
roleOptions: [],
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
defaultProps: {
|
|
||||||
children: "children",
|
|
||||||
label: "label"
|
|
||||||
},
|
|
||||||
// 用户导入参数
|
|
||||||
upload: {
|
|
||||||
// 是否显示弹出层(用户导入)
|
|
||||||
open: false,
|
|
||||||
// 弹出层标题(用户导入)
|
|
||||||
title: "",
|
|
||||||
// 是否禁用上传
|
|
||||||
isUploading: false,
|
|
||||||
// 是否更新已经存在的用户数据
|
|
||||||
updateSupport: 0,
|
|
||||||
// 设置上传的请求头部
|
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
|
||||||
// 上传的地址
|
|
||||||
url: process.env.VUE_APP_BASE_API + "/system/user/importData"
|
|
||||||
},
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -295,11 +250,6 @@ export default {
|
|||||||
nickName: [
|
nickName: [
|
||||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
password: [
|
|
||||||
{ required: true, message: "用户密码不能为空", trigger: "blur" },
|
|
||||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
type: "email",
|
type: "email",
|
||||||
@@ -317,12 +267,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
// 根据名称筛选部门树
|
|
||||||
deptName(val) {
|
|
||||||
this.$refs.tree.filter(val)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
this.getDeptTree()
|
this.getDeptTree()
|
||||||
@@ -335,11 +279,10 @@ export default {
|
|||||||
getList() {
|
getList() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
this.userList = response.rows
|
this.userList = response.rows
|
||||||
this.total = response.total
|
this.total = response.total
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
})
|
||||||
)
|
|
||||||
},
|
},
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
getDeptTree() {
|
getDeptTree() {
|
||||||
@@ -360,11 +303,6 @@ export default {
|
|||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 筛选节点
|
|
||||||
filterNode(value, data) {
|
|
||||||
if (!value) return true
|
|
||||||
return data.label.indexOf(value) !== -1
|
|
||||||
},
|
|
||||||
// 节点单击事件
|
// 节点单击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
this.queryParams.deptId = data.id
|
this.queryParams.deptId = data.id
|
||||||
@@ -414,7 +352,7 @@ export default {
|
|||||||
this.dateRange = []
|
this.dateRange = []
|
||||||
this.resetForm("queryForm")
|
this.resetForm("queryForm")
|
||||||
this.queryParams.deptId = undefined
|
this.queryParams.deptId = undefined
|
||||||
this.$refs.tree.setCurrentKey(null)
|
this.$refs.deptTreeRef.setCurrentKey(null)
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
@@ -464,30 +402,24 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
handleResetPwd(row) {
|
handleResetPwd(row) {
|
||||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
this.$prompt(`请输入「${row.userName}」的新密码`, "重置密码", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
inputPattern: /^.{5,20}$/,
|
inputValidator: this.pwdPromptValidator
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
|
||||||
inputValidator: (value) => {
|
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
|
||||||
return "不能包含非法字符:< > \" ' \\\ |"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(() => {
|
resetUserPwd(row.userId, value).then(() => {
|
||||||
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
||||||
})
|
})
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
/** 分配角色操作 */
|
/** 分配角色操作 */
|
||||||
handleAuthRole: function(row) {
|
handleAuthRole(row) {
|
||||||
const userId = row.userId
|
const userId = row.userId
|
||||||
this.$router.push("/system/user-auth/role/" + userId)
|
this.$router.push("/system/user-auth/role/" + userId)
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.userId != undefined) {
|
if (this.form.userId != undefined) {
|
||||||
@@ -522,37 +454,14 @@ export default {
|
|||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `user_${new Date().getTime()}.xlsx`)
|
}, `user_${new Date().getTime()}.xlsx`)
|
||||||
},
|
},
|
||||||
|
/** 详情按钮操作 */
|
||||||
|
handleViewData(row) {
|
||||||
|
this.$refs.userViewRef.open(row.userId)
|
||||||
|
},
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
handleImport() {
|
handleImport() {
|
||||||
this.upload.title = "用户导入"
|
this.$refs.importUserRef.open()
|
||||||
this.upload.open = true
|
|
||||||
},
|
|
||||||
/** 下载模板操作 */
|
|
||||||
importTemplate() {
|
|
||||||
this.download('system/user/importTemplate', {
|
|
||||||
}, `user_template_${new Date().getTime()}.xlsx`)
|
|
||||||
},
|
|
||||||
// 文件上传中处理
|
|
||||||
handleFileUploadProgress(event, file, fileList) {
|
|
||||||
this.upload.isUploading = true
|
|
||||||
},
|
|
||||||
// 文件上传成功处理
|
|
||||||
handleFileSuccess(response, file, fileList) {
|
|
||||||
this.upload.open = false
|
|
||||||
this.upload.isUploading = false
|
|
||||||
this.$refs.upload.clearFiles()
|
|
||||||
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true })
|
|
||||||
this.getList()
|
|
||||||
},
|
|
||||||
// 提交上传文件
|
|
||||||
submitFileForm() {
|
|
||||||
const file = this.$refs.upload.uploadFiles
|
|
||||||
if (!file || file.length === 0 || !file[0].name.toLowerCase().endsWith('.xls') && !file[0].name.toLowerCase().endsWith('.xlsx')) {
|
|
||||||
this.$modal.msgError("请选择后缀为 “xls”或“xlsx”的文件。")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.$refs.upload.submit()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="user" :rules="formRules" label-width="80px">
|
||||||
<el-form-item label="旧密码" prop="oldPassword">
|
<el-form-item label="旧密码" prop="oldPassword">
|
||||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="新密码" prop="newPassword">
|
<el-form-item label="新密码" prop="newPassword" :rules="infoPwdValidator">
|
||||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="确认密码" prop="confirmPassword">
|
<el-form-item label="确认密码" prop="confirmPassword">
|
||||||
@@ -18,35 +18,36 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { updateUserPwd } from "@/api/system/user"
|
import { updateUserPwd } from "@/api/system/user"
|
||||||
|
import passwordRule from "@/utils/passwordRule"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [passwordRule],
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
|
||||||
if (this.user.newPassword !== value) {
|
|
||||||
callback(new Error("两次输入的密码不一致"))
|
|
||||||
} else {
|
|
||||||
callback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
user: {
|
user: {
|
||||||
oldPassword: undefined,
|
oldPassword: undefined,
|
||||||
newPassword: undefined,
|
newPassword: undefined,
|
||||||
confirmPassword: undefined
|
confirmPassword: undefined
|
||||||
},
|
}
|
||||||
// 表单校验
|
}
|
||||||
rules: {
|
},
|
||||||
|
computed: {
|
||||||
|
formRules() {
|
||||||
|
return {
|
||||||
oldPassword: [
|
oldPassword: [
|
||||||
{ required: true, message: "旧密码不能为空", trigger: "blur" }
|
{ required: true, message: "旧密码不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
newPassword: [
|
|
||||||
{ required: true, message: "新密码不能为空", trigger: "blur" },
|
|
||||||
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" },
|
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
|
||||||
],
|
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
||||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (this.user.newPassword !== value) {
|
||||||
|
callback(new Error("两次输入的密码不一致"))
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}, trigger: "blur"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
177
ruoyi-ui/src/views/system/user/view.vue
Normal file
177
ruoyi-ui/src/views/system/user/view.vue
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="用户信息详情" :visible.sync="visible" direction="rtl" size="68%" append-to-body :before-close="handleClose" custom-class="detail-drawer">
|
||||||
|
<div v-loading="loading" class="drawer-content">
|
||||||
|
<!-- 基本信息 -->
|
||||||
|
<h4 class="section-header">基本信息</h4>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">用户名称:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.nickName }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">归属部门:</label>
|
||||||
|
<span class="info-value plaintext">{{ (info.dept && info.dept.deptName) }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">手机号码:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.phonenumber }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">邮箱:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.email }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">登录账号:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.userName }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">用户状态:</label>
|
||||||
|
<span class="info-value plaintext">
|
||||||
|
<el-tag size="small" :type="info.status === '0' ? 'success' : 'danger'">{{ info.status === '0' ? '正常' : '停用' }}</el-tag>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">岗位:</label>
|
||||||
|
<span class="info-value plaintext">{{ postNames || '无岗位' }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">用户性别:</label>
|
||||||
|
<span class="info-value plaintext">{{ sexLabel }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="24">
|
||||||
|
<div class="info-item full-width">
|
||||||
|
<label class="info-label">角色:</label>
|
||||||
|
<span class="info-value plaintext">{{ roleNames || '无角色' }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<!-- 其他信息 -->
|
||||||
|
<h4 class="section-header">其他信息</h4>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">创建者:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.createBy }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">创建时间:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.createTime }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">更新者:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.updateBy }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">更新时间:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.updateTime }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">最后登录IP:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.loginIp }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div class="info-item">
|
||||||
|
<label class="info-label">最后登录时间:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.loginDate }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20" class="mb8">
|
||||||
|
<el-col :span="24">
|
||||||
|
<div class="info-item full-width">
|
||||||
|
<label class="info-label">备注:</label>
|
||||||
|
<span class="info-value plaintext">{{ info.remark }}</span>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getUser } from '@/api/system/user'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserViewDrawer',
|
||||||
|
dicts: ['sys_user_sex'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
info: {},
|
||||||
|
postOptions: [],
|
||||||
|
roleOptions: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sexLabel() {
|
||||||
|
return this.selectDictLabel(this.dict.type.sys_user_sex, this.info.sex) || '-'
|
||||||
|
},
|
||||||
|
postNames() {
|
||||||
|
if (!this.postOptions.length) return ''
|
||||||
|
const ids = this.info.postIds || []
|
||||||
|
return this.postOptions.filter(p => ids.includes(p.postId)).map(p => p.postName).join('、') || ''
|
||||||
|
},
|
||||||
|
roleNames() {
|
||||||
|
if (!this.roleOptions.length) return ''
|
||||||
|
const ids = this.info.roleIds || []
|
||||||
|
return this.roleOptions.filter(r => ids.includes(r.roleId)).map(r => r.roleName).join('、') || ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(userId) {
|
||||||
|
this.visible = true
|
||||||
|
this.loading = true
|
||||||
|
getUser(userId).then(res => {
|
||||||
|
this.info = res.data || {}
|
||||||
|
this.postOptions = res.posts || []
|
||||||
|
this.roleOptions = res.roles || []
|
||||||
|
this.info.postIds = res.postIds || []
|
||||||
|
this.info.roleIds = res.roleIds || []
|
||||||
|
}).finally(() => {
|
||||||
|
this.loading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -183,6 +183,7 @@ export default {
|
|||||||
const genTable = Object.assign({}, basicForm.model, genForm.model)
|
const genTable = Object.assign({}, basicForm.model, genForm.model)
|
||||||
genTable.columns = this.columns
|
genTable.columns = this.columns
|
||||||
genTable.params = {
|
genTable.params = {
|
||||||
|
genView: genTable.view ? '1' : '0',
|
||||||
treeCode: genTable.treeCode,
|
treeCode: genTable.treeCode,
|
||||||
treeName: genTable.treeName,
|
treeName: genTable.treeName,
|
||||||
treeParentCode: genTable.treeParentCode,
|
treeParentCode: genTable.treeParentCode,
|
||||||
|
|||||||
@@ -69,6 +69,29 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item prop="formColNum">
|
||||||
|
<span slot="label">
|
||||||
|
表单布局
|
||||||
|
<el-tooltip content="选择表单的栅格布局方式" placement="top">
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
<el-select v-model="info.formColNum">
|
||||||
|
<el-option label="单列" :value="1" />
|
||||||
|
<el-option label="双列" :value="2" />
|
||||||
|
<el-option label="三列" :value="3" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item prop="genView">
|
||||||
|
<span slot="label">扩展功能</span>
|
||||||
|
<el-checkbox v-model="info.view">生成详情页</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item prop="genType">
|
<el-form-item prop="genType">
|
||||||
<span slot="label">
|
<span slot="label">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi</artifactId>
|
<artifactId>ruoyi</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-visual</artifactId>
|
<artifactId>ruoyi-visual</artifactId>
|
||||||
<version>3.6.7</version>
|
<version>3.6.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -552,6 +552,7 @@ insert into sys_config values(4, '账号自助-是否开启用户注册功能',
|
|||||||
insert into sys_config values(5, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)');
|
insert into sys_config values(5, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)');
|
||||||
insert into sys_config values(6, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '1', 'Y', 'admin', sysdate(), '', null, '0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框');
|
insert into sys_config values(6, '用户管理-初始密码修改策略', 'sys.account.initPasswordModify', '1', 'Y', 'admin', sysdate(), '', null, '0:初始密码修改策略关闭,没有任何提示,1:提醒用户,如果未修改初始密码,则在登录时就会提醒修改密码对话框');
|
||||||
insert into sys_config values(7, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
insert into sys_config values(7, '用户管理-账号密码更新周期', 'sys.account.passwordValidateDays', '0', 'Y', 'admin', sysdate(), '', null, '密码更新周期(填写数字,数据初始化值为0不限制,若修改必须为大于0小于365的正整数),如果超过这个周期登录系统时,则在登录时就会提醒修改密码对话框');
|
||||||
|
insert into sys_config values(8, '用户管理-密码字符范围', 'sys.account.chrtype', '0', 'Y', 'admin', sysdate(), '', null, '默认任意字符范围,0任意(密码可以输入任意字符),1数字(密码只能为0-9数字),2英文字母(密码只能为a-z和A-Z字母),3字母和数字(密码必须包含字母,数字),4字母数字和特殊字符(目前支持的特殊字符包括:~!@#$%^&*()-=_+)');
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
@@ -674,6 +675,7 @@ create table gen_table (
|
|||||||
business_name varchar(30) comment '生成业务名',
|
business_name varchar(30) comment '生成业务名',
|
||||||
function_name varchar(50) comment '生成功能名',
|
function_name varchar(50) comment '生成功能名',
|
||||||
function_author varchar(50) comment '生成功能作者',
|
function_author varchar(50) comment '生成功能作者',
|
||||||
|
form_col_num int(1) default 1 comment '表单布局(单列 双列 三列)',
|
||||||
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
|
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
|
||||||
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
||||||
options varchar(1000) comment '其它生成选项',
|
options varchar(1000) comment '其它生成选项',
|
||||||
Reference in New Issue
Block a user