diff --git a/.editorconfig b/.editorconfig index 672defc11..25b312ef3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,7 @@ end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true -[*.{json,yml}] +[*.{json,yml,yaml}] indent_size = 2 [*.md] diff --git a/README.md b/README.md index d2e514751..88a388b47 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,16 @@ [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/blob/master/LICENSE) [![使用IntelliJ IDEA开发维护](https://img.shields.io/badge/IntelliJ%20IDEA-提供支持-blue.svg)](https://www.jetbrains.com/?from=RuoYi-Vue-Plus)
-[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-4.2.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) -[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.6-blue.svg)]() +[![RuoYi-Vue-Plus](https://img.shields.io/badge/RuoYi_Vue_Plus-4.3.0-success.svg)](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus) +[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-2.7-blue.svg)]() [![JDK-8+](https://img.shields.io/badge/JDK-8-green.svg)]() [![JDK-11](https://img.shields.io/badge/JDK-11-green.svg)]() > RuoYi-Vue-Plus 是重写 RuoYi-Vue 针对 `分布式集群` 场景全方位升级(不兼容原框架) +> 项目代码、文档 均开源免费可商用 遵循开源协议在项目中保留开源协议文件即可
+活到老写到老 为兴趣而开源 为学习而开源 为让大家真正可以学到技术而开源 + > 系统演示: [传送门](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/系统演示?sort_id=4836388) | 功能介绍 | 使用技术 | 文档地址 | 特性注意事项 | @@ -46,7 +49,7 @@ | 监控框架 | SpringBoot-Admin | [SpringBoot-Admin文档](https://codecentric.github.io/spring-boot-admin/current/) | 全方位服务监控 | | 校验框架 | Validation | [Validation文档](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/) | 增强接口安全性、严谨性 支持国际化 | | Excel框架 | Alibaba EasyExcel | [EasyExcel文档](https://www.yuque.com/easyexcel/doc/easyexcel) | 性能优异 扩展性强 | -| 文档框架 | Knife4j | [Knife4j文档](https://doc.xiaominfo.com/knife4j/documentation/) | 美化接口文档 | +| 文档框架 | SpringDoc、javadoc | [接口文档](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5805266&doc_id=1469725) | 无注解零入侵基于java注释 | | 工具类框架 | Hutool、Lombok | [Hutool文档](https://www.hutool.cn/docs/) | 减少代码冗余 增加安全性 | | 代码生成器 | 适配MP、Knife4j规范化代码 | [Hutool文档](https://www.hutool.cn/docs/) | 一键生成前后端代码 | | 部署方式 | Docker | [Docker文档](https://docs.docker.com/) | 容器编排 一键部署业务集群 | @@ -56,11 +59,14 @@ 使用框架前请仔细阅读文档重点注意事项
->[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) ->>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于初始化项目?sort_id=4164117) -> ->[部署项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382) ->>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/关于应用部署?sort_id=4219382) +>[初始化项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) +>>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4164117&doc_id=1469725) +> +>[专栏与视频 入门必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) +>>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=5473272&doc_id=1469725) +> +>[部署项目 必看](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) +>>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages?sort_id=4219382&doc_id=1469725) > >[参考文档 Wiki](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) >>[https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages](https://gitee.com/JavaLionLi/RuoYi-Vue-Plus/wikis/pages) diff --git a/pom.xml b/pom.xml index fe199e04e..e1c02ede6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,53 +6,46 @@ com.ruoyi ruoyi-vue-plus - 4.2.0 + 4.3.0 RuoYi-Vue-Plus https://gitee.com/JavaLionLi/RuoYi-Vue-Plus RuoYi-Vue-Plus后台管理系统 - 4.2.0 - 2.6.9 + 4.3.0 + 2.7.3 UTF-8 UTF-8 1.8 3.2.2 2.2.2 - 1.2.11 - 3.0.3 - 1.5.22 + 1.2.12 + 1.6.11 5.2.2 3.1.1 2.3 1.30.0 3.5.2 3.9.1 - 5.8.3 - 4.9.3 - 2.6.7 - 3.17.4 - 2.2.1 - 3.5.1 + 5.8.6 + 4.10.0 + 2.7.4 + 3.17.6 + 2.2.2 + 3.5.2 1.4.3 2.3.1 + 1.18.24 - 30.0-jre + 31.1-jre - 1.12.248 + 1.12.300 - 2.0.9 - 3.1.537 - - - localhost - http://${docker.registry.url}:2375 - ruoyi - 1.2.2 - + 2.0.18 + 3.1.591 @@ -85,21 +78,21 @@ - com.github.xiaoymin - knife4j-spring-boot-starter - ${knife4j.version} - - - swagger-annotations - io.swagger - - + org.springdoc + springdoc-openapi-webmvc-core + ${springdoc.version} - io.swagger - swagger-annotations - ${swagger-annotations.version} + org.springdoc + springdoc-openapi-javadoc + ${springdoc.version} + + + + org.projectlombok + lombok + ${lombok.version} @@ -142,6 +135,12 @@ cn.dev33 sa-token-jwt ${satoken.version} + + + cn.hutool + hutool-all + + @@ -274,6 +273,23 @@ ${java.version} ${java.version} ${project.build.sourceEncoding} + + + com.github.therapi + therapi-runtime-javadoc-scribe + 0.15.0 + + + org.projectlombok + lombok + ${lombok.version} + + + org.springframework.boot + spring-boot-configuration-processor + ${spring-boot.version} + + @@ -329,8 +345,6 @@ local debug - false - '*' @@ -339,8 +353,6 @@ dev debug - false - '*' @@ -352,8 +364,6 @@ prod warn - true - health, info, logfile diff --git a/ruoyi-extend/pom.xml b/ruoyi-extend/pom.xml index 2be8693e4..a44051d7b 100644 --- a/ruoyi-extend/pom.xml +++ b/ruoyi-extend/pom.xml @@ -5,7 +5,7 @@ ruoyi-vue-plus com.ruoyi - 4.2.0 + 4.3.0 4.0.0 ruoyi-extend diff --git a/ruoyi-extend/ruoyi-monitor-admin/pom.xml b/ruoyi-extend/ruoyi-monitor-admin/pom.xml index e42e8e0f4..6b189aaab 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/pom.xml +++ b/ruoyi-extend/ruoyi-monitor-admin/pom.xml @@ -5,7 +5,7 @@ ruoyi-extend com.ruoyi - 4.2.0 + 4.3.0 4.0.0 jar @@ -59,25 +59,6 @@ - - com.spotify - docker-maven-plugin - ${docker.plugin.version} - - ${docker.namespace}/${project.artifactId}:${project.version} - ${project.basedir} - ${docker.registry.host} - ${docker.registry.url} - ${docker.registry.url} - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java index 2b04f712f..627fa835a 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/java/com/ruoyi/monitor/admin/config/SecurityConfig.java @@ -1,10 +1,10 @@ package com.ruoyi.monitor.admin.config; import de.codecentric.boot.admin.server.config.AdminServerProperties; -import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; /** @@ -12,9 +12,8 @@ import org.springframework.security.web.authentication.SavedRequestAwareAuthenti * * @author Lion Li */ -@Configuration @EnableWebSecurity -public class SecurityConfig extends WebSecurityConfigurerAdapter { +public class SecurityConfig { private final String adminContextPath; @@ -22,27 +21,30 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { this.adminContextPath = adminServerProperties.getContextPath(); } - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { + @Bean + public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("redirectTo"); successHandler.setDefaultTargetUrl(adminContextPath + "/"); - // admin监控 用户鉴权 - httpSecurity.authorizeRequests() - //授予对所有静态资产和登录页面的公共访问权限。 - .antMatchers(adminContextPath + "/assets/**").permitAll() - .antMatchers(adminContextPath + "/login").permitAll() - .antMatchers("/actuator").permitAll() - .antMatchers("/actuator/**").permitAll() - //必须对每个其他请求进行身份验证 - .anyRequest().authenticated().and() - //配置登录和注销 - .formLogin().loginPage(adminContextPath + "/login") - .successHandler(successHandler).and() - .logout().logoutUrl(adminContextPath + "/logout").and() - //启用HTTP-Basic支持。这是Spring Boot Admin Client注册所必需的 - .httpBasic().and().csrf().disable() - .headers().frameOptions().disable(); + + return httpSecurity + .headers().frameOptions().disable() + .and().authorizeRequests() + .antMatchers(adminContextPath + "/assets/**" + , adminContextPath + "/login" + , "/actuator" + , "/actuator/**" + ).permitAll() + .anyRequest().authenticated() + .and() + .formLogin().loginPage(adminContextPath + "/login") + .successHandler(successHandler).and() + .logout().logoutUrl(adminContextPath + "/logout") + .and() + .httpBasic().and() + .csrf() + .disable() + .build(); } } diff --git a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml index bf0db5620..22ef1abfc 100644 --- a/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-monitor-admin/src/main/resources/application.yml @@ -14,18 +14,29 @@ spring: password: 123456 boot: admin: + ui: + title: RuoYi-Vue-Plus服务监控中心 context-path: /admin --- # Actuator 监控端点的配置项 management: endpoints: web: - # Actuator 提供的 API 接口的根目录。默认为 /actuator - base-path: /actuator exposure: - # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 - # 生产环境不建议放开所有 根据项目需求放开即可 - include: @endpoints.include@ + include: '*' endpoint: + health: + show-details: ALWAYS logfile: external-file: ./logs/ruoyi-monitor-admin.log + +--- # 监控配置 +spring.boot.admin.client: + # 增加客户端开关 + enabled: true + # 设置 Spring Boot Admin Server 地址 + url: http://localhost:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml index b9954beac..ff164369c 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/pom.xml @@ -4,7 +4,7 @@ ruoyi-extend com.ruoyi - 4.2.0 + 4.3.0 ruoyi-xxl-job-admin jar @@ -96,27 +96,6 @@ - - - com.spotify - docker-maven-plugin - ${docker.plugin.version} - - - ${docker.namespace}/${project.artifactId}:${project.version} - ${project.basedir} - ${docker.registry.host} - ${docker.registry.url} - ${docker.registry.url} - - - / - ${project.build.directory} - ${project.build.finalName}.jar - - - - diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java index a75595683..0312b7479 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/JacksonUtil.java @@ -21,10 +21,10 @@ import java.io.IOException; public class JacksonUtil { private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); - private final static ObjectMapper objectMapper = new ObjectMapper(); + private final static ObjectMapper OBJECT_MAPPER = new ObjectMapper(); public static ObjectMapper getInstance() { - return objectMapper; + return OBJECT_MAPPER; } /** diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml index 09ed519fa..fa04b5686 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-dev.yml @@ -1,17 +1,13 @@ --- # 监控配置 -spring: - boot: - admin: - # Spring Boot Admin Client 客户端的相关配置 - client: - # 增加客户端开关 - enabled: true - # 设置 Spring Boot Admin Server 地址 - url: http://localhost:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 +spring.boot.admin.client: + # 增加客户端开关 + enabled: true + # 设置 Spring Boot Admin Server 地址 + url: http://localhost:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 --- # 数据库配置 spring: diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml index 401f60af9..d4193d0be 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application-prod.yml @@ -1,24 +1,20 @@ --- # 监控配置 -spring: - boot: - admin: - # Spring Boot Admin Client 客户端的相关配置 - client: - # 增加客户端开关 - enabled: true - # 设置 Spring Boot Admin Server 地址 - url: http://172.30.0.90:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 +spring.boot.admin.client: + # 增加客户端开关 + enabled: true + # 设置 Spring Boot Admin Server 地址 + url: http://localhost:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 --- # 数据库配置 spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://172.30.0.36:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai + url: jdbc:mysql://127.0.0.1:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai username: root password: root hikari: diff --git a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml index 202272087..d4fda939a 100644 --- a/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml +++ b/ruoyi-extend/ruoyi-xxl-job-admin/src/main/resources/application.yml @@ -37,13 +37,11 @@ management: enabled: false endpoints: web: - # Actuator 提供的 API 接口的根目录。默认为 /actuator - base-path: /actuator exposure: - # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 - # 生产环境不建议放开所有 根据项目需求放开即可 - include: @endpoints.include@ + include: '*' endpoint: + health: + show-details: ALWAYS logfile: external-file: ./logs/ruoyi-xxl-job-admin.log diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging deleted file mode 100644 index 903abe658..000000000 --- a/ruoyi-ui/.env.staging +++ /dev/null @@ -1,19 +0,0 @@ -# 页面标题 -VUE_APP_TITLE = RuoYi-Vue-Plus后台管理系统 - -NODE_ENV = production - -# 测试环境配置 -ENV = 'staging' - -# 应用访问路径 例如使用前缀 /admin/ -VUE_APP_CONTEXT_PATH = '/' - -# 监控地址 -VUE_APP_MONITRO_ADMIN = '/admin/login' - -# 监控地址 -VUE_APP_XXL_JOB_ADMIN = '/xxl-job-admin' - -# 若依管理系统/测试环境 -VUE_APP_BASE_API = '/stage-api' diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index c9486724f..645d3007e 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,13 +1,12 @@ { "name": "ruoyi-vue-plus", - "version": "4.2.0", + "version": "4.3.0", "description": "RuoYi-Vue-Plus后台管理系统", "author": "LionLi", "license": "MIT", "scripts": { "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", - "build:stage": "vue-cli-service build --mode staging", "preview": "node build/index.js --preview", "lint": "eslint --ext .js,.vue src" }, diff --git a/ruoyi-ui/src/api/monitor/cache.js b/ruoyi-ui/src/api/monitor/cache.js index 2ffaf7a3f..9177e933a 100644 --- a/ruoyi-ui/src/api/monitor/cache.js +++ b/ruoyi-ui/src/api/monitor/cache.js @@ -7,3 +7,51 @@ export function getCache() { method: 'get' }) } + +// 查询缓存名称列表 +export function listCacheName() { + return request({ + url: '/monitor/cache/getNames', + method: 'get' + }) +} + +// 查询缓存键名列表 +export function listCacheKey(cacheName) { + return request({ + url: '/monitor/cache/getKeys/' + cacheName, + method: 'get' + }) +} + +// 查询缓存内容 +export function getCacheValue(cacheName, cacheKey) { + return request({ + url: '/monitor/cache/getValue/' + cacheName + '/' + cacheKey, + method: 'get' + }) +} + +// 清理指定名称缓存 +export function clearCacheName(cacheName) { + return request({ + url: '/monitor/cache/clearCacheName/' + cacheName, + method: 'delete' + }) +} + +// 清理指定键名缓存 +export function clearCacheKey(cacheName, cacheKey) { + return request({ + url: '/monitor/cache/clearCacheKey/'+ cacheName + "/" + cacheKey, + method: 'delete' + }) +} + +// 清理全部缓存 +export function clearCacheAll() { + return request({ + url: '/monitor/cache/clearCacheAll', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/logininfor.js b/ruoyi-ui/src/api/monitor/logininfor.js index 26a46eb56..4d112b78a 100644 --- a/ruoyi-ui/src/api/monitor/logininfor.js +++ b/ruoyi-ui/src/api/monitor/logininfor.js @@ -17,6 +17,14 @@ export function delLogininfor(infoId) { }) } +// 解锁用户登录状态 +export function unlockLogininfor(userName) { + return request({ + url: '/monitor/logininfor/unlock/' + userName, + method: 'get' + }) +} + // 清空登录日志 export function cleanLogininfor() { return request({ diff --git a/ruoyi-ui/src/api/system/dept.js b/ruoyi-ui/src/api/system/dept.js index 2804676ff..331c4b2c1 100644 --- a/ruoyi-ui/src/api/system/dept.js +++ b/ruoyi-ui/src/api/system/dept.js @@ -25,22 +25,6 @@ export function getDept(deptId) { }) } -// 查询部门下拉树结构 -export function treeselect() { - return request({ - url: '/system/dept/treeselect', - method: 'get' - }) -} - -// 根据角色ID查询部门树结构 -export function roleDeptTreeselect(roleId) { - return request({ - url: '/system/dept/roleDeptTreeselect/' + roleId, - method: 'get' - }) -} - // 新增部门 export function addDept(data) { return request({ @@ -65,4 +49,4 @@ export function delDept(deptId) { url: '/system/dept/' + deptId, method: 'delete' }) -} \ No newline at end of file +} diff --git a/ruoyi-ui/src/api/system/ossConfig.js b/ruoyi-ui/src/api/system/ossConfig.js index 175325e87..f29076283 100644 --- a/ruoyi-ui/src/api/system/ossConfig.js +++ b/ruoyi-ui/src/api/system/ossConfig.js @@ -43,7 +43,7 @@ export function delOssConfig(ossConfigId) { }) } -// 用户状态修改 +// 对象存储状态修改 export function changeOssConfigStatus(ossConfigId, status, configKey) { const data = { ossConfigId, diff --git a/ruoyi-ui/src/api/system/role.js b/ruoyi-ui/src/api/system/role.js index 888538e55..f13e6f404 100644 --- a/ruoyi-ui/src/api/system/role.js +++ b/ruoyi-ui/src/api/system/role.js @@ -109,3 +109,11 @@ export function authUserSelectAll(data) { params: data }) } + +// 根据角色ID查询部门树结构 +export function deptTreeSelect(roleId) { + return request({ + url: '/system/role/deptTree/' + roleId, + method: 'get' + }) +} diff --git a/ruoyi-ui/src/api/system/user.js b/ruoyi-ui/src/api/system/user.js index 4fd752b4b..f2f76ef9f 100644 --- a/ruoyi-ui/src/api/system/user.js +++ b/ruoyi-ui/src/api/system/user.js @@ -125,3 +125,11 @@ export function updateAuthRole(data) { params: data }) } + +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/user/deptTree', + method: 'get' + }) +} diff --git a/ruoyi-ui/src/assets/icons/svg/redis-list.svg b/ruoyi-ui/src/assets/icons/svg/redis-list.svg new file mode 100644 index 000000000..98a15b2a6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/redis-list.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/styles/transition.scss b/ruoyi-ui/src/assets/styles/transition.scss index 4cb27cc81..eb4989554 100644 --- a/ruoyi-ui/src/assets/styles/transition.scss +++ b/ruoyi-ui/src/assets/styles/transition.scss @@ -12,11 +12,16 @@ } /* fade-transform */ +.fade-transform--move, .fade-transform-leave-active, .fade-transform-enter-active { transition: all .5s; } +.fade-transform-leave-active { + position: absolute; +} + .fade-transform-enter { opacity: 0; transform: translateX(-30px); diff --git a/ruoyi-ui/src/components/DictData/index.js b/ruoyi-ui/src/components/DictData/index.js index c2a0359cc..7b85d4aaa 100644 --- a/ruoyi-ui/src/components/DictData/index.js +++ b/ruoyi-ui/src/components/DictData/index.js @@ -1,7 +1,23 @@ import Vue from 'vue' +import store from '@/store' import DataDict from '@/utils/dict' import { getDicts as getDicts } from '@/api/system/dict/data' +function searchDictByKey(dict, key) { + if (key == null && key == "") { + return null + } + try { + for (let i = 0; i < dict.length; i++) { + if (dict[i].key == key) { + return dict[i].value + } + } + } catch (e) { + return null + } +} + function install() { Vue.use(DataDict, { metas: { @@ -9,7 +25,19 @@ function install() { labelField: 'dictLabel', valueField: 'dictValue', request(dictMeta) { - return getDicts(dictMeta.type).then(res => res.data) + const storeDict = searchDictByKey(store.getters.dict, dictMeta.type) + if (storeDict) { + return new Promise(resolve => { resolve(storeDict) }) + } else { + return new Promise((resolve, reject) => { + getDicts(dictMeta.type).then(res => { + store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data }) + resolve(res.data) + }).catch(error => { + reject(error) + }) + }) + } }, }, }, diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index e999f14f8..1095824b5 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -12,7 +12,7 @@ :show-file-list="false" :headers="headers" class="upload-file-uploader" - ref="upload" + ref="fileUpload" > 选取文件 @@ -157,22 +157,19 @@ export default { // 上传失败 handleUploadError(err) { this.$modal.msgError("上传图片失败,请重试"); - this.$modal.closeLoading() + this.$modal.closeLoading(); }, // 上传成功回调 handleUploadSuccess(res, file) { if (res.code === 200) { this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId }); - if (this.uploadList.length === this.number) { - this.fileList = this.fileList.concat(this.uploadList); - this.uploadList = []; - this.number = 0; - this.$emit("input", this.listToString(this.fileList)); - this.$modal.closeLoading(); - } + this.uploadedSuccessfully(); } else { - this.$modal.msgError(res.msg); + this.number--; this.$modal.closeLoading(); + this.$modal.msgError(res.msg); + this.$refs.fileUpload.handleRemove(file); + this.uploadedSuccessfully(); } }, // 删除文件 @@ -182,6 +179,16 @@ export default { this.fileList.splice(index, 1); this.$emit("input", this.listToString(this.fileList)); }, + // 上传结束处理 + uploadedSuccessfully() { + if (this.number > 0 && this.uploadList.length === this.number) { + this.fileList = this.fileList.concat(this.uploadList); + this.uploadList = []; + this.number = 0; + this.$emit("input", this.listToString(this.fileList)); + this.$modal.closeLoading(); + } + }, // 获取文件名称 getFileName(name) { // 如果是url那么取最后的名字 如果不是直接返回 diff --git a/ruoyi-ui/src/components/ImagePreview/index.vue b/ruoyi-ui/src/components/ImagePreview/index.vue index 671eda323..cd996262a 100644 --- a/ruoyi-ui/src/components/ImagePreview/index.vue +++ b/ruoyi-ui/src/components/ImagePreview/index.vue @@ -18,7 +18,7 @@ export default { props: { src: { type: String, - required: true + default: "" }, width: { type: [Number, String], @@ -31,10 +31,16 @@ export default { }, computed: { realSrc() { + if (!this.src) { + return; + } let real_src = this.src.split(",")[0]; return real_src; }, realSrcList() { + if (!this.src) { + return; + } let real_src_list = this.src.split(","); let srcList = []; real_src_list.forEach(item => { diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index 62199795d..9c92e86bc 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -9,8 +9,8 @@ :limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" - name="file" - :on-remove="handleRemove" + ref="imageUpload" + :on-remove="handleDelete" :show-file-list="true" :headers="headers" :file-list="fileList" @@ -120,32 +120,6 @@ export default { }, }, methods: { - // 删除图片 - handleRemove(file, fileList) { - const findex = this.fileList.map(f => f.name).indexOf(file.name); - if(findex > -1) { - let ossId = this.fileList[findex].ossId; - delOss(ossId); - this.fileList.splice(findex, 1); - this.$emit("input", this.listToString(this.fileList)); - } - }, - // 上传成功回调 - handleUploadSuccess(res) { - if (res.code == 200) { - this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId }); - if (this.uploadList.length === this.number) { - this.fileList = this.fileList.concat(this.uploadList); - this.uploadList = []; - this.number = 0; - this.$emit("input", this.listToString(this.fileList)); - this.$modal.closeLoading(); - } - } else { - this.$modal.msgError(res.msg); - this.$modal.closeLoading(); - } - }, // 上传前loading加载 handleBeforeUpload(file) { let isImg = false; @@ -181,11 +155,44 @@ export default { handleExceed() { this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`); }, + // 上传成功回调 + handleUploadSuccess(res, file) { + if (res.code === 200) { + this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId }); + this.uploadedSuccessfully(); + } else { + this.number--; + this.$modal.closeLoading(); + this.$modal.msgError(res.msg); + this.$refs.imageUpload.handleRemove(file); + this.uploadedSuccessfully(); + } + }, + // 删除图片 + handleDelete(file) { + const findex = this.fileList.map(f => f.name).indexOf(file.name); + if(findex > -1) { + let ossId = this.fileList[findex].ossId; + delOss(ossId); + this.fileList.splice(findex, 1); + this.$emit("input", this.listToString(this.fileList)); + } + }, // 上传失败 handleUploadError(res) { this.$modal.msgError("上传图片失败,请重试"); this.$modal.closeLoading(); }, + // 上传结束处理 + uploadedSuccessfully() { + if (this.number > 0 && this.uploadList.length === this.number) { + this.fileList = this.fileList.concat(this.uploadList); + this.uploadList = []; + this.number = 0; + this.$emit("input", this.listToString(this.fileList)); + this.$modal.closeLoading(); + } + }, // 预览 handlePictureCardPreview(file) { this.dialogImageUrl = file.url; @@ -196,10 +203,12 @@ export default { let strs = ""; separator = separator || ","; for (let i in list) { - strs += list[i].ossId + separator; + if (list[i].ossId) { + strs += list[i].ossId + separator; + } } return strs != "" ? strs.substr(0, strs.length - 1) : ""; - }, + } } }; diff --git a/ruoyi-ui/src/components/RightPanel/index.vue b/ruoyi-ui/src/components/RightPanel/index.vue index fbf27eb4f..2d6122bc0 100644 --- a/ruoyi-ui/src/components/RightPanel/index.vue +++ b/ruoyi-ui/src/components/RightPanel/index.vue @@ -1,5 +1,5 @@ - -