mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-04-26 01:07:52 +08:00
Compare commits
173 Commits
v3.6.8
...
springboot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d97c94ffc8 | ||
|
|
fc9d7cb4d8 | ||
|
|
24f28090e0 | ||
|
|
48d94f7b48 | ||
|
|
44fa3cebc3 | ||
|
|
6f17a6077e | ||
|
|
c922c9d68c | ||
|
|
c58a9eacde | ||
|
|
f3b34285f3 | ||
|
|
2b26b1457e | ||
|
|
8befe8a1c3 | ||
|
|
6f57599599 | ||
|
|
3b35a0d76a | ||
|
|
27d87d3101 | ||
|
|
a57fbeb1a3 | ||
|
|
9753007f94 | ||
|
|
37143acc77 | ||
|
|
f02efef9ef | ||
|
|
20c6c6d0bd | ||
|
|
9565ac51a4 | ||
|
|
34335db4a0 | ||
|
|
0027382952 | ||
|
|
5ee971821b | ||
|
|
427b313376 | ||
|
|
535658af9f | ||
|
|
d5e8ebfc31 | ||
|
|
14d99de58c | ||
|
|
23278020ac | ||
|
|
3550349018 | ||
|
|
06f6d1b47f | ||
|
|
c363bf88f5 | ||
|
|
4681d299d7 | ||
|
|
51d4d129fb | ||
|
|
bbc899dc45 | ||
|
|
771c775120 | ||
|
|
0c4d414e08 | ||
|
|
a42431e012 | ||
|
|
8dadbd9a51 | ||
|
|
ea6ea5755f | ||
|
|
996e0eb48b | ||
|
|
c3d3a1cbdb | ||
|
|
255d2aa813 | ||
|
|
3b24a44cf0 | ||
|
|
43728c99f0 | ||
|
|
c600cb7ac1 | ||
|
|
6a074c8832 | ||
|
|
fefad4e147 | ||
|
|
316117524d | ||
|
|
c5cd75fe17 | ||
|
|
704fefced2 | ||
|
|
15e0913714 | ||
|
|
df0f7d16a4 | ||
|
|
a5ced3b531 | ||
|
|
2d9ce89b2e | ||
|
|
ec8e955955 | ||
|
|
0398aa0333 | ||
|
|
14063cd6ed | ||
|
|
a8b6799d8d | ||
|
|
a492ebf41e | ||
|
|
8d6790b358 | ||
|
|
c763a0f356 | ||
|
|
227f62dbe2 | ||
|
|
e5d494d018 | ||
|
|
0f9e698fb5 | ||
|
|
3d4c6f4fa1 | ||
|
|
40a52af8ee | ||
|
|
9e67041290 | ||
|
|
c17ed8bb04 | ||
|
|
64e5288625 | ||
|
|
afe8236b42 | ||
|
|
21ee628202 | ||
|
|
b54e00529a | ||
|
|
3f4484107a | ||
|
|
341c9a8851 | ||
|
|
81bfef9a3c | ||
|
|
7238dbb807 | ||
|
|
ff9068b9d4 | ||
|
|
ea8351cce0 | ||
|
|
8ef3b5490e | ||
|
|
1284f6763f | ||
|
|
eeb6303200 | ||
|
|
513335d9db | ||
|
|
1a373f41e6 | ||
|
|
e73aa3b497 | ||
|
|
d5d6b9789c | ||
|
|
6b0bd81f56 | ||
|
|
0be3a0720d | ||
|
|
83e5f2e24d | ||
|
|
942df70c21 | ||
|
|
32cb5e8851 | ||
|
|
ffce2af11e | ||
|
|
aeb698985b | ||
|
|
ec15604725 | ||
|
|
67642ed19a | ||
|
|
604345f72b | ||
|
|
eb01cde0b1 | ||
|
|
217119575d | ||
|
|
86d5eae71f | ||
|
|
aa72ac20d1 | ||
|
|
b1e0418c77 | ||
|
|
8e32654d46 | ||
|
|
c8c0127185 | ||
|
|
46e75b4d7e | ||
|
|
a735ed90f7 | ||
|
|
e64bb2d7be | ||
|
|
496d6113c4 | ||
|
|
f871171d32 | ||
|
|
a36e19d88e | ||
|
|
235728fdb9 | ||
|
|
381077253d | ||
|
|
5f3a93d12e | ||
|
|
e22323971e | ||
|
|
f593d36745 | ||
|
|
9978594069 | ||
|
|
9026c8e49e | ||
|
|
c359924d4e | ||
|
|
f8d726f966 | ||
|
|
cbdbc91784 | ||
|
|
3a61e8df5a | ||
|
|
9d242f0182 | ||
|
|
2afad16eba | ||
|
|
637a628cfc | ||
|
|
785f3c3515 | ||
|
|
85dc2aef8f | ||
|
|
3a91cb47a4 | ||
|
|
7d611b754f | ||
|
|
6be79bd7d4 | ||
|
|
13942b41b2 | ||
|
|
583f653890 | ||
|
|
9ebb230d66 | ||
|
|
65cc92286f | ||
|
|
fe1badd9a6 | ||
|
|
48830b1181 | ||
|
|
4257ca91b2 | ||
|
|
15b2502ffa | ||
|
|
eb035d179b | ||
|
|
b959a91d26 | ||
|
|
28377670bb | ||
|
|
1215d5d474 | ||
|
|
7b4fbf4e13 | ||
|
|
eaeb8d759e | ||
|
|
bba6433113 | ||
|
|
61a49b5951 | ||
|
|
8d631d1325 | ||
|
|
d302cdb324 | ||
|
|
33af14461f | ||
|
|
cff2e611c5 | ||
|
|
72bc8bfc53 | ||
|
|
4a6603d8b3 | ||
|
|
2b425e62e4 | ||
|
|
a837f49291 | ||
|
|
3a2e434a53 | ||
|
|
08484eea75 | ||
|
|
a5f3be78ec | ||
|
|
0fc5c7199e | ||
|
|
1af0861a3b | ||
|
|
bea8f763bb | ||
|
|
78d958ec8c | ||
|
|
101f7e3cf7 | ||
|
|
b92fb20439 | ||
|
|
264d6e320e | ||
|
|
1f0eb72a58 | ||
|
|
eb2e089d57 | ||
|
|
efdc96abb6 | ||
|
|
64dc968949 | ||
|
|
dcc303a8d4 | ||
|
|
cc0c6deb38 | ||
|
|
c2157d7f2a | ||
|
|
f6c8be3285 | ||
|
|
4f8c2215b3 | ||
|
|
6f94f4d1e0 | ||
|
|
f2aad7a76c | ||
|
|
c50a2b4200 |
10
README.md
10
README.md
@@ -13,8 +13,8 @@
|
||||
|
||||
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
|
||||
|
||||
* 采用前后端分离的模式,微服务版本前端(基于 [RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue))。
|
||||
* 后端采用Spring Boot、Spring Cloud & Alibaba。
|
||||
* 本仓库为RuoYi-Cloud的Spring Boot 3 的版本,保持同步更新。
|
||||
* 后端采用Spring Boot3、Spring Cloud & Alibaba。
|
||||
* 注册中心、配置中心选型Nacos,权限认证使用Redis。
|
||||
* 流量控制框架选型Sentinel,分布式事务选型Seata。
|
||||
* 阿里云优惠券:[点我进入](http://aly.ruoyi.vip),腾讯云优惠券:[点我进入](http://txy.ruoyi.vip)
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
RuoYi-Cloud 后端项目提供 Spring Boot 2.x / 3.x / 4.x 多版本分支的并行维护。
|
||||
|
||||
| 名称 | 说明 | 地址 |
|
||||
| :---------------- | :----------------------------------- | :-------------------------------------------------------- |
|
||||
| 名称 | 说明 | 地址 |
|
||||
| :---------------- | :------------------------ | :-------------------------------------------------------- |
|
||||
| master 默认分支 | Spring Boot 4.x (JDK 17+、Nacos 3.x) | https://gitee.com/y_project/RuoYi-Cloud |
|
||||
| springboot3 分支 | Spring Boot 3.x (JDK 17+、Nacos 3.x) | https://gitee.com/y_project/RuoYi-Cloud/tree/springboot3 |
|
||||
| springboot2 分支 | Spring Boot 2.x (JDK 8+、 Nacos 2.x) | https://gitee.com/y_project/RuoYi-Cloud/tree/springboot2 |
|
||||
| springboot2 分支 | Spring Boot 2.x (JDK 8+、Nacos 2.x) | https://gitee.com/y_project/RuoYi-Cloud/tree/springboot2 |
|
||||
|
||||
RuoYi-Cloud 前端项目提供 Vue 2.x / 3.x / JavaScript TypeScript 版本均可混用搭配
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ usage() {
|
||||
|
||||
# copy sql
|
||||
echo "begin copy sql "
|
||||
cp ../sql/ry_20260321.sql ./mysql/db
|
||||
cp ../sql/ry_20260402.sql ./mysql/db
|
||||
cp ../sql/ry_config_20260311.sql ./mysql/db
|
||||
|
||||
# copy html
|
||||
|
||||
20
pom.xml
20
pom.xml
@@ -17,14 +17,14 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version>
|
||||
<spring-boot.version>4.0.3</spring-boot.version>
|
||||
<spring-cloud.version>2025.1.0</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2025.1.0.0</spring-cloud-alibaba.version>
|
||||
<spring-boot-admin.version>4.0.2</spring-boot-admin.version>
|
||||
<mybatis-spring-boot.version>4.0.1</mybatis-spring-boot.version>
|
||||
<spring-boot.version>3.5.11</spring-boot.version>
|
||||
<spring-cloud.version>2025.0.1</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2025.0.0.0</spring-cloud-alibaba.version>
|
||||
<spring-boot-admin.version>3.5.8</spring-boot-admin.version>
|
||||
<mybatis-spring.version>3.0.5</mybatis-spring.version>
|
||||
<kaptcha.version>2.3.3</kaptcha.version>
|
||||
<pagehelper.boot.version>2.1.0</pagehelper.boot.version>
|
||||
<druid.version>1.2.28</druid.version>
|
||||
<druid.version>1.2.27</druid.version>
|
||||
<dynamic-ds.version>4.5.0</dynamic-ds.version>
|
||||
<commons.io.version>2.21.0</commons.io.version>
|
||||
<velocity.version>2.3</velocity.version>
|
||||
@@ -32,7 +32,7 @@
|
||||
<jjwt.version>0.9.1</jjwt.version>
|
||||
<minio.version>8.2.2</minio.version>
|
||||
<poi.version>4.1.2</poi.version>
|
||||
<springdoc.version>3.0.2</springdoc.version>
|
||||
<springdoc.version>2.8.16</springdoc.version>
|
||||
<transmittable-thread-local.version>2.14.5</transmittable-thread-local.version>
|
||||
</properties>
|
||||
|
||||
@@ -95,9 +95,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>${mybatis-spring-boot.version}</version>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>${mybatis-spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- io常用工具类 -->
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.api.domain;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import jakarta.validation.constraints.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
@@ -68,6 +69,7 @@ public class SysUser extends BaseEntity
|
||||
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)
|
||||
private Date loginDate;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.ruoyi.auth;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
|
||||
<!-- Mybatis Spring -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Hibernate Validator -->
|
||||
@@ -68,7 +68,7 @@
|
||||
<!-- Spring Aop -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aspectj</artifactId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson -->
|
||||
|
||||
@@ -142,4 +142,35 @@ public class Constants
|
||||
*/
|
||||
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" };
|
||||
|
||||
/**
|
||||
* 部门相关常量
|
||||
*/
|
||||
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 GEN_VIEW = "genView";
|
||||
|
||||
/** 数据库字符串类型 */
|
||||
public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" };
|
||||
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package com.ruoyi.common.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.Strings;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import com.ruoyi.common.core.text.StrFormatter;
|
||||
@@ -371,87 +367,12 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转set
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param sep 分隔符
|
||||
* @return set集合
|
||||
*/
|
||||
public static final Set<String> str2Set(String str, String sep)
|
||||
{
|
||||
return new HashSet<String>(str2List(str, sep, true, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转list
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param sep 分隔符
|
||||
* @return list集合
|
||||
*/
|
||||
public static final List<String> str2List(String str, String sep)
|
||||
{
|
||||
return str2List(str, sep, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转list
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param sep 分隔符
|
||||
* @param filterBlank 过滤纯空白
|
||||
* @param trim 去掉首尾空白
|
||||
* @return list集合
|
||||
*/
|
||||
public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim)
|
||||
{
|
||||
List<String> list = new ArrayList<String>();
|
||||
if (StringUtils.isEmpty(str))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
// 过滤空白字符串
|
||||
if (filterBlank && StringUtils.isBlank(str))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
String[] split = str.split(sep);
|
||||
for (String string : split)
|
||||
{
|
||||
if (filterBlank && StringUtils.isBlank(string))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (trim)
|
||||
{
|
||||
string = string.trim();
|
||||
}
|
||||
list.add(string);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查子字符串是否存在
|
||||
*
|
||||
* @param seq 检查的字符串
|
||||
* @param searchSeq 查找的字符串
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
|
||||
{
|
||||
return Strings.CS.contains(seq, searchSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断给定的collection列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value
|
||||
*
|
||||
* @param collection 给定的集合
|
||||
* @param array 给定的数组
|
||||
* @return 结果
|
||||
* @return boolean 结果
|
||||
*/
|
||||
public static boolean containsAny(Collection<String> collection, String... array)
|
||||
{
|
||||
@@ -472,198 +393,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否包含给定数组中的任意一个。
|
||||
*
|
||||
* @param cs 要判断的字符串
|
||||
* @param searchCharSequences 要判断的数组
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean containsAny(final CharSequence cs, final CharSequence... searchCharSequences)
|
||||
{
|
||||
return Strings.CS.containsAny(cs, searchCharSequences);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写
|
||||
*
|
||||
* @param cs 指定字符串
|
||||
* @param searchCharSequences 需要检查的字符串数组
|
||||
* @return 是否包含任意一个字符串
|
||||
*/
|
||||
public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences)
|
||||
{
|
||||
if (isEmpty(cs) || isEmpty(searchCharSequences))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (CharSequence testStr : searchCharSequences)
|
||||
{
|
||||
if (containsIgnoreCase(cs, testStr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否包含要搜索的字符串,忽略大小写
|
||||
*
|
||||
* @param str 要检查的字符串
|
||||
* @param searchStr 要查找的字符串
|
||||
* @return 如果包含要搜索的字符串(忽略大小写)则返回true,如果不包含或返回false
|
||||
*/
|
||||
public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr)
|
||||
{
|
||||
return Strings.CI.contains(str, searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查字符串是否以任意前缀开始
|
||||
*
|
||||
* @param sequence 要检查的字符串
|
||||
* @param searchStrings 区分大小写的字符串前缀数组
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean startsWithAny(final CharSequence sequence, final CharSequence... searchStrings)
|
||||
{
|
||||
return Strings.CS.startsWithAny(sequence, searchStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不区分大小写地检查一个字符串是否以指定前缀开头。
|
||||
*
|
||||
* @param str 待检查的字符串
|
||||
* @param 要查找的前缀
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean startsWithIgnoreCase(final CharSequence str, final CharSequence prefix)
|
||||
{
|
||||
return Strings.CI.startsWith(str, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较两个字符串是否相同
|
||||
*
|
||||
* @param cs1 第一个字符串
|
||||
* @param cs2 第二个字符串
|
||||
* @return 如果给定对象与字符串相等,则返回 true;否则返回 false
|
||||
*/
|
||||
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
|
||||
{
|
||||
return Strings.CS.equals(cs1, cs2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换字符串中所有匹配的字符
|
||||
*
|
||||
* @param text 要搜索和替换的文本
|
||||
* @param searchString 要搜索的字符串
|
||||
* @param replacement 用于替换的字符串
|
||||
* @return 处理完所有替换后的文本
|
||||
*/
|
||||
public static String replace(final String text, final String searchString, final String replacement)
|
||||
{
|
||||
return Strings.CS.replace(text, searchString, replacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅当子字符串位于源字符串末尾时才将其移除,否则返回源字符串。
|
||||
* @param str 要搜索的源字符串
|
||||
* @param remove 要搜索并移除的字符串
|
||||
* @return 如果找到并移除了字符串,则返回移除后的子字符串
|
||||
*/
|
||||
public static String removeEnd(final String str, final String remove)
|
||||
{
|
||||
return Strings.CS.removeEnd(str, remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找字符串首次出现位置的索引
|
||||
*
|
||||
* @param seq 要检查的字符串
|
||||
* @param searchSeq 要查找的字符串
|
||||
* @return 返回指定字符在字符串中第一次出现处的索引,如果此字符串中没有这样的字符,则返回 -1
|
||||
*/
|
||||
public static int indexOf(final CharSequence seq, final CharSequence searchSeq)
|
||||
{
|
||||
return Strings.CS.indexOf(seq, searchSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查字符串是否以指定的后缀结尾
|
||||
*
|
||||
* @param str 要检查的字符
|
||||
* @param suffix 要检查的后缀
|
||||
* @return 若参数与该字符串末尾相符 true;否则 false
|
||||
*/
|
||||
public static boolean endsWith(final CharSequence str, final CharSequence suffix)
|
||||
{
|
||||
return Strings.CS.endsWith(str, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将给定的字符串与数组进行比较
|
||||
*
|
||||
* @param string 要比较的字符串
|
||||
* @param searchStrings 字符串数组
|
||||
* @return 如果字符串等于(区分大小写){@code searchStrings}中的任意其他元素,则返回true;如果{@code searchStrings}为null或不包含匹配项,则返回false
|
||||
*/
|
||||
public static boolean equalsAny(final CharSequence string, final CharSequence... searchStrings)
|
||||
{
|
||||
return Strings.CS.equalsAny(string, searchStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查一个字符串是否以任意提供的区分大小写的后缀结尾。
|
||||
*
|
||||
* @param sequence 要检查的字符串
|
||||
* @param searchStrings 要查找的区分大小写的字符串数组
|
||||
* @return 如果输入参数{@code sequence}为null且未提供任何{@code searchStrings},或者输入{@code sequence}以任意提供的区分大小写的{@code searchStrings}结尾,则返回{@code true}。
|
||||
*/
|
||||
public static boolean endsWithAny(final CharSequence sequence, final CharSequence... searchStrings)
|
||||
{
|
||||
return Strings.CS.endsWithAny(sequence, searchStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 不区分大小写地检查字符序列是否以指定的后缀结尾
|
||||
*
|
||||
* @param str 要检查的字符序列
|
||||
* @param suffix 要查找的后缀
|
||||
* @return 如果字符序列以该后缀结尾(不区分大小写),或两者均为{@code null},则返回{@code true}
|
||||
*/
|
||||
public static boolean endsWithIgnoreCase(final CharSequence str, final CharSequence suffix)
|
||||
{
|
||||
return Strings.CI.endsWith(str, suffix);
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定范围内查找字符串,忽略大小写
|
||||
*
|
||||
* @param str 要检查的字符串
|
||||
* @param searchStr 要查找的字符串
|
||||
* @return 搜索字符串的第一个索引,如果未找到匹配项则返回 -1
|
||||
*/
|
||||
public static int indexOfIgnoreCase(final CharSequence str, final CharSequence searchStr)
|
||||
{
|
||||
return Strings.CI.indexOf(str, searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares given {@code string} to a CharSequences vararg of {@code searchStrings},
|
||||
* returning {@code true} if the {@code string} is equal to any of the {@code searchStrings}, ignoring case.
|
||||
*
|
||||
* @param string to compare, may be {@code null}.
|
||||
* @param searchStrings a vararg of strings, may be {@code null}.
|
||||
* @return {@code true} if the string is equal (case-insensitive) to any other element of {@code searchStrings};
|
||||
*/
|
||||
public static boolean equalsAnyIgnoreCase(final CharSequence string, final CharSequence... searchStrings)
|
||||
{
|
||||
return Strings.CI.equalsAny(string, searchStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
* 驼峰转下划线命名
|
||||
*/
|
||||
@@ -735,22 +464,6 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除最后一个字符串
|
||||
*
|
||||
* @param str 输入字符串
|
||||
* @param spit 以什么类型结尾的
|
||||
* @return 截取后的字符串
|
||||
*/
|
||||
public static String lastStringDel(String str, String spit)
|
||||
{
|
||||
if (!StringUtils.isEmpty(str) && str.endsWith(spit))
|
||||
{
|
||||
return str.subSequence(0, str.length() - 1).toString();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多 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表单
|
||||
*
|
||||
|
||||
@@ -7,13 +7,13 @@ import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Date;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 反射工具类. 提供调用getter/setter方法, 访问私有变量, 调用私有方法, 获取泛型类型Class, 被AOP过的真实类等工具函数.
|
||||
|
||||
@@ -7,17 +7,12 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.core.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import com.ruoyi.common.core.utils.PageUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.utils.sql.SqlUtil;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.web.page.PageDomain;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.web.page.TableSupport;
|
||||
|
||||
/**
|
||||
* web层通用数据处理
|
||||
@@ -53,19 +48,6 @@ public class BaseController
|
||||
PageUtils.startPage();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置请求排序数据
|
||||
*/
|
||||
protected void startOrderBy()
|
||||
{
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
|
||||
{
|
||||
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
|
||||
PageHelper.orderBy(orderBy);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理分页的线程变量
|
||||
*/
|
||||
|
||||
@@ -16,15 +16,25 @@ import java.lang.annotation.Target;
|
||||
@Documented
|
||||
public @interface DataScope
|
||||
{
|
||||
/**
|
||||
* 用户表的别名
|
||||
*/
|
||||
public String userAlias() default "";
|
||||
|
||||
/**
|
||||
* 部门表的别名
|
||||
*/
|
||||
public String deptAlias() default "";
|
||||
|
||||
/**
|
||||
* 用户表的别名
|
||||
* 用户字段名
|
||||
*/
|
||||
public String userAlias() default "";
|
||||
public String userField() default "user_id";
|
||||
|
||||
/**
|
||||
* 部门字段名
|
||||
*/
|
||||
public String deptField() default "dept_id";
|
||||
|
||||
/**
|
||||
* 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.ruoyi.common.core.constant.Constants;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.context.SecurityContextHolder;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
@@ -26,31 +27,6 @@ import com.ruoyi.system.api.model.LoginUser;
|
||||
@Component
|
||||
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())
|
||||
{
|
||||
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 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();
|
||||
List<String> conditions = new ArrayList<String>();
|
||||
List<String> scopeCustomIds = new ArrayList<String>();
|
||||
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()));
|
||||
}
|
||||
@@ -111,42 +87,42 @@ public class DataScopeAspect
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (DATA_SCOPE_ALL.equals(dataScope))
|
||||
if (Constants.Dept.DATA_SCOPE_ALL.equals(dataScope))
|
||||
{
|
||||
sqlString = new StringBuilder();
|
||||
conditions.add(dataScope);
|
||||
break;
|
||||
}
|
||||
else if (DATA_SCOPE_CUSTOM.equals(dataScope))
|
||||
else if (Constants.Dept.DATA_SCOPE_CUSTOM.equals(dataScope))
|
||||
{
|
||||
if (scopeCustomIds.size() > 1)
|
||||
{
|
||||
// 多个自定数据权限使用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
|
||||
{
|
||||
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))
|
||||
{
|
||||
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
||||
sqlString.append(StringUtils.format(" OR {}.{} = {} ", userAlias, userField, user.getUserId()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||
sqlString.append(StringUtils.format(" OR {}.{} = 0 ", deptAlias, deptField));
|
||||
}
|
||||
}
|
||||
conditions.add(dataScope);
|
||||
@@ -155,7 +131,7 @@ public class DataScopeAspect
|
||||
// 角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据
|
||||
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()))
|
||||
|
||||
@@ -20,21 +20,15 @@
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-4-starter</artifactId>
|
||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Dynamic DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot4-starter</artifactId>
|
||||
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId>
|
||||
<version>${dynamic-ds.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<groupId>org.mybatis</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.ruoyi.common.redis.configure;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
|
||||
import org.springframework.cache.annotation.CachingConfigurerSupport;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
@@ -14,15 +15,15 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@AutoConfigureBefore(RedisAutoConfiguration.class)
|
||||
@SuppressWarnings("deprecation")
|
||||
public class RedisConfig extends CachingConfigurerSupport
|
||||
{
|
||||
@Bean(name = "ruoyiRedisTemplate")
|
||||
@Primary
|
||||
@Bean
|
||||
@SuppressWarnings(value = { "unchecked", "rawtypes" })
|
||||
public RedisTemplate<Object, Object> ruoyiRedisTemplate(RedisConnectionFactory connectionFactory)
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory)
|
||||
{
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.common.security.annotation;
|
||||
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
@@ -18,7 +17,6 @@ public @interface EnableRyFeignClients
|
||||
{
|
||||
String[] value() default {};
|
||||
|
||||
@AliasFor(annotation = EnableFeignClients.class, attribute = "basePackages")
|
||||
String[] basePackages() default { "com.ruoyi" };
|
||||
|
||||
Class<?>[] basePackageClasses() default {};
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package com.ruoyi.common.security.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||
import java.util.TimeZone;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
@@ -16,11 +15,8 @@ public class ApplicationConfig
|
||||
* 时区配置
|
||||
*/
|
||||
@Bean
|
||||
public ObjectMapper objectMapper()
|
||||
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
|
||||
{
|
||||
ObjectMapper objectMapper = JsonMapper.builder().build();
|
||||
objectMapper.findAndRegisterModules();
|
||||
objectMapper.setTimeZone(TimeZone.getDefault());
|
||||
return objectMapper;
|
||||
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringDoc webmvc -->
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.ruoyi.common.swagger.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springdoc.core.configuration.SpringDocConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -19,6 +21,7 @@ import io.swagger.v3.oas.models.servers.Server;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@AutoConfiguration(before = SpringDocConfiguration.class)
|
||||
@EnableConfigurationProperties(SpringDocProperties.class)
|
||||
@ConditionalOnProperty(name = "springdoc.api-docs.enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class SpringDocAutoConfiguration
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.ruoyi.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 网关启动程序
|
||||
|
||||
@@ -3,12 +3,12 @@ package com.ruoyi.gateway.handler;
|
||||
import org.springframework.cloud.gateway.support.NotFoundException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebExceptionHandler;
|
||||
import com.ruoyi.common.core.utils.ServletUtils;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@@ -19,7 +19,7 @@ import reactor.core.publisher.Mono;
|
||||
*/
|
||||
@Order(-1)
|
||||
@Configuration
|
||||
public class GatewayExceptionHandler implements WebExceptionHandler
|
||||
public class GatewayExceptionHandler implements ErrorWebExceptionHandler
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(GatewayExceptionHandler.class);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Minio -->
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.ruoyi.file;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 文件服务
|
||||
|
||||
@@ -64,6 +64,9 @@ public class GenTable extends BaseEntity
|
||||
@NotBlank(message = "作者不能为空")
|
||||
private String functionAuthor;
|
||||
|
||||
/** 表单布局(单列 双列 三列) */
|
||||
private Integer formColNum;
|
||||
|
||||
/** 生成代码方式(0zip压缩包 1自定义路径) */
|
||||
private String genType;
|
||||
|
||||
@@ -98,6 +101,9 @@ public class GenTable extends BaseEntity
|
||||
/** 上级菜单名称字段 */
|
||||
private String parentMenuName;
|
||||
|
||||
/** 是否生成详情页 */
|
||||
private boolean isView;
|
||||
|
||||
public Long getTableId()
|
||||
{
|
||||
return tableId;
|
||||
@@ -228,6 +234,16 @@ public class GenTable extends BaseEntity
|
||||
this.functionAuthor = functionAuthor;
|
||||
}
|
||||
|
||||
public Integer getFormColNum()
|
||||
{
|
||||
return formColNum;
|
||||
}
|
||||
|
||||
public void setFormColNum(Integer formColNum)
|
||||
{
|
||||
this.formColNum = formColNum;
|
||||
}
|
||||
|
||||
public String getGenType()
|
||||
{
|
||||
return genType;
|
||||
@@ -338,6 +354,16 @@ public class GenTable extends BaseEntity
|
||||
this.parentMenuName = parentMenuName;
|
||||
}
|
||||
|
||||
public boolean isView()
|
||||
{
|
||||
return isView;
|
||||
}
|
||||
|
||||
public void setView(boolean isView)
|
||||
{
|
||||
this.isView = isView;
|
||||
}
|
||||
|
||||
public boolean isSub()
|
||||
{
|
||||
return isSub(this.tplCategory);
|
||||
|
||||
@@ -209,7 +209,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||
for (String template : templates)
|
||||
{
|
||||
// 渲染模板
|
||||
@@ -253,10 +253,10 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||
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();
|
||||
@@ -371,7 +371,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
VelocityContext context = VelocityUtils.prepareContext(table);
|
||||
|
||||
// 获取模板列表
|
||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType());
|
||||
List<String> templates = VelocityUtils.getTemplateList(table);
|
||||
for (String template : templates)
|
||||
{
|
||||
// 渲染模板
|
||||
@@ -524,12 +524,14 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||
Long parentMenuId = paramsObj.getLongValue(GenConstants.PARENT_MENU_ID);
|
||||
String parentMenuName = paramsObj.getString(GenConstants.PARENT_MENU_NAME);
|
||||
boolean isView = paramsObj.getBooleanValue(GenConstants.GEN_VIEW);
|
||||
|
||||
genTable.setTreeCode(treeCode);
|
||||
genTable.setTreeParentCode(treeParentCode);
|
||||
genTable.setTreeName(treeName);
|
||||
genTable.setParentMenuId(parentMenuId);
|
||||
genTable.setParentMenuName(parentMenuName);
|
||||
genTable.setView(isView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.ruoyi.gen.domain.GenTable;
|
||||
import com.ruoyi.gen.domain.GenTableColumn;
|
||||
|
||||
/**
|
||||
* 模板工具类
|
||||
* 模板处理工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@@ -60,6 +60,7 @@ public class VelocityUtils
|
||||
velocityContext.put("basePackage", getPackagePrefix(packageName));
|
||||
velocityContext.put("packageName", packageName);
|
||||
velocityContext.put("author", genTable.getFunctionAuthor());
|
||||
velocityContext.put("colSpan", getColSpan(genTable.getFormColNum()));
|
||||
velocityContext.put("datetime", DateUtils.getDate());
|
||||
velocityContext.put("pkColumn", genTable.getPkColumn());
|
||||
velocityContext.put("importList", getImportList(genTable));
|
||||
@@ -67,6 +68,7 @@ public class VelocityUtils
|
||||
velocityContext.put("columns", genTable.getColumns());
|
||||
velocityContext.put("table", genTable);
|
||||
velocityContext.put("dicts", getDicts(genTable));
|
||||
setExtensionsContext(velocityContext, genTable.getOptions());
|
||||
setMenuVelocityContext(velocityContext, genTable);
|
||||
if (GenConstants.TPL_TREE.equals(tplCategory))
|
||||
{
|
||||
@@ -79,6 +81,13 @@ public class VelocityUtils
|
||||
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)
|
||||
{
|
||||
String options = genTable.getOptions();
|
||||
@@ -133,8 +142,12 @@ public class VelocityUtils
|
||||
* @param tplWebType 前端类型
|
||||
* @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 apiTemplate = "vm/js/api.js.vm";
|
||||
if (StringUtils.equals(ELEMENT_PLUS, tplWebType))
|
||||
@@ -173,6 +186,10 @@ public class VelocityUtils
|
||||
templates.add(useWebType + "/index.vue.vm");
|
||||
templates.add("vm/java/sub-domain.java.vm");
|
||||
}
|
||||
if (isView)
|
||||
{
|
||||
templates.add(useWebType + "/view.vue.vm");
|
||||
}
|
||||
return templates;
|
||||
}
|
||||
|
||||
@@ -252,6 +269,10 @@ public class VelocityUtils
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -393,6 +414,21 @@ public class VelocityUtils
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单 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>
|
||||
<if test="columnComment != null">column_comment = #{columnComment},</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="isInsert != null">is_insert = #{isInsert},</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="functionName" column="function_name" />
|
||||
<result property="functionAuthor" column="function_author" />
|
||||
<result property="formColNum" column="form_col_num" />
|
||||
<result property="genType" column="gen_type" />
|
||||
<result property="genPath" column="gen_path" />
|
||||
<result property="options" column="options" />
|
||||
@@ -55,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||
@@ -112,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<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
|
||||
FROM gen_table t
|
||||
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 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
|
||||
FROM gen_table t
|
||||
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 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
|
||||
FROM gen_table t
|
||||
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="functionName != null and functionName != ''">function_name,</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="genPath != null and genPath != ''">gen_path,</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="functionName != null and functionName != ''">#{functionName},</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="genPath != null and genPath != ''">#{genPath},</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="className != null and className != ''">class_name = #{className},</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="genPath != null and genPath != ''">gen_path = #{genPath},</if>
|
||||
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
|
||||
|
||||
@@ -139,6 +139,15 @@
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -164,9 +173,21 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -179,100 +200,127 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
@@ -284,6 +332,9 @@
|
||||
|
||||
<script>
|
||||
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 "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
||||
|
||||
@@ -293,6 +344,9 @@ export default {
|
||||
dicts: [${dicts}],
|
||||
#end
|
||||
components: {
|
||||
#if($genView)
|
||||
${BusinessName}ViewDrawer,
|
||||
#end
|
||||
Treeselect
|
||||
},
|
||||
data() {
|
||||
@@ -448,6 +502,12 @@ export default {
|
||||
this.refreshTable = true
|
||||
})
|
||||
},
|
||||
#if($genView)
|
||||
/** 详情按钮操作 */
|
||||
handleViewData(row) {
|
||||
this.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
},
|
||||
#end
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
|
||||
@@ -153,6 +153,15 @@
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -179,9 +188,21 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -194,96 +215,121 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
#if($table.sub)
|
||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
@@ -354,9 +400,15 @@
|
||||
|
||||
<script>
|
||||
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 {
|
||||
name: "${BusinessName}",
|
||||
#if($genView)
|
||||
components: { ${BusinessName}ViewDrawer },
|
||||
#end
|
||||
#if(${dicts} != '')
|
||||
dicts: [${dicts}],
|
||||
#end
|
||||
@@ -493,7 +545,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.${pkColumn.javaField})
|
||||
this.single = selection.length!==1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@@ -590,6 +642,12 @@ export default {
|
||||
handle${subClassName}SelectionChange(selection) {
|
||||
this.checked${subClassName} = selection.map(item => item.index)
|
||||
},
|
||||
#end
|
||||
#if($genView)
|
||||
/** 详情按钮操作 */
|
||||
handleViewData(row) {
|
||||
this.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
},
|
||||
#end
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
|
||||
@@ -136,6 +136,9 @@
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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="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>
|
||||
@@ -143,9 +146,21 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -158,107 +173,134 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<el-tree-select
|
||||
v-model="form.${treeParentCode}"
|
||||
:data="${businessName}Options"
|
||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||
value-key="${treeCode}"
|
||||
placeholder="请选择${comment}"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<el-tree-select
|
||||
v-model="form.${treeParentCode}"
|
||||
:data="${businessName}Options"
|
||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||
value-key="${treeCode}"
|
||||
placeholder="请选择${comment}"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@@ -272,11 +314,14 @@
|
||||
|
||||
<script setup name="${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()
|
||||
#if(${dicts} != '')
|
||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
||||
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||
#end
|
||||
|
||||
const ${businessName}List = ref([])
|
||||
@@ -299,7 +344,7 @@ const data = reactive({
|
||||
queryParams: {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.query)
|
||||
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||
#end
|
||||
#end
|
||||
},
|
||||
@@ -356,13 +401,13 @@ function getTreeselect() {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
#foreach ($column in $columns)
|
||||
@@ -414,6 +459,13 @@ function toggleExpandAll() {
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
#if($genView)
|
||||
|
||||
/** 详情按钮操作 */
|
||||
function handleViewData(row) {
|
||||
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
}
|
||||
#end
|
||||
|
||||
/** 修改按钮操作 */
|
||||
async function handleUpdate(row) {
|
||||
@@ -444,13 +496,13 @@ function submitForm() {
|
||||
#end
|
||||
#end
|
||||
if (form.value.${pkColumn.javaField} != null) {
|
||||
update${BusinessName}(form.value).then(response => {
|
||||
update${BusinessName}(form.value).then(() => {
|
||||
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
add${BusinessName}(form.value).then(response => {
|
||||
add${BusinessName}(form.value).then(() => {
|
||||
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
|
||||
@@ -148,6 +148,9 @@
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||
</template>
|
||||
@@ -162,9 +165,21 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -177,96 +192,121 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
#if($table.sub)
|
||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
@@ -277,9 +317,13 @@
|
||||
<el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">删除</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
||||
<el-table :data="${subclassName}List" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="index" width="50"/>
|
||||
<el-table-column label="序号" width="60">
|
||||
<template #default="{ $index }">
|
||||
{{ $index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
#foreach($column in $subTable.columns)
|
||||
#set($javaField=$column.javaField)
|
||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||
@@ -344,11 +388,14 @@
|
||||
|
||||
<script setup name="${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()
|
||||
#if(${dicts} != '')
|
||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
||||
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||
#end
|
||||
|
||||
const ${businessName}List = ref([])
|
||||
@@ -380,7 +427,7 @@ const data = reactive({
|
||||
pageSize: 10,
|
||||
#foreach ($column in $columns)
|
||||
#if($column.query)
|
||||
$column.javaField: null#if($foreach.count != $columns.size()),#end
|
||||
$column.javaField: undefined#if($foreach.count != $columns.size()),#end
|
||||
#end
|
||||
#end
|
||||
},
|
||||
@@ -428,13 +475,13 @@ function getList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
#foreach ($column in $columns)
|
||||
@@ -469,7 +516,7 @@ function resetQuery() {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.${pkColumn.javaField})
|
||||
single.value = selection.length != 1
|
||||
@@ -515,13 +562,13 @@ function submitForm() {
|
||||
form.value.${subclassName}List = ${subclassName}List.value
|
||||
#end
|
||||
if (form.value.${pkColumn.javaField} != null) {
|
||||
update${BusinessName}(form.value).then(response => {
|
||||
update${BusinessName}(form.value).then(() => {
|
||||
proxy.#[[$modal]]#.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
add${BusinessName}(form.value).then(response => {
|
||||
add${BusinessName}(form.value).then(() => {
|
||||
proxy.#[[$modal]]#.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
@@ -543,18 +590,13 @@ function handleDelete(row) {
|
||||
}
|
||||
|
||||
#if($table.sub)
|
||||
/** ${subTable.functionName}序号 */
|
||||
function row${subClassName}Index({ row, rowIndex }) {
|
||||
row.index = rowIndex + 1
|
||||
}
|
||||
|
||||
/** ${subTable.functionName}添加按钮操作 */
|
||||
function handleAdd${subClassName}() {
|
||||
let obj = {}
|
||||
#foreach($column in $subTable.columns)
|
||||
#if($column.pk || $column.javaField == ${subTableFkclassName})
|
||||
#elseif($column.list && "" != $javaField)
|
||||
obj.$column.javaField = ""
|
||||
obj.$column.javaField = undefined
|
||||
#end
|
||||
#end
|
||||
${subclassName}List.value.push(obj)
|
||||
@@ -578,6 +620,13 @@ function handle${subClassName}SelectionChange(selection) {
|
||||
checked${subClassName}.value = selection.map(item => item.index)
|
||||
}
|
||||
|
||||
#end
|
||||
#if($genView)
|
||||
/** 详情按钮操作 */
|
||||
function handleViewData(row) {
|
||||
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
}
|
||||
|
||||
#end
|
||||
/** 导出按钮操作 */
|
||||
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
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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="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>
|
||||
@@ -143,9 +146,21 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -158,107 +173,134 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<el-tree-select
|
||||
v-model="form.${treeParentCode}"
|
||||
:data="${businessName}Options"
|
||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||
value-key="${treeCode}"
|
||||
placeholder="请选择${comment}"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${treeParentCode}">
|
||||
<el-tree-select
|
||||
v-model="form.${treeParentCode}"
|
||||
:data="${businessName}Options"
|
||||
:props="{ value: '${treeCode}', label: '${treeName}', children: 'children' }"
|
||||
value-key="${treeCode}"
|
||||
placeholder="请选择${comment}"
|
||||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@@ -272,13 +314,16 @@
|
||||
|
||||
<script setup lang="ts" name="${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 { TreeSelect } from '@/types/api/common'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
#if(${dicts} != '')
|
||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
||||
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||
#end
|
||||
|
||||
const ${businessName}List = ref<any[]>([])
|
||||
@@ -358,13 +403,13 @@ function getTreeselect() {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
#foreach ($column in $columns)
|
||||
@@ -416,6 +461,13 @@ function toggleExpandAll() {
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
#if($genView)
|
||||
|
||||
/** 详情按钮操作 */
|
||||
function handleViewData(row: ${ClassName}) {
|
||||
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
}
|
||||
#end
|
||||
|
||||
/** 修改按钮操作 */
|
||||
async function handleUpdate(row: ${ClassName}) {
|
||||
|
||||
@@ -148,6 +148,9 @@
|
||||
#end
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${permissionPrefix}:remove']">删除</el-button>
|
||||
</template>
|
||||
@@ -162,9 +165,21 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
#if($genView)
|
||||
<!-- ${functionName}详情抽屉 -->
|
||||
<${businessName}-view-drawer ref="${businessName}ViewRef" />
|
||||
#end
|
||||
<!-- 添加或修改${functionName}对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="80px">
|
||||
#if($table.formColNum == 2)
|
||||
#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)
|
||||
#set($field=$column.javaField)
|
||||
#if($column.insert && !$column.pk)
|
||||
@@ -177,96 +192,121 @@
|
||||
#end
|
||||
#set($dictType=$column.dictType)
|
||||
#if($column.htmlType == "input")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" placeholder="请输入${comment}" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "imageUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<image-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "fileUpload")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<file-upload v-model="form.${field}"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "editor")
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}">
|
||||
<editor v-model="form.${field}" :min-height="192"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:value="parseInt(dict.value)"
|
||||
:value="parseInt(dict.value)"
|
||||
#else
|
||||
:value="dict.value"
|
||||
:value="dict.value"
|
||||
#end
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "select" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-select v-model="form.${field}" placeholder="请选择${comment}">
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
:label="dict.value">
|
||||
{{dict.label}}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-checkbox-group v-model="form.${field}">
|
||||
<el-checkbox>请选择字典生成</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio
|
||||
v-for="dict in ${dictType}"
|
||||
:key="dict.value"
|
||||
#if($column.javaType == "Integer" || $column.javaType == "Long")
|
||||
:label="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
#else
|
||||
:label="dict.value"
|
||||
:label="dict.value"
|
||||
#end
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "radio" && $dictType)
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-radio-group v-model="form.${field}">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "datetime")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-col :span="${colSpan}">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-date-picker clearable
|
||||
v-model="form.${field}"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择${comment}">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#elseif($column.htmlType == "textarea")
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="${comment}" prop="${field}">
|
||||
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
</el-row>
|
||||
#if($table.sub)
|
||||
<el-divider content-position="center">${subTable.functionName}信息</el-divider>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
@@ -346,18 +386,21 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="Config">
|
||||
<script setup lang="ts" name="${BusinessName}">
|
||||
#if($table.sub)
|
||||
import type { ${ClassName}, ${subClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||
#else
|
||||
import type { ${ClassName}, ${BusinessName}QueryParams } from "@/types/api/${moduleName}/${businessName}"
|
||||
#end
|
||||
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()
|
||||
#if(${dicts} != '')
|
||||
#set($dictsNoSymbol=$dicts.replace("'", ""))
|
||||
const { ${dictsNoSymbol} } = proxy.useDict(${dicts})
|
||||
const { ${dictsNoSymbol} } = useDict(${dicts})
|
||||
#end
|
||||
|
||||
const ${businessName}List = ref<${ClassName}[]>([])
|
||||
@@ -437,13 +480,13 @@ function getList() {
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
#foreach ($column in $columns)
|
||||
@@ -478,7 +521,7 @@ function resetQuery() {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection: ${ClassName}[]) {
|
||||
ids.value = selection.map(item => item.${pkColumn.javaField})
|
||||
single.value = selection.length != 1
|
||||
@@ -582,6 +625,13 @@ function handle${subClassName}SelectionChange(selection: any[]) {
|
||||
checked${subClassName}.value = selection.map(item => item.index)
|
||||
}
|
||||
|
||||
#end
|
||||
#if($genView)
|
||||
/** 详情按钮操作 */
|
||||
function handleViewData(row: ${ClassName}) {
|
||||
proxy.#[[$]]#refs["${businessName}ViewRef"].open(row.${pkColumn.javaField})
|
||||
}
|
||||
|
||||
#end
|
||||
/** 导出按钮操作 */
|
||||
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>
|
||||
@@ -43,8 +43,14 @@
|
||||
|
||||
<!-- Quartz -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.mchange</groupId>
|
||||
<artifactId>c3p0</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
|
||||
@@ -54,7 +54,6 @@ public class SysNoticeController extends BaseController
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:notice:query")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
@@ -125,6 +124,19 @@ public class SysNoticeController extends BaseController
|
||||
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("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
ajax.put("pwdChrtype", getSysAccountChrtype());
|
||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
// 获取用户密码自定义配置规则
|
||||
public String getSysAccountChrtype()
|
||||
{
|
||||
return Convert.toStr(configService.selectConfigByKey("sys.account.chrtype"), "0");
|
||||
}
|
||||
|
||||
// 检查初始密码是否提醒修改
|
||||
public boolean initPasswordIsModify(Date pwdUpdateDate)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.system.domain.SysNoticeRead;
|
||||
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);
|
||||
|
||||
/**
|
||||
* 查询已阅读某公告的用户列表
|
||||
*
|
||||
* @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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
|
||||
/**
|
||||
@@ -43,6 +44,15 @@ public interface ISysNoticeReadService
|
||||
*/
|
||||
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 结果
|
||||
*/
|
||||
public int deleteNoticeById(Long noticeId);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除公告信息
|
||||
*
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.SysNoticeRead;
|
||||
import com.ruoyi.system.domain.SysNotice;
|
||||
import com.ruoyi.system.domain.SysNoticeRead;
|
||||
import com.ruoyi.system.mapper.SysNoticeReadMapper;
|
||||
import com.ruoyi.system.service.ISysNoticeReadService;
|
||||
|
||||
@@ -62,6 +63,15 @@ public class SysNoticeReadServiceImpl implements ISysNoticeReadService
|
||||
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>
|
||||
</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>
|
||||
|
||||
@@ -48,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<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,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
"quill": "2.0.2",
|
||||
"screenfull": "5.0.2",
|
||||
"sortablejs": "1.10.2",
|
||||
"splitpanes": "2.4.1",
|
||||
"vue": "2.6.12",
|
||||
"vue-count-to": "1.0.13",
|
||||
"vue-cropper": "0.5.5",
|
||||
|
||||
@@ -68,3 +68,12 @@ export function markNoticeReadAll(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-card {
|
||||
@@ -324,6 +373,28 @@
|
||||
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-title { color: #c0392b !important; }
|
||||
.error-title i { color: #c0392b !important; }
|
||||
@@ -398,6 +469,9 @@
|
||||
}
|
||||
|
||||
/* 拖拽列样式 */
|
||||
.allowDrag { cursor: grab; }
|
||||
.allowDrag:active { cursor: grabbing; }
|
||||
|
||||
.sortable-ghost {
|
||||
opacity: .8;
|
||||
color: #fff !important;
|
||||
@@ -408,8 +482,3 @@
|
||||
position: relative;
|
||||
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>
|
||||
|
||||
<script>
|
||||
import cache from '@/plugins/cache'
|
||||
|
||||
export default {
|
||||
name: "RightToolbar",
|
||||
data() {
|
||||
@@ -76,6 +78,11 @@ export default {
|
||||
type: Number,
|
||||
default: 10
|
||||
},
|
||||
/* 列显隐状态记忆的 localStorage key(传入则启用记忆,不传则不记忆) */
|
||||
storageKey: {
|
||||
type: String,
|
||||
default: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
style() {
|
||||
@@ -103,6 +110,23 @@ export default {
|
||||
}
|
||||
},
|
||||
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') {
|
||||
// transfer穿梭显隐列初始默认隐藏列
|
||||
if (Array.isArray(this.columns)) {
|
||||
@@ -168,6 +192,7 @@ export default {
|
||||
this.columns[key].visible = !data.includes(index)
|
||||
})
|
||||
}
|
||||
this.saveStorage()
|
||||
},
|
||||
// 打开显隐列dialog
|
||||
showColumn() {
|
||||
@@ -180,6 +205,7 @@ export default {
|
||||
} else {
|
||||
this.columns[key].visible = event
|
||||
}
|
||||
this.saveStorage()
|
||||
},
|
||||
// 切换全选/反选
|
||||
toggleCheckAll() {
|
||||
@@ -189,6 +215,20 @@ export default {
|
||||
} else {
|
||||
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) {}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,170 +1,170 @@
|
||||
<template>
|
||||
<el-color-picker
|
||||
v-model="theme"
|
||||
:predefine="['#409EFF', '#1890ff', '#304156','#212121','#11a983', '#13c2c2', '#6959CD', '#f5222d', ]"
|
||||
class="theme-picker"
|
||||
popper-class="theme-picker-dropdown"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const ORIGINAL_THEME = '#409EFF' // default color
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
chalk: '', // content of theme-chalk css
|
||||
theme: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
defaultTheme() {
|
||||
return this.$store.state.settings.theme
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultTheme: {
|
||||
handler: function(val, oldVal) {
|
||||
this.theme = val
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
async theme(val) {
|
||||
await this.setTheme(val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if(this.defaultTheme !== ORIGINAL_THEME) {
|
||||
this.setTheme(this.defaultTheme)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async setTheme(val) {
|
||||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
||||
if (typeof val !== 'string') return
|
||||
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
||||
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
||||
|
||||
const getHandler = (variable, id) => {
|
||||
return () => {
|
||||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
||||
const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster)
|
||||
|
||||
let styleTag = document.getElementById(id)
|
||||
if (!styleTag) {
|
||||
styleTag = document.createElement('style')
|
||||
styleTag.setAttribute('id', id)
|
||||
document.head.appendChild(styleTag)
|
||||
}
|
||||
styleTag.innerText = newStyle
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.chalk) {
|
||||
const url = `/styles/theme-chalk/index.css`
|
||||
await this.getCSSString(url, 'chalk')
|
||||
}
|
||||
|
||||
const chalkHandler = getHandler('chalk', 'chalk-style')
|
||||
chalkHandler()
|
||||
|
||||
const styles = [].slice.call(document.querySelectorAll('style'))
|
||||
.filter(style => {
|
||||
const text = style.innerText
|
||||
return new RegExp(oldVal, 'i').test(text) && !/Chalk Variables/.test(text)
|
||||
})
|
||||
styles.forEach(style => {
|
||||
const { innerText } = style
|
||||
if (typeof innerText !== 'string') return
|
||||
style.innerText = this.updateStyle(innerText, originalCluster, themeCluster)
|
||||
})
|
||||
|
||||
this.$emit('change', val)
|
||||
},
|
||||
|
||||
updateStyle(style, oldCluster, newCluster) {
|
||||
let newStyle = style
|
||||
oldCluster.forEach((color, index) => {
|
||||
newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index])
|
||||
})
|
||||
return newStyle
|
||||
},
|
||||
|
||||
getCSSString(url, variable) {
|
||||
return new Promise(resolve => {
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
this[variable] = xhr.responseText.replace(/@font-face{[^}]+}/, '')
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
xhr.open('GET', url)
|
||||
xhr.send()
|
||||
})
|
||||
},
|
||||
|
||||
getThemeCluster(theme) {
|
||||
const tintColor = (color, tint) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
if (tint === 0) { // when primary color is in its rgb space
|
||||
return [red, green, blue].join(',')
|
||||
} else {
|
||||
red += Math.round(tint * (255 - red))
|
||||
green += Math.round(tint * (255 - green))
|
||||
blue += Math.round(tint * (255 - blue))
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
}
|
||||
|
||||
const shadeColor = (color, shade) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
red = Math.round((1 - shade) * red)
|
||||
green = Math.round((1 - shade) * green)
|
||||
blue = Math.round((1 - shade) * blue)
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
|
||||
const clusters = [theme]
|
||||
for (let i = 0; i <= 9; i++) {
|
||||
clusters.push(tintColor(theme, Number((i / 10).toFixed(2))))
|
||||
}
|
||||
clusters.push(shadeColor(theme, 0.1))
|
||||
return clusters
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.theme-message,
|
||||
.theme-picker-dropdown {
|
||||
z-index: 99999 !important;
|
||||
}
|
||||
|
||||
.theme-picker .el-color-picker__trigger {
|
||||
height: 26px !important;
|
||||
width: 26px !important;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.theme-picker-dropdown .el-color-dropdown__link-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<el-color-picker
|
||||
v-model="theme"
|
||||
:predefine="['#409EFF', '#1890ff', '#304156','#212121','#11a983', '#13c2c2', '#6959CD', '#f5222d', ]"
|
||||
class="theme-picker"
|
||||
popper-class="theme-picker-dropdown"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const ORIGINAL_THEME = '#409EFF' // default color
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
chalk: '', // content of theme-chalk css
|
||||
theme: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
defaultTheme() {
|
||||
return this.$store.state.settings.theme
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultTheme: {
|
||||
handler: function(val, oldVal) {
|
||||
this.theme = val
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
async theme(val) {
|
||||
await this.setTheme(val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if(this.defaultTheme !== ORIGINAL_THEME) {
|
||||
this.setTheme(this.defaultTheme)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async setTheme(val) {
|
||||
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
||||
if (typeof val !== 'string') return
|
||||
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
||||
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
||||
|
||||
const getHandler = (variable, id) => {
|
||||
return () => {
|
||||
const originalCluster = this.getThemeCluster(ORIGINAL_THEME.replace('#', ''))
|
||||
const newStyle = this.updateStyle(this[variable], originalCluster, themeCluster)
|
||||
|
||||
let styleTag = document.getElementById(id)
|
||||
if (!styleTag) {
|
||||
styleTag = document.createElement('style')
|
||||
styleTag.setAttribute('id', id)
|
||||
document.head.appendChild(styleTag)
|
||||
}
|
||||
styleTag.innerText = newStyle
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.chalk) {
|
||||
const url = `/styles/theme-chalk/index.css`
|
||||
await this.getCSSString(url, 'chalk')
|
||||
}
|
||||
|
||||
const chalkHandler = getHandler('chalk', 'chalk-style')
|
||||
chalkHandler()
|
||||
|
||||
const styles = [].slice.call(document.querySelectorAll('style'))
|
||||
.filter(style => {
|
||||
const text = style.innerText
|
||||
return new RegExp(oldVal, 'i').test(text) && !/Chalk Variables/.test(text)
|
||||
})
|
||||
styles.forEach(style => {
|
||||
const { innerText } = style
|
||||
if (typeof innerText !== 'string') return
|
||||
style.innerText = this.updateStyle(innerText, originalCluster, themeCluster)
|
||||
})
|
||||
|
||||
this.$emit('change', val)
|
||||
},
|
||||
|
||||
updateStyle(style, oldCluster, newCluster) {
|
||||
let newStyle = style
|
||||
oldCluster.forEach((color, index) => {
|
||||
newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index])
|
||||
})
|
||||
return newStyle
|
||||
},
|
||||
|
||||
getCSSString(url, variable) {
|
||||
return new Promise(resolve => {
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
this[variable] = xhr.responseText.replace(/@font-face{[^}]+}/, '')
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
xhr.open('GET', url)
|
||||
xhr.send()
|
||||
})
|
||||
},
|
||||
|
||||
getThemeCluster(theme) {
|
||||
const tintColor = (color, tint) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
if (tint === 0) { // when primary color is in its rgb space
|
||||
return [red, green, blue].join(',')
|
||||
} else {
|
||||
red += Math.round(tint * (255 - red))
|
||||
green += Math.round(tint * (255 - green))
|
||||
blue += Math.round(tint * (255 - blue))
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
}
|
||||
|
||||
const shadeColor = (color, shade) => {
|
||||
let red = parseInt(color.slice(0, 2), 16)
|
||||
let green = parseInt(color.slice(2, 4), 16)
|
||||
let blue = parseInt(color.slice(4, 6), 16)
|
||||
|
||||
red = Math.round((1 - shade) * red)
|
||||
green = Math.round((1 - shade) * green)
|
||||
blue = Math.round((1 - shade) * blue)
|
||||
|
||||
red = red.toString(16)
|
||||
green = green.toString(16)
|
||||
blue = blue.toString(16)
|
||||
|
||||
return `#${red}${green}${blue}`
|
||||
}
|
||||
|
||||
const clusters = [theme]
|
||||
for (let i = 0; i <= 9; i++) {
|
||||
clusters.push(tintColor(theme, Number((i / 10).toFixed(2))))
|
||||
}
|
||||
clusters.push(shadeColor(theme, 0.1))
|
||||
return clusters
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.theme-message,
|
||||
.theme-picker-dropdown {
|
||||
z-index: 99999 !important;
|
||||
}
|
||||
|
||||
.theme-picker .el-color-picker__trigger {
|
||||
height: 26px !important;
|
||||
width: 26px !important;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.theme-picker-dropdown .el-color-dropdown__link-btn {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
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>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="previewTitle" :visible.sync="previewVisible" width="680px" append-to-body custom-class="notice-preview-dialog">
|
||||
<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>
|
||||
<notice-detail-view ref="noticeViewRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNoticeTop, markNoticeRead, markNoticeReadAll, getNotice } from '@/api/system/notice'
|
||||
import NoticeDetailView from './DetailView'
|
||||
import { listNoticeTop, markNoticeRead, markNoticeReadAll } from '@/api/system/notice'
|
||||
|
||||
export default {
|
||||
name: 'HeaderNotice',
|
||||
components: { NoticeDetailView },
|
||||
data() {
|
||||
return {
|
||||
noticeList: [], // 通知列表
|
||||
unreadCount: 0, // 未读数量
|
||||
noticeLoading: false, // 加载状态
|
||||
noticeVisible: false, // 弹出层显示状态
|
||||
noticeLeaveTimer: null, // 鼠标离开计时器
|
||||
previewVisible: false, // 预览弹窗显示状态
|
||||
previewTitle: '', // 预览弹窗标题
|
||||
previewContent: '', // 预览弹窗内容
|
||||
previewNoticeType: '', // 预览弹窗类型
|
||||
previewCreateBy: '', // 预览弹窗创建人
|
||||
previewCreateTime: '' // 预览弹窗创建时间
|
||||
noticeLeaveTimer: null // 鼠标离开计时器
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -99,15 +85,7 @@ export default {
|
||||
if (idx !== -1) this.$set(this.noticeList, idx, { ...item, isRead: true })
|
||||
this.unreadCount = Math.max(0, this.unreadCount - 1)
|
||||
}
|
||||
getNotice(item.noticeId).then(res => {
|
||||
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
|
||||
})
|
||||
this.$refs.noticeViewRef.open(item.noticeId)
|
||||
},
|
||||
// 全部已读
|
||||
markAllRead() {
|
||||
@@ -200,30 +178,4 @@ export default {
|
||||
font-size: 11px;
|
||||
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>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import Breadcrumb from '@/components/Breadcrumb'
|
||||
import TopNav from '@/components/TopNav'
|
||||
import TopNav from './TopNav'
|
||||
import TopBar from './TopBar'
|
||||
import Logo from './Sidebar/Logo'
|
||||
import Hamburger from '@/components/Hamburger'
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<h3 class="drawer-title">系统布局配置</h3>
|
||||
|
||||
<div class="drawer-item">
|
||||
<span>开启 Tags-Views</span>
|
||||
<span>开启页签</span>
|
||||
<el-switch v-model="tagsView" class="drawer-switch" />
|
||||
</div>
|
||||
|
||||
@@ -75,6 +75,14 @@
|
||||
<el-switch v-model="tagsIcon" :disabled="!tagsView" class="drawer-switch" />
|
||||
</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">
|
||||
<span>固定 Header</span>
|
||||
<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: {
|
||||
get() {
|
||||
return this.$store.state.settings.sidebarLogo
|
||||
@@ -256,6 +275,7 @@ export default {
|
||||
"navType":${this.navType},
|
||||
"tagsView":${this.tagsView},
|
||||
"tagsIcon":${this.tagsIcon},
|
||||
"tagsViewStyle":"${this.tagsViewStyle}",
|
||||
"tagsViewPersist":${this.tagsViewPersist},
|
||||
"fixedHeader":${this.fixedHeader},
|
||||
"sidebarLogo":${this.sidebarLogo},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<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">
|
||||
<i class="el-icon-arrow-left" />
|
||||
@@ -15,11 +15,11 @@
|
||||
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
|
||||
tag="span"
|
||||
class="tags-view-item"
|
||||
:style="activeStyle(tag)"
|
||||
:style="tagActiveStyle(tag)"
|
||||
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
|
||||
@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 }}
|
||||
<span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
|
||||
</router-link>
|
||||
@@ -97,8 +97,20 @@ export default {
|
||||
tagsIcon() {
|
||||
return this.$store.state.settings.tagsIcon
|
||||
},
|
||||
tagsViewStyle() {
|
||||
return this.$store.state.settings.tagsViewStyle
|
||||
},
|
||||
selectedDropdownTag() {
|
||||
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: {
|
||||
@@ -136,11 +148,21 @@ export default {
|
||||
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) {
|
||||
return route.path === this.$route.path
|
||||
},
|
||||
activeStyle(tag) {
|
||||
if (!this.isActive(tag)) return {}
|
||||
tagActiveStyle(tag) {
|
||||
if (!this.isActive(tag) || this.tagsViewStyle !== 'card') return {}
|
||||
return {
|
||||
"background-color": this.theme,
|
||||
"border-color": this.theme
|
||||
@@ -367,13 +389,16 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$tags-bar-height: 34px;
|
||||
|
||||
.tags-view-container {
|
||||
height: 34px;
|
||||
height: $tags-bar-height;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #d8dce5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
|
||||
$btn-width: 28px;
|
||||
$btn-color: #71717a;
|
||||
@@ -388,7 +413,7 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: $btn-width;
|
||||
height: 34px;
|
||||
height: $tags-bar-height;
|
||||
cursor: pointer;
|
||||
color: $btn-color;
|
||||
font-size: 13px;
|
||||
@@ -405,18 +430,14 @@ export default {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
&--left {
|
||||
border-right: $divider;
|
||||
}
|
||||
|
||||
&--right {
|
||||
border-left: $divider;
|
||||
}
|
||||
&--left { border-right: $divider; }
|
||||
&--right { border-left: $divider; }
|
||||
}
|
||||
|
||||
.tags-view-wrapper {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
|
||||
.tags-view-item {
|
||||
display: inline-block;
|
||||
@@ -432,31 +453,27 @@ export default {
|
||||
margin-left: 5px;
|
||||
border-radius: 3px;
|
||||
|
||||
&:first-of-type {
|
||||
margin-left: 6px;
|
||||
}
|
||||
&:last-of-type {
|
||||
margin-right: 15px;
|
||||
}
|
||||
&.active {
|
||||
background-color: #42b983;
|
||||
color: #fff;
|
||||
border-color: #42b983;
|
||||
&::before {
|
||||
content: '';
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
margin-right: 2px;
|
||||
}
|
||||
}
|
||||
&:first-of-type { margin-left: 6px; }
|
||||
&:last-of-type { margin-right: 15px; }
|
||||
}
|
||||
}
|
||||
&:not(.tags-view-container--chrome) .tags-view-wrapper .tags-view-item.active {
|
||||
background-color: #42b983;
|
||||
color: #fff;
|
||||
border-color: #42b983;
|
||||
&::before {
|
||||
content: '';
|
||||
background: #fff;
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -471,7 +488,7 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: $btn-width;
|
||||
height: 34px;
|
||||
height: $tags-bar-height;
|
||||
cursor: pointer;
|
||||
color: $btn-color;
|
||||
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 lang="scss">
|
||||
.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 {
|
||||
.el-icon-close {
|
||||
width: 16px;
|
||||
@@ -546,6 +726,8 @@ export default {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
margin-left: 0 !important;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.main-container.fullscreen-mode .fixed-header {
|
||||
@@ -556,6 +738,7 @@ export default {
|
||||
right: 0;
|
||||
width: 100% !important;
|
||||
z-index: 1000;
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
.main-container.fullscreen-mode .fixed-header .navbar {
|
||||
@@ -574,4 +757,4 @@ export default {
|
||||
min-height: calc(100vh - 34px) !important;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -34,6 +34,11 @@ module.exports = {
|
||||
*/
|
||||
tagsIcon: false,
|
||||
|
||||
/**
|
||||
* 标签页样式:card 卡片(默认)、chrome 谷歌浏览器风格
|
||||
*/
|
||||
tagsViewStyle: 'card',
|
||||
|
||||
/**
|
||||
* 是否固定头部
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import defaultSettings from '@/settings'
|
||||
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 state = {
|
||||
@@ -13,6 +13,7 @@ const state = {
|
||||
tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView,
|
||||
tagsViewPersist: storageSetting.tagsViewPersist === undefined ? tagsViewPersist : storageSetting.tagsViewPersist,
|
||||
tagsIcon: storageSetting.tagsIcon === undefined ? tagsIcon : storageSetting.tagsIcon,
|
||||
tagsViewStyle: storageSetting.tagsViewStyle === undefined ? tagsViewStyle : storageSetting.tagsViewStyle,
|
||||
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
||||
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
||||
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import store from '@/store'
|
||||
import router from '@/router'
|
||||
import cache from '@/plugins/cache'
|
||||
import { MessageBox, } from 'element-ui'
|
||||
import { login, logout, getInfo, refreshToken } from '@/api/login'
|
||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||
@@ -82,6 +83,7 @@ const user = {
|
||||
commit('SET_NAME', user.userName)
|
||||
commit('SET_NICK_NAME', user.nickName)
|
||||
commit('SET_AVATAR', avatar)
|
||||
cache.session.set('pwrChrtype', res.pwdChrtype)
|
||||
/* 初始密码提示 */
|
||||
if(res.isDefaultModifyPwd) {
|
||||
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}
|
||||
*/
|
||||
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}$`)
|
||||
return regex.test(path)
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.jobId != undefined) {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-form-item prop="password" :rules="registerPwdValidator">
|
||||
<el-input
|
||||
v-model="registerForm.password"
|
||||
type="password"
|
||||
@@ -68,18 +68,12 @@
|
||||
|
||||
<script>
|
||||
import { getCodeImg, register } from "@/api/login"
|
||||
import passwordRule from "@/utils/passwordRule"
|
||||
import defaultSettings from '@/settings'
|
||||
|
||||
export default {
|
||||
name: "Register",
|
||||
mixins: [passwordRule],
|
||||
data() {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.registerForm.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
title: process.env.VUE_APP_TITLE,
|
||||
footerContent: defaultSettings.footerContent,
|
||||
@@ -91,24 +85,31 @@ export default {
|
||||
code: "",
|
||||
uuid: ""
|
||||
},
|
||||
registerRules: {
|
||||
loading: false,
|
||||
captchaEnabled: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
registerRules() {
|
||||
return {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||
{ 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: [
|
||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
||||
{ required: true, message: "请再次输入您的密码", trigger: "blur" },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (this.registerForm.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}, trigger: "blur"
|
||||
}
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
},
|
||||
loading: false,
|
||||
captchaEnabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -283,7 +283,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.configId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
@@ -297,7 +297,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.configId != undefined) {
|
||||
|
||||
@@ -325,7 +325,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.deptId != undefined) {
|
||||
|
||||
@@ -345,7 +345,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.dictCode)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
@@ -359,7 +359,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.dictCode != undefined) {
|
||||
|
||||
@@ -305,7 +305,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.dictId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 字典数据抽屉显示信息 */
|
||||
@@ -328,7 +328,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.dictId != undefined) {
|
||||
|
||||
@@ -466,7 +466,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
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-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
||||
<el-table-column
|
||||
label="公告标题"
|
||||
align="center"
|
||||
prop="noticeTitle"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column label="公告标题" align="center" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<a class="link-type" style="cursor:pointer" @click="handleViewData(scope.row)">{{ scope.row.noticeTitle }}</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
||||
@@ -96,6 +95,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<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
|
||||
size="mini"
|
||||
type="text"
|
||||
@@ -166,14 +172,20 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<notice-detail-view ref="noticeViewRef" />
|
||||
<read-users-dialog ref="readUsersRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NoticeDetailView from "@/layout/components/HeaderNotice/DetailView"
|
||||
import ReadUsersDialog from "./ReadUsers"
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
|
||||
|
||||
export default {
|
||||
name: "Notice",
|
||||
components: { NoticeDetailView, ReadUsersDialog },
|
||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||
data() {
|
||||
return {
|
||||
@@ -258,7 +270,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.noticeId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@@ -278,7 +290,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
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) {
|
||||
const noticeIds = row.noticeId || this.ids
|
||||
|
||||
@@ -249,7 +249,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.postId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
@@ -269,7 +269,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.postId != undefined) {
|
||||
|
||||
@@ -451,7 +451,7 @@ export default {
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.roleId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length != 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 更多操作触发
|
||||
@@ -547,12 +547,12 @@ export default {
|
||||
this.title = "分配数据权限"
|
||||
},
|
||||
/** 分配用户操作 */
|
||||
handleAuthUser: function(row) {
|
||||
handleAuthUser(row) {
|
||||
const roleId = row.roleId
|
||||
this.$router.push("/system/role-auth/user/" + roleId)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.roleId != undefined) {
|
||||
@@ -574,7 +574,7 @@ export default {
|
||||
})
|
||||
},
|
||||
/** 提交按钮(数据权限) */
|
||||
submitDataScope: function() {
|
||||
submitDataScope() {
|
||||
if (this.form.roleId != undefined) {
|
||||
this.form.deptIds = this.getDeptAllCheckedKeys()
|
||||
dataScope(this.form).then(() => {
|
||||
|
||||
@@ -1,98 +1,86 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
|
||||
<!--部门数据-->
|
||||
<pane size="16">
|
||||
<el-col>
|
||||
<div class="head-container">
|
||||
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
|
||||
</div>
|
||||
<div class="head-container">
|
||||
<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" />
|
||||
</div>
|
||||
<div class="app-container tree-sidebar-manage-wrap">
|
||||
<tree-panel title="组织机构" :tree-data="deptOptions" search-placeholder="请输入部门名称" storage-key="dept-sidebar-width" :defaultExpandAll="true" @node-click="handleNodeClick" @refresh="getDeptTree" ref="deptTreeRef" />
|
||||
<div class="tree-sidebar-content">
|
||||
<div class="content-inner">
|
||||
<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>
|
||||
</pane>
|
||||
<!--用户数据-->
|
||||
<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 :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>
|
||||
</pane>
|
||||
</splitpanes>
|
||||
</el-row>
|
||||
<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" 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>
|
||||
@@ -128,7 +116,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
@@ -179,39 +167,27 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 用户详情抽屉 -->
|
||||
<user-view-drawer ref="userViewRef" />
|
||||
<!-- 用户导入对话框 -->
|
||||
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
|
||||
<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>
|
||||
<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" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 "@riophae/vue-treeselect/dist/vue-treeselect.css"
|
||||
import { Splitpanes, Pane } from "splitpanes"
|
||||
import "splitpanes/dist/splitpanes.css"
|
||||
import TreePanel from "@/components/TreePanel"
|
||||
import ExcelImportDialog from "@/components/ExcelImportDialog"
|
||||
import UserViewDrawer from "./view"
|
||||
import passwordRule from "@/utils/passwordRule"
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
mixins: [passwordRule],
|
||||
dicts: ['sys_normal_disable', 'sys_user_sex'],
|
||||
components: { Treeselect, Splitpanes, Pane },
|
||||
components: { Treeselect, TreePanel, ExcelImportDialog, UserViewDrawer },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -236,8 +212,6 @@ export default {
|
||||
enabledDeptOptions: undefined,
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 部门名称
|
||||
deptName: undefined,
|
||||
// 默认密码
|
||||
initPassword: undefined,
|
||||
// 日期范围
|
||||
@@ -248,25 +222,6 @@ export default {
|
||||
roleOptions: [],
|
||||
// 表单参数
|
||||
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: {
|
||||
pageNum: 1,
|
||||
@@ -295,11 +250,6 @@ export default {
|
||||
nickName: [
|
||||
{ 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: [
|
||||
{
|
||||
type: "email",
|
||||
@@ -317,12 +267,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName(val) {
|
||||
this.$refs.tree.filter(val)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getDeptTree()
|
||||
@@ -335,11 +279,10 @@ export default {
|
||||
getList() {
|
||||
this.loading = true
|
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
)
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getDeptTree() {
|
||||
@@ -360,11 +303,6 @@ export default {
|
||||
return true
|
||||
})
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode(value, data) {
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick(data) {
|
||||
this.queryParams.deptId = data.id
|
||||
@@ -414,7 +352,7 @@ export default {
|
||||
this.dateRange = []
|
||||
this.resetForm("queryForm")
|
||||
this.queryParams.deptId = undefined
|
||||
this.$refs.tree.setCurrentKey(null)
|
||||
this.$refs.deptTreeRef.setCurrentKey(null)
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
@@ -464,30 +402,24 @@ export default {
|
||||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleResetPwd(row) {
|
||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||
this.$prompt(`请输入「${row.userName}」的新密码`, "重置密码", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
closeOnClickModal: false,
|
||||
inputPattern: /^.{5,20}$/,
|
||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
||||
inputValidator: (value) => {
|
||||
if (/<|>|"|'|\||\\/.test(value)) {
|
||||
return "不能包含非法字符:< > \" ' \\\ |"
|
||||
}
|
||||
},
|
||||
inputValidator: this.pwdPromptValidator
|
||||
}).then(({ value }) => {
|
||||
resetUserPwd(row.userId, value).then(() => {
|
||||
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
||||
})
|
||||
}).catch(() => {})
|
||||
resetUserPwd(row.userId, value).then(() => {
|
||||
this.$modal.msgSuccess("修改成功,新密码是:" + value)
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 分配角色操作 */
|
||||
handleAuthRole: function(row) {
|
||||
handleAuthRole(row) {
|
||||
const userId = row.userId
|
||||
this.$router.push("/system/user-auth/role/" + userId)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.userId != undefined) {
|
||||
@@ -522,37 +454,14 @@ export default {
|
||||
...this.queryParams
|
||||
}, `user_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 详情按钮操作 */
|
||||
handleViewData(row) {
|
||||
this.$refs.userViewRef.open(row.userId)
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport() {
|
||||
this.upload.title = "用户导入"
|
||||
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()
|
||||
this.$refs.importUserRef.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<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-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
||||
</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-form-item>
|
||||
<el-form-item label="确认密码" prop="confirmPassword">
|
||||
@@ -18,35 +18,36 @@
|
||||
|
||||
<script>
|
||||
import { updateUserPwd } from "@/api/system/user"
|
||||
import passwordRule from "@/utils/passwordRule"
|
||||
|
||||
export default {
|
||||
mixins: [passwordRule],
|
||||
data() {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.user.newPassword !== value) {
|
||||
callback(new Error("两次输入的密码不一致"))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
user: {
|
||||
oldPassword: undefined,
|
||||
newPassword: undefined,
|
||||
confirmPassword: undefined
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formRules() {
|
||||
return {
|
||||
oldPassword: [
|
||||
{ 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: [
|
||||
{ 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)
|
||||
genTable.columns = this.columns
|
||||
genTable.params = {
|
||||
genView: genTable.view ? '1' : '0',
|
||||
treeCode: genTable.treeCode,
|
||||
treeName: genTable.treeName,
|
||||
treeParentCode: genTable.treeParentCode,
|
||||
|
||||
@@ -69,6 +69,29 @@
|
||||
</el-form-item>
|
||||
</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-form-item prop="genType">
|
||||
<span slot="label">
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<!-- SpringBoot Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security -->
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti
|
||||
|
||||
/**
|
||||
* 监控权限配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableWebSecurity
|
||||
|
||||
@@ -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(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(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 '生成业务名',
|
||||
function_name 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_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
|
||||
options varchar(1000) comment '其它生成选项',
|
||||
@@ -34,7 +34,7 @@ CREATE TABLE `config_info` (
|
||||
|
||||
insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema, encrypted_data_key) values
|
||||
(1,'application-dev.yml','DEFAULT_GROUP','spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n min-request-size: 8192\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','9928f41dfb10386ad38b3254af5692e0','2020-05-20 12:00:00','2024-08-29 12:14:45','nacos','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','',''),
|
||||
(2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n data:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n server:\n webflux:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - name: CacheRequestBody\n args:\n bodyClass: java.lang.String\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','1650061c268e8065f4ca40a1ee99808d','2020-05-14 14:17:55','2026-03-10 10:57:46','nacos_namespace_migrate','192.168.137.1','','','网关模块',NULL,NULL,'yaml',NULL,''),
|
||||
(2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n data:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n server:\n webflux:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestBody\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /*/v3/api-docs\n - /csrf\n\n# springdoc配置\nspringdoc:\n webjars:\n # 访问前缀\n prefix:\n','1650061c268e8065f4ca40a1ee99808d','2020-05-14 14:17:55','2026-03-10 10:57:46','nacos_namespace_migrate','192.168.137.1','','','网关模块',NULL,NULL,'yaml',NULL,''),
|
||||
(3,'ruoyi-auth-dev.yml','DEFAULT_GROUP','spring:\n data:\n redis:\n host: localhost\n port: 6379\n password: \n','72565b1a725e013154ee57c8fd3045c4','2020-11-20 00:00:00','2024-09-14 04:49:42','nacos','0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','',''),
|
||||
(4,'ruoyi-monitor-dev.yml','DEFAULT_GROUP','# spring\nspring:\n security:\n user:\n name: ruoyi\n password: 123456\n boot:\n admin:\n ui:\n title: 若依服务状态监控\n','6f122fd2bfb8d45f858e7d6529a9cd44','2020-11-20 00:00:00','2024-08-29 12:15:11','nacos','0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','',''),
|
||||
(5,'ruoyi-system-dev.yml','DEFAULT_GROUP','# spring配置\nspring:\n data:\n redis:\n host: localhost\n port: 6379\n password: \n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: ruoyi\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n connectTimeout: 30000\n socketTimeout: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://localhost:3306/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: root\n password: password\n # 从库数据源\n # slave:\n # username: \n # password: \n # url: \n # driver-class-name: \n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# springdoc配置\nspringdoc:\n gatewayUrl: http://localhost:8080/${spring.application.name}\n api-docs:\n # 是否开启接口文档\n enabled: true\n info:\n # 标题\n title: \'系统模块接口文档\'\n # 描述\n description: \'系统模块接口描述\'\n # 作者信息\n contact:\n name: RuoYi\n url: https://ruoyi.vip\n','a79ae256018abb7f3bbaba923baeb6af','2020-11-20 00:00:00','2024-09-14 04:49:54','nacos','0:0:0:0:0:0:0:1','','','系统模块','null','null','yaml','',''),
|
||||
Reference in New Issue
Block a user