diff --git a/README.md b/README.md index 09a4f7492..f39163083 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,26 @@

- logo + logo

-

RuoYi v4.7.8

-

基于SpringBoot开发的轻量级Java快速开发框架

+

RuoYi v3.8.7

+

基于SpringBoot+Vue前后端分离的Java快速开发框架

- - - + + +

## 平台简介 -一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序,如网站管理后台,网站会员中心,CMS,CRM,OA。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 - -性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依) - 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 -* 前后端分离版本,请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) -* 感谢 [hplus](https://gitee.com/hplus_admin/hplus) 后台主题 UI 框架。 +* 前端采用Vue、Element UI。 +* 后端采用Spring Boot、Spring Security、Redis & Jwt。 +* 权限认证使用Jwt,支持多终端认证系统。 +* 支持加载动态权限菜单,多方式轻松权限控制。 +* 高效率开发,使用代码生成器可以一键生成前后端代码。 +* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 +* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 +* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   * 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   @@ -39,7 +41,7 @@ 13. 代码生成:前后端代码的生成(java、html、xml、sql)支持CRUD下载 。 14. 系统接口:根据业务代码自动生成相关的api接口文档。 15. 服务监控:监视当前系统CPU、内存、磁盘、堆栈等相关信息。 -16. 缓存监控:对系统的缓存查询,删除、清空等操作。 +16. 缓存监控:对系统的缓存信息查询,命令统计等。 17. 在线构建器:拖动表单元素生成相应的HTML代码。 18. 连接池监视:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈。 @@ -48,55 +50,47 @@ - admin/admin123 - 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 -演示地址:http://ruoyi.vip +演示地址:http://vue.ruoyi.vip 文档地址:http://doc.ruoyi.vip ## 演示图 - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - + +
-## 若依交流群 +## 若依前后端分离交流群 -QQ群: [![加入QQ群](https://img.shields.io/badge/已满-1389287-blue.svg)](https://jq.qq.com/?_wv=1027&k=5HBAaYN) [![加入QQ群](https://img.shields.io/badge/已满-1679294-blue.svg)](https://jq.qq.com/?_wv=1027&k=5cHeRVW) [![加入QQ群](https://img.shields.io/badge/已满-1529866-blue.svg)](https://jq.qq.com/?_wv=1027&k=53R0L5Z) [![加入QQ群](https://img.shields.io/badge/已满-1772718-blue.svg)](https://jq.qq.com/?_wv=1027&k=5g75dCU) [![加入QQ群](https://img.shields.io/badge/已满-1366522-blue.svg)](https://jq.qq.com/?_wv=1027&k=58cPoHA) [![加入QQ群](https://img.shields.io/badge/已满-1382251-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Ofd4Pb) [![加入QQ群](https://img.shields.io/badge/已满-1145125-blue.svg)](https://jq.qq.com/?_wv=1027&k=5yugASz) [![加入QQ群](https://img.shields.io/badge/已满-86752435-blue.svg)](https://jq.qq.com/?_wv=1027&k=5Rf3d2P) [![加入QQ群](https://img.shields.io/badge/已满-134072510-blue.svg)](https://jq.qq.com/?_wv=1027&k=5ZIjaeP) [![加入QQ群](https://img.shields.io/badge/已满-210336300-blue.svg)](https://jq.qq.com/?_wv=1027&k=5CJw1jY) [![加入QQ群](https://img.shields.io/badge/已满-339522636-blue.svg)](https://jq.qq.com/?_wv=1027&k=5omzbKc) [![加入QQ群](https://img.shields.io/badge/已满-130035985-blue.svg)](https://jq.qq.com/?_wv=1027&k=qPIKBb7s) [![加入QQ群](https://img.shields.io/badge/已满-143151071-blue.svg)](https://jq.qq.com/?_wv=1027&k=4NsjKbtU) [![加入QQ群](https://img.shields.io/badge/已满-158781320-blue.svg)](https://jq.qq.com/?_wv=1027&k=VD2pkz2G) [![加入QQ群](https://img.shields.io/badge/已满-201531282-blue.svg)](https://jq.qq.com/?_wv=1027&k=HlshFwkJ) [![加入QQ群](https://img.shields.io/badge/已满-101526938-blue.svg)](https://jq.qq.com/?_wv=1027&k=0ARRrO9V) [![加入QQ群](https://img.shields.io/badge/已满-264355400-blue.svg)](https://jq.qq.com/?_wv=1027&k=up9k3ZXJ) [![加入QQ群](https://img.shields.io/badge/已满-298522656-blue.svg)](https://jq.qq.com/?_wv=1027&k=540WfdEr) [![加入QQ群](https://img.shields.io/badge/已满-139845794-blue.svg)](https://jq.qq.com/?_wv=1027&k=ss91fC4t) [![加入QQ群](https://img.shields.io/badge/已满-185760789-blue.svg)](https://jq.qq.com/?_wv=1027&k=Cqd66IKe) [![加入QQ群](https://img.shields.io/badge/已满-175104288-blue.svg)](https://jq.qq.com/?_wv=1027&k=7FplYUnR) [![加入QQ群](https://img.shields.io/badge/174942938-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=lqMHu_5Fskm7H2S1vNAQTtzAUokVydwc&authKey=ptw0Fpch5pbNocML3CIJKKqZBaq2DI7cusKuzIgfMNiY3t9Pvd9hP%2BA8WYx3yaY1&noverify=0&group_code=174942938) \ No newline at end of file +QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/已满-143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [![加入QQ群](https://img.shields.io/badge/已满-174951577-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) [![加入QQ群](https://img.shields.io/badge/已满-161281055-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=Fn2aF5IHpwsy8j6VlalNJK6qbwFLFHat&authKey=uyIT%2B97x2AXj3odyXpsSpVaPMC%2Bidw0LxG5MAtEqlrcBcWJUA%2FeS43rsF1Tg7IRJ&noverify=0&group_code=161281055) [![加入QQ群](https://img.shields.io/badge/138988063-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=XIzkm_mV2xTsUtFxo63bmicYoDBA6Ifm&authKey=dDW%2F4qsmw3x9govoZY9w%2FoWAoC4wbHqGal%2BbqLzoS6VBarU8EBptIgPKN%2FviyC8j&noverify=0&group_code=138988063) 点击按钮入群。 \ No newline at end of file diff --git a/doc/~$环境使用手册.docx b/doc/~$环境使用手册.docx new file mode 100644 index 000000000..0a832e2c2 --- /dev/null +++ b/doc/~$环境使用手册.docx @@ -0,0 +1 @@ +chen_tfxchen_tfx \ No newline at end of file diff --git a/doc/若依环境使用手册.docx b/doc/若依环境使用手册.docx index fa5b62d7d..9e4daef4d 100644 --- a/doc/若依环境使用手册.docx +++ b/doc/若依环境使用手册.docx @@ -47,17 +47,23 @@ 改为自己需要的路径 -3.2 启动及验证 +3.2 启动及验证(后台) 启动RuoYiApplication.java 出现如下图表示启动成功 -打开浏览器,输入:http://localhost:80/ -若能正确展示登录页面,并能成功登录,登录后菜单及页面展示正常,则表明环境搭建成功。 -默认密码为 admin/admin123 +打开浏览器,输入:http://localhost:8080/captchaImage +若能正确显示返回信息,搭建后台成功。 -演示地址:http://ruoyi.vip +3.3 启动及验证(前台) +# 进入项目目录 +cd ruoyi-ui +npm install --registry=https://registry.npm.taobao.org +npm run dev +打开浏览器,输入:http://localhost:80 (默认账户 admin/admin123) +若能正确展示登录页面,并能成功登录,菜单及页面展示正常,则表明环境搭建成功 +注意:执行npm命令需要配置node环境 4. 部署若依系统 4.1 war部署方式 4.1.1 修改pom.xml文件。将jar修改为war @@ -84,6 +90,14 @@ 执行命令:java - jar RuoYi.jar 脚本执行:ry.sh start 启动stop 停止 +4.2 前端部署 +# 打包正式环境 +npm run build:prod + +# 打包预发布环境 +npm run build:stage + +构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件,通常是 ***.js 、***.css、index.html 等静态文件。发布到你的 nginx 或者静态服务器即可,其中的 index.html 是后台服务的入口页面。 演示地址:ruoyi.vip 文档地址:doc.ruoyi.vip diff --git a/pom.xml b/pom.xml index 61994cff1..2bdfca51f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,35 +1,35 @@ - - 4.0.0 - + + 4.0.0 + com.ruoyi ruoyi - 4.7.8 + 3.8.7 ruoyi http://www.ruoyi.vip 若依管理系统 - 4.7.8 + 3.8.7 UTF-8 UTF-8 1.8 3.1.1 - 1.13.0 5.3.33 - 2.1.0 1.2.20 1.21 - 2.3.3 3.0.0 + 2.3.3 1.4.7 - 1.2.83 + 2.0.43 6.5.0 2.13.0 4.1.2 2.3 + 0.9.1 @@ -60,41 +60,6 @@ druid-spring-boot-starter ${druid.version} - - - - pro.fessional - kaptcha - ${kaptcha.version} - - - - - org.apache.shiro - shiro-core - ${shiro.version} - - - - - org.apache.shiro - shiro-spring - ${shiro.version} - - - - - org.apache.shiro - shiro-ehcache - ${shiro.version} - - - - - com.github.theborakompanioni - thymeleaf-extras-shiro - ${thymeleaf.extras.shiro.version} - @@ -153,11 +118,25 @@ - com.alibaba - fastjson + com.alibaba.fastjson2 + fastjson2 ${fastjson.version} + + + io.jsonwebtoken + jjwt + ${jwt.version} + + + + + pro.fessional + kaptcha + ${kaptcha.version} + + com.ruoyi @@ -206,11 +185,6 @@ pom - - - - - diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 2e28443e9..b97ef8863 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 4.7.8 + 3.8.7 4.0.0 jar @@ -17,12 +17,6 @@ - - - org.springframework.boot - spring-boot-starter-thymeleaf - - org.springframework.boot @@ -43,7 +37,7 @@ 1.6.2 - + mysql mysql-connector-java @@ -89,44 +83,12 @@ org.apache.maven.plugins maven-war-plugin - 3.0.0 + 3.1.0 false ${project.artifactId} - - + ${project.artifactId} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index a0e726bd4..e3c56ee54 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -27,4 +27,4 @@ public class RuoYiApplication " | | \\ / \\ / \n" + " ''-' `'-' `-..-' "); } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java new file mode 100644 index 000000000..d2d6e8c47 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -0,0 +1,94 @@ +package com.ruoyi.web.controller.common; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import com.google.code.kaptcha.Producer; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.sign.Base64; +import com.ruoyi.common.utils.uuid.IdUtils; +import com.ruoyi.system.service.ISysConfigService; + +/** + * 验证码操作处理 + * + * @author ruoyi + */ +@RestController +public class CaptchaController +{ + @Resource(name = "captchaProducer") + private Producer captchaProducer; + + @Resource(name = "captchaProducerMath") + private Producer captchaProducerMath; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysConfigService configService; + /** + * 生成验证码 + */ + @GetMapping("/captchaImage") + public AjaxResult getCode(HttpServletResponse response) throws IOException + { + AjaxResult ajax = AjaxResult.success(); + boolean captchaEnabled = configService.selectCaptchaEnabled(); + ajax.put("captchaEnabled", captchaEnabled); + if (!captchaEnabled) + { + return ajax; + } + + // 保存验证码信息 + String uuid = IdUtils.simpleUUID(); + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + uuid; + + String capStr = null, code = null; + BufferedImage image = null; + + // 生成验证码 + String captchaType = RuoYiConfig.getCaptchaType(); + if ("math".equals(captchaType)) + { + String capText = captchaProducerMath.createText(); + capStr = capText.substring(0, capText.lastIndexOf("@")); + code = capText.substring(capText.lastIndexOf("@") + 1); + image = captchaProducerMath.createImage(capStr); + } + else if ("char".equals(captchaType)) + { + capStr = code = captchaProducer.createText(); + image = captchaProducer.createImage(capStr); + } + + redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); + // 转换流信息写出 + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try + { + ImageIO.write(image, "jpg", os); + } + catch (IOException e) + { + return AjaxResult.error(e.getMessage()); + } + + ajax.put("uuid", uuid); + ajax.put("img", Base64.encode(os.toByteArray())); + return ajax; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index c2db93ac9..d51d61d00 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -8,26 +8,25 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.config.ServerConfig; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; /** * 通用请求处理 * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/common") public class CommonController { @@ -74,7 +73,6 @@ public class CommonController * 通用上传请求(单个) */ @PostMapping("/upload") - @ResponseBody public AjaxResult uploadFile(MultipartFile file) throws Exception { try @@ -101,7 +99,6 @@ public class CommonController * 通用上传请求(多个) */ @PostMapping("/uploads") - @ResponseBody public AjaxResult uploadFiles(List files) throws Exception { try diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java deleted file mode 100644 index 6b95a7420..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoDialogController.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 模态窗口 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/modal") -public class DemoDialogController -{ - private String prefix = "demo/modal"; - - /** - * 模态窗口 - */ - @GetMapping("/dialog") - public String dialog() - { - return prefix + "/dialog"; - } - - /** - * 弹层组件 - */ - @GetMapping("/layer") - public String layer() - { - return prefix + "/layer"; - } - - /** - * 表单 - */ - @GetMapping("/form") - public String form() - { - return prefix + "/form"; - } - - /** - * 表格 - */ - @GetMapping("/table") - public String table() - { - return prefix + "/table"; - } - - /** - * 表格check - */ - @GetMapping("/check") - public String check() - { - return prefix + "/table/check"; - } - - /** - * 表格radio - */ - @GetMapping("/radio") - public String radio() - { - return prefix + "/table/radio"; - } - - /** - * 表格回传父窗体 - */ - @GetMapping("/parent") - public String parent() - { - return prefix + "/table/parent"; - } - - /** - * 多层窗口frame1 - */ - @GetMapping("/frame1") - public String frame1() - { - return prefix + "/table/frame1"; - } - - /** - * 多层窗口frame2 - */ - @GetMapping("/frame2") - public String frame2() - { - return prefix + "/table/frame2"; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java deleted file mode 100644 index 0f72816fc..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoFormController.java +++ /dev/null @@ -1,399 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.List; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.alibaba.fastjson.JSON; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.CxSelect; -import com.ruoyi.common.json.JSONObject; -import com.ruoyi.common.json.JSONObject.JSONArray; -import com.ruoyi.common.utils.StringUtils; - -/** - * 表单相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/form") -public class DemoFormController -{ - private String prefix = "demo/form"; - - private final static List users = new ArrayList(); - { - users.add(new UserFormModel(1, "1000001", "测试1", "15888888888")); - users.add(new UserFormModel(2, "1000002", "测试2", "15666666666")); - users.add(new UserFormModel(3, "1000003", "测试3", "15666666666")); - users.add(new UserFormModel(4, "1000004", "测试4", "15666666666")); - users.add(new UserFormModel(5, "1000005", "测试5", "15666666666")); - } - - /** - * 按钮页 - */ - @GetMapping("/button") - public String button() - { - return prefix + "/button"; - } - - /** - * 下拉框 - */ - @GetMapping("/select") - public String select() - { - return prefix + "/select"; - } - - /** - * 时间轴 - */ - @GetMapping("/timeline") - public String timeline() - { - return prefix + "/timeline"; - } - - /** - * 进度条 - */ - @GetMapping("/progress_bars") - public String progress_bars() - { - return prefix + "/progress_bars"; - } - - /** - * 表单校验 - */ - @GetMapping("/validate") - public String validate() - { - return prefix + "/validate"; - } - - /** - * 功能扩展(包含文件上传) - */ - @GetMapping("/jasny") - public String jasny() - { - return prefix + "/jasny"; - } - - /** - * 拖动排序 - */ - @GetMapping("/sortable") - public String sortable() - { - return prefix + "/sortable"; - } - - /** - * 单据打印 - */ - @GetMapping("/invoice") - public String invoice() - { - return prefix + "/invoice"; - } - - /** - * 标签 & 提示 - */ - @GetMapping("/labels_tips") - public String labels_tips() - { - return prefix + "/labels_tips"; - } - - /** - * 选项卡 & 面板 - */ - @GetMapping("/tabs_panels") - public String tabs_panels() - { - return prefix + "/tabs_panels"; - } - - /** - * 栅格 - */ - @GetMapping("/grid") - public String grid() - { - return prefix + "/grid"; - } - - /** - * 表单向导 - */ - @GetMapping("/wizard") - public String wizard() - { - return prefix + "/wizard"; - } - - /** - * 文件上传 - */ - @GetMapping("/upload") - public String upload() - { - return prefix + "/upload"; - } - - /** - * 日期和时间页 - */ - @GetMapping("/datetime") - public String datetime() - { - return prefix + "/datetime"; - } - - /** - * 左右互选组件 - */ - @GetMapping("/duallistbox") - public String duallistbox() - { - return prefix + "/duallistbox"; - } - - /** - * 基本表单 - */ - @GetMapping("/basic") - public String basic() - { - return prefix + "/basic"; - } - - /** - * 卡片列表 - */ - @GetMapping("/cards") - public String cards() - { - return prefix + "/cards"; - } - - /** - * summernote 富文本编辑器 - */ - @GetMapping("/summernote") - public String summernote() - { - return prefix + "/summernote"; - } - - /** - * 搜索自动补全 - */ - @GetMapping("/autocomplete") - public String autocomplete() - { - return prefix + "/autocomplete"; - } - - /** - * 多级联动下拉 - */ - @GetMapping("/cxselect") - public String cxselect(ModelMap mmap) - { - CxSelect cxSelectTB = new CxSelect(); - cxSelectTB.setN("淘宝"); - cxSelectTB.setV("taobao"); - CxSelect cxSelectTm = new CxSelect(); - cxSelectTm.setN("天猫"); - cxSelectTm.setV("tm"); - CxSelect cxSelectJhs = new CxSelect(); - cxSelectJhs.setN("聚划算"); - cxSelectJhs.setV("jhs"); - List tmList = new ArrayList(); - tmList.add(cxSelectTm); - tmList.add(cxSelectJhs); - cxSelectTB.setS(tmList); - - CxSelect cxSelectJD = new CxSelect(); - cxSelectJD.setN("京东"); - cxSelectJD.setV("jd"); - CxSelect cxSelectCs = new CxSelect(); - cxSelectCs.setN("京东超市"); - cxSelectCs.setV("jdcs"); - CxSelect cxSelectSx = new CxSelect(); - cxSelectSx.setN("京东生鲜"); - cxSelectSx.setV("jdsx"); - List jdList = new ArrayList(); - jdList.add(cxSelectCs); - jdList.add(cxSelectSx); - cxSelectJD.setS(jdList); - - List cxList = new ArrayList(); - cxList.add(cxSelectTB); - cxList.add(cxSelectJD); - - mmap.put("data", JSON.toJSON(cxList)); - return prefix + "/cxselect"; - } - - /** - * 局部刷新 - */ - @GetMapping("/localrefresh") - public String localRefresh(ModelMap mmap) - { - JSONArray list = new JSONArray(); - JSONObject item = new JSONObject(); - item.put("name", "这条任务数据是由ModelMap传递到页面的,点击添加按钮后会将这条数据替换为新数据"); - item.put("type", "默认"); - item.put("date", "2020.06.10"); - list.add(item); - mmap.put("tasks", list); - mmap.put("min", 2); - mmap.put("max", 10); - return prefix + "/localrefresh"; - } - - /** - * 局部刷新-添加任务 - * - * @param fragment 页面中的模板名称 - * @param taskName 任务名称 - */ - @PostMapping("/localrefresh/task") - public String localRefreshTask(String fragment, String taskName, ModelMap mmap) - { - JSONArray list = new JSONArray(); - JSONObject item = new JSONObject(); - item.put("name", StringUtils.defaultIfBlank(taskName, "通过电话销售过程中了解各盛市的设备仪器使用、采购情况及相关重要追踪人")); - item.put("type", "新增"); - item.put("date", "2018.06.10"); - list.add(item); - item = new JSONObject(); - item.put("name", "提高自己电话营销技巧,灵活专业地与客户进行电话交流"); - item.put("type", "新增"); - item.put("date", "2018.06.12"); - list.add(item); - mmap.put("tasks", list); - return prefix + "/localrefresh::" + fragment; - } - - /** - * 模拟数据 - */ - @GetMapping("/cityData") - @ResponseBody - public String cityData() - { - String data = "[{\"n\":\"湖南省\",\"s\":[{\"n\":\"长沙市\",\"s\":[{\"n\":\"芙蓉区\"},{\"n\":\"天心区\"},{\"n\":\"岳麓区\"},{\"n\":\"开福区\"},{\"n\":\"雨花区\"},{\"n\":\"望城区\"},{\"n\":\"长沙县\"},{\"n\":\"宁乡县\"},{\"n\":\"浏阳市\"}]},{\"n\":\"株洲市\",\"s\":[{\"n\":\"荷塘区\"},{\"n\":\"芦淞区\"},{\"n\":\"石峰区\"},{\"n\":\"天元区\"},{\"n\":\"株洲县\"},{\"n\":\"攸县\"},{\"n\":\"茶陵县\"},{\"n\":\"炎陵县\"},{\"n\":\"醴陵市\"}]},{\"n\":\"湘潭市\",\"s\":[{\"n\":\"雨湖区\"},{\"n\":\"岳塘区\"},{\"n\":\"湘潭县\"},{\"n\":\"湘乡市\"},{\"n\":\"韶山市\"}]},{\"n\":\"衡阳市\",\"s\":[{\"n\":\"珠晖区\"},{\"n\":\"雁峰区\"},{\"n\":\"石鼓区\"},{\"n\":\"蒸湘区\"},{\"n\":\"南岳区\"},{\"n\":\"衡阳县\"},{\"n\":\"衡南县\"},{\"n\":\"衡山县\"},{\"n\":\"衡东县\"},{\"n\":\"祁东县\"},{\"n\":\"耒阳市\"},{\"n\":\"常宁市\"}]},{\"n\":\"邵阳市\",\"s\":[{\"n\":\"双清区\"},{\"n\":\"大祥区\"},{\"n\":\"北塔区\"},{\"n\":\"邵东县\"},{\"n\":\"新邵县\"},{\"n\":\"邵阳县\"},{\"n\":\"隆回县\"},{\"n\":\"洞口县\"},{\"n\":\"绥宁县\"},{\"n\":\"新宁县\"},{\"n\":\"城步苗族自治县\"},{\"n\":\"武冈市\"}]},{\"n\":\"岳阳市\",\"s\":[{\"n\":\"岳阳楼区\"},{\"n\":\"云溪区\"},{\"n\":\"君山区\"},{\"n\":\"岳阳县\"},{\"n\":\"华容县\"},{\"n\":\"湘阴县\"},{\"n\":\"平江县\"},{\"n\":\"汨罗市\"},{\"n\":\"临湘市\"}]},{\"n\":\"常德市\",\"s\":[{\"n\":\"武陵区\"},{\"n\":\"鼎城区\"},{\"n\":\"安乡县\"},{\"n\":\"汉寿县\"},{\"n\":\"澧县\"},{\"n\":\"临澧县\"},{\"n\":\"桃源县\"},{\"n\":\"石门县\"},{\"n\":\"津市市\"}]},{\"n\":\"张家界市\",\"s\":[{\"n\":\"永定区\"},{\"n\":\"武陵源区\"},{\"n\":\"慈利县\"},{\"n\":\"桑植县\"}]},{\"n\":\"益阳市\",\"s\":[{\"n\":\"资阳区\"},{\"n\":\"赫山区\"},{\"n\":\"南县\"},{\"n\":\"桃江县\"},{\"n\":\"安化县\"},{\"n\":\"沅江市\"}]},{\"n\":\"郴州市\",\"s\":[{\"n\":\"北湖区\"},{\"n\":\"苏仙区\"},{\"n\":\"桂阳县\"},{\"n\":\"宜章县\"},{\"n\":\"永兴县\"},{\"n\":\"嘉禾县\"},{\"n\":\"临武县\"},{\"n\":\"汝城县\"},{\"n\":\"桂东县\"},{\"n\":\"安仁县\"},{\"n\":\"资兴市\"}]},{\"n\":\"永州市\",\"s\":[{\"n\":\"零陵区\"},{\"n\":\"冷水滩区\"},{\"n\":\"祁阳县\"},{\"n\":\"东安县\"},{\"n\":\"双牌县\"},{\"n\":\"道县\"},{\"n\":\"江永县\"},{\"n\":\"宁远县\"},{\"n\":\"蓝山县\"},{\"n\":\"新田县\"},{\"n\":\"江华瑶族自治县\"}]},{\"n\":\"怀化市\",\"s\":[{\"n\":\"鹤城区\"},{\"n\":\"中方县\"},{\"n\":\"沅陵县\"},{\"n\":\"辰溪县\"},{\"n\":\"溆浦县\"},{\"n\":\"会同县\"},{\"n\":\"麻阳苗族自治县\"},{\"n\":\"新晃侗族自治县\"},{\"n\":\"芷江侗族自治县\"},{\"n\":\"靖州苗族侗族自治县\"},{\"n\":\"通道侗族自治县\"},{\"n\":\"洪江市\"}]},{\"n\":\"娄底市\",\"s\":[{\"n\":\"娄星区\"},{\"n\":\"双峰县\"},{\"n\":\"新化县\"},{\"n\":\"冷水江市\"},{\"n\":\"涟源市\"}]},{\"n\":\"湘西土家族苗族自治州\",\"s\":[{\"n\":\"吉首市\"},{\"n\":\"泸溪县\"},{\"n\":\"凤凰县\"},{\"n\":\"花垣县\"},{\"n\":\"保靖县\"},{\"n\":\"古丈县\"},{\"n\":\"永顺县\"},{\"n\":\"龙山县\"}]}]},{\"n\":\"广东省\",\"s\":[{\"n\":\"广州市\",\"s\":[{\"n\":\"荔湾区\"},{\"n\":\"越秀区\"},{\"n\":\"海珠区\"},{\"n\":\"天河区\"},{\"n\":\"白云区\"},{\"n\":\"黄埔区\"},{\"n\":\"番禺区\"},{\"n\":\"花都区\"},{\"n\":\"南沙区\"},{\"n\":\"萝岗区\"},{\"n\":\"增城市\"},{\"n\":\"从化市\"}]},{\"n\":\"韶关市\",\"s\":[{\"n\":\"武江区\"},{\"n\":\"浈江区\"},{\"n\":\"曲江区\"},{\"n\":\"始兴县\"},{\"n\":\"仁化县\"},{\"n\":\"翁源县\"},{\"n\":\"乳源瑶族自治县\"},{\"n\":\"新丰县\"},{\"n\":\"乐昌市\"},{\"n\":\"南雄市\"}]},{\"n\":\"深圳市\",\"s\":[{\"n\":\"罗湖区\"},{\"n\":\"福田区\"},{\"n\":\"南山区\"},{\"n\":\"宝安区\"},{\"n\":\"龙岗区\"},{\"n\":\"盐田区\"}]},{\"n\":\"珠海市\",\"s\":[{\"n\":\"香洲区\"},{\"n\":\"斗门区\"},{\"n\":\"金湾区\"}]},{\"n\":\"汕头市\",\"s\":[{\"n\":\"龙湖区\"},{\"n\":\"金平区\"},{\"n\":\"濠江区\"},{\"n\":\"潮阳区\"},{\"n\":\"潮南区\"},{\"n\":\"澄海区\"},{\"n\":\"南澳县\"}]},{\"n\":\"佛山市\",\"s\":[{\"n\":\"禅城区\"},{\"n\":\"南海区\"},{\"n\":\"顺德区\"},{\"n\":\"三水区\"},{\"n\":\"高明区\"}]},{\"n\":\"江门市\",\"s\":[{\"n\":\"蓬江区\"},{\"n\":\"江海区\"},{\"n\":\"新会区\"},{\"n\":\"台山市\"},{\"n\":\"开平市\"},{\"n\":\"鹤山市\"},{\"n\":\"恩平市\"}]},{\"n\":\"湛江市\",\"s\":[{\"n\":\"赤坎区\"},{\"n\":\"霞山区\"},{\"n\":\"坡头区\"},{\"n\":\"麻章区\"},{\"n\":\"遂溪县\"},{\"n\":\"徐闻县\"},{\"n\":\"廉江市\"},{\"n\":\"雷州市\"},{\"n\":\"吴川市\"}]},{\"n\":\"茂名市\",\"s\":[{\"n\":\"茂南区\"},{\"n\":\"茂港区\"},{\"n\":\"电白县\"},{\"n\":\"高州市\"},{\"n\":\"化州市\"},{\"n\":\"信宜市\"}]},{\"n\":\"肇庆市\",\"s\":[{\"n\":\"端州区\"},{\"n\":\"鼎湖区\"},{\"n\":\"广宁县\"},{\"n\":\"怀集县\"},{\"n\":\"封开县\"},{\"n\":\"德庆县\"},{\"n\":\"高要市\"},{\"n\":\"四会市\"}]},{\"n\":\"惠州市\",\"s\":[{\"n\":\"惠城区\"},{\"n\":\"惠阳区\"},{\"n\":\"博罗县\"},{\"n\":\"惠东县\"},{\"n\":\"龙门县\"}]},{\"n\":\"梅州市\",\"s\":[{\"n\":\"梅江区\"},{\"n\":\"梅县\"},{\"n\":\"大埔县\"},{\"n\":\"丰顺县\"},{\"n\":\"五华县\"},{\"n\":\"平远县\"},{\"n\":\"蕉岭县\"},{\"n\":\"兴宁市\"}]},{\"n\":\"汕尾市\",\"s\":[{\"n\":\"城区\"},{\"n\":\"海丰县\"},{\"n\":\"陆河县\"},{\"n\":\"陆丰市\"}]},{\"n\":\"河源市\",\"s\":[{\"n\":\"源城区\"},{\"n\":\"紫金县\"},{\"n\":\"龙川县\"},{\"n\":\"连平县\"},{\"n\":\"和平县\"},{\"n\":\"东源县\"}]},{\"n\":\"阳江市\",\"s\":[{\"n\":\"江城区\"},{\"n\":\"阳西县\"},{\"n\":\"阳东县\"},{\"n\":\"阳春市\"}]},{\"n\":\"清远市\",\"s\":[{\"n\":\"清城区\"},{\"n\":\"清新区\"},{\"n\":\"佛冈县\"},{\"n\":\"阳山县\"},{\"n\":\"连山壮族瑶族自治县\"},{\"n\":\"连南瑶族自治县\"},{\"n\":\"英德市\"},{\"n\":\"连州市\"}]},{\"n\":\"东莞市\"},{\"n\":\"中山市\"},{\"n\":\"潮州市\",\"s\":[{\"n\":\"湘桥区\"},{\"n\":\"潮安区\"},{\"n\":\"饶平县\"}]},{\"n\":\"揭阳市\",\"s\":[{\"n\":\"榕城区\"},{\"n\":\"揭东区\"},{\"n\":\"揭西县\"},{\"n\":\"惠来县\"},{\"n\":\"普宁市\"}]},{\"n\":\"云浮市\",\"s\":[{\"n\":\"云城区\"},{\"n\":\"新兴县\"},{\"n\":\"郁南县\"},{\"n\":\"云安县\"},{\"n\":\"罗定市\"}]}]}]"; - return data; - } - - /** - * 获取用户数据 - */ - @GetMapping("/userModel") - @ResponseBody - public AjaxResult userModel() - { - AjaxResult ajax = new AjaxResult(); - - ajax.put("code", 200); - ajax.put("value", users); - return ajax; - } - - /** - * 获取数据集合 - */ - @GetMapping("/collection") - @ResponseBody - public AjaxResult collection() - { - String[] array = { "ruoyi 1", "ruoyi 2", "ruoyi 3", "ruoyi 4", "ruoyi 5" }; - AjaxResult ajax = new AjaxResult(); - ajax.put("value", array); - return ajax; - } -} - -class UserFormModel -{ - /** 用户ID */ - private int userId; - - /** 用户编号 */ - private String userCode; - - /** 用户姓名 */ - private String userName; - - /** 用户手机 */ - private String userPhone; - - public UserFormModel() - { - - } - - public UserFormModel(int userId, String userCode, String userName, String userPhone) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userPhone = userPhone; - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java deleted file mode 100644 index 490c3e061..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoIconController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 图标相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/icon") -public class DemoIconController -{ - private String prefix = "demo/icon"; - - /** - * FontAwesome图标 - */ - @GetMapping("/fontawesome") - public String fontAwesome() - { - return prefix + "/fontawesome"; - } - - /** - * Glyphicons图标 - */ - @GetMapping("/glyphicons") - public String glyphicons() - { - return prefix + "/glyphicons"; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java deleted file mode 100644 index 95412d84f..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoOperateController.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.web.controller.demo.domain.CustomerModel; -import com.ruoyi.web.controller.demo.domain.UserOperateModel; - -/** - * 操作控制 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/operate") -public class DemoOperateController extends BaseController -{ - private String prefix = "demo/operate"; - - private final static Map users = new LinkedHashMap(); - { - users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); - users.put(2, new UserOperateModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); - users.put(3, new UserOperateModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); - users.put(4, new UserOperateModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.put(5, new UserOperateModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); - users.put(6, new UserOperateModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); - users.put(7, new UserOperateModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); - users.put(8, new UserOperateModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); - users.put(9, new UserOperateModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); - users.put(10, new UserOperateModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); - users.put(11, new UserOperateModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); - users.put(12, new UserOperateModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); - users.put(13, new UserOperateModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); - users.put(14, new UserOperateModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); - users.put(15, new UserOperateModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); - users.put(16, new UserOperateModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); - users.put(17, new UserOperateModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); - users.put(18, new UserOperateModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); - users.put(19, new UserOperateModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); - users.put(20, new UserOperateModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.put(21, new UserOperateModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); - users.put(22, new UserOperateModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); - users.put(23, new UserOperateModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); - users.put(24, new UserOperateModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); - users.put(25, new UserOperateModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); - users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); - } - - /** - * 表格 - */ - @GetMapping("/table") - public String table() - { - return prefix + "/table"; - } - - /** - * 其他 - */ - @GetMapping("/other") - public String other() - { - return prefix + "/other"; - } - - /** - * 查询数据 - */ - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(UserOperateModel userModel) - { - TableDataInfo rspData = new TableDataInfo(); - List userList = new ArrayList(users.values()); - // 查询条件过滤 - if (StringUtils.isNotEmpty(userModel.getSearchValue())) - { - userList.clear(); - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(userModel.getSearchValue())) - { - userList.add(entry.getValue()); - } - } - } - else if (StringUtils.isNotEmpty(userModel.getUserName())) - { - userList.clear(); - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(userModel.getUserName())) - { - userList.add(entry.getValue()); - } - } - } - PageDomain pageDomain = TableSupport.buildPageRequest(); - if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) - { - rspData.setRows(userList); - rspData.setTotal(userList.size()); - return rspData; - } - Integer pageNum = (pageDomain.getPageNum() - 1) * 10; - Integer pageSize = pageDomain.getPageNum() * 10; - if (pageSize > userList.size()) - { - pageSize = userList.size(); - } - rspData.setRows(userList.subList(pageNum, pageSize)); - rspData.setTotal(userList.size()); - return rspData; - } - - /** - * 新增用户 - */ - @GetMapping("/add") - public String add(ModelMap mmap) - { - return prefix + "/add"; - } - - /** - * 新增保存用户 - */ - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(UserOperateModel user) - { - Integer userId = users.size() + 1; - user.setUserId(userId); - return AjaxResult.success(users.put(userId, user)); - } - - /** - * 新增保存主子表信息 - */ - @PostMapping("/customer/add") - @ResponseBody - public AjaxResult addSave(CustomerModel customerModel) - { - System.out.println(customerModel.toString()); - return AjaxResult.success(); - } - - /** - * 修改用户 - */ - @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) - { - mmap.put("user", users.get(userId)); - return prefix + "/edit"; - } - - /** - * 修改保存用户 - */ - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(UserOperateModel user) - { - return AjaxResult.success(users.put(user.getUserId(), user)); - } - - /** - * 导出 - */ - @PostMapping("/export") - @ResponseBody - public AjaxResult export(UserOperateModel user) - { - List list = new ArrayList(users.values()); - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - return util.exportExcel(list, "用户数据"); - } - - /** - * 下载模板 - */ - @GetMapping("/importTemplate") - @ResponseBody - public AjaxResult importTemplate() - { - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - return util.importTemplateExcel("用户数据"); - } - - /** - * 导入数据 - */ - @PostMapping("/importData") - @ResponseBody - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { - ExcelUtil util = new ExcelUtil(UserOperateModel.class); - List userList = util.importExcel(file.getInputStream()); - String message = importUser(userList, updateSupport); - return AjaxResult.success(message); - } - - /** - * 删除用户 - */ - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - Integer[] userIds = Convert.toIntArray(ids); - for (Integer userId : userIds) - { - users.remove(userId); - } - return AjaxResult.success(); - } - - /** - * 查看详细 - */ - @GetMapping("/detail/{userId}") - public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) - { - mmap.put("user", users.get(userId)); - return prefix + "/detail"; - } - - @PostMapping("/clean") - @ResponseBody - public AjaxResult clean() - { - users.clear(); - return success(); - } - - /** - * 导入用户数据 - * - * @param userList 用户数据列表 - * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据 - * @return 结果 - */ - public String importUser(List userList, Boolean isUpdateSupport) - { - if (StringUtils.isNull(userList) || userList.size() == 0) - { - throw new ServiceException("导入用户数据不能为空!"); - } - int successNum = 0; - int failureNum = 0; - StringBuilder successMsg = new StringBuilder(); - StringBuilder failureMsg = new StringBuilder(); - for (UserOperateModel user : userList) - { - try - { - // 验证是否存在这个用户 - boolean userFlag = false; - for (Map.Entry entry : users.entrySet()) - { - if (entry.getValue().getUserName().equals(user.getUserName())) - { - userFlag = true; - break; - } - } - if (!userFlag) - { - Integer userId = users.size() + 1; - user.setUserId(userId); - users.put(userId, user); - successNum++; - successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 导入成功"); - } - else if (isUpdateSupport) - { - users.put(user.getUserId(), user); - successNum++; - successMsg.append("
" + successNum + "、用户 " + user.getUserName() + " 更新成功"); - } - else - { - failureNum++; - failureMsg.append("
" + failureNum + "、用户 " + user.getUserName() + " 已存在"); - } - } - catch (Exception e) - { - failureNum++; - String msg = "
" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; - failureMsg.append(msg + e.getMessage()); - } - } - if (failureNum > 0) - { - failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); - throw new ServiceException(failureMsg.toString()); - } - else - { - successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); - } - return successMsg.toString(); - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java deleted file mode 100644 index 318e8f08b..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoReportController.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -/** - * 报表 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/report") -public class DemoReportController -{ - private String prefix = "demo/report"; - - /** - * 百度ECharts - */ - @GetMapping("/echarts") - public String echarts() - { - return prefix + "/echarts"; - } - - /** - * 图表插件 - */ - @GetMapping("/peity") - public String peity() - { - return prefix + "/peity"; - } - - /** - * 线状图插件 - */ - @GetMapping("/sparkline") - public String sparkline() - { - return prefix + "/sparkline"; - } - - /** - * 图表组合 - */ - @GetMapping("/metrics") - public String metrics() - { - return prefix + "/metrics"; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java deleted file mode 100644 index ed1ab0308..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/controller/DemoTableController.java +++ /dev/null @@ -1,846 +0,0 @@ -package com.ruoyi.web.controller.demo.controller; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.PageDomain; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.page.TableSupport; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.poi.ExcelUtil; - -/** - * 表格相关 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/demo/table") -public class DemoTableController extends BaseController -{ - private String prefix = "demo/table"; - - private final static List users = new ArrayList(); - { - users.add(new UserTableModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); - users.add(new UserTableModel(2, "1000002", "测试2", "1", "15666666666", "ry@qq.com", 180.0, "1")); - users.add(new UserTableModel(3, "1000003", "测试3", "0", "15666666666", "ry@qq.com", 110.0, "1")); - users.add(new UserTableModel(4, "1000004", "测试4", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.add(new UserTableModel(5, "1000005", "测试5", "0", "15666666666", "ry@qq.com", 140.0, "1")); - users.add(new UserTableModel(6, "1000006", "测试6", "1", "15666666666", "ry@qq.com", 330.0, "1")); - users.add(new UserTableModel(7, "1000007", "测试7", "0", "15666666666", "ry@qq.com", 160.0, "1")); - users.add(new UserTableModel(8, "1000008", "测试8", "1", "15666666666", "ry@qq.com", 170.0, "1")); - users.add(new UserTableModel(9, "1000009", "测试9", "0", "15666666666", "ry@qq.com", 180.0, "1")); - users.add(new UserTableModel(10, "1000010", "测试10", "0", "15666666666", "ry@qq.com", 210.0, "1")); - users.add(new UserTableModel(11, "1000011", "测试11", "1", "15666666666", "ry@qq.com", 110.0, "1")); - users.add(new UserTableModel(12, "1000012", "测试12", "0", "15666666666", "ry@qq.com", 120.0, "1")); - users.add(new UserTableModel(13, "1000013", "测试13", "1", "15666666666", "ry@qq.com", 380.0, "1")); - users.add(new UserTableModel(14, "1000014", "测试14", "0", "15666666666", "ry@qq.com", 280.0, "1")); - users.add(new UserTableModel(15, "1000015", "测试15", "0", "15666666666", "ry@qq.com", 570.0, "1")); - users.add(new UserTableModel(16, "1000016", "测试16", "1", "15666666666", "ry@qq.com", 260.0, "1")); - users.add(new UserTableModel(17, "1000017", "测试17", "1", "15666666666", "ry@qq.com", 210.0, "1")); - users.add(new UserTableModel(18, "1000018", "测试18", "1", "15666666666", "ry@qq.com", 340.0, "1")); - users.add(new UserTableModel(19, "1000019", "测试19", "1", "15666666666", "ry@qq.com", 160.0, "1")); - users.add(new UserTableModel(20, "1000020", "测试20", "1", "15666666666", "ry@qq.com", 220.0, "1")); - users.add(new UserTableModel(21, "1000021", "测试21", "1", "15666666666", "ry@qq.com", 120.0, "1")); - users.add(new UserTableModel(22, "1000022", "测试22", "1", "15666666666", "ry@qq.com", 130.0, "1")); - users.add(new UserTableModel(23, "1000023", "测试23", "1", "15666666666", "ry@qq.com", 490.0, "1")); - users.add(new UserTableModel(24, "1000024", "测试24", "1", "15666666666", "ry@qq.com", 570.0, "1")); - users.add(new UserTableModel(25, "1000025", "测试25", "1", "15666666666", "ry@qq.com", 250.0, "1")); - users.add(new UserTableModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1")); - } - - private final static List areas = new ArrayList(); - { - areas.add(new AreaModel(1, 0, "广东省", "440000", "GDS", "GuangDongSheng", 1)); - areas.add(new AreaModel(2, 0, "湖南省", "430000", "HNS", "HuNanSheng", 1)); - areas.add(new AreaModel(3, 0, "河南省", "410000", "HNS", "HeNanSheng", 0)); - areas.add(new AreaModel(4, 0, "湖北省", "420000", "HBS", "HuBeiSheng", 0)); - areas.add(new AreaModel(5, 0, "辽宁省", "210000", "LNS", "LiaoNingSheng", 0)); - areas.add(new AreaModel(6, 0, "山东省", "370000", "SDS", "ShanDongSheng", 0)); - areas.add(new AreaModel(7, 0, "陕西省", "610000", "SXS", "ShanXiSheng", 0)); - areas.add(new AreaModel(8, 0, "贵州省", "520000", "GZS", "GuiZhouSheng", 0)); - areas.add(new AreaModel(9, 0, "上海市", "310000", "SHS", "ShangHaiShi", 0)); - areas.add(new AreaModel(10, 0, "重庆市", "500000", "CQS", "ChongQingShi", 0)); - areas.add(new AreaModel(11, 0, "若依省", "666666", "YYS", "RuoYiSheng", 0)); - areas.add(new AreaModel(12, 0, "安徽省", "340000", "AHS", "AnHuiSheng", 0)); - areas.add(new AreaModel(13, 0, "福建省", "350000", "FJS", "FuJianSheng", 0)); - areas.add(new AreaModel(14, 0, "海南省", "460000", "HNS", "HaiNanSheng", 0)); - areas.add(new AreaModel(15, 0, "江苏省", "320000", "JSS", "JiangSuSheng", 0)); - areas.add(new AreaModel(16, 0, "青海省", "630000", "QHS", "QingHaiSheng", 0)); - areas.add(new AreaModel(17, 0, "广西壮族自治区", "450000", "GXZZZZQ", "GuangXiZhuangZuZiZhiQu", 0)); - areas.add(new AreaModel(18, 0, "宁夏回族自治区", "640000", "NXHZZZQ", "NingXiaHuiZuZiZhiQu", 0)); - areas.add(new AreaModel(19, 0, "内蒙古自治区", "150000", "NMGZZQ", "NeiMengGuZiZhiQu", 0)); - areas.add(new AreaModel(20, 0, "新疆维吾尔自治区", "650000", "XJWWEZZQ", "XinJiangWeiWuErZiZhiQu", 0)); - areas.add(new AreaModel(21, 0, "江西省", "360000", "JXS", "JiangXiSheng", 0)); - areas.add(new AreaModel(22, 0, "浙江省", "330000", "ZJS", "ZheJiangSheng", 0)); - areas.add(new AreaModel(23, 0, "河北省", "130000", "HBS", "HeBeiSheng", 0)); - areas.add(new AreaModel(24, 0, "天津市", "120000", "TJS", "TianJinShi", 0)); - areas.add(new AreaModel(25, 0, "山西省", "140000", "SXS", "ShanXiSheng", 0)); - areas.add(new AreaModel(26, 0, "台湾省", "710000", "TWS", "TaiWanSheng", 0)); - areas.add(new AreaModel(27, 0, "甘肃省", "620000", "GSS", "GanSuSheng", 0)); - areas.add(new AreaModel(28, 0, "四川省", "510000", "SCS", "SiChuanSheng", 0)); - areas.add(new AreaModel(29, 0, "云南省", "530000", "YNS", "YunNanSheng", 0)); - areas.add(new AreaModel(30, 0, "北京市", "110000", "BJS", "BeiJingShi", 0)); - areas.add(new AreaModel(31, 0, "香港特别行政区", "810000", "XGTBXZQ", "XiangGangTeBieXingZhengQu", 0)); - areas.add(new AreaModel(32, 0, "澳门特别行政区", "820000", "AMTBXZQ", "AoMenTeBieXingZhengQu", 0)); - - areas.add(new AreaModel(100, 1, "深圳市", "440300", "SZS", "ShenZhenShi", 1)); - areas.add(new AreaModel(101, 1, "广州市", "440100", "GZS", "GuangZhouShi", 0)); - areas.add(new AreaModel(102, 1, "东莞市", "441900", "DGS", "DongGuanShi", 0)); - areas.add(new AreaModel(103, 2, "长沙市", "410005", "CSS", "ChangShaShi", 1)); - areas.add(new AreaModel(104, 2, "岳阳市", "414000", "YYS", "YueYangShi", 0)); - - areas.add(new AreaModel(1000, 100, "龙岗区", "518172", "LGQ", "LongGangQu", 0)); - areas.add(new AreaModel(1001, 100, "南山区", "518051", "NSQ", "NanShanQu", 0)); - areas.add(new AreaModel(1002, 100, "宝安区", "518101", "BAQ", "BaoAnQu", 0)); - areas.add(new AreaModel(1003, 100, "福田区", "518081", "FTQ", "FuTianQu", 0)); - areas.add(new AreaModel(1004, 103, "天心区", "410004", "TXQ", "TianXinQu", 0)); - areas.add(new AreaModel(1005, 103, "开福区", "410008", "KFQ", "KaiFuQu", 0)); - areas.add(new AreaModel(1006, 103, "芙蓉区", "410011", "FRQ", "FuRongQu", 0)); - areas.add(new AreaModel(1007, 103, "雨花区", "410011", "YHQ", "YuHuaQu", 0)); - } - - private final static List columns = new ArrayList(); - { - columns.add(new UserTableColumn("用户ID", "userId")); - columns.add(new UserTableColumn("用户编号", "userCode")); - columns.add(new UserTableColumn("用户姓名", "userName")); - columns.add(new UserTableColumn("用户手机", "userPhone")); - columns.add(new UserTableColumn("用户邮箱", "userEmail")); - columns.add(new UserTableColumn("用户状态", "status")); - } - - /** - * 搜索相关 - */ - @GetMapping("/search") - public String search() - { - return prefix + "/search"; - } - - /** - * 数据汇总 - */ - @GetMapping("/footer") - public String footer() - { - return prefix + "/footer"; - } - - /** - * 组合表头 - */ - @GetMapping("/groupHeader") - public String groupHeader() - { - return prefix + "/groupHeader"; - } - - /** - * 表格导出 - */ - @GetMapping("/export") - public String export() - { - return prefix + "/export"; - } - - /** - * 表格导出选择列 - */ - @GetMapping("/exportSelected") - public String exportSelected() - { - return prefix + "/exportSelected"; - } - - /** - * 导出数据 - */ - @PostMapping("/exportData") - @ResponseBody - public AjaxResult exportSelected(UserTableModel userModel, String userIds) - { - List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()])); - Collections.copy(userList, users); - - // 条件过滤 - if (StringUtils.isNotEmpty(userIds)) - { - userList.clear(); - for (Long userId : Convert.toLongArray(userIds)) - { - for (UserTableModel user : users) - { - if (user.getUserId() == userId) - { - userList.add(user); - } - } - } - } - ExcelUtil util = new ExcelUtil(UserTableModel.class); - return util.exportExcel(userList, "用户数据"); - } - - /** - * 翻页记住选择 - */ - @GetMapping("/remember") - public String remember() - { - return prefix + "/remember"; - } - - /** - * 跳转至指定页 - */ - @GetMapping("/pageGo") - public String pageGo() - { - return prefix + "/pageGo"; - } - - /** - * 自定义查询参数 - */ - @GetMapping("/params") - public String params() - { - return prefix + "/params"; - } - - /** - * 多表格 - */ - @GetMapping("/multi") - public String multi() - { - return prefix + "/multi"; - } - - /** - * 点击按钮加载表格 - */ - @GetMapping("/button") - public String button() - { - return prefix + "/button"; - } - - /** - * 直接加载表格数据 - */ - @GetMapping("/data") - public String data(ModelMap mmap) - { - mmap.put("users", users); - return prefix + "/data"; - } - - /** - * 表格冻结列 - */ - @GetMapping("/fixedColumns") - public String fixedColumns() - { - return prefix + "/fixedColumns"; - } - - /** - * 自定义触发事件 - */ - @GetMapping("/event") - public String event() - { - return prefix + "/event"; - } - - /** - * 表格细节视图 - */ - @GetMapping("/detail") - public String detail() - { - return prefix + "/detail"; - } - - /** - * 表格父子视图 - */ - @GetMapping("/child") - public String child() - { - return prefix + "/child"; - } - - /** - * 表格图片预览 - */ - @GetMapping("/image") - public String image() - { - return prefix + "/image"; - } - - /** - * 动态增删改查 - */ - @GetMapping("/curd") - public String curd() - { - return prefix + "/curd"; - } - - /** - * 表格行拖拽操作 - */ - @GetMapping("/reorderRows") - public String reorderRows() - { - return prefix + "/reorderRows"; - } - - /** - * 表格列拖拽操作 - */ - @GetMapping("/reorderColumns") - public String reorderColumns() - { - return prefix + "/reorderColumns"; - } - - /** - * 表格列宽拖动 - */ - @GetMapping("/resizable") - public String resizable() - { - return prefix + "/resizable"; - } - - /** - * 表格行内编辑操作 - */ - @GetMapping("/editable") - public String editable() - { - return prefix + "/editable"; - } - - /** - * 主子表提交 - */ - @GetMapping("/subdata") - public String subdata() - { - return prefix + "/subdata"; - } - - /** - * 表格自动刷新 - */ - @GetMapping("/refresh") - public String refresh() - { - return prefix + "/refresh"; - } - - /** - * 表格打印配置 - */ - @GetMapping("/print") - public String print() - { - return prefix + "/print"; - } - - /** - * 表格标题格式化 - */ - @GetMapping("/headerStyle") - public String headerStyle() - { - return prefix + "/headerStyle"; - } - - /** - * 表格动态列 - */ - @GetMapping("/dynamicColumns") - public String dynamicColumns() - { - return prefix + "/dynamicColumns"; - } - - /** - * 自定义视图分页 - */ - @GetMapping("/customView") - public String customView() - { - return prefix + "/customView"; - } - - /** - * 异步加载表格树 - */ - @GetMapping("/asynTree") - public String asynTree() - { - return prefix + "/asynTree"; - } - - /** - * 表格其他操作 - */ - @GetMapping("/other") - public String other() - { - return prefix + "/other"; - } - - /** - * 动态获取列 - */ - @PostMapping("/ajaxColumns") - @ResponseBody - public AjaxResult ajaxColumns(UserTableColumn userColumn) - { - List columnList = new ArrayList(Arrays.asList(new UserTableColumn[columns.size()])); - Collections.copy(columnList, columns); - if (userColumn != null && "userBalance".equals(userColumn.getField())) - { - columnList.add(new UserTableColumn("用户余额", "userBalance")); - } - return AjaxResult.success(columnList); - } - - /** - * 查询数据 - */ - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(UserTableModel userModel) - { - TableDataInfo rspData = new TableDataInfo(); - List userList = new ArrayList(Arrays.asList(new UserTableModel[users.size()])); - Collections.copy(userList, users); - // 查询条件过滤 - if (StringUtils.isNotEmpty(userModel.getUserName())) - { - userList.clear(); - for (UserTableModel user : users) - { - if (user.getUserName().equals(userModel.getUserName())) - { - userList.add(user); - } - } - } - PageDomain pageDomain = TableSupport.buildPageRequest(); - if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) - { - rspData.setRows(userList); - rspData.setTotal(userList.size()); - return rspData; - } - Integer pageNum = (pageDomain.getPageNum() - 1) * 10; - Integer pageSize = pageDomain.getPageNum() * 10; - if (pageSize > userList.size()) - { - pageSize = userList.size(); - } - rspData.setRows(userList.subList(pageNum, pageSize)); - rspData.setTotal(userList.size()); - return rspData; - } - - /** - * 查询树表数据 - */ - @PostMapping("/tree/list") - @ResponseBody - public TableDataInfo treeList(AreaModel areaModel) - { - TableDataInfo rspData = new TableDataInfo(); - List areaList = new ArrayList(Arrays.asList(new AreaModel[areas.size()])); - // 默认查询条件 parentId 0 - Collections.copy(areaList, areas); - areaList.clear(); - if (StringUtils.isNotEmpty(areaModel.getAreaName())) - { - for (AreaModel area : areas) - { - if (area.getParentId() == 0 && area.getAreaName().equals(areaModel.getAreaName())) - { - areaList.add(area); - } - } - } - else - { - for (AreaModel area : areas) - { - if (area.getParentId() == 0) - { - areaList.add(area); - } - } - } - PageDomain pageDomain = TableSupport.buildPageRequest(); - Integer pageNum = (pageDomain.getPageNum() - 1) * pageDomain.getPageSize(); - Integer pageSize = pageDomain.getPageNum() * pageDomain.getPageSize(); - if (pageSize > areaList.size()) - { - pageSize = areaList.size(); - } - rspData.setRows(areaList.subList(pageNum, pageSize)); - rspData.setTotal(areaList.size()); - return rspData; - } - - /** - * 查询树表子节点数据 - */ - @PostMapping("/tree/listChild") - @ResponseBody - public List listChild(AreaModel areaModel) - { - List areaList = new ArrayList(Arrays.asList(new AreaModel[areas.size()])); - // 查询条件 parentId - Collections.copy(areaList, areas); - areaList.clear(); - if (StringUtils.isNotEmpty(areaModel.getAreaName())) - { - for (AreaModel area : areas) - { - if (area.getParentId().intValue() == areaModel.getParentId().intValue() && area.getAreaName().equals(areaModel.getAreaName())) - { - areaList.add(area); - } - } - } - else - { - for (AreaModel area : areas) - { - if (area.getParentId().intValue() == areaModel.getParentId().intValue()) - { - areaList.add(area); - } - } - } - return areaList; - } -} - -class UserTableColumn -{ - /** 表头 */ - private String title; - /** 字段 */ - private String field; - - public UserTableColumn() - { - - } - - public UserTableColumn(String title, String field) - { - this.title = title; - this.field = field; - } - - public String getTitle() - { - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public String getField() - { - return field; - } - - public void setField(String field) - { - this.field = field; - } -} - -class UserTableModel -{ - /** 用户ID */ - private int userId; - - /** 用户编号 */ - @Excel(name = "用户编号", cellType = ColumnType.NUMERIC) - private String userCode; - - /** 用户姓名 */ - @Excel(name = "用户姓名") - private String userName; - - /** 用户性别 */ - private String userSex; - - /** 用户手机 */ - @Excel(name = "用户手机") - private String userPhone; - - /** 用户邮箱 */ - @Excel(name = "用户邮箱") - private String userEmail; - - /** 用户余额 */ - @Excel(name = "用户余额", cellType = ColumnType.NUMERIC) - private double userBalance; - - /** 用户状态(0正常 1停用) */ - private String status; - - /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - public UserTableModel() - { - - } - - public UserTableModel(int userId, String userCode, String userName, String userSex, String userPhone, - String userEmail, double userBalance, String status) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userSex = userSex; - this.userPhone = userPhone; - this.userEmail = userEmail; - this.userBalance = userBalance; - this.status = status; - this.createTime = DateUtils.getNowDate(); - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserSex() - { - return userSex; - } - - public void setUserSex(String userSex) - { - this.userSex = userSex; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - - public String getUserEmail() - { - return userEmail; - } - - public void setUserEmail(String userEmail) - { - this.userEmail = userEmail; - } - - public double getUserBalance() - { - return userBalance; - } - - public void setUserBalance(double userBalance) - { - this.userBalance = userBalance; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - public Date getCreateTime() - { - return createTime; - } - - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } -} -class AreaModel -{ - /** 编号 */ - private Long id; - - /** 父编号 */ - private Long parentId; - - /** 区域名称 */ - private String areaName; - - /** 区域代码 */ - private String areaCode; - - /** 名称首字母 */ - private String simplePy; - - /** 名称全拼 */ - private String pinYin; - - /** 是否有子节点(0无 1有) */ - private Integer isTreeLeaf = 1; - - public AreaModel() - { - - } - - public AreaModel(int id, int parentId, String areaName, String areaCode, String simplePy, String pinYin, Integer isTreeLeaf) - { - this.id = Long.valueOf(id); - this.parentId = Long.valueOf(parentId); - this.areaName = areaName; - this.areaCode = areaCode; - this.simplePy = simplePy; - this.pinYin = pinYin; - this.isTreeLeaf = isTreeLeaf; - } - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public String getAreaName() - { - return areaName; - } - - public void setAreaName(String areaName) - { - this.areaName = areaName; - } - - public String getAreaCode() - { - return areaCode; - } - - public void setAreaCode(String areaCode) - { - this.areaCode = areaCode; - } - - public String getSimplePy() - { - return simplePy; - } - - public void setSimplePy(String simplePy) - { - this.simplePy = simplePy; - } - - public String getPinYin() - { - return pinYin; - } - - public void setPinYin(String pinYin) - { - this.pinYin = pinYin; - } - - public Integer getIsTreeLeaf() - { - return isTreeLeaf; - } - - public void setIsTreeLeaf(Integer isTreeLeaf) - { - this.isTreeLeaf = isTreeLeaf; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java deleted file mode 100644 index d1aebf2ba..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/CustomerModel.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.ruoyi.web.controller.demo.domain; - -import java.util.List; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 客户测试信息 - * - * @author ruoyi - */ -public class CustomerModel -{ - /** - * 客户姓名 - */ - private String name; - - /** - * 客户手机 - */ - private String phonenumber; - - /** - * 客户性别 - */ - private String sex; - - /** - * 客户生日 - */ - private String birthday; - - /** - * 客户描述 - */ - private String remark; - - /** - * 商品信息 - */ - private List goods; - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getPhonenumber() - { - return phonenumber; - } - - public void setPhonenumber(String phonenumber) - { - this.phonenumber = phonenumber; - } - - - public String getSex() - { - return sex; - } - - public void setSex(String sex) - { - this.sex = sex; - } - - public String getBirthday() - { - return birthday; - } - - public void setBirthday(String birthday) - { - this.birthday = birthday; - } - - public String getRemark() - { - return remark; - } - - public void setRemark(String remark) - { - this.remark = remark; - } - - public List getGoods() - { - return goods; - } - - public void setGoods(List goods) - { - this.goods = goods; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("name", getName()) - .append("phonenumber", getPhonenumber()) - .append("sex", getSex()) - .append("birthday", getBirthday()) - .append("goods", getGoods()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java deleted file mode 100644 index 897a010e6..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/GoodsModel.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ruoyi.web.controller.demo.domain; - -import java.util.Date; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -/** - * 商品测试信息 - * - * @author ruoyi - */ -public class GoodsModel -{ - /** - * 商品名称 - */ - private String name; - - /** - * 商品重量 - */ - private Integer weight; - - /** - * 商品价格 - */ - private Double price; - - /** - * 商品日期 - */ - private Date date; - - /** - * 商品种类 - */ - private String type; - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public Integer getWeight() - { - return weight; - } - - public void setWeight(Integer weight) - { - this.weight = weight; - } - - public Double getPrice() - { - return price; - } - - public void setPrice(Double price) - { - this.price = price; - } - - public Date getDate() - { - return date; - } - - public void setDate(Date date) - { - this.date = date; - } - - public String getType() - { - return type; - } - - public void setType(String type) - { - this.type = type; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("name", getName()) - .append("weight", getWeight()) - .append("price", getPrice()) - .append("date", getDate()) - .append("type", getType()) - .toString(); - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java deleted file mode 100644 index 3324cc7ca..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/demo/domain/UserOperateModel.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.ruoyi.web.controller.demo.domain; - -import java.util.Date; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.utils.DateUtils; - -public class UserOperateModel extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - private int userId; - - @Excel(name = "用户编号") - private String userCode; - - @Excel(name = "用户姓名") - private String userName; - - @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") - private String userSex; - - @Excel(name = "用户手机") - private String userPhone; - - @Excel(name = "用户邮箱") - private String userEmail; - - @Excel(name = "用户余额") - private double userBalance; - - @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用") - private String status; - - @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) - private Date createTime; - - public UserOperateModel() - { - - } - - public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone, - String userEmail, double userBalance, String status) - { - this.userId = userId; - this.userCode = userCode; - this.userName = userName; - this.userSex = userSex; - this.userPhone = userPhone; - this.userEmail = userEmail; - this.userBalance = userBalance; - this.status = status; - this.createTime = DateUtils.getNowDate(); - } - - public int getUserId() - { - return userId; - } - - public void setUserId(int userId) - { - this.userId = userId; - } - - public String getUserCode() - { - return userCode; - } - - public void setUserCode(String userCode) - { - this.userCode = userCode; - } - - public String getUserName() - { - return userName; - } - - public void setUserName(String userName) - { - this.userName = userName; - } - - public String getUserSex() - { - return userSex; - } - - public void setUserSex(String userSex) - { - this.userSex = userSex; - } - - public String getUserPhone() - { - return userPhone; - } - - public void setUserPhone(String userPhone) - { - this.userPhone = userPhone; - } - - public String getUserEmail() - { - return userEmail; - } - - public void setUserEmail(String userEmail) - { - this.userEmail = userEmail; - } - - public double getUserBalance() - { - return userBalance; - } - - public void setUserBalance(double userBalance) - { - this.userBalance = userBalance; - } - - public String getStatus() - { - return status; - } - - public void setStatus(String status) - { - this.status = status; - } - - @Override - public Date getCreateTime() - { - return createTime; - } - - @Override - public void setCreateTime(Date createTime) - { - this.createTime = createTime; - } -} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index 995ce8af2..41029fd91 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -1,90 +1,120 @@ package com.ruoyi.web.controller.monitor; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.core.controller.BaseController; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.framework.web.service.CacheService; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysCache; /** * 缓存监控 * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/monitor/cache") -public class CacheController extends BaseController +public class CacheController { - private String prefix = "monitor/cache"; - @Autowired - private CacheService cacheService; + private RedisTemplate redisTemplate; - @RequiresPermissions("monitor:cache:view") + private final static List caches = new ArrayList(); + { + caches.add(new SysCache(CacheConstants.LOGIN_TOKEN_KEY, "用户信息")); + caches.add(new SysCache(CacheConstants.SYS_CONFIG_KEY, "配置信息")); + caches.add(new SysCache(CacheConstants.SYS_DICT_KEY, "数据字典")); + caches.add(new SysCache(CacheConstants.CAPTCHA_CODE_KEY, "验证码")); + caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交")); + caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); + caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数")); + } + + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") @GetMapping() - public String cache(ModelMap mmap) + public AjaxResult getInfo() throws Exception { - mmap.put("cacheNames", cacheService.getCacheNames()); - return prefix + "/cache"; + Properties info = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info()); + Properties commandStats = (Properties) redisTemplate.execute((RedisCallback) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback) connection -> connection.dbSize()); + + Map result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + + List> pieList = new ArrayList<>(); + commandStats.stringPropertyNames().forEach(key -> { + Map data = new HashMap<>(2); + String property = commandStats.getProperty(key); + data.put("name", StringUtils.removeStart(key, "cmdstat_")); + data.put("value", StringUtils.substringBetween(property, "calls=", ",usec")); + pieList.add(data); + }); + result.put("commandStats", pieList); + return AjaxResult.success(result); } - @RequiresPermissions("monitor:cache:view") - @PostMapping("/getNames") - public String getCacheNames(String fragment, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getNames") + public AjaxResult cache() { - mmap.put("cacheNames", cacheService.getCacheNames()); - return prefix + "/cache::" + fragment; + return AjaxResult.success(caches); } - @RequiresPermissions("monitor:cache:view") - @PostMapping("/getKeys") - public String getCacheKeys(String fragment, String cacheName, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getKeys/{cacheName}") + public AjaxResult getCacheKeys(@PathVariable String cacheName) { - mmap.put("cacheName", cacheName); - mmap.put("cacheKeys", cacheService.getCacheKeys(cacheName)); - return prefix + "/cache::" + fragment; + Set cacheKeys = redisTemplate.keys(cacheName + "*"); + return AjaxResult.success(cacheKeys); } - @RequiresPermissions("monitor:cache:view") - @PostMapping("/getValue") - public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @GetMapping("/getValue/{cacheName}/{cacheKey}") + public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { - mmap.put("cacheName", cacheName); - mmap.put("cacheKey", cacheKey); - mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey)); - return prefix + "/cache::" + fragment; + String cacheValue = redisTemplate.opsForValue().get(cacheKey); + SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue); + return AjaxResult.success(sysCache); } - @RequiresPermissions("monitor:cache:view") - @PostMapping("/clearCacheName") - @ResponseBody - public AjaxResult clearCacheName(String cacheName, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheName/{cacheName}") + public AjaxResult clearCacheName(@PathVariable String cacheName) { - cacheService.clearCacheName(cacheName); + Collection cacheKeys = redisTemplate.keys(cacheName + "*"); + redisTemplate.delete(cacheKeys); return AjaxResult.success(); } - @RequiresPermissions("monitor:cache:view") - @PostMapping("/clearCacheKey") - @ResponseBody - public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheKey/{cacheKey}") + public AjaxResult clearCacheKey(@PathVariable String cacheKey) { - cacheService.clearCacheKey(cacheName, cacheKey); + redisTemplate.delete(cacheKey); return AjaxResult.success(); } - @RequiresPermissions("monitor:cache:view") - @GetMapping("/clearAll") - @ResponseBody - public AjaxResult clearAll(ModelMap mmap) + @PreAuthorize("@ss.hasPermi('monitor:cache:list')") + @DeleteMapping("/clearCacheAll") + public AjaxResult clearCacheAll() { - cacheService.clearAll(); + Collection cacheKeys = redisTemplate.keys("*"); + redisTemplate.delete(cacheKeys); return AjaxResult.success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java deleted file mode 100644 index 98e4242f5..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.web.controller.monitor; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * druid 监控 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/monitor/data") -public class DruidController extends BaseController -{ - private String prefix = "/druid"; - - @RequiresPermissions("monitor:data:view") - @GetMapping() - public String index() - { - return redirect(prefix + "/index.html"); - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java index 764197d39..082027beb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java @@ -1,11 +1,10 @@ package com.ruoyi.web.controller.monitor; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.framework.web.domain.Server; /** @@ -13,19 +12,16 @@ import com.ruoyi.framework.web.domain.Server; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/monitor/server") -public class ServerController extends BaseController +public class ServerController { - private String prefix = "monitor/server"; - - @RequiresPermissions("monitor:server:view") + @PreAuthorize("@ss.hasPermi('monitor:server:list')") @GetMapping() - public String server(ModelMap mmap) throws Exception + public AjaxResult getInfo() throws Exception { Server server = new Server(); server.copyTo(); - mmap.put("server", server); - return prefix + "/server"; + return AjaxResult.success(server); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index c18c860dd..f9f262e00 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -1,20 +1,22 @@ package com.ruoyi.web.controller.monitor; import java.util.List; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.service.SysPasswordService; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.service.ISysLogininforService; @@ -23,28 +25,18 @@ import com.ruoyi.system.service.ISysLogininforService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/monitor/logininfor") public class SysLogininforController extends BaseController { - private String prefix = "monitor/logininfor"; - @Autowired private ISysLogininforService logininforService; @Autowired private SysPasswordService passwordService; - @RequiresPermissions("monitor:logininfor:view") - @GetMapping() - public String logininfor() - { - return prefix + "/logininfor"; - } - - @RequiresPermissions("monitor:logininfor:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('monitor:logininfor:list')") + @GetMapping("/list") public TableDataInfo list(SysLogininfor logininfor) { startPage(); @@ -53,42 +45,38 @@ public class SysLogininforController extends BaseController } @Log(title = "登录日志", businessType = BusinessType.EXPORT) - @RequiresPermissions("monitor:logininfor:export") + @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysLogininfor logininfor) + public void export(HttpServletResponse response, SysLogininfor logininfor) { List list = logininforService.selectLogininforList(logininfor); ExcelUtil util = new ExcelUtil(SysLogininfor.class); - return util.exportExcel(list, "登录日志"); + util.exportExcel(response, list, "登录日志"); } - @RequiresPermissions("monitor:logininfor:remove") + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + @DeleteMapping("/{infoIds}") + public AjaxResult remove(@PathVariable Long[] infoIds) { - return toAjax(logininforService.deleteLogininforByIds(ids)); + return toAjax(logininforService.deleteLogininforByIds(infoIds)); } - - @RequiresPermissions("monitor:logininfor:remove") + + @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") @Log(title = "登录日志", businessType = BusinessType.CLEAN) - @PostMapping("/clean") - @ResponseBody + @DeleteMapping("/clean") public AjaxResult clean() { logininforService.cleanLogininfor(); return success(); } - @RequiresPermissions("monitor:logininfor:unlock") + @PreAuthorize("@ss.hasPermi('monitor:logininfor:unlock')") @Log(title = "账户解锁", businessType = BusinessType.OTHER) - @PostMapping("/unlock") - @ResponseBody - public AjaxResult unlock(String loginName) + @GetMapping("/unlock/{userName}") + public AjaxResult unlock(@PathVariable("userName") String userName) { - passwordService.clearLoginRecordCache(loginName); + passwordService.clearLoginRecordCache(userName); return success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 2375fe6fc..5378424a8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -1,15 +1,15 @@ package com.ruoyi.web.controller.monitor; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -24,25 +24,15 @@ import com.ruoyi.system.service.ISysOperLogService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/monitor/operlog") public class SysOperlogController extends BaseController { - private String prefix = "monitor/operlog"; - @Autowired private ISysOperLogService operLogService; - @RequiresPermissions("monitor:operlog:view") - @GetMapping() - public String operlog() - { - return prefix + "/operlog"; - } - - @RequiresPermissions("monitor:operlog:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('monitor:operlog:list')") + @GetMapping("/list") public TableDataInfo list(SysOperLog operLog) { startPage(); @@ -51,37 +41,26 @@ public class SysOperlogController extends BaseController } @Log(title = "操作日志", businessType = BusinessType.EXPORT) - @RequiresPermissions("monitor:operlog:export") + @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysOperLog operLog) + public void export(HttpServletResponse response, SysOperLog operLog) { List list = operLogService.selectOperLogList(operLog); ExcelUtil util = new ExcelUtil(SysOperLog.class); - return util.exportExcel(list, "操作日志"); + util.exportExcel(response, list, "操作日志"); } @Log(title = "操作日志", businessType = BusinessType.DELETE) - @RequiresPermissions("monitor:operlog:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/{operIds}") + public AjaxResult remove(@PathVariable Long[] operIds) { - return toAjax(operLogService.deleteOperLogByIds(ids)); + return toAjax(operLogService.deleteOperLogByIds(operIds)); } - @RequiresPermissions("monitor:operlog:detail") - @GetMapping("/detail/{operId}") - public String detail(@PathVariable("operId") Long operId, ModelMap mmap) - { - mmap.put("operLog", operLogService.selectOperLogById(operId)); - return prefix + "/detail"; - } - @Log(title = "操作日志", businessType = BusinessType.CLEAN) - @RequiresPermissions("monitor:operlog:remove") - @PostMapping("/clean") - @ResponseBody + @PreAuthorize("@ss.hasPermi('monitor:operlog:remove')") + @DeleteMapping("/clean") public AjaxResult clean() { operLogService.cleanOperLog(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 3ae9e81ea..7c343e210 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -1,24 +1,25 @@ package com.ruoyi.web.controller.monitor; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.List; -import org.apache.shiro.authz.annotation.Logical; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.enums.OnlineStatus; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.framework.shiro.session.OnlineSessionDAO; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.service.ISysUserOnlineService; @@ -27,62 +28,56 @@ import com.ruoyi.system.service.ISysUserOnlineService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/monitor/online") public class SysUserOnlineController extends BaseController { - private String prefix = "monitor/online"; - @Autowired private ISysUserOnlineService userOnlineService; @Autowired - private OnlineSessionDAO onlineSessionDAO; + private RedisCache redisCache; - @RequiresPermissions("monitor:online:view") - @GetMapping() - public String online() + @PreAuthorize("@ss.hasPermi('monitor:online:list')") + @GetMapping("/list") + public TableDataInfo list(String ipaddr, String userName) { - return prefix + "/online"; - } - - @RequiresPermissions("monitor:online:list") - @PostMapping("/list") - @ResponseBody - public TableDataInfo list(SysUserOnline userOnline) - { - startPage(); - List list = userOnlineService.selectUserOnlineList(userOnline); - return getDataTable(list); - } - - @RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR) - @Log(title = "在线用户", businessType = BusinessType.FORCE) - @PostMapping("/batchForceLogout") - @ResponseBody - public AjaxResult batchForceLogout(String ids) - { - for (String sessionId : Convert.toStrArray(ids)) + Collection keys = redisCache.keys(CacheConstants.LOGIN_TOKEN_KEY + "*"); + List userOnlineList = new ArrayList(); + for (String key : keys) { - SysUserOnline online = userOnlineService.selectOnlineById(sessionId); - if (online == null) + LoginUser user = redisCache.getCacheObject(key); + if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) { - return error("用户已下线"); + userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user)); } - OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); - if (onlineSession == null) + else if (StringUtils.isNotEmpty(ipaddr)) { - return error("用户已下线"); + userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user)); } - if (sessionId.equals(ShiroUtils.getSessionId())) + else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) { - return error("当前登录用户无法强退"); + userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user)); + } + else + { + userOnlineList.add(userOnlineService.loginUserToUserOnline(user)); } - onlineSessionDAO.delete(onlineSession); - online.setStatus(OnlineStatus.off_line); - userOnlineService.saveOnline(online); - userOnlineService.removeUserCache(online.getLoginName(), sessionId); } + Collections.reverse(userOnlineList); + userOnlineList.removeAll(Collections.singleton(null)); + return getDataTable(userOnlineList); + } + + /** + * 强退用户 + */ + @PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')") + @Log(title = "在线用户", businessType = BusinessType.FORCE) + @DeleteMapping("/{tokenId}") + public AjaxResult forceLogout(@PathVariable String tokenId) + { + redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + tokenId); return success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java deleted file mode 100644 index 230cc3b29..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.ruoyi.web.controller.system; - -import java.awt.image.BufferedImage; -import java.io.IOException; -import javax.annotation.Resource; -import javax.imageio.ImageIO; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.servlet.ModelAndView; -import com.google.code.kaptcha.Constants; -import com.google.code.kaptcha.Producer; -import com.ruoyi.common.core.controller.BaseController; - -/** - * 图片验证码(支持算术形式) - * - * @author ruoyi - */ -@Controller -@RequestMapping("/captcha") -public class SysCaptchaController extends BaseController -{ - @Resource(name = "captchaProducer") - private Producer captchaProducer; - - @Resource(name = "captchaProducerMath") - private Producer captchaProducerMath; - - /** - * 验证码生成 - */ - @GetMapping(value = "/captchaImage") - public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) - { - ServletOutputStream out = null; - try - { - HttpSession session = request.getSession(); - response.setDateHeader("Expires", 0); - response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); - response.addHeader("Cache-Control", "post-check=0, pre-check=0"); - response.setHeader("Pragma", "no-cache"); - response.setContentType("image/jpeg"); - - String type = request.getParameter("type"); - String capStr = null; - String code = null; - BufferedImage bi = null; - if ("math".equals(type)) - { - String capText = captchaProducerMath.createText(); - capStr = capText.substring(0, capText.lastIndexOf("@")); - code = capText.substring(capText.lastIndexOf("@") + 1); - bi = captchaProducerMath.createImage(capStr); - } - else if ("char".equals(type)) - { - capStr = code = captchaProducer.createText(); - bi = captchaProducer.createImage(capStr); - } - session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code); - out = response.getOutputStream(); - ImageIO.write(bi, "jpg", out); - out.flush(); - - } - catch (Exception e) - { - e.printStackTrace(); - } - finally - { - try - { - if (out != null) - { - out.close(); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - } - return null; - } -} \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 9c0bdbe22..95bcaeceb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -1,16 +1,18 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -25,28 +27,18 @@ import com.ruoyi.system.service.ISysConfigService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/config") public class SysConfigController extends BaseController { - private String prefix = "system/config"; - @Autowired private ISysConfigService configService; - @RequiresPermissions("system:config:view") - @GetMapping() - public String config() - { - return prefix + "/config"; - } - /** - * 查询参数配置列表 + * 获取参数配置列表 */ - @RequiresPermissions("system:config:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:config:list')") + @GetMapping("/list") public TableDataInfo list(SysConfig config) { startPage(); @@ -55,103 +47,87 @@ public class SysConfigController extends BaseController } @Log(title = "参数管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:config:export") + @PreAuthorize("@ss.hasPermi('system:config:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysConfig config) + public void export(HttpServletResponse response, SysConfig config) { List list = configService.selectConfigList(config); ExcelUtil util = new ExcelUtil(SysConfig.class); - return util.exportExcel(list, "参数数据"); + util.exportExcel(response, list, "参数数据"); + } + + /** + * 根据参数编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:config:query')") + @GetMapping(value = "/{configId}") + public AjaxResult getInfo(@PathVariable Long configId) + { + return success(configService.selectConfigById(configId)); + } + + /** + * 根据参数键名查询参数值 + */ + @GetMapping(value = "/configKey/{configKey}") + public AjaxResult getConfigKey(@PathVariable String configKey) + { + return success(configService.selectConfigByKey(configKey)); } /** * 新增参数配置 */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存参数配置 - */ - @RequiresPermissions("system:config:add") + @PreAuthorize("@ss.hasPermi('system:config:add')") @Log(title = "参数管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysConfig config) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysConfig config) { if (!configService.checkConfigKeyUnique(config)) { return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); } - config.setCreateBy(getLoginName()); + config.setCreateBy(getUsername()); return toAjax(configService.insertConfig(config)); } /** * 修改参数配置 */ - @RequiresPermissions("system:config:edit") - @GetMapping("/edit/{configId}") - public String edit(@PathVariable("configId") Long configId, ModelMap mmap) - { - mmap.put("config", configService.selectConfigById(configId)); - return prefix + "/edit"; - } - - /** - * 修改保存参数配置 - */ - @RequiresPermissions("system:config:edit") + @PreAuthorize("@ss.hasPermi('system:config:edit')") @Log(title = "参数管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysConfig config) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysConfig config) { if (!configService.checkConfigKeyUnique(config)) { return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); } - config.setUpdateBy(getLoginName()); + config.setUpdateBy(getUsername()); return toAjax(configService.updateConfig(config)); } /** * 删除参数配置 */ - @RequiresPermissions("system:config:remove") + @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + @DeleteMapping("/{configIds}") + public AjaxResult remove(@PathVariable Long[] configIds) { - configService.deleteConfigByIds(ids); + configService.deleteConfigByIds(configIds); return success(); } /** * 刷新参数缓存 */ - @RequiresPermissions("system:config:remove") + @PreAuthorize("@ss.hasPermi('system:config:remove')") @Log(title = "参数管理", businessType = BusinessType.CLEAN) - @GetMapping("/refreshCache") - @ResponseBody + @DeleteMapping("/refreshCache") public AjaxResult refreshCache() { configService.resetConfigCache(); return success(); } - - /** - * 校验参数键名 - */ - @PostMapping("/checkConfigKeyUnique") - @ResponseBody - public boolean checkConfigKeyUnique(SysConfig config) - { - return configService.checkConfigKeyUnique(config); - } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index fad2736e8..4d70b655d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -1,21 +1,22 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; @@ -26,87 +27,70 @@ import com.ruoyi.system.service.ISysDeptService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/dept") public class SysDeptController extends BaseController { - private String prefix = "system/dept"; - @Autowired private ISysDeptService deptService; - @RequiresPermissions("system:dept:view") - @GetMapping() - public String dept() + /** + * 获取部门列表 + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list") + public AjaxResult list(SysDept dept) { - return prefix + "/dept"; + List depts = deptService.selectDeptList(dept); + return success(depts); } - @RequiresPermissions("system:dept:list") - @PostMapping("/list") - @ResponseBody - public List list(SysDept dept) + /** + * 查询部门列表(排除节点) + */ + @PreAuthorize("@ss.hasPermi('system:dept:list')") + @GetMapping("/list/exclude/{deptId}") + public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { - List deptList = deptService.selectDeptList(dept); - return deptList; + List depts = deptService.selectDeptList(new SysDept()); + depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); + return success(depts); + } + + /** + * 根据部门编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:dept:query')") + @GetMapping(value = "/{deptId}") + public AjaxResult getInfo(@PathVariable Long deptId) + { + deptService.checkDeptDataScope(deptId); + return success(deptService.selectDeptById(deptId)); } /** * 新增部门 */ - @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) - { - if (!getSysUser().isAdmin()) - { - parentId = getSysUser().getDeptId(); - } - mmap.put("dept", deptService.selectDeptById(parentId)); - return prefix + "/add"; - } - - /** - * 新增保存部门 - */ + @PreAuthorize("@ss.hasPermi('system:dept:add')") @Log(title = "部门管理", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dept:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDept dept) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDept dept) { if (!deptService.checkDeptNameUnique(dept)) { return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); } - dept.setCreateBy(getLoginName()); + dept.setCreateBy(getUsername()); return toAjax(deptService.insertDept(dept)); } /** * 修改部门 */ - @RequiresPermissions("system:dept:edit") - @GetMapping("/edit/{deptId}") - public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) - { - deptService.checkDeptDataScope(deptId); - SysDept dept = deptService.selectDeptById(deptId); - if (StringUtils.isNotNull(dept) && 100L == deptId) - { - dept.setParentName("无"); - } - mmap.put("dept", dept); - return prefix + "/edit"; - } - - /** - * 修改保存部门 - */ + @PreAuthorize("@ss.hasPermi('system:dept:edit')") @Log(title = "部门管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dept:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDept dept) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDept dept) { Long deptId = dept.getDeptId(); deptService.checkDeptDataScope(deptId); @@ -120,68 +104,29 @@ public class SysDeptController extends BaseController } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) { - return AjaxResult.error("该部门包含未停用的子部门!"); + return error("该部门包含未停用的子部门!"); } - dept.setUpdateBy(getLoginName()); + dept.setUpdateBy(getUsername()); return toAjax(deptService.updateDept(dept)); } /** - * 删除 + * 删除部门 */ + @PreAuthorize("@ss.hasPermi('system:dept:remove')") @Log(title = "部门管理", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dept:remove") - @GetMapping("/remove/{deptId}") - @ResponseBody - public AjaxResult remove(@PathVariable("deptId") Long deptId) + @DeleteMapping("/{deptId}") + public AjaxResult remove(@PathVariable Long deptId) { - if (deptService.selectDeptCount(deptId) > 0) + if (deptService.hasChildByDeptId(deptId)) { - return AjaxResult.warn("存在下级部门,不允许删除"); + return warn("存在下级部门,不允许删除"); } if (deptService.checkDeptExistUser(deptId)) { - return AjaxResult.warn("部门存在用户,不允许删除"); + return warn("部门存在用户,不允许删除"); } deptService.checkDeptDataScope(deptId); return toAjax(deptService.deleteDeptById(deptId)); } - - /** - * 校验部门名称 - */ - @PostMapping("/checkDeptNameUnique") - @ResponseBody - public boolean checkDeptNameUnique(SysDept dept) - { - return deptService.checkDeptNameUnique(dept); - } - - /** - * 选择部门树 - * - * @param deptId 部门ID - * @param excludeId 排除ID - */ - @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" }) - public String selectDeptTree(@PathVariable("deptId") Long deptId, - @PathVariable(value = "excludeId", required = false) Long excludeId, ModelMap mmap) - { - mmap.put("dept", deptService.selectDeptById(deptId)); - mmap.put("excludeId", excludeId); - return prefix + "/tree"; - } - - /** - * 加载部门列表树(排除下级) - */ - @GetMapping("/treeData/{excludeId}") - @ResponseBody - public List treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) - { - SysDept dept = new SysDept(); - dept.setExcludeId(excludeId); - List ztrees = deptService.selectDeptTreeExcludeChild(dept); - return ztrees; - } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index d7fe5ef74..1914b998c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -1,49 +1,47 @@ package com.ruoyi.web.controller.system; +import java.util.ArrayList; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictDataService; +import com.ruoyi.system.service.ISysDictTypeService; /** * 数据字典信息 * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/dict/data") public class SysDictDataController extends BaseController { - private String prefix = "system/dict/data"; - @Autowired private ISysDictDataService dictDataService; - @RequiresPermissions("system:dict:view") - @GetMapping() - public String dictData() - { - return prefix + "/data"; - } + @Autowired + private ISysDictTypeService dictTypeService; - @PostMapping("/list") - @RequiresPermissions("system:dict:list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") public TableDataInfo list(SysDictData dictData) { startPage(); @@ -52,70 +50,72 @@ public class SysDictDataController extends BaseController } @Log(title = "字典数据", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:dict:export") + @PreAuthorize("@ss.hasPermi('system:dict:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysDictData dictData) + public void export(HttpServletResponse response, SysDictData dictData) { List list = dictDataService.selectDictDataList(dictData); ExcelUtil util = new ExcelUtil(SysDictData.class); - return util.exportExcel(list, "字典数据"); + util.exportExcel(response, list, "字典数据"); + } + + /** + * 查询字典数据详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictCode}") + public AjaxResult getInfo(@PathVariable Long dictCode) + { + return success(dictDataService.selectDictDataById(dictCode)); + } + + /** + * 根据字典类型查询字典数据信息 + */ + @GetMapping(value = "/type/{dictType}") + public AjaxResult dictType(@PathVariable String dictType) + { + List data = dictTypeService.selectDictDataByType(dictType); + if (StringUtils.isNull(data)) + { + data = new ArrayList(); + } + return success(data); } /** * 新增字典类型 */ - @GetMapping("/add/{dictType}") - public String add(@PathVariable("dictType") String dictType, ModelMap mmap) - { - mmap.put("dictType", dictType); - return prefix + "/add"; - } - - /** - * 新增保存字典类型 - */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "字典数据", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDictData dict) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictData dict) { - dict.setCreateBy(getLoginName()); + dict.setCreateBy(getUsername()); return toAjax(dictDataService.insertDictData(dict)); } - /** - * 修改字典类型 - */ - @RequiresPermissions("system:dict:edit") - @GetMapping("/edit/{dictCode}") - public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) - { - mmap.put("dict", dictDataService.selectDictDataById(dictCode)); - return prefix + "/edit"; - } - /** * 修改保存字典类型 */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "字典数据", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDictData dict) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictData dict) { - dict.setUpdateBy(getLoginName()); + dict.setUpdateBy(getUsername()); return toAjax(dictDataService.updateDictData(dict)); } - @Log(title = "字典数据", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dict:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") + @Log(title = "字典类型", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictCodes}") + public AjaxResult remove(@PathVariable Long[] dictCodes) { - dictDataService.deleteDictDataByIds(ids); + dictDataService.deleteDictDataByIds(dictCodes); return success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 136b00f37..980884246 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -1,20 +1,21 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; @@ -26,25 +27,15 @@ import com.ruoyi.system.service.ISysDictTypeService; * * @author ruoyi */ -@Controller -@RequestMapping("/system/dict") +@RestController +@RequestMapping("/system/dict/type") public class SysDictTypeController extends BaseController { - private String prefix = "system/dict/type"; - @Autowired private ISysDictTypeService dictTypeService; - @RequiresPermissions("system:dict:view") - @GetMapping() - public String dictType() - { - return prefix + "/type"; - } - - @PostMapping("/list") - @RequiresPermissions("system:dict:list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:dict:list')") + @GetMapping("/list") public TableDataInfo list(SysDictType dictType) { startPage(); @@ -53,88 +44,75 @@ public class SysDictTypeController extends BaseController } @Log(title = "字典类型", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:dict:export") + @PreAuthorize("@ss.hasPermi('system:dict:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysDictType dictType) + public void export(HttpServletResponse response, SysDictType dictType) { - List list = dictTypeService.selectDictTypeList(dictType); ExcelUtil util = new ExcelUtil(SysDictType.class); - return util.exportExcel(list, "字典类型"); + util.exportExcel(response, list, "字典类型"); + } + + /** + * 查询字典类型详细 + */ + @PreAuthorize("@ss.hasPermi('system:dict:query')") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) + { + return success(dictTypeService.selectDictTypeById(dictId)); } /** * 新增字典类型 */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存字典类型 - */ + @PreAuthorize("@ss.hasPermi('system:dict:add')") @Log(title = "字典类型", businessType = BusinessType.INSERT) - @RequiresPermissions("system:dict:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysDictType dict) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysDictType dict) { if (!dictTypeService.checkDictTypeUnique(dict)) { return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); } - dict.setCreateBy(getLoginName()); + dict.setCreateBy(getUsername()); return toAjax(dictTypeService.insertDictType(dict)); } /** * 修改字典类型 */ - @RequiresPermissions("system:dict:edit") - @GetMapping("/edit/{dictId}") - public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) - { - mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); - return prefix + "/edit"; - } - - /** - * 修改保存字典类型 - */ + @PreAuthorize("@ss.hasPermi('system:dict:edit')") @Log(title = "字典类型", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:dict:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysDictType dict) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysDictType dict) { if (!dictTypeService.checkDictTypeUnique(dict)) { return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); } - dict.setUpdateBy(getLoginName()); + dict.setUpdateBy(getUsername()); return toAjax(dictTypeService.updateDictType(dict)); } + /** + * 删除字典类型 + */ + @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.DELETE) - @RequiresPermissions("system:dict:remove") - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + @DeleteMapping("/{dictIds}") + public AjaxResult remove(@PathVariable Long[] dictIds) { - dictTypeService.deleteDictTypeByIds(ids); + dictTypeService.deleteDictTypeByIds(dictIds); return success(); } /** * 刷新字典缓存 */ - @RequiresPermissions("system:dict:remove") + @PreAuthorize("@ss.hasPermi('system:dict:remove')") @Log(title = "字典类型", businessType = BusinessType.CLEAN) - @GetMapping("/refreshCache") - @ResponseBody + @DeleteMapping("/refreshCache") public AjaxResult refreshCache() { dictTypeService.resetDictCache(); @@ -142,47 +120,12 @@ public class SysDictTypeController extends BaseController } /** - * 查询字典详细 + * 获取字典选择框列表 */ - @RequiresPermissions("system:dict:list") - @GetMapping("/detail/{dictId}") - public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) + @GetMapping("/optionselect") + public AjaxResult optionselect() { - mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); - mmap.put("dictList", dictTypeService.selectDictTypeAll()); - return "system/dict/data/data"; - } - - /** - * 校验字典类型 - */ - @PostMapping("/checkDictTypeUnique") - @ResponseBody - public boolean checkDictTypeUnique(SysDictType dictType) - { - return dictTypeService.checkDictTypeUnique(dictType); - } - - /** - * 选择字典树 - */ - @GetMapping("/selectDictTree/{columnId}/{dictType}") - public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, - ModelMap mmap) - { - mmap.put("columnId", columnId); - mmap.put("dict", dictTypeService.selectDictTypeByType(dictType)); - return prefix + "/tree"; - } - - /** - * 加载字典列表树 - */ - @GetMapping("/treeData") - @ResponseBody - public List treeData() - { - List ztrees = dictTypeService.selectDictTree(new SysDictType()); - return ztrees; + List dictTypes = dictTypeService.selectDictTypeAll(); + return success(dictTypes); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index 10da47fb4..009219e02 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -1,178 +1,29 @@ package com.ruoyi.web.controller.system; -import java.util.Date; -import java.util.List; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.entity.SysMenu; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.utils.CookieUtils; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import com.ruoyi.system.service.ISysConfigService; -import com.ruoyi.system.service.ISysMenuService; /** - * 首页 业务处理 - * + * 首页 + * * @author ruoyi */ -@Controller -public class SysIndexController extends BaseController +@RestController +public class SysIndexController { + /** 系统基础配置 */ @Autowired - private ISysMenuService menuService; + private RuoYiConfig ruoyiConfig; - @Autowired - private ISysConfigService configService; - - @Autowired - private SysPasswordService passwordService; - - // 系统首页 - @GetMapping("/index") - public String index(ModelMap mmap) + /** + * 访问首页,提示语 + */ + @RequestMapping("/") + public String index() { - // 取身份信息 - SysUser user = getSysUser(); - // 根据用户id取出菜单 - List menus = menuService.selectMenusByUser(user); - mmap.put("menus", menus); - mmap.put("user", user); - mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme")); - mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName")); - Boolean footer = Convert.toBool(configService.selectConfigByKey("sys.index.footer"), true); - Boolean tagsView = Convert.toBool(configService.selectConfigByKey("sys.index.tagsView"), true); - mmap.put("footer", footer); - mmap.put("tagsView", tagsView); - mmap.put("mainClass", contentMainClass(footer, tagsView)); - mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear()); - mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled()); - mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate())); - mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate())); - mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent"))); - - // 菜单导航显示风格 - String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); - // 移动端,默认使左侧导航菜单,否则取默认配置 - String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle; - - // 优先Cookie配置导航菜单 - Cookie[] cookies = ServletUtils.getRequest().getCookies(); - for (Cookie cookie : cookies) - { - if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) - { - indexStyle = cookie.getValue(); - break; - } - } - String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index"; - return webIndex; - } - - // 锁定屏幕 - @GetMapping("/lockscreen") - public String lockscreen(ModelMap mmap) - { - mmap.put("user", getSysUser()); - ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true); - return "lock"; - } - - // 解锁屏幕 - @PostMapping("/unlockscreen") - @ResponseBody - public AjaxResult unlockscreen(String password) - { - SysUser user = getSysUser(); - if (StringUtils.isNull(user)) - { - return AjaxResult.error("服务器超时,请重新登录"); - } - if (passwordService.matches(user, password)) - { - ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN); - return AjaxResult.success(); - } - return AjaxResult.error("密码不正确,请重新输入。"); - } - - // 切换主题 - @GetMapping("/system/switchSkin") - public String switchSkin() - { - return "skin"; - } - - // 切换菜单 - @GetMapping("/system/menuStyle/{style}") - public void menuStyle(@PathVariable String style, HttpServletResponse response) - { - CookieUtils.setCookie(response, "nav-style", style); - } - - // 系统介绍 - @GetMapping("/system/main") - public String main(ModelMap mmap) - { - mmap.put("version", RuoYiConfig.getVersion()); - return "main"; - } - - // content-main class - public String contentMainClass(Boolean footer, Boolean tagsView) - { - if (!footer && !tagsView) - { - return "tagsview-footer-hide"; - } - else if (!footer) - { - return "footer-hide"; - } - else if (!tagsView) - { - return "tagsview-hide"; - } - return StringUtils.EMPTY; - } - - // 检查初始密码是否提醒修改 - public boolean initPasswordIsModify(Date pwdUpdateDate) - { - Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); - return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null; - } - - // 检查密码是否过期 - public boolean passwordIsExpiration(Date pwdUpdateDate) - { - Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays")); - if (passwordValidateDays != null && passwordValidateDays > 0) - { - if (StringUtils.isNull(pwdUpdateDate)) - { - // 如果从未修改过初始密码,直接提醒过期 - return true; - } - Date nowDate = DateUtils.getNowDate(); - return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays; - } - return false; + return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ruoyiConfig.getName(), ruoyiConfig.getVersion()); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 55aecae62..d959a17e0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -1,82 +1,86 @@ package com.ruoyi.web.controller.system; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.AuthenticationException; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.apache.shiro.subject.Subject; +import java.util.List; +import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.core.controller.BaseController; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.web.service.ConfigService; +import com.ruoyi.common.core.domain.entity.SysMenu; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.framework.web.service.SysLoginService; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.system.service.ISysMenuService; /** * 登录验证 * * @author ruoyi */ -@Controller -public class SysLoginController extends BaseController +@RestController +public class SysLoginController { - /** - * 是否开启记住我功能 - */ - @Value("${shiro.rememberMe.enabled: false}") - private boolean rememberMe; + @Autowired + private SysLoginService loginService; @Autowired - private ConfigService configService; + private ISysMenuService menuService; - @GetMapping("/login") - public String login(HttpServletRequest request, HttpServletResponse response, ModelMap mmap) - { - // 如果是Ajax请求,返回Json字符串。 - if (ServletUtils.isAjaxRequest(request)) - { - return ServletUtils.renderString(response, "{\"code\":\"1\",\"msg\":\"未登录或登录超时。请重新登录\"}"); - } - // 是否开启记住我 - mmap.put("isRemembered", rememberMe); - // 是否开启用户注册 - mmap.put("isAllowRegister", Convert.toBool(configService.getKey("sys.account.registerUser"), false)); - return "login"; - } + @Autowired + private SysPermissionService permissionService; + /** + * 登录方法 + * + * @param loginBody 登录信息 + * @return 结果 + */ @PostMapping("/login") - @ResponseBody - public AjaxResult ajaxLogin(String username, String password, Boolean rememberMe) + public AjaxResult login(@RequestBody LoginBody loginBody) { - UsernamePasswordToken token = new UsernamePasswordToken(username, password, rememberMe); - Subject subject = SecurityUtils.getSubject(); - try - { - subject.login(token); - return success(); - } - catch (AuthenticationException e) - { - String msg = "用户或密码错误"; - if (StringUtils.isNotEmpty(e.getMessage())) - { - msg = e.getMessage(); - } - return error(msg); - } + AjaxResult ajax = AjaxResult.success(); + // 生成令牌 + String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), + loginBody.getUuid()); + ajax.put(Constants.TOKEN, token); + return ajax; } - @GetMapping("/unauth") - public String unauth() + /** + * 获取用户信息 + * + * @return 用户信息 + */ + @GetMapping("getInfo") + public AjaxResult getInfo() { - return "error/unauth"; + SysUser user = SecurityUtils.getLoginUser().getUser(); + // 角色集合 + Set roles = permissionService.getRolePermission(user); + // 权限集合 + Set permissions = permissionService.getMenuPermission(user); + AjaxResult ajax = AjaxResult.success(); + ajax.put("user", user); + ajax.put("roles", roles); + ajax.put("permissions", permissions); + return ajax; + } + + /** + * 获取路由信息 + * + * @return 路由信息 + */ + @GetMapping("getRouters") + public AjaxResult getRouters() + { + Long userId = SecurityUtils.getUserId(); + List menus = menuService.selectMenuTreeByUserId(userId); + return AjaxResult.success(menuService.buildMenus(menus)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 30ab7955f..eaaebd3eb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -1,25 +1,24 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysMenu; -import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.framework.shiro.util.AuthorizationUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysMenuService; /** @@ -27,171 +26,117 @@ import com.ruoyi.system.service.ISysMenuService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/menu") public class SysMenuController extends BaseController { - private String prefix = "system/menu"; - @Autowired private ISysMenuService menuService; - @RequiresPermissions("system:menu:view") - @GetMapping() - public String menu() + /** + * 获取菜单列表 + */ + @PreAuthorize("@ss.hasPermi('system:menu:list')") + @GetMapping("/list") + public AjaxResult list(SysMenu menu) { - return prefix + "/menu"; - } - - @RequiresPermissions("system:menu:list") - @PostMapping("/list") - @ResponseBody - public List list(SysMenu menu) - { - Long userId = ShiroUtils.getUserId(); - List menuList = menuService.selectMenuList(menu, userId); - return menuList; + List menus = menuService.selectMenuList(menu, getUserId()); + return success(menus); } /** - * 删除菜单 + * 根据菜单编号获取详细信息 */ - @Log(title = "菜单管理", businessType = BusinessType.DELETE) - @RequiresPermissions("system:menu:remove") - @GetMapping("/remove/{menuId}") - @ResponseBody - public AjaxResult remove(@PathVariable("menuId") Long menuId) + @PreAuthorize("@ss.hasPermi('system:menu:query')") + @GetMapping(value = "/{menuId}") + public AjaxResult getInfo(@PathVariable Long menuId) { - if (menuService.selectCountMenuByParentId(menuId) > 0) - { - return AjaxResult.warn("存在子菜单,不允许删除"); - } - if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) - { - return AjaxResult.warn("菜单已分配,不允许删除"); - } - AuthorizationUtils.clearAllCachedAuthorizationInfo(); - return toAjax(menuService.deleteMenuById(menuId)); + return success(menuService.selectMenuById(menuId)); } /** - * 新增 + * 获取菜单下拉树列表 */ - @GetMapping("/add/{parentId}") - public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) + @GetMapping("/treeselect") + public AjaxResult treeselect(SysMenu menu) { - SysMenu menu = null; - if (0L != parentId) - { - menu = menuService.selectMenuById(parentId); - } - else - { - menu = new SysMenu(); - menu.setMenuId(0L); - menu.setMenuName("主目录"); - } - mmap.put("menu", menu); - return prefix + "/add"; + List menus = menuService.selectMenuList(menu, getUserId()); + return success(menuService.buildMenuTreeSelect(menus)); } /** - * 新增保存菜单 + * 加载对应角色菜单列表树 */ + @GetMapping(value = "/roleMenuTreeselect/{roleId}") + public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) + { + List menus = menuService.selectMenuList(getUserId()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); + ajax.put("menus", menuService.buildMenuTreeSelect(menus)); + return ajax; + } + + /** + * 新增菜单 + */ + @PreAuthorize("@ss.hasPermi('system:menu:add')") @Log(title = "菜单管理", businessType = BusinessType.INSERT) - @RequiresPermissions("system:menu:add") - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysMenu menu) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysMenu menu) { if (!menuService.checkMenuNameUnique(menu)) { return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); } - menu.setCreateBy(getLoginName()); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + menu.setCreateBy(getUsername()); return toAjax(menuService.insertMenu(menu)); } /** * 修改菜单 */ - @RequiresPermissions("system:menu:edit") - @GetMapping("/edit/{menuId}") - public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) - { - mmap.put("menu", menuService.selectMenuById(menuId)); - return prefix + "/edit"; - } - - /** - * 修改保存菜单 - */ + @PreAuthorize("@ss.hasPermi('system:menu:edit')") @Log(title = "菜单管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:menu:edit") - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysMenu menu) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysMenu menu) { if (!menuService.checkMenuNameUnique(menu)) { return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); } - menu.setUpdateBy(getLoginName()); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); + else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath())) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头"); + } + else if (menu.getMenuId().equals(menu.getParentId())) + { + return error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己"); + } + menu.setUpdateBy(getUsername()); return toAjax(menuService.updateMenu(menu)); } /** - * 选择菜单图标 + * 删除菜单 */ - @GetMapping("/icon") - public String icon() + @PreAuthorize("@ss.hasPermi('system:menu:remove')") + @Log(title = "菜单管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{menuId}") + public AjaxResult remove(@PathVariable("menuId") Long menuId) { - return prefix + "/icon"; - } - - /** - * 校验菜单名称 - */ - @PostMapping("/checkMenuNameUnique") - @ResponseBody - public boolean checkMenuNameUnique(SysMenu menu) - { - return menuService.checkMenuNameUnique(menu); - } - - /** - * 加载角色菜单列表树 - */ - @GetMapping("/roleMenuTreeData") - @ResponseBody - public List roleMenuTreeData(SysRole role) - { - Long userId = ShiroUtils.getUserId(); - List ztrees = menuService.roleMenuTreeData(role, userId); - return ztrees; - } - - /** - * 加载所有菜单列表树 - */ - @GetMapping("/menuTreeData") - @ResponseBody - public List menuTreeData() - { - Long userId = ShiroUtils.getUserId(); - List ztrees = menuService.menuTreeData(userId); - return ztrees; - } - - /** - * 选择菜单树 - */ - @GetMapping("/selectMenuTree/{menuId}") - public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) - { - mmap.put("menu", menuService.selectMenuById(menuId)); - return prefix + "/tree"; + if (menuService.hasChildByMenuId(menuId)) + { + return warn("存在子菜单,不允许删除"); + } + if (menuService.checkMenuExistRole(menuId)) + { + return warn("菜单已分配,不允许删除"); + } + return toAjax(menuService.deleteMenuById(menuId)); } } \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index c83af2824..36c62b991 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -1,16 +1,17 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -24,28 +25,18 @@ import com.ruoyi.system.service.ISysNoticeService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/notice") public class SysNoticeController extends BaseController { - private String prefix = "system/notice"; - @Autowired private ISysNoticeService noticeService; - @RequiresPermissions("system:notice:view") - @GetMapping() - public String notice() - { - return prefix + "/notice"; - } - /** - * 查询公告列表 + * 获取通知公告列表 */ - @RequiresPermissions("system:notice:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:notice:list')") + @GetMapping("/list") public TableDataInfo list(SysNotice notice) { startPage(); @@ -54,71 +45,47 @@ public class SysNoticeController extends BaseController } /** - * 新增公告 + * 根据通知公告编号获取详细信息 */ - @GetMapping("/add") - public String add() + @PreAuthorize("@ss.hasPermi('system:notice:query')") + @GetMapping(value = "/{noticeId}") + public AjaxResult getInfo(@PathVariable Long noticeId) { - return prefix + "/add"; + return success(noticeService.selectNoticeById(noticeId)); } /** - * 新增保存公告 + * 新增通知公告 */ - @RequiresPermissions("system:notice:add") + @PreAuthorize("@ss.hasPermi('system:notice:add')") @Log(title = "通知公告", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysNotice notice) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysNotice notice) { - notice.setCreateBy(getLoginName()); + notice.setCreateBy(getUsername()); return toAjax(noticeService.insertNotice(notice)); } /** - * 修改公告 + * 修改通知公告 */ - @RequiresPermissions("system:notice:edit") - @GetMapping("/edit/{noticeId}") - public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) - { - mmap.put("notice", noticeService.selectNoticeById(noticeId)); - return prefix + "/edit"; - } - - /** - * 修改保存公告 - */ - @RequiresPermissions("system:notice:edit") + @PreAuthorize("@ss.hasPermi('system:notice:edit')") @Log(title = "通知公告", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysNotice notice) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysNotice notice) { - notice.setUpdateBy(getLoginName()); + notice.setUpdateBy(getUsername()); return toAjax(noticeService.updateNotice(notice)); } /** - * 查询公告详细 + * 删除通知公告 */ - @RequiresPermissions("system:notice:list") - @GetMapping("/view/{noticeId}") - public String view(@PathVariable("noticeId") Long noticeId, ModelMap mmap) - { - mmap.put("notice", noticeService.selectNoticeById(noticeId)); - return prefix + "/view"; - } - - /** - * 删除公告 - */ - @RequiresPermissions("system:notice:remove") + @PreAuthorize("@ss.hasPermi('system:notice:remove')") @Log(title = "通知公告", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + @DeleteMapping("/{noticeIds}") + public AjaxResult remove(@PathVariable Long[] noticeIds) { - return toAjax(noticeService.deleteNoticeByIds(ids)); + return toAjax(noticeService.deleteNoticeByIds(noticeIds)); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 22aea2e0f..a5b96c876 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -1,16 +1,18 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -25,76 +27,52 @@ import com.ruoyi.system.service.ISysPostService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/post") public class SysPostController extends BaseController { - private String prefix = "system/post"; - @Autowired private ISysPostService postService; - @RequiresPermissions("system:post:view") - @GetMapping() - public String operlog() - { - return prefix + "/post"; - } - - @RequiresPermissions("system:post:list") - @PostMapping("/list") - @ResponseBody + /** + * 获取岗位列表 + */ + @PreAuthorize("@ss.hasPermi('system:post:list')") + @GetMapping("/list") public TableDataInfo list(SysPost post) { startPage(); List list = postService.selectPostList(post); return getDataTable(list); } - + @Log(title = "岗位管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:post:export") + @PreAuthorize("@ss.hasPermi('system:post:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysPost post) + public void export(HttpServletResponse response, SysPost post) { List list = postService.selectPostList(post); ExcelUtil util = new ExcelUtil(SysPost.class); - return util.exportExcel(list, "岗位数据"); + util.exportExcel(response, list, "岗位数据"); } - @RequiresPermissions("system:post:remove") - @Log(title = "岗位管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) + /** + * 根据岗位编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:post:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable Long postId) { - try - { - return toAjax(postService.deletePostByIds(ids)); - } - catch (Exception e) - { - return error(e.getMessage()); - } + return success(postService.selectPostById(postId)); } /** * 新增岗位 */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存岗位 - */ - @RequiresPermissions("system:post:add") + @PreAuthorize("@ss.hasPermi('system:post:add')") @Log(title = "岗位管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysPost post) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysPost post) { if (!postService.checkPostNameUnique(post)) { @@ -104,29 +82,17 @@ public class SysPostController extends BaseController { return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); } - post.setCreateBy(getLoginName()); + post.setCreateBy(getUsername()); return toAjax(postService.insertPost(post)); } /** * 修改岗位 */ - @RequiresPermissions("system:post:edit") - @GetMapping("/edit/{postId}") - public String edit(@PathVariable("postId") Long postId, ModelMap mmap) - { - mmap.put("post", postService.selectPostById(postId)); - return prefix + "/edit"; - } - - /** - * 修改保存岗位 - */ - @RequiresPermissions("system:post:edit") + @PreAuthorize("@ss.hasPermi('system:post:edit')") @Log(title = "岗位管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysPost post) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysPost post) { if (!postService.checkPostNameUnique(post)) { @@ -136,27 +102,28 @@ public class SysPostController extends BaseController { return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); } - post.setUpdateBy(getLoginName()); + post.setUpdateBy(getUsername()); return toAjax(postService.updatePost(post)); } /** - * 校验岗位名称 + * 删除岗位 */ - @PostMapping("/checkPostNameUnique") - @ResponseBody - public boolean checkPostNameUnique(SysPost post) + @PreAuthorize("@ss.hasPermi('system:post:remove')") + @Log(title = "岗位管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable Long[] postIds) { - return postService.checkPostNameUnique(post); + return toAjax(postService.deletePostByIds(postIds)); } /** - * 校验岗位编码 + * 获取岗位选择框列表 */ - @PostMapping("/checkPostCodeUnique") - @ResponseBody - public boolean checkPostCodeUnique(SysPost post) + @GetMapping("/optionselect") + public AjaxResult optionselect() { - return postService.checkPostCodeUnique(post); + List posts = postService.selectPostAll(); + return success(posts); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index e82c1da4a..cd8abd6f5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -1,28 +1,26 @@ package com.ruoyi.web.controller.system; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.MimeTypeUtils; -import com.ruoyi.framework.shiro.service.SysPasswordService; +import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.service.ISysUserService; /** @@ -30,152 +28,110 @@ import com.ruoyi.system.service.ISysUserService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/user/profile") public class SysProfileController extends BaseController { - private static final Logger log = LoggerFactory.getLogger(SysProfileController.class); - - private String prefix = "system/user/profile"; - @Autowired private ISysUserService userService; - + @Autowired - private SysPasswordService passwordService; + private TokenService tokenService; /** * 个人信息 */ - @GetMapping() - public String profile(ModelMap mmap) + @GetMapping + public AjaxResult profile() { - SysUser user = getSysUser(); - mmap.put("user", user); - mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); - mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); - return prefix + "/profile"; + LoginUser loginUser = getLoginUser(); + SysUser user = loginUser.getUser(); + AjaxResult ajax = AjaxResult.success(user); + ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); + ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); + return ajax; } - @GetMapping("/checkPassword") - @ResponseBody - public boolean checkPassword(String password) + /** + * 修改用户 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult updateProfile(@RequestBody SysUser user) { - SysUser user = getSysUser(); - return passwordService.matches(user, password); + LoginUser loginUser = getLoginUser(); + SysUser currentUser = loginUser.getUser(); + currentUser.setNickName(user.getNickName()); + currentUser.setEmail(user.getEmail()); + currentUser.setPhonenumber(user.getPhonenumber()); + currentUser.setSex(user.getSex()); + if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) + { + return error("修改用户'" + loginUser.getUsername() + "'失败,手机号码已存在"); + } + if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) + { + return error("修改用户'" + loginUser.getUsername() + "'失败,邮箱账号已存在"); + } + if (userService.updateUserProfile(currentUser) > 0) + { + // 更新缓存用户信息 + tokenService.setLoginUser(loginUser); + return success(); + } + return error("修改个人信息异常,请联系管理员"); } - @GetMapping("/resetPwd") - public String resetPwd(ModelMap mmap) + /** + * 重置密码 + */ + @Log(title = "个人信息", businessType = BusinessType.UPDATE) + @PutMapping("/updatePwd") + public AjaxResult updatePwd(String oldPassword, String newPassword) { - SysUser user = getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/resetPwd"; - } - - @Log(title = "重置密码", businessType = BusinessType.UPDATE) - @PostMapping("/resetPwd") - @ResponseBody - public AjaxResult resetPwd(String oldPassword, String newPassword) - { - SysUser user = getSysUser(); - if (!passwordService.matches(user, oldPassword)) + LoginUser loginUser = getLoginUser(); + String userName = loginUser.getUsername(); + String password = loginUser.getPassword(); + if (!SecurityUtils.matchesPassword(oldPassword, password)) { return error("修改密码失败,旧密码错误"); } - if (passwordService.matches(user, newPassword)) + if (SecurityUtils.matchesPassword(newPassword, password)) { return error("新密码不能与旧密码相同"); } - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); - user.setPwdUpdateDate(DateUtils.getNowDate()); - if (userService.resetUserPwd(user) > 0) + newPassword = SecurityUtils.encryptPassword(newPassword); + if (userService.resetUserPwd(userName, newPassword) > 0) { - setSysUser(userService.selectUserById(user.getUserId())); + // 更新缓存用户密码 + loginUser.getUser().setPassword(newPassword); + tokenService.setLoginUser(loginUser); return success(); } return error("修改密码异常,请联系管理员"); } /** - * 修改用户 + * 头像上传 */ - @GetMapping("/edit") - public String edit(ModelMap mmap) + @Log(title = "用户头像", businessType = BusinessType.UPDATE) + @PostMapping("/avatar") + public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws Exception { - SysUser user = getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/edit"; - } - - /** - * 修改头像 - */ - @GetMapping("/avatar") - public String avatar(ModelMap mmap) - { - SysUser user = getSysUser(); - mmap.put("user", userService.selectUserById(user.getUserId())); - return prefix + "/avatar"; - } - - /** - * 修改用户 - */ - @Log(title = "个人信息", businessType = BusinessType.UPDATE) - @PostMapping("/update") - @ResponseBody - public AjaxResult update(SysUser user) - { - SysUser currentUser = getSysUser(); - currentUser.setUserName(user.getUserName()); - currentUser.setEmail(user.getEmail()); - currentUser.setPhonenumber(user.getPhonenumber()); - currentUser.setSex(user.getSex()); - if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(currentUser)) + if (!file.isEmpty()) { - return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在"); - } - else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(currentUser)) - { - return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在"); - } - if (userService.updateUserInfo(currentUser) > 0) - { - setSysUser(userService.selectUserById(currentUser.getUserId())); - return success(); - } - return error(); - } - - /** - * 保存头像 - */ - @Log(title = "个人信息", businessType = BusinessType.UPDATE) - @PostMapping("/updateAvatar") - @ResponseBody - public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) - { - SysUser currentUser = getSysUser(); - try - { - if (!file.isEmpty()) + LoginUser loginUser = getLoginUser(); + String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); + if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) { - String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); - currentUser.setAvatar(avatar); - if (userService.updateUserInfo(currentUser) > 0) - { - setSysUser(userService.selectUserById(currentUser.getUserId())); - return success(); - } + AjaxResult ajax = AjaxResult.success(); + ajax.put("imgUrl", avatar); + // 更新缓存用户头像 + loginUser.getUser().setAvatar(avatar); + tokenService.setLoginUser(loginUser); + return ajax; } - return error(); - } - catch (Exception e) - { - log.error("修改头像失败!", e); - return error(e.getMessage()); } + return error("上传图片异常,请联系管理员"); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index 9bcd8b9e4..f1552e033 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -1,15 +1,14 @@ package com.ruoyi.web.controller.system; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.RegisterBody; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.shiro.service.SysRegisterService; +import com.ruoyi.framework.web.service.SysRegisterService; import com.ruoyi.system.service.ISysConfigService; /** @@ -17,7 +16,7 @@ import com.ruoyi.system.service.ISysConfigService; * * @author ruoyi */ -@Controller +@RestController public class SysRegisterController extends BaseController { @Autowired @@ -26,15 +25,8 @@ public class SysRegisterController extends BaseController @Autowired private ISysConfigService configService; - @GetMapping("/register") - public String register() - { - return "register"; - } - @PostMapping("/register") - @ResponseBody - public AjaxResult ajaxRegister(SysUser user) + public AjaxResult register(@RequestBody RegisterBody user) { if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 2cdf08055..ebe7460e1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -1,26 +1,31 @@ package com.ruoyi.web.controller.system; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.shiro.util.AuthorizationUtils; +import com.ruoyi.framework.web.service.SysPermissionService; +import com.ruoyi.framework.web.service.TokenService; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysRoleService; @@ -31,31 +36,27 @@ import com.ruoyi.system.service.ISysUserService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/role") public class SysRoleController extends BaseController { - private String prefix = "system/role"; - @Autowired private ISysRoleService roleService; + @Autowired + private TokenService tokenService; + + @Autowired + private SysPermissionService permissionService; + @Autowired private ISysUserService userService; @Autowired private ISysDeptService deptService; - @RequiresPermissions("system:role:view") - @GetMapping() - public String role() - { - return prefix + "/role"; - } - - @RequiresPermissions("system:role:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/list") public TableDataInfo list(SysRole role) { startPage(); @@ -64,33 +65,33 @@ public class SysRoleController extends BaseController } @Log(title = "角色管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:role:export") + @PreAuthorize("@ss.hasPermi('system:role:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysRole role) + public void export(HttpServletResponse response, SysRole role) { List list = roleService.selectRoleList(role); ExcelUtil util = new ExcelUtil(SysRole.class); - return util.exportExcel(list, "角色数据"); + util.exportExcel(response, list, "角色数据"); + } + + /** + * 根据角色编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/{roleId}") + public AjaxResult getInfo(@PathVariable Long roleId) + { + roleService.checkRoleDataScope(roleId); + return success(roleService.selectRoleById(roleId)); } /** * 新增角色 */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } - - /** - * 新增保存角色 - */ - @RequiresPermissions("system:role:add") + @PreAuthorize("@ss.hasPermi('system:role:add')") @Log(title = "角色管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysRole role) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysRole role) { if (!roleService.checkRoleNameUnique(role)) { @@ -100,32 +101,18 @@ public class SysRoleController extends BaseController { return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); } - role.setCreateBy(getLoginName()); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); + role.setCreateBy(getUsername()); return toAjax(roleService.insertRole(role)); } - /** - * 修改角色 - */ - @RequiresPermissions("system:role:edit") - @GetMapping("/edit/{roleId}") - public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - roleService.checkRoleDataScope(roleId); - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/edit"; - } - /** * 修改保存角色 */ - @RequiresPermissions("system:role:edit") + @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysRole role) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); @@ -137,110 +124,76 @@ public class SysRoleController extends BaseController { return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); } - role.setUpdateBy(getLoginName()); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); - return toAjax(roleService.updateRole(role)); - } - - /** - * 角色分配数据权限 - */ - @GetMapping("/authDataScope/{roleId}") - public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/dataScope"; - } - - /** - * 保存角色分配数据权限 - */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @PostMapping("/authDataScope") - @ResponseBody - public AjaxResult authDataScopeSave(SysRole role) - { - roleService.checkRoleAllowed(role); - roleService.checkRoleDataScope(role.getRoleId()); - role.setUpdateBy(getLoginName()); - if (roleService.authDataScope(role) > 0) + role.setUpdateBy(getUsername()); + + if (roleService.updateRole(role) > 0) { - setSysUser(userService.selectUserById(getUserId())); + // 更新缓存用户权限 + LoginUser loginUser = getLoginUser(); + if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) + { + loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); + loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); + tokenService.setLoginUser(loginUser); + } return success(); } - return error(); - } - - @RequiresPermissions("system:role:remove") - @Log(title = "角色管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(roleService.deleteRoleByIds(ids)); + return error("修改角色'" + role.getRoleName() + "'失败,请联系管理员"); } /** - * 校验角色名称 - */ - @PostMapping("/checkRoleNameUnique") - @ResponseBody - public boolean checkRoleNameUnique(SysRole role) - { - return roleService.checkRoleNameUnique(role); - } - - /** - * 校验角色权限 - */ - @PostMapping("/checkRoleKeyUnique") - @ResponseBody - public boolean checkRoleKeyUnique(SysRole role) - { - return roleService.checkRoleKeyUnique(role); - } - - /** - * 选择菜单树 - */ - @GetMapping("/selectMenuTree") - public String selectMenuTree() - { - return prefix + "/tree"; - } - - /** - * 角色状态修改 + * 修改保存数据权限 */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:role:edit") - @PostMapping("/changeStatus") - @ResponseBody - public AjaxResult changeStatus(SysRole role) + @PutMapping("/dataScope") + public AjaxResult dataScope(@RequestBody SysRole role) { roleService.checkRoleAllowed(role); roleService.checkRoleDataScope(role.getRoleId()); - return toAjax(roleService.changeStatus(role)); + return toAjax(roleService.authDataScope(role)); } /** - * 分配用户 + * 状态修改 */ - @RequiresPermissions("system:role:edit") - @GetMapping("/authUser/{roleId}") - public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysRole role) { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/authUser"; + roleService.checkRoleAllowed(role); + roleService.checkRoleDataScope(role.getRoleId()); + role.setUpdateBy(getUsername()); + return toAjax(roleService.updateRoleStatus(role)); + } + + /** + * 删除角色 + */ + @PreAuthorize("@ss.hasPermi('system:role:remove')") + @Log(title = "角色管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{roleIds}") + public AjaxResult remove(@PathVariable Long[] roleIds) + { + return toAjax(roleService.deleteRoleByIds(roleIds)); + } + + /** + * 获取角色选择框列表 + */ + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping("/optionselect") + public AjaxResult optionselect() + { + return success(roleService.selectRoleAll()); } /** * 查询已分配用户角色列表 */ - @RequiresPermissions("system:role:list") - @PostMapping("/authUser/allocatedList") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/allocatedList") public TableDataInfo allocatedList(SysUser user) { startPage(); @@ -248,46 +201,11 @@ public class SysRoleController extends BaseController return getDataTable(list); } - /** - * 取消授权 - */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/cancel") - @ResponseBody - public AjaxResult cancelAuthUser(SysUserRole userRole) - { - return toAjax(roleService.deleteAuthUser(userRole)); - } - - /** - * 批量取消授权 - */ - @RequiresPermissions("system:role:edit") - @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/cancelAll") - @ResponseBody - public AjaxResult cancelAuthUserAll(Long roleId, String userIds) - { - return toAjax(roleService.deleteAuthUsers(roleId, userIds)); - } - - /** - * 选择用户 - */ - @GetMapping("/authUser/selectUser/{roleId}") - public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) - { - mmap.put("role", roleService.selectRoleById(roleId)); - return prefix + "/selectUser"; - } - /** * 查询未分配用户角色列表 */ - @RequiresPermissions("system:role:list") - @PostMapping("/authUser/unallocatedList") - @ResponseBody + @PreAuthorize("@ss.hasPermi('system:role:list')") + @GetMapping("/authUser/unallocatedList") public TableDataInfo unallocatedList(SysUser user) { startPage(); @@ -295,28 +213,50 @@ public class SysRoleController extends BaseController return getDataTable(list); } + /** + * 取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancel") + public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) + { + return toAjax(roleService.deleteAuthUser(userRole)); + } + + /** + * 批量取消授权用户 + */ + @PreAuthorize("@ss.hasPermi('system:role:edit')") + @Log(title = "角色管理", businessType = BusinessType.GRANT) + @PutMapping("/authUser/cancelAll") + public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) + { + return toAjax(roleService.deleteAuthUsers(roleId, userIds)); + } + /** * 批量选择用户授权 */ - @RequiresPermissions("system:role:edit") + @PreAuthorize("@ss.hasPermi('system:role:edit')") @Log(title = "角色管理", businessType = BusinessType.GRANT) - @PostMapping("/authUser/selectAll") - @ResponseBody - public AjaxResult selectAuthUserAll(Long roleId, String userIds) + @PutMapping("/authUser/selectAll") + public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) { roleService.checkRoleDataScope(roleId); return toAjax(roleService.insertAuthUsers(roleId, userIds)); } /** - * 加载角色部门(数据权限)列表树 + * 获取对应角色部门树列表 */ - @RequiresPermissions("system:role:edit") - @GetMapping("/deptTreeData") - @ResponseBody - public List deptTreeData(SysRole role) + @PreAuthorize("@ss.hasPermi('system:role:query')") + @GetMapping(value = "/deptTree/{roleId}") + public AjaxResult deptTree(@PathVariable("roleId") Long roleId) { - List ztrees = deptService.roleDeptTreeData(role); - return ztrees; + AjaxResult ajax = AjaxResult.success(); + ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); + ajax.put("depts", deptService.selectDeptTreeList(new SysDept())); + return ajax; } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index b1f6dd585..dc29d4982 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -2,34 +2,31 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.ArrayUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.shiro.service.SysPasswordService; -import com.ruoyi.framework.shiro.util.AuthorizationUtils; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysRoleService; @@ -40,37 +37,27 @@ import com.ruoyi.system.service.ISysUserService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/system/user") public class SysUserController extends BaseController { - private String prefix = "system/user"; - @Autowired private ISysUserService userService; @Autowired private ISysRoleService roleService; - + @Autowired private ISysDeptService deptService; @Autowired private ISysPostService postService; - @Autowired - private SysPasswordService passwordService; - - @RequiresPermissions("system:user:view") - @GetMapping() - public String user() - { - return prefix + "/user"; - } - - @RequiresPermissions("system:user:list") - @PostMapping("/list") - @ResponseBody + /** + * 获取用户列表 + */ + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/list") public TableDataInfo list(SysUser user) { startPage(); @@ -79,270 +66,186 @@ public class SysUserController extends BaseController } @Log(title = "用户管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:user:export") + @PreAuthorize("@ss.hasPermi('system:user:export')") @PostMapping("/export") - @ResponseBody - public AjaxResult export(SysUser user) + public void export(HttpServletResponse response, SysUser user) { List list = userService.selectUserList(user); ExcelUtil util = new ExcelUtil(SysUser.class); - return util.exportExcel(list, "用户数据"); + util.exportExcel(response, list, "用户数据"); } @Log(title = "用户管理", businessType = BusinessType.IMPORT) - @RequiresPermissions("system:user:import") + @PreAuthorize("@ss.hasPermi('system:user:import')") @PostMapping("/importData") - @ResponseBody public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil util = new ExcelUtil(SysUser.class); List userList = util.importExcel(file.getInputStream()); - String message = userService.importUser(userList, updateSupport, getLoginName()); - return AjaxResult.success(message); + String operName = getUsername(); + String message = userService.importUser(userList, updateSupport, operName); + return success(message); } - @RequiresPermissions("system:user:view") - @GetMapping("/importTemplate") - @ResponseBody - public AjaxResult importTemplate() + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { ExcelUtil util = new ExcelUtil(SysUser.class); - return util.importTemplateExcel("用户数据"); + util.importTemplateExcel(response, "用户数据"); + } + + /** + * 根据用户编号获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping(value = { "/", "/{userId}" }) + public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) + { + userService.checkUserDataScope(userId); + AjaxResult ajax = AjaxResult.success(); + List roles = roleService.selectRoleAll(); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + ajax.put("posts", postService.selectPostAll()); + if (StringUtils.isNotNull(userId)) + { + SysUser sysUser = userService.selectUserById(userId); + ajax.put(AjaxResult.DATA_TAG, sysUser); + ajax.put("postIds", postService.selectPostListByUserId(userId)); + ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); + } + return ajax; } /** * 新增用户 */ - @GetMapping("/add") - public String add(ModelMap mmap) - { - mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); - mmap.put("posts", postService.selectPostAll()); - return prefix + "/add"; - } - - /** - * 新增保存用户 - */ - @RequiresPermissions("system:user:add") + @PreAuthorize("@ss.hasPermi('system:user:add')") @Log(title = "用户管理", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(@Validated SysUser user) + @PostMapping + public AjaxResult add(@Validated @RequestBody SysUser user) { - if (!userService.checkLoginNameUnique(user)) + if (!userService.checkUserNameUnique(user)) { - return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); + return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在"); } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { - return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); + return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { - return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); + return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); - user.setPwdUpdateDate(DateUtils.getNowDate()); - user.setCreateBy(getLoginName()); + user.setCreateBy(getUsername()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); return toAjax(userService.insertUser(user)); } /** * 修改用户 */ - @RequiresPermissions("system:user:edit") - @GetMapping("/edit/{userId}") - public String edit(@PathVariable("userId") Long userId, ModelMap mmap) - { - userService.checkUserDataScope(userId); - List roles = roleService.selectRolesByUserId(userId); - mmap.put("user", userService.selectUserById(userId)); - mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); - mmap.put("posts", postService.selectPostsByUserId(userId)); - return prefix + "/edit"; - } - - /** - * 查询用户详细 - */ - @RequiresPermissions("system:user:list") - @GetMapping("/view/{userId}") - public String view(@PathVariable("userId") Long userId, ModelMap mmap) - { - userService.checkUserDataScope(userId); - mmap.put("user", userService.selectUserById(userId)); - mmap.put("roleGroup", userService.selectUserRoleGroup(userId)); - mmap.put("postGroup", userService.selectUserPostGroup(userId)); - return prefix + "/view"; - } - - /** - * 修改保存用户 - */ - @RequiresPermissions("system:user:edit") + @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated SysUser user) + @PutMapping + public AjaxResult edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); - if (!userService.checkLoginNameUnique(user)) + if (!userService.checkUserNameUnique(user)) { - return error("修改用户'" + user.getLoginName() + "'失败,登录账号已存在"); + return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { - return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); + return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { - return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); + return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - user.setUpdateBy(getLoginName()); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); + user.setUpdateBy(getUsername()); return toAjax(userService.updateUser(user)); } - @RequiresPermissions("system:user:resetPwd") - @GetMapping("/resetPwd/{userId}") - public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) + /** + * 删除用户 + */ + @PreAuthorize("@ss.hasPermi('system:user:remove')") + @Log(title = "用户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{userIds}") + public AjaxResult remove(@PathVariable Long[] userIds) { - mmap.put("user", userService.selectUserById(userId)); - return prefix + "/resetPwd"; - } - - @RequiresPermissions("system:user:resetPwd") - @Log(title = "重置密码", businessType = BusinessType.UPDATE) - @PostMapping("/resetPwd") - @ResponseBody - public AjaxResult resetPwdSave(SysUser user) - { - userService.checkUserAllowed(user); - userService.checkUserDataScope(user.getUserId()); - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); - if (userService.resetUserPwd(user) > 0) + if (ArrayUtils.contains(userIds, getUserId())) { - if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) - { - setSysUser(userService.selectUserById(user.getUserId())); - } - return success(); + return error("当前用户不能删除"); } - return error(); + return toAjax(userService.deleteUserByIds(userIds)); } /** - * 进入授权角色页 + * 重置密码 */ - @GetMapping("/authRole/{userId}") - public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) + @PreAuthorize("@ss.hasPermi('system:user:resetPwd')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/resetPwd") + public AjaxResult resetPwd(@RequestBody SysUser user) { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); + user.setUpdateBy(getUsername()); + return toAjax(userService.resetPwd(user)); + } + + /** + * 状态修改 + */ + @PreAuthorize("@ss.hasPermi('system:user:edit')") + @Log(title = "用户管理", businessType = BusinessType.UPDATE) + @PutMapping("/changeStatus") + public AjaxResult changeStatus(@RequestBody SysUser user) + { + userService.checkUserAllowed(user); + userService.checkUserDataScope(user.getUserId()); + user.setUpdateBy(getUsername()); + return toAjax(userService.updateUserStatus(user)); + } + + /** + * 根据用户编号获取授权角色 + */ + @PreAuthorize("@ss.hasPermi('system:user:query')") + @GetMapping("/authRole/{userId}") + public AjaxResult authRole(@PathVariable("userId") Long userId) + { + AjaxResult ajax = AjaxResult.success(); SysUser user = userService.selectUserById(userId); - // 获取用户所属的角色列表 List roles = roleService.selectRolesByUserId(userId); - mmap.put("user", user); - mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); - return prefix + "/authRole"; + ajax.put("user", user); + ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); + return ajax; } /** * 用户授权角色 */ - @RequiresPermissions("system:user:edit") + @PreAuthorize("@ss.hasPermi('system:user:edit')") @Log(title = "用户管理", businessType = BusinessType.GRANT) - @PostMapping("/authRole/insertAuthRole") - @ResponseBody + @PutMapping("/authRole") public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { userService.checkUserDataScope(userId); userService.insertUserAuth(userId, roleIds); - AuthorizationUtils.clearAllCachedAuthorizationInfo(); return success(); } - @RequiresPermissions("system:user:remove") - @Log(title = "用户管理", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId())) - { - return error("当前用户不能删除"); - } - return toAjax(userService.deleteUserByIds(ids)); - } - /** - * 校验用户名 + * 获取部门树列表 */ - @PostMapping("/checkLoginNameUnique") - @ResponseBody - public boolean checkLoginNameUnique(SysUser user) + @PreAuthorize("@ss.hasPermi('system:user:list')") + @GetMapping("/deptTree") + public AjaxResult deptTree(SysDept dept) { - return userService.checkLoginNameUnique(user); + return success(deptService.selectDeptTreeList(dept)); } - - /** - * 校验手机号码 - */ - @PostMapping("/checkPhoneUnique") - @ResponseBody - public boolean checkPhoneUnique(SysUser user) - { - return userService.checkPhoneUnique(user); - } - - /** - * 校验email邮箱 - */ - @PostMapping("/checkEmailUnique") - @ResponseBody - public boolean checkEmailUnique(SysUser user) - { - return userService.checkEmailUnique(user); - } - - /** - * 用户状态修改 - */ - @Log(title = "用户管理", businessType = BusinessType.UPDATE) - @RequiresPermissions("system:user:edit") - @PostMapping("/changeStatus") - @ResponseBody - public AjaxResult changeStatus(SysUser user) - { - userService.checkUserAllowed(user); - userService.checkUserDataScope(user.getUserId()); - return toAjax(userService.changeStatus(user)); - } - - /** - * 加载部门列表树 - */ - @RequiresPermissions("system:user:list") - @GetMapping("/deptTreeData") - @ResponseBody - public List deptTreeData() - { - List ztrees = deptService.selectDeptTree(new SysDept()); - return ztrees; - } - - /** - * 选择部门树 - * - * @param deptId 部门ID - */ - @RequiresPermissions("system:user:list") - @GetMapping("/selectDeptTree/{deptId}") - public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap) - { - mmap.put("dept", deptService.selectDeptById(deptId)); - return prefix + "/deptTree"; - } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java deleted file mode 100644 index 53ce0f1ba..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.web.controller.tool; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * build 表单构建 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/tool/build") -public class BuildController extends BaseController -{ - private String prefix = "tool/build"; - - @RequiresPermissions("tool:build:view") - @GetMapping() - public String build() - { - return prefix + "/build"; - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java deleted file mode 100644 index 079d7d2a7..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ruoyi.web.controller.tool; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.common.core.controller.BaseController; - -/** - * swagger 接口 - * - * @author ruoyi - */ -@Controller -@RequestMapping("/tool/swagger") -public class SwaggerController extends BaseController -{ - @RequiresPermissions("tool:swagger:view") - @GetMapping() - public String index() - { - return redirect("/swagger-ui/index.html"); - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java index 0cfbfbadb..0b9424507 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java @@ -1,16 +1,25 @@ package com.ruoyi.web.core.config; +import java.util.ArrayList; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.ruoyi.common.config.RuoYiConfig; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.Contact; +import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.SecurityScheme; import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; /** @@ -21,10 +30,18 @@ import springfox.documentation.spring.web.plugins.Docket; @Configuration public class SwaggerConfig { + /** 系统基础配置 */ + @Autowired + private RuoYiConfig ruoyiConfig; + /** 是否开启swagger */ @Value("${swagger.enabled}") private boolean enabled; - + + /** 设置请求的统一前缀 */ + @Value("${swagger.pathMapping}") + private String pathMapping; + /** * 创建API */ @@ -41,10 +58,51 @@ public class SwaggerConfig // 扫描所有有注解的api,用这种方式更灵活 .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // 扫描指定包中的swagger注解 - //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) + // .apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) // 扫描所有 .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) - .build(); + .build() + /* 设置安全模式,swagger可以设置访问token */ + .securitySchemes(securitySchemes()) + .securityContexts(securityContexts()) + .pathMapping(pathMapping); + } + + /** + * 安全模式,这里指定token通过Authorization头请求头传递 + */ + private List securitySchemes() + { + List apiKeyList = new ArrayList(); + apiKeyList.add(new ApiKey("Authorization", "Authorization", In.HEADER.toValue())); + return apiKeyList; + } + + /** + * 安全上下文 + */ + private List securityContexts() + { + List securityContexts = new ArrayList<>(); + securityContexts.add( + SecurityContext.builder() + .securityReferences(defaultAuth()) + .operationSelector(o -> o.requestMappingPattern().matches("/.*")) + .build()); + return securityContexts; + } + + /** + * 默认的安全上引用 + */ + private List defaultAuth() + { + AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); + AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; + authorizationScopes[0] = authorizationScope; + List securityReferences = new ArrayList<>(); + securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); + return securityReferences; } /** @@ -59,9 +117,9 @@ public class SwaggerConfig // 描述 .description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...") // 作者信息 - .contact(new Contact(RuoYiConfig.getName(), null, null)) + .contact(new Contact(ruoyiConfig.getName(), null, null)) // 版本 - .version("版本号:" + RuoYiConfig.getVersion()) + .version("版本号:" + ruoyiConfig.getVersion()) .build(); } } diff --git a/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties b/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties new file mode 100644 index 000000000..37e7b5806 --- /dev/null +++ b/ruoyi-admin/src/main/resources/META-INF/spring-devtools.properties @@ -0,0 +1 @@ +restart.include.json=/com.alibaba.fastjson2.*.jar \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index a69d8feb2..bcfad3eae 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,7 +6,7 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root password: password # 从库数据源 diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 0dc885f68..6db16fbf8 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -3,20 +3,20 @@ ruoyi: # 名称 name: RuoYi # 版本 - version: 4.7.8 + version: 3.8.7 # 版权年份 copyrightYear: 2024 - # 实例演示开关 - demoEnabled: true # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) profile: D:/ruoyi/uploadPath # 获取ip地址开关 addressEnabled: false + # 验证码类型 math 数字计算 char 字符验证 + captchaType: math # 开发环境配置 server: - # 服务器的HTTP端口,默认为80 - port: 80 + # 服务器的HTTP端口,默认为8080 + port: 8080 servlet: # 应用的访问路径 context-path: / @@ -30,7 +30,7 @@ server: max: 800 # Tomcat启动初始化的线程数,默认值10 min-spare: 100 - + # 日志配置 logging: level: @@ -40,24 +40,17 @@ logging: # 用户配置 user: password: - # 密码错误{maxRetryCount}次锁定10分钟 + # 密码最大错误次数 maxRetryCount: 5 + # 密码锁定时间(默认10分钟) + lockTime: 10 # Spring配置 spring: - # 模板引擎 - thymeleaf: - mode: HTML - encoding: utf-8 - # 禁用缓存 - cache: false # 资源信息 messages: # 国际化资源文件路径 - basename: static/i18n/messages - jackson: - time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss + basename: i18n/messages profiles: active: druid # 文件上传 @@ -72,8 +65,39 @@ spring: restart: # 热部署开关 enabled: true + # redis 配置 + redis: + # 地址 + host: localhost + # 端口,默认为6379 + port: 6379 + # 数据库索引 + database: 0 + # 密码 + password: + # 连接超时时间 + timeout: 10s + lettuce: + pool: + # 连接池中的最小空闲连接 + min-idle: 0 + # 连接池中的最大空闲连接 + max-idle: 8 + # 连接池的最大数据库连接数 + max-active: 8 + # #连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms -# MyBatis +# token配置 +token: + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 30 + +# MyBatis配置 mybatis: # 搜索指定包别名 typeAliasesPackage: com.ruoyi.**.domain @@ -88,55 +112,18 @@ pagehelper: supportMethodsArguments: true params: count=countSql -# Shiro -shiro: - user: - # 登录地址 - loginUrl: /login - # 权限认证失败地址 - unauthorizedUrl: /unauth - # 首页地址 - indexUrl: /index - # 验证码开关 - captchaEnabled: true - # 验证码类型 math 数字计算 char 字符验证 - captchaType: math - cookie: - # 设置Cookie的域名 默认空,即当前访问的域名 - domain: - # 设置cookie的有效访问路径 - path: / - # 设置HttpOnly属性 - httpOnly: true - # 设置Cookie的过期时间,天为单位 - maxAge: 30 - # 设置密钥,务必保持唯一性(生成方式,直接拷贝到main运行即可)Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) (默认启动生成随机秘钥,随机秘钥会导致之前客户端RememberMe Cookie无效,如设置固定秘钥RememberMe Cookie则有效) - cipherKey: - session: - # Session超时时间,-1代表永不过期(默认30分钟) - expireTime: 30 - # 同步session到数据库的周期(默认1分钟) - dbSyncPeriod: 1 - # 相隔多久检查一次session的有效性,默认就是10分钟 - validationInterval: 10 - # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制) - maxSession: -1 - # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 - kickoutAfter: false - rememberMe: - # 是否开启记住我 - enabled: true +# Swagger配置 +swagger: + # 是否开启swagger + enabled: true + # 请求前缀 + pathMapping: /dev-api # 防止XSS攻击 xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) - excludes: /system/notice/* + excludes: /system/notice # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* - -# Swagger配置 -swagger: - # 是否开启swagger - enabled: true diff --git a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml b/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml deleted file mode 100644 index 8ffd5ed04..000000000 --- a/ruoyi-admin/src/main/resources/ehcache/ehcache-shiro.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties similarity index 96% rename from ruoyi-admin/src/main/resources/static/i18n/messages.properties rename to ruoyi-admin/src/main/resources/i18n/messages.properties index 02cb2fda6..93de0055b 100644 --- a/ruoyi-admin/src/main/resources/static/i18n/messages.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -1,37 +1,38 @@ -#错误消息 -not.null=* 必须填写 -user.jcaptcha.error=验证码错误 -user.not.exists=用户不存在/密码错误 -user.password.not.match=用户不存在/密码错误 -user.password.retry.limit.count=密码输入错误{0}次 -user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟 -user.password.delete=对不起,您的账号已被删除 -user.blocked=用户已封禁,请联系管理员 -role.blocked=角色已封禁,请联系管理员 -login.blocked=很遗憾,访问IP已被列入系统黑名单 -user.logout.success=退出成功 - -length.not.valid=长度必须在{min}到{max}个字符之间 - -user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 -user.password.not.valid=* 5-50个字符 - -user.email.not.valid=邮箱格式错误 -user.mobile.phone.number.not.valid=手机号格式错误 -user.login.success=登录成功 -user.register.success=注册成功 -user.notfound=请重新登录 -user.forcelogout=管理员强制退出,请重新登录 -user.unknown.error=未知错误,请重新登录 - -##文件上传消息 -upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! -upload.filename.exceed.length=上传的文件名最长{0}个字符 - -##权限 -no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] -no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] -no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] -no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] -no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] -no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] +#错误消息 +not.null=* 必须填写 +user.jcaptcha.error=验证码错误 +user.jcaptcha.expire=验证码已失效 +user.not.exists=用户不存在/密码错误 +user.password.not.match=用户不存在/密码错误 +user.password.retry.limit.count=密码输入错误{0}次 +user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟 +user.password.delete=对不起,您的账号已被删除 +user.blocked=用户已封禁,请联系管理员 +role.blocked=角色已封禁,请联系管理员 +login.blocked=很遗憾,访问IP已被列入系统黑名单 +user.logout.success=退出成功 + +length.not.valid=长度必须在{min}到{max}个字符之间 + +user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头 +user.password.not.valid=* 5-50个字符 + +user.email.not.valid=邮箱格式错误 +user.mobile.phone.number.not.valid=手机号格式错误 +user.login.success=登录成功 +user.register.success=注册成功 +user.notfound=请重新登录 +user.forcelogout=管理员强制退出,请重新登录 +user.unknown.error=未知错误,请重新登录 + +##文件上传消息 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! +upload.filename.exceed.length=上传的文件名最长{0}个字符 + +##权限 +no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] +no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] +no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}] +no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] +no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] +no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js b/ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js deleted file mode 100644 index 4f7dd9273..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/beautifyhtml/beautifyhtml.js +++ /dev/null @@ -1,617 +0,0 @@ -/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */ -/* - - The MIT License (MIT) - - Copyright (c) 2007-2013 Einar Lielmanis and contributors. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - - - Style HTML ---------------- - - Written by Nochum Sossonko, (nsossonko@hotmail.com) - - Based on code initially developed by: Einar Lielmanis, - http://jsbeautifier.org/ - - Usage: - style_html(html_source); - - style_html(html_source, options); - - The options are: - indent_size (default 4) — indentation size, - indent_char (default space) — character to indent with, - max_char (default 250) - maximum amount of characters per line (0 = disable) - brace_style (default "collapse") - "collapse" | "expand" | "end-expand" - put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line. - unformatted (defaults to inline tags) - list of tags, that shouldn't be reformatted - indent_scripts (default normal) - "keep"|"separate"|"normal" - - e.g. - - style_html(html_source, { - 'indent_size': 2, - 'indent_char': ' ', - 'max_char': 78, - 'brace_style': 'expand', - 'unformatted': ['a', 'sub', 'sup', 'b', 'i', 'u'] - }); -*/ - -(function() { - - function style_html(html_source, options, js_beautify, css_beautify) { - //Wrapper function to invoke all the necessary constructors and deal with the output. - - var multi_parser, - indent_size, - indent_character, - max_char, - brace_style, - unformatted; - - options = options || {}; - indent_size = options.indent_size || 4; - indent_character = options.indent_char || ' '; - brace_style = options.brace_style || 'collapse'; - max_char = options.max_char === 0 ? Infinity : options.max_char || 250; - unformatted = options.unformatted || ['a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; - - function Parser() { - - this.pos = 0; //Parser position - this.token = ''; - this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT - this.tags = { //An object to hold tags, their position, and their parent-tags, initiated with default values - parent: 'parent1', - parentcount: 1, - parent1: '' - }; - this.tag_type = ''; - this.token_text = this.last_token = this.last_text = this.token_type = ''; - - this.Utils = { //Uilities made available to the various functions - whitespace: "\n\r\t ".split(''), - single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?='.split(','), //all the single tags for HTML - extra_liners: 'head,body,/html'.split(','), //for tags that need a line of whitespace before them - in_array: function (what, arr) { - for (var i=0; i= this.input.length) { - return content.length?content.join(''):['', 'TK_EOF']; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - this.line_char_count++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { - if (content.length) { - space = true; - } - this.line_char_count--; - continue; //don't want to insert unnecessary space - } - else if (space) { - if (this.line_char_count >= this.max_char) { //insert a line when the max_char is reached - content.push('\n'); - for (var i=0; i', 'igm'); - reg_match.lastIndex = this.pos; - var reg_array = reg_match.exec(this.input); - var end_script = reg_array?reg_array.index:this.input.length; //absolute end of script - if(this.pos < end_script) { //get everything in between the script tags - content = this.input.substring(this.pos, end_script); - this.pos = end_script; - } - return content; - }; - - this.record_tag = function (tag){ //function to record a tag and its parent in this.tags Object - if (this.tags[tag + 'count']) { //check for the existence of this tag type - this.tags[tag + 'count']++; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level - } - else { //otherwise initialize this tag type - this.tags[tag + 'count'] = 1; - this.tags[tag + this.tags[tag + 'count']] = this.indent_level; //and record the present indent level - } - this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; //set the parent (i.e. in the case of a div this.tags.div1parent) - this.tags.parent = tag + this.tags[tag + 'count']; //and make this the current parent (i.e. in the case of a div 'div1') - }; - - this.retrieve_tag = function (tag) { //function to retrieve the opening tag to the corresponding closer - if (this.tags[tag + 'count']) { //if the openener is not in the Object we ignore it - var temp_parent = this.tags.parent; //check to see if it's a closable tag. - while (temp_parent) { //till we reach '' (the initial value); - if (tag + this.tags[tag + 'count'] === temp_parent) { //if this is it use it - break; - } - temp_parent = this.tags[temp_parent + 'parent']; //otherwise keep on climbing up the DOM Tree - } - if (temp_parent) { //if we caught something - this.indent_level = this.tags[tag + this.tags[tag + 'count']]; //set the indent_level accordingly - this.tags.parent = this.tags[temp_parent + 'parent']; //and set the current parent - } - delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; //delete the closed tags parent reference... - delete this.tags[tag + this.tags[tag + 'count']]; //...and the tag itself - if (this.tags[tag + 'count'] === 1) { - delete this.tags[tag + 'count']; - } - else { - this.tags[tag + 'count']--; - } - } - }; - - this.get_tag = function (peek) { //function to get a full tag and parse its type - var input_char = '', - content = [], - comment = '', - space = false, - tag_start, tag_end, - orig_pos = this.pos, - orig_line_char_count = this.line_char_count; - - peek = peek !== undefined ? peek : false; - - do { - if (this.pos >= this.input.length) { - if (peek) { - this.pos = orig_pos; - this.line_char_count = orig_line_char_count; - } - return content.length?content.join(''):['', 'TK_EOF']; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - this.line_char_count++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { //don't want to insert unnecessary space - space = true; - this.line_char_count--; - continue; - } - - if (input_char === "'" || input_char === '"') { - if (!content[1] || content[1] !== '!') { //if we're in a comment strings don't get treated specially - input_char += this.get_unformatted(input_char); - space = true; - } - } - - if (input_char === '=') { //no space before = - space = false; - } - - if (content.length && content[content.length-1] !== '=' && input_char !== '>' && space) { - //no space after = or before > - if (this.line_char_count >= this.max_char) { - this.print_newline(false, content); - this.line_char_count = 0; - } - else { - content.push(' '); - this.line_char_count++; - } - space = false; - } - if (input_char === '<') { - tag_start = this.pos - 1; - } - content.push(input_char); //inserts character at-a-time (or string) - } while (input_char !== '>'); - - var tag_complete = content.join(''); - var tag_index; - if (tag_complete.indexOf(' ') !== -1) { //if there's whitespace, thats where the tag name ends - tag_index = tag_complete.indexOf(' '); - } - else { //otherwise go with the tag ending - tag_index = tag_complete.indexOf('>'); - } - var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); - if (tag_complete.charAt(tag_complete.length-2) === '/' || - this.Utils.in_array(tag_check, this.Utils.single_token)) { //if this tag name is a single tag type (either in the list or has a closing /) - if ( ! peek) { - this.tag_type = 'SINGLE'; - } - } - else if (tag_check === 'script') { //for later script handling - if ( ! peek) { - this.record_tag(tag_check); - this.tag_type = 'SCRIPT'; - } - } - else if (tag_check === 'style') { //for future style handling (for now it justs uses get_content) - if ( ! peek) { - this.record_tag(tag_check); - this.tag_type = 'STYLE'; - } - } - else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags - comment = this.get_unformatted('', tag_complete); //...delegate to get_unformatted function - content.push(comment); - // Preserve collapsed whitespace either before or after this tag. - if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)){ - content.splice(0, 0, this.input.charAt(tag_start - 1)); - } - tag_end = this.pos - 1; - if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)){ - content.push(this.input.charAt(tag_end + 1)); - } - this.tag_type = 'SINGLE'; - } - else if (tag_check.charAt(0) === '!') { //peek for so... - comment = this.get_unformatted('-->', tag_complete); //...delegate to get_unformatted - content.push(comment); - } - if ( ! peek) { - this.tag_type = 'START'; - } - } - else if (tag_check.indexOf('[endif') !== -1) {//peek for ', tag_complete); - content.push(comment); - this.tag_type = 'SINGLE'; - } - } - else if ( ! peek) { - if (tag_check.charAt(0) === '/') { //this tag is a double tag so check for tag-ending - this.retrieve_tag(tag_check.substring(1)); //remove it and all ancestors - this.tag_type = 'END'; - } - else { //otherwise it's a start-tag - this.record_tag(tag_check); //push it on the tag stack - this.tag_type = 'START'; - } - if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { //check if this double needs an extra line - this.print_newline(true, this.output); - } - } - - if (peek) { - this.pos = orig_pos; - this.line_char_count = orig_line_char_count; - } - - return content.join(''); //returns fully formatted tag - }; - - this.get_unformatted = function (delimiter, orig_tag) { //function to return unformatted content in its entirety - - if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) { - return ''; - } - var input_char = ''; - var content = ''; - var space = true; - do { - - if (this.pos >= this.input.length) { - return content; - } - - input_char = this.input.charAt(this.pos); - this.pos++; - - if (this.Utils.in_array(input_char, this.Utils.whitespace)) { - if (!space) { - this.line_char_count--; - continue; - } - if (input_char === '\n' || input_char === '\r') { - content += '\n'; - /* Don't change tab indention for unformatted blocks. If using code for html editing, this will greatly affect
 tags if they are specified in the 'unformatted array'
-                for (var i=0; i]*>\s*$/);
-
-            // if next_tag comes back but is not an isolated tag, then
-            // let's treat the 'a' tag as having content
-            // and respect the unformatted option
-            if (!tag || this.Utils.in_array(tag, unformatted)){
-                return true;
-            } else {
-                return false;
-            }
-        };
-
-        this.printer = function (js_source, indent_character, indent_size, max_char, brace_style) { //handles input/output and some other printing functions
-
-          this.input = js_source || ''; //gets the input for the Parser
-          this.output = [];
-          this.indent_character = indent_character;
-          this.indent_string = '';
-          this.indent_size = indent_size;
-          this.brace_style = brace_style;
-          this.indent_level = 0;
-          this.max_char = max_char;
-          this.line_char_count = 0; //count to see if max_char was exceeded
-
-          for (var i=0; i 0) {
-              this.indent_level--;
-            }
-          };
-        };
-        return this;
-      }
-
-      /*_____________________--------------------_____________________*/
-
-      multi_parser = new Parser(); //wrapping functions Parser
-      multi_parser.printer(html_source, indent_character, indent_size, max_char, brace_style); //initialize starting values
-
-      while (true) {
-          var t = multi_parser.get_token();
-          multi_parser.token_text = t[0];
-          multi_parser.token_type = t[1];
-
-        if (multi_parser.token_type === 'TK_EOF') {
-          break;
-        }
-
-        switch (multi_parser.token_type) {
-          case 'TK_TAG_START':
-            multi_parser.print_newline(false, multi_parser.output);
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.indent();
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_STYLE':
-          case 'TK_TAG_SCRIPT':
-            multi_parser.print_newline(false, multi_parser.output);
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_END':
-            //Print new line only if the tag has no content and has child
-            if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
-                var tag_name = multi_parser.token_text.match(/\w+/)[0];
-                var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
-                if (tag_extracted_from_last_output === null || tag_extracted_from_last_output[1] !== tag_name) {
-                    multi_parser.print_newline(true, multi_parser.output);
-                }
-            }
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_TAG_SINGLE':
-            // Don't add a newline before elements that should remain unformatted.
-            var tag_check = multi_parser.token_text.match(/^\s*<([a-z]+)/i);
-            if (!tag_check || !multi_parser.Utils.in_array(tag_check[1], unformatted)){
-                multi_parser.print_newline(false, multi_parser.output);
-            }
-            multi_parser.print_token(multi_parser.token_text);
-            multi_parser.current_mode = 'CONTENT';
-            break;
-          case 'TK_CONTENT':
-            if (multi_parser.token_text !== '') {
-              multi_parser.print_token(multi_parser.token_text);
-            }
-            multi_parser.current_mode = 'TAG';
-            break;
-          case 'TK_STYLE':
-          case 'TK_SCRIPT':
-            if (multi_parser.token_text !== '') {
-              multi_parser.output.push('\n');
-              var text = multi_parser.token_text,
-                  _beautifier,
-                  script_indent_level = 1;
-              if (multi_parser.token_type === 'TK_SCRIPT') {
-                _beautifier = typeof js_beautify === 'function' && js_beautify;
-              } else if (multi_parser.token_type === 'TK_STYLE') {
-                _beautifier = typeof css_beautify === 'function' && css_beautify;
-              }
-
-              if (options.indent_scripts === "keep") {
-                script_indent_level = 0;
-              } else if (options.indent_scripts === "separate") {
-                script_indent_level = -multi_parser.indent_level;
-              }
-
-              var indentation = multi_parser.get_full_indent(script_indent_level);
-              if (_beautifier) {
-                // call the Beautifier if avaliable
-                text = _beautifier(text.replace(/^\s*/, indentation), options);
-              } else {
-                // simply indent the string otherwise
-                var white = text.match(/^\s*/)[0];
-                var _level = white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length - 1;
-                var reindent = multi_parser.get_full_indent(script_indent_level -_level);
-                text = text.replace(/^\s*/, indentation)
-                       .replace(/\r\n|\r|\n/g, '\n' + reindent)
-                       .replace(/\s*$/, '');
-              }
-              if (text) {
-                multi_parser.print_token(text);
-                multi_parser.print_newline(true, multi_parser.output);
-              }
-            }
-            multi_parser.current_mode = 'TAG';
-            break;
-        }
-        multi_parser.last_token = multi_parser.token_type;
-        multi_parser.last_text = multi_parser.token_text;
-      }
-      return multi_parser.output.join('');
-    }
-
-    // If we're running a web page and don't have either of the above, add our one global
-    window.html_beautify = function(html_source, options) {
-        return style_html(html_source, options, window.js_beautify, window.css_beautify);
-    };
-
-}());
diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js b/ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
deleted file mode 100644
index 8a9d70893..000000000
--- a/ruoyi-admin/src/main/resources/static/ajax/libs/blockUI/jquery.blockUI.js
+++ /dev/null
@@ -1,620 +0,0 @@
-/*!
- * jQuery blockUI plugin
- * Version 2.70.0-2014.11.23
- * Requires jQuery v1.7 or later
- *
- * Examples at: http://malsup.com/jquery/block/
- * Copyright (c) 2007-2013 M. Alsup
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Thanks to Amir-Hossein Sobhi for some excellent contributions!
- */
-
-;(function() {
-/*jshint eqeqeq:false curly:false latedef:false */
-"use strict";
-
-	function setup($) {
-		$.fn._fadeIn = $.fn.fadeIn;
-
-		var noOp = $.noop || function() {};
-
-		// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
-		// confusing userAgent strings on Vista)
-		var msie = /MSIE/.test(navigator.userAgent);
-		var ie6  = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
-		var mode = document.documentMode || 0;
-		var setExpr = $.isFunction( document.createElement('div').style.setExpression );
-
-		// global $ methods for blocking/unblocking the entire page
-		$.blockUI   = function(opts) { install(window, opts); };
-		$.unblockUI = function(opts) { remove(window, opts); };
-
-		// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)
-		$.growlUI = function(title, message, timeout, onClose) {
-			var $m = $('
'); - if (title) $m.append('

'+title+'

'); - if (message) $m.append('

'+message+'

'); - if (timeout === undefined) timeout = 3000; - - // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications - var callBlock = function(opts) { - opts = opts || {}; - - $.blockUI({ - message: $m, - fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700, - fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000, - timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout, - centerY: false, - showOverlay: false, - onUnblock: onClose, - css: $.blockUI.defaults.growlCSS - }); - }; - - callBlock(); - var nonmousedOpacity = $m.css('opacity'); - $m.mouseover(function() { - callBlock({ - fadeIn: 0, - timeout: 30000 - }); - - var displayBlock = $('.blockMsg'); - displayBlock.stop(); // cancel fadeout if it has started - displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency - }).mouseout(function() { - $('.blockMsg').fadeOut(1000); - }); - // End konapun additions - }; - - // plugin method for blocking element content - $.fn.block = function(opts) { - if ( this[0] === window ) { - $.blockUI( opts ); - return this; - } - var fullOpts = $.extend({}, $.blockUI.defaults, opts || {}); - this.each(function() { - var $el = $(this); - if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked')) - return; - $el.unblock({ fadeOut: 0 }); - }); - - return this.each(function() { - if ($.css(this,'position') == 'static') { - this.style.position = 'relative'; - $(this).data('blockUI.static', true); - } - this.style.zoom = 1; // force 'hasLayout' in ie - install(this, opts); - }); - }; - - // plugin method for unblocking element content - $.fn.unblock = function(opts) { - if ( this[0] === window ) { - $.unblockUI( opts ); - return this; - } - return this.each(function() { - remove(this, opts); - }); - }; - - $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost! - - // override these in your code to change the default behavior and style - $.blockUI.defaults = { - // message displayed when blocking (use null for no message) - message: '
加载中......
', - - title: null, // title string; only used when theme == true - draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) - - theme: false, // set to true to use with jQuery UI themes - - // styles for the message when blocking; if you wish to disable - // these and use an external stylesheet then do this in your code: - // $.blockUI.defaults.css = {}; - css: { - padding: 0, - margin: 0, - width: '30%', - top: '40%', - left: '35%', - textAlign: 'center', - color: '#000', - border: '0px', - backgroundColor:'transparent', - cursor: 'wait' - }, - - // minimal style set used when themes are used - themedCSS: { - width: '30%', - top: '40%', - left: '35%' - }, - - // styles for the overlay - overlayCSS: { - backgroundColor: '#000', - opacity: 0.6, - cursor: 'wait' - }, - - // style to replace wait cursor before unblocking to correct issue - // of lingering wait cursor - cursorReset: 'default', - - // styles applied when using $.growlUI - growlCSS: { - width: '350px', - top: '10px', - left: '', - right: '10px', - border: 'none', - padding: '5px', - opacity: 0.6, - cursor: 'default', - color: '#fff', - backgroundColor: '#000', - '-webkit-border-radius':'10px', - '-moz-border-radius': '10px', - 'border-radius': '10px' - }, - - // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w - // (hat tip to Jorge H. N. de Vasconcelos) - /*jshint scripturl:true */ - iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', - - // force usage of iframe in non-IE browsers (handy for blocking applets) - forceIframe: false, - - // z-index for the blocking overlay - baseZ: 1000, - - // set these to true to have the message automatically centered - centerX: true, // <-- only effects element blocking (page block controlled via css above) - centerY: true, - - // allow body element to be stetched in ie6; this makes blocking look better - // on "short" pages. disable if you wish to prevent changes to the body height - allowBodyStretch: true, - - // enable if you want key and mouse events to be disabled for content that is blocked - bindEvents: true, - - // be default blockUI will supress tab navigation from leaving blocking content - // (if bindEvents is true) - constrainTabKey: true, - - // fadeIn time in millis; set to 0 to disable fadeIn on block - fadeIn: 200, - - // fadeOut time in millis; set to 0 to disable fadeOut on unblock - fadeOut: 400, - - // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock - timeout: 0, - - // disable if you don't want to show the overlay - showOverlay: true, - - // if true, focus will be placed in the first available input field when - // page blocking - focusInput: true, - - // elements that can receive focus - focusableElements: ':input:enabled:visible', - - // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) - // no longer needed in 2012 - // applyPlatformOpacityRules: true, - - // callback method invoked when fadeIn has completed and blocking message is visible - onBlock: null, - - // callback method invoked when unblocking has completed; the callback is - // passed the element that has been unblocked (which is the window object for page - // blocks) and the options that were passed to the unblock call: - // onUnblock(element, options) - onUnblock: null, - - // callback method invoked when the overlay area is clicked. - // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used. - onOverlayClick: null, - - // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 - quirksmodeOffsetHack: 4, - - // class name of the message block - blockMsgClass: 'blockMsg', - - // if it is already blocked, then ignore it (don't unblock and reblock) - ignoreIfBlocked: false - }; - - // private data and functions follow... - - var pageBlock = null; - var pageBlockEls = []; - - function install(el, opts) { - var css, themedCSS; - var full = (el == window); - var msg = (opts && opts.message !== undefined ? opts.message : undefined); - opts = $.extend({}, $.blockUI.defaults, opts || {}); - - if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked')) - return; - - opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); - css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); - if (opts.onOverlayClick) - opts.overlayCSS.cursor = 'pointer'; - - themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); - msg = msg === undefined ? opts.message : msg; - - // remove the current block (if there is one) - if (full && pageBlock) - remove(window, {fadeOut:0}); - - // if an existing element is being used as the blocking content then we capture - // its current place in the DOM (and current display style) so we can restore - // it when we unblock - if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { - var node = msg.jquery ? msg[0] : msg; - var data = {}; - $(el).data('blockUI.history', data); - data.el = node; - data.parent = node.parentNode; - data.display = node.style.display; - data.position = node.style.position; - if (data.parent) - data.parent.removeChild(node); - } - - $(el).data('blockUI.onUnblock', opts.onUnblock); - var z = opts.baseZ; - - // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; - // layer1 is the iframe layer which is used to supress bleed through of underlying content - // layer2 is the overlay layer which has opacity and a wait cursor (by default) - // layer3 is the message content that is displayed while blocking - var lyr1, lyr2, lyr3, s; - if (msie || opts.forceIframe) - lyr1 = $(''); - else - lyr1 = $(''); - - if (opts.theme) - lyr2 = $(''); - else - lyr2 = $(''); - - if (opts.theme && full) { - s = ''; - } - else if (opts.theme) { - s = ''; - } - else if (full) { - s = ''; - } - else { - s = ''; - } - lyr3 = $(s); - - // if we have a message, style it - if (msg) { - if (opts.theme) { - lyr3.css(themedCSS); - lyr3.addClass('ui-widget-content'); - } - else - lyr3.css(css); - } - - // style the overlay - if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/) - lyr2.css(opts.overlayCSS); - lyr2.css('position', full ? 'fixed' : 'absolute'); - - // make iframe layer transparent in IE - if (msie || opts.forceIframe) - lyr1.css('opacity',0.0); - - //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); - var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); - $.each(layers, function() { - this.appendTo($par); - }); - - if (opts.theme && opts.draggable && $.fn.draggable) { - lyr3.draggable({ - handle: '.ui-dialog-titlebar', - cancel: 'li' - }); - } - - // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) - var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0); - if (ie6 || expr) { - // give body 100% height - if (full && opts.allowBodyStretch && $.support.boxModel) - $('html,body').css('height','100%'); - - // fix ie6 issue when blocked element has a border width - if ((ie6 || !$.support.boxModel) && !full) { - var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); - var fixT = t ? '(0 - '+t+')' : 0; - var fixL = l ? '(0 - '+l+')' : 0; - } - - // simulate fixed position - $.each(layers, function(i,o) { - var s = o[0].style; - s.position = 'absolute'; - if (i < 2) { - if (full) - s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'); - else - s.setExpression('height','this.parentNode.offsetHeight + "px"'); - if (full) - s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'); - else - s.setExpression('width','this.parentNode.offsetWidth + "px"'); - if (fixL) s.setExpression('left', fixL); - if (fixT) s.setExpression('top', fixT); - } - else if (opts.centerY) { - if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); - s.marginTop = 0; - } - else if (!opts.centerY && full) { - var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0; - var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; - s.setExpression('top',expression); - } - }); - } - - // show the message - if (msg) { - if (opts.theme) - lyr3.find('.ui-widget-content').append(msg); - else - lyr3.append(msg); - if (msg.jquery || msg.nodeType) - $(msg).show(); - } - - if ((msie || opts.forceIframe) && opts.showOverlay) - lyr1.show(); // opacity is zero - if (opts.fadeIn) { - var cb = opts.onBlock ? opts.onBlock : noOp; - var cb1 = (opts.showOverlay && !msg) ? cb : noOp; - var cb2 = msg ? cb : noOp; - if (opts.showOverlay) - lyr2._fadeIn(opts.fadeIn, cb1); - if (msg) - lyr3._fadeIn(opts.fadeIn, cb2); - } - else { - if (opts.showOverlay) - lyr2.show(); - if (msg) - lyr3.show(); - if (opts.onBlock) - opts.onBlock.bind(lyr3)(); - } - - // bind key and mouse events - bind(1, el, opts); - - if (full) { - pageBlock = lyr3[0]; - pageBlockEls = $(opts.focusableElements,pageBlock); - if (opts.focusInput) - setTimeout(focus, 20); - } - else - center(lyr3[0], opts.centerX, opts.centerY); - - if (opts.timeout) { - // auto-unblock - var to = setTimeout(function() { - if (full) - $.unblockUI(opts); - else - $(el).unblock(opts); - }, opts.timeout); - $(el).data('blockUI.timeout', to); - } - } - - // remove the block - function remove(el, opts) { - var count; - var full = (el == window); - var $el = $(el); - var data = $el.data('blockUI.history'); - var to = $el.data('blockUI.timeout'); - if (to) { - clearTimeout(to); - $el.removeData('blockUI.timeout'); - } - opts = $.extend({}, $.blockUI.defaults, opts || {}); - bind(0, el, opts); // unbind events - - if (opts.onUnblock === null) { - opts.onUnblock = $el.data('blockUI.onUnblock'); - $el.removeData('blockUI.onUnblock'); - } - - var els; - if (full) // crazy selector to handle odd field errors in ie6/7 - els = $('body').children().filter('.blockUI').add('body > .blockUI'); - else - els = $el.find('>.blockUI'); - - // fix cursor issue - if ( opts.cursorReset ) { - if ( els.length > 1 ) - els[1].style.cursor = opts.cursorReset; - if ( els.length > 2 ) - els[2].style.cursor = opts.cursorReset; - } - - if (full) - pageBlock = pageBlockEls = null; - - if (opts.fadeOut) { - count = els.length; - els.stop().fadeOut(opts.fadeOut, function() { - if ( --count === 0) - reset(els,data,opts,el); - }); - } - else - reset(els, data, opts, el); - } - - // move blocking element back into the DOM where it started - function reset(els,data,opts,el) { - var $el = $(el); - if ( $el.data('blockUI.isBlocked') ) - return; - - els.each(function(i,o) { - // remove via DOM calls so we don't lose event handlers - if (this.parentNode) - this.parentNode.removeChild(this); - }); - - if (data && data.el) { - data.el.style.display = data.display; - data.el.style.position = data.position; - data.el.style.cursor = 'default'; // #59 - if (data.parent) - data.parent.appendChild(data.el); - $el.removeData('blockUI.history'); - } - - if ($el.data('blockUI.static')) { - $el.css('position', 'static'); // #22 - } - - if (typeof opts.onUnblock == 'function') - opts.onUnblock(el,opts); - - // fix issue in Safari 6 where block artifacts remain until reflow - var body = $(document.body), w = body.width(), cssW = body[0].style.width; - body.width(w-1).width(w); - body[0].style.width = cssW; - } - - // bind/unbind the handler - function bind(b, el, opts) { - var full = el == window, $el = $(el); - - // don't bother unbinding if there is nothing to unbind - if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) - return; - - $el.data('blockUI.isBlocked', b); - - // don't bind events when overlay is not in use or if bindEvents is false - if (!full || !opts.bindEvents || (b && !opts.showOverlay)) - return; - - // bind anchors and inputs for mouse and key events - var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove'; - if (b) - $(document).bind(events, opts, handler); - else - $(document).unbind(events, handler); - - // former impl... - // var $e = $('a,:input'); - // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); - } - - // event handler to suppress keyboard/mouse events when blocking - function handler(e) { - // allow tab navigation (conditionally) - if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) { - if (pageBlock && e.data.constrainTabKey) { - var els = pageBlockEls; - var fwd = !e.shiftKey && e.target === els[els.length-1]; - var back = e.shiftKey && e.target === els[0]; - if (fwd || back) { - setTimeout(function(){focus(back);},10); - return false; - } - } - } - var opts = e.data; - var target = $(e.target); - if (target.hasClass('blockOverlay') && opts.onOverlayClick) - opts.onOverlayClick(e); - - // allow events within the message content - if (target.parents('div.' + opts.blockMsgClass).length > 0) - return true; - - // allow events for content that is not being blocked - return target.parents().children().filter('div.blockUI').length === 0; - } - - function focus(back) { - if (!pageBlockEls) - return; - var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; - if (e) - e.focus(); - } - - function center(el, x, y) { - var p = el.parentNode, s = el.style; - var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); - var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); - if (x) s.left = l > 0 ? (l+'px') : '0'; - if (y) s.top = t > 0 ? (t+'px') : '0'; - } - - function sz(el, p) { - return parseInt($.css(el,p),10)||0; - } - - } - - - /*global define:true */ - if (typeof define === 'function' && define.amd && define.amd.jQuery) { - define(['jquery'], setup); - } else { - setup(jQuery); - } - -})(); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css deleted file mode 100644 index b6c0062b0..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.css +++ /dev/null @@ -1,688 +0,0 @@ -/*! - * bootstrap-fileinput v5.5.2 - * http://plugins.krajee.com/file-input - * - * Krajee default styling for bootstrap-fileinput. - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ - -.file-loading input[type=file], -input[type=file].file-loading { - width: 0; - height: 0; -} - -.file-no-browse { - position: absolute; - left: 50%; - bottom: 20%; - width: 1px; - height: 1px; - font-size: 0; - opacity: 0; - border: none; - background: none; - outline: none; - box-shadow: none; -} - -.kv-hidden, -.file-caption-icon, -.file-zoom-dialog .modal-header:before, -.file-zoom-dialog .modal-header:after, -.file-input-new .file-preview, -.file-input-new .close, -.file-input-new .glyphicon-file, -.file-input-new .fileinput-remove-button, -.file-input-new .fileinput-upload-button, -.file-input-new .no-browse .input-group-btn, -.file-input-ajax-new .fileinput-remove-button, -.file-input-ajax-new .fileinput-upload-button, -.file-input-ajax-new .no-browse .input-group-btn, -.hide-content .kv-file-content, -.is-locked .fileinput-upload-button, -.is-locked .fileinput-remove-button { - display: none; -} - -.file-caption .input-group { - align-items: center; -} - -.btn-file input[type=file], -.file-caption-icon, -.file-preview .fileinput-remove, -.krajee-default .file-thumb-progress, -.file-zoom-dialog .btn-navigate, -.file-zoom-dialog .floating-buttons { - position: absolute; -} - -.file-caption-icon .kv-caption-icon { - line-height: inherit; -} - -.file-input, -.file-loading:before, -.btn-file, -.file-caption, -.file-preview, -.krajee-default.file-preview-frame, -.krajee-default .file-thumbnail-footer, -.file-zoom-dialog .modal-dialog { - position: relative; -} - -.file-error-message pre, -.file-error-message ul, -.krajee-default .file-actions, -.krajee-default .file-other-error { - text-align: left; -} - -.file-error-message pre, -.file-error-message ul { - margin: 0; -} - -.krajee-default .file-drag-handle, -.krajee-default .file-upload-indicator { - float: left; - margin-top: 10px; - width: 16px; - height: 16px; -} - -.file-thumb-progress .progress, -.file-thumb-progress .progress-bar { - font-family: Verdana, Helvetica, sans-serif; - font-size: 0.7rem; -} - -.krajee-default .file-thumb-progress .progress, -.kv-upload-progress .progress { - background-color: #ccc; -} - -.krajee-default .file-caption-info, -.krajee-default .file-size-info { - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: 160px; - height: 15px; - margin: auto; -} - -.file-zoom-content > .file-object.type-video, -.file-zoom-content > .file-object.type-flash, -.file-zoom-content > .file-object.type-image { - max-width: 100%; - max-height: 100%; - width: auto; -} - -.file-zoom-content > .file-object.type-video, -.file-zoom-content > .file-object.type-flash { - height: 100%; -} - -.file-zoom-content > .file-object.type-pdf, -.file-zoom-content > .file-object.type-html, -.file-zoom-content > .file-object.type-text, -.file-zoom-content > .file-object.type-default { - width: 100%; -} - -.file-loading:before { - content: " Loading..."; - display: inline-block; - padding-left: 20px; - line-height: 16px; - font-size: 13px; - font-variant: small-caps; - color: #999; - background: transparent url(loading.gif) top left no-repeat; -} - -.file-object { - margin: 0 0 -5px 0; - padding: 0; -} - -.btn-file { - overflow: hidden; -} - -.btn-file input[type=file] { - top: 0; - left: 0; - min-width: 100%; - min-height: 100%; - text-align: right; - opacity: 0; - background: none repeat scroll 0 0 transparent; - cursor: inherit; - display: block; -} - -.btn-file ::-ms-browse { - font-size: 10000px; - width: 100%; - height: 100%; -} - -.file-caption.icon-visible .file-caption-icon { - display: inline-block; -} - -.file-caption.icon-visible .file-caption-name { - padding-left: 25px; -} - -.file-caption.icon-visible > .input-group-lg .file-caption-name { - padding-left: 30px; -} - -.file-caption.icon-visible > .input-group-sm .file-caption-name { - padding-left: 22px; -} - -.file-caption-name:not(.file-caption-disabled) { - background-color: transparent; -} - -.file-caption-name.file-processing { - font-style: italic; - border-color: #bbb; - opacity: 0.5; -} - -.file-caption-icon { - padding: 7px 5px; - left: 4px; -} - -.input-group-lg .file-caption-icon { - font-size: 1.25rem; -} - -.input-group-sm .file-caption-icon { - font-size: 0.875rem; - padding: 0.25rem; -} - -.file-error-message { - color: #a94442; - background-color: #f2dede; - margin: 5px; - border: 1px solid #ebccd1; - border-radius: 4px; - padding: 15px; -} - -.file-error-message pre { - margin: 5px 0; -} - -.file-caption-disabled { - background-color: #eee; - cursor: not-allowed; - opacity: 1; -} - -.file-preview { - border-radius: 5px; - border: 1px solid #ddd; - padding: 8px; - width: 100%; - margin-bottom: 5px; -} - -.file-preview .btn-xs { - padding: 1px 5px; - font-size: 12px; - line-height: 1.5; - border-radius: 3px; -} - -.file-preview .fileinput-remove { - top: 1px; - right: 1px; - line-height: 10px; -} - -.file-preview .clickable { - cursor: pointer; -} - -.file-preview-image { - font: 40px Impact, Charcoal, sans-serif; - color: #008000; - width: auto; - height: auto; - max-width: 100%; - max-height: 100%; -} - -.krajee-default.file-preview-frame { - margin: 8px; - border: 1px solid rgba(0, 0, 0, 0.2); - box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.2); - padding: 6px; - float: left; - text-align: center; - -} - -.krajee-default.file-preview-frame .kv-file-content { - width: 213px; - height: 160px; -} - -.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { - width: 400px; -} - -.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content { - width: 240px; - height: 55px; -} - -.krajee-default.file-preview-frame .file-thumbnail-footer { - height: 70px; -} - -.krajee-default.file-preview-frame:not(.file-preview-error):hover { - border: 1px solid rgba(0, 0, 0, 0.3); - box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.4); -} - -.krajee-default .file-preview-text { - color: #428bca; - border: 1px solid #ddd; - outline: none; - resize: none; -} - -.krajee-default .file-preview-html { - border: 1px solid #ddd; -} - -.krajee-default .file-other-icon { - font-size: 6em; - line-height: 1; -} - -.krajee-default .file-footer-buttons { - float: right; -} - -.krajee-default .file-footer-caption { - display: block; - text-align: center; - padding-top: 4px; - font-size: 11px; - color: #999; - margin-bottom: 30px; -} - -.file-upload-stats { - font-size: 10px; - text-align: center; - width: 100%; -} - -.kv-upload-progress .file-upload-stats { - font-size: 12px; - margin: -10px 0 5px; -} - -.krajee-default .file-preview-error { - opacity: 0.65; - box-shadow: none; -} - -.krajee-default .file-thumb-progress { - top: 37px; - left: 0; - right: 0; -} - -.krajee-default.kvsortable-ghost { - background: #e1edf7; - border: 2px solid #a1abff; -} - -.krajee-default .file-preview-other:hover { - opacity: 0.8; -} - -.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover { - color: #000; -} - -.kv-upload-progress .progress { - height: 20px; - margin: 10px 0; - overflow: hidden; -} - -.kv-upload-progress .progress-bar { - height: 20px; - font-family: Verdana, Helvetica, sans-serif; -} - - -/*noinspection CssOverwrittenProperties*/ - -.file-zoom-dialog .file-other-icon { - font-size: 22em; - font-size: 50vmin; -} - -.file-zoom-dialog .modal-dialog { - width: auto; -} - -.file-zoom-dialog .modal-header { - display: flex; - align-items: center; - justify-content: space-between; -} - -.file-zoom-dialog .btn-navigate { - margin: 0 0.1rem; - padding: 0; - font-size: 1.2rem; - width: 2.4rem; - height: 2.4rem; - top: 50%; - border-radius: 50%; - text-align: center; -} - -.btn-navigate * { - width: auto; -} - -.file-zoom-dialog .floating-buttons { - top: 5px; - right: 10px; -} - -.file-zoom-dialog .btn-kv-prev { - left: 0; -} - -.file-zoom-dialog .btn-kv-next { - right: 0; -} - -.file-zoom-dialog .kv-zoom-header { - padding: 0.5rem; -} - -.file-zoom-dialog .kv-zoom-body { - padding: 0.25rem; -} - -.file-zoom-dialog .kv-zoom-description { - position: absolute; - opacity: 0.8; - font-size: 0.8rem; - background-color: #1a1a1a; - padding: 1rem; - text-align: center; - border-radius: 0.5rem; - color: #fff; - left: 15%; - right: 15%; - bottom: 15%; -} - -.file-zoom-dialog .kv-desc-hide { - float: right; - color: #fff; - padding: 0 0.1rem; - background: none; - border: none; -} - -.file-zoom-dialog .kv-desc-hide:hover { - opacity: 0.7; -} - -.file-zoom-dialog .kv-desc-hide:focus { - opacity: 0.9; -} - -.file-input-new .no-browse .form-control { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.file-input-ajax-new .no-browse .form-control { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; -} - -.file-caption { - width: 100%; - position: relative; -} - -.file-thumb-loading { - background: transparent url(loading.gif) no-repeat scroll center center content-box !important; -} - -.file-drop-zone { - border: 1px dashed #aaa; - min-height: 260px; - border-radius: 4px; - text-align: center; - vertical-align: middle; - margin: 12px 15px 12px 12px; - padding: 5px; -} - -.file-drop-zone.clickable:hover { - border: 2px dashed #999; -} - -.file-drop-zone.clickable:focus { - border: 2px solid #5acde2; -} - -.file-drop-zone .file-preview-thumbnails { - cursor: default; -} - -.file-drop-zone-title { - color: #aaa; - font-size: 1.6em; - text-align: center; - padding: 85px 10px; - cursor: default; -} - -.file-highlighted { - border: 2px dashed #999 !important; - background-color: #eee; -} - -.file-uploading { - background: url(loading-sm.gif) no-repeat center bottom 10px; - opacity: 0.65; -} - -.file-zoom-fullscreen .modal-dialog { - min-width: 100%; - margin: 0; -} - -.file-zoom-fullscreen .modal-content { - border-radius: 0; - box-shadow: none; - min-height: 100vh; -} - -.file-zoom-fullscreen .kv-zoom-body { - overflow-y: auto; -} - -.floating-buttons { - z-index: 3000; -} - -.floating-buttons .btn-kv { - margin-left: 3px; - z-index: 3000; -} - -.kv-zoom-actions { - min-width: 140px; -} - -.kv-zoom-actions .btn-kv { - margin-left: 3px; -} - -.file-zoom-content { - text-align: center; - white-space: nowrap; - min-height: 300px; -} - -.file-zoom-content:hover { - background: transparent; -} - -.file-zoom-content .file-preview-image { - max-height: 100%; -} - -.file-zoom-content .file-preview-video { - max-height: 100%; -} - -.file-zoom-content > .file-object.type-image { - height: auto; - min-height: inherit; -} - -.file-zoom-content > .file-object.type-audio { - width: auto; - height: 30px; -} - -@media (min-width: 576px) { - .file-zoom-dialog .modal-dialog { - max-width: 500px; - } -} - -@media (min-width: 992px) { - .file-zoom-dialog .modal-lg { - max-width: 800px; - } -} - -@media (max-width: 767px) { - .file-preview-thumbnails { - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; - } - - .file-zoom-dialog .modal-header { - flex-direction: column; - } -} - -@media (max-width: 350px) { - .krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content { - width: 160px; - } -} - -@media (max-width: 420px) { - .krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered { - width: 100%; - } -} - -.file-loading[dir=rtl]:before { - background: transparent url(loading.gif) top right no-repeat; - padding-left: 0; - padding-right: 20px; -} - -.clickable .file-drop-zone-title { - cursor: pointer; -} - -.file-sortable .file-drag-handle:hover { - opacity: 0.7; -} - -.file-sortable .file-drag-handle { - cursor: grab; - opacity: 1; -} - -.file-grabbing, -.file-grabbing * { - cursor: not-allowed !important; -} - -.file-grabbing .file-preview-thumbnails * { - cursor: grabbing !important; -} - -.file-preview-frame.sortable-chosen { - background-color: #d9edf7; - border-color: #17a2b8; - box-shadow: none !important; -} - -.file-preview .kv-zoom-cache { - display: none; -} - -.file-preview-other-frame, .file-preview-object, .kv-file-content, .kv-zoom-body { - display: flex; - align-items: center; - justify-content: center; -} - -.btn-kv-rotate, -.kv-file-rotate { - display: none; -} - -.rotatable:not(.hide-rotate) .btn-kv-rotate, -.rotatable:not(.hide-rotate) .kv-file-rotate { - display: inline-block; -} - -.rotatable .file-zoom-detail, -.rotatable .kv-file-content, -.rotatable .kv-file-content > :first-child { - transform-origin: center center; -} - -.rotate-animate { - transition: transform 0.3s ease; -} - -.kv-overflow-hidden { - overflow: hidden; -} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js deleted file mode 100644 index 75466c06f..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.js +++ /dev/null @@ -1,6681 +0,0 @@ -/*! - * bootstrap-fileinput v5.5.2 - * http://plugins.krajee.com/file-input - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ -(function (factory) { - 'use strict'; - if (typeof define === 'function' && define.amd) { - define(['jquery'], factory); - } else if (typeof module === 'object' && typeof module.exports === 'object') { - factory(require('jquery')); - } else { - factory(window.jQuery); - } -}(function ($) { - 'use strict'; - - $.fn.fileinputLocales = {}; - $.fn.fileinputThemes = {}; - - if (!$.fn.fileinputBsVersion) { - $.fn.fileinputBsVersion = (window.bootstrap && window.bootstrap.Alert && window.bootstrap.Alert.VERSION) || - (window.Alert && window.Alert.VERSION) || '3.x.x'; - } - - String.prototype.setTokens = function (replacePairs) { - var str = this.toString(), key, re; - for (key in replacePairs) { - if (replacePairs.hasOwnProperty(key)) { - re = new RegExp('\{' + key + '\}', 'g'); - str = str.replace(re, replacePairs[key]); - } - } - return str; - }; - - if (!Array.prototype.flatMap) { // polyfill flatMap - Array.prototype.flatMap = function (lambda) { - return [].concat(this.map(lambda)); - }; - } - - var $h, FileInput; - - // fileinput helper object for all global variables and internal helper methods - $h = { - FRAMES: '.kv-preview-thumb', - SORT_CSS: 'file-sortable', - INIT_FLAG: 'init-', - SCRIPT_SRC: document && document.currentScript && document.currentScript.src || null, - OBJECT_PARAMS: '\n' + - '\n' + - '\n' + - '\n' + - '\n' + - '\n', - DEFAULT_PREVIEW: '
\n' + - '{previewFileIcon}\n' + - '
', - MODAL_ID: 'kvFileinputModal', - MODAL_EVENTS: ['show', 'shown', 'hide', 'hidden', 'loaded'], - logMessages: { - ajaxError: '{status}: {error}. Error Details: {text}.', - badDroppedFiles: 'Error scanning dropped files!', - badExifParser: 'Error loading the piexif.js library. {details}', - badInputType: 'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.', - exifWarning: 'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded ' + - 'the "piexif.js" library correctly on your page before the "fileinput.js" script.', - invalidChunkSize: 'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.', - invalidThumb: 'Invalid thumb frame with id: "{id}".', - noResumableSupport: 'The browser does not support resumable or chunk uploads.', - noUploadUrl: 'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.', - retryStatus: 'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.', - chunkQueueError: 'Could not push task to ajax pool for chunk index # {index}.', - resumableMaxRetriesReached: 'Maximum resumable ajax retries ({n}) reached.', - resumableRetryError: 'Could not retry the resumable request (try # {n})... aborting.', - resumableAborting: 'Aborting / cancelling the resumable request.', - resumableRequestError: 'Error processing resumable request. {msg}' - - }, - objUrl: window.URL || window.webkitURL, - getZoomPlaceholder: function () { // used to prevent 404 errors in URL parsing - var src = $h.SCRIPT_SRC, srcPath, zoomVar = '?kvTemp__2873389129__='; - if (!src) { - return zoomVar; - } - srcPath = src.substring(0, src.lastIndexOf("/")); - return srcPath.substring(0, srcPath.lastIndexOf("/") + 1) + 'img/loading.gif' + zoomVar; - }, - isBs: function (ver) { - var chk = $.trim(($.fn.fileinputBsVersion || '') + ''); - ver = parseInt(ver, 10); - if (!chk) { - return ver === 4; - } - return ver === parseInt(chk.charAt(0), 10); - - }, - defaultButtonCss: function (fill) { - return 'btn-default btn-' + (fill ? '' : 'outline-') + 'secondary'; - }, - now: function () { - return new Date().getTime(); - }, - round: function (num) { - num = parseFloat(num); - return isNaN(num) ? 0 : Math.floor(Math.round(num)); - }, - getArray: function (obj) { - var i, arr = [], len = obj && obj.length || 0; - for (i = 0; i < len; i++) { - arr.push(obj[i]); - } - return arr; - }, - getFileRelativePath: function (file) { - /** @namespace file.relativePath */ - /** @namespace file.webkitRelativePath */ - return String(file.newPath || file.relativePath || file.webkitRelativePath || $h.getFileName(file) || null); - - }, - getFileId: function (file, generateFileId) { - var relativePath = $h.getFileRelativePath(file); - if (typeof generateFileId === 'function') { - return generateFileId(file); - } - if (!file) { - return null; - } - if (!relativePath) { - return null; - } - return (file.size + '_' + encodeURIComponent(relativePath).replace(/%/g, '_')); - }, - getFrameSelector: function (id, selector) { - selector = selector || ''; - return '[id="' + id + '"]' + selector; - }, - getZoomSelector: function (id, selector) { - return $h.getFrameSelector('zoom-' + id, selector); - }, - getFrameElement: function ($element, id, selector) { - return $element.find($h.getFrameSelector(id, selector)); - }, - getZoomElement: function ($element, id, selector) { - return $element.find($h.getZoomSelector(id, selector)); - }, - getElapsed: function (seconds) { - var delta = seconds, out = '', result = {}, structure = { - year: 31536000, - month: 2592000, - week: 604800, // uncomment row to ignore - day: 86400, // feel free to add your own row - hour: 3600, - minute: 60, - second: 1 - }; - $h.getObjectKeys(structure).forEach(function (key) { - result[key] = Math.floor(delta / structure[key]); - delta -= result[key] * structure[key]; - }); - $.each(result, function (key, value) { - if (value > 0) { - out += (out ? ' ' : '') + value + key.substring(0, 1); - } - }); - return out; - }, - debounce: function (func, delay) { - var inDebounce; - return function () { - var args = arguments, context = this; - clearTimeout(inDebounce); - inDebounce = setTimeout(function () { - func.apply(context, args); - }, delay); - }; - }, - stopEvent: function (e) { - e.stopPropagation(); - e.preventDefault(); - }, - getFileName: function (file) { - /** @namespace file.fileName */ - return file ? (file.fileName || file.name || '') : ''; // some confusion in different versions of Firefox - }, - createObjectURL: function (data) { - if ($h.objUrl && $h.objUrl.createObjectURL && data) { - return $h.objUrl.createObjectURL(data); - } - return ''; - }, - revokeObjectURL: function (data) { - if ($h.objUrl && $h.objUrl.revokeObjectURL && data) { - $h.objUrl.revokeObjectURL(data); - } - }, - compare: function (input, str, exact) { - return input !== undefined && (exact ? input === str : input.match(str)); - }, - isIE: function (ver) { - var div, status; - // check for IE versions < 11 - if (navigator.appName !== 'Microsoft Internet Explorer') { - return false; - } - if (ver === 10) { - return new RegExp('msie\\s' + ver, 'i').test(navigator.userAgent); - } - div = document.createElement('div'); - div.innerHTML = ''; - status = div.getElementsByTagName('i').length; - document.body.appendChild(div); - div.parentNode.removeChild(div); - return status; - }, - canOrientImage: function ($el) { - var $img = $(document.createElement('img')).css({width: '1px', height: '1px'}).insertAfter($el), - flag = $img.css('image-orientation'); - $img.remove(); - return !!flag; - }, - canAssignFilesToInput: function () { - var input = document.createElement('input'); - try { - input.type = 'file'; - input.files = null; - return true; - } catch (err) { - return false; - } - }, - getDragDropFolders: function (items) { - var i, item, len = items ? items.length : 0, folders = 0; - if (len > 0 && items[0].webkitGetAsEntry()) { - for (i = 0; i < len; i++) { - item = items[i].webkitGetAsEntry(); - if (item && item.isDirectory) { - folders++; - } - } - } - return folders; - }, - initModal: function ($modal) { - var $body = $('body'); - if ($body.length) { - $modal.appendTo($body); - } - }, - isFunction: function (v) { - return typeof v === 'function'; - }, - isEmpty: function (value, trim) { - if (value === undefined || value === null || value === '') { - return true; - } - if ($h.isString(value) && trim) { - return $.trim(value) === ''; - } - if ($h.isArray(value)) { - return value.length === 0; - } - if ($.isPlainObject(value) && $.isEmptyObject(value)) { - return true; - } - return false; - }, - isArray: function (a) { - return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]'; - }, - isString: function (a) { - return Object.prototype.toString.call(a) === '[object String]'; - }, - ifSet: function (needle, haystack, def) { - def = def || ''; - return (haystack && typeof haystack === 'object' && needle in haystack) ? haystack[needle] : def; - }, - cleanArray: function (arr) { - if (!(arr instanceof Array)) { - arr = []; - } - return arr.filter(function (e) { - return (e !== undefined && e !== null); - }); - }, - spliceArray: function (arr, index, reverseOrder) { - var i, j = 0, out = [], newArr; - if (!(arr instanceof Array)) { - return []; - } - newArr = $.extend(true, [], arr); - if (reverseOrder) { - newArr.reverse(); - } - for (i = 0; i < newArr.length; i++) { - if (i !== index) { - out[j] = newArr[i]; - j++; - } - } - if (reverseOrder) { - out.reverse(); - } - return out; - }, - getNum: function (num, def) { - def = def || 0; - if (typeof num === 'number') { - return num; - } - if (typeof num === 'string') { - num = parseFloat(num); - } - return isNaN(num) ? def : num; - }, - hasFileAPISupport: function () { - return !!(window.File && window.FileReader); - }, - hasDragDropSupport: function () { - var div = document.createElement('div'); - /** @namespace div.draggable */ - /** @namespace div.ondragstart */ - /** @namespace div.ondrop */ - return !$h.isIE(9) && - (div.draggable !== undefined || (div.ondragstart !== undefined && div.ondrop !== undefined)); - }, - hasFileUploadSupport: function () { - return $h.hasFileAPISupport() && window.FormData; - }, - hasBlobSupport: function () { - try { - return !!window.Blob && Boolean(new Blob()); - } catch (e) { - return false; - } - }, - hasArrayBufferViewSupport: function () { - try { - return new Blob([new Uint8Array(100)]).size === 100; - } catch (e) { - return false; - } - }, - hasResumableUploadSupport: function () { - /** @namespace Blob.prototype.webkitSlice */ - /** @namespace Blob.prototype.mozSlice */ - return $h.hasFileUploadSupport() && $h.hasBlobSupport() && $h.hasArrayBufferViewSupport() && - (!!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice || !!Blob.prototype.slice || false); - }, - dataURI2Blob: function (dataURI) { - var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || - window.MSBlobBuilder, canBlob = $h.hasBlobSupport(), byteStr, arrayBuffer, intArray, i, mimeStr, bb, - canProceed = (canBlob || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array; - if (!canProceed) { - return null; - } - if (dataURI.split(',')[0].indexOf('base64') >= 0) { - byteStr = atob(dataURI.split(',')[1]); - } else { - byteStr = decodeURIComponent(dataURI.split(',')[1]); - } - arrayBuffer = new ArrayBuffer(byteStr.length); - intArray = new Uint8Array(arrayBuffer); - for (i = 0; i < byteStr.length; i += 1) { - intArray[i] = byteStr.charCodeAt(i); - } - mimeStr = dataURI.split(',')[0].split(':')[1].split(';')[0]; - if (canBlob) { - return new Blob([$h.hasArrayBufferViewSupport() ? intArray : arrayBuffer], {type: mimeStr}); - } - bb = new BlobBuilder(); - bb.append(arrayBuffer); - return bb.getBlob(mimeStr); - }, - arrayBuffer2String: function (buffer) { - if (window.TextDecoder) { - return new TextDecoder('utf-8').decode(buffer); - } - var array = Array.prototype.slice.apply(new Uint8Array(buffer)), out = '', i = 0, len, c, char2, char3; - len = array.length; - while (i < len) { - c = array[i++]; - switch (c >> 4) { // jshint ignore:line - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - // 0xxxxxxx - out += String.fromCharCode(c); - break; - case 12: - case 13: - // 110x xxxx 10xx xxxx - char2 = array[i++]; - out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); // jshint ignore:line - break; - case 14: - // 1110 xxxx 10xx xxxx 10xx xxxx - char2 = array[i++]; - char3 = array[i++]; - out += String.fromCharCode(((c & 0x0F) << 12) | // jshint ignore:line - ((char2 & 0x3F) << 6) | // jshint ignore:line - ((char3 & 0x3F) << 0)); // jshint ignore:line - break; - } - } - return out; - }, - isHtml: function (str) { - var a = document.createElement('div'); - a.innerHTML = str; - for (var c = a.childNodes, i = c.length; i--;) { - if (c[i].nodeType === 1) { - return true; - } - } - return false; - }, - isPdf: function (str) { - if ($h.isEmpty(str)) { - return false; - } - str = str.toString().trim().replace(/\n/g, ' '); - if (str.length === 0) { - return false; - } - }, - isSvg: function (str) { - if ($h.isEmpty(str)) { - return false; - } - str = str.toString().trim().replace(/\n/g, ' '); - if (str.length === 0) { - return false; - } - return str.match(/^\s*<\?xml/i) && (str.match(/' + str + '')); - }, - uniqId: function () { - return (new Date().getTime() + Math.floor(Math.random() * Math.pow(10, 15))).toString(36); - }, - cspBuffer: { - CSP_ATTRIB: 'data-csp-01928735', // a randomly named temporary attribute to store the CSP elem id - domElementsStyles: {}, - stash: function (htmlString) { - var self = this, outerDom = $.parseHTML('
' + htmlString + '
'), $el = $(outerDom); - $el.find('[style]').each(function (key, elem) { - var $elem = $(elem), styleDeclaration = $elem[0].style, id = $h.uniqId(), styles = {}; - if (styleDeclaration && styleDeclaration.length) { - $(styleDeclaration).each(function () { - styles[this] = styleDeclaration[this]; - }); - self.domElementsStyles[id] = styles; - $elem.removeAttr('style').attr(self.CSP_ATTRIB, id); - } - }); - $el.filter('*').removeAttr('style'); // make sure all style attr are removed - var values = Object.values ? Object.values(outerDom) : Object.keys(outerDom).map(function (itm) { - return outerDom[itm]; - }); - return values.flatMap(function (elem) { - return elem.innerHTML; - }).join(''); - }, - apply: function (domElement) { - var self = this, $el = $(domElement); - $el.find('[' + self.CSP_ATTRIB + ']').each(function (key, elem) { - var $elem = $(elem), id = $elem.attr(self.CSP_ATTRIB), styles = self.domElementsStyles[id]; - if (styles) { - $elem.css(styles); - } - $elem.removeAttr(self.CSP_ATTRIB); - }); - self.domElementsStyles = {}; - } - }, - setHtml: function ($elem, htmlString) { - var buf = $h.cspBuffer; - $elem.html(buf.stash(htmlString)); - buf.apply($elem); - return $elem; - }, - htmlEncode: function (str, undefVal) { - if (str === undefined) { - return undefVal || null; - } - return str.replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); - }, - replaceTags: function (str, tags) { - var out = str; - if (!tags) { - return out; - } - $.each(tags, function (key, value) { - if (typeof value === 'function') { - value = value(); - } - out = out.split(key).join(value); - }); - return out; - }, - cleanMemory: function ($thumb) { - var data = $thumb.is('img') ? $thumb.attr('src') : $thumb.find('source').attr('src'); - $h.revokeObjectURL(data); - }, - findFileName: function (filePath) { - var sepIndex = filePath.lastIndexOf('/'); - if (sepIndex === -1) { - sepIndex = filePath.lastIndexOf('\\'); - } - return filePath.split(filePath.substring(sepIndex, sepIndex + 1)).pop(); - }, - checkFullScreen: function () { - return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || - document.msFullscreenElement; - }, - toggleFullScreen: function (maximize) { - var doc = document, de = doc.documentElement, isFullScreen = $h.checkFullScreen(); - if (de && maximize && !isFullScreen) { - if (de.requestFullscreen) { - de.requestFullscreen(); - } else { - if (de.msRequestFullscreen) { - de.msRequestFullscreen(); - } else { - if (de.mozRequestFullScreen) { - de.mozRequestFullScreen(); - } else { - if (de.webkitRequestFullscreen) { - de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); - } - } - } - } - } else { - if (isFullScreen) { - if (doc.exitFullscreen) { - doc.exitFullscreen(); - } else { - if (doc.msExitFullscreen) { - doc.msExitFullscreen(); - } else { - if (doc.mozCancelFullScreen) { - doc.mozCancelFullScreen(); - } else { - if (doc.webkitExitFullscreen) { - doc.webkitExitFullscreen(); - } - } - } - } - } - } - }, - moveArray: function (arr, oldIndex, newIndex, reverseOrder) { - var newArr = $.extend(true, [], arr); - if (reverseOrder) { - newArr.reverse(); - } - if (newIndex >= newArr.length) { - var k = newIndex - newArr.length; - while ((k--) + 1) { - newArr.push(undefined); - } - } - newArr.splice(newIndex, 0, newArr.splice(oldIndex, 1)[0]); - if (reverseOrder) { - newArr.reverse(); - } - return newArr; - }, - closeButton: function (css) { - css = ($h.isBs(5) ? 'btn-close' : 'close') + (css ? ' ' + css : ''); - return ''; - }, - getRotation: function (value) { - switch (value) { - case 2: - return 'rotateY(180deg)'; - case 3: - return 'rotate(180deg)'; - case 4: - return 'rotate(180deg) rotateY(180deg)'; - case 5: - return 'rotate(270deg) rotateY(180deg)'; - case 6: - return 'rotate(90deg)'; - case 7: - return 'rotate(90deg) rotateY(180deg)'; - case 8: - return 'rotate(270deg)'; - default: - return ''; - } - }, - setTransform: function (el, val) { - if (!el) { - return; - } - el.style.transform = val; - el.style.webkitTransform = val; - el.style['-moz-transform'] = val; - el.style['-ms-transform'] = val; - el.style['-o-transform'] = val; - }, - getObjectKeys: function (obj) { - var keys = []; - if (obj) { - $.each(obj, function (key) { - keys.push(key); - }); - } - return keys; - }, - getObjectSize: function (obj) { - return $h.getObjectKeys(obj).length; - }, - /** - * Small dependency injection for the task manager - * https://gist.github.com/fearphage/4341799 - */ - whenAll: function (array) { - var s = [].slice, resolveValues = arguments.length === 1 && $h.isArray(array) ? array : s.call(arguments), - deferred = $.Deferred(), i, failed = 0, value, length = resolveValues.length, - remaining = length, rejectContexts, rejectValues, resolveContexts, updateFunc; - rejectContexts = rejectValues = resolveContexts = Array(length); - updateFunc = function (index, contexts, values) { - return function () { - if (values !== resolveValues) { - failed++; - } - deferred.notifyWith(contexts[index] = this, values[index] = s.call(arguments)); - if (!(--remaining)) { - deferred[(!failed ? 'resolve' : 'reject') + 'With'](contexts, values); - } - }; - }; - for (i = 0; i < length; i++) { - if ((value = resolveValues[i]) && $.isFunction(value.promise)) { - value.promise() - .done(updateFunc(i, resolveContexts, resolveValues)) - .fail(updateFunc(i, rejectContexts, rejectValues)); - } else { - deferred.notifyWith(this, value); - --remaining; - } - } - if (!remaining) { - deferred.resolveWith(resolveContexts, resolveValues); - } - return deferred.promise(); - } - }; - FileInput = function (element, options) { - var self = this; - self.$element = $(element); - self.$parent = self.$element.parent(); - if (!self._validate()) { - return; - } - self.isPreviewable = $h.hasFileAPISupport(); - self.isIE9 = $h.isIE(9); - self.isIE10 = $h.isIE(10); - if (self.isPreviewable || self.isIE9) { - self._init(options); - self._listen(); - } - self.$element.removeClass('file-loading'); - }; - - FileInput.prototype = { - constructor: FileInput, - _cleanup: function () { - var self = this; - self.reader = null; - self.clearFileStack(); - self.fileBatchCompleted = true; - self.isError = false; - self.isDuplicateError = false; - self.isPersistentError = false; - self.cancelling = false; - self.paused = false; - self.lastProgress = 0; - self._initAjax(); - }, - _isAborted: function () { - var self = this; - return self.cancelling || self.paused; - }, - _initAjax: function () { - var self = this, tm = self.taskManager = { - pool: {}, - addPool: function (id) { - return (tm.pool[id] = new tm.TasksPool(id)); - }, - getPool: function (id) { - return tm.pool[id]; - }, - addTask: function (id, logic) { // add standalone task directly from task manager - return new tm.Task(id, logic); - }, - TasksPool: function (id) { - var tp = this; - tp.id = id; - tp.cancelled = false; - tp.cancelledDeferrer = $.Deferred(); - tp.tasks = {}; - tp.addTask = function (id, logic) { - return (tp.tasks[id] = new tm.Task(id, logic)); - }; - tp.size = function () { - return $h.getObjectSize(tp.tasks); - }; - tp.run = function (maxThreads) { - var i = 0, failed = false, task, tasksList = $h.getObjectKeys(tp.tasks).map(function (key) { - return tp.tasks[key]; - }), tasksDone = [], deferred = $.Deferred(), enqueue, callback; - - if (tp.cancelled) { - tp.cancelledDeferrer.resolve(); - return deferred.reject(); - } - // if run all at once - if (!maxThreads) { - var tasksDeferredList = $h.getObjectKeys(tp.tasks).map(function (key) { - return tp.tasks[key].deferred; - }); - // when all are done - $h.whenAll(tasksDeferredList).done(function () { - var argv = $h.getArray(arguments); - if (!tp.cancelled) { - deferred.resolve.apply(null, argv); - tp.cancelledDeferrer.reject(); - } else { - deferred.reject.apply(null, argv); - tp.cancelledDeferrer.resolve(); - } - }).fail(function () { - var argv = $h.getArray(arguments); - deferred.reject.apply(null, argv); - if (!tp.cancelled) { - tp.cancelledDeferrer.reject(); - } else { - tp.cancelledDeferrer.resolve(); - } - }); - // run all tasks - $.each(tp.tasks, function (id) { - task = tp.tasks[id]; - task.run(); - }); - return deferred; - } - enqueue = function (task) { - $.when(task.deferred) - .fail(function () { - failed = true; - callback.apply(null, arguments); - }) - .always(callback); - }; - callback = function () { - var argv = $h.getArray(arguments); - // notify a task just ended - deferred.notify(argv); - tasksDone.push(argv); - if (tp.cancelled) { - deferred.reject.apply(null, tasksDone); - tp.cancelledDeferrer.resolve(); - return; - } - if (tasksDone.length === tp.size()) { - if (failed) { - deferred.reject.apply(null, tasksDone); - } else { - deferred.resolve.apply(null, tasksDone); - } - } - // if there are any tasks remaining - if (tasksList.length) { - task = tasksList.shift(); - enqueue(task); - task.run(); - } - }; - // run the first "maxThreads" tasks - while (tasksList.length && i++ < maxThreads) { - task = tasksList.shift(); - enqueue(task); - task.run(); - } - return deferred; - }; - tp.cancel = function () { - tp.cancelled = true; - return tp.cancelledDeferrer; - }; - }, - Task: function (id, logic) { - var tk = this; - tk.id = id; - tk.deferred = $.Deferred(); - tk.logic = logic; - tk.context = null; - tk.run = function () { - var argv = $h.getArray(arguments); - argv.unshift(tk.deferred); // add deferrer as first argument - logic.apply(tk.context, argv); // run task - return tk.deferred; // return deferrer - }; - tk.runWithContext = function (context) { - tk.context = context; - return tk.run(); - }; - } - }; - self.ajaxQueue = []; - self.ajaxRequests = []; - self.ajaxPool = null; - self.ajaxAborted = false; - }, - _init: function (options, refreshMode) { - var self = this, f, $el = self.$element, $cont, t, tmp; - self.options = options; - self.zoomPlaceholder = $h.getZoomPlaceholder(); - self.canOrientImage = $h.canOrientImage($el); - $.each(options, function (key, value) { - switch (key) { - case 'minFileCount': - case 'maxFileCount': - case 'maxTotalFileCount': - case 'minFileSize': - case 'maxFileSize': - case 'maxFilePreviewSize': - case 'resizeQuality': - case 'resizeIfSizeMoreThan': - case 'progressUploadThreshold': - case 'initialPreviewCount': - case 'zoomModalHeight': - case 'minImageHeight': - case 'maxImageHeight': - case 'minImageWidth': - case 'maxImageWidth': - case 'bytesToKB': - self[key] = $h.getNum(value); - break; - default: - self[key] = value; - break; - } - }); - if (!self.bytesToKB || self.bytesToKB <= 0) { - self.bytesToKB = 1024; - } - if (self.errorCloseButton === undefined) { - self.errorCloseButton = $h.closeButton('kv-error-close' + ($h.isBs(5) ? ' float-end' : '')); - } - if (self.maxTotalFileCount > 0 && self.maxTotalFileCount < self.maxFileCount) { - self.maxTotalFileCount = self.maxFileCount; - } - if (self.rtl) { // swap buttons for rtl - tmp = self.previewZoomButtonIcons.prev; - self.previewZoomButtonIcons.prev = self.previewZoomButtonIcons.next; - self.previewZoomButtonIcons.next = tmp; - } - // validate chunk threads to not exceed maxAjaxThreads - if (!isNaN(self.maxAjaxThreads) && self.maxAjaxThreads < self.resumableUploadOptions.maxThreads) { - self.resumableUploadOptions.maxThreads = self.maxAjaxThreads; - } - self._initFileManager(); - if (typeof self.autoOrientImage === 'function') { - self.autoOrientImage = self.autoOrientImage(); - } - if (typeof self.autoOrientImageInitial === 'function') { - self.autoOrientImageInitial = self.autoOrientImageInitial(); - } - if (!refreshMode) { - self._cleanup(); - } - self.duplicateErrors = []; - self.$form = $el.closest('form'); - self._initTemplateDefaults(); - self.uploadFileAttr = !$h.isEmpty($el.attr('name')) ? $el.attr('name') : 'file_data'; - t = self._getLayoutTemplate('progress'); - self.progressTemplate = t.replace('{class}', self.progressClass); - self.progressInfoTemplate = t.replace('{class}', self.progressInfoClass); - self.progressPauseTemplate = t.replace('{class}', self.progressPauseClass); - self.progressCompleteTemplate = t.replace('{class}', self.progressCompleteClass); - self.progressErrorTemplate = t.replace('{class}', self.progressErrorClass); - self.isDisabled = $el.attr('disabled') || $el.attr('readonly'); - if (self.isDisabled) { - $el.attr('disabled', true); - } - self.isClickable = self.browseOnZoneClick && self.showPreview && - (self.dropZoneEnabled || !$h.isEmpty(self.defaultPreviewContent)); - self.isAjaxUpload = $h.hasFileUploadSupport() && !$h.isEmpty(self.uploadUrl); - self.dropZoneEnabled = $h.hasDragDropSupport() && self.dropZoneEnabled; - if (!self.isAjaxUpload) { - self.dropZoneEnabled = self.dropZoneEnabled && $h.canAssignFilesToInput(); - } - self.slug = typeof options.slugCallback === 'function' ? options.slugCallback : self._slugDefault; - self.mainTemplate = self.showCaption ? self._getLayoutTemplate('main1') : self._getLayoutTemplate('main2'); - self.captionTemplate = self._getLayoutTemplate('caption'); - self.previewGenericTemplate = self._getPreviewTemplate('generic'); - if (!self.imageCanvas && self.resizeImage && (self.maxImageWidth || self.maxImageHeight)) { - self.imageCanvas = document.createElement('canvas'); - self.imageCanvasContext = self.imageCanvas.getContext('2d'); - } - if ($h.isEmpty($el.attr('id'))) { - $el.attr('id', $h.uniqId()); - } - self.namespace = '.fileinput_' + $el.attr('id').replace(/-/g, '_'); - if (self.$container === undefined) { - self.$container = self._createContainer(); - } else { - self._refreshContainer(); - } - $cont = self.$container; - self.$dropZone = $cont.find('.file-drop-zone'); - self.$progress = $cont.find('.kv-upload-progress'); - self.$btnUpload = $cont.find('.fileinput-upload'); - self.$captionContainer = $h.getElement(options, 'elCaptionContainer', $cont.find('.file-caption')); - self.$caption = $h.getElement(options, 'elCaptionText', $cont.find('.file-caption-name')); - if (!$h.isEmpty(self.msgPlaceholder)) { - f = $el.attr('multiple') ? self.filePlural : self.fileSingle; - self.$caption.attr('placeholder', self.msgPlaceholder.replace('{files}', f)); - } - self.$captionIcon = self.$captionContainer.find('.file-caption-icon'); - self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview')); - self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails')); - self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status')); - self.$errorContainer = $h.getElement(options, 'elErrorContainer', - self.$previewContainer.find('.kv-fileinput-error')); - self._validateDisabled(); - if (!$h.isEmpty(self.msgErrorClass)) { - $h.addCss(self.$errorContainer, self.msgErrorClass); - } - if (!refreshMode) { - self._resetErrors(); - self.$errorContainer.hide(); - self.previewInitId = 'thumb-' + $el.attr('id'); - self._initPreviewCache(); - self._initPreview(true); - self._initPreviewActions(); - if (self.$parent.hasClass('file-loading')) { - self.$container.insertBefore(self.$parent); - self.$parent.remove(); - } - } else { - if (!self._errorsExist()) { - self.$errorContainer.hide(); - } - } - self._setFileDropZoneTitle(); - if ($el.attr('disabled')) { - self.disable(); - } - self._initZoom(); - if (self.hideThumbnailContent) { - $h.addCss(self.$preview, 'hide-content'); - } - }, - _initFileManager: function () { - var self = this; - self.uploadStartTime = $h.now(); - self.fileManager = { - stack: {}, - filesProcessed: [], - errors: [], - loadedImages: {}, - totalImages: 0, - totalFiles: null, - totalSize: null, - uploadedSize: 0, - stats: {}, - bpsLog: [], - bps: 0, - initStats: function (id) { - var data = {started: $h.now()}; - if (id) { - self.fileManager.stats[id] = data; - } else { - self.fileManager.stats = data; - } - }, - getUploadStats: function (id, loaded, total) { - var fm = self.fileManager, - started = id ? fm.stats[id] && fm.stats[id].started || $h.now() : self.uploadStartTime, - elapsed = ($h.now() - started) / 1000, bps = Math.ceil(elapsed ? loaded / elapsed : 0), - pendingBytes = total - loaded, out, delay = fm.bpsLog.length ? self.bitrateUpdateDelay : 0; - setTimeout(function () { - var i, j = 0, n = 0, len, beg; - fm.bpsLog.push(bps); - fm.bpsLog.sort(function (a, b) { - return a - b; - }); - len = fm.bpsLog.length; - beg = len > 10 ? len - 10 : Math.ceil(len / 2); - for (i = len; i > beg; i--) { - n = parseFloat(fm.bpsLog[i]); - j++; - } - fm.bps = (j > 0 ? n / j : 0) * 64; - }, delay); - out = { - fileId: id, - started: started, - elapsed: elapsed, - loaded: loaded, - total: total, - bps: fm.bps, - bitrate: self._getSize(fm.bps, false, self.bitRateUnits), - pendingBytes: pendingBytes - }; - if (id) { - fm.stats[id] = out; - } else { - fm.stats = out; - } - return out; - }, - exists: function (id) { - return $.inArray(id, self.fileManager.getIdList()) !== -1; - }, - count: function () { - return self.fileManager.getIdList().length; - }, - total: function () { - var fm = self.fileManager; - if (!fm.totalFiles) { - fm.totalFiles = fm.count(); - } - return fm.totalFiles; - }, - getTotalSize: function () { - var fm = self.fileManager; - if (fm.totalSize) { - return fm.totalSize; - } - fm.totalSize = 0; - $.each(self.getFileStack(), function (id, f) { - var size = parseFloat(f.size); - fm.totalSize += isNaN(size) ? 0 : size; - }); - return fm.totalSize; - }, - add: function (file, id) { - if (!id) { - id = self.fileManager.getId(file); - } - if (!id) { - return; - } - self.fileManager.stack[id] = { - file: file, - name: $h.getFileName(file), - relativePath: $h.getFileRelativePath(file), - size: file.size, - nameFmt: self._getFileName(file, ''), - sizeFmt: self._getSize(file.size) - }; - }, - remove: function ($thumb) { - var id = self._getThumbFileId($thumb); - self.fileManager.removeFile(id); - }, - removeFile: function (id) { - var fm = self.fileManager; - if (!id) { - return; - } - delete fm.stack[id]; - delete fm.loadedImages[id]; - }, - move: function (idFrom, idTo) { - var result = {}, stack = self.fileManager.stack; - if (!idFrom && !idTo || idFrom === idTo) { - return; - } - $.each(stack, function (k, v) { - if (k !== idFrom) { - result[k] = v; - } - if (k === idTo) { - result[idFrom] = stack[idFrom]; - } - }); - self.fileManager.stack = result; - }, - list: function () { - var files = []; - $.each(self.getFileStack(), function (k, v) { - if (v && v.file) { - files.push(v.file); - } - }); - return files; - }, - isPending: function (id) { - return $.inArray(id, self.fileManager.filesProcessed) === -1 && self.fileManager.exists(id); - }, - isProcessed: function () { - var filesProcessed = true, fm = self.fileManager; - $.each(self.getFileStack(), function (id) { - if (fm.isPending(id)) { - filesProcessed = false; - } - }); - return filesProcessed; - }, - clear: function () { - var fm = self.fileManager; - self.isDuplicateError = false; - self.isPersistentError = false; - fm.totalFiles = null; - fm.totalSize = null; - fm.uploadedSize = 0; - fm.stack = {}; - fm.errors = []; - fm.filesProcessed = []; - fm.stats = {}; - fm.bpsLog = []; - fm.bps = 0; - fm.clearImages(); - }, - clearImages: function () { - self.fileManager.loadedImages = {}; - self.fileManager.totalImages = 0; - }, - addImage: function (id, config) { - self.fileManager.loadedImages[id] = config; - }, - removeImage: function (id) { - delete self.fileManager.loadedImages[id]; - }, - getImageIdList: function () { - return $h.getObjectKeys(self.fileManager.loadedImages); - }, - getImageCount: function () { - return self.fileManager.getImageIdList().length; - }, - getId: function (file) { - return self._getFileId(file); - }, - getIndex: function (id) { - return self.fileManager.getIdList().indexOf(id); - }, - getThumb: function (id) { - var $thumb = null; - self._getThumbs().each(function () { - var $t = $(this); - if (self._getThumbFileId($t) === id) { - $thumb = $t; - } - }); - return $thumb; - }, - getThumbIndex: function ($thumb) { - var id = self._getThumbFileId($thumb); - return self.fileManager.getIndex(id); - }, - getIdList: function () { - return $h.getObjectKeys(self.fileManager.stack); - }, - getFile: function (id) { - return self.fileManager.stack[id] || null; - }, - getFileName: function (id, fmt) { - var file = self.fileManager.getFile(id); - if (!file) { - return ''; - } - return fmt ? (file.nameFmt || '') : file.name || ''; - }, - getFirstFile: function () { - var ids = self.fileManager.getIdList(), id = ids && ids.length ? ids[0] : null; - return self.fileManager.getFile(id); - }, - setFile: function (id, file) { - if (self.fileManager.getFile(id)) { - self.fileManager.stack[id].file = file; - } else { - self.fileManager.add(file, id); - } - }, - setProcessed: function (id) { - self.fileManager.filesProcessed.push(id); - }, - getProgress: function () { - var total = self.fileManager.total(), filesProcessed = self.fileManager.filesProcessed.length; - if (!total) { - return 0; - } - return Math.ceil(filesProcessed / total * 100); - - }, - setProgress: function (id, pct) { - var f = self.fileManager.getFile(id); - if (!isNaN(pct) && f) { - f.progress = pct; - } - } - }; - }, - _setUploadData: function (fd, config) { - var self = this; - $.each(config, function (key, value) { - var param = self.uploadParamNames[key] || key; - if ($h.isArray(value)) { - fd.append(param, value[0], value[1]); - } else { - fd.append(param, value); - } - }); - }, - _initResumableUpload: function () { - var self = this, opts = self.resumableUploadOptions, logs = $h.logMessages, rm, fm = self.fileManager; - if (!self.enableResumableUpload) { - return; - } - if (opts.fallback !== false && typeof opts.fallback !== 'function') { - opts.fallback = function (s) { - s._log(logs.noResumableSupport); - s.enableResumableUpload = false; - }; - } - if (!$h.hasResumableUploadSupport() && opts.fallback !== false) { - opts.fallback(self); - return; - } - if (!self.uploadUrl && self.enableResumableUpload) { - self._log(logs.noUploadUrl); - self.enableResumableUpload = false; - return; - - } - opts.chunkSize = parseFloat(opts.chunkSize); - if (opts.chunkSize <= 0 || isNaN(opts.chunkSize)) { - self._log(logs.invalidChunkSize, {chunkSize: opts.chunkSize}); - self.enableResumableUpload = false; - return; - } - rm = self.resumableManager = { - init: function (id, f, index) { - rm.logs = []; - rm.stack = []; - rm.error = ''; - rm.id = id; - rm.file = f.file; - rm.fileName = f.name; - rm.fileIndex = index; - rm.completed = false; - rm.lastProgress = 0; - if (self.showPreview) { - rm.$thumb = fm.getThumb(id) || null; - rm.$progress = rm.$btnDelete = null; - if (rm.$thumb && rm.$thumb.length) { - rm.$progress = rm.$thumb.find('.file-thumb-progress'); - rm.$btnDelete = rm.$thumb.find('.kv-file-remove'); - } - } - rm.chunkSize = opts.chunkSize * self.bytesToKB; - rm.chunkCount = rm.getTotalChunks(); - }, - setAjaxError: function (jqXHR, textStatus, errorThrown, isTest) { - if (jqXHR.responseJSON && jqXHR.responseJSON.error) { - errorThrown = jqXHR.responseJSON.error.toString(); - } - if (!isTest) { - rm.error = errorThrown; - } - if (opts.showErrorLog) { - self._log(logs.ajaxError, { - status: jqXHR.status, - error: errorThrown, - text: jqXHR.responseText || '' - }); - } - }, - reset: function () { - rm.stack = []; - rm.chunksProcessed = {}; - }, - setProcessed: function (status) { - var id = rm.id, msg, $thumb = rm.$thumb, $prog = rm.$progress, hasThumb = $thumb && $thumb.length, - params = {id: hasThumb ? $thumb.attr('id') : '', index: fm.getIndex(id), fileId: id}, tokens, - skipErrorsAndProceed = self.resumableUploadOptions.skipErrorsAndProceed; - rm.completed = true; - rm.lastProgress = 0; - if (hasThumb) { - $thumb.removeClass('file-uploading'); - } - if (status === 'success') { - fm.uploadedSize += rm.file.size; - if (self.showPreview) { - self._setProgress(101, $prog); - self._setThumbStatus($thumb, 'Success'); - self._initUploadSuccess(rm.chunksProcessed[id].data, $thumb); - } - fm.removeFile(id); - delete rm.chunksProcessed[id]; - self._raise('fileuploaded', [params.id, params.index, params.fileId]); - if (fm.isProcessed()) { - self._setProgress(101); - } - } else { - if (status !== 'cancel') { - if (self.showPreview) { - self._setThumbStatus($thumb, 'Error'); - self._setPreviewError($thumb, true); - self._setProgress(101, $prog, self.msgProgressError); - self._setProgress(101, self.$progress, self.msgProgressError); - self.cancelling = !skipErrorsAndProceed; - } - if (!self.$errorContainer.find('li[data-file-id="' + params.fileId + '"]').length) { - tokens = {file: rm.fileName, max: opts.maxRetries, error: rm.error}; - msg = self.msgResumableUploadRetriesExceeded.setTokens(tokens); - $.extend(params, tokens); - self._showFileError(msg, params, 'filemaxretries'); - if (skipErrorsAndProceed) { - fm.removeFile(id); - delete rm.chunksProcessed[id]; - if (fm.isProcessed()) { - self._setProgress(101); - } - } - } - } - } - if (fm.isProcessed()) { - rm.reset(); - } - }, - check: function () { - var status = true; - $.each(rm.logs, function (index, value) { - if (!value) { - status = false; - return false; - } - }); - }, - processedResumables: function () { - var logs = rm.logs, i, count = 0; - if (!logs || !logs.length) { - return 0; - } - for (i = 0; i < logs.length; i++) { - if (logs[i] === true) { - count++; - } - } - return count; - }, - getUploadedSize: function () { - var size = rm.processedResumables() * rm.chunkSize; - return size > rm.file.size ? rm.file.size : size; - }, - getTotalChunks: function () { - var chunkSize = parseFloat(rm.chunkSize); - if (!isNaN(chunkSize) && chunkSize > 0) { - return Math.ceil(rm.file.size / chunkSize); - } - return 0; - }, - getProgress: function () { - var chunksProcessed = rm.processedResumables(), total = rm.chunkCount; - if (total === 0) { - return 0; - } - return Math.ceil(chunksProcessed / total * 100); - }, - checkAborted: function (intervalId) { - if (self._isAborted()) { - clearInterval(intervalId); - self.unlock(); - } - }, - upload: function () { - var ids = fm.getIdList(), flag = 'new', intervalId; - intervalId = setInterval(function () { - var id; - rm.checkAborted(intervalId); - if (flag === 'new') { - self.lock(); - flag = 'processing'; - id = ids.shift(); - fm.initStats(id); - if (fm.stack[id]) { - rm.init(id, fm.stack[id], fm.getIndex(id)); - rm.processUpload(); - } - } - if (!fm.isPending(id) && rm.completed) { - flag = 'new'; - } - if (fm.isProcessed()) { - var $initThumbs = self.$preview.find('.file-preview-initial'); - if ($initThumbs.length) { - $h.addCss($initThumbs, $h.SORT_CSS); - self._initSortable(); - } - clearInterval(intervalId); - self._clearFileInput(); - self.unlock(); - setTimeout(function () { - var data = self.previewCache.data; - if (data) { - self.initialPreview = data.content; - self.initialPreviewConfig = data.config; - self.initialPreviewThumbTags = data.tags; - } - self._raise('filebatchuploadcomplete', [ - self.initialPreview, - self.initialPreviewConfig, - self.initialPreviewThumbTags, - self._getExtraData() - ]); - }, self.processDelay); - } - }, self.processDelay); - }, - uploadResumable: function () { - var i, pool, tm = self.taskManager, total = rm.chunkCount; - pool = tm.addPool(rm.id); - for (i = 0; i < total; i++) { - rm.logs[i] = !!(rm.chunksProcessed[rm.id] && rm.chunksProcessed[rm.id][i]); - if (!rm.logs[i]) { - rm.pushAjax(i, 0); - } - } - pool.run(opts.maxThreads) - .done(function () { - rm.setProcessed('success'); - }) - .fail(function () { - rm.setProcessed(pool.cancelled ? 'cancel' : 'error'); - }); - }, - processUpload: function () { - var fd, f, id = rm.id, fnBefore, fnSuccess, fnError, fnComplete, outData; - if (!opts.testUrl) { - rm.uploadResumable(); - return; - } - fd = new FormData(); - f = fm.stack[id]; - self._setUploadData(fd, { - fileId: id, - fileName: f.fileName, - fileSize: f.size, - fileRelativePath: f.relativePath, - chunkSize: rm.chunkSize, - chunkCount: rm.chunkCount - }); - fnBefore = function (jqXHR) { - outData = self._getOutData(fd, jqXHR); - self._raise('filetestbeforesend', [id, fm, rm, outData]); - }; - fnSuccess = function (data, textStatus, jqXHR) { - outData = self._getOutData(fd, jqXHR, data); - var pNames = self.uploadParamNames, chunksUploaded = pNames.chunksUploaded || 'chunksUploaded', - params = [id, fm, rm, outData]; - if (!data[chunksUploaded] || !$h.isArray(data[chunksUploaded])) { - self._raise('filetesterror', params); - } else { - if (!rm.chunksProcessed[id]) { - rm.chunksProcessed[id] = {}; - } - $.each(data[chunksUploaded], function (key, index) { - rm.logs[index] = true; - rm.chunksProcessed[id][index] = true; - }); - rm.chunksProcessed[id].data = data; - self._raise('filetestsuccess', params); - } - rm.uploadResumable(); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - outData = self._getOutData(fd, jqXHR); - self._raise('filetestajaxerror', [id, fm, rm, outData]); - rm.setAjaxError(jqXHR, textStatus, errorThrown, true); - rm.uploadResumable(); - }; - fnComplete = function () { - self._raise('filetestcomplete', [id, fm, rm, self._getOutData(fd)]); - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex, opts.testUrl); - }, - pushAjax: function (index, retry) { - var tm = self.taskManager, pool = tm.getPool(rm.id); - pool.addTask(pool.size() + 1, function (deferrer) { - // use fifo chunk stack - var arr = rm.stack.shift(), index; - index = arr[0]; - if (!rm.chunksProcessed[rm.id] || !rm.chunksProcessed[rm.id][index]) { - rm.sendAjax(index, arr[1], deferrer); - } else { - self._log(logs.chunkQueueError, {index: index}); - } - }); - rm.stack.push([index, retry]); - }, - sendAjax: function (index, retry, deferrer) { - var f, chunkSize = rm.chunkSize, id = rm.id, file = rm.file, $thumb = rm.$thumb, - msgs = $h.logMessages, $btnDelete = rm.$btnDelete, logError = function (msg, tokens) { - if (tokens) { - msg = msg.setTokens(tokens); - } - msg = msgs.resumableRequestError.setTokens({msg: msg}); - self._log(msg); - deferrer.reject(msg); - }; - if (rm.chunksProcessed[id] && rm.chunksProcessed[id][index]) { - return; - } - if (retry > opts.maxRetries) { - logError(msgs.resumableMaxRetriesReached, {n: opts.maxRetries}); - rm.setProcessed('error'); - return; - } - var fd, outData, fnBefore, fnSuccess, fnError, fnComplete, slice = file.slice ? 'slice' : - (file.mozSlice ? 'mozSlice' : (file.webkitSlice ? 'webkitSlice' : 'slice')), - blob = file[slice](chunkSize * index, chunkSize * (index + 1)); - fd = new FormData(); - f = fm.stack[id]; - self._setUploadData(fd, { - chunkCount: rm.chunkCount, - chunkIndex: index, - chunkSize: chunkSize, - chunkSizeStart: chunkSize * index, - fileBlob: [blob, rm.fileName], - fileId: id, - fileName: rm.fileName, - fileRelativePath: f.relativePath, - fileSize: file.size, - retryCount: retry - }); - if (rm.$progress && rm.$progress.length) { - rm.$progress.show(); - } - fnBefore = function (jqXHR) { - outData = self._getOutData(fd, jqXHR); - if (self.showPreview) { - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnDelete.attr('disabled', true); - } - self._raise('filechunkbeforesend', [id, index, retry, fm, rm, outData]); - }; - fnSuccess = function (data, textStatus, jqXHR) { - if (self._isAborted()) { - logError(msgs.resumableAborting); - return; - } - outData = self._getOutData(fd, jqXHR, data); - var paramNames = self.uploadParamNames, chunkIndex = paramNames.chunkIndex || 'chunkIndex', - params = [id, index, retry, fm, rm, outData]; - if (data.error) { - if (opts.showErrorLog) { - self._log(logs.retryStatus, { - retry: retry + 1, - filename: rm.fileName, - chunk: index - }); - } - self._raise('filechunkerror', params); - rm.pushAjax(index, retry + 1); - rm.error = data.error; - logError(data.error); - } else { - rm.logs[data[chunkIndex]] = true; - if (!rm.chunksProcessed[id]) { - rm.chunksProcessed[id] = {}; - } - rm.chunksProcessed[id][data[chunkIndex]] = true; - rm.chunksProcessed[id].data = data; - deferrer.resolve.call(null, data); - self._raise('filechunksuccess', params); - rm.check(); - } - }; - fnError = function (jqXHR, textStatus, errorThrown) { - if (self._isAborted()) { - logError(msgs.resumableAborting); - return; - } - outData = self._getOutData(fd, jqXHR); - rm.setAjaxError(jqXHR, textStatus, errorThrown); - self._raise('filechunkajaxerror', [id, index, retry, fm, rm, outData]); - rm.pushAjax(index, retry + 1); // push another task - logError(msgs.resumableRetryError, {n: retry - 1}); // resolve the current task - }; - fnComplete = function () { - if (!self._isAborted()) { - self._raise('filechunkcomplete', [id, index, retry, fm, rm, self._getOutData(fd)]); - } - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, fd, id, rm.fileIndex); - } - }; - rm.reset(); - }, - _initTemplateDefaults: function () { - var self = this, tMain1, tMain2, tPreview, tFileIcon, tClose, tCaption, tBtnDefault, tBtnLink, tBtnBrowse, - tModalMain, tModal, tProgress, tSize, tFooter, tActions, tActionDelete, tActionUpload, tActionDownload, - tActionZoom, tActionDrag, tIndicator, tTagBef, tTagBef1, tTagBef2, tTagAft, tGeneric, tHtml, tImage, - tText, tOffice, tGdocs, tVideo, tAudio, tFlash, tObject, tPdf, tOther, tStyle, tZoomCache, vDefaultDim, - tActionRotate, tStats, tModalLabel, tDescClose, renderObject = function (type, mime) { - return '\n' + $h.DEFAULT_PREVIEW + '\n\n'; - }, defBtnCss1 = 'btn btn-sm btn-kv ' + $h.defaultButtonCss(); - tMain1 = '{preview}\n' + - '
\n' + - '
\n' + - '
\n' + - ' {caption}\n\n' + - ($h.isBs(5) ? '' : '
\n') + - ' {remove}\n' + - ' {cancel}\n' + - ' {pause}\n' + - ' {upload}\n' + - ' {browse}\n' + - ($h.isBs(5) ? '' : '
\n') + - '
'; - '
'; - tMain2 = '{preview}\n
\n
\n' + - '{remove}\n{cancel}\n{upload}\n{browse}\n'; - tPreview = '
\n' + - ' {close}' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - '
'; - tClose = $h.closeButton('fileinput-remove'); - tFileIcon = ''; - // noinspection HtmlUnknownAttribute - tCaption = '\n'; - //noinspection HtmlUnknownAttribute - tBtnDefault = ''; - //noinspection HtmlUnknownTarget,HtmlUnknownAttribute - tBtnLink = '{icon} {label}'; - //noinspection HtmlUnknownAttribute - tBtnBrowse = '
{icon} {label}
'; - tModalLabel = $h.MODAL_ID + 'Label'; - tModalMain = ''; - tModal = '\n'; - tDescClose = ''; - tProgress = '
\n' + - '
\n' + - ' {status}\n' + - '
\n' + - '
{stats}'; - tStats = '
' + - '{pendingTime} ' + - '{uploadSpeed}' + - '
'; - tSize = ' ({sizeText})'; - tFooter = ''; - tActions = '
\n' + - ' \n' + - '
\n' + - '{drag}\n' + - '
'; - //noinspection HtmlUnknownAttribute - tActionDelete = '\n'; - tActionUpload = ''; - tActionRotate = ''; - tActionDownload = '{downloadIcon}'; - tActionZoom = ''; - tActionDrag = '{dragIcon}'; - tIndicator = '
{indicator}
'; - tTagBef = '
\n'; - tTagBef2 = tTagBef + ' title="{caption}">
\n'; - tTagAft = '
{footer}\n{zoomCache}
\n'; - tGeneric = '{content}\n'; - tStyle = ' {style}'; - tHtml = renderObject('html', 'text/html'); - tText = renderObject('text', 'text/plain;charset=UTF-8'); - tPdf = renderObject('pdf', 'application/pdf'); - tImage = '{alt}\n'; - tOffice = ''; - tGdocs = ''; - tVideo = '\n'; - tAudio = '\n'; - tFlash = '\n'; - tObject = '\n' + '\n' + - $h.OBJECT_PARAMS + ' ' + $h.DEFAULT_PREVIEW + '\n\n'; - tOther = '
\n' + $h.DEFAULT_PREVIEW + '\n
\n'; - tZoomCache = '
{zoomContent}
'; - vDefaultDim = {width: '100%', height: '100%', 'min-height': '480px'}; - if (self._isPdfRendered()) { - tPdf = self.pdfRendererTemplate.replace('{renderer}', self._encodeURI(self.pdfRendererUrl)); - } - self.defaults = { - layoutTemplates: { - main1: tMain1, - main2: tMain2, - preview: tPreview, - close: tClose, - fileIcon: tFileIcon, - caption: tCaption, - modalMain: tModalMain, - modal: tModal, - descriptionClose: tDescClose, - progress: tProgress, - stats: tStats, - size: tSize, - footer: tFooter, - indicator: tIndicator, - actions: tActions, - actionDelete: tActionDelete, - actionRotate: tActionRotate, - actionUpload: tActionUpload, - actionDownload: tActionDownload, - actionZoom: tActionZoom, - actionDrag: tActionDrag, - btnDefault: tBtnDefault, - btnLink: tBtnLink, - btnBrowse: tBtnBrowse, - zoomCache: tZoomCache - }, - previewMarkupTags: { - tagBefore1: tTagBef1, - tagBefore2: tTagBef2, - tagAfter: tTagAft - }, - previewContentTemplates: { - generic: tGeneric, - html: tHtml, - image: tImage, - text: tText, - office: tOffice, - gdocs: tGdocs, - video: tVideo, - audio: tAudio, - flash: tFlash, - object: tObject, - pdf: tPdf, - other: tOther - }, - allowedPreviewTypes: ['image', 'html', 'text', 'video', 'audio', 'flash', 'pdf', 'object'], - previewTemplates: {}, - previewSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '213px', height: '160px'}, - text: {width: '213px', height: '160px'}, - office: {width: '213px', height: '160px'}, - gdocs: {width: '213px', height: '160px'}, - video: {width: '213px', height: '160px'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '213px', height: '160px'}, - object: {width: '213px', height: '160px'}, - pdf: {width: '100%', height: '160px', 'position': 'relative'}, - other: {width: '213px', height: '160px'} - }, - previewSettingsSmall: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: {width: '100%', height: '160px'}, - text: {width: '100%', height: '160px'}, - office: {width: '100%', height: '160px'}, - gdocs: {width: '100%', height: '160px'}, - video: {width: '100%', height: 'auto'}, - audio: {width: '100%', height: '30px'}, - flash: {width: '100%', height: 'auto'}, - object: {width: '100%', height: 'auto'}, - pdf: {width: '100%', height: '160px'}, - other: {width: '100%', height: '160px'} - }, - previewZoomSettings: { - image: {width: 'auto', height: 'auto', 'max-width': '100%', 'max-height': '100%'}, - html: vDefaultDim, - text: vDefaultDim, - office: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - gdocs: {width: '100%', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - video: {width: 'auto', height: '100%', 'max-width': '100%'}, - audio: {width: '100%', height: '30px'}, - flash: {width: 'auto', height: '480px'}, - object: {width: 'auto', height: '100%', 'max-width': '100%', 'min-height': '480px'}, - pdf: vDefaultDim, - other: {width: 'auto', height: '100%', 'min-height': '480px'} - }, - mimeTypeAliases: { - 'video/quicktime': 'video/mp4' - }, - fileTypeSettings: { - image: function (vType, vName) { - return ($h.compare(vType, 'image.*') && !$h.compare(vType, /(tiff?|wmf)$/i) || - $h.compare(vName, /\.(gif|png|jpe?g)$/i)); - }, - html: function (vType, vName) { - return $h.compare(vType, 'text/html') || $h.compare(vName, /\.(htm|html)$/i); - }, - office: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office)$/i) || - $h.compare(vName, /\.(docx?|xlsx?|pptx?|pps|potx?)$/i); - }, - gdocs: function (vType, vName) { - return $h.compare(vType, /(word|excel|powerpoint|office|iwork-pages|tiff?)$/i) || - $h.compare(vName, - /\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i); - }, - text: function (vType, vName) { - return $h.compare(vType, 'text.*') || $h.compare(vName, /\.(xml|javascript)$/i) || - $h.compare(vName, /\.(txt|md|nfo|ini|json|php|js|css)$/i); - }, - video: function (vType, vName) { - return $h.compare(vType, 'video.*') && ($h.compare(vType, /(ogg|mp4|mp?g|mov|webm|3gp)$/i) || - $h.compare(vName, /\.(og?|mp4|webm|mp?g|mov|3gp)$/i)); - }, - audio: function (vType, vName) { - return $h.compare(vType, 'audio.*') && ($h.compare(vName, /(ogg|mp3|mp?g|wav)$/i) || - $h.compare(vName, /\.(og?|mp3|mp?g|wav)$/i)); - }, - flash: function (vType, vName) { - return $h.compare(vType, 'application/x-shockwave-flash', true) || $h.compare(vName, - /\.(swf)$/i); - }, - pdf: function (vType, vName) { - return $h.compare(vType, 'application/pdf', true) || $h.compare(vName, /\.(pdf)$/i); - }, - object: function () { - return true; - }, - other: function () { - return true; - } - }, - fileActionSettings: { - showRemove: true, - showUpload: true, - showDownload: true, - showZoom: true, - showDrag: true, - showRotate: false, - removeIcon: '', - removeClass: defBtnCss1, - removeErrorClass: 'btn btn-sm btn-kv btn-danger', - removeTitle: 'Remove file', - uploadIcon: '', - uploadClass: defBtnCss1, - uploadTitle: 'Upload file', - uploadRetryIcon: '', - uploadRetryTitle: 'Retry upload', - downloadIcon: '', - downloadClass: defBtnCss1, - downloadTitle: 'Download file', - rotateIcon: '', - rotateClass: defBtnCss1, - rotateTitle: 'Rotate 90 deg. clockwise', - zoomIcon: '', - zoomClass: defBtnCss1, - zoomTitle: 'View Details', - dragIcon: '', - dragClass: 'text-primary', - dragTitle: 'Move / Rearrange', - dragSettings: {}, - indicatorNew: '', - indicatorSuccess: '', - indicatorError: '', - indicatorLoading: '', - indicatorPaused: '', - indicatorNewTitle: 'Not uploaded yet', - indicatorSuccessTitle: 'Uploaded', - indicatorErrorTitle: 'Upload Error', - indicatorLoadingTitle: 'Uploading …', - indicatorPausedTitle: 'Upload Paused' - } - }; - $.each(self.defaults, function (key, setting) { - if (key === 'allowedPreviewTypes') { - if (self.allowedPreviewTypes === undefined) { - self.allowedPreviewTypes = setting; - } - return; - } - self[key] = $.extend(true, {}, setting, self[key]); - }); - self._initPreviewTemplates(); - }, - _initPreviewTemplates: function () { - var self = this, tags = self.previewMarkupTags, tagBef, tagAft = tags.tagAfter; - $.each(self.previewContentTemplates, function (key, value) { - if ($h.isEmpty(self.previewTemplates[key])) { - tagBef = tags.tagBefore2; - if (key === 'generic' || key === 'image') { - tagBef = tags.tagBefore1; - } - if (self._isPdfRendered() && key === 'pdf') { - tagBef = tagBef.replace('kv-file-content', 'kv-file-content kv-pdf-rendered'); - } - self.previewTemplates[key] = tagBef + value + tagAft; - } - }); - }, - _initPreviewCache: function () { - var self = this; - self.previewCache = { - data: {}, - init: function () { - var content = self.initialPreview; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - self.previewCache.data = { - content: content, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - }, - count: function (skipNull) { - if (!self.previewCache.data || !self.previewCache.data.content) { - return 0; - } - if (skipNull) { - var chk = self.previewCache.data.content.filter(function (n) { - return n !== null; - }); - return chk.length; - } - return self.previewCache.data.content.length; - }, - get: function (i, isDisabled) { - var ind = $h.INIT_FLAG + i, data = self.previewCache.data, config = data.config[i], - content = data.content[i], out, $tmp, cat, ftr, - fname, ftype, frameClass, asData = $h.ifSet('previewAsData', config, self.initialPreviewAsData), - a = config ? {title: config.title || null, alt: config.alt || null} : {title: null, alt: null}, - parseTemplate = function (cat, dat, fname, ftype, ftr, ind, fclass, t) { - var fc = ' file-preview-initial ' + $h.SORT_CSS + (fclass ? ' ' + fclass : ''), - id = self.previewInitId + '-' + ind, - fileId = config && config.fileId || id; - /** @namespace config.zoomData */ - return self._generatePreviewTemplate(cat, dat, fname, ftype, id, fileId, false, null, null, fc, - ftr, ind, t, a, config && config.zoomData || dat); - }; - if (!content || !content.length) { - return ''; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - cat = $h.ifSet('type', config, self.initialPreviewFileType || 'generic'); - fname = $h.ifSet('filename', config, $h.ifSet('caption', config)); - ftype = $h.ifSet('filetype', config, cat); - ftr = self.previewCache.footer(i, isDisabled, (config && config.size || null)); - frameClass = $h.ifSet('frameClass', config); - if (asData) { - out = parseTemplate(cat, content, fname, ftype, ftr, ind, frameClass); - } else { - out = parseTemplate('generic', content, fname, ftype, ftr, ind, frameClass, cat) - .setTokens({'content': data.content[i]}); - } - if (data.tags.length && data.tags[i]) { - out = $h.replaceTags(out, data.tags[i]); - } - /** @namespace config.frameAttr */ - if (!$h.isEmpty(config) && !$h.isEmpty(config.frameAttr)) { - $tmp = $h.createElement(out); - $tmp.find('.file-preview-initial').attr(config.frameAttr); - out = $tmp.html(); - $tmp.remove(); - } - return out; - }, - clean: function (data) { - data.content = $h.cleanArray(data.content); - data.config = $h.cleanArray(data.config); - data.tags = $h.cleanArray(data.tags); - self.previewCache.data = data; - }, - add: function (content, config, tags, append) { - var data = self.previewCache.data, index; - if (!content || !content.length) { - return 0; - } - index = content.length - 1; - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (append && data.content) { - index = data.content.push(content[0]) - 1; - data.config[index] = config; - data.tags[index] = tags; - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - return index; - }, - set: function (content, config, tags, append) { - var data = self.previewCache.data, i, chk; - if (!content || !content.length) { - return; - } - if (!$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - chk = content.filter(function (n) { - return n !== null; - }); - if (!chk.length) { - return; - } - if (data.content === undefined) { - data.content = []; - } - if (data.config === undefined) { - data.config = []; - } - if (data.tags === undefined) { - data.tags = []; - } - if (append) { - for (i = 0; i < content.length; i++) { - if (content[i]) { - data.content.push(content[i]); - } - } - for (i = 0; i < config.length; i++) { - if (config[i]) { - data.config.push(config[i]); - } - } - for (i = 0; i < tags.length; i++) { - if (tags[i]) { - data.tags.push(tags[i]); - } - } - } else { - data.content = content; - data.config = config; - data.tags = tags; - } - self.previewCache.clean(data); - }, - unset: function (index) { - var chk = self.previewCache.count(), rev = self.reversePreviewOrder; - if (!chk) { - return; - } - if (chk === 1) { - self.previewCache.data.content = []; - self.previewCache.data.config = []; - self.previewCache.data.tags = []; - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - return; - } - self.previewCache.data.content = $h.spliceArray(self.previewCache.data.content, index, rev); - self.previewCache.data.config = $h.spliceArray(self.previewCache.data.config, index, rev); - self.previewCache.data.tags = $h.spliceArray(self.previewCache.data.tags, index, rev); - var data = $.extend(true, {}, self.previewCache.data); - self.previewCache.clean(data); - }, - out: function () { - var html = '', caption, len = self.previewCache.count(), i, content; - if (len === 0) { - return {content: '', caption: ''}; - } - for (i = 0; i < len; i++) { - content = self.previewCache.get(i); - html = self.reversePreviewOrder ? (content + html) : (html + content); - } - caption = self._getMsgSelected(len); - return {content: html, caption: caption}; - }, - footer: function (i, isDisabled, size) { - var data = self.previewCache.data || {}; - if ($h.isEmpty(data.content)) { - return ''; - } - if ($h.isEmpty(data.config) || $h.isEmpty(data.config[i])) { - data.config[i] = {}; - } - isDisabled = isDisabled === undefined ? true : isDisabled; - var config = data.config[i], caption = $h.ifSet('caption', config), a, - width = $h.ifSet('width', config, 'auto'), url = $h.ifSet('url', config, false), - key = $h.ifSet('key', config, null), fileId = $h.ifSet('fileId', config, null), - fs = self.fileActionSettings, initPreviewShowDel = self.initialPreviewShowDelete || false, - downloadInitialUrl = !self.initialPreviewDownloadUrl ? '' : - self.initialPreviewDownloadUrl + '?key=' + key + (fileId ? '&fileId=' + fileId : ''), - dUrl = config.downloadUrl || downloadInitialUrl, - dFil = config.filename || config.caption || '', - initPreviewShowDwl = !!(dUrl), - sDel = $h.ifSet('showRemove', config, initPreviewShowDel), - sRot = $h.ifSet('showRotate', config, $h.ifSet('showRotate', fs, true)), - sDwl = $h.ifSet('showDownload', config, $h.ifSet('showDownload', fs, initPreviewShowDwl)), - sZm = $h.ifSet('showZoom', config, $h.ifSet('showZoom', fs, true)), - sDrg = $h.ifSet('showDrag', config, $h.ifSet('showDrag', fs, true)), - dis = (url === false) && isDisabled; - sDwl = sDwl && config.downloadUrl !== false && !!dUrl; - a = self._renderFileActions(config, false, sDwl, sDel, sRot, sZm, sDrg, dis, url, key, true, dUrl, dFil); - return self._getLayoutTemplate('footer').setTokens({ - 'progress': self._renderThumbProgress(), - 'actions': a, - 'caption': caption, - 'size': self._getSize(size), - 'width': width, - 'indicator': '' - }); - } - }; - self.previewCache.init(); - }, - _isPdfRendered: function () { - var self = this, useLib = self.usePdfRenderer, - flag = typeof useLib === 'function' ? useLib() : !!useLib; - return flag && self.pdfRendererUrl; - }, - _handler: function ($el, event, callback) { - var self = this, ns = self.namespace, ev = event.split(' ').join(ns + ' ') + ns; - if (!$el || !$el.length) { - return; - } - $el.off(ev).on(ev, callback); - }, - _encodeURI: function (vUrl) { - var self = this; - return self.encodeUrl ? encodeURI(vUrl) : vUrl; - }, - _log: function (msg, tokens) { - var self = this, id = self.$element.attr('id'); - if (!self.showConsoleLogs) { - return; - } - if (id) { - msg = '"' + id + '": ' + msg; - } - msg = 'bootstrap-fileinput: ' + msg; - if (typeof tokens === 'object') { - msg = msg.setTokens(tokens); - } - if (window.console && typeof window.console.log !== 'undefined') { - window.console.log(msg); - } else { - window.alert(msg); - } - }, - _validate: function () { - var self = this, status = self.$element.attr('type') === 'file'; - if (!status) { - self._log($h.logMessages.badInputType); - } - return status; - }, - _errorsExist: function () { - var self = this, $err, $errList = self.$errorContainer.find('li'); - if ($errList.length) { - return true; - } - $err = $h.createElement(self.$errorContainer.html()); - $err.find('.kv-error-close').remove(); - $err.find('ul').remove(); - return !!$.trim($err.text()).length; - }, - _errorHandler: function (evt, caption) { - var self = this, err = evt.target.error, showError = function (msg) { - self._showError(msg.replace('{name}', caption)); - }; - /** @namespace err.NOT_FOUND_ERR */ - /** @namespace err.SECURITY_ERR */ - /** @namespace err.NOT_READABLE_ERR */ - if (err.code === err.NOT_FOUND_ERR) { - showError(self.msgFileNotFound); - } else { - if (err.code === err.SECURITY_ERR) { - showError(self.msgFileSecured); - } else { - if (err.code === err.NOT_READABLE_ERR) { - showError(self.msgFileNotReadable); - } else { - if (err.code === err.ABORT_ERR) { - showError(self.msgFilePreviewAborted); - } else { - showError(self.msgFilePreviewError); - } - } - } - } - }, - _addError: function (msg) { - var self = this, $error = self.$errorContainer; - if (msg && $error.length) { - $h.setHtml($error, self.errorCloseButton + msg); - self._handler($error.find('.kv-error-close'), 'click', function () { - setTimeout(function () { - if (self.showPreview && !self.getFrames().length) { - self.clear(); - } - $error.fadeOut('slow'); - }, self.processDelay); - }); - } - }, - _setValidationError: function (css) { - var self = this; - css = (css ? css + ' ' : '') + 'has-error'; - self.$container.removeClass(css).addClass('has-error'); - $h.addCss(self.$caption, 'is-invalid'); - }, - _resetErrors: function (fade) { - var self = this, $error = self.$errorContainer, history = self.resumableUploadOptions.retainErrorHistory; - if (self.isPersistentError || (self.enableResumableUpload && history && !self.clearInput)) { - return; - } - self.clearInput = false; - self.isError = false; - self.$container.removeClass('has-error'); - self.$caption.removeClass('is-invalid is-valid file-processing'); - $error.html(''); - if (fade) { - $error.fadeOut('slow'); - } else { - $error.hide(); - } - }, - _showFolderError: function (folders) { - var self = this, $error = self.$errorContainer, msg; - if (!folders) { - return; - } - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - msg = self.msgFoldersNotAllowed.replace('{n}', folders); - self._addError(msg); - self._setValidationError(); - $error.fadeIn(self.fadeDelay); - self._raise('filefoldererror', [folders, msg]); - }, - showUserError: function (msg, params, retainErrorHistory) { - var self = this, fileName; - if (!self.uploadInitiated) { - return; - } - if (!params || !params.fileId) { - if (!retainErrorHistory) { - self.$errorContainer.html(''); - } - } else { - if (!retainErrorHistory) { - self.$errorContainer.find('[data-file-id="' + params.fileId + '"]').remove(); - } - fileName = self.fileManager.getFileName(params.fileId); - if (fileName) { - msg = '' + fileName + ': ' + msg; - } - } - self._showFileError(msg, params, 'fileusererror'); - }, - _showFileError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', - fId = params && params.fileId || '', e = params && params.id ? - '
  • ' + msg + '
  • ' : - '
  • ' + msg + '
  • '; - - if ($error.find('ul').length === 0) { - self._addError('
      ' + e + '
    '); - } else { - $error.find('ul').append(e); - } - $error.fadeIn(self.fadeDelay); - self._raise(ev, [params, msg]); - self._setValidationError('file-input-new'); - return true; - }, - _showError: function (msg, params, event) { - var self = this, $error = self.$errorContainer, ev = event || 'fileerror'; - params = params || {}; - params.reader = self.reader; - self._addError(msg); - $error.fadeIn(self.fadeDelay); - self._raise(ev, [params, msg]); - if (!self.isAjaxUpload) { - self._clearFileInput(); - } - self._setValidationError('file-input-new'); - self.$btnUpload.attr('disabled', true); - return true; - }, - _noFilesError: function (params) { - var self = this, label = self.minFileCount > 1 ? self.filePlural : self.fileSingle, - msg = self.msgFilesTooLess.replace('{n}', self.minFileCount).replace('{files}', label), - $error = self.$errorContainer; - msg = '
  • ' + msg + '
  • '; - if ($error.find('ul').length === 0) { - self._addError('
      ' + msg + '
    '); - } else { - $error.find('ul').append(msg); - } - self.isError = true; - self._updateFileDetails(0); - $error.fadeIn(self.fadeDelay); - self._raise('fileerror', [params, msg]); - self._clearFileInput(); - self._setValidationError(); - }, - _parseError: function (operation, jqXHR, errorThrown, fileName) { - /** @namespace jqXHR.responseJSON */ - var self = this, errMsg = $.trim(errorThrown + ''), textPre, errText, text; - errText = jqXHR.responseJSON && jqXHR.responseJSON.error ? jqXHR.responseJSON.error.toString() : ''; - text = errText ? errText : jqXHR.responseText; - if (self.cancelling && self.msgUploadAborted) { - errMsg = self.msgUploadAborted; - } - if (self.showAjaxErrorDetails && text) { - if (errText) { - errMsg = $.trim(errText + ''); - } else { - text = $.trim(text.replace(/\n\s*\n/g, '\n')); - textPre = text.length ? '
    ' + text + '
    ' : ''; - errMsg += errMsg ? textPre : text; - } - } - if (!errMsg) { - errMsg = self.msgAjaxError.replace('{operation}', operation); - } - self.cancelling = false; - return fileName ? '' + fileName + ': ' + errMsg : errMsg; - }, - _parseFileType: function (type, name) { - var self = this, isValid, vType, cat, i, types = self.allowedPreviewTypes || []; - if (type === 'application/text-plain') { - return 'text'; - } - for (i = 0; i < types.length; i++) { - cat = types[i]; - isValid = self.fileTypeSettings[cat]; - vType = isValid(type, name) ? cat : ''; - if (!$h.isEmpty(vType)) { - return vType; - } - } - return 'other'; - }, - _getPreviewIcon: function (fname) { - var self = this, ext, out = null; - if (fname && fname.indexOf('.') > -1) { - ext = fname.split('.').pop(); - if (self.previewFileIconSettings) { - out = self.previewFileIconSettings[ext] || self.previewFileIconSettings[ext.toLowerCase()] || null; - } - if (self.previewFileExtSettings) { - $.each(self.previewFileExtSettings, function (key, func) { - if (self.previewFileIconSettings[key] && func(ext)) { - out = self.previewFileIconSettings[key]; - //noinspection UnnecessaryReturnStatementJS - return; - } - }); - } - } - return out || self.previewFileIcon; - }, - _parseFilePreviewIcon: function (content, fname) { - var self = this, icn = self._getPreviewIcon(fname), out = content; - if (out.indexOf('{previewFileIcon}') > -1) { - out = out.setTokens({'previewFileIconClass': self.previewFileIconClass, 'previewFileIcon': icn}); - } - return out; - }, - _raise: function (event, params) { - var self = this, e = $.Event(event); - if (params !== undefined) { - self.$element.trigger(e, params); - } else { - self.$element.trigger(e); - } - var out = e.result, isAborted = out === false; - if (e.isDefaultPrevented() || isAborted) { - return false; - } - if (e.type === 'filebatchpreupload' && (out || isAborted)) { - self.ajaxAborted = out; - return false; - } - switch (event) { - // ignore these events - case 'filebatchuploadcomplete': - case 'filebatchuploadsuccess': - case 'fileuploaded': - case 'fileclear': - case 'filecleared': - case 'filereset': - case 'fileerror': - case 'filefoldererror': - case 'filecustomerror': - case 'filesuccessremove': - break; - // receive data response via `filecustomerror` event` - default: - if (!self.ajaxAborted) { - self.ajaxAborted = out; - } - break; - } - return true; - }, - _listenFullScreen: function (isFullScreen) { - var self = this, $modal = self.$modal, $btnFull, $btnBord; - if (!$modal || !$modal.length) { - return; - } - $btnFull = $modal && $modal.find('.btn-kv-fullscreen'); - $btnBord = $modal && $modal.find('.btn-kv-borderless'); - if (!$btnFull.length || !$btnBord.length) { - return; - } - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - if (isFullScreen) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - } else { - if (isFullScreen) { - self._maximizeZoomDialog(); - } else { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - }, - _listen: function () { - var self = this, $el = self.$element, $form = self.$form, $cont = self.$container, fullScreenEv; - self._handler($el, 'click', function (e) { - self._initFileSelected(); - if ($el.hasClass('file-no-browse')) { - if ($el.data('zoneClicked')) { - $el.data('zoneClicked', false); - } else { - e.preventDefault(); - } - } - }); - self._handler($el, 'change', $.proxy(self._change, self)); - self._handler(self.$caption, 'paste', $.proxy(self.paste, self)); - if (self.showBrowse) { - self._handler(self.$btnFile, 'click', $.proxy(self._browse, self)); - self._handler(self.$btnFile, 'keypress', function (e) { - var keycode = e.keyCode || e.which; - if (keycode === 13) { - $el.trigger('click'); - self._browse(e); - } - }); - } - self._handler($cont.find('.fileinput-remove:not([disabled])'), 'click', $.proxy(self.clear, self)); - self._handler($cont.find('.fileinput-cancel'), 'click', $.proxy(self.cancel, self)); - self._handler($cont.find('.fileinput-pause'), 'click', $.proxy(self.pause, self)); - self._initDragDrop(); - self._handler($form, 'reset', $.proxy(self.clear, self)); - if (!self.isAjaxUpload) { - self._handler($form, 'submit', $.proxy(self._submitForm, self)); - } - self._handler(self.$container.find('.fileinput-upload'), 'click', $.proxy(self._uploadClick, self)); - self._handler($(window), 'resize', function () { - self._listenFullScreen(screen.width === window.innerWidth && screen.height === window.innerHeight); - }); - fullScreenEv = 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange'; - self._handler($(document), fullScreenEv, function () { - self._listenFullScreen($h.checkFullScreen()); - }); - self.$caption.on('focus', function () { - self.$captionContainer.focus(); - }); - self._autoFitContent(); - self._initClickable(); - self._refreshPreview(); - }, - _autoFitContent: function () { - var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - self = this, config = width < 400 ? (self.previewSettingsSmall || self.defaults.previewSettingsSmall) : - (self.previewSettings || self.defaults.previewSettings), sel; - $.each(config, function (cat, settings) { - sel = '.file-preview-frame .file-preview-' + cat; - self.$preview.find(sel + '.kv-preview-data,' + sel + ' .kv-preview-data').css(settings); - }); - }, - _scanDroppedItems: function (item, files, path) { - path = path || ''; - var self = this, i, dirReader, readDir, errorHandler = function (e) { - self._log($h.logMessages.badDroppedFiles); - self._log(e); - }; - if (item.isFile) { - item.file(function (file) { - if (path) { - file.newPath = path + file.name; - } - files.push(file); - }, errorHandler); - } else { - if (item.isDirectory) { - dirReader = item.createReader(); - readDir = function () { - dirReader.readEntries(function (entries) { - if (entries && entries.length > 0) { - for (i = 0; i < entries.length; i++) { - self._scanDroppedItems(entries[i], files, path + item.name + '/'); - } - // recursively call readDir() again, since browser can only handle first 100 entries. - readDir(); - } - return null; - }, errorHandler); - }; - readDir(); - } - } - - }, - _initDragDrop: function () { - var self = this, $zone = self.$dropZone; - if (self.dropZoneEnabled && self.showPreview) { - self._handler($zone, 'dragenter dragover', $.proxy(self._zoneDragEnter, self)); - self._handler($zone, 'dragleave', $.proxy(self._zoneDragLeave, self)); - self._handler($zone, 'drop', $.proxy(self._zoneDrop, self)); - self._handler($(document), 'dragenter dragover drop', self._zoneDragDropInit); - } - }, - _zoneDragDropInit: function (e) { - e.stopPropagation(); - e.preventDefault(); - }, - _zoneDragEnter: function (e) { - var self = this, dt = e.originalEvent.dataTransfer, hasFiles = $.inArray('Files', dt.types) > -1; - self._zoneDragDropInit(e); - if (self.isDisabled || !hasFiles) { - dt.effectAllowed = 'none'; - dt.dropEffect = 'none'; - return; - } - dt.dropEffect = 'copy'; - if (self._raise('fileDragEnter', {'sourceEvent': e, 'files': dt.types.Files})) { - $h.addCss(self.$dropZone, 'file-highlighted'); - } - }, - _zoneDragLeave: function (e) { - var self = this; - self._zoneDragDropInit(e); - if (self.isDisabled) { - return; - } - if (self._raise('fileDragLeave', {'sourceEvent': e})) { - self.$dropZone.removeClass('file-highlighted'); - } - - }, - _dropFiles: function (e, files) { - var self = this, $el = self.$element; - if (!self.isAjaxUpload) { - self.changeTriggered = true; - $el.get(0).files = files; - setTimeout(function () { - self.changeTriggered = false; - $el.trigger('change' + self.namespace); - }, self.processDelay); - } else { - self._change(e, files); - } - self.$dropZone.removeClass('file-highlighted'); - }, - _zoneDrop: function (e) { - /** @namespace e.originalEvent.dataTransfer */ - var self = this, i, $el = self.$element, dt = e.originalEvent.dataTransfer, - files = dt.files, items = dt.items, folders = $h.getDragDropFolders(items); - e.preventDefault(); - if (self.isDisabled || $h.isEmpty(files)) { - return; - } - if (!self._raise('fileDragDrop', {'sourceEvent': e, 'files': files})) { - return; - } - if (folders > 0) { - if (!self.isAjaxUpload) { - self._showFolderError(folders); - return; - } - files = []; - for (i = 0; i < items.length; i++) { - var item = items[i].webkitGetAsEntry(); - if (item) { - self._scanDroppedItems(item, files); - } - } - setTimeout(function () { - self._dropFiles(e, files); - }, 500); - } else { - self._dropFiles(e, files); - } - }, - _uploadClick: function (e) { - var self = this, $btn = self.$container.find('.fileinput-upload'), $form, - isEnabled = !$btn.hasClass('disabled') && $h.isEmpty($btn.attr('disabled')); - if (e && e.isDefaultPrevented()) { - return; - } - if (!self.isAjaxUpload) { - if (isEnabled && $btn.attr('type') !== 'submit') { - e.preventDefault(); - $form = $btn.closest('form'); - // downgrade to normal form submit if possible - if ($form.length) { - $form.trigger('submit'); - } - } - return; - } - e.preventDefault(); - if (isEnabled) { - self.upload(); - } - }, - _submitForm: function () { - var self = this; - return self._isFileSelectionValid() && !self._abort({}); - }, - _clearPreview: function () { - var self = this, - $thumbs = self.showUploadedThumbs ? self.getFrames(':not(.file-preview-success)') : self.getFrames(); - $thumbs.each(function () { - var $thumb = $(this); - $thumb.remove(); - }); - if (!self.getFrames().length || !self.showPreview) { - self._resetUpload(); - } - self._validateDefaultPreview(); - }, - _initSortable: function () { - var self = this, $el = self.$preview, settings, selector = '.' + $h.SORT_CSS, $cont, $body = $('body'), - $html = $('html'), rev = self.reversePreviewOrder, Sortable = window.Sortable, beginGrab, endGrab; - if (!Sortable || $el.find(selector).length === 0) { - return; - } - $cont = $body.length ? $body : ($html.length ? $html : self.$container); - beginGrab = function () { - $cont.addClass('file-grabbing'); - }; - endGrab = function () { - $cont.removeClass('file-grabbing'); - }; - settings = { - handle: '.drag-handle-init', - dataIdAttr: 'data-fileid', - animation: 600, - draggable: selector, - scroll: false, - forceFallback: true, - onChoose: beginGrab, - onStart: beginGrab, - onUnchoose: endGrab, - onEnd: endGrab, - onSort: function (e) { - var oldIndex = e.oldIndex, newIndex = e.newIndex, i = 0, len = self.initialPreviewConfig.length, - exceedsLast = len > 0 && newIndex >= len, $item = $(e.item), $first; - if (exceedsLast) { - newIndex = len - 1; - } - self.initialPreview = $h.moveArray(self.initialPreview, oldIndex, newIndex, rev); - self.initialPreviewConfig = $h.moveArray(self.initialPreviewConfig, oldIndex, newIndex, rev); - self.previewCache.init(); - self.getFrames('.file-preview-initial').each(function () { - $(this).attr('data-fileindex', $h.INIT_FLAG + i); - i++; - }); - if (exceedsLast) { - $first = self.getFrames(':not(.file-preview-initial):first'); - if ($first.length) { - $item.slideUp(function () { - $item.insertBefore($first).slideDown(); - }); - } - } - self._raise('filesorted', { - previewId: $item.attr('id'), - 'oldIndex': oldIndex, - 'newIndex': newIndex, - stack: self.initialPreviewConfig - }); - }, - }; - $.extend(true, settings, self.fileActionSettings.dragSettings); - if (self.sortable) { - self.sortable.destroy(); - } - self.sortable = Sortable.create($el[0], settings); - }, - _setPreviewContent: function (content) { - var self = this; - $h.setHtml(self.$preview, content); - self._autoFitContent(); - }, - _initPreviewImageOrientations: function () { - var self = this, i = 0, canOrientImage = self.canOrientImage; - if (!self.autoOrientImageInitial && !canOrientImage) { - return; - } - self.getFrames('.file-preview-initial').each(function () { - var $thumb = $(this), $img, $zoomImg, id, config = self.initialPreviewConfig[i]; - /** @namespace config.exif */ - if (config && config.exif && config.exif.Orientation) { - id = $thumb.attr('id'); - $img = $thumb.find('>.kv-file-content img'); - $zoomImg = self._getZoom(id, ' >.kv-file-content img'); - if (canOrientImage) { - $img.css('image-orientation', (self.autoOrientImageInitial ? 'from-image' : 'none')); - } else { - self.setImageOrientation($img, $zoomImg, config.exif.Orientation, $thumb); - } - } - i++; - }); - }, - _initPreview: function (isInit) { - var self = this, cap = self.initialCaption || '', out; - if (!self.previewCache.count(true)) { - self._clearPreview(); - if (isInit) { - self._setCaption(cap); - } else { - self._initCaption(); - } - return; - } - out = self.previewCache.out(); - cap = isInit && self.initialCaption ? self.initialCaption : out.caption; - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(cap); - self._initSortable(); - if (!$h.isEmpty(out.content)) { - self.$container.removeClass('file-input-new'); - } - self._initPreviewImageOrientations(); - }, - _getZoomButton: function (type) { - var self = this, label = self.previewZoomButtonIcons[type], css = self.previewZoomButtonClasses[type], - title = ' title="' + (self.previewZoomButtonTitles[type] || '') + '" ', tag = $h.isBs(5) ? 'bs-' : '', - params = title + (type === 'close' ? ' data-' + tag + 'dismiss="modal" aria-hidden="true"' : ''); - if (type === 'fullscreen' || type === 'borderless' || type === 'toggleheader') { - params += ' data-toggle="button" aria-pressed="false" autocomplete="off"'; - } - return ''; - }, - _getModalContent: function () { - var self = this; - return self._getLayoutTemplate('modal').setTokens({ - 'rtl': self.rtl ? ' kv-rtl' : '', - 'zoomFrameClass': self.frameClass, - 'prev': self._getZoomButton('prev'), - 'next': self._getZoomButton('next'), - 'rotate': self._getZoomButton('rotate'), - 'toggleheader': self._getZoomButton('toggleheader'), - 'fullscreen': self._getZoomButton('fullscreen'), - 'borderless': self._getZoomButton('borderless'), - 'close': self._getZoomButton('close') - }); - }, - _listenModalEvent: function (event) { - var self = this, $modal = self.$modal, getParams = function (e) { - return { - sourceEvent: e, - previewId: $modal.data('previewId'), - modal: $modal - }; - }; - $modal.on(event + '.bs.modal', function (e) { - if (e.namespace !== 'bs.modal') { - return; - } - var $btnFull = $modal.find('.btn-fullscreen'), $btnBord = $modal.find('.btn-borderless'); - if ($modal.data('fileinputPluginId') === self.$element.attr('id')) { - self._raise('filezoom' + event, getParams(e)); - } - if (event === 'shown') { - self._handleRotation($modal, $modal.find('.file-zoom-detail'), $modal.data('angle')); - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - if ($modal.hasClass('file-zoom-fullscreen')) { - self._maximizeZoomDialog(); - if ($h.checkFullScreen()) { - $btnFull.addClass('active').attr('aria-pressed', 'true'); - } else { - $btnBord.addClass('active').attr('aria-pressed', 'true'); - } - } - } - }); - }, - _initZoom: function () { - var self = this, $dialog, modalMain = self._getLayoutTemplate('modalMain'), modalId = '#' + $h.MODAL_ID; - modalMain = self._setTabIndex('modal', modalMain); - if (!self.showPreview) { - return; - } - self.$modal = $(modalId); - if (!self.$modal || !self.$modal.length) { - $dialog = $h.createElement($h.cspBuffer.stash(modalMain)).insertAfter(self.$container); - self.$modal = $(modalId).insertBefore($dialog); - $h.cspBuffer.apply(self.$modal); - $dialog.remove(); - } - $h.initModal(self.$modal); - self.$modal.html($h.cspBuffer.stash(self._getModalContent())); - $h.cspBuffer.apply(self.$modal); - $.each($h.MODAL_EVENTS, function (key, event) { - self._listenModalEvent(event); - }); - }, - _initZoomButtons: function () { - var self = this, $modal = self.$modal, previewId = $modal.data('previewId') || '', $first, $last, - thumbs = self.getFrames().toArray(), len = thumbs.length, $prev = $modal.find('.btn-kv-prev'), - $next = $modal.find('.btn-kv-next'), $rotate = $modal.find('.btn-kv-rotate'); - if (thumbs.length < 2) { - $prev.hide(); - $next.hide(); - return; - } else { - $prev.show(); - $next.show(); - } - if (!len) { - return; - } - $first = $(thumbs[0]); - $last = $(thumbs[len - 1]); - $prev.removeAttr('disabled'); - $next.removeAttr('disabled'); - if (self.reversePreviewOrder) { - [$prev, $next] = [$next, $prev]; // swap - } - if ($first.length && $first.attr('id') === previewId) { - $prev.attr('disabled', true); - } - if ($last.length && $last.attr('id') === previewId) { - $next.attr('disabled', true); - } - }, - _maximizeZoomDialog: function () { - var self = this, $modal = self.$modal, $head = $modal.find('.modal-header:visible'), - $foot = $modal.find('.modal-footer:visible'), $body = $modal.find('.kv-zoom-body'), - h = $(window).height(), diff = 0; - $modal.addClass('file-zoom-fullscreen'); - if ($head && $head.length) { - h -= $head.outerHeight(true); - } - if ($foot && $foot.length) { - h -= $foot.outerHeight(true); - } - if ($body && $body.length) { - diff = $body.outerHeight(true) - $body.height(); - h -= diff; - } - $modal.find('.kv-zoom-body').height(h); - }, - _resizeZoomDialog: function (fullScreen) { - var self = this, $modal = self.$modal, $btnFull = $modal.find('.btn-kv-fullscreen'), - $btnBord = $modal.find('.btn-kv-borderless'); - if ($modal.hasClass('file-zoom-fullscreen')) { - $h.toggleFullScreen(false); - if (!fullScreen) { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self.$modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); - } else { - $btnFull.removeClass('active').attr('aria-pressed', 'false'); - } - } else { - if (!$btnFull.hasClass('active')) { - $modal.removeClass('file-zoom-fullscreen'); - self._resizeZoomDialog(true); - if ($btnBord.hasClass('active')) { - $btnBord.removeClass('active').attr('aria-pressed', 'false'); - } - } - } - } else { - if (!fullScreen) { - self._maximizeZoomDialog(); - return; - } - $h.toggleFullScreen(true); - } - $modal.focus(); - }, - _setZoomContent: function ($frame, navigate) { - var self = this, $content, tmplt, body, title, $body, $dataEl, config, previewId = $frame.attr('id'), - $zoomPreview = self._getZoom(previewId), $modal = self.$modal, $tmp, desc, $desc, - $btnFull = $modal.find('.btn-kv-fullscreen'), $btnBord = $modal.find('.btn-kv-borderless'), cap, size, - $btnTogh = $modal.find('.btn-kv-toggleheader'), dir = navigate === 'prev' ? 'Left' : 'Right', - slideIn = 'slideIn' + dir, slideOut = 'slideOut' + dir, parsed, zoomData = $frame.data('zoom'); - if (zoomData) { - zoomData = decodeURIComponent(zoomData); - parsed = $zoomPreview.html().replace(self.zoomPlaceholder, '').setTokens({zoomData: zoomData}); - $zoomPreview.html(parsed); - $frame.data('zoom', ''); - $zoomPreview.attr('data-zoom', zoomData); - } - tmplt = $zoomPreview.attr('data-template') || 'generic'; - $content = $zoomPreview.find('.kv-file-content'); - body = $content.length ? $content.html() : ''; - cap = $frame.data('caption') || self.msgZoomModalHeading; - size = $frame.data('size') || ''; - desc = $frame.data('description') || ''; - $modal.find('.kv-zoom-caption').attr('title', cap).html(cap); - $modal.find('.kv-zoom-size').html(size); - $desc = $modal.find('.kv-zoom-description').hide(); - if (desc) { - if (self.showDescriptionClose) { - desc = self._getLayoutTemplate('descriptionClose').setTokens({ - closeIcon: self.previewZoomButtonIcons.close - }) + '' + desc; - } - $desc.show().html(desc); - if (self.showDescriptionClose) { - self._handler($modal.find('.kv-desc-hide'), 'click', function () { - $(this).parent().fadeOut('fast', function () { - $modal.focus(); - }); - }); - } - } - $body = $modal.find('.kv-zoom-body'); - $modal.removeClass('kv-single-content'); - if (navigate) { - $tmp = $body.addClass('file-thumb-loading').clone().insertAfter($body); - $h.setHtml($body, body).hide(); - $tmp.fadeOut('fast', function () { - $body.fadeIn('fast', function () { - $body.removeClass('file-thumb-loading'); - }); - $tmp.remove(); - }); - } else { - $h.setHtml($body, body); - } - config = self.previewZoomSettings[tmplt]; - if (config) { - $dataEl = $body.find('.kv-preview-data'); - $h.addCss($dataEl, 'file-zoom-detail'); - $.each(config, function (key, value) { - $dataEl.css(key, value); - if (($dataEl.attr('width') && key === 'width') || ($dataEl.attr('height') && key === 'height')) { - $dataEl.removeAttr(key); - } - }); - } - $modal.data('previewId', previewId); - self._handler($modal.find('.btn-kv-prev'), 'click', function () { - self._zoomSlideShow('prev', previewId); - }); - self._handler($modal.find('.btn-kv-next'), 'click', function () { - self._zoomSlideShow('next', previewId); - }); - self._handler($btnFull, 'click', function () { - self._resizeZoomDialog(true); - }); - self._handler($btnBord, 'click', function () { - self._resizeZoomDialog(false); - }); - self._handler($btnTogh, 'click', function () { - var $header = $modal.find('.modal-header'), $floatBar = $modal.find('.floating-buttons'), - ht, $actions = $header.find('.kv-zoom-actions'), resize = function (height) { - var $body = self.$modal.find('.kv-zoom-body'), h = self.zoomModalHeight; - if ($modal.hasClass('file-zoom-fullscreen')) { - h = $body.outerHeight(true); - if (!height) { - h = h - $header.outerHeight(true); - } - } - $body.css('height', height ? h + height : h); - }; - if ($header.is(':visible')) { - ht = $header.outerHeight(true); - $header.slideUp('slow', function () { - $actions.find('.btn').appendTo($floatBar); - resize(ht); - }); - } else { - $floatBar.find('.btn').appendTo($actions); - $header.slideDown('slow', function () { - resize(); - }); - } - $modal.focus(); - }); - self._handler($modal, 'keydown', function (e) { - var key = e.which || e.keyCode, delay = self.processDelay + 1, $prev = $(this).find('.btn-kv-prev'), - $next = $(this).find('.btn-kv-next'), vId = $(this).data('previewId'), vPrevKey, vNextKey; - [vPrevKey, vNextKey] = self.rtl ? [39, 37] : [37, 39]; - $.each({prev: [$prev, vPrevKey], next: [$next, vNextKey]}, function (direction, config) { - var $btn = config[0], vKey = config[1]; - if (key === vKey && $btn.length) { - $modal.focus(); - if (!$btn.attr('disabled')) { - $btn.blur(); - setTimeout(function () { - $btn.focus(); - self._zoomSlideShow(direction, vId); - setTimeout(function () { - if ($btn.attr('disabled')) { - $modal.focus(); - } - }, delay); - }, delay); - } - } - }); - }); - }, - _showModal: function ($frame) { - var self = this, $modal = self.$modal, $content, css, angle; - if (!$frame || !$frame.length) { - return; - } - $h.initModal($modal); - $h.setHtml($modal, self._getModalContent()); - self._setZoomContent($frame); - $modal.removeClass('rotatable'); - $modal.data({backdrop: false, fileinputPluginId: self.$element.attr('id')}); - $modal.find('.kv-zoom-body').css('height', self.zoomModalHeight); - $content = $frame.find('.kv-file-content > :first-child'); - if ($content.length) { - css = $content.css('transform'); - if (css) { - $modal.find('.file-zoom-detail').css('transform', css); - } - } - if ($frame.hasClass('rotatable')) { - $modal.addClass('rotatable'); - } - if ($frame.data('angle')) { - $modal.data('angle', $frame.data('angle')); - } - angle = ($frame.data('angle') || 0); - $modal.modal('show'); - self._initZoomButtons(); - self._initRotateZoom($frame, $content); - }, - _zoomPreview: function ($btn) { - var self = this, $frame; - if (!$btn.length) { - throw 'Cannot zoom to detailed preview!'; - } - $frame = $btn.closest($h.FRAMES); - self._showModal($frame); - }, - _zoomSlideShow: function (dir, previewId) { - var self = this, $modal = self.$modal, $btn = $modal.find('.kv-zoom-actions .btn-kv-' + dir), $targFrame, i, - $thumb, thumbsData = self.getFrames().toArray(), thumbs = [], len = thumbsData.length, out, angle, - $content; - if (self.reversePreviewOrder) { - dir = dir === 'prev' ? 'next' : 'prev'; - } - if ($btn.attr('disabled')) { - return; - } - for (i = 0; i < len; i++) { - $thumb = $(thumbsData[i]); - if ($thumb && $thumb.length && $thumb.find('.kv-file-zoom:visible').length) { - thumbs.push(thumbsData[i]); - } - } - len = thumbs.length; - for (i = 0; i < len; i++) { - if ($(thumbs[i]).attr('id') === previewId) { - out = dir === 'prev' ? i - 1 : i + 1; - break; - } - } - if (out < 0 || out >= len || !thumbs[out]) { - return; - } - $targFrame = $(thumbs[out]); - if ($targFrame.length) { - self._setZoomContent($targFrame, dir); - } - self._initZoomButtons(); - if ($targFrame.length && $targFrame.hasClass('rotatable')) { - angle = $targFrame.data('angle') || 0; - $modal.addClass('rotatable').data('angle', angle); - $content = $targFrame.find('.kv-file-content > :first-child'); - self._initRotateZoom($targFrame, $content); - } else { - $modal.removeClass('rotatable').removeData('angle'); - } - self._raise('filezoom' + dir, {'previewId': previewId, modal: self.$modal}); - }, - _initZoomButton: function () { - var self = this; - self.$preview.find('.kv-file-zoom').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - self._zoomPreview($el); - }); - }); - }, - _inputFileCount: function () { - return this.$element[0].files.length; - }, - _refreshPreview: function () { - var self = this, files; - if ((!self._inputFileCount() && !self.isAjaxUpload) || !self.showPreview || !self.isPreviewable) { - return; - } - if (self.isAjaxUpload) { - if (self.fileManager.count() > 0) { - files = $.extend(true, [], self.getFileList()); - self.fileManager.clear(); - self._clearFileInput(); - } else { - files = self.$element[0].files; - } - } else { - files = self.$element[0].files; - } - if (files && files.length) { - self.readFiles(files); - } - }, - _clearObjects: function ($el) { - $el.find('video audio').each(function () { - this.pause(); - $(this).remove(); - }); - $el.find('img object div').each(function () { - $(this).remove(); - }); - }, - _clearFileInput: function () { - var self = this, $el = self.$element, $srcFrm, $tmpFrm, $tmpEl; - if (!self._inputFileCount()) { - return; - } - $srcFrm = $el.closest('form'); - $tmpFrm = $(document.createElement('form')); - $tmpEl = $(document.createElement('div')); - $el.before($tmpEl); - if ($srcFrm.length) { - $srcFrm.after($tmpFrm); - } else { - $tmpEl.after($tmpFrm); - } - $tmpFrm.append($el).trigger('reset'); - $tmpEl.before($el).remove(); - $tmpFrm.remove(); - }, - _resetUpload: function () { - var self = this; - self.uploadInitiated = false; - self.uploadStartTime = $h.now(); - self.uploadCache = []; - self.$btnUpload.removeAttr('disabled'); - self._setProgress(0); - self._hideProgress(); - self._resetErrors(false); - self._initAjax(); - self.fileManager.clearImages(); - self._resetCanvas(); - if (self.overwriteInitial) { - self.initialPreview = []; - self.initialPreviewConfig = []; - self.initialPreviewThumbTags = []; - self.previewCache.data = { - content: [], - config: [], - tags: [] - }; - } - }, - _resetCanvas: function () { - var self = this; - if (self.imageCanvas && self.imageCanvasContext) { - self.imageCanvasContext.clearRect(0, 0, self.imageCanvas.width, self.imageCanvas.height); - } - }, - _hasInitialPreview: function () { - var self = this; - return !self.overwriteInitial && self.previewCache.count(true); - }, - _resetPreview: function () { - var self = this, out, cap, $div, hasSuc = self.showUploadedThumbs, hasErr = !self.removeFromPreviewOnError, - includeProcessed = (hasSuc || hasErr) && self.isDuplicateError; - if (self.previewCache.count(true)) { - out = self.previewCache.out(); - if (includeProcessed) { - $div = $h.createElement('').insertAfter(self.$container); - self.getFrames().each(function () { - var $thumb = $(this); - if ((hasSuc && $thumb.hasClass('file-preview-success')) || - (hasErr && $thumb.hasClass('file-preview-error'))) { - $div.append($thumb); - } - }); - } - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - cap = self.initialCaption ? self.initialCaption : out.caption; - self._setCaption(cap); - if (includeProcessed) { - $div.contents().appendTo(self.$preview); - $div.remove(); - } - } else { - self._clearPreview(); - self._initCaption(); - } - if (self.showPreview) { - self._initZoom(); - self._initSortable(); - } - self.isDuplicateError = false; - }, - _clearDefaultPreview: function () { - var self = this; - self.$preview.find('.file-default-preview').remove(); - }, - _validateDefaultPreview: function () { - var self = this; - if (!self.showPreview || $h.isEmpty(self.defaultPreviewContent)) { - return; - } - self._setPreviewContent('
    ' + self.defaultPreviewContent + '
    '); - self.$container.removeClass('file-input-new'); - self._initClickable(); - }, - _resetPreviewThumbs: function (isAjax) { - var self = this, out; - if (isAjax) { - self._clearPreview(); - self.clearFileStack(); - return; - } - if (self._hasInitialPreview()) { - out = self.previewCache.out(); - self._setPreviewContent(out.content); - self._setInitThumbAttr(); - self._setCaption(out.caption); - self._initPreviewActions(); - } else { - self._clearPreview(); - } - }, - _getLayoutTemplate: function (t) { - var self = this, template = self.layoutTemplates[t]; - if ($h.isEmpty(self.customLayoutTags)) { - return template; - } - return $h.replaceTags(template, self.customLayoutTags); - }, - _getPreviewTemplate: function (t) { - var self = this, templates = self.previewTemplates, template = templates[t] || templates.other; - if ($h.isEmpty(self.customPreviewTags)) { - return template; - } - return $h.replaceTags(template, self.customPreviewTags); - }, - _getOutData: function (formdata, jqXHR, responseData, filesData) { - var self = this; - jqXHR = jqXHR || {}; - responseData = responseData || {}; - filesData = filesData || self.fileManager.list(); - return { - formdata: formdata, - files: filesData, - filenames: self.filenames, - filescount: self.getFilesCount(), - extra: self._getExtraData(), - response: responseData, - reader: self.reader, - jqXHR: jqXHR - }; - }, - _getMsgSelected: function (n, processing) { - var self = this, strFiles = n === 1 ? self.fileSingle : self.filePlural; - return n > 0 ? self.msgSelected.replace('{n}', n).replace('{files}', strFiles) : - (processing ? self.msgProcessing : self.msgNoFilesSelected); - }, - _getFrame: function (id, skipWarning) { - var self = this, $frame = $h.getFrameElement(self.$preview, id); - if (self.showPreview && !skipWarning && !$frame.length) { - self._log($h.logMessages.invalidThumb, {id: id}); - } - return $frame; - }, - _getZoom: function (id, selector) { - var self = this, $frame = $h.getZoomElement(self.$preview, id, selector); - if (self.showPreview && !$frame.length) { - self._log($h.logMessages.invalidThumb, {id: id}); - } - return $frame; - }, - _getThumbs: function (css) { - css = css || ''; - return this.getFrames(':not(.file-preview-initial)' + css); - }, - _getThumbId: function (fileId) { - var self = this; - return self.previewInitId + '-' + fileId; - }, - _getExtraData: function (fileId, index) { - var self = this, data = self.uploadExtraData; - if (typeof self.uploadExtraData === 'function') { - data = self.uploadExtraData(fileId, index); - } - return data; - }, - _initXhr: function (xhrobj, fileId) { - var self = this, fm = self.fileManager, func = function (event) { - var pct = 0, total = event.total, loaded = event.loaded || event.position, - stats = fm.getUploadStats(fileId, loaded, total); - /** @namespace event.lengthComputable */ - if (event.lengthComputable && !self.enableResumableUpload) { - pct = $h.round(loaded / total * 100); - } - if (fileId) { - self._setFileUploadStats(fileId, pct, stats); - } else { - self._setProgress(pct, null, null, self._getStats(stats)); - } - self._raise('fileajaxprogress', [stats]); - }; - if (xhrobj.upload) { - if (self.progressDelay) { - func = $h.debounce(func, self.progressDelay); - } - xhrobj.upload.addEventListener('progress', func, false); - } - return xhrobj; - }, - _initAjaxSettings: function () { - var self = this; - self._ajaxSettings = $.extend(true, {}, self.ajaxSettings); - self._ajaxDeleteSettings = $.extend(true, {}, self.ajaxDeleteSettings); - }, - _mergeAjaxCallback: function (funcName, srcFunc, type) { - var self = this, settings = self._ajaxSettings, flag = self.mergeAjaxCallbacks, targFunc; - if (type === 'delete') { - settings = self._ajaxDeleteSettings; - flag = self.mergeAjaxDeleteCallbacks; - } - targFunc = settings[funcName]; - if (flag && typeof targFunc === 'function') { - if (flag === 'before') { - settings[funcName] = function () { - targFunc.apply(this, arguments); - srcFunc.apply(this, arguments); - }; - } else { - settings[funcName] = function () { - srcFunc.apply(this, arguments); - targFunc.apply(this, arguments); - }; - } - } else { - settings[funcName] = srcFunc; - } - }, - _ajaxSubmit: function (fnBefore, fnSuccess, fnComplete, fnError, formdata, fileId, index, vUrl) { - var self = this, settings, defaults, data, tm = self.taskManager; - if (!self._raise('filepreajax', [formdata, fileId, index])) { - return; - } - formdata.append('initialPreview', JSON.stringify(self.initialPreview)); - formdata.append('initialPreviewConfig', JSON.stringify(self.initialPreviewConfig)); - formdata.append('initialPreviewThumbTags', JSON.stringify(self.initialPreviewThumbTags)); - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore); - self._mergeAjaxCallback('success', fnSuccess); - self._mergeAjaxCallback('complete', fnComplete); - self._mergeAjaxCallback('error', fnError); - vUrl = vUrl || self.uploadUrlThumb || self.uploadUrl; - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - data = self._getExtraData(fileId, index) || {}; - if (typeof data === 'object') { - $.each(data, function (key, value) { - formdata.append(key, value); - }); - } - defaults = { - xhr: function () { - var xhrobj = $.ajaxSettings.xhr(); - return self._initXhr(xhrobj, fileId); - }, - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: formdata, - cache: false, - processData: false, - contentType: false - }; - settings = $.extend(true, {}, defaults, self._ajaxSettings); - self.ajaxQueue.push(settings); - tm.addTask(fileId + '-' + index, function () { - var self = this.self, config, xhr; - config = self.ajaxQueue.shift(); - xhr = $.ajax(config); - self.ajaxRequests.push(xhr); - }).runWithContext({self: self}); - }, - _mergeArray: function (prop, content) { - var self = this, arr1 = $h.cleanArray(self[prop]), arr2 = $h.cleanArray(content); - self[prop] = arr1.concat(arr2); - }, - _initUploadSuccess: function (out, $thumb, allFiles) { - var self = this, append, data, index, $div, content, config, tags, id, i; - if (!self.showPreview || typeof out !== 'object' || $.isEmptyObject(out)) { - self._resetCaption(); - return; - } - if (out.initialPreview !== undefined && out.initialPreview.length > 0) { - self.hasInitData = true; - content = out.initialPreview || []; - config = out.initialPreviewConfig || []; - tags = out.initialPreviewThumbTags || []; - append = out.append === undefined || out.append; - if (content.length > 0 && !$h.isArray(content)) { - content = content.split(self.initialPreviewDelimiter); - } - if (content.length) { - self._mergeArray('initialPreview', content); - self._mergeArray('initialPreviewConfig', config); - self._mergeArray('initialPreviewThumbTags', tags); - } - if ($thumb !== undefined) { - if (!allFiles) { - index = self.previewCache.add(content[0], config[0], tags[0], append); - data = self.previewCache.get(index, false); - $div = $h.createElement(data).hide().appendTo($thumb); - $thumb.fadeOut('slow', function () { - var $newThumb = $div.find('> .file-preview-frame'); - if ($newThumb && $newThumb.length) { - $newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block'); - } - self._initPreviewActions(); - self._clearFileInput(); - $thumb.remove(); - $div.remove(); - self._initSortable(); - }); - } else { - id = $thumb.attr('id'); - i = self._getUploadCacheIndex(id); - if (i !== null) { - self.uploadCache[i] = { - id: id, - content: content[0], - config: config[0] || [], - tags: tags[0] || [], - append: append - }; - } - } - } else { - self.previewCache.set(content, config, tags, append); - self._initPreview(); - self._initPreviewActions(); - } - } - self._resetCaption(); - }, - _getUploadCacheIndex: function (id) { - var self = this, i, len = self.uploadCache.length, config; - for (i = 0; i < len; i++) { - config = self.uploadCache[i]; - if (config.id === id) { - return i; - } - } - return null; - }, - _initSuccessThumbs: function () { - var self = this; - if (!self.showPreview) { - return; - } - setTimeout(function () { - self._getThumbs($h.FRAMES + '.file-preview-success').each(function () { - var $thumb = $(this), $remove = $thumb.find('.kv-file-remove'); - $remove.removeAttr('disabled'); - self._handler($remove, 'click', function () { - var id = $thumb.attr('id'), - out = self._raise('filesuccessremove', [id, $thumb.attr('data-fileindex')]); - $h.cleanMemory($thumb); - if (out === false) { - return; - } - self.$caption.attr('title', ''); - $thumb.fadeOut('slow', function () { - var fm = self.fileManager; - $thumb.remove(); - if (!self.getFrames().length) { - self.reset(); - } - }); - }); - }); - }, self.processDelay); - }, - _updateInitialPreview: function () { - var self = this, u = self.uploadCache; - if (self.showPreview) { - $.each(u, function (key, setting) { - self.previewCache.add(setting.content, setting.config, setting.tags, setting.append); - }); - if (self.hasInitData) { - self._initPreview(); - self._initPreviewActions(); - } - } - }, - _getThumbFileId: function ($thumb) { - var self = this; - if (self.showPreview && $thumb !== undefined) { - return $thumb.attr('data-fileid'); - } - return null; - }, - _getThumbFile: function ($thumb) { - var self = this, id = self._getThumbFileId($thumb); - return id ? self.fileManager.getFile(id) : null; - }, - _uploadSingle: function (i, id, isBatch, deferrer) { - var self = this, fm = self.fileManager, count = fm.count(), formdata = new FormData(), outData, - previewId = self._getThumbId(id), $thumb, chkComplete, $btnUpload, $btnDelete, - hasPostData = count > 0 || !$.isEmptyObject(self.uploadExtraData), uploadFailed, $prog, fnBefore, - errMsg, fnSuccess, fnComplete, fnError, updateUploadLog, op = self.ajaxOperations.uploadThumb, - fileObj = fm.getFile(id), params = {id: previewId, index: i, fileId: id}, - fileName = self.fileManager.getFileName(id, true), resolve = function () { - if (deferrer && deferrer.resolve) { - deferrer.resolve(); - } - }, reject = function () { - if (deferrer && deferrer.reject) { - deferrer.reject(); - } - }; - if (self.enableResumableUpload) { // not enabled for resumable uploads - return; - } - self.uploadInitiated = true; - if (self.showPreview) { - $thumb = fm.getThumb(id); - $prog = $thumb.find('.file-thumb-progress'); - $btnUpload = $thumb.find('.kv-file-upload'); - $btnDelete = $thumb.find('.kv-file-remove'); - $prog.show(); - } - if (count === 0 || !hasPostData || (self.showPreview && $btnUpload && $btnUpload.hasClass('disabled')) || - self._abort(params)) { - return; - } - updateUploadLog = function () { - if (!uploadFailed) { - fm.removeFile(id); - } else { - fm.errors.push(id); - } - fm.setProcessed(id); - if (fm.isProcessed()) { - self.fileBatchCompleted = true; - chkComplete(); - } - }; - chkComplete = function () { - var $initThumbs; - if (!self.fileBatchCompleted) { - return; - } - setTimeout(function () { - var triggerReset = fm.count() === 0, errCount = fm.errors.length; - self._updateInitialPreview(); - self.unlock(triggerReset); - if (triggerReset) { - self._clearFileInput(); - } - $initThumbs = self.$preview.find('.file-preview-initial'); - if (self.uploadAsync && $initThumbs.length) { - $h.addCss($initThumbs, $h.SORT_CSS); - self._initSortable(); - } - self._raise('filebatchuploadcomplete', [fm.stack, self._getExtraData()]); - if (!self.retryErrorUploads || errCount === 0) { - fm.clear(); - } - self._setProgress(101); - self.ajaxAborted = false; - self.uploadInitiated = false; - }, self.processDelay); - }; - fnBefore = function (jqXHR) { - outData = self._getOutData(formdata, jqXHR); - fm.initStats(id); - self.fileBatchCompleted = false; - if (!isBatch) { - self.ajaxAborted = false; - } - if (self.showPreview) { - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - } - if (!isBatch) { - self.lock(); - } - if (fm.errors.indexOf(id) !== -1) { - delete fm.errors[id]; - } - self._raise('filepreupload', [outData, previewId, i, self._getThumbFileId($thumb)]); - $.extend(true, params, outData); - if (self._abort(params)) { - jqXHR.abort(); - - if (!isBatch) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - } - self._setProgressCancelled(); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var pid = self.showPreview && $thumb.attr('id') ? $thumb.attr('id') : previewId; - outData = self._getOutData(formdata, jqXHR, data); - $.extend(true, params, outData); - setTimeout(function () { - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - if (self.showPreview) { - self._setThumbStatus($thumb, 'Success'); - $btnUpload.hide(); - self._initUploadSuccess(data, $thumb, isBatch); - self._setProgress(101, $prog); - } - self._raise('fileuploaded', [outData, pid, i, self._getThumbFileId($thumb)]); - if (!isBatch) { - self.fileManager.remove($thumb); - } else { - updateUploadLog(); - resolve(); - } - } else { - uploadFailed = true; - errMsg = self._parseError(op, jqXHR, self.msgUploadError, self.fileManager.getFileName(id)); - self._showFileError(errMsg, params); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - if (isBatch) { - updateUploadLog(); - resolve(); - } - self._setProgress(101, self._getFrame(pid).find('.file-thumb-progress'), - self.msgUploadError); - } - }, self.processDelay); - }; - fnComplete = function () { - if (self.showPreview) { - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - $thumb.removeClass('file-uploading'); - } - if (!isBatch) { - self.unlock(false); - self._clearFileInput(); - } else { - chkComplete(); - } - self._initSuccessThumbs(); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - errMsg = self._parseError(op, jqXHR, errorThrown, self.fileManager.getFileName(id)); - uploadFailed = true; - setTimeout(function () { - var $prog; - if (isBatch) { - updateUploadLog(); - reject(); - } - self.fileManager.setProgress(id, 100); - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $btnUpload.hide(); - } - $.extend(true, params, self._getOutData(formdata, jqXHR)); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - $prog = self.showPreview && $thumb ? $thumb.find('.file-thumb-progress') : ''; - self._setProgress(101, $prog, self.msgUploadError); - self._showFileError(errMsg, params); - }, self.processDelay); - }; - self._setFileData(formdata, fileObj.file, fileName, id); - self._setUploadData(formdata, {fileId: id}); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata, id, i); - }, - _setFileData: function (formdata, file, fileName, fileId) { - var self = this, preProcess = self.preProcessUpload; - if (preProcess && typeof preProcess === 'function') { - formdata.append(self.uploadFileAttr, preProcess(fileId, file)); - } else { - formdata.append(self.uploadFileAttr, file, fileName); - } - }, - _checkBatchPreupload: function (outData, jqXHR) { - var self = this, out = self._raise('filebatchpreupload', [outData]); - if (out) { - return true; - } - self._abort(outData); - if (jqXHR) { - jqXHR.abort(); - } - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if ($thumb.hasClass('file-preview-loading')) { - self._setThumbStatus($thumb, 'New'); - $thumb.removeClass('file-uploading'); - } - $btnUpload.removeAttr('disabled'); - $btnDelete.removeAttr('disabled'); - }); - self._setProgressCancelled(); - return false; - }, - _uploadBatch: function () { - var self = this, fm = self.fileManager, total = fm.total(), params = {}, fnBefore, fnSuccess, fnError, - fnComplete, hasPostData = total > 0 || !$.isEmptyObject(self.uploadExtraData), errMsg, - setAllUploaded, formdata = new FormData(), op = self.ajaxOperations.uploadBatch; - if (total === 0 || !hasPostData || self._abort(params)) { - return; - } - setAllUploaded = function () { - self.fileManager.clear(); - self._clearFileInput(); - }; - fnBefore = function (jqXHR) { - self.lock(); - fm.initStats(); - var outData = self._getOutData(formdata, jqXHR); - self.ajaxAborted = false; - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), $btnUpload = $thumb.find('.kv-file-upload'), - $btnDelete = $thumb.find('.kv-file-remove'); - if (!$thumb.hasClass('file-preview-success')) { - self._setThumbStatus($thumb, 'Loading'); - $h.addCss($thumb, 'file-uploading'); - } - $btnUpload.attr('disabled', true); - $btnDelete.attr('disabled', true); - }); - } - self._checkBatchPreupload(outData, jqXHR); - }; - fnSuccess = function (data, textStatus, jqXHR) { - /** @namespace data.errorkeys */ - var outData = self._getOutData(formdata, jqXHR, data), key = 0, - $thumbs = self._getThumbs(':not(.file-preview-success)'), - keys = $h.isEmpty(data) || $h.isEmpty(data.errorkeys) ? [] : data.errorkeys; - - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - setAllUploaded(); - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - self._setThumbStatus($thumb, 'Success'); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').hide().removeAttr('disabled'); - }); - self._initUploadSuccess(data); - } else { - self.reset(); - } - self._setProgress(101); - } else { - if (self.showPreview) { - $thumbs.each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - $thumb.find('.kv-file-upload').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeAttr('disabled'); - if (keys.length === 0 || $.inArray(key, keys) !== -1) { - self._setPreviewError($thumb, true); - if (!self.retryErrorUploads) { - $thumb.find('.kv-file-upload').hide(); - self.fileManager.remove($thumb); - } - } else { - $thumb.find('.kv-file-upload').hide(); - self._setThumbStatus($thumb, 'Success'); - self.fileManager.remove($thumb); - } - if (!$thumb.hasClass('file-preview-error') || self.retryErrorUploads) { - key++; - } - }); - self._initUploadSuccess(data); - } - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgUploadError); - } - }; - fnComplete = function () { - self.unlock(); - self._initSuccessThumbs(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self.uploadFileCount = total - 1; - if (!self.showPreview) { - return; - } - self._getThumbs().each(function () { - var $thumb = $(this); - $thumb.removeClass('file-uploading'); - if (self._getThumbFile($thumb)) { - self._setPreviewError($thumb); - } - }); - self._getThumbs().removeClass('file-uploading'); - self._getThumbs(' .kv-file-upload').removeAttr('disabled'); - self._getThumbs(' .kv-file-delete').removeAttr('disabled'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - var ctr = 0; - $.each(self.fileManager.stack, function (key, data) { - if (!$h.isEmpty(data.file)) { - self._setFileData(formdata, data.file, (data.nameFmt || ('untitled_' + ctr)), key); - } - ctr++; - }); - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _uploadExtraOnly: function () { - var self = this, params = {}, fnBefore, fnSuccess, fnComplete, fnError, formdata = new FormData(), errMsg, - op = self.ajaxOperations.uploadExtra; - fnBefore = function (jqXHR) { - self.lock(); - var outData = self._getOutData(formdata, jqXHR); - self._setProgress(50); - params.data = outData; - params.xhr = jqXHR; - self._checkBatchPreupload(outData, jqXHR); - }; - fnSuccess = function (data, textStatus, jqXHR) { - var outData = self._getOutData(formdata, jqXHR, data); - if ($h.isEmpty(data) || $h.isEmpty(data.error)) { - self._raise('filebatchuploadsuccess', [outData]); - self._clearFileInput(); - self._initUploadSuccess(data); - self._setProgress(101); - } else { - errMsg = self._parseError(op, jqXHR, self.msgUploadError); - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - } - }; - fnComplete = function () { - self.unlock(); - self._clearFileInput(); - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var outData = self._getOutData(formdata, jqXHR); - errMsg = self._parseError(op, jqXHR, errorThrown); - params.data = outData; - self._showFileError(errMsg, outData, 'filebatchuploaderror'); - self._setProgress(101, self.$progress, self.msgAjaxProgressError.replace('{operation}', op)); - }; - self._ajaxSubmit(fnBefore, fnSuccess, fnComplete, fnError, formdata); - }, - _deleteFileIndex: function ($frame) { - var self = this, ind = $frame.attr('data-fileindex'), rev = self.reversePreviewOrder; - if (ind.substring(0, 5) === $h.INIT_FLAG) { - ind = parseInt(ind.replace($h.INIT_FLAG, '')); - self.initialPreview = $h.spliceArray(self.initialPreview, ind, rev); - self.initialPreviewConfig = $h.spliceArray(self.initialPreviewConfig, ind, rev); - self.initialPreviewThumbTags = $h.spliceArray(self.initialPreviewThumbTags, ind, rev); - self.getFrames().each(function () { - var $nFrame = $(this), nInd = $nFrame.attr('data-fileindex'); - if (nInd.substring(0, 5) === $h.INIT_FLAG) { - nInd = parseInt(nInd.replace($h.INIT_FLAG, '')); - if (nInd > ind) { - nInd--; - $nFrame.attr('data-fileindex', $h.INIT_FLAG + nInd); - } - } - }); - } - }, - _resetCaption: function () { - var self = this; - setTimeout(function () { - var cap = '', n, chk = self.previewCache.count(true), len = self.fileManager.count(), file, - incomplete = ':not(.file-preview-success):not(.file-preview-error)', cfg, - hasThumb = self.showPreview && self.getFrames(incomplete).length; - if (len === 0 && chk === 0 && !hasThumb) { - self.reset(); - } else { - n = chk + len; - if (n > 1) { - cap = self._getMsgSelected(n); - } else { - if (len === 0) { - cfg = self.initialPreviewConfig[0]; - cap = ''; - if (cfg) { - cap = cfg.caption || cfg.filename || ''; - } - if (!cap) { - cap = self._getMsgSelected(n); - } - } else { - file = self.fileManager.getFirstFile(); - cap = file ? file.nameFmt : '_'; - } - } - self._setCaption(cap); - } - }, self.processDelay); - }, - _handleRotation: function ($el, $content, angle) { - var self = this, css, newCss, addCss = '', scale = 1, elContent = $content[0], quadrant, transform, h, w, - wNew, $parent = $content.parent(), hParent, wParent, $body = $('body'), bodyExists = !!$body.length; - if (bodyExists) { - $body.addClass('kv-overflow-hidden'); - } - if (!$content.length || $el.hasClass('hide-rotate')) { - if (bodyExists) { - $body.removeClass('kv-overflow-hidden'); - } - return; - } - transform = $content.css('transform'); - if (transform) { - $content.css('transform', 'none'); - } - if (transform) { - $content.css('transform', transform); - } - angle = angle || 0; - quadrant = angle % 360; - css = 'rotate(' + angle + 'deg)'; - newCss = 'rotate(' + quadrant + 'deg)'; - addCss = ''; - if (quadrant === 90 || quadrant === 270) { - w = elContent.naturalWidth || $content.outerWidth() || 0; - h = elContent.naturalHeight || $content.outerHeight() || 0; - scale = w > h && w != 0 ? (h / w).toFixed(2) : 1; - if ($parent.length) { - hParent = $parent.height(); - wParent = $parent.width(); - wNew = Math.min(w, wParent); - if (hParent > scale * wNew) { - scale = wNew > hParent && wNew != 0 ? (hParent / wNew).toFixed(2) : 1; - } - } - if (scale !== 1) { - addCss = ' scale(' + scale + ')'; - } - } - $content.addClass('rotate-animate').css('transform', css + addCss); - setTimeout(function () { - $content.removeClass('rotate-animate').css('transform', newCss + addCss); - if (bodyExists) { - $body.removeClass('kv-overflow-hidden'); - } - $el.data('angle', quadrant); - }, self.fadeDelay); - }, - _initRotateButton: function () { - var self = this; - self.getFrames('.rotatable .kv-file-rotate').each(function () { - var $el = $(this), $frame = $el.closest($h.FRAMES), - $content = $frame.find('.kv-file-content > :first-child'); - self._handler($el, 'click', function () { - var angle = ($frame.data('angle') || 0) + 90; - self._handleRotation($frame, $content, angle); - }); - }); - }, - _initRotateZoom: function ($frame, $content) { - var self = this, $modal = self.$modal, $rotate = $modal.find('.btn-kv-rotate'), - angle = $frame.data('angle'); - $modal.data('angle', angle); - if ($rotate.length) { - $rotate.off('click'); - if ($modal.hasClass('rotatable')) { - $rotate.on('click', function () { - angle = ($modal.data('angle') || 0) + 90; - $modal.data('angle', angle); - self._handleRotation($modal, $modal.find('.file-zoom-detail'), angle); - self._handleRotation($frame, $content, angle); - if ($frame.hasClass('hide-rotate')) { - $frame.data('angle', angle); - } - }); - } - } - }, - _initFileActions: function () { - var self = this; - if (!self.showPreview) { - return; - } - self._initZoomButton(); - self._initRotateButton(); - self.getFrames(' .kv-file-remove').each(function () { - var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'), - ind = $frame.attr('data-fileindex'), status, fm = self.fileManager; - self._handler($el, 'click', function () { - status = self._raise('filepreremove', [id, ind]); - if (status === false || !self._validateMinCount()) { - return false; - } - hasError = $frame.hasClass('file-preview-error'); - $h.cleanMemory($frame); - $frame.fadeOut('slow', function () { - self.fileManager.remove($frame); - self._clearObjects($frame); - $frame.remove(); - if (id && hasError) { - self.$errorContainer.find('li[data-thumb-id="' + id + '"]').fadeOut('fast', function () { - $(this).remove(); - if (!self._errorsExist()) { - self._resetErrors(); - } - }); - } - self._clearFileInput(); - self._resetCaption(); - self._raise('fileremoved', [id, ind]); - }); - }); - }); - self.getFrames(' .kv-file-upload').each(function () { - var $el = $(this); - self._handler($el, 'click', function () { - var $frame = $el.closest($h.FRAMES), fileId = self._getThumbFileId($frame); - self._hideProgress(); - if ($frame.hasClass('file-preview-error') && !self.retryErrorUploads) { - return; - } - self._uploadSingle(self.fileManager.getIndex(fileId), fileId, false); - }); - }); - }, - _initPreviewActions: function () { - var self = this, $preview = self.$preview, deleteExtraData = self.deleteExtraData || {}, - btnRemove = $h.FRAMES + ' .kv-file-remove', settings = self.fileActionSettings, - origClass = settings.removeClass, errClass = settings.removeErrorClass, - resetProgress = function () { - var hasFiles = self.isAjaxUpload ? self.previewCache.count(true) : self._inputFileCount(); - if (!self.getFrames().length && !hasFiles) { - self._setCaption(''); - self.reset(); - self.initialCaption = ''; - } else { - self._resetCaption(); - } - }; - self._initZoomButton(); - self._initRotateButton(); - $preview.find(btnRemove).each(function () { - var $el = $(this), vUrl = $el.data('url') || self.deleteUrl, vKey = $el.data('key'), errMsg, fnBefore, - fnSuccess, fnError, op = self.ajaxOperations.deleteThumb; - if ($h.isEmpty(vUrl) || vKey === undefined) { - return; - } - if (typeof vUrl === 'function') { - vUrl = vUrl(); - } - var $frame = $el.closest($h.FRAMES), cache = self.previewCache.data, settings, params, config, - fileName, extraData, index = $frame.attr('data-fileindex'); - index = parseInt(index.replace($h.INIT_FLAG, '')); - config = $h.isEmpty(cache.config) && $h.isEmpty(cache.config[index]) ? null : cache.config[index]; - extraData = $h.isEmpty(config) || $h.isEmpty(config.extra) ? deleteExtraData : config.extra; - fileName = config && (config.filename || config.caption) || ''; - if (typeof extraData === 'function') { - extraData = extraData(); - } - params = {id: $el.attr('id'), key: vKey, extra: extraData}; - fnBefore = function (jqXHR) { - self.ajaxAborted = false; - self._raise('filepredelete', [vKey, jqXHR, extraData]); - if (self._abort()) { - jqXHR.abort(); - } else { - $el.removeClass(errClass); - $h.addCss($frame, 'file-uploading'); - $h.addCss($el, 'disabled ' + origClass); - } - }; - fnSuccess = function (data, textStatus, jqXHR) { - var n, cap; - if (!$h.isEmpty(data) && !$h.isEmpty(data.error)) { - params.jqXHR = jqXHR; - params.response = data; - errMsg = self._parseError(op, jqXHR, self.msgDeleteError, fileName); - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - return; - } - $frame.removeClass('file-uploading').addClass('file-deleted'); - $frame.fadeOut('slow', function () { - index = parseInt(($frame.attr('data-fileindex')).replace($h.INIT_FLAG, '')); - self.previewCache.unset(index); - self._deleteFileIndex($frame); - n = self.previewCache.count(true); - cap = n > 0 ? self._getMsgSelected(n) : ''; - self._setCaption(cap); - self._raise('filedeleted', [vKey, jqXHR, extraData]); - self._clearObjects($frame); - $frame.remove(); - resetProgress(); - }); - }; - fnError = function (jqXHR, textStatus, errorThrown) { - var errMsg = self._parseError(op, jqXHR, errorThrown, fileName); - params.jqXHR = jqXHR; - params.response = {}; - self._showFileError(errMsg, params, 'filedeleteerror'); - $frame.removeClass('file-uploading'); - $el.removeClass('disabled ' + origClass).addClass(errClass); - resetProgress(); - }; - self._initAjaxSettings(); - self._mergeAjaxCallback('beforeSend', fnBefore, 'delete'); - self._mergeAjaxCallback('success', fnSuccess, 'delete'); - self._mergeAjaxCallback('error', fnError, 'delete'); - settings = $.extend(true, {}, { - url: self._encodeURI(vUrl), - type: 'POST', - dataType: 'json', - data: $.extend(true, {}, {key: vKey}, extraData) - }, self._ajaxDeleteSettings); - self._handler($el, 'click', function () { - if (!self._validateMinCount()) { - return false; - } - self.ajaxAborted = false; - self._raise('filebeforedelete', [vKey, extraData]); - if (self.ajaxAborted instanceof Promise) { - self.ajaxAborted.then(function (result) { - if (!result) { - $.ajax(settings); - } - }); - } else { - if (!self.ajaxAborted) { - $.ajax(settings); - } - } - }); - }); - }, - _hideFileIcon: function () { - var self = this; - if (self.overwriteInitial) { - self.$captionContainer.removeClass('icon-visible'); - } - }, - _showFileIcon: function () { - var self = this; - $h.addCss(self.$captionContainer, 'icon-visible'); - }, - _getSize: function (bytes, skipTemplate, sizeUnits) { - var self = this, size = parseFloat(bytes), i = 0, factor = self.bytesToKB, func = self.fileSizeGetter, out, - sizeHuman = size, newSize; - if (!$.isNumeric(bytes) || !$.isNumeric(size)) { - return ''; - } - if (typeof func === 'function') { - out = func(size); - } else { - if (!sizeUnits) { - sizeUnits = self.sizeUnits; - } - if (size > 0) { - while (sizeHuman >= factor) { - sizeHuman /= factor; - ++i; - } - if (!sizeUnits[i]) { - sizeHuman = size; - i = 0; - } - } - newSize = sizeHuman.toFixed(2); - if (newSize == sizeHuman) { - newSize = sizeHuman; - } - out = newSize + ' ' + sizeUnits[i]; - } - return skipTemplate ? out : self._getLayoutTemplate('size').replace('{sizeText}', out); - }, - _getFileType: function (ftype) { - var self = this; - return self.mimeTypeAliases[ftype] || ftype; - }, - _generatePreviewTemplate: function ( - cat, - data, - fname, - ftype, - previewId, - fileId, - isError, - size, - fnameUpdated, - frameClass, - foot, - ind, - templ, - attrs, - zoomData - ) { - var self = this, caption = self.slug(fname), prevContent, zoomContent = '', styleAttribs = '', - filename = fnameUpdated || fname, isIconic, ext = filename.split('.').pop().toLowerCase(), - screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, - config, title = caption, alt = caption, typeCss = 'type-default', getContent, addFrameCss, - footer = foot || self._renderFileFooter(cat, caption, size, 'auto', isError), isRotatable, - alwaysPreview = $.inArray(ext, self.alwaysPreviewFileExtensions) !== -1, - forcePrevIcon = self.preferIconicPreview && !alwaysPreview, - forceZoomIcon = self.preferIconicZoomPreview && !alwaysPreview, newCat = forcePrevIcon ? 'other' : cat; - config = screenW < 400 ? (self.previewSettingsSmall[newCat] || self.defaults.previewSettingsSmall[newCat]) : - (self.previewSettings[newCat] || self.defaults.previewSettings[newCat]); - if (config) { - $.each(config, function (key, val) { - styleAttribs += key + ':' + val + ';'; - }); - } - getContent = function (vCat, vData, zoom, frameCss, vZoomData) { - var id = zoom ? 'zoom-' + previewId : previewId, tmplt = self._getPreviewTemplate(vCat), - css = (frameClass || '') + ' ' + frameCss, tokens; - if (self.frameClass) { - css = self.frameClass + ' ' + css; - } - if (zoom) { - css = css.replace(' ' + $h.SORT_CSS, ''); - } - tmplt = self._parseFilePreviewIcon(tmplt, fname); - if (cat === 'object' && !ftype) { - $.each(self.defaults.fileTypeSettings, function (key, func) { - if (key === 'object' || key === 'other') { - return; - } - if (func(fname, ftype)) { - typeCss = 'type-' + key; - } - }); - } - if (!$h.isEmpty(attrs)) { - if (attrs.title !== undefined && attrs.title !== null) { - title = attrs.title; - } - if (attrs.alt !== undefined && attrs.alt !== null) { - alt = title = attrs.alt; - } - } - tokens = { - 'previewId': id, - 'caption': caption, - 'title': title, - 'alt': alt, - 'frameClass': css, - 'type': self._getFileType(ftype), - 'fileindex': ind, - 'fileid': fileId || '', - 'filename': filename, - 'typeCss': typeCss, - 'footer': footer, - 'data': vData, -// 'data': zoom && vZoomData ? self.zoomPlaceholder + '{zoomData}' : vData, - 'template': templ || cat, - 'style': styleAttribs ? 'style="' + styleAttribs + '"' : '', - 'zoomData': vZoomData ? encodeURIComponent(vZoomData) : '' - }; - if (zoom) { - tokens.zoomCache = ''; - tokens.zoomData = '{zoomData}'; - } - return tmplt.setTokens(tokens); - }; - ind = ind || previewId.slice(previewId.lastIndexOf('-') + 1); - isRotatable = self.fileActionSettings.showRotate && $.inArray(ext, self.rotatableFileExtensions) !== -1; - if (self.fileActionSettings.showZoom) { - addFrameCss = 'kv-zoom-thumb'; - if (isRotatable) { - addFrameCss += ' rotatable' + (forceZoomIcon ? ' hide-rotate' : ''); - } - zoomContent = getContent((forceZoomIcon ? 'other' : cat), data, true, addFrameCss, zoomData); - } - zoomContent = '\n' + self._getLayoutTemplate('zoomCache').replace('{zoomContent}', zoomContent); - if (typeof self.sanitizeZoomCache === 'function') { - zoomContent = self.sanitizeZoomCache(zoomContent); - } - addFrameCss = 'kv-preview-thumb'; - if (isRotatable) { - isIconic = forcePrevIcon || self.hideThumbnailContent || !!self.previewFileIconSettings[ext]; - addFrameCss += ' rotatable' + (isIconic ? ' hide-rotate' : ''); - } - prevContent = getContent((forcePrevIcon ? 'other' : cat), data, false, addFrameCss, zoomData); - return prevContent.setTokens({zoomCache: zoomContent}); - }, - _addToPreview: function ($preview, content) { - var self = this, $el; - content = $h.cspBuffer.stash(content); - $el = self.reversePreviewOrder ? $preview.prepend(content) : $preview.append(content); - $h.cspBuffer.apply($preview); - return $el; - }, - _previewDefault: function (file, isDisabled) { - var self = this, $preview = self.$preview; - if (!self.showPreview) { - return; - } - var fname = $h.getFileName(file), ftype = file ? file.type : '', content, size = file.size || 0, - caption = self._getFileName(file, ''), isError = isDisabled === true && !self.isAjaxUpload, - data = $h.createObjectURL(file), fileId = self.fileManager.getId(file), - previewId = self._getThumbId(fileId); - self._clearDefaultPreview(); - content = self._generatePreviewTemplate('other', data, fname, ftype, previewId, fileId, isError, size); - self._addToPreview($preview, content); - self._setThumbAttr(previewId, caption, size); - if (isDisabled === true && self.isAjaxUpload) { - self._setThumbStatus(self._getFrame(previewId), 'Error'); - } - }, - _previewFile: function (i, file, theFile, data, fileInfo) { - if (!this.showPreview) { - return; - } - var self = this, fname = $h.getFileName(file), ftype = fileInfo.type, content, - caption = fileInfo.name, cat = self._parseFileType(ftype, fname), $preview = self.$preview, - fsize = file.size || 0, iData = cat === 'image' ? theFile.target.result : data, fm = self.fileManager, - fileId = fm.getId(file), previewId = self._getThumbId(fileId); - /** @namespace window.DOMPurify */ - content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, fileId, false, fsize, fileInfo.filename); - self._clearDefaultPreview(); - self._addToPreview($preview, content); - var $thumb = self._getFrame(previewId); - self._validateImageOrientation($thumb.find('img'), file, previewId, fileId, caption, ftype, fsize, iData); - self._setThumbAttr(previewId, caption, fsize); - self._initSortable(); - }, - _setThumbAttr: function (id, caption, size, description) { - var self = this, $frame = self._getFrame(id); - if ($frame.length) { - size = size && size > 0 ? self._getSize(size) : ''; - $frame.data({'caption': caption, 'size': size, 'description': description || ''}); - } - }, - _setInitThumbAttr: function () { - var self = this, data = self.previewCache.data, len = self.previewCache.count(true), config, - caption, size, description, previewId; - if (len === 0) { - return; - } - for (var i = 0; i < len; i++) { - config = data.config[i]; - previewId = self.previewInitId + '-' + $h.INIT_FLAG + i; - caption = $h.ifSet('caption', config, $h.ifSet('filename', config)); - size = $h.ifSet('size', config); - description = $h.ifSet('description', config); - self._setThumbAttr(previewId, caption, size, description); - } - }, - _slugDefault: function (text) { - // noinspection RegExpRedundantEscape - return $h.isEmpty(text, true) ? '' : String(text).replace(/[\[\]\/\{}:;#%=\(\)\*\+\?\\\^\$\|<>&"']/g, '_'); - }, - _updateFileDetails: function (numFiles) { - var self = this, $el = self.$element, label, n, log, nFiles, file, - name = ($h.isIE(9) && $h.findFileName($el.val())) || ($el[0].files[0] && $el[0].files[0].name); - if (!name && self.fileManager.count() > 0) { - file = self.fileManager.getFirstFile(); - label = file.nameFmt; - } else { - label = name ? self.slug(name) : '_'; - } - n = self.isAjaxUpload ? self.fileManager.count() : numFiles; - nFiles = self.previewCache.count(true) + n; - log = n === 1 ? label : self._getMsgSelected(nFiles, !self.isAjaxUpload && !self.isError); - if (self.isError) { - self.$previewContainer.removeClass('file-thumb-loading'); - self._initCapStatus(); - self.$previewStatus.html(''); - self.$captionContainer.removeClass('icon-visible'); - } else { - self._showFileIcon(); - } - self._setCaption(log, self.isError); - self.$container.removeClass('file-input-new file-input-ajax-new'); - self._raise('fileselect', [numFiles, label]); - if (self.previewCache.count(true)) { - self._initPreviewActions(); - } - }, - _setThumbStatus: function ($thumb, status) { - var self = this; - if (!self.showPreview) { - return; - } - var icon = 'indicator' + status, msg = icon + 'Title', - css = 'file-preview-' + status.toLowerCase(), - $indicator = $thumb.find('.file-upload-indicator'), - config = self.fileActionSettings; - $thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading'); - if (status === 'Success') { - $thumb.find('.file-drag-handle').remove(); - } - $h.setHtml($indicator, config[icon]); - $indicator.attr('title', config[msg]); - $thumb.addClass(css); - if (status === 'Error' && !self.retryErrorUploads) { - $thumb.find('.kv-file-upload').attr('disabled', true); - } - }, - _setProgressCancelled: function () { - var self = this; - self._setProgress(101, self.$progress, self.msgCancelled); - }, - _setProgress: function (p, $el, error, stats) { - var self = this; - $el = $el || self.$progress; - if (!$el.length) { - return; - } - var pct = Math.min(p, 100), out, pctLimit = self.progressUploadThreshold, - t = p <= 100 ? self.progressTemplate : self.progressCompleteTemplate, - template = pct < 100 ? self.progressTemplate : - (error ? (self.paused ? self.progressPauseTemplate : self.progressErrorTemplate) : t); - if (p >= 100) { - stats = ''; - } - if (!$h.isEmpty(template)) { - if (pctLimit && pct > pctLimit && p <= 100) { - out = template.setTokens({'percent': pctLimit, 'status': self.msgUploadThreshold}); - } else { - out = template.setTokens({'percent': pct, 'status': (p > 100 ? self.msgUploadEnd : pct + '%')}); - } - stats = stats || ''; - out = out.setTokens({stats: stats}); - $h.setHtml($el, out); - if (error) { - $h.setHtml($el.find('[role="progressbar"]'), error); - } - } - }, - _hasFiles: function () { - var el = this.$element[0]; - return !!(el && el.files && el.files.length); - }, - _setFileDropZoneTitle: function () { - var self = this, $zone = self.$container.find('.file-drop-zone'), title = self.dropZoneTitle, strFiles; - if (self.isClickable) { - strFiles = $h.isEmpty(self.$element.attr('multiple')) ? self.fileSingle : self.filePlural; - title += self.dropZoneClickTitle.replace('{files}', strFiles); - } - $zone.find('.' + self.dropZoneTitleClass).remove(); - if (!self.showPreview || $zone.length === 0 || self.fileManager.count() > 0 || !self.dropZoneEnabled || - self.previewCache.count() > 0 || (!self.isAjaxUpload && self._hasFiles())) { - return; - } - if ($zone.find($h.FRAMES).length === 0 && $h.isEmpty(self.defaultPreviewContent)) { - $zone.prepend('
    ' + title + '
    '); - } - self.$container.removeClass('file-input-new'); - $h.addCss(self.$container, 'file-input-ajax-new'); - }, - _getStats: function (stats) { - var self = this, pendingTime, t; - if (!self.showUploadStats || !stats || !stats.bitrate) { - return ''; - } - t = self._getLayoutTemplate('stats'); - pendingTime = (!stats.elapsed || !stats.bps) ? self.msgCalculatingTime : - self.msgPendingTime.setTokens({time: $h.getElapsed(Math.ceil(stats.pendingBytes / stats.bps))}); - - return t.setTokens({ - uploadSpeed: stats.bitrate, - pendingTime: pendingTime - }); - }, - _setResumableProgress: function (pct, stats, $thumb) { - var self = this, rm = self.resumableManager, obj = $thumb ? rm : self, - $prog = $thumb ? $thumb.find('.file-thumb-progress') : null; - if (obj.lastProgress === 0) { - obj.lastProgress = pct; - } - if (pct < obj.lastProgress) { - pct = obj.lastProgress; - } - self._setProgress(pct, $prog, null, self._getStats(stats)); - obj.lastProgress = pct; - }, - _toggleResumableProgress: function (template, message) { - var self = this, $progress = self.$progress; - if ($progress && $progress.length) { - $h.setHtml($progress, template.setTokens({ - percent: 101, - status: message, - stats: '' - })); - } - }, - _setFileUploadStats: function (id, pct, stats) { - var self = this, $prog = self.$progress; - if (!self.showPreview && (!$prog || !$prog.length)) { - return; - } - var fm = self.fileManager, rm = self.resumableManager, $thumb = fm.getThumb(id), pctTot, - totUpSize = 0, totSize = fm.getTotalSize(), totStats = $.extend(true, {}, stats); - if (self.enableResumableUpload) { - var loaded = stats.loaded, currUplSize = rm.getUploadedSize(), currTotSize = rm.file.size, totLoaded; - loaded += currUplSize; - totLoaded = fm.uploadedSize + loaded; - pct = $h.round(100 * loaded / currTotSize); - stats.pendingBytes = currTotSize - currUplSize; - self._setResumableProgress(pct, stats, $thumb); - pctTot = Math.floor(100 * totLoaded / totSize); - totStats.pendingBytes = totSize - totLoaded; - self._setResumableProgress(pctTot, totStats); - } else { - fm.setProgress(id, pct); - $prog = $thumb && $thumb.length ? $thumb.find('.file-thumb-progress') : null; - self._setProgress(pct, $prog, null, self._getStats(stats)); - $.each(fm.stats, function (id, cfg) { - totUpSize += cfg.loaded; - }); - totStats.pendingBytes = totSize - totUpSize; - pctTot = $h.round(totUpSize / totSize * 100); - self._setProgress(pctTot, null, null, self._getStats(totStats)); - } - }, - _validateMinCount: function () { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - if (self.validateInitialCount && self.minFileCount > 0 && self._getFileCount(len - 1) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - _getFileCount: function (fileCount, includeInitial) { - var self = this, addCount = 0; - if (includeInitial === undefined) { - includeInitial = self.validateInitialCount && !self.overwriteInitial; - } - if (includeInitial) { - addCount = self.previewCache.count(true); - fileCount += addCount; - } - return fileCount; - }, - _getFileId: function (file) { - return $h.getFileId(file, this.generateFileId); - }, - _getFileName: function (file, defaultValue) { - var self = this, fileName = $h.getFileName(file); - return fileName ? self.slug(fileName) : defaultValue; - }, - _getFileNames: function (skipNull) { - var self = this; - return self.filenames.filter(function (n) { - return (skipNull ? n !== undefined : n !== undefined && n !== null); - }); - }, - _setPreviewError: function ($thumb, keepFile) { - var self = this, removeFrame = self.removeFromPreviewOnError && !self.retryErrorUploads; - if (!keepFile || removeFrame) { - self.fileManager.remove($thumb); - } - if (!self.showPreview) { - return; - } - if (removeFrame) { - $thumb.remove(); - return; - } else { - self._setThumbStatus($thumb, 'Error'); - } - self._refreshUploadButton($thumb); - }, - _refreshUploadButton: function ($thumb) { - var self = this, $btn = $thumb.find('.kv-file-upload'), cfg = self.fileActionSettings, - icon = cfg.uploadIcon, title = cfg.uploadTitle; - if (!$btn.length) { - return; - } - if (self.retryErrorUploads) { - icon = cfg.uploadRetryIcon; - title = cfg.uploadRetryTitle; - } - $btn.attr('title', title); - $h.setHtml($btn, icon); - }, - _isValidSize: function (size, type, $image, $thumb, filename, params) { - var self = this, msg, dim, $img, tag = size === 'Small' ? 'min' : 'max', limit = self[tag + 'Image' + type]; - if ($h.isEmpty(limit) || !$image.length) { - return true; - } - $img = $image[0]; - dim = (type === 'Width') ? $img.naturalWidth || $img.width : $img.naturalHeight || $img.height; - if (size === 'Small' ? dim >= limit : dim <= limit) { - return true; - } - msg = self['msgImage' + type + size] || 'Image "{name}" has a size validation error (limit "{size}").'; - self._showFileError(msg.setTokens({'name': filename, 'size': limit, 'dimension': dim}), params); - self._setPreviewError($thumb); - self.fileManager.remove($thumb); - self._clearFileInput(); - return false; - }, - _getExifObj: function (data) { - var self = this, exifObj, error = $h.logMessages.exifWarning; - if (data.slice(0, 23) !== 'data:image/jpeg;base64,' && data.slice(0, 22) !== 'data:image/jpg;base64,') { - exifObj = null; - return; - } - try { - exifObj = window.piexif ? window.piexif.load(data) : null; - } catch (err) { - exifObj = null; - error = err && err.message || ''; - } - if (!exifObj && self.showExifErrorLog) { - self._log($h.logMessages.badExifParser, {details: error}); - } - return exifObj; - }, - setImageOrientation: function ($img, $zoomImg, value, $thumb) { - var self = this, invalidImg = !$img || !$img.length, invalidZoomImg = !$zoomImg || !$zoomImg.length, $mark, - isHidden = false, $div, zoomOnly = invalidImg && $thumb && $thumb.attr('data-template') === 'image', ev; - if (invalidImg && invalidZoomImg) { - return; - } - ev = 'load.fileinputimageorient'; - if (zoomOnly) { - $img = $zoomImg; - $zoomImg = null; - $img.css(self.previewSettings.image); - $div = $(document.createElement('div')).appendTo($thumb.find('.kv-file-content')); - $mark = $(document.createElement('span')).insertBefore($img); - $img.css('visibility', 'hidden').removeClass('file-zoom-detail').appendTo($div); - } else { - isHidden = !$img.is(':visible'); - } - $img.off(ev).on(ev, function () { - if (isHidden) { - self.$preview.removeClass('hide-content'); - $thumb.find('.kv-file-content').css('visibility', 'hidden'); - } - var img = $img[0], zoomImg = $zoomImg && $zoomImg.length ? $zoomImg[0] : null, - h = img.offsetHeight, w = img.offsetWidth, r = $h.getRotation(value); - if (isHidden) { - $thumb.find('.kv-file-content').css('visibility', 'visible'); - self.$preview.addClass('hide-content'); - } - $img.data('orientation', value); - if (zoomImg) { - $zoomImg.data('orientation', value); - } - if (value < 5) { - $h.setTransform(img, r); - $h.setTransform(zoomImg, r); - return; - } - var offsetAngle = Math.atan(w / h), origFactor = Math.sqrt(Math.pow(h, 2) + Math.pow(w, 2)), - scale = !origFactor ? 1 : (h / Math.cos(Math.PI / 2 + offsetAngle)) / origFactor, - s = ' scale(' + Math.abs(scale) + ')'; - $h.setTransform(img, r + s); - $h.setTransform(zoomImg, r + s); - if (zoomOnly) { - $img.css('visibility', 'visible').insertAfter($mark).addClass('file-zoom-detail'); - $mark.remove(); - $div.remove(); - } - }); - }, - _validateImageOrientation: function ($img, file, previewId, fileId, caption, ftype, fsize, iData) { - var self = this, exifObj = null, value, autoOrientImage = self.autoOrientImage, selector; - exifObj = self._getExifObj(iData); - if (self.canOrientImage) { - $img.css('image-orientation', (autoOrientImage ? 'from-image' : 'none')); - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - return; - } - selector = $h.getZoomSelector(previewId, ' img'); - value = exifObj ? exifObj['0th'][piexif.ImageIFD.Orientation] : null; // jshint ignore:line - if (!value) { - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - return; - } - self.setImageOrientation($img, $(selector), value, self._getFrame(previewId)); - self._raise('fileimageoriented', {'$img': $img, 'file': file}); - self._validateImage(previewId, fileId, caption, ftype, fsize, iData, exifObj); - }, - _validateImage: function (previewId, fileId, fname, ftype, fsize, iData, exifObj) { - var self = this, $preview = self.$preview, params, w1, w2, $thumb = self._getFrame(previewId), - i = $thumb.attr('data-fileindex'), $img = $thumb.find('img'); - fname = fname || 'Untitled'; - $img.one('load', function () { - if ($img.data('validated')) { - return; - } - $img.data('validated', true); - w1 = $thumb.width(); - w2 = $preview.width(); - if (w1 > w2) { - $img.css('width', '100%'); - } - params = {ind: i, id: previewId, fileId: fileId}; - setTimeout(function () { - var isValidWidth, isValidHeight; - isValidWidth = self._isValidSize('Small', 'Width', $img, $thumb, fname, params); - isValidHeight = self._isValidSize('Small', 'Height', $img, $thumb, fname, params); - if (!self.resizeImage) { - isValidWidth = isValidWidth && self._isValidSize('Large', 'Width', $img, $thumb, fname, params); - isValidHeight = isValidHeight && self._isValidSize('Large', 'Height', $img, $thumb, fname, params); - } - self._raise('fileimageloaded', [previewId]); - $thumb.data('exif', exifObj); - if (isValidWidth && isValidHeight) { - self.fileManager.addImage(fileId, { - ind: i, - img: $img, - thumb: $thumb, - pid: previewId, - typ: ftype, - siz: fsize, - validated: false, - imgData: iData, - exifObj: exifObj - }); - self._validateAllImages(); - } - }, self.processDelay); - }).one('error', function () { - self._raise('fileimageloaderror', [previewId]); - }); - }, - _validateAllImages: function () { - var self = this, counter = {val: 0}, numImgs = self.fileManager.getImageCount(), fsize, - minSize = self.resizeIfSizeMoreThan; - if (numImgs !== self.fileManager.totalImages) { - return; - } - self._raise('fileimagesloaded'); - if (!self.resizeImage) { - return; - } - $.each(self.fileManager.loadedImages, function (id, config) { - if (!config.validated) { - fsize = config.siz; - if (fsize && fsize > minSize * self.bytesToKB) { - self._getResizedImage(id, config, counter, numImgs); - } - config.validated = true; - } - }); - }, - _getResizedImage: function (id, config, counter, numImgs) { - var self = this, img = $(config.img)[0], width = img.naturalWidth, height = img.naturalHeight, blob, - ratio = 1, maxWidth = self.maxImageWidth || width, maxHeight = self.maxImageHeight || height, - isValidImage = !!(width && height), chkWidth, chkHeight, canvas = self.imageCanvas, dataURI, - context = self.imageCanvasContext, type = config.typ, pid = config.pid, ind = config.ind, - $thumb = config.thumb, throwError, msg, exifObj = config.exifObj, exifStr, file, params, evParams; - throwError = function (msg, params, ev) { - if (self.isAjaxUpload) { - self._showFileError(msg, params, ev); - } else { - self._showError(msg, params, ev); - } - self._setPreviewError($thumb); - }; - file = self.fileManager.getFile(id); - params = {id: pid, 'index': ind, fileId: id}; - evParams = [id, pid, ind]; - if (!file || !isValidImage || (width <= maxWidth && height <= maxHeight)) { - if (isValidImage && file) { - self._raise('fileimageresized', evParams); - } - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized'); - } - if (!isValidImage) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - return; - } - } - type = type || self.resizeDefaultImageType; - chkWidth = width > maxWidth; - chkHeight = height > maxHeight; - if (self.resizePreference === 'width') { - ratio = chkWidth ? maxWidth / width : (chkHeight ? maxHeight / height : 1); - } else { - ratio = chkHeight ? maxHeight / height : (chkWidth ? maxWidth / width : 1); - } - self._resetCanvas(); - width *= ratio; - height *= ratio; - canvas.width = width; - canvas.height = height; - try { - context.drawImage(img, 0, 0, width, height); - dataURI = canvas.toDataURL(type, self.resizeQuality); - if (exifObj) { - exifStr = window.piexif.dump(exifObj); - dataURI = window.piexif.insert(exifStr, dataURI); - } - blob = $h.dataURI2Blob(dataURI); - self.fileManager.setFile(id, blob); - self._raise('fileimageresized', evParams); - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - if (!(blob instanceof Blob)) { - throwError(self.msgImageResizeError, params, 'fileimageresizeerror'); - } - } catch (err) { - counter.val++; - if (counter.val === numImgs) { - self._raise('fileimagesresized', [undefined, undefined]); - } - msg = self.msgImageResizeException.replace('{errors}', err.message); - throwError(msg, params, 'fileimageresizeexception'); - } - }, - _showProgress: function () { - var self = this; - if (self.$progress && self.$progress.length) { - self.$progress.show(); - } - }, - _hideProgress: function () { - var self = this; - if (self.$progress && self.$progress.length) { - self.$progress.hide(); - } - }, - _initBrowse: function ($container) { - var self = this, $el = self.$element; - if (self.showBrowse) { - self.$btnFile = $container.find('.btn-file').append($el); - } else { - $el.appendTo($container).attr('tabindex', -1); - $h.addCss($el, 'file-no-browse'); - } - }, - _initClickable: function () { - var self = this, $zone, $tmpZone; - if (!self.isClickable) { - return; - } - $zone = self.$dropZone; - if (!self.isAjaxUpload) { - $tmpZone = self.$preview.find('.file-default-preview'); - if ($tmpZone.length) { - $zone = $tmpZone; - } - } - - $h.addCss($zone, 'clickable'); - $zone.attr('tabindex', -1); - self._handler($zone, 'click', function (e) { - var $tar = $(e.target); - if (!self.$errorContainer.is(':visible') && (!$tar.parents( - '.file-preview-thumbnails').length || $tar.parents( - '.file-default-preview').length)) { - self.$element.data('zoneClicked', true).trigger('click'); - $zone.blur(); - } - }); - }, - _initCaption: function () { - var self = this, cap = self.initialCaption || ''; - if (self.overwriteInitial || $h.isEmpty(cap)) { - self.$caption.val(''); - return false; - } - self._setCaption(cap); - return true; - }, - _setCaption: function (content, isError) { - var self = this, title, out, icon, n, cap, file; - if (!self.$caption.length) { - return; - } - self.$captionContainer.removeClass('icon-visible'); - if (isError) { - title = $('
    ' + self.msgValidationError + '
    ').text(); - n = self.fileManager.count(); - if (n) { - file = self.fileManager.getFirstFile(); - cap = n === 1 && file ? file.nameFmt : self._getMsgSelected(n); - } else { - cap = self._getMsgSelected(self.msgNo); - } - out = $h.isEmpty(content) ? cap : content; - icon = '' + self.msgValidationErrorIcon + ''; - } else { - if ($h.isEmpty(content)) { - self.$caption.attr('title', ''); - return; - } - title = $('
    ' + content + '
    ').text(); - out = title; - icon = self._getLayoutTemplate('fileIcon'); - } - self.$captionContainer.addClass('icon-visible'); - self.$caption.attr('title', title).val(out); - $h.setHtml(self.$captionIcon, icon); - }, - _createContainer: function () { - var self = this, attribs = {'class': 'file-input file-input-new' + (self.rtl ? ' kv-rtl' : '')}, - $container = $h.createElement($h.cspBuffer.stash(self._renderMain())); - $h.cspBuffer.apply($container); - $container.insertBefore(self.$element).attr(attribs); - self._initBrowse($container); - if (self.theme) { - $container.addClass('theme-' + self.theme); - } - return $container; - }, - _refreshContainer: function () { - var self = this, $container = self.$container, $el = self.$element; - $el.insertAfter($container); - $h.setHtml($container, self._renderMain()); - self._initBrowse($container); - self._validateDisabled(); - }, - _validateDisabled: function () { - var self = this; - self.$caption.attr({readonly: self.isDisabled}); - }, - _setTabIndex: function (type, html) { - var self = this, index = self.tabIndexConfig[type]; - return html.setTokens({ - tabIndexConfig: index === undefined || index === null ? '' : 'tabindex="' + index + '"' - }); - }, - _renderMain: function () { - var self = this, - dropCss = self.dropZoneEnabled ? ' file-drop-zone' : 'file-drop-disabled', - close = !self.showClose ? '' : self._getLayoutTemplate('close'), - preview = !self.showPreview ? '' : self._getLayoutTemplate('preview') - .setTokens({'class': self.previewClass, 'dropClass': dropCss}), - css = self.isDisabled ? self.captionClass + ' file-caption-disabled' : self.captionClass, - caption = self.captionTemplate.setTokens({'class': css + ' kv-fileinput-caption'}); - caption = self._setTabIndex('caption', caption); - return self.mainTemplate.setTokens({ - 'class': self.mainClass + (!self.showBrowse && self.showCaption ? ' no-browse' : ''), - 'inputGroupClass': self.inputGroupClass, - 'preview': preview, - 'close': close, - 'caption': caption, - 'upload': self._renderButton('upload'), - 'remove': self._renderButton('remove'), - 'cancel': self._renderButton('cancel'), - 'pause': self._renderButton('pause'), - 'browse': self._renderButton('browse') - }); - - }, - _renderButton: function (type) { - var self = this, tmplt = self._getLayoutTemplate('btnDefault'), css = self[type + 'Class'], - title = self[type + 'Title'], icon = self[type + 'Icon'], label = self[type + 'Label'], - status = self.isDisabled ? ' disabled' : '', btnType = 'button'; - switch (type) { - case 'remove': - if (!self.showRemove) { - return ''; - } - break; - case 'cancel': - if (!self.showCancel) { - return ''; - } - css += ' kv-hidden'; - break; - case 'pause': - if (!self.showPause) { - return ''; - } - css += ' kv-hidden'; - break; - case 'upload': - if (!self.showUpload) { - return ''; - } - if (self.isAjaxUpload && !self.isDisabled) { - tmplt = self._getLayoutTemplate('btnLink').replace('{href}', self.uploadUrl); - } else { - btnType = 'submit'; - } - break; - case 'browse': - if (!self.showBrowse) { - return ''; - } - tmplt = self._getLayoutTemplate('btnBrowse'); - break; - default: - return ''; - } - tmplt = self._setTabIndex(type, tmplt); - - css += type === 'browse' ? ' btn-file' : ' fileinput-' + type + ' fileinput-' + type + '-button'; - if (!$h.isEmpty(label)) { - label = ' ' + label + ''; - } - return tmplt.setTokens({ - 'type': btnType, 'css': css, 'title': title, 'status': status, 'icon': icon, 'label': label - }); - }, - _renderThumbProgress: function () { - var self = this; - return '
    ' + - self.progressInfoTemplate.setTokens({percent: 101, status: self.msgUploadBegin, stats: ''}) + - '
    '; - }, - _renderFileFooter: function (cat, caption, size, width, isError) { - var self = this, config = self.fileActionSettings, rem = config.showRemove, drg = config.showDrag, - upl = config.showUpload, rot = config.showRotate, zoom = config.showZoom, out, params, - template = self._getLayoutTemplate('footer'), tInd = self._getLayoutTemplate('indicator'), - ind = isError ? config.indicatorError : config.indicatorNew, - title = isError ? config.indicatorErrorTitle : config.indicatorNewTitle, - indicator = tInd.setTokens({'indicator': ind, 'indicatorTitle': title}); - size = self._getSize(size); - params = {type: cat, caption: caption, size: size, width: width, progress: '', indicator: indicator}; - if (self.isAjaxUpload) { - params.progress = self._renderThumbProgress(); - params.actions = self._renderFileActions(params, upl, false, rem, rot, zoom, drg, false, false, false); - } else { - params.actions = self._renderFileActions(params, false, false, false, false, zoom, drg, false, false, false); - } - out = template.setTokens(params); - out = $h.replaceTags(out, self.previewThumbTags); - return out; - }, - _renderFileActions: function ( - cfg, - showUpl, - showDwn, - showDel, - showRot, - showZoom, - showDrag, - disabled, - url, - key, - isInit, - dUrl, - dFile - ) { - var self = this; - if (!cfg.type && isInit) { - cfg.type = 'image'; - } - if (self.enableResumableUpload) { - showUpl = false; - } else { - if (typeof showUpl === 'function') { - showUpl = showUpl(cfg); - } - } - if (typeof showDwn === 'function') { - showDwn = showDwn(cfg); - } - if (typeof showDel === 'function') { - showDel = showDel(cfg); - } - if (typeof showZoom === 'function') { - showZoom = showZoom(cfg); - } - if (typeof showDrag === 'function') { - showDrag = showDrag(cfg); - } - if (typeof showRot === 'function') { - showRot = showRot(cfg); - } - if (!showUpl && !showDwn && !showDel && !showRot && !showZoom && !showDrag) { - return ''; - } - var vUrl = url === false ? '' : ' data-url="' + url + '"', btnZoom = '', btnDrag = '', btnRotate = '', css, - vKey = key === false ? '' : ' data-key="' + key + '"', btnDelete = '', btnUpload = '', btnDownload = '', - template = self._getLayoutTemplate('actions'), config = self.fileActionSettings, - otherButtons = self.otherActionButtons.setTokens({'dataKey': vKey, 'key': key}), - removeClass = disabled ? config.removeClass + ' disabled' : config.removeClass; - if (showDel) { - btnDelete = self._getLayoutTemplate('actionDelete').setTokens({ - 'removeClass': removeClass, - 'removeIcon': config.removeIcon, - 'removeTitle': config.removeTitle, - 'dataUrl': vUrl, - 'dataKey': vKey, - 'key': key - }); - } - if (showRot) { - btnRotate = self._getLayoutTemplate('actionRotate').setTokens({ - 'rotateClass': config.rotateClass, - 'rotateIcon': config.rotateIcon, - 'rotateTitle': config.rotateTitle - }); - } - if (showUpl) { - btnUpload = self._getLayoutTemplate('actionUpload').setTokens({ - 'uploadClass': config.uploadClass, - 'uploadIcon': config.uploadIcon, - 'uploadTitle': config.uploadTitle - }); - } - if (showDwn) { - btnDownload = self._getLayoutTemplate('actionDownload').setTokens({ - 'downloadClass': config.downloadClass, - 'downloadIcon': config.downloadIcon, - 'downloadTitle': config.downloadTitle, - 'downloadUrl': dUrl || self.initialPreviewDownloadUrl - }); - btnDownload = btnDownload.setTokens({'filename': dFile, 'key': key}); - } - if (showZoom) { - btnZoom = self._getLayoutTemplate('actionZoom').setTokens({ - 'zoomClass': config.zoomClass, - 'zoomIcon': config.zoomIcon, - 'zoomTitle': config.zoomTitle - }); - } - if (showDrag && isInit) { - css = 'drag-handle-init ' + config.dragClass; - btnDrag = self._getLayoutTemplate('actionDrag').setTokens({ - 'dragClass': css, - 'dragTitle': config.dragTitle, - 'dragIcon': config.dragIcon - }); - } - return template.setTokens({ - 'delete': btnDelete, - 'upload': btnUpload, - 'download': btnDownload, - 'rotate': btnRotate, - 'zoom': btnZoom, - 'drag': btnDrag, - 'other': otherButtons - }); - }, - _browse: function (e) { - var self = this; - if (e && e.isDefaultPrevented() || !self._raise('filebrowse')) { - return; - } - if (self.isError && !self.isAjaxUpload) { - self.clear(); - } - if (self.focusCaptionOnBrowse) { - self.$captionContainer.focus(); - } - }, - _change: function (e) { - var self = this; - $(document.body).off('focusin.fileinput focusout.fileinput'); - if (self.changeTriggered) { - self._toggleLoading('hide'); - return; - } - self._toggleLoading('show'); - var $el = self.$element, isDragDrop = arguments.length > 1, isAjaxUpload = self.isAjaxUpload, - tfiles, files = isDragDrop ? arguments[1] : $el[0].files, ctr = self.fileManager.count(), - total, initCount, len, isSingleUpl = $h.isEmpty($el.attr('multiple')), - maxCount = !isAjaxUpload && isSingleUpl ? 1 : self.maxFileCount, maxTotCount = self.maxTotalFileCount, - inclAll = maxTotCount > 0 && maxTotCount > maxCount, flagSingle = (isSingleUpl && ctr > 0), - throwError = function (mesg, file, previewId, index) { - var p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), {id: previewId, index: index}), - p2 = {id: previewId, index: index, file: file, files: files}; - self.isPersistentError = true; - self._toggleLoading('hide'); - return isAjaxUpload ? self._showFileError(mesg, p1) : self._showError(mesg, p2); - }, - maxCountCheck = function (n, m, all) { - var msg = all ? self.msgTotalFilesTooMany : self.msgFilesTooMany; - msg = msg.replace('{m}', m).replace('{n}', n); - self.isError = throwError(msg, null, null, null); - self.$captionContainer.removeClass('icon-visible'); - self._setCaption('', true); - self.$container.removeClass('file-input-new file-input-ajax-new'); - }; - self.reader = null; - self._resetUpload(); - self._hideFileIcon(); - if (self.dropZoneEnabled) { - self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove(); - } - if (!isAjaxUpload) { - if (e.target && e.target.files === undefined) { - files = e.target.value ? [{name: e.target.value.replace(/^.+\\/, '')}] : []; - } else { - files = e.target.files || {}; - } - } - tfiles = files; - if ($h.isEmpty(tfiles) || tfiles.length === 0) { - if (!isAjaxUpload) { - self.clear(); - } - self._raise('fileselectnone'); - return; - } - self._resetErrors(); - len = tfiles.length; - initCount = isAjaxUpload ? (self.fileManager.count() + len) : len; - total = self._getFileCount(initCount, inclAll ? false : undefined); - if (maxCount > 0 && total > maxCount) { - if (!self.autoReplace || len > maxCount) { - maxCountCheck((self.autoReplace && len > maxCount ? len : total), maxCount); - return; - } - if (total > maxCount) { - self._resetPreviewThumbs(isAjaxUpload); - } - - } else { - if (inclAll) { - total = self._getFileCount(initCount, true); - if (maxTotCount > 0 && total > maxTotCount) { - if (!self.autoReplace || len > maxCount) { - maxCountCheck((self.autoReplace && len > maxTotCount ? len : total), maxTotCount, true); - return; - } - if (total > maxCount) { - self._resetPreviewThumbs(isAjaxUpload); - } - } - } - if (!isAjaxUpload || flagSingle) { - self._resetPreviewThumbs(false); - if (flagSingle) { - self.clearFileStack(); - } - } else { - if (isAjaxUpload && ctr === 0 && (!self.previewCache.count(true) || self.overwriteInitial)) { - self._resetPreviewThumbs(true); - } - } - } - if (self.autoReplace) { - self._getThumbs().each(function () { - var $thumb = $(this); - if ($thumb.hasClass('file-preview-success') || $thumb.hasClass('file-preview-error')) { - $thumb.remove(); - } - }); - } - self.readFiles(tfiles); - self._toggleLoading('hide'); - }, - _abort: function (params) { - var self = this, data; - if (self.ajaxAborted && typeof self.ajaxAborted === 'object' && self.ajaxAborted.message !== undefined) { - data = $.extend(true, {}, self._getOutData(null), params); - data.abortData = self.ajaxAborted.data || {}; - data.abortMessage = self.ajaxAborted.message; - self._setProgress(101, self.$progress, self.msgCancelled); - self._showFileError(self.ajaxAborted.message, data, 'filecustomerror'); - self.cancel(); - self.unlock(); - return true; - } - return !!self.ajaxAborted; - }, - _resetFileStack: function () { - var self = this, i = 0; - self._getThumbs().each(function () { - var $thumb = $(this), ind = $thumb.attr('data-fileindex'), pid = $thumb.attr('id'); - if (ind === '-1' || ind === -1) { - return; - } - if (!self._getThumbFile($thumb)) { - $thumb.attr({'data-fileindex': i}); - i++; - } else { - $thumb.attr({'data-fileindex': '-1'}); - } - self._getZoom(pid).attr({ - 'data-fileindex': $thumb.attr('data-fileindex') - }); - }); - }, - _isFileSelectionValid: function (cnt) { - var self = this; - cnt = cnt || 0; - if (self.required && !self.getFilesCount()) { - self.$errorContainer.html(''); - self._showFileError(self.msgFileRequired); - return false; - } - if (self.minFileCount > 0 && self._getFileCount(cnt) < self.minFileCount) { - self._noFilesError({}); - return false; - } - return true; - }, - _canPreview: function (file) { - var self = this; - if (!file || !self.showPreview || !self.$preview || !self.$preview.length) { - return false; - } - var name = file.name || '', type = file.type || '', size = (file.size || 0) / self.bytesToKB, - cat = self._parseFileType(type, name), allowedTypes, allowedMimes, allowedExts, skipPreview, - types = self.allowedPreviewTypes, mimes = self.allowedPreviewMimeTypes, - exts = self.allowedPreviewExtensions || [], dTypes = self.disabledPreviewTypes, - dMimes = self.disabledPreviewMimeTypes, dExts = self.disabledPreviewExtensions || [], - maxSize = self.maxFilePreviewSize && parseFloat(self.maxFilePreviewSize) || 0, - expAllExt = new RegExp('\\.(' + exts.join('|') + ')$', 'i'), - expDisExt = new RegExp('\\.(' + dExts.join('|') + ')$', 'i'); - allowedTypes = !types || types.indexOf(cat) !== -1; - allowedMimes = !mimes || mimes.indexOf(type) !== -1; - allowedExts = !exts.length || $h.compare(name, expAllExt); - skipPreview = (dTypes && dTypes.indexOf(cat) !== -1) || (dMimes && dMimes.indexOf(type) !== -1) || - (dExts.length && $h.compare(name, expDisExt)) || (maxSize && !isNaN(maxSize) && size > maxSize); - return !skipPreview && (allowedTypes || allowedMimes || allowedExts); - }, - addToStack: function (file, id) { - var self = this; - self.stackIsUpdating = true; - self.fileManager.add(file, id); - self._refreshPreview(); - self.stackIsUpdating = false; - }, - clearFileStack: function () { - var self = this; - self.fileManager.clear(); - self._initResumableUpload(); - if (self.enableResumableUpload) { - if (self.showPause === null) { - self.showPause = true; - } - if (self.showCancel === null) { - self.showCancel = false; - } - } else { - self.showPause = false; - if (self.showCancel === null) { - self.showCancel = true; - } - } - return self.$element; - }, - getFileStack: function () { - return this.fileManager.stack; - }, - getFileList: function () { - return this.fileManager.list(); - }, - getFilesSize: function () { - return this.fileManager.getTotalSize(); - }, - getFilesCount: function (includeInitial) { - var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount(); - if (includeInitial) { - len += self.previewCache.count(true); - } - return self._getFileCount(len); - }, - _initCapStatus: function (status) { - var self = this, $cap = self.$caption; - $cap.removeClass('is-valid file-processing'); - if (!status) { - return; - } - if (status === 'processing') { - $cap.addClass('file-processing'); - } else { - $cap.addClass('is-valid'); - } - }, - _toggleLoading: function (type) { - var self = this; - self.$previewStatus.html(type === 'hide' ? '' : self.msgProcessing); - self.$container.removeClass('file-thumb-loading'); - self._initCapStatus(type === 'hide' ? '' : 'processing'); - if (type !== 'hide') { - if (self.dropZoneEnabled) { - self.$container.find('.file-drop-zone .' + self.dropZoneTitleClass).remove(); - } - self.$container.addClass('file-thumb-loading'); - } - }, - _initFileSelected: function () { - var self = this, $el = self.$element, $body = $(document.body), ev = 'focusin.fileinput focusout.fileinput'; - if ($body.length) { - $body.off(ev).on('focusout.fileinput', function () { - self._toggleLoading('show'); - }).on('focusin.fileinput', function () { - setTimeout(function () { - if (!$el.val()) { - self._setFileDropZoneTitle(); - } - $body.off(ev); - self._toggleLoading('hide'); - }, 2500); - }); - } else { - self._toggleLoading('hide'); - } - }, - readFiles: function (files) { - this.reader = new FileReader(); - var self = this, reader = self.reader, $container = self.$previewContainer, - $status = self.$previewStatus, msgLoading = self.msgLoading, msgProgress = self.msgProgress, - previewInitId = self.previewInitId, numFiles = files.length, settings = self.fileTypeSettings, - readFile, fileTypes = self.allowedFileTypes, typLen = fileTypes ? fileTypes.length : 0, - fileExt = self.allowedFileExtensions, strExt = $h.isEmpty(fileExt) ? '' : fileExt.join(', '), - throwError = function (msg, file, previewId, index, fileId) { - var $thumb, p1 = $.extend(true, {}, self._getOutData(null, {}, {}, files), - {id: previewId, index: index, fileId: fileId}), - p2 = {id: previewId, index: index, fileId: fileId, file: file, files: files}; - self._previewDefault(file, true); - $thumb = self._getFrame(previewId, true); - self._toggleLoading('hide'); - if (self.isAjaxUpload) { - setTimeout(function () { - readFile(index + 1); - }, self.processDelay); - } else { - self.unlock(); - numFiles = 0; - } - if (self.removeFromPreviewOnError && $thumb.length) { - $thumb.remove(); - } else { - self._initFileActions(); - $thumb.find('.kv-file-upload').remove(); - } - self.isPersistentError = true; - self.isError = self.isAjaxUpload ? self._showFileError(msg, p1) : self._showError(msg, p2); - self._updateFileDetails(numFiles); - }; - self.fileManager.clearImages(); - $.each(files, function (key, file) { - var func = self.fileTypeSettings.image; - if (func && func(file.type)) { - self.fileManager.totalImages++; - } - }); - readFile = function (i) { - var $error = self.$errorContainer, errors, fm = self.fileManager; - if (i >= numFiles) { - self.unlock(); - if (self.duplicateErrors.length) { - errors = '
  • ' + self.duplicateErrors.join('
  • ') + '
  • '; - if ($error.find('ul').length === 0) { - $h.setHtml($error, self.errorCloseButton + '
      ' + errors + '
    '); - } else { - $error.find('ul').append(errors); - } - $error.fadeIn(self.fadeDelay); - self._handler($error.find('.kv-error-close'), 'click', function () { - $error.fadeOut(self.fadeDelay); - }); - self.duplicateErrors = []; - } - if (self.isAjaxUpload) { - self._raise('filebatchselected', [fm.stack]); - if (fm.count() === 0 && !self.isError) { - self.reset(); - } - } else { - self._raise('filebatchselected', [files]); - } - $container.removeClass('file-thumb-loading'); - self._initCapStatus('valid'); - $status.html(''); - return; - } - self.lock(true); - var file = files[i], id, previewId, fileProcessed, - fSize = (file && file.size || 0), sizeHuman = self._getSize(fSize, true), j, msg, - fnImage = settings.image, chk, typ, typ1, typ2, caption, fileSize = fSize / self.bytesToKB, - fileExtExpr = '', previewData, fileCount = 0, strTypes = '', fileId, canLoad, - fileReaderAborted = false, func, knownTypes = 0, isImage, processFileLoaded, initFileData; - initFileData = function (dataSource) { - dataSource = dataSource || file; - id = fileId = self._getFileId(file); - previewId = previewInitId + '-' + id; - previewData = $h.createObjectURL(dataSource); - caption = self._getFileName(file, ''); - }; - processFileLoaded = function () { - var isImageResized = !!fm.loadedImages[id], msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': 50, - 'name': caption - }); - setTimeout(function () { - $status.html(msg); - self._updateFileDetails(numFiles); - if (self.getFilesCount(true) > 0 && self.getFrames(':visible')) { - self.$dropZone.find('.' + self.dropZoneTitleClass).remove(); - } - readFile(i + 1); - }, self.processDelay); - if (self._raise('fileloaded', [file, previewId, id, i, reader]) && self.isAjaxUpload) { - if (!isImageResized) { - fm.add(file); - } - } else { - if (isImageResized) { - fm.removeFile(id); - } - } - }; - if (!file) { - return; - } - initFileData(); - - if (typLen > 0) { - for (j = 0; j < typLen; j++) { - typ1 = fileTypes[j]; - typ2 = self.msgFileTypes[typ1] || typ1; - strTypes += j === 0 ? typ2 : ', ' + typ2; - } - } - if (caption === false) { - readFile(i + 1); - return; - } - if (caption.length === 0) { - msg = self.msgInvalidFileName.replace('{name}', $h.htmlEncode($h.getFileName(file), '[unknown]')); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileExt)) { - fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i'); - } - if (self.isAjaxUpload && fm.exists(fileId) || self._getFrame(previewId, true).length) { - var p2 = {id: previewId, index: i, fileId: fileId, file: file, files: files}; - msg = self.msgDuplicateFile.setTokens({name: caption, size: sizeHuman}); - if (self.isAjaxUpload) { - if (!self.stackIsUpdating) { - self.duplicateErrors.push(msg); - self.isDuplicateError = true; - self._raise('fileduplicateerror', [file, fileId, caption, sizeHuman, previewId, i]); - } - readFile(i + 1); - self._updateFileDetails(numFiles); - } else { - self._showError(msg, p2); - self.unlock(); - numFiles = 0; - self._clearFileInput(); - self.reset(); - self._updateFileDetails(numFiles); - } - return; - } - if (self.maxFileSize > 0 && fileSize > self.maxFileSize) { - msg = self.msgSizeTooLarge.setTokens({ - 'name': caption, - 'size': sizeHuman, - 'maxSize': self._getSize(self.maxFileSize * self.bytesToKB, true) - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (self.minFileSize !== null && fileSize <= $h.getNum(self.minFileSize)) { - msg = self.msgSizeTooSmall.setTokens({ - 'name': caption, - 'size': sizeHuman, - 'minSize': self._getSize(self.minFileSize * self.bytesToKB, true) - }); - throwError(msg, file, previewId, i, fileId); - return; - } - if (!$h.isEmpty(fileTypes) && $h.isArray(fileTypes)) { - for (j = 0; j < fileTypes.length; j += 1) { - typ = fileTypes[j]; - func = settings[typ]; - fileCount += !func || (typeof func !== 'function') ? 0 : (func(file.type, - $h.getFileName(file)) ? 1 : 0); - } - if (fileCount === 0) { - msg = self.msgInvalidFileType.setTokens({name: caption, types: strTypes}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (fileCount === 0 && !$h.isEmpty(fileExt) && $h.isArray(fileExt) && !$h.isEmpty(fileExtExpr)) { - chk = $h.compare(caption, fileExtExpr); - fileCount += $h.isEmpty(chk) ? 0 : chk.length; - if (fileCount === 0) { - msg = self.msgInvalidFileExtension.setTokens({name: caption, extensions: strExt}); - throwError(msg, file, previewId, i, fileId); - return; - } - } - if (!self._canPreview(file)) { - canLoad = self._raise('filebeforeload', [file, i, reader]); - if (self.isAjaxUpload && canLoad) { - fm.add(file); - } - if (self.showPreview && canLoad) { - $container.addClass('file-thumb-loading'); - self._initCapStatus('processing'); - self._previewDefault(file); - self._initFileActions(); - } - setTimeout(function () { - if (canLoad) { - self._updateFileDetails(numFiles); - } - readFile(i + 1); - self._raise('fileloaded', [file, previewId, id, i]); - }, 10); - return; - } - isImage = fnImage(file.type, caption); - $status.html(msgLoading.replace('{index}', i + 1).replace('{files}', numFiles)); - $container.addClass('file-thumb-loading'); - self._initCapStatus('processing'); - reader.onerror = function (evt) { - self._errorHandler(evt, caption); - }; - reader.onload = function (theFile) { - var hex, fileInfo, fileData, byte, bytes = [], contents, mime, - processPreview = function (fType, ext) { - if ($h.isEmpty(fType)) { // look for ascii text content - contents = $h.arrayBuffer2String(reader.result); - fType = $h.isSvg(contents) ? 'image/svg+xml' : $h.getMimeType(hex, contents, file.type); - } - fileInfo = {'name': caption, 'type': fType || ''}; - if (ext && typeof File !== "undefined") { - try { - var fName = fileInfo.filename = caption + '.' + ext; - fileProcessed = new File([file], fName, {type: fileInfo.type}); - initFileData(fileProcessed); - } catch (err) { - } - } - isImage = fnImage(fType, ''); - if (isImage) { - var newReader = new FileReader(); - newReader.onerror = function (theFileNew) { - self._errorHandler(theFileNew, caption); - }; - newReader.onload = function (theFileNew) { - if (self.isAjaxUpload && !self._raise('filebeforeload', [file, i, reader])) { - fileReaderAborted = true; - self._resetCaption(); - reader.abort(); - $status.html(''); - $container.removeClass('file-thumb-loading'); - self._initCapStatus('valid'); - self.enable(); - return; - } - self._previewFile(i, file, theFileNew, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - newReader.readAsDataURL(file); - return; - } - if (self.isAjaxUpload && !self._raise('filebeforeload', [file, i, reader])) { - fileReaderAborted = true; - self._resetCaption(); - reader.abort(); - $status.html(''); - $container.removeClass('file-thumb-loading'); - self._initCapStatus('valid'); - self.enable(); - return; - } - self._previewFile(i, file, theFile, previewData, fileInfo); - self._initFileActions(); - processFileLoaded(); - }; - mime = file.type; - fileInfo = {'name': caption, 'type': mime}; - $.each(settings, function (k, f) { - if (k !== 'object' && k !== 'other' && typeof f === 'function' && f(mime, caption)) { - knownTypes++; - } - }); - if (typeof FileTypeParser !== "undefined") { - fileData = new Uint8Array(theFile.target.result); - new FileTypeParser().parse(fileData).then(function (result) { - processPreview(result && result.mime || mime, result && result.ext || ''); - }); - } else { - if (knownTypes === 0) { // auto detect mime types from content if no known file types detected - fileData = new Uint8Array(theFile.target.result); - for (j = 0; j < fileData.length; j++) { - byte = fileData[j].toString(16); - bytes.push(byte); - } - hex = bytes.join('').toLowerCase().substring(0, 8); - mime = $h.getMimeType(hex, '', ''); - } - processPreview(mime); - } - }; - reader.onprogress = function (data) { - if (data.lengthComputable) { - var fact = (data.loaded / data.total) * 100, progress = Math.ceil(fact); - msg = msgProgress.setTokens({ - 'index': i + 1, - 'files': numFiles, - 'percent': progress, - 'name': caption - }); - setTimeout(function () { - if (!fileReaderAborted) { - $status.html(msg); - } - }, self.processDelay); - } - }; - reader.readAsArrayBuffer(file); - }; - - readFile(0); - self._updateFileDetails(numFiles); - }, - lock: function (selectMode) { - var self = this, $container = self.$container; - self._resetErrors(); - self.disable(); - if (!selectMode && self.showCancel) { - $container.find('.fileinput-cancel').show(); - } - if (!selectMode && self.showPause) { - $container.find('.fileinput-pause').show(); - } - self._initCapStatus('processing'); - self._raise('filelock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - unlock: function (reset) { - var self = this, $container = self.$container; - if (reset === undefined) { - reset = true; - } - self.enable(); - $container.removeClass('is-locked'); - if (self.showCancel) { - $container.find('.fileinput-cancel').hide(); - } - if (self.showPause) { - $container.find('.fileinput-pause').hide(); - } - if (reset) { - self._resetFileStack(); - } - self._initCapStatus(); - self._raise('fileunlock', [self.fileManager.stack, self._getExtraData()]); - return self.$element; - }, - resume: function () { - var self = this, fm = self.fileManager, flag = false, rm = self.resumableManager; - fm.bpsLog = []; - fm.bps = 0; - if (!self.enableResumableUpload) { - return self.$element; - } - if (self.paused) { - self._toggleResumableProgress(self.progressPauseTemplate, self.msgUploadResume); - } else { - flag = true; - } - self.paused = false; - if (flag) { - self._toggleResumableProgress(self.progressInfoTemplate, self.msgUploadBegin); - } - setTimeout(function () { - rm.upload(); - }, self.processDelay); - return self.$element; - }, - paste: function (e) { - var self = this, ev = e.originalEvent, files = ev.clipboardData && ev.clipboardData.files || null; - if (files) { - self._dropFiles(e, files); - } - return self.$element; - }, - pause: function () { - var self = this, rm = self.resumableManager, xhr = self.ajaxRequests, len = xhr.length, i, - pct = rm.getProgress(), actions = self.fileActionSettings, tm = self.taskManager, - pool = tm.getPool(rm.id); - if (!self.enableResumableUpload) { - return self.$element; - } else { - if (pool) { - pool.cancel(); - } - } - self._raise('fileuploadpaused', [self.fileManager, rm]); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.paused = true; - xhr[i].abort(); - } - } - if (self.showPreview) { - self._getThumbs().each(function () { - var $thumb = $(this), t = self._getLayoutTemplate('stats'), stats, - $indicator = $thumb.find('.file-upload-indicator'); - $thumb.removeClass('file-uploading'); - if ($indicator.attr('title') === actions.indicatorLoadingTitle) { - self._setThumbStatus($thumb, 'Paused'); - stats = t.setTokens({pendingTime: self.msgPaused, uploadSpeed: ''}); - self.paused = true; - self._setProgress(pct, $thumb.find('.file-thumb-progress'), pct + '%', stats); - } - if (!self._getThumbFile($thumb)) { - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - }); - } - self._setProgress(101, self.$progress, self.msgPaused); - return self.$element; - }, - cancel: function () { - var self = this, xhr = self.ajaxRequests, - rm = self.resumableManager, tm = self.taskManager, - pool = rm ? tm.getPool(rm.id) : undefined, len = xhr.length, i; - if (self.enableResumableUpload && pool) { - pool.cancel().done(function () { - self._setProgressCancelled(); - }); - rm.reset(); - self._raise('fileuploadcancelled', [self.fileManager, rm]); - } else { - if (self.ajaxPool) { - self.ajaxPool.cancel(); - } - self._raise('fileuploadcancelled', [self.fileManager]); - } - self._initAjax(); - if (len > 0) { - for (i = 0; i < len; i += 1) { - self.cancelling = true; - xhr[i].abort(); - } - } - self._getThumbs().each(function () { - var $thumb = $(this), $prog = $thumb.find('.file-thumb-progress'); - $thumb.removeClass('file-uploading'); - self._setProgress(0, $prog); - $prog.hide(); - if (!self._getThumbFile($thumb)) { - $thumb.find('.kv-file-upload').removeClass('disabled').removeAttr('disabled'); - $thumb.find('.kv-file-remove').removeClass('disabled').removeAttr('disabled'); - } - self.unlock(); - }); - setTimeout(function () { - self._setProgressCancelled(); - }, self.processDelay); - return self.$element; - }, - clear: function () { - var self = this, cap; - if (!self._raise('fileclear')) { - return; - } - self.clearInput = true; - self.$btnUpload.removeAttr('disabled'); - self._getThumbs().find('video,audio,img').each(function () { - $h.cleanMemory($(this)); - }); - self._clearFileInput(); - self._resetUpload(); - self.clearFileStack(); - self.isDuplicateError = false; - self.isPersistentError = false; - self._resetErrors(true); - if (self._hasInitialPreview()) { - self._showFileIcon(); - self._resetPreview(); - self._initPreviewActions(); - self.$container.removeClass('file-input-new'); - } else { - self._getThumbs().each(function () { - self._clearObjects($(this)); - }); - if (self.isAjaxUpload) { - self.previewCache.data = {}; - } - self.$preview.html(''); - cap = (!self.overwriteInitial && self.initialCaption.length > 0) ? self.initialCaption : ''; - self.$caption.attr('title', '').val(cap); - $h.addCss(self.$container, 'file-input-new'); - self._validateDefaultPreview(); - } - if (self.$container.find($h.FRAMES).length === 0) { - if (!self._initCaption()) { - self.$captionContainer.removeClass('icon-visible'); - } - } - self._hideFileIcon(); - if (self.focusCaptionOnClear) { - self.$captionContainer.focus(); - } - self._setFileDropZoneTitle(); - self._raise('filecleared'); - return self.$element; - }, - reset: function () { - var self = this; - if (!self._raise('filereset')) { - return; - } - self.lastProgress = 0; - self._resetPreview(); - self.$container.find('.fileinput-filename').text(''); - $h.addCss(self.$container, 'file-input-new'); - if (self.getFrames().length) { - self.$container.removeClass('file-input-new'); - } - self.clearFileStack(); - self._setFileDropZoneTitle(); - return self.$element; - }, - disable: function () { - var self = this, $container = self.$container; - self.isDisabled = true; - self._raise('filedisabled'); - self.$element.attr('disabled', 'disabled'); - $container.addClass('is-locked'); - $h.addCss($container.find('.btn-file'), 'disabled'); - $container.find('.kv-fileinput-caption').addClass('file-caption-disabled'); - $container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .attr('disabled', true); - self._initDragDrop(); - return self.$element; - }, - enable: function () { - var self = this, $container = self.$container; - self.isDisabled = false; - self._raise('fileenabled'); - self.$element.removeAttr('disabled'); - $container.removeClass('is-locked'); - $container.find('.kv-fileinput-caption').removeClass('file-caption-disabled'); - $container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button') - .removeAttr('disabled'); - $container.find('.btn-file').removeClass('disabled'); - self._initDragDrop(); - return self.$element; - }, - upload: function () { - var self = this, fm = self.fileManager, totLen = fm.count(), i, outData, tm = self.taskManager, - hasExtraData = !$.isEmptyObject(self._getExtraData()); - fm.bpsLog = []; - fm.bps = 0; - if (!self.isAjaxUpload || self.isDisabled || !self._isFileSelectionValid(totLen)) { - return; - } - self.lastProgress = 0; - self._resetUpload(); - if (totLen === 0 && !hasExtraData) { - self._showFileError(self.msgUploadEmpty); - return; - } - self.cancelling = false; - self.uploadInitiated = true; - self._showProgress(); - self.lock(); - if (totLen === 0 && hasExtraData) { - self._setProgress(2); - self._uploadExtraOnly(); - return; - } - if (self.enableResumableUpload) { - return self.resume(); - } - if (self.uploadAsync || self.enableResumableUpload) { - outData = self._getOutData(null); - if (!self._checkBatchPreupload(outData)) { - return; - } - self.fileBatchCompleted = false; - self.uploadCache = []; - $.each(self.getFileStack(), function (id) { - var previewId = self._getThumbId(id); - self.uploadCache.push({id: previewId, content: null, config: null, tags: null, append: true}); - }); - self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS); - self._initSortable(); - } - self._setProgress(2); - self.hasInitData = false; - if (self.uploadAsync) { - i = 0; - var pool = self.ajaxPool = tm.addPool($h.uniqId()); - $.each(self.getFileStack(), function (id) { - pool.addTask(id + i, function (deferrer) { - self._uploadSingle(i, id, true, deferrer); - }); - i++; - }); - - pool.run(self.maxAjaxThreads).done(function () { - self._log('Async upload batch completed successfully.'); - self._raise('filebatchuploadsuccess', [fm.stack, self._getExtraData()]); - }).fail(function () { - self._log('Async upload batch completed with errors.'); - self._raise('filebatchuploaderror', [fm.stack, self._getExtraData()]); - }); - return; - } - self._uploadBatch(); - return self.$element; - }, - destroy: function () { - var self = this, $form = self.$form, $cont = self.$container, $el = self.$element, ns = self.namespace; - $(document).off(ns); - $(window).off(ns); - if ($form && $form.length) { - $form.off(ns); - } - if (self.isAjaxUpload) { - self._clearFileInput(); - } - self._cleanup(); - self._initPreviewCache(); - $el.insertBefore($cont).off(ns).removeData(); - $cont.off().remove(); - return $el; - }, - refresh: function (options) { - var self = this, $el = self.$element; - if (typeof options !== 'object' || $h.isEmpty(options)) { - options = self.options; - } else { - options = $.extend(true, {}, self.options, options); - } - self._init(options, true); - self._listen(); - return $el; - }, - zoom: function (frameId) { - var self = this, $frame = self._getFrame(frameId); - self._showModal($frame); - }, - getExif: function (frameId) { - var self = this, $frame = self._getFrame(frameId); - return $frame && $frame.data('exif') || null; - }, - getFrames: function (cssFilter) { - var self = this, $frames; - cssFilter = cssFilter || ''; - $frames = self.$preview.find($h.FRAMES + cssFilter); - if (self.reversePreviewOrder) { - $frames = $($frames.get().reverse()); - } - return $frames; - }, - getPreview: function () { - var self = this; - return { - content: self.initialPreview, - config: self.initialPreviewConfig, - tags: self.initialPreviewThumbTags - }; - } - }; - - $.fn.fileinput = function (option) { - if (!$h.hasFileAPISupport() && !$h.isIE(9)) { - return; - } - var args = Array.apply(null, arguments), retvals = []; - args.shift(); - this.each(function () { - var self = $(this), data = self.data('fileinput'), options = typeof option === 'object' && option, - theme = options.theme || self.data('theme'), l = {}, t = {}, - lang = options.language || self.data('language') || $.fn.fileinput.defaults.language || 'en', opt; - if (!data) { - if (theme) { - t = $.fn.fileinputThemes[theme] || {}; - } - if (lang !== 'en' && !$h.isEmpty($.fn.fileinputLocales[lang])) { - l = $.fn.fileinputLocales[lang] || {}; - } - opt = $.extend(true, {}, $.fn.fileinput.defaults, t, $.fn.fileinputLocales.en, l, options, self.data()); - data = new FileInput(this, opt); - self.data('fileinput', data); - } - - if (typeof option === 'string') { - retvals.push(data[option].apply(data, args)); - } - }); - switch (retvals.length) { - case 0: - return this; - case 1: - return retvals[0]; - default: - return retvals; - } - }; - - var IFRAME_ATTRIBS = 'class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}', - defBtnCss1 = 'btn btn-sm btn-kv ' + $h.defaultButtonCss(), defBtnCss2 = 'btn ' + $h.defaultButtonCss(); - - $.fn.fileinput.defaults = { - language: 'zh', - bytesToKB: 1024, - showCaption: true, - showBrowse: true, - showPreview: true, - showRemove: true, - showUpload: true, - showUploadStats: true, - showCancel: null, - showPause: null, - showClose: true, - showUploadedThumbs: true, - showConsoleLogs: false, - browseOnZoneClick: false, - autoReplace: false, - showDescriptionClose: true, - autoOrientImage: function () { // applicable for JPEG images only and non ios safari - var ua = window.navigator.userAgent, webkit = !!ua.match(/WebKit/i), - iOS = !!ua.match(/iP(od|ad|hone)/i), iOSSafari = iOS && webkit && !ua.match(/CriOS/i); - return !iOSSafari; - }, - autoOrientImageInitial: true, - showExifErrorLog: false, - required: false, - rtl: false, - hideThumbnailContent: false, - encodeUrl: true, - focusCaptionOnBrowse: true, - focusCaptionOnClear: true, - generateFileId: null, - previewClass: '', - captionClass: '', - frameClass: 'krajee-default', - mainClass: '', - inputGroupClass: '', - mainTemplate: null, - fileSizeGetter: null, - initialCaption: '', - initialPreview: [], - initialPreviewDelimiter: '*$$*', - initialPreviewAsData: false, - initialPreviewFileType: 'image', - initialPreviewConfig: [], - initialPreviewThumbTags: [], - previewThumbTags: {}, - initialPreviewShowDelete: true, - initialPreviewDownloadUrl: '', - removeFromPreviewOnError: false, - deleteUrl: '', - deleteExtraData: {}, - overwriteInitial: true, - sanitizeZoomCache: function (content) { - var $container = $h.createElement(content); - $container.find('input,textarea,select,datalist,form,.file-thumbnail-footer').remove(); - return $container.html(); - }, - previewZoomButtonIcons: { - prev: '', - next: '', - toggleheader: '', - fullscreen: '', - borderless: '', - close: '' - }, - previewZoomButtonClasses: { - prev: 'btn btn-default btn-outline-secondary btn-navigate', - next: 'btn btn-default btn-outline-secondary btn-navigate', - rotate: defBtnCss1, - toggleheader: defBtnCss1, - fullscreen: defBtnCss1, - borderless: defBtnCss1, - close: defBtnCss1 - }, - previewTemplates: {}, - previewContentTemplates: {}, - preferIconicPreview: false, - preferIconicZoomPreview: false, - alwaysPreviewFileExtensions: [], - rotatableFileExtensions: ['jpg', 'jpeg', 'png', 'gif'], - allowedFileTypes: null, - allowedFileExtensions: null, - allowedPreviewTypes: undefined, - allowedPreviewMimeTypes: null, - allowedPreviewExtensions: null, - disabledPreviewTypes: undefined, - disabledPreviewExtensions: ['msi', 'exe', 'com', 'zip', 'rar', 'app', 'vb', 'scr'], - disabledPreviewMimeTypes: null, - defaultPreviewContent: null, - customLayoutTags: {}, - customPreviewTags: {}, - previewFileIcon: '', - previewFileIconClass: 'file-other-icon', - previewFileIconSettings: {}, - previewFileExtSettings: {}, - buttonLabelClass: 'hidden-xs', - browseIcon: ' ', - browseClass: 'btn btn-primary', - removeIcon: '', - removeClass: defBtnCss2, - cancelIcon: '', - cancelClass: defBtnCss2, - pauseIcon: '', - pauseClass: defBtnCss2, - uploadIcon: '', - uploadClass: defBtnCss2, - uploadUrl: null, - uploadUrlThumb: null, - uploadAsync: true, - uploadParamNames: { - chunkCount: 'chunkCount', - chunkIndex: 'chunkIndex', - chunkSize: 'chunkSize', - chunkSizeStart: 'chunkSizeStart', - chunksUploaded: 'chunksUploaded', - fileBlob: 'fileBlob', - fileId: 'fileId', - fileName: 'fileName', - fileRelativePath: 'fileRelativePath', - fileSize: 'fileSize', - retryCount: 'retryCount' - }, - maxAjaxThreads: 5, - fadeDelay: 800, - processDelay: 100, - bitrateUpdateDelay: 500, - queueDelay: 10, // must be lesser than process delay - progressDelay: 0, // must be lesser than process delay - enableResumableUpload: false, - resumableUploadOptions: { - fallback: null, - testUrl: null, // used for checking status of chunks/ files previously / partially uploaded - chunkSize: 2048, // in KB - maxThreads: 4, - maxRetries: 3, - showErrorLog: true, - retainErrorHistory: false, // when set to true, display complete error history always unless user explicitly resets upload - skipErrorsAndProceed: false // when set to true, files with errors will be skipped and upload will continue with other files - }, - uploadExtraData: {}, - zoomModalHeight: 485, // 5px more than the default preview content heights set for text, html, pdf etc. - minImageWidth: null, - minImageHeight: null, - maxImageWidth: null, - maxImageHeight: null, - resizeImage: false, - resizePreference: 'width', - resizeQuality: 0.92, - resizeDefaultImageType: 'image/jpeg', - resizeIfSizeMoreThan: 0, // in KB - minFileSize: -1, - maxFileSize: 0, - maxFilePreviewSize: 25600, // 25 MB - minFileCount: 0, - maxFileCount: 0, - maxTotalFileCount: 0, - validateInitialCount: false, - msgValidationErrorClass: 'text-danger', - msgValidationErrorIcon: ' ', - msgErrorClass: 'file-error-message', - progressThumbClass: 'progress-bar progress-bar-striped active progress-bar-animated', - progressClass: 'progress-bar bg-success progress-bar-success progress-bar-striped active progress-bar-animated', - progressInfoClass: 'progress-bar bg-info progress-bar-info progress-bar-striped active progress-bar-animated', - progressCompleteClass: 'progress-bar bg-success progress-bar-success', - progressPauseClass: 'progress-bar bg-primary progress-bar-primary progress-bar-striped active progress-bar-animated', - progressErrorClass: 'progress-bar bg-danger progress-bar-danger', - progressUploadThreshold: 99, - previewFileType: 'image', - elCaptionContainer: null, - elCaptionText: null, - elPreviewContainer: null, - elPreviewImage: null, - elPreviewStatus: null, - elErrorContainer: null, - errorCloseButton: undefined, - slugCallback: null, - dropZoneEnabled: true, - dropZoneTitleClass: 'file-drop-zone-title', - fileActionSettings: {}, - otherActionButtons: '', - textEncoding: 'UTF-8', - preProcessUpload: null, - ajaxSettings: {}, - ajaxDeleteSettings: {}, - showAjaxErrorDetails: true, - mergeAjaxCallbacks: false, - mergeAjaxDeleteCallbacks: false, - retryErrorUploads: true, - reversePreviewOrder: false, - usePdfRenderer: function () { - var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; - return !!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i) || isIE11; - }, - pdfRendererUrl: '', - pdfRendererTemplate: '', - tabIndexConfig: { - browse: 500, - remove: 500, - upload: 500, - cancel: null, - pause: null, - modal: -1 - } - }; - - // noinspection HtmlUnknownAttribute - $.fn.fileinputLocales.en = { - sizeUnits: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - bitRateUnits: ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'], - fileSingle: 'file', - filePlural: 'files', - browseLabel: 'Browse …', - removeLabel: 'Remove', - removeTitle: 'Clear all unprocessed files', - cancelLabel: 'Cancel', - cancelTitle: 'Abort ongoing upload', - pauseLabel: 'Pause', - pauseTitle: 'Pause ongoing upload', - uploadLabel: 'Upload', - uploadTitle: 'Upload selected files', - msgNo: 'No', - msgNoFilesSelected: 'No files selected', - msgCancelled: 'Cancelled', - msgPaused: 'Paused', - msgPlaceholder: 'Select {files} ...', - msgZoomModalHeading: 'Detailed Preview', - msgFileRequired: 'You must select a file to upload.', - msgSizeTooSmall: 'File "{name}" ({size}) is too small and must be larger than {minSize}.', - msgSizeTooLarge: 'File "{name}" ({size}) exceeds maximum allowed upload size of {maxSize}.', - msgFilesTooLess: 'You must select at least {n} {files} to upload.', - msgFilesTooMany: 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.', - msgTotalFilesTooMany: 'You can upload a maximum of {m} files ({n} files detected).', - msgFileNotFound: 'File "{name}" not found!', - msgFileSecured: 'Security restrictions prevent reading the file "{name}".', - msgFileNotReadable: 'File "{name}" is not readable.', - msgFilePreviewAborted: 'File preview aborted for "{name}".', - msgFilePreviewError: 'An error occurred while reading the file "{name}".', - msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".', - msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.', - msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.', - msgFileTypes: { - 'image': 'image', - 'html': 'HTML', - 'text': 'text', - 'video': 'video', - 'audio': 'audio', - 'flash': 'flash', - 'pdf': 'PDF', - 'object': 'object' - }, - msgUploadAborted: 'The file upload was aborted', - msgUploadThreshold: 'Processing …', - msgUploadBegin: 'Initializing …', - msgUploadEnd: 'Done', - msgUploadResume: 'Resuming upload …', - msgUploadEmpty: 'No valid data available for upload.', - msgUploadError: 'Upload Error', - msgDeleteError: 'Delete Error', - msgProgressError: 'Error', - msgValidationError: 'Validation Error', - msgLoading: 'Loading file {index} of {files} …', - msgProgress: 'Loading file {index} of {files} - {name} - {percent}% completed.', - msgSelected: '{n} {files} selected', - msgProcessing: 'Processing ...', - msgFoldersNotAllowed: 'Drag & drop files only! {n} folder(s) dropped were skipped.', - msgImageWidthSmall: 'Width of image file "{name}" must be at least {size} px (detected {dimension} px).', - msgImageHeightSmall: 'Height of image file "{name}" must be at least {size} px (detected {dimension} px).', - msgImageWidthLarge: 'Width of image file "{name}" cannot exceed {size} px (detected {dimension} px).', - msgImageHeightLarge: 'Height of image file "{name}" cannot exceed {size} px (detected {dimension} px).', - msgImageResizeError: 'Could not get the image dimensions to resize.', - msgImageResizeException: 'Error while resizing the image.
    {errors}
    ', - msgAjaxError: 'Something went wrong with the {operation} operation. Please try again later!', - msgAjaxProgressError: '{operation} failed', - msgDuplicateFile: 'File "{name}" of same size "{size}" has already been selected earlier. Skipping duplicate selection.', - msgResumableUploadRetriesExceeded: 'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ', - msgPendingTime: '{time} remaining', - msgCalculatingTime: 'calculating time remaining', - ajaxOperations: { - deleteThumb: 'file delete', - uploadThumb: 'file upload', - uploadBatch: 'batch file upload', - uploadExtra: 'form data upload' - }, - dropZoneTitle: 'Drag & drop files here …', - dropZoneClickTitle: '
    (or click to select {files})', - previewZoomButtonTitles: { - prev: 'View previous file', - next: 'View next file', - rotate: 'Rotate 90 deg. clockwise', - toggleheader: 'Toggle header', - fullscreen: 'Toggle full screen', - borderless: 'Toggle borderless mode', - close: 'Close detailed preview' - } - }; - - $.fn.fileinputLocales.zh = { - sizeUnits: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], - bitRateUnits: ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s', 'EB/s', 'ZB/s', 'YB/s'], - fileSingle: '文件', - filePlural: '个文件', - browseLabel: '选择 …', - removeLabel: '移除', - removeTitle: '清除选中文件', - cancelLabel: '取消', - cancelTitle: '取消进行中的上传', - pauseLabel: '暂停', - pauseTitle: '暂停上传', - uploadLabel: '上传', - uploadTitle: '上传选中文件', - msgNo: '没有', - msgNoFilesSelected: '未选择文件', - msgPaused: '已暂停', - msgCancelled: '取消', - msgPlaceholder: '选择 {files} ...', - msgZoomModalHeading: '详细预览', - msgFileRequired: '必须选择一个文件上传.', - msgSizeTooSmall: '文件 "{name}" ({size}) 必须大于限定大小 {minSize}.', - msgSizeTooLarge: '文件 "{name}" ({size}) 超过了允许大小 {maxSize}.', - msgFilesTooLess: '你必须选择最少 {n} {files} 来上传. ', - msgFilesTooMany: '选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.', - msgTotalFilesTooMany: '你最多可以上传 {m} 个文件 (当前有{n} 个文件).', - msgFileNotFound: '文件 "{name}" 未找到!', - msgFileSecured: '安全限制,为了防止读取文件 "{name}".', - msgFileNotReadable: '文件 "{name}" 不可读.', - msgFilePreviewAborted: '取消 "{name}" 的预览.', - msgFilePreviewError: '读取 "{name}" 时出现了一个错误.', - msgInvalidFileName: '文件名 "{name}" 包含非法字符.', - msgInvalidFileType: '不正确的类型 "{name}". 只支持 "{types}" 类型的文件.', - msgInvalidFileExtension: '不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.', - msgFileTypes: { - 'image': 'image', - 'html': 'HTML', - 'text': 'text', - 'video': 'video', - 'audio': 'audio', - 'flash': 'flash', - 'pdf': 'PDF', - 'object': 'object' - }, - msgUploadAborted: '该文件上传被中止', - msgUploadThreshold: '处理中 …', - msgUploadBegin: '正在初始化 …', - msgUploadEnd: '完成', - msgUploadResume: '继续上传 …', - msgUploadEmpty: '无效的文件上传.', - msgUploadError: '上传出错', - msgDeleteError: '删除出错', - msgProgressError: '上传出错', - msgValidationError: '验证错误', - msgLoading: '加载第 {index} 文件 共 {files} …', - msgProgress: '加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.', - msgSelected: '{n} {files} 选中', - msgProcessing: '处理中 ...', - msgFoldersNotAllowed: '只支持拖拽文件! 跳过 {n} 拖拽的文件夹.', - msgImageWidthSmall: '图像文件的"{name}"的宽度必须是至少{size}像素.', - msgImageHeightSmall: '图像文件的"{name}"的高度必须至少为{size}像素.', - msgImageWidthLarge: '图像文件"{name}"的宽度不能超过{size}像素.', - msgImageHeightLarge: '图像文件"{name}"的高度不能超过{size}像素.', - msgImageResizeError: '无法获取的图像尺寸调整。', - msgImageResizeException: '调整图像大小时发生错误。
    {errors}
    ', - msgAjaxError: '{operation} 发生错误. 请重试!', - msgAjaxProgressError: '{operation} 失败', - msgDuplicateFile: '文件 "{name}",大小 "{size}" 已经被选中.忽略相同的文件.', - msgResumableUploadRetriesExceeded: '文件 {file} 上传失败超过 {max} 次重试 ! 错误详情:
    {error}
    ', - msgPendingTime: '{time} 剩余', - msgCalculatingTime: '计算剩余时间', - ajaxOperations: { - deleteThumb: '删除文件', - uploadThumb: '上传文件', - uploadBatch: '批量上传', - uploadExtra: '表单数据上传' - }, - dropZoneTitle: '拖拽文件到这里 …
    支持多文件同时上传', - dropZoneClickTitle: '
    (或点击{files}按钮选择文件)', - fileActionSettings: { - removeTitle: '删除文件', - uploadTitle: '上传文件', - downloadTitle: '下载文件', - uploadRetryTitle: '重试', - rotateTitle: '顺时针旋转90度', - zoomTitle: '查看详情', - dragTitle: '移动 / 重置', - indicatorNewTitle: '没有上传', - indicatorSuccessTitle: '上传', - indicatorErrorTitle: '上传错误', - indicatorPausedTitle: '上传已暂停', - indicatorLoadingTitle: '上传 …' - }, - previewZoomButtonTitles: { - prev: '预览上一个文件', - next: '预览下一个文件', - rotate: '顺时针旋转90度', - toggleheader: '缩放', - fullscreen: '全屏', - borderless: '无边界模式', - close: '关闭当前预览' - } - }; - - $.fn.fileinput.Constructor = FileInput; - - /** - * Convert automatically file inputs with class 'file' into a bootstrap fileinput control. - */ - $(document).ready(function () { - var $input = $('input.file[type=file]'); - if ($input.length) { - $input.fileinput(); - } - }); -})); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css deleted file mode 100644 index 33a833047..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.css +++ /dev/null @@ -1,13 +0,0 @@ -/*! - * bootstrap-fileinput v5.5.2 - * http://plugins.krajee.com/file-input - * - * Krajee default styling for bootstrap-fileinput. - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ - .file-loading input[type=file],input[type=file].file-loading{width:0;height:0;}.file-no-browse{position:absolute;left:50%;bottom:20%;width:1px;height:1px;font-size:0;opacity:0;border:none;background:none;outline:none;box-shadow:none;}.kv-hidden,.file-caption-icon,.file-zoom-dialog .modal-header:before,.file-zoom-dialog .modal-header:after,.file-input-new .file-preview,.file-input-new .close,.file-input-new .glyphicon-file,.file-input-new .fileinput-remove-button,.file-input-new .fileinput-upload-button,.file-input-new .no-browse .input-group-btn,.file-input-ajax-new .fileinput-remove-button,.file-input-ajax-new .fileinput-upload-button,.file-input-ajax-new .no-browse .input-group-btn,.hide-content .kv-file-content,.is-locked .fileinput-upload-button,.is-locked .fileinput-remove-button{display:none;}.file-caption .input-group{align-items:center;}.btn-file input[type=file],.file-caption-icon,.file-preview .fileinput-remove,.krajee-default .file-thumb-progress,.file-zoom-dialog .btn-navigate,.file-zoom-dialog .floating-buttons{position:absolute;}.file-caption-icon .kv-caption-icon{line-height:inherit;}.file-input,.file-loading:before,.btn-file,.file-caption,.file-preview,.krajee-default.file-preview-frame,.krajee-default .file-thumbnail-footer,.file-zoom-dialog .modal-dialog{position:relative;}.file-error-message pre,.file-error-message ul,.krajee-default .file-actions,.krajee-default .file-other-error{text-align:left;}.file-error-message pre,.file-error-message ul{margin:0;}.krajee-default .file-drag-handle,.krajee-default .file-upload-indicator{float:left;margin-top:10px;width:16px;height:16px;}.file-thumb-progress .progress,.file-thumb-progress .progress-bar{font-family:Verdana,Helvetica,sans-serif;font-size:0.7rem;}.krajee-default .file-thumb-progress .progress,.kv-upload-progress .progress{background-color:#ccc;}.krajee-default .file-caption-info,.krajee-default .file-size-info{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:160px;height:15px;margin:auto;}.file-zoom-content > .file-object.type-video,.file-zoom-content > .file-object.type-flash,.file-zoom-content > .file-object.type-image{max-width:100%;max-height:100%;width:auto;}.file-zoom-content > .file-object.type-video,.file-zoom-content > .file-object.type-flash{height:100%;}.file-zoom-content > .file-object.type-pdf,.file-zoom-content > .file-object.type-html,.file-zoom-content > .file-object.type-text,.file-zoom-content > .file-object.type-default{width:100%;}.file-loading:before{content:" Loading...";display:inline-block;padding-left:20px;line-height:16px;font-size:13px;font-variant:small-caps;color:#999;background:transparent url(loading.gif) top left no-repeat;}.file-object{margin:0 0 -5px 0;padding:0;}.btn-file{overflow:hidden;}.btn-file input[type=file]{top:0;left:0;min-width:100%;min-height:100%;text-align:right;opacity:0;background:none repeat scroll 0 0 transparent;cursor:inherit;display:block;}.btn-file::-ms-browse{font-size:10000px;width:100%;height:100%;}.file-caption.icon-visible .file-caption-icon{display:inline-block;}.file-caption.icon-visible .file-caption-name{padding-left:25px;}.file-caption.icon-visible > .input-group-lg .file-caption-name{padding-left:30px;}.file-caption.icon-visible > .input-group-sm .file-caption-name{padding-left:22px;}.file-caption-name:not(.file-caption-disabled){background-color:transparent;}.file-caption-name.file-processing{font-style:italic;border-color:#bbb;opacity:0.5;}.file-caption-icon{padding:7px 5px;left:4px;}.input-group-lg .file-caption-icon{font-size:1.25rem;}.input-group-sm .file-caption-icon{font-size:0.875rem;padding:0.25rem;}.file-error-message{color:#a94442;background-color:#f2dede;margin:5px;border:1px solid #ebccd1;border-radius:4px;padding:15px;}.file-error-message pre{margin:5px 0;}.file-caption-disabled{background-color:#eee;cursor:not-allowed;opacity:1;}.file-preview{border-radius:5px;border:1px solid #ddd;padding:8px;width:100%;margin-bottom:5px;}.file-preview .btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px;}.file-preview .fileinput-remove{top:1px;right:1px;line-height:10px;}.file-preview .clickable{cursor:pointer;}.file-preview-image{font:40px Impact,Charcoal,sans-serif;color:#008000;width:auto;height:auto;max-width:100%;max-height:100%;}.krajee-default.file-preview-frame{margin:8px;border:1px solid rgba(0,0,0,0.2);box-shadow:0 0 10px 0 rgba(0,0,0,0.2);padding:6px;float:left;text-align:center;}.krajee-default.file-preview-frame .kv-file-content{width:213px;height:160px;}.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:400px;}.krajee-default.file-preview-frame[data-template="audio"] .kv-file-content{width:240px;height:55px;}.krajee-default.file-preview-frame .file-thumbnail-footer{height:70px;}.krajee-default.file-preview-frame:not(.file-preview-error):hover{border:1px solid rgba(0,0,0,0.3);box-shadow:0 0 10px 0 rgba(0,0,0,0.4);}.krajee-default .file-preview-text{color:#428bca;border:1px solid #ddd;outline:none;resize:none;}.krajee-default .file-preview-html{border:1px solid #ddd;}.krajee-default .file-other-icon{font-size:6em;line-height:1;}.krajee-default .file-footer-buttons{float:right;}.krajee-default .file-footer-caption{display:block;text-align:center;padding-top:4px;font-size:11px;color:#999;margin-bottom:30px;}.file-upload-stats{font-size:10px;text-align:center;width:100%;}.kv-upload-progress .file-upload-stats{font-size:12px;margin:-10px 0 5px;}.krajee-default .file-preview-error{opacity:0.65;box-shadow:none;}.krajee-default .file-thumb-progress{top:37px;left:0;right:0;}.krajee-default.kvsortable-ghost{background:#e1edf7;border:2px solid #a1abff;}.krajee-default .file-preview-other:hover{opacity:0.8;}.krajee-default .file-preview-frame:not(.file-preview-error) .file-footer-caption:hover{color:#000;}.kv-upload-progress .progress{height:20px;margin:10px 0;overflow:hidden;}.kv-upload-progress .progress-bar{height:20px;font-family:Verdana,Helvetica,sans-serif;}.file-zoom-dialog .file-other-icon{font-size:22em;font-size:50vmin;}.file-zoom-dialog .modal-dialog{width:auto;}.file-zoom-dialog .modal-header{display:flex;align-items:center;justify-content:space-between;}.file-zoom-dialog .btn-navigate{margin:0 0.1rem;padding:0;font-size:1.2rem;width:2.4rem;height:2.4rem;top:50%;border-radius:50%;text-align:center;}.btn-navigate *{width:auto;}.file-zoom-dialog .floating-buttons{top:5px;right:10px;}.file-zoom-dialog .btn-kv-prev{left:0;}.file-zoom-dialog .btn-kv-next{right:0;}.file-zoom-dialog .kv-zoom-header{padding:0.5rem;}.file-zoom-dialog .kv-zoom-body{padding:0.25rem;}.file-zoom-dialog .kv-zoom-description{position:absolute;opacity:0.8;font-size:0.8rem;background-color:#1a1a1a;padding:1rem;text-align:center;border-radius:0.5rem;color:#fff;left:15%;right:15%;bottom:15%;}.file-zoom-dialog .kv-desc-hide{float:right;color:#fff;padding:0 0.1rem;background:none;border:none;}.file-zoom-dialog .kv-desc-hide:hover{opacity:0.7;}.file-zoom-dialog .kv-desc-hide:focus{opacity:0.9;}.file-input-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px;}.file-input-ajax-new .no-browse .form-control{border-top-right-radius:4px;border-bottom-right-radius:4px;}.file-caption{width:100%;position:relative;}.file-thumb-loading{background:transparent url(loading.gif) no-repeat scroll center center content-box !important;}.file-drop-zone{border:1px dashed #aaa;min-height:260px;border-radius:4px;text-align:center;vertical-align:middle;margin:12px 15px 12px 12px;padding:5px;}.file-drop-zone.clickable:hover{border:2px dashed #999;}.file-drop-zone.clickable:focus{border:2px solid #5acde2;}.file-drop-zone .file-preview-thumbnails{cursor:default;}.file-drop-zone-title{color:#aaa;font-size:1.6em;text-align:center;padding:85px 10px;cursor:default;}.file-highlighted{border:2px dashed #999 !important;background-color:#eee;}.file-uploading{background:url(loading-sm.gif) no-repeat center bottom 10px;opacity:0.65;}.file-zoom-fullscreen .modal-dialog{min-width:100%;margin:0;}.file-zoom-fullscreen .modal-content{border-radius:0;box-shadow:none;min-height:100vh;}.file-zoom-fullscreen .kv-zoom-body{overflow-y:auto;}.floating-buttons{z-index:3000;}.floating-buttons .btn-kv{margin-left:3px;z-index:3000;}.kv-zoom-actions{min-width:140px;}.kv-zoom-actions .btn-kv{margin-left:3px;}.file-zoom-content{text-align:center;white-space:nowrap;min-height:300px;}.file-zoom-content:hover{background:transparent;}.file-zoom-content .file-preview-image{max-height:100%;}.file-zoom-content .file-preview-video{max-height:100%;}.file-zoom-content > .file-object.type-image{height:auto;min-height:inherit;}.file-zoom-content > .file-object.type-audio{width:auto;height:30px;}@media (min-width:576px){.file-zoom-dialog .modal-dialog{max-width:500px;}}@media (min-width:992px){.file-zoom-dialog .modal-lg{max-width:800px;}}@media (max-width:767px){.file-preview-thumbnails{display:flex;justify-content:center;align-items:center;flex-direction:column;}.file-zoom-dialog .modal-header{flex-direction:column;}}@media (max-width:350px){.krajee-default.file-preview-frame:not([data-template="audio"]) .kv-file-content{width:160px;}}@media (max-width:420px){.krajee-default.file-preview-frame .kv-file-content.kv-pdf-rendered{width:100%;}}.file-loading[dir=rtl]:before{background:transparent url(loading.gif) top right no-repeat;padding-left:0;padding-right:20px;}.clickable .file-drop-zone-title{cursor:pointer;}.file-sortable .file-drag-handle:hover{opacity:0.7;}.file-sortable .file-drag-handle{cursor:grab;opacity:1;}.file-grabbing,.file-grabbing *{cursor:not-allowed !important;}.file-grabbing .file-preview-thumbnails *{cursor:grabbing !important;}.file-preview-frame.sortable-chosen{background-color:#d9edf7;border-color:#17a2b8;box-shadow:none !important;}.file-preview .kv-zoom-cache{display:none;}.file-preview-other-frame,.file-preview-object,.kv-file-content,.kv-zoom-body{display:flex;align-items:center;justify-content:center;}.btn-kv-rotate,.kv-file-rotate{display:none;}.rotatable:not(.hide-rotate) .btn-kv-rotate,.rotatable:not(.hide-rotate) .kv-file-rotate{display:inline-block;}.rotatable .file-zoom-detail,.rotatable .kv-file-content,.rotatable .kv-file-content >:first-child{transform-origin:center center;}.rotate-animate{transition:transform 0.3s ease;}.kv-overflow-hidden{overflow:hidden;} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js deleted file mode 100644 index d6e0ccfe3..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/fileinput.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * bootstrap-fileinput v5.5.2 - * http://plugins.krajee.com/file-input - * - * Author: Kartik Visweswaran - * Copyright: 2014 - 2022, Kartik Visweswaran, Krajee.com - * - * Licensed under the BSD-3-Clause - * https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md - */ -(function(factory){'use strict';if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof module==='object'&&typeof module.exports==='object'){factory(require('jquery'))}else{factory(window.jQuery)}}(function($){'use strict';$.fn.fileinputLocales={};$.fn.fileinputThemes={};if(!$.fn.fileinputBsVersion){$.fn.fileinputBsVersion=(window.bootstrap&&window.bootstrap.Alert&&window.bootstrap.Alert.VERSION)||(window.Alert&&window.Alert.VERSION)||'3.x.x'}String.prototype.setTokens=function(replacePairs){var str=this.toString(),key,re;for(key in replacePairs){if(replacePairs.hasOwnProperty(key)){re=new RegExp('\{'+key+'\}','g');str=str.replace(re,replacePairs[key])}}return str};if(!Array.prototype.flatMap){Array.prototype.flatMap=function(lambda){return[].concat(this.map(lambda))}}var $h,FileInput;$h={FRAMES:'.kv-preview-thumb',SORT_CSS:'file-sortable',INIT_FLAG:'init-',SCRIPT_SRC:document&&document.currentScript&&document.currentScript.src||null,OBJECT_PARAMS:'\n\n\n\n\n\n',DEFAULT_PREVIEW:'
    \n{previewFileIcon}\n
    ',MODAL_ID:'kvFileinputModal',MODAL_EVENTS:['show','shown','hide','hidden','loaded'],logMessages:{ajaxError:'{status}: {error}. Error Details: {text}.',badDroppedFiles:'Error scanning dropped files!',badExifParser:'Error loading the piexif.js library. {details}',badInputType:'The input "type" must be set to "file" for initializing the "bootstrap-fileinput" plugin.',exifWarning:'To avoid this warning, either set "autoOrientImage" to "false" OR ensure you have loaded the "piexif.js" library correctly on your page before the "fileinput.js" script.',invalidChunkSize:'Invalid upload chunk size: "{chunkSize}". Resumable uploads are disabled.',invalidThumb:'Invalid thumb frame with id: "{id}".',noResumableSupport:'The browser does not support resumable or chunk uploads.',noUploadUrl:'The "uploadUrl" is not set. Ajax uploads and resumable uploads have been disabled.',retryStatus:'Retrying upload for chunk # {chunk} for {filename}... retry # {retry}.',chunkQueueError:'Could not push task to ajax pool for chunk index # {index}.',resumableMaxRetriesReached:'Maximum resumable ajax retries ({n}) reached.',resumableRetryError:'Could not retry the resumable request (try # {n})... aborting.',resumableAborting:'Aborting / cancelling the resumable request.',resumableRequestError:'Error processing resumable request. {msg}'},objUrl:window.URL||window.webkitURL,getZoomPlaceholder:function(){var src=$h.SCRIPT_SRC,srcPath,zoomVar='?kvTemp__2873389129__=';if(!src){return zoomVar}srcPath=src.substring(0,src.lastIndexOf("/"));return srcPath.substring(0,srcPath.lastIndexOf("/")+1)+'img/loading.gif'+zoomVar},isBs:function(ver){var chk=$.trim(($.fn.fileinputBsVersion||'')+'');ver=parseInt(ver,10);if(!chk){return ver===4}return ver===parseInt(chk.charAt(0),10)},defaultButtonCss:function(fill){return'btn-default btn-'+(fill?'':'outline-')+'secondary'},now:function(){return new Date().getTime()},round:function(num){num=parseFloat(num);return isNaN(num)?0:Math.floor(Math.round(num))},getArray:function(obj){var i,arr=[],len=obj&&obj.length||0;for(i=0;i0){out+=(out?' ':'')+value+key.substring(0,1)}});return out},debounce:function(func,delay){var inDebounce;return function(){var args=arguments,context=this;clearTimeout(inDebounce);inDebounce=setTimeout(function(){func.apply(context,args)},delay)}},stopEvent:function(e){e.stopPropagation();e.preventDefault()},getFileName:function(file){return file?(file.fileName||file.name||''):''},createObjectURL:function(data){if($h.objUrl&&$h.objUrl.createObjectURL&&data){return $h.objUrl.createObjectURL(data)}return''},revokeObjectURL:function(data){if($h.objUrl&&$h.objUrl.revokeObjectURL&&data){$h.objUrl.revokeObjectURL(data)}},compare:function(input,str,exact){return input!==undefined&&(exact?input===str:input.match(str))},isIE:function(ver){var div,status;if(navigator.appName!=='Microsoft Internet Explorer'){return false}if(ver===10){return new RegExp('msie\\s'+ver,'i').test(navigator.userAgent)}div=document.createElement('div');div.innerHTML='';status=div.getElementsByTagName('i').length;document.body.appendChild(div);div.parentNode.removeChild(div);return status},canOrientImage:function($el){var $img=$(document.createElement('img')).css({width:'1px',height:'1px'}).insertAfter($el),flag=$img.css('image-orientation');$img.remove();return!!flag},canAssignFilesToInput:function(){var input=document.createElement('input');try{input.type='file';input.files=null;return true}catch(err){return false}},getDragDropFolders:function(items){var i,item,len=items?items.length:0,folders=0;if(len>0&&items[0].webkitGetAsEntry()){for(i=0;i=0){byteStr=atob(dataURI.split(',')[1])}else{byteStr=decodeURIComponent(dataURI.split(',')[1])}arrayBuffer=new ArrayBuffer(byteStr.length);intArray=new Uint8Array(arrayBuffer);for(i=0;i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:out+=String.fromCharCode(c);break;case 12:case 13:char2=array[i++];out+=String.fromCharCode(((c&0x1F)<<6)|(char2&0x3F));break;case 14:char2=array[i++];char3=array[i++];out+=String.fromCharCode(((c&0x0F)<<12)|((char2&0x3F)<<6)|((char3&0x3F)<<0));break}}return out},isHtml:function(str){var a=document.createElement('div');a.innerHTML=str;for(var c=a.childNodes,i=c.length;i--;){if(c[i].nodeType===1){return true}}return false},isPdf:function(str){if($h.isEmpty(str)){return false}str=str.toString().trim().replace(/\n/g,' ');if(str.length===0){return false}},isSvg:function(str){if($h.isEmpty(str)){return false}str=str.toString().trim().replace(/\n/g,' ');if(str.length===0){return false}return str.match(/^\s*<\?xml/i)&&(str.match(/'+str+''))},uniqId:function(){return(new Date().getTime()+Math.floor(Math.random()*Math.pow(10,15))).toString(36)},cspBuffer:{CSP_ATTRIB:'data-csp-01928735',domElementsStyles:{},stash:function(htmlString){var self=this,outerDom=$.parseHTML('
    '+htmlString+'
    '),$el=$(outerDom);$el.find('[style]').each(function(key,elem){var $elem=$(elem),styleDeclaration=$elem[0].style,id=$h.uniqId(),styles={};if(styleDeclaration&&styleDeclaration.length){$(styleDeclaration).each(function(){styles[this]=styleDeclaration[this]});self.domElementsStyles[id]=styles;$elem.removeAttr('style').attr(self.CSP_ATTRIB,id)}});$el.filter('*').removeAttr('style');var values=Object.values?Object.values(outerDom):Object.keys(outerDom).map(function(itm){return outerDom[itm]});return values.flatMap(function(elem){return elem.innerHTML}).join('')},apply:function(domElement){var self=this,$el=$(domElement);$el.find('['+self.CSP_ATTRIB+']').each(function(key,elem){var $elem=$(elem),id=$elem.attr(self.CSP_ATTRIB),styles=self.domElementsStyles[id];if(styles){$elem.css(styles)}$elem.removeAttr(self.CSP_ATTRIB)});self.domElementsStyles={}}},setHtml:function($elem,htmlString){var buf=$h.cspBuffer;$elem.html(buf.stash(htmlString));buf.apply($elem);return $elem},htmlEncode:function(str,undefVal){if(str===undefined){return undefVal||null}return str.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''')},replaceTags:function(str,tags){var out=str;if(!tags){return out}$.each(tags,function(key,value){if(typeof value==='function'){value=value()}out=out.split(key).join(value)});return out},cleanMemory:function($thumb){var data=$thumb.is('img')?$thumb.attr('src'):$thumb.find('source').attr('src');$h.revokeObjectURL(data)},findFileName:function(filePath){var sepIndex=filePath.lastIndexOf('/');if(sepIndex===-1){sepIndex=filePath.lastIndexOf('\\')}return filePath.split(filePath.substring(sepIndex,sepIndex+1)).pop()},checkFullScreen:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},toggleFullScreen:function(maximize){var doc=document,de=doc.documentElement,isFullScreen=$h.checkFullScreen();if(de&&maximize&&!isFullScreen){if(de.requestFullscreen){de.requestFullscreen()}else{if(de.msRequestFullscreen){de.msRequestFullscreen()}else{if(de.mozRequestFullScreen){de.mozRequestFullScreen()}else{if(de.webkitRequestFullscreen){de.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}}else{if(isFullScreen){if(doc.exitFullscreen){doc.exitFullscreen()}else{if(doc.msExitFullscreen){doc.msExitFullscreen()}else{if(doc.mozCancelFullScreen){doc.mozCancelFullScreen()}else{if(doc.webkitExitFullscreen){doc.webkitExitFullscreen()}}}}}}},moveArray:function(arr,oldIndex,newIndex,reverseOrder){var newArr=$.extend(true,[],arr);if(reverseOrder){newArr.reverse()}if(newIndex>=newArr.length){var k=newIndex-newArr.length;while((k--)+1){newArr.push(undefined)}}newArr.splice(newIndex,0,newArr.splice(oldIndex,1)[0]);if(reverseOrder){newArr.reverse()}return newArr},closeButton:function(css){css=($h.isBs(5)?'btn-close':'close')+(css?' '+css:'');return''},getRotation:function(value){switch(value){case 2:return'rotateY(180deg)';case 3:return'rotate(180deg)';case 4:return'rotate(180deg) rotateY(180deg)';case 5:return'rotate(270deg) rotateY(180deg)';case 6:return'rotate(90deg)';case 7:return'rotate(90deg) rotateY(180deg)';case 8:return'rotate(270deg)';default:return''}},setTransform:function(el,val){if(!el){return}el.style.transform=val;el.style.webkitTransform=val;el.style['-moz-transform']=val;el.style['-ms-transform']=val;el.style['-o-transform']=val},getObjectKeys:function(obj){var keys=[];if(obj){$.each(obj,function(key){keys.push(key)})}return keys},getObjectSize:function(obj){return $h.getObjectKeys(obj).length},whenAll:function(array){var s=[].slice,resolveValues=arguments.length===1&&$h.isArray(array)?array:s.call(arguments),deferred=$.Deferred(),i,failed=0,value,length=resolveValues.length,remaining=length,rejectContexts,rejectValues,resolveContexts,updateFunc;rejectContexts=rejectValues=resolveContexts=Array(length);updateFunc=function(index,contexts,values){return function(){if(values!==resolveValues){failed++}deferred.notifyWith(contexts[index]=this,values[index]=s.call(arguments));if(!(--remaining)){deferred[(!failed?'resolve':'reject')+'With'](contexts,values)}}};for(i=0;i0&&self.maxTotalFileCount10?len-10:Math.ceil(len/2);for(i=len;i>beg;i--){n=parseFloat(fm.bpsLog[i]);j++}fm.bps=(j>0?n/j:0)*64},delay);out={fileId:id,started:started,elapsed:elapsed,loaded:loaded,total:total,bps:fm.bps,bitrate:self._getSize(fm.bps,false,self.bitRateUnits),pendingBytes:pendingBytes};if(id){fm.stats[id]=out}else{fm.stats=out}return out},exists:function(id){return $.inArray(id,self.fileManager.getIdList())!==-1},count:function(){return self.fileManager.getIdList().length},total:function(){var fm=self.fileManager;if(!fm.totalFiles){fm.totalFiles=fm.count()}return fm.totalFiles},getTotalSize:function(){var fm=self.fileManager;if(fm.totalSize){return fm.totalSize}fm.totalSize=0;$.each(self.getFileStack(),function(id,f){var size=parseFloat(f.size);fm.totalSize+=isNaN(size)?0:size});return fm.totalSize},add:function(file,id){if(!id){id=self.fileManager.getId(file)}if(!id){return}self.fileManager.stack[id]={file:file,name:$h.getFileName(file),relativePath:$h.getFileRelativePath(file),size:file.size,nameFmt:self._getFileName(file,''),sizeFmt:self._getSize(file.size)}},remove:function($thumb){var id=self._getThumbFileId($thumb);self.fileManager.removeFile(id)},removeFile:function(id){var fm=self.fileManager;if(!id){return}delete fm.stack[id];delete fm.loadedImages[id]},move:function(idFrom,idTo){var result={},stack=self.fileManager.stack;if(!idFrom&&!idTo||idFrom===idTo){return}$.each(stack,function(k,v){if(k!==idFrom){result[k]=v}if(k===idTo){result[idFrom]=stack[idFrom]}});self.fileManager.stack=result},list:function(){var files=[];$.each(self.getFileStack(),function(k,v){if(v&&v.file){files.push(v.file)}});return files},isPending:function(id){return $.inArray(id,self.fileManager.filesProcessed)===-1&&self.fileManager.exists(id)},isProcessed:function(){var filesProcessed=true,fm=self.fileManager;$.each(self.getFileStack(),function(id){if(fm.isPending(id)){filesProcessed=false}});return filesProcessed},clear:function(){var fm=self.fileManager;self.isDuplicateError=false;self.isPersistentError=false;fm.totalFiles=null;fm.totalSize=null;fm.uploadedSize=0;fm.stack={};fm.errors=[];fm.filesProcessed=[];fm.stats={};fm.bpsLog=[];fm.bps=0;fm.clearImages()},clearImages:function(){self.fileManager.loadedImages={};self.fileManager.totalImages=0},addImage:function(id,config){self.fileManager.loadedImages[id]=config},removeImage:function(id){delete self.fileManager.loadedImages[id]},getImageIdList:function(){return $h.getObjectKeys(self.fileManager.loadedImages)},getImageCount:function(){return self.fileManager.getImageIdList().length},getId:function(file){return self._getFileId(file)},getIndex:function(id){return self.fileManager.getIdList().indexOf(id)},getThumb:function(id){var $thumb=null;self._getThumbs().each(function(){var $t=$(this);if(self._getThumbFileId($t)===id){$thumb=$t}});return $thumb},getThumbIndex:function($thumb){var id=self._getThumbFileId($thumb);return self.fileManager.getIndex(id)},getIdList:function(){return $h.getObjectKeys(self.fileManager.stack)},getFile:function(id){return self.fileManager.stack[id]||null},getFileName:function(id,fmt){var file=self.fileManager.getFile(id);if(!file){return''}return fmt?(file.nameFmt||''):file.name||''},getFirstFile:function(){var ids=self.fileManager.getIdList(),id=ids&&ids.length?ids[0]:null;return self.fileManager.getFile(id)},setFile:function(id,file){if(self.fileManager.getFile(id)){self.fileManager.stack[id].file=file}else{self.fileManager.add(file,id)}},setProcessed:function(id){self.fileManager.filesProcessed.push(id)},getProgress:function(){var total=self.fileManager.total(),filesProcessed=self.fileManager.filesProcessed.length;if(!total){return 0}return Math.ceil(filesProcessed/total*100)},setProgress:function(id,pct){var f=self.fileManager.getFile(id);if(!isNaN(pct)&&f){f.progress=pct}}}},_setUploadData:function(fd,config){var self=this;$.each(config,function(key,value){var param=self.uploadParamNames[key]||key;if($h.isArray(value)){fd.append(param,value[0],value[1])}else{fd.append(param,value)}})},_initResumableUpload:function(){var self=this,opts=self.resumableUploadOptions,logs=$h.logMessages,rm,fm=self.fileManager;if(!self.enableResumableUpload){return}if(opts.fallback!==false&&typeof opts.fallback!=='function'){opts.fallback=function(s){s._log(logs.noResumableSupport);s.enableResumableUpload=false}}if(!$h.hasResumableUploadSupport()&&opts.fallback!==false){opts.fallback(self);return}if(!self.uploadUrl&&self.enableResumableUpload){self._log(logs.noUploadUrl);self.enableResumableUpload=false;return}opts.chunkSize=parseFloat(opts.chunkSize);if(opts.chunkSize<=0||isNaN(opts.chunkSize)){self._log(logs.invalidChunkSize,{chunkSize:opts.chunkSize});self.enableResumableUpload=false;return}rm=self.resumableManager={init:function(id,f,index){rm.logs=[];rm.stack=[];rm.error='';rm.id=id;rm.file=f.file;rm.fileName=f.name;rm.fileIndex=index;rm.completed=false;rm.lastProgress=0;if(self.showPreview){rm.$thumb=fm.getThumb(id)||null;rm.$progress=rm.$btnDelete=null;if(rm.$thumb&&rm.$thumb.length){rm.$progress=rm.$thumb.find('.file-thumb-progress');rm.$btnDelete=rm.$thumb.find('.kv-file-remove')}}rm.chunkSize=opts.chunkSize*self.bytesToKB;rm.chunkCount=rm.getTotalChunks()},setAjaxError:function(jqXHR,textStatus,errorThrown,isTest){if(jqXHR.responseJSON&&jqXHR.responseJSON.error){errorThrown=jqXHR.responseJSON.error.toString()}if(!isTest){rm.error=errorThrown}if(opts.showErrorLog){self._log(logs.ajaxError,{status:jqXHR.status,error:errorThrown,text:jqXHR.responseText||''})}},reset:function(){rm.stack=[];rm.chunksProcessed={}},setProcessed:function(status){var id=rm.id,msg,$thumb=rm.$thumb,$prog=rm.$progress,hasThumb=$thumb&&$thumb.length,params={id:hasThumb?$thumb.attr('id'):'',index:fm.getIndex(id),fileId:id},tokens,skipErrorsAndProceed=self.resumableUploadOptions.skipErrorsAndProceed;rm.completed=true;rm.lastProgress=0;if(hasThumb){$thumb.removeClass('file-uploading')}if(status==='success'){fm.uploadedSize+=rm.file.size;if(self.showPreview){self._setProgress(101,$prog);self._setThumbStatus($thumb,'Success');self._initUploadSuccess(rm.chunksProcessed[id].data,$thumb)}fm.removeFile(id);delete rm.chunksProcessed[id];self._raise('fileuploaded',[params.id,params.index,params.fileId]);if(fm.isProcessed()){self._setProgress(101)}}else{if(status!=='cancel'){if(self.showPreview){self._setThumbStatus($thumb,'Error');self._setPreviewError($thumb,true);self._setProgress(101,$prog,self.msgProgressError);self._setProgress(101,self.$progress,self.msgProgressError);self.cancelling=!skipErrorsAndProceed}if(!self.$errorContainer.find('li[data-file-id="'+params.fileId+'"]').length){tokens={file:rm.fileName,max:opts.maxRetries,error:rm.error};msg=self.msgResumableUploadRetriesExceeded.setTokens(tokens);$.extend(params,tokens);self._showFileError(msg,params,'filemaxretries');if(skipErrorsAndProceed){fm.removeFile(id);delete rm.chunksProcessed[id];if(fm.isProcessed()){self._setProgress(101)}}}}}if(fm.isProcessed()){rm.reset()}},check:function(){var status=true;$.each(rm.logs,function(index,value){if(!value){status=false;return false}})},processedResumables:function(){var logs=rm.logs,i,count=0;if(!logs||!logs.length){return 0}for(i=0;irm.file.size?rm.file.size:size},getTotalChunks:function(){var chunkSize=parseFloat(rm.chunkSize);if(!isNaN(chunkSize)&&chunkSize>0){return Math.ceil(rm.file.size/chunkSize)}return 0},getProgress:function(){var chunksProcessed=rm.processedResumables(),total=rm.chunkCount;if(total===0){return 0}return Math.ceil(chunksProcessed/total*100)},checkAborted:function(intervalId){if(self._isAborted()){clearInterval(intervalId);self.unlock()}},upload:function(){var ids=fm.getIdList(),flag='new',intervalId;intervalId=setInterval(function(){var id;rm.checkAborted(intervalId);if(flag==='new'){self.lock();flag='processing';id=ids.shift();fm.initStats(id);if(fm.stack[id]){rm.init(id,fm.stack[id],fm.getIndex(id));rm.processUpload()}}if(!fm.isPending(id)&&rm.completed){flag='new'}if(fm.isProcessed()){var $initThumbs=self.$preview.find('.file-preview-initial');if($initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable()}clearInterval(intervalId);self._clearFileInput();self.unlock();setTimeout(function(){var data=self.previewCache.data;if(data){self.initialPreview=data.content;self.initialPreviewConfig=data.config;self.initialPreviewThumbTags=data.tags}self._raise('filebatchuploadcomplete',[self.initialPreview,self.initialPreviewConfig,self.initialPreviewThumbTags,self._getExtraData()])},self.processDelay)}},self.processDelay)},uploadResumable:function(){var i,pool,tm=self.taskManager,total=rm.chunkCount;pool=tm.addPool(rm.id);for(i=0;iopts.maxRetries){logError(msgs.resumableMaxRetriesReached,{n:opts.maxRetries});rm.setProcessed('error');return}var fd,outData,fnBefore,fnSuccess,fnError,fnComplete,slice=file.slice?'slice':(file.mozSlice?'mozSlice':(file.webkitSlice?'webkitSlice':'slice')),blob=file[slice](chunkSize*index,chunkSize*(index+1));fd=new FormData();f=fm.stack[id];self._setUploadData(fd,{chunkCount:rm.chunkCount,chunkIndex:index,chunkSize:chunkSize,chunkSizeStart:chunkSize*index,fileBlob:[blob,rm.fileName],fileId:id,fileName:rm.fileName,fileRelativePath:f.relativePath,fileSize:file.size,retryCount:retry});if(rm.$progress&&rm.$progress.length){rm.$progress.show()}fnBefore=function(jqXHR){outData=self._getOutData(fd,jqXHR);if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnDelete.attr('disabled',true)}self._raise('filechunkbeforesend',[id,index,retry,fm,rm,outData])};fnSuccess=function(data,textStatus,jqXHR){if(self._isAborted()){logError(msgs.resumableAborting);return}outData=self._getOutData(fd,jqXHR,data);var paramNames=self.uploadParamNames,chunkIndex=paramNames.chunkIndex||'chunkIndex',params=[id,index,retry,fm,rm,outData];if(data.error){if(opts.showErrorLog){self._log(logs.retryStatus,{retry:retry+1,filename:rm.fileName,chunk:index})}self._raise('filechunkerror',params);rm.pushAjax(index,retry+1);rm.error=data.error;logError(data.error)}else{rm.logs[data[chunkIndex]]=true;if(!rm.chunksProcessed[id]){rm.chunksProcessed[id]={}}rm.chunksProcessed[id][data[chunkIndex]]=true;rm.chunksProcessed[id].data=data;deferrer.resolve.call(null,data);self._raise('filechunksuccess',params);rm.check()}};fnError=function(jqXHR,textStatus,errorThrown){if(self._isAborted()){logError(msgs.resumableAborting);return}outData=self._getOutData(fd,jqXHR);rm.setAjaxError(jqXHR,textStatus,errorThrown);self._raise('filechunkajaxerror',[id,index,retry,fm,rm,outData]);rm.pushAjax(index,retry+1);logError(msgs.resumableRetryError,{n:retry-1})};fnComplete=function(){if(!self._isAborted()){self._raise('filechunkcomplete',[id,index,retry,fm,rm,self._getOutData(fd)])}};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,fd,id,rm.fileIndex)}};rm.reset()},_initTemplateDefaults:function(){var self=this,tMain1,tMain2,tPreview,tFileIcon,tClose,tCaption,tBtnDefault,tBtnLink,tBtnBrowse,tModalMain,tModal,tProgress,tSize,tFooter,tActions,tActionDelete,tActionUpload,tActionDownload,tActionZoom,tActionDrag,tIndicator,tTagBef,tTagBef1,tTagBef2,tTagAft,tGeneric,tHtml,tImage,tText,tOffice,tGdocs,tVideo,tAudio,tFlash,tObject,tPdf,tOther,tStyle,tZoomCache,vDefaultDim,tActionRotate,tStats,tModalLabel,tDescClose,renderObject=function(type,mime){return'\n'+$h.DEFAULT_PREVIEW+'\n\n'},defBtnCss1='btn btn-sm btn-kv '+$h.defaultButtonCss();tMain1='{preview}\n
    \n
    \n
    \n {caption}\n\n'+($h.isBs(5)?'':'
    \n')+' {remove}\n {cancel}\n {pause}\n {upload}\n {browse}\n'+($h.isBs(5)?'':'
    \n')+'
    ';'
    ';tMain2='{preview}\n
    \n
    \n{remove}\n{cancel}\n{upload}\n{browse}\n';tPreview='
    \n {close}
    \n
    \n
    \n
    \n
    \n
    \n
    ';tClose=$h.closeButton('fileinput-remove');tFileIcon='';tCaption='\n';tBtnDefault='';tBtnLink='{icon} {label}';tBtnBrowse='
    {icon} {label}
    ';tModalLabel=$h.MODAL_ID+'Label';tModalMain='';tModal='\n';tDescClose='';tProgress='
    \n
    \n {status}\n
    \n
    {stats}';tStats='
    {pendingTime} {uploadSpeed}
    ';tSize=' ({sizeText})';tFooter='';tActions='
    \n \n
    \n{drag}\n
    ';tActionDelete='\n';tActionUpload='';tActionRotate='';tActionDownload='{downloadIcon}';tActionZoom='';tActionDrag='{dragIcon}';tIndicator='
    {indicator}
    ';tTagBef='
    \n';tTagBef2=tTagBef+' title="{caption}">
    \n';tTagAft='
    {footer}\n{zoomCache}
    \n';tGeneric='{content}\n';tStyle=' {style}';tHtml=renderObject('html','text/html');tText=renderObject('text','text/plain;charset=UTF-8');tPdf=renderObject('pdf','application/pdf');tImage='{alt}\n';tOffice='';tGdocs='';tVideo='\n';tAudio='\n';tFlash='\n';tObject='\n\n'+$h.OBJECT_PARAMS+' '+$h.DEFAULT_PREVIEW+'\n\n';tOther='
    \n'+$h.DEFAULT_PREVIEW+'\n
    \n';tZoomCache='
    {zoomContent}
    ';vDefaultDim={width:'100%',height:'100%','min-height':'480px'};if(self._isPdfRendered()){tPdf=self.pdfRendererTemplate.replace('{renderer}',self._encodeURI(self.pdfRendererUrl))}self.defaults={layoutTemplates:{main1:tMain1,main2:tMain2,preview:tPreview,close:tClose,fileIcon:tFileIcon,caption:tCaption,modalMain:tModalMain,modal:tModal,descriptionClose:tDescClose,progress:tProgress,stats:tStats,size:tSize,footer:tFooter,indicator:tIndicator,actions:tActions,actionDelete:tActionDelete,actionRotate:tActionRotate,actionUpload:tActionUpload,actionDownload:tActionDownload,actionZoom:tActionZoom,actionDrag:tActionDrag,btnDefault:tBtnDefault,btnLink:tBtnLink,btnBrowse:tBtnBrowse,zoomCache:tZoomCache},previewMarkupTags:{tagBefore1:tTagBef1,tagBefore2:tTagBef2,tagAfter:tTagAft},previewContentTemplates:{generic:tGeneric,html:tHtml,image:tImage,text:tText,office:tOffice,gdocs:tGdocs,video:tVideo,audio:tAudio,flash:tFlash,object:tObject,pdf:tPdf,other:tOther},allowedPreviewTypes:['image','html','text','video','audio','flash','pdf','object'],previewTemplates:{},previewSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'213px',height:'160px'},text:{width:'213px',height:'160px'},office:{width:'213px',height:'160px'},gdocs:{width:'213px',height:'160px'},video:{width:'213px',height:'160px'},audio:{width:'100%',height:'30px'},flash:{width:'213px',height:'160px'},object:{width:'213px',height:'160px'},pdf:{width:'100%',height:'160px','position':'relative'},other:{width:'213px',height:'160px'}},previewSettingsSmall:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:{width:'100%',height:'160px'},text:{width:'100%',height:'160px'},office:{width:'100%',height:'160px'},gdocs:{width:'100%',height:'160px'},video:{width:'100%',height:'auto'},audio:{width:'100%',height:'30px'},flash:{width:'100%',height:'auto'},object:{width:'100%',height:'auto'},pdf:{width:'100%',height:'160px'},other:{width:'100%',height:'160px'}},previewZoomSettings:{image:{width:'auto',height:'auto','max-width':'100%','max-height':'100%'},html:vDefaultDim,text:vDefaultDim,office:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},gdocs:{width:'100%',height:'100%','max-width':'100%','min-height':'480px'},video:{width:'auto',height:'100%','max-width':'100%'},audio:{width:'100%',height:'30px'},flash:{width:'auto',height:'480px'},object:{width:'auto',height:'100%','max-width':'100%','min-height':'480px'},pdf:vDefaultDim,other:{width:'auto',height:'100%','min-height':'480px'}},mimeTypeAliases:{'video/quicktime':'video/mp4'},fileTypeSettings:{image:function(vType,vName){return($h.compare(vType,'image.*')&&!$h.compare(vType,/(tiff?|wmf)$/i)||$h.compare(vName,/\.(gif|png|jpe?g)$/i))},html:function(vType,vName){return $h.compare(vType,'text/html')||$h.compare(vName,/\.(htm|html)$/i)},office:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?)$/i)},gdocs:function(vType,vName){return $h.compare(vType,/(word|excel|powerpoint|office|iwork-pages|tiff?)$/i)||$h.compare(vName,/\.(docx?|xlsx?|pptx?|pps|potx?|rtf|ods|odt|pages|ai|dxf|ttf|tiff?|wmf|e?ps)$/i)},text:function(vType,vName){return $h.compare(vType,'text.*')||$h.compare(vName,/\.(xml|javascript)$/i)||$h.compare(vName,/\.(txt|md|nfo|ini|json|php|js|css)$/i)},video:function(vType,vName){return $h.compare(vType,'video.*')&&($h.compare(vType,/(ogg|mp4|mp?g|mov|webm|3gp)$/i)||$h.compare(vName,/\.(og?|mp4|webm|mp?g|mov|3gp)$/i))},audio:function(vType,vName){return $h.compare(vType,'audio.*')&&($h.compare(vName,/(ogg|mp3|mp?g|wav)$/i)||$h.compare(vName,/\.(og?|mp3|mp?g|wav)$/i))},flash:function(vType,vName){return $h.compare(vType,'application/x-shockwave-flash',true)||$h.compare(vName,/\.(swf)$/i)},pdf:function(vType,vName){return $h.compare(vType,'application/pdf',true)||$h.compare(vName,/\.(pdf)$/i)},object:function(){return true},other:function(){return true}},fileActionSettings:{showRemove:true,showUpload:true,showDownload:true,showZoom:true,showDrag:true,showRotate:false,removeIcon:'',removeClass:defBtnCss1,removeErrorClass:'btn btn-sm btn-kv btn-danger',removeTitle:'Remove file',uploadIcon:'',uploadClass:defBtnCss1,uploadTitle:'Upload file',uploadRetryIcon:'',uploadRetryTitle:'Retry upload',downloadIcon:'',downloadClass:defBtnCss1,downloadTitle:'Download file',rotateIcon:'',rotateClass:defBtnCss1,rotateTitle:'Rotate 90 deg. clockwise',zoomIcon:'',zoomClass:defBtnCss1,zoomTitle:'View Details',dragIcon:'',dragClass:'text-primary',dragTitle:'Move / Rearrange',dragSettings:{},indicatorNew:'',indicatorSuccess:'',indicatorError:'',indicatorLoading:'',indicatorPaused:'',indicatorNewTitle:'Not uploaded yet',indicatorSuccessTitle:'Uploaded',indicatorErrorTitle:'Upload Error',indicatorLoadingTitle:'Uploading …',indicatorPausedTitle:'Upload Paused'}};$.each(self.defaults,function(key,setting){if(key==='allowedPreviewTypes'){if(self.allowedPreviewTypes===undefined){self.allowedPreviewTypes=setting}return}self[key]=$.extend(true,{},setting,self[key])});self._initPreviewTemplates()},_initPreviewTemplates:function(){var self=this,tags=self.previewMarkupTags,tagBef,tagAft=tags.tagAfter;$.each(self.previewContentTemplates,function(key,value){if($h.isEmpty(self.previewTemplates[key])){tagBef=tags.tagBefore2;if(key==='generic'||key==='image'){tagBef=tags.tagBefore1}if(self._isPdfRendered()&&key==='pdf'){tagBef=tagBef.replace('kv-file-content','kv-file-content kv-pdf-rendered')}self.previewTemplates[key]=tagBef+value+tagAft}})},_initPreviewCache:function(){var self=this;self.previewCache={data:{},init:function(){var content=self.initialPreview;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}self.previewCache.data={content:content,config:self.initialPreviewConfig,tags:self.initialPreviewThumbTags}},count:function(skipNull){if(!self.previewCache.data||!self.previewCache.data.content){return 0}if(skipNull){var chk=self.previewCache.data.content.filter(function(n){return n!==null});return chk.length}return self.previewCache.data.content.length},get:function(i,isDisabled){var ind=$h.INIT_FLAG+i,data=self.previewCache.data,config=data.config[i],content=data.content[i],out,$tmp,cat,ftr,fname,ftype,frameClass,asData=$h.ifSet('previewAsData',config,self.initialPreviewAsData),a=config?{title:config.title||null,alt:config.alt||null}:{title:null,alt:null},parseTemplate=function(cat,dat,fname,ftype,ftr,ind,fclass,t){var fc=' file-preview-initial '+$h.SORT_CSS+(fclass?' '+fclass:''),id=self.previewInitId+'-'+ind,fileId=config&&config.fileId||id;return self._generatePreviewTemplate(cat,dat,fname,ftype,id,fileId,false,null,null,fc,ftr,ind,t,a,config&&config.zoomData||dat)};if(!content||!content.length){return''}isDisabled=isDisabled===undefined?true:isDisabled;cat=$h.ifSet('type',config,self.initialPreviewFileType||'generic');fname=$h.ifSet('filename',config,$h.ifSet('caption',config));ftype=$h.ifSet('filetype',config,cat);ftr=self.previewCache.footer(i,isDisabled,(config&&config.size||null));frameClass=$h.ifSet('frameClass',config);if(asData){out=parseTemplate(cat,content,fname,ftype,ftr,ind,frameClass)}else{out=parseTemplate('generic',content,fname,ftype,ftr,ind,frameClass,cat).setTokens({'content':data.content[i]})}if(data.tags.length&&data.tags[i]){out=$h.replaceTags(out,data.tags[i])}if(!$h.isEmpty(config)&&!$h.isEmpty(config.frameAttr)){$tmp=$h.createElement(out);$tmp.find('.file-preview-initial').attr(config.frameAttr);out=$tmp.html();$tmp.remove()}return out},clean:function(data){data.content=$h.cleanArray(data.content);data.config=$h.cleanArray(data.config);data.tags=$h.cleanArray(data.tags);self.previewCache.data=data},add:function(content,config,tags,append){var data=self.previewCache.data,index;if(!content||!content.length){return 0}index=content.length-1;if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}if(append&&data.content){index=data.content.push(content[0])-1;data.config[index]=config;data.tags[index]=tags}else{data.content=content;data.config=config;data.tags=tags}self.previewCache.clean(data);return index},set:function(content,config,tags,append){var data=self.previewCache.data,i,chk;if(!content||!content.length){return}if(!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}chk=content.filter(function(n){return n!==null});if(!chk.length){return}if(data.content===undefined){data.content=[]}if(data.config===undefined){data.config=[]}if(data.tags===undefined){data.tags=[]}if(append){for(i=0;i'+fileName+': '+msg}}self._showFileError(msg,params,'fileusererror')},_showFileError:function(msg,params,event){var self=this,$error=self.$errorContainer,ev=event||'fileuploaderror',fId=params&¶ms.fileId||'',e=params&¶ms.id?'
  • '+msg+'
  • ':'
  • '+msg+'
  • ';if($error.find('ul').length===0){self._addError('
      '+e+'
    ')}else{$error.find('ul').append(e)}$error.fadeIn(self.fadeDelay);self._raise(ev,[params,msg]);self._setValidationError('file-input-new');return true},_showError:function(msg,params,event){var self=this,$error=self.$errorContainer,ev=event||'fileerror';params=params||{};params.reader=self.reader;self._addError(msg);$error.fadeIn(self.fadeDelay);self._raise(ev,[params,msg]);if(!self.isAjaxUpload){self._clearFileInput()}self._setValidationError('file-input-new');self.$btnUpload.attr('disabled',true);return true},_noFilesError:function(params){var self=this,label=self.minFileCount>1?self.filePlural:self.fileSingle,msg=self.msgFilesTooLess.replace('{n}',self.minFileCount).replace('{files}',label),$error=self.$errorContainer;msg='
  • '+msg+'
  • ';if($error.find('ul').length===0){self._addError('
      '+msg+'
    ')}else{$error.find('ul').append(msg)}self.isError=true;self._updateFileDetails(0);$error.fadeIn(self.fadeDelay);self._raise('fileerror',[params,msg]);self._clearFileInput();self._setValidationError()},_parseError:function(operation,jqXHR,errorThrown,fileName){var self=this,errMsg=$.trim(errorThrown+''),textPre,errText,text;errText=jqXHR.responseJSON&&jqXHR.responseJSON.error?jqXHR.responseJSON.error.toString():'';text=errText?errText:jqXHR.responseText;if(self.cancelling&&self.msgUploadAborted){errMsg=self.msgUploadAborted}if(self.showAjaxErrorDetails&&text){if(errText){errMsg=$.trim(errText+'')}else{text=$.trim(text.replace(/\n\s*\n/g,'\n'));textPre=text.length?'
    '+text+'
    ':'';errMsg+=errMsg?textPre:text}}if(!errMsg){errMsg=self.msgAjaxError.replace('{operation}',operation)}self.cancelling=false;return fileName?''+fileName+': '+errMsg:errMsg},_parseFileType:function(type,name){var self=this,isValid,vType,cat,i,types=self.allowedPreviewTypes||[];if(type==='application/text-plain'){return'text'}for(i=0;i-1){ext=fname.split('.').pop();if(self.previewFileIconSettings){out=self.previewFileIconSettings[ext]||self.previewFileIconSettings[ext.toLowerCase()]||null}if(self.previewFileExtSettings){$.each(self.previewFileExtSettings,function(key,func){if(self.previewFileIconSettings[key]&&func(ext)){out=self.previewFileIconSettings[key];return}})}}return out||self.previewFileIcon},_parseFilePreviewIcon:function(content,fname){var self=this,icn=self._getPreviewIcon(fname),out=content;if(out.indexOf('{previewFileIcon}')>-1){out=out.setTokens({'previewFileIconClass':self.previewFileIconClass,'previewFileIcon':icn})}return out},_raise:function(event,params){var self=this,e=$.Event(event);if(params!==undefined){self.$element.trigger(e,params)}else{self.$element.trigger(e)}var out=e.result,isAborted=out===false;if(e.isDefaultPrevented()||isAborted){return false}if(e.type==='filebatchpreupload'&&(out||isAborted)){self.ajaxAborted=out;return false}switch(event){case'filebatchuploadcomplete':case'filebatchuploadsuccess':case'fileuploaded':case'fileclear':case'filecleared':case'filereset':case'fileerror':case'filefoldererror':case'filecustomerror':case'filesuccessremove':break;default:if(!self.ajaxAborted){self.ajaxAborted=out}break}return true},_listenFullScreen:function(isFullScreen){var self=this,$modal=self.$modal,$btnFull,$btnBord;if(!$modal||!$modal.length){return}$btnFull=$modal&&$modal.find('.btn-kv-fullscreen');$btnBord=$modal&&$modal.find('.btn-kv-borderless');if(!$btnFull.length||!$btnBord.length){return}$btnFull.removeClass('active').attr('aria-pressed','false');$btnBord.removeClass('active').attr('aria-pressed','false');if(isFullScreen){$btnFull.addClass('active').attr('aria-pressed','true')}else{$btnBord.addClass('active').attr('aria-pressed','true')}if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog()}else{if(isFullScreen){self._maximizeZoomDialog()}else{$btnBord.removeClass('active').attr('aria-pressed','false')}}},_listen:function(){var self=this,$el=self.$element,$form=self.$form,$cont=self.$container,fullScreenEv;self._handler($el,'click',function(e){self._initFileSelected();if($el.hasClass('file-no-browse')){if($el.data('zoneClicked')){$el.data('zoneClicked',false)}else{e.preventDefault()}}});self._handler($el,'change',$.proxy(self._change,self));self._handler(self.$caption,'paste',$.proxy(self.paste,self));if(self.showBrowse){self._handler(self.$btnFile,'click',$.proxy(self._browse,self));self._handler(self.$btnFile,'keypress',function(e){var keycode=e.keyCode||e.which;if(keycode===13){$el.trigger('click');self._browse(e)}})}self._handler($cont.find('.fileinput-remove:not([disabled])'),'click',$.proxy(self.clear,self));self._handler($cont.find('.fileinput-cancel'),'click',$.proxy(self.cancel,self));self._handler($cont.find('.fileinput-pause'),'click',$.proxy(self.pause,self));self._initDragDrop();self._handler($form,'reset',$.proxy(self.clear,self));if(!self.isAjaxUpload){self._handler($form,'submit',$.proxy(self._submitForm,self))}self._handler(self.$container.find('.fileinput-upload'),'click',$.proxy(self._uploadClick,self));self._handler($(window),'resize',function(){self._listenFullScreen(screen.width===window.innerWidth&&screen.height===window.innerHeight)});fullScreenEv='webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange';self._handler($(document),fullScreenEv,function(){self._listenFullScreen($h.checkFullScreen())});self.$caption.on('focus',function(){self.$captionContainer.focus()});self._autoFitContent();self._initClickable();self._refreshPreview()},_autoFitContent:function(){var width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,self=this,config=width<400?(self.previewSettingsSmall||self.defaults.previewSettingsSmall):(self.previewSettings||self.defaults.previewSettings),sel;$.each(config,function(cat,settings){sel='.file-preview-frame .file-preview-'+cat;self.$preview.find(sel+'.kv-preview-data,'+sel+' .kv-preview-data').css(settings)})},_scanDroppedItems:function(item,files,path){path=path||'';var self=this,i,dirReader,readDir,errorHandler=function(e){self._log($h.logMessages.badDroppedFiles);self._log(e)};if(item.isFile){item.file(function(file){if(path){file.newPath=path+file.name}files.push(file)},errorHandler)}else{if(item.isDirectory){dirReader=item.createReader();readDir=function(){dirReader.readEntries(function(entries){if(entries&&entries.length>0){for(i=0;i-1;self._zoneDragDropInit(e);if(self.isDisabled||!hasFiles){dt.effectAllowed='none';dt.dropEffect='none';return}dt.dropEffect='copy';if(self._raise('fileDragEnter',{'sourceEvent':e,'files':dt.types.Files})){$h.addCss(self.$dropZone,'file-highlighted')}},_zoneDragLeave:function(e){var self=this;self._zoneDragDropInit(e);if(self.isDisabled){return}if(self._raise('fileDragLeave',{'sourceEvent':e})){self.$dropZone.removeClass('file-highlighted')}},_dropFiles:function(e,files){var self=this,$el=self.$element;if(!self.isAjaxUpload){self.changeTriggered=true;$el.get(0).files=files;setTimeout(function(){self.changeTriggered=false;$el.trigger('change'+self.namespace)},self.processDelay)}else{self._change(e,files)}self.$dropZone.removeClass('file-highlighted')},_zoneDrop:function(e){var self=this,i,$el=self.$element,dt=e.originalEvent.dataTransfer,files=dt.files,items=dt.items,folders=$h.getDragDropFolders(items);e.preventDefault();if(self.isDisabled||$h.isEmpty(files)){return}if(!self._raise('fileDragDrop',{'sourceEvent':e,'files':files})){return}if(folders>0){if(!self.isAjaxUpload){self._showFolderError(folders);return}files=[];for(i=0;i0&&newIndex>=len,$item=$(e.item),$first;if(exceedsLast){newIndex=len-1}self.initialPreview=$h.moveArray(self.initialPreview,oldIndex,newIndex,rev);self.initialPreviewConfig=$h.moveArray(self.initialPreviewConfig,oldIndex,newIndex,rev);self.previewCache.init();self.getFrames('.file-preview-initial').each(function(){$(this).attr('data-fileindex',$h.INIT_FLAG+i);i++});if(exceedsLast){$first=self.getFrames(':not(.file-preview-initial):first');if($first.length){$item.slideUp(function(){$item.insertBefore($first).slideDown()})}}self._raise('filesorted',{previewId:$item.attr('id'),'oldIndex':oldIndex,'newIndex':newIndex,stack:self.initialPreviewConfig})},};$.extend(true,settings,self.fileActionSettings.dragSettings);if(self.sortable){self.sortable.destroy()}self.sortable=Sortable.create($el[0],settings)},_setPreviewContent:function(content){var self=this;$h.setHtml(self.$preview,content);self._autoFitContent()},_initPreviewImageOrientations:function(){var self=this,i=0,canOrientImage=self.canOrientImage;if(!self.autoOrientImageInitial&&!canOrientImage){return}self.getFrames('.file-preview-initial').each(function(){var $thumb=$(this),$img,$zoomImg,id,config=self.initialPreviewConfig[i];if(config&&config.exif&&config.exif.Orientation){id=$thumb.attr('id');$img=$thumb.find('>.kv-file-content img');$zoomImg=self._getZoom(id,' >.kv-file-content img');if(canOrientImage){$img.css('image-orientation',(self.autoOrientImageInitial?'from-image':'none'))}else{self.setImageOrientation($img,$zoomImg,config.exif.Orientation,$thumb)}}i++})},_initPreview:function(isInit){var self=this,cap=self.initialCaption||'',out;if(!self.previewCache.count(true)){self._clearPreview();if(isInit){self._setCaption(cap)}else{self._initCaption()}return}out=self.previewCache.out();cap=isInit&&self.initialCaption?self.initialCaption:out.caption;self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(cap);self._initSortable();if(!$h.isEmpty(out.content)){self.$container.removeClass('file-input-new')}self._initPreviewImageOrientations()},_getZoomButton:function(type){var self=this,label=self.previewZoomButtonIcons[type],css=self.previewZoomButtonClasses[type],title=' title="'+(self.previewZoomButtonTitles[type]||'')+'" ',tag=$h.isBs(5)?'bs-':'',params=title+(type==='close'?' data-'+tag+'dismiss="modal" aria-hidden="true"':'');if(type==='fullscreen'||type==='borderless'||type==='toggleheader'){params+=' data-toggle="button" aria-pressed="false" autocomplete="off"'}return''},_getModalContent:function(){var self=this;return self._getLayoutTemplate('modal').setTokens({'rtl':self.rtl?' kv-rtl':'','zoomFrameClass':self.frameClass,'prev':self._getZoomButton('prev'),'next':self._getZoomButton('next'),'rotate':self._getZoomButton('rotate'),'toggleheader':self._getZoomButton('toggleheader'),'fullscreen':self._getZoomButton('fullscreen'),'borderless':self._getZoomButton('borderless'),'close':self._getZoomButton('close')})},_listenModalEvent:function(event){var self=this,$modal=self.$modal,getParams=function(e){return{sourceEvent:e,previewId:$modal.data('previewId'),modal:$modal}};$modal.on(event+'.bs.modal',function(e){if(e.namespace!=='bs.modal'){return}var $btnFull=$modal.find('.btn-fullscreen'),$btnBord=$modal.find('.btn-borderless');if($modal.data('fileinputPluginId')===self.$element.attr('id')){self._raise('filezoom'+event,getParams(e))}if(event==='shown'){self._handleRotation($modal,$modal.find('.file-zoom-detail'),$modal.data('angle'));$btnBord.removeClass('active').attr('aria-pressed','false');$btnFull.removeClass('active').attr('aria-pressed','false');if($modal.hasClass('file-zoom-fullscreen')){self._maximizeZoomDialog();if($h.checkFullScreen()){$btnFull.addClass('active').attr('aria-pressed','true')}else{$btnBord.addClass('active').attr('aria-pressed','true')}}}})},_initZoom:function(){var self=this,$dialog,modalMain=self._getLayoutTemplate('modalMain'),modalId='#'+$h.MODAL_ID;modalMain=self._setTabIndex('modal',modalMain);if(!self.showPreview){return}self.$modal=$(modalId);if(!self.$modal||!self.$modal.length){$dialog=$h.createElement($h.cspBuffer.stash(modalMain)).insertAfter(self.$container);self.$modal=$(modalId).insertBefore($dialog);$h.cspBuffer.apply(self.$modal);$dialog.remove()}$h.initModal(self.$modal);self.$modal.html($h.cspBuffer.stash(self._getModalContent()));$h.cspBuffer.apply(self.$modal);$.each($h.MODAL_EVENTS,function(key,event){self._listenModalEvent(event)})},_initZoomButtons:function(){var self=this,$modal=self.$modal,previewId=$modal.data('previewId')||'',$first,$last,thumbs=self.getFrames().toArray(),len=thumbs.length,$prev=$modal.find('.btn-kv-prev'),$next=$modal.find('.btn-kv-next'),$rotate=$modal.find('.btn-kv-rotate');if(thumbs.length<2){$prev.hide();$next.hide();return}else{$prev.show();$next.show()}if(!len){return}$first=$(thumbs[0]);$last=$(thumbs[len-1]);$prev.removeAttr('disabled');$next.removeAttr('disabled');if(self.reversePreviewOrder){[$prev,$next]=[$next,$prev]}if($first.length&&$first.attr('id')===previewId){$prev.attr('disabled',true)}if($last.length&&$last.attr('id')===previewId){$next.attr('disabled',true)}},_maximizeZoomDialog:function(){var self=this,$modal=self.$modal,$head=$modal.find('.modal-header:visible'),$foot=$modal.find('.modal-footer:visible'),$body=$modal.find('.kv-zoom-body'),h=$(window).height(),diff=0;$modal.addClass('file-zoom-fullscreen');if($head&&$head.length){h-=$head.outerHeight(true)}if($foot&&$foot.length){h-=$foot.outerHeight(true)}if($body&&$body.length){diff=$body.outerHeight(true)-$body.height();h-=diff}$modal.find('.kv-zoom-body').height(h)},_resizeZoomDialog:function(fullScreen){var self=this,$modal=self.$modal,$btnFull=$modal.find('.btn-kv-fullscreen'),$btnBord=$modal.find('.btn-kv-borderless');if($modal.hasClass('file-zoom-fullscreen')){$h.toggleFullScreen(false);if(!fullScreen){if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self.$modal.find('.kv-zoom-body').css('height',self.zoomModalHeight)}else{$btnFull.removeClass('active').attr('aria-pressed','false')}}else{if(!$btnFull.hasClass('active')){$modal.removeClass('file-zoom-fullscreen');self._resizeZoomDialog(true);if($btnBord.hasClass('active')){$btnBord.removeClass('active').attr('aria-pressed','false')}}}}else{if(!fullScreen){self._maximizeZoomDialog();return}$h.toggleFullScreen(true)}$modal.focus()},_setZoomContent:function($frame,navigate){var self=this,$content,tmplt,body,title,$body,$dataEl,config,previewId=$frame.attr('id'),$zoomPreview=self._getZoom(previewId),$modal=self.$modal,$tmp,desc,$desc,$btnFull=$modal.find('.btn-kv-fullscreen'),$btnBord=$modal.find('.btn-kv-borderless'),cap,size,$btnTogh=$modal.find('.btn-kv-toggleheader'),dir=navigate==='prev'?'Left':'Right',slideIn='slideIn'+dir,slideOut='slideOut'+dir,parsed,zoomData=$frame.data('zoom');if(zoomData){zoomData=decodeURIComponent(zoomData);parsed=$zoomPreview.html().replace(self.zoomPlaceholder,'').setTokens({zoomData:zoomData});$zoomPreview.html(parsed);$frame.data('zoom','');$zoomPreview.attr('data-zoom',zoomData)}tmplt=$zoomPreview.attr('data-template')||'generic';$content=$zoomPreview.find('.kv-file-content');body=$content.length?$content.html():'';cap=$frame.data('caption')||self.msgZoomModalHeading;size=$frame.data('size')||'';desc=$frame.data('description')||'';$modal.find('.kv-zoom-caption').attr('title',cap).html(cap);$modal.find('.kv-zoom-size').html(size);$desc=$modal.find('.kv-zoom-description').hide();if(desc){if(self.showDescriptionClose){desc=self._getLayoutTemplate('descriptionClose').setTokens({closeIcon:self.previewZoomButtonIcons.close})+''+desc}$desc.show().html(desc);if(self.showDescriptionClose){self._handler($modal.find('.kv-desc-hide'),'click',function(){$(this).parent().fadeOut('fast',function(){$modal.focus()})})}}$body=$modal.find('.kv-zoom-body');$modal.removeClass('kv-single-content');if(navigate){$tmp=$body.addClass('file-thumb-loading').clone().insertAfter($body);$h.setHtml($body,body).hide();$tmp.fadeOut('fast',function(){$body.fadeIn('fast',function(){$body.removeClass('file-thumb-loading')});$tmp.remove()})}else{$h.setHtml($body,body)}config=self.previewZoomSettings[tmplt];if(config){$dataEl=$body.find('.kv-preview-data');$h.addCss($dataEl,'file-zoom-detail');$.each(config,function(key,value){$dataEl.css(key,value);if(($dataEl.attr('width')&&key==='width')||($dataEl.attr('height')&&key==='height')){$dataEl.removeAttr(key)}})}$modal.data('previewId',previewId);self._handler($modal.find('.btn-kv-prev'),'click',function(){self._zoomSlideShow('prev',previewId)});self._handler($modal.find('.btn-kv-next'),'click',function(){self._zoomSlideShow('next',previewId)});self._handler($btnFull,'click',function(){self._resizeZoomDialog(true)});self._handler($btnBord,'click',function(){self._resizeZoomDialog(false)});self._handler($btnTogh,'click',function(){var $header=$modal.find('.modal-header'),$floatBar=$modal.find('.floating-buttons'),ht,$actions=$header.find('.kv-zoom-actions'),resize=function(height){var $body=self.$modal.find('.kv-zoom-body'),h=self.zoomModalHeight;if($modal.hasClass('file-zoom-fullscreen')){h=$body.outerHeight(true);if(!height){h=h-$header.outerHeight(true)}}$body.css('height',height?h+height:h)};if($header.is(':visible')){ht=$header.outerHeight(true);$header.slideUp('slow',function(){$actions.find('.btn').appendTo($floatBar);resize(ht)})}else{$floatBar.find('.btn').appendTo($actions);$header.slideDown('slow',function(){resize()})}$modal.focus()});self._handler($modal,'keydown',function(e){var key=e.which||e.keyCode,delay=self.processDelay+1,$prev=$(this).find('.btn-kv-prev'),$next=$(this).find('.btn-kv-next'),vId=$(this).data('previewId'),vPrevKey,vNextKey;[vPrevKey,vNextKey]=self.rtl?[39,37]:[37,39];$.each({prev:[$prev,vPrevKey],next:[$next,vNextKey]},function(direction,config){var $btn=config[0],vKey=config[1];if(key===vKey&&$btn.length){$modal.focus();if(!$btn.attr('disabled')){$btn.blur();setTimeout(function(){$btn.focus();self._zoomSlideShow(direction,vId);setTimeout(function(){if($btn.attr('disabled')){$modal.focus()}},delay)},delay)}}})})},_showModal:function($frame){var self=this,$modal=self.$modal,$content,css,angle;if(!$frame||!$frame.length){return}$h.initModal($modal);$h.setHtml($modal,self._getModalContent());self._setZoomContent($frame);$modal.removeClass('rotatable');$modal.data({backdrop:false,fileinputPluginId:self.$element.attr('id')});$modal.find('.kv-zoom-body').css('height',self.zoomModalHeight);$content=$frame.find('.kv-file-content > :first-child');if($content.length){css=$content.css('transform');if(css){$modal.find('.file-zoom-detail').css('transform',css)}}if($frame.hasClass('rotatable')){$modal.addClass('rotatable')}if($frame.data('angle')){$modal.data('angle',$frame.data('angle'))}angle=($frame.data('angle')||0);$modal.modal('show');self._initZoomButtons();self._initRotateZoom($frame,$content)},_zoomPreview:function($btn){var self=this,$frame;if(!$btn.length){throw'Cannot zoom to detailed preview!';}$frame=$btn.closest($h.FRAMES);self._showModal($frame)},_zoomSlideShow:function(dir,previewId){var self=this,$modal=self.$modal,$btn=$modal.find('.kv-zoom-actions .btn-kv-'+dir),$targFrame,i,$thumb,thumbsData=self.getFrames().toArray(),thumbs=[],len=thumbsData.length,out,angle,$content;if(self.reversePreviewOrder){dir=dir==='prev'?'next':'prev'}if($btn.attr('disabled')){return}for(i=0;i=len||!thumbs[out]){return}$targFrame=$(thumbs[out]);if($targFrame.length){self._setZoomContent($targFrame,dir)}self._initZoomButtons();if($targFrame.length&&$targFrame.hasClass('rotatable')){angle=$targFrame.data('angle')||0;$modal.addClass('rotatable').data('angle',angle);$content=$targFrame.find('.kv-file-content > :first-child');self._initRotateZoom($targFrame,$content)}else{$modal.removeClass('rotatable').removeData('angle')}self._raise('filezoom'+dir,{'previewId':previewId,modal:self.$modal})},_initZoomButton:function(){var self=this;self.$preview.find('.kv-file-zoom').each(function(){var $el=$(this);self._handler($el,'click',function(){self._zoomPreview($el)})})},_inputFileCount:function(){return this.$element[0].files.length},_refreshPreview:function(){var self=this,files;if((!self._inputFileCount()&&!self.isAjaxUpload)||!self.showPreview||!self.isPreviewable){return}if(self.isAjaxUpload){if(self.fileManager.count()>0){files=$.extend(true,[],self.getFileList());self.fileManager.clear();self._clearFileInput()}else{files=self.$element[0].files}}else{files=self.$element[0].files}if(files&&files.length){self.readFiles(files)}},_clearObjects:function($el){$el.find('video audio').each(function(){this.pause();$(this).remove()});$el.find('img object div').each(function(){$(this).remove()})},_clearFileInput:function(){var self=this,$el=self.$element,$srcFrm,$tmpFrm,$tmpEl;if(!self._inputFileCount()){return}$srcFrm=$el.closest('form');$tmpFrm=$(document.createElement('form'));$tmpEl=$(document.createElement('div'));$el.before($tmpEl);if($srcFrm.length){$srcFrm.after($tmpFrm)}else{$tmpEl.after($tmpFrm)}$tmpFrm.append($el).trigger('reset');$tmpEl.before($el).remove();$tmpFrm.remove()},_resetUpload:function(){var self=this;self.uploadInitiated=false;self.uploadStartTime=$h.now();self.uploadCache=[];self.$btnUpload.removeAttr('disabled');self._setProgress(0);self._hideProgress();self._resetErrors(false);self._initAjax();self.fileManager.clearImages();self._resetCanvas();if(self.overwriteInitial){self.initialPreview=[];self.initialPreviewConfig=[];self.initialPreviewThumbTags=[];self.previewCache.data={content:[],config:[],tags:[]}}},_resetCanvas:function(){var self=this;if(self.imageCanvas&&self.imageCanvasContext){self.imageCanvasContext.clearRect(0,0,self.imageCanvas.width,self.imageCanvas.height)}},_hasInitialPreview:function(){var self=this;return!self.overwriteInitial&&self.previewCache.count(true)},_resetPreview:function(){var self=this,out,cap,$div,hasSuc=self.showUploadedThumbs,hasErr=!self.removeFromPreviewOnError,includeProcessed=(hasSuc||hasErr)&&self.isDuplicateError;if(self.previewCache.count(true)){out=self.previewCache.out();if(includeProcessed){$div=$h.createElement('').insertAfter(self.$container);self.getFrames().each(function(){var $thumb=$(this);if((hasSuc&&$thumb.hasClass('file-preview-success'))||(hasErr&&$thumb.hasClass('file-preview-error'))){$div.append($thumb)}})}self._setPreviewContent(out.content);self._setInitThumbAttr();cap=self.initialCaption?self.initialCaption:out.caption;self._setCaption(cap);if(includeProcessed){$div.contents().appendTo(self.$preview);$div.remove()}}else{self._clearPreview();self._initCaption()}if(self.showPreview){self._initZoom();self._initSortable()}self.isDuplicateError=false},_clearDefaultPreview:function(){var self=this;self.$preview.find('.file-default-preview').remove()},_validateDefaultPreview:function(){var self=this;if(!self.showPreview||$h.isEmpty(self.defaultPreviewContent)){return}self._setPreviewContent('
    '+self.defaultPreviewContent+'
    ');self.$container.removeClass('file-input-new');self._initClickable()},_resetPreviewThumbs:function(isAjax){var self=this,out;if(isAjax){self._clearPreview();self.clearFileStack();return}if(self._hasInitialPreview()){out=self.previewCache.out();self._setPreviewContent(out.content);self._setInitThumbAttr();self._setCaption(out.caption);self._initPreviewActions()}else{self._clearPreview()}},_getLayoutTemplate:function(t){var self=this,template=self.layoutTemplates[t];if($h.isEmpty(self.customLayoutTags)){return template}return $h.replaceTags(template,self.customLayoutTags)},_getPreviewTemplate:function(t){var self=this,templates=self.previewTemplates,template=templates[t]||templates.other;if($h.isEmpty(self.customPreviewTags)){return template}return $h.replaceTags(template,self.customPreviewTags)},_getOutData:function(formdata,jqXHR,responseData,filesData){var self=this;jqXHR=jqXHR||{};responseData=responseData||{};filesData=filesData||self.fileManager.list();return{formdata:formdata,files:filesData,filenames:self.filenames,filescount:self.getFilesCount(),extra:self._getExtraData(),response:responseData,reader:self.reader,jqXHR:jqXHR}},_getMsgSelected:function(n,processing){var self=this,strFiles=n===1?self.fileSingle:self.filePlural;return n>0?self.msgSelected.replace('{n}',n).replace('{files}',strFiles):(processing?self.msgProcessing:self.msgNoFilesSelected)},_getFrame:function(id,skipWarning){var self=this,$frame=$h.getFrameElement(self.$preview,id);if(self.showPreview&&!skipWarning&&!$frame.length){self._log($h.logMessages.invalidThumb,{id:id})}return $frame},_getZoom:function(id,selector){var self=this,$frame=$h.getZoomElement(self.$preview,id,selector);if(self.showPreview&&!$frame.length){self._log($h.logMessages.invalidThumb,{id:id})}return $frame},_getThumbs:function(css){css=css||'';return this.getFrames(':not(.file-preview-initial)'+css)},_getThumbId:function(fileId){var self=this;return self.previewInitId+'-'+fileId},_getExtraData:function(fileId,index){var self=this,data=self.uploadExtraData;if(typeof self.uploadExtraData==='function'){data=self.uploadExtraData(fileId,index)}return data},_initXhr:function(xhrobj,fileId){var self=this,fm=self.fileManager,func=function(event){var pct=0,total=event.total,loaded=event.loaded||event.position,stats=fm.getUploadStats(fileId,loaded,total);if(event.lengthComputable&&!self.enableResumableUpload){pct=$h.round(loaded/total*100)}if(fileId){self._setFileUploadStats(fileId,pct,stats)}else{self._setProgress(pct,null,null,self._getStats(stats))}self._raise('fileajaxprogress',[stats])};if(xhrobj.upload){if(self.progressDelay){func=$h.debounce(func,self.progressDelay)}xhrobj.upload.addEventListener('progress',func,false)}return xhrobj},_initAjaxSettings:function(){var self=this;self._ajaxSettings=$.extend(true,{},self.ajaxSettings);self._ajaxDeleteSettings=$.extend(true,{},self.ajaxDeleteSettings)},_mergeAjaxCallback:function(funcName,srcFunc,type){var self=this,settings=self._ajaxSettings,flag=self.mergeAjaxCallbacks,targFunc;if(type==='delete'){settings=self._ajaxDeleteSettings;flag=self.mergeAjaxDeleteCallbacks}targFunc=settings[funcName];if(flag&&typeof targFunc==='function'){if(flag==='before'){settings[funcName]=function(){targFunc.apply(this,arguments);srcFunc.apply(this,arguments)}}else{settings[funcName]=function(){srcFunc.apply(this,arguments);targFunc.apply(this,arguments)}}}else{settings[funcName]=srcFunc}},_ajaxSubmit:function(fnBefore,fnSuccess,fnComplete,fnError,formdata,fileId,index,vUrl){var self=this,settings,defaults,data,tm=self.taskManager;if(!self._raise('filepreajax',[formdata,fileId,index])){return}formdata.append('initialPreview',JSON.stringify(self.initialPreview));formdata.append('initialPreviewConfig',JSON.stringify(self.initialPreviewConfig));formdata.append('initialPreviewThumbTags',JSON.stringify(self.initialPreviewThumbTags));self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore);self._mergeAjaxCallback('success',fnSuccess);self._mergeAjaxCallback('complete',fnComplete);self._mergeAjaxCallback('error',fnError);vUrl=vUrl||self.uploadUrlThumb||self.uploadUrl;if(typeof vUrl==='function'){vUrl=vUrl()}data=self._getExtraData(fileId,index)||{};if(typeof data==='object'){$.each(data,function(key,value){formdata.append(key,value)})}defaults={xhr:function(){var xhrobj=$.ajaxSettings.xhr();return self._initXhr(xhrobj,fileId)},url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:formdata,cache:false,processData:false,contentType:false};settings=$.extend(true,{},defaults,self._ajaxSettings);self.ajaxQueue.push(settings);tm.addTask(fileId+'-'+index,function(){var self=this.self,config,xhr;config=self.ajaxQueue.shift();xhr=$.ajax(config);self.ajaxRequests.push(xhr)}).runWithContext({self:self})},_mergeArray:function(prop,content){var self=this,arr1=$h.cleanArray(self[prop]),arr2=$h.cleanArray(content);self[prop]=arr1.concat(arr2)},_initUploadSuccess:function(out,$thumb,allFiles){var self=this,append,data,index,$div,content,config,tags,id,i;if(!self.showPreview||typeof out!=='object'||$.isEmptyObject(out)){self._resetCaption();return}if(out.initialPreview!==undefined&&out.initialPreview.length>0){self.hasInitData=true;content=out.initialPreview||[];config=out.initialPreviewConfig||[];tags=out.initialPreviewThumbTags||[];append=out.append===undefined||out.append;if(content.length>0&&!$h.isArray(content)){content=content.split(self.initialPreviewDelimiter)}if(content.length){self._mergeArray('initialPreview',content);self._mergeArray('initialPreviewConfig',config);self._mergeArray('initialPreviewThumbTags',tags)}if($thumb!==undefined){if(!allFiles){index=self.previewCache.add(content[0],config[0],tags[0],append);data=self.previewCache.get(index,false);$div=$h.createElement(data).hide().appendTo($thumb);$thumb.fadeOut('slow',function(){var $newThumb=$div.find('> .file-preview-frame');if($newThumb&&$newThumb.length){$newThumb.insertBefore($thumb).fadeIn('slow').css('display:inline-block')}self._initPreviewActions();self._clearFileInput();$thumb.remove();$div.remove();self._initSortable()})}else{id=$thumb.attr('id');i=self._getUploadCacheIndex(id);if(i!==null){self.uploadCache[i]={id:id,content:content[0],config:config[0]||[],tags:tags[0]||[],append:append}}}}else{self.previewCache.set(content,config,tags,append);self._initPreview();self._initPreviewActions()}}self._resetCaption()},_getUploadCacheIndex:function(id){var self=this,i,len=self.uploadCache.length,config;for(i=0;i0||!$.isEmptyObject(self.uploadExtraData),uploadFailed,$prog,fnBefore,errMsg,fnSuccess,fnComplete,fnError,updateUploadLog,op=self.ajaxOperations.uploadThumb,fileObj=fm.getFile(id),params={id:previewId,index:i,fileId:id},fileName=self.fileManager.getFileName(id,true),resolve=function(){if(deferrer&&deferrer.resolve){deferrer.resolve()}},reject=function(){if(deferrer&&deferrer.reject){deferrer.reject()}};if(self.enableResumableUpload){return}self.uploadInitiated=true;if(self.showPreview){$thumb=fm.getThumb(id);$prog=$thumb.find('.file-thumb-progress');$btnUpload=$thumb.find('.kv-file-upload');$btnDelete=$thumb.find('.kv-file-remove');$prog.show()}if(count===0||!hasPostData||(self.showPreview&&$btnUpload&&$btnUpload.hasClass('disabled'))||self._abort(params)){return}updateUploadLog=function(){if(!uploadFailed){fm.removeFile(id)}else{fm.errors.push(id)}fm.setProcessed(id);if(fm.isProcessed()){self.fileBatchCompleted=true;chkComplete()}};chkComplete=function(){var $initThumbs;if(!self.fileBatchCompleted){return}setTimeout(function(){var triggerReset=fm.count()===0,errCount=fm.errors.length;self._updateInitialPreview();self.unlock(triggerReset);if(triggerReset){self._clearFileInput()}$initThumbs=self.$preview.find('.file-preview-initial');if(self.uploadAsync&&$initThumbs.length){$h.addCss($initThumbs,$h.SORT_CSS);self._initSortable()}self._raise('filebatchuploadcomplete',[fm.stack,self._getExtraData()]);if(!self.retryErrorUploads||errCount===0){fm.clear()}self._setProgress(101);self.ajaxAborted=false;self.uploadInitiated=false},self.processDelay)};fnBefore=function(jqXHR){outData=self._getOutData(formdata,jqXHR);fm.initStats(id);self.fileBatchCompleted=false;if(!isBatch){self.ajaxAborted=false}if(self.showPreview){if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true)}if(!isBatch){self.lock()}if(fm.errors.indexOf(id)!==-1){delete fm.errors[id]}self._raise('filepreupload',[outData,previewId,i,self._getThumbFileId($thumb)]);$.extend(true,params,outData);if(self._abort(params)){jqXHR.abort();if(!isBatch){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading');$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled')}self._setProgressCancelled()}};fnSuccess=function(data,textStatus,jqXHR){var pid=self.showPreview&&$thumb.attr('id')?$thumb.attr('id'):previewId;outData=self._getOutData(formdata,jqXHR,data);$.extend(true,params,outData);setTimeout(function(){if($h.isEmpty(data)||$h.isEmpty(data.error)){if(self.showPreview){self._setThumbStatus($thumb,'Success');$btnUpload.hide();self._initUploadSuccess(data,$thumb,isBatch);self._setProgress(101,$prog)}self._raise('fileuploaded',[outData,pid,i,self._getThumbFileId($thumb)]);if(!isBatch){self.fileManager.remove($thumb)}else{updateUploadLog();resolve()}}else{uploadFailed=true;errMsg=self._parseError(op,jqXHR,self.msgUploadError,self.fileManager.getFileName(id));self._showFileError(errMsg,params);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide()}if(isBatch){updateUploadLog();resolve()}self._setProgress(101,self._getFrame(pid).find('.file-thumb-progress'),self.msgUploadError)}},self.processDelay)};fnComplete=function(){if(self.showPreview){$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled');$thumb.removeClass('file-uploading')}if(!isBatch){self.unlock(false);self._clearFileInput()}else{chkComplete()}self._initSuccessThumbs()};fnError=function(jqXHR,textStatus,errorThrown){errMsg=self._parseError(op,jqXHR,errorThrown,self.fileManager.getFileName(id));uploadFailed=true;setTimeout(function(){var $prog;if(isBatch){updateUploadLog();reject()}self.fileManager.setProgress(id,100);self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$btnUpload.hide()}$.extend(true,params,self._getOutData(formdata,jqXHR));self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op));$prog=self.showPreview&&$thumb?$thumb.find('.file-thumb-progress'):'';self._setProgress(101,$prog,self.msgUploadError);self._showFileError(errMsg,params)},self.processDelay)};self._setFileData(formdata,fileObj.file,fileName,id);self._setUploadData(formdata,{fileId:id});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata,id,i)},_setFileData:function(formdata,file,fileName,fileId){var self=this,preProcess=self.preProcessUpload;if(preProcess&&typeof preProcess==='function'){formdata.append(self.uploadFileAttr,preProcess(fileId,file))}else{formdata.append(self.uploadFileAttr,file,fileName)}},_checkBatchPreupload:function(outData,jqXHR){var self=this,out=self._raise('filebatchpreupload',[outData]);if(out){return true}self._abort(outData);if(jqXHR){jqXHR.abort()}self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if($thumb.hasClass('file-preview-loading')){self._setThumbStatus($thumb,'New');$thumb.removeClass('file-uploading')}$btnUpload.removeAttr('disabled');$btnDelete.removeAttr('disabled')});self._setProgressCancelled();return false},_uploadBatch:function(){var self=this,fm=self.fileManager,total=fm.total(),params={},fnBefore,fnSuccess,fnError,fnComplete,hasPostData=total>0||!$.isEmptyObject(self.uploadExtraData),errMsg,setAllUploaded,formdata=new FormData(),op=self.ajaxOperations.uploadBatch;if(total===0||!hasPostData||self._abort(params)){return}setAllUploaded=function(){self.fileManager.clear();self._clearFileInput()};fnBefore=function(jqXHR){self.lock();fm.initStats();var outData=self._getOutData(formdata,jqXHR);self.ajaxAborted=false;if(self.showPreview){self._getThumbs().each(function(){var $thumb=$(this),$btnUpload=$thumb.find('.kv-file-upload'),$btnDelete=$thumb.find('.kv-file-remove');if(!$thumb.hasClass('file-preview-success')){self._setThumbStatus($thumb,'Loading');$h.addCss($thumb,'file-uploading')}$btnUpload.attr('disabled',true);$btnDelete.attr('disabled',true)})}self._checkBatchPreupload(outData,jqXHR)};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data),key=0,$thumbs=self._getThumbs(':not(.file-preview-success)'),keys=$h.isEmpty(data)||$h.isEmpty(data.errorkeys)?[]:data.errorkeys;if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);setAllUploaded();if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);self._setThumbStatus($thumb,'Success');$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').hide().removeAttr('disabled')});self._initUploadSuccess(data)}else{self.reset()}self._setProgress(101)}else{if(self.showPreview){$thumbs.each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');$thumb.find('.kv-file-upload').removeAttr('disabled');$thumb.find('.kv-file-remove').removeAttr('disabled');if(keys.length===0||$.inArray(key,keys)!==-1){self._setPreviewError($thumb,true);if(!self.retryErrorUploads){$thumb.find('.kv-file-upload').hide();self.fileManager.remove($thumb)}}else{$thumb.find('.kv-file-upload').hide();self._setThumbStatus($thumb,'Success');self.fileManager.remove($thumb)}if(!$thumb.hasClass('file-preview-error')||self.retryErrorUploads){key++}});self._initUploadSuccess(data)}errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgUploadError)}};fnComplete=function(){self.unlock();self._initSuccessThumbs();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()])};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);self._showFileError(errMsg,outData,'filebatchuploaderror');self.uploadFileCount=total-1;if(!self.showPreview){return}self._getThumbs().each(function(){var $thumb=$(this);$thumb.removeClass('file-uploading');if(self._getThumbFile($thumb)){self._setPreviewError($thumb)}});self._getThumbs().removeClass('file-uploading');self._getThumbs(' .kv-file-upload').removeAttr('disabled');self._getThumbs(' .kv-file-delete').removeAttr('disabled');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op))};var ctr=0;$.each(self.fileManager.stack,function(key,data){if(!$h.isEmpty(data.file)){self._setFileData(formdata,data.file,(data.nameFmt||('untitled_'+ctr)),key)}ctr++});self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata)},_uploadExtraOnly:function(){var self=this,params={},fnBefore,fnSuccess,fnComplete,fnError,formdata=new FormData(),errMsg,op=self.ajaxOperations.uploadExtra;fnBefore=function(jqXHR){self.lock();var outData=self._getOutData(formdata,jqXHR);self._setProgress(50);params.data=outData;params.xhr=jqXHR;self._checkBatchPreupload(outData,jqXHR)};fnSuccess=function(data,textStatus,jqXHR){var outData=self._getOutData(formdata,jqXHR,data);if($h.isEmpty(data)||$h.isEmpty(data.error)){self._raise('filebatchuploadsuccess',[outData]);self._clearFileInput();self._initUploadSuccess(data);self._setProgress(101)}else{errMsg=self._parseError(op,jqXHR,self.msgUploadError);self._showFileError(errMsg,outData,'filebatchuploaderror')}};fnComplete=function(){self.unlock();self._clearFileInput();self._raise('filebatchuploadcomplete',[self.fileManager.stack,self._getExtraData()])};fnError=function(jqXHR,textStatus,errorThrown){var outData=self._getOutData(formdata,jqXHR);errMsg=self._parseError(op,jqXHR,errorThrown);params.data=outData;self._showFileError(errMsg,outData,'filebatchuploaderror');self._setProgress(101,self.$progress,self.msgAjaxProgressError.replace('{operation}',op))};self._ajaxSubmit(fnBefore,fnSuccess,fnComplete,fnError,formdata)},_deleteFileIndex:function($frame){var self=this,ind=$frame.attr('data-fileindex'),rev=self.reversePreviewOrder;if(ind.substring(0,5)===$h.INIT_FLAG){ind=parseInt(ind.replace($h.INIT_FLAG,''));self.initialPreview=$h.spliceArray(self.initialPreview,ind,rev);self.initialPreviewConfig=$h.spliceArray(self.initialPreviewConfig,ind,rev);self.initialPreviewThumbTags=$h.spliceArray(self.initialPreviewThumbTags,ind,rev);self.getFrames().each(function(){var $nFrame=$(this),nInd=$nFrame.attr('data-fileindex');if(nInd.substring(0,5)===$h.INIT_FLAG){nInd=parseInt(nInd.replace($h.INIT_FLAG,''));if(nInd>ind){nInd--;$nFrame.attr('data-fileindex',$h.INIT_FLAG+nInd)}}})}},_resetCaption:function(){var self=this;setTimeout(function(){var cap='',n,chk=self.previewCache.count(true),len=self.fileManager.count(),file,incomplete=':not(.file-preview-success):not(.file-preview-error)',cfg,hasThumb=self.showPreview&&self.getFrames(incomplete).length;if(len===0&&chk===0&&!hasThumb){self.reset()}else{n=chk+len;if(n>1){cap=self._getMsgSelected(n)}else{if(len===0){cfg=self.initialPreviewConfig[0];cap='';if(cfg){cap=cfg.caption||cfg.filename||''}if(!cap){cap=self._getMsgSelected(n)}}else{file=self.fileManager.getFirstFile();cap=file?file.nameFmt:'_'}}self._setCaption(cap)}},self.processDelay)},_handleRotation:function($el,$content,angle){var self=this,css,newCss,addCss='',scale=1,elContent=$content[0],quadrant,transform,h,w,wNew,$parent=$content.parent(),hParent,wParent,$body=$('body'),bodyExists=!!$body.length;if(bodyExists){$body.addClass('kv-overflow-hidden')}if(!$content.length||$el.hasClass('hide-rotate')){if(bodyExists){$body.removeClass('kv-overflow-hidden')}return}transform=$content.css('transform');if(transform){$content.css('transform','none')}if(transform){$content.css('transform',transform)}angle=angle||0;quadrant=angle%360;css='rotate('+angle+'deg)';newCss='rotate('+quadrant+'deg)';addCss='';if(quadrant===90||quadrant===270){w=elContent.naturalWidth||$content.outerWidth()||0;h=elContent.naturalHeight||$content.outerHeight()||0;scale=w>h&&w!=0?(h/w).toFixed(2):1;if($parent.length){hParent=$parent.height();wParent=$parent.width();wNew=Math.min(w,wParent);if(hParent>scale*wNew){scale=wNew>hParent&&wNew!=0?(hParent/wNew).toFixed(2):1}}if(scale!==1){addCss=' scale('+scale+')'}}$content.addClass('rotate-animate').css('transform',css+addCss);setTimeout(function(){$content.removeClass('rotate-animate').css('transform',newCss+addCss);if(bodyExists){$body.removeClass('kv-overflow-hidden')}$el.data('angle',quadrant)},self.fadeDelay)},_initRotateButton:function(){var self=this;self.getFrames('.rotatable .kv-file-rotate').each(function(){var $el=$(this),$frame=$el.closest($h.FRAMES),$content=$frame.find('.kv-file-content > :first-child');self._handler($el,'click',function(){var angle=($frame.data('angle')||0)+90;self._handleRotation($frame,$content,angle)})})},_initRotateZoom:function($frame,$content){var self=this,$modal=self.$modal,$rotate=$modal.find('.btn-kv-rotate'),angle=$frame.data('angle');$modal.data('angle',angle);if($rotate.length){$rotate.off('click');if($modal.hasClass('rotatable')){$rotate.on('click',function(){angle=($modal.data('angle')||0)+90;$modal.data('angle',angle);self._handleRotation($modal,$modal.find('.file-zoom-detail'),angle);self._handleRotation($frame,$content,angle);if($frame.hasClass('hide-rotate')){$frame.data('angle',angle)}})}}},_initFileActions:function(){var self=this;if(!self.showPreview){return}self._initZoomButton();self._initRotateButton();self.getFrames(' .kv-file-remove').each(function(){var $el=$(this),$frame=$el.closest($h.FRAMES),hasError,id=$frame.attr('id'),ind=$frame.attr('data-fileindex'),status,fm=self.fileManager;self._handler($el,'click',function(){status=self._raise('filepreremove',[id,ind]);if(status===false||!self._validateMinCount()){return false}hasError=$frame.hasClass('file-preview-error');$h.cleanMemory($frame);$frame.fadeOut('slow',function(){self.fileManager.remove($frame);self._clearObjects($frame);$frame.remove();if(id&&hasError){self.$errorContainer.find('li[data-thumb-id="'+id+'"]').fadeOut('fast',function(){$(this).remove();if(!self._errorsExist()){self._resetErrors()}})}self._clearFileInput();self._resetCaption();self._raise('fileremoved',[id,ind])})})});self.getFrames(' .kv-file-upload').each(function(){var $el=$(this);self._handler($el,'click',function(){var $frame=$el.closest($h.FRAMES),fileId=self._getThumbFileId($frame);self._hideProgress();if($frame.hasClass('file-preview-error')&&!self.retryErrorUploads){return}self._uploadSingle(self.fileManager.getIndex(fileId),fileId,false)})})},_initPreviewActions:function(){var self=this,$preview=self.$preview,deleteExtraData=self.deleteExtraData||{},btnRemove=$h.FRAMES+' .kv-file-remove',settings=self.fileActionSettings,origClass=settings.removeClass,errClass=settings.removeErrorClass,resetProgress=function(){var hasFiles=self.isAjaxUpload?self.previewCache.count(true):self._inputFileCount();if(!self.getFrames().length&&!hasFiles){self._setCaption('');self.reset();self.initialCaption=''}else{self._resetCaption()}};self._initZoomButton();self._initRotateButton();$preview.find(btnRemove).each(function(){var $el=$(this),vUrl=$el.data('url')||self.deleteUrl,vKey=$el.data('key'),errMsg,fnBefore,fnSuccess,fnError,op=self.ajaxOperations.deleteThumb;if($h.isEmpty(vUrl)||vKey===undefined){return}if(typeof vUrl==='function'){vUrl=vUrl()}var $frame=$el.closest($h.FRAMES),cache=self.previewCache.data,settings,params,config,fileName,extraData,index=$frame.attr('data-fileindex');index=parseInt(index.replace($h.INIT_FLAG,''));config=$h.isEmpty(cache.config)&&$h.isEmpty(cache.config[index])?null:cache.config[index];extraData=$h.isEmpty(config)||$h.isEmpty(config.extra)?deleteExtraData:config.extra;fileName=config&&(config.filename||config.caption)||'';if(typeof extraData==='function'){extraData=extraData()}params={id:$el.attr('id'),key:vKey,extra:extraData};fnBefore=function(jqXHR){self.ajaxAborted=false;self._raise('filepredelete',[vKey,jqXHR,extraData]);if(self._abort()){jqXHR.abort()}else{$el.removeClass(errClass);$h.addCss($frame,'file-uploading');$h.addCss($el,'disabled '+origClass)}};fnSuccess=function(data,textStatus,jqXHR){var n,cap;if(!$h.isEmpty(data)&&!$h.isEmpty(data.error)){params.jqXHR=jqXHR;params.response=data;errMsg=self._parseError(op,jqXHR,self.msgDeleteError,fileName);self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress();return}$frame.removeClass('file-uploading').addClass('file-deleted');$frame.fadeOut('slow',function(){index=parseInt(($frame.attr('data-fileindex')).replace($h.INIT_FLAG,''));self.previewCache.unset(index);self._deleteFileIndex($frame);n=self.previewCache.count(true);cap=n>0?self._getMsgSelected(n):'';self._setCaption(cap);self._raise('filedeleted',[vKey,jqXHR,extraData]);self._clearObjects($frame);$frame.remove();resetProgress()})};fnError=function(jqXHR,textStatus,errorThrown){var errMsg=self._parseError(op,jqXHR,errorThrown,fileName);params.jqXHR=jqXHR;params.response={};self._showFileError(errMsg,params,'filedeleteerror');$frame.removeClass('file-uploading');$el.removeClass('disabled '+origClass).addClass(errClass);resetProgress()};self._initAjaxSettings();self._mergeAjaxCallback('beforeSend',fnBefore,'delete');self._mergeAjaxCallback('success',fnSuccess,'delete');self._mergeAjaxCallback('error',fnError,'delete');settings=$.extend(true,{},{url:self._encodeURI(vUrl),type:'POST',dataType:'json',data:$.extend(true,{},{key:vKey},extraData)},self._ajaxDeleteSettings);self._handler($el,'click',function(){if(!self._validateMinCount()){return false}self.ajaxAborted=false;self._raise('filebeforedelete',[vKey,extraData]);if(self.ajaxAborted instanceof Promise){self.ajaxAborted.then(function(result){if(!result){$.ajax(settings)}})}else{if(!self.ajaxAborted){$.ajax(settings)}}})})},_hideFileIcon:function(){var self=this;if(self.overwriteInitial){self.$captionContainer.removeClass('icon-visible')}},_showFileIcon:function(){var self=this;$h.addCss(self.$captionContainer,'icon-visible')},_getSize:function(bytes,skipTemplate,sizeUnits){var self=this,size=parseFloat(bytes),i=0,factor=self.bytesToKB,func=self.fileSizeGetter,out,sizeHuman=size,newSize;if(!$.isNumeric(bytes)||!$.isNumeric(size)){return''}if(typeof func==='function'){out=func(size)}else{if(!sizeUnits){sizeUnits=self.sizeUnits}if(size>0){while(sizeHuman>=factor){sizeHuman/=factor;++i}if(!sizeUnits[i]){sizeHuman=size;i=0}}newSize=sizeHuman.toFixed(2);if(newSize==sizeHuman){newSize=sizeHuman}out=newSize+' '+sizeUnits[i]}return skipTemplate?out:self._getLayoutTemplate('size').replace('{sizeText}',out)},_getFileType:function(ftype){var self=this;return self.mimeTypeAliases[ftype]||ftype},_generatePreviewTemplate:function(cat,data,fname,ftype,previewId,fileId,isError,size,fnameUpdated,frameClass,foot,ind,templ,attrs,zoomData){var self=this,caption=self.slug(fname),prevContent,zoomContent='',styleAttribs='',filename=fnameUpdated||fname,isIconic,ext=filename.split('.').pop().toLowerCase(),screenW=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,config,title=caption,alt=caption,typeCss='type-default',getContent,addFrameCss,footer=foot||self._renderFileFooter(cat,caption,size,'auto',isError),isRotatable,alwaysPreview=$.inArray(ext,self.alwaysPreviewFileExtensions)!==-1,forcePrevIcon=self.preferIconicPreview&&!alwaysPreview,forceZoomIcon=self.preferIconicZoomPreview&&!alwaysPreview,newCat=forcePrevIcon?'other':cat;config=screenW<400?(self.previewSettingsSmall[newCat]||self.defaults.previewSettingsSmall[newCat]):(self.previewSettings[newCat]||self.defaults.previewSettings[newCat]);if(config){$.each(config,function(key,val){styleAttribs+=key+':'+val+';'})}getContent=function(vCat,vData,zoom,frameCss,vZoomData){var id=zoom?'zoom-'+previewId:previewId,tmplt=self._getPreviewTemplate(vCat),css=(frameClass||'')+' '+frameCss,tokens;if(self.frameClass){css=self.frameClass+' '+css}if(zoom){css=css.replace(' '+$h.SORT_CSS,'')}tmplt=self._parseFilePreviewIcon(tmplt,fname);if(cat==='object'&&!ftype){$.each(self.defaults.fileTypeSettings,function(key,func){if(key==='object'||key==='other'){return}if(func(fname,ftype)){typeCss='type-'+key}})}if(!$h.isEmpty(attrs)){if(attrs.title!==undefined&&attrs.title!==null){title=attrs.title}if(attrs.alt!==undefined&&attrs.alt!==null){alt=title=attrs.alt}}tokens={'previewId':id,'caption':caption,'title':title,'alt':alt,'frameClass':css,'type':self._getFileType(ftype),'fileindex':ind,'fileid':fileId||'','filename':filename,'typeCss':typeCss,'footer':footer,'data':vData,'template':templ||cat,'style':styleAttribs?'style="'+styleAttribs+'"':'','zoomData':vZoomData?encodeURIComponent(vZoomData):''};if(zoom){tokens.zoomCache='';tokens.zoomData='{zoomData}'}return tmplt.setTokens(tokens)};ind=ind||previewId.slice(previewId.lastIndexOf('-')+1);isRotatable=self.fileActionSettings.showRotate&&$.inArray(ext,self.rotatableFileExtensions)!==-1;if(self.fileActionSettings.showZoom){addFrameCss='kv-zoom-thumb';if(isRotatable){addFrameCss+=' rotatable'+(forceZoomIcon?' hide-rotate':'')}zoomContent=getContent((forceZoomIcon?'other':cat),data,true,addFrameCss,zoomData)}zoomContent='\n'+self._getLayoutTemplate('zoomCache').replace('{zoomContent}',zoomContent);if(typeof self.sanitizeZoomCache==='function'){zoomContent=self.sanitizeZoomCache(zoomContent)}addFrameCss='kv-preview-thumb';if(isRotatable){isIconic=forcePrevIcon||self.hideThumbnailContent||!!self.previewFileIconSettings[ext];addFrameCss+=' rotatable'+(isIconic?' hide-rotate':'')}prevContent=getContent((forcePrevIcon?'other':cat),data,false,addFrameCss,zoomData);return prevContent.setTokens({zoomCache:zoomContent})},_addToPreview:function($preview,content){var self=this,$el;content=$h.cspBuffer.stash(content);$el=self.reversePreviewOrder?$preview.prepend(content):$preview.append(content);$h.cspBuffer.apply($preview);return $el},_previewDefault:function(file,isDisabled){var self=this,$preview=self.$preview;if(!self.showPreview){return}var fname=$h.getFileName(file),ftype=file?file.type:'',content,size=file.size||0,caption=self._getFileName(file,''),isError=isDisabled===true&&!self.isAjaxUpload,data=$h.createObjectURL(file),fileId=self.fileManager.getId(file),previewId=self._getThumbId(fileId);self._clearDefaultPreview();content=self._generatePreviewTemplate('other',data,fname,ftype,previewId,fileId,isError,size);self._addToPreview($preview,content);self._setThumbAttr(previewId,caption,size);if(isDisabled===true&&self.isAjaxUpload){self._setThumbStatus(self._getFrame(previewId),'Error')}},_previewFile:function(i,file,theFile,data,fileInfo){if(!this.showPreview){return}var self=this,fname=$h.getFileName(file),ftype=fileInfo.type,content,caption=fileInfo.name,cat=self._parseFileType(ftype,fname),$preview=self.$preview,fsize=file.size||0,iData=cat==='image'?theFile.target.result:data,fm=self.fileManager,fileId=fm.getId(file),previewId=self._getThumbId(fileId);content=self._generatePreviewTemplate(cat,iData,fname,ftype,previewId,fileId,false,fsize,fileInfo.filename);self._clearDefaultPreview();self._addToPreview($preview,content);var $thumb=self._getFrame(previewId);self._validateImageOrientation($thumb.find('img'),file,previewId,fileId,caption,ftype,fsize,iData);self._setThumbAttr(previewId,caption,fsize);self._initSortable()},_setThumbAttr:function(id,caption,size,description){var self=this,$frame=self._getFrame(id);if($frame.length){size=size&&size>0?self._getSize(size):'';$frame.data({'caption':caption,'size':size,'description':description||''})}},_setInitThumbAttr:function(){var self=this,data=self.previewCache.data,len=self.previewCache.count(true),config,caption,size,description,previewId;if(len===0){return}for(var i=0;i&"']/g,'_')},_updateFileDetails:function(numFiles){var self=this,$el=self.$element,label,n,log,nFiles,file,name=($h.isIE(9)&&$h.findFileName($el.val()))||($el[0].files[0]&&$el[0].files[0].name);if(!name&&self.fileManager.count()>0){file=self.fileManager.getFirstFile();label=file.nameFmt}else{label=name?self.slug(name):'_'}n=self.isAjaxUpload?self.fileManager.count():numFiles;nFiles=self.previewCache.count(true)+n;log=n===1?label:self._getMsgSelected(nFiles,!self.isAjaxUpload&&!self.isError);if(self.isError){self.$previewContainer.removeClass('file-thumb-loading');self._initCapStatus();self.$previewStatus.html('');self.$captionContainer.removeClass('icon-visible')}else{self._showFileIcon()}self._setCaption(log,self.isError);self.$container.removeClass('file-input-new file-input-ajax-new');self._raise('fileselect',[numFiles,label]);if(self.previewCache.count(true)){self._initPreviewActions()}},_setThumbStatus:function($thumb,status){var self=this;if(!self.showPreview){return}var icon='indicator'+status,msg=icon+'Title',css='file-preview-'+status.toLowerCase(),$indicator=$thumb.find('.file-upload-indicator'),config=self.fileActionSettings;$thumb.removeClass('file-preview-success file-preview-error file-preview-paused file-preview-loading');if(status==='Success'){$thumb.find('.file-drag-handle').remove()}$h.setHtml($indicator,config[icon]);$indicator.attr('title',config[msg]);$thumb.addClass(css);if(status==='Error'&&!self.retryErrorUploads){$thumb.find('.kv-file-upload').attr('disabled',true)}},_setProgressCancelled:function(){var self=this;self._setProgress(101,self.$progress,self.msgCancelled)},_setProgress:function(p,$el,error,stats){var self=this;$el=$el||self.$progress;if(!$el.length){return}var pct=Math.min(p,100),out,pctLimit=self.progressUploadThreshold,t=p<=100?self.progressTemplate:self.progressCompleteTemplate,template=pct<100?self.progressTemplate:(error?(self.paused?self.progressPauseTemplate:self.progressErrorTemplate):t);if(p>=100){stats=''}if(!$h.isEmpty(template)){if(pctLimit&&pct>pctLimit&&p<=100){out=template.setTokens({'percent':pctLimit,'status':self.msgUploadThreshold})}else{out=template.setTokens({'percent':pct,'status':(p>100?self.msgUploadEnd:pct+'%')})}stats=stats||'';out=out.setTokens({stats:stats});$h.setHtml($el,out);if(error){$h.setHtml($el.find('[role="progressbar"]'),error)}}},_hasFiles:function(){var el=this.$element[0];return!!(el&&el.files&&el.files.length)},_setFileDropZoneTitle:function(){var self=this,$zone=self.$container.find('.file-drop-zone'),title=self.dropZoneTitle,strFiles;if(self.isClickable){strFiles=$h.isEmpty(self.$element.attr('multiple'))?self.fileSingle:self.filePlural;title+=self.dropZoneClickTitle.replace('{files}',strFiles)}$zone.find('.'+self.dropZoneTitleClass).remove();if(!self.showPreview||$zone.length===0||self.fileManager.count()>0||!self.dropZoneEnabled||self.previewCache.count()>0||(!self.isAjaxUpload&&self._hasFiles())){return}if($zone.find($h.FRAMES).length===0&&$h.isEmpty(self.defaultPreviewContent)){$zone.prepend('
    '+title+'
    ')}self.$container.removeClass('file-input-new');$h.addCss(self.$container,'file-input-ajax-new')},_getStats:function(stats){var self=this,pendingTime,t;if(!self.showUploadStats||!stats||!stats.bitrate){return''}t=self._getLayoutTemplate('stats');pendingTime=(!stats.elapsed||!stats.bps)?self.msgCalculatingTime:self.msgPendingTime.setTokens({time:$h.getElapsed(Math.ceil(stats.pendingBytes/stats.bps))});return t.setTokens({uploadSpeed:stats.bitrate,pendingTime:pendingTime})},_setResumableProgress:function(pct,stats,$thumb){var self=this,rm=self.resumableManager,obj=$thumb?rm:self,$prog=$thumb?$thumb.find('.file-thumb-progress'):null;if(obj.lastProgress===0){obj.lastProgress=pct}if(pct0&&self._getFileCount(len-1)=limit:dim<=limit){return true}msg=self['msgImage'+type+size]||'Image "{name}" has a size validation error (limit "{size}").';self._showFileError(msg.setTokens({'name':filename,'size':limit,'dimension':dim}),params);self._setPreviewError($thumb);self.fileManager.remove($thumb);self._clearFileInput();return false},_getExifObj:function(data){var self=this,exifObj,error=$h.logMessages.exifWarning;if(data.slice(0,23)!=='data:image/jpeg;base64,'&&data.slice(0,22)!=='data:image/jpg;base64,'){exifObj=null;return}try{exifObj=window.piexif?window.piexif.load(data):null}catch(err){exifObj=null;error=err&&err.message||''}if(!exifObj&&self.showExifErrorLog){self._log($h.logMessages.badExifParser,{details:error})}return exifObj},setImageOrientation:function($img,$zoomImg,value,$thumb){var self=this,invalidImg=!$img||!$img.length,invalidZoomImg=!$zoomImg||!$zoomImg.length,$mark,isHidden=false,$div,zoomOnly=invalidImg&&$thumb&&$thumb.attr('data-template')==='image',ev;if(invalidImg&&invalidZoomImg){return}ev='load.fileinputimageorient';if(zoomOnly){$img=$zoomImg;$zoomImg=null;$img.css(self.previewSettings.image);$div=$(document.createElement('div')).appendTo($thumb.find('.kv-file-content'));$mark=$(document.createElement('span')).insertBefore($img);$img.css('visibility','hidden').removeClass('file-zoom-detail').appendTo($div)}else{isHidden=!$img.is(':visible')}$img.off(ev).on(ev,function(){if(isHidden){self.$preview.removeClass('hide-content');$thumb.find('.kv-file-content').css('visibility','hidden')}var img=$img[0],zoomImg=$zoomImg&&$zoomImg.length?$zoomImg[0]:null,h=img.offsetHeight,w=img.offsetWidth,r=$h.getRotation(value);if(isHidden){$thumb.find('.kv-file-content').css('visibility','visible');self.$preview.addClass('hide-content')}$img.data('orientation',value);if(zoomImg){$zoomImg.data('orientation',value)}if(value<5){$h.setTransform(img,r);$h.setTransform(zoomImg,r);return}var offsetAngle=Math.atan(w/h),origFactor=Math.sqrt(Math.pow(h,2)+Math.pow(w,2)),scale=!origFactor?1:(h/Math.cos(Math.PI/2+offsetAngle))/origFactor,s=' scale('+Math.abs(scale)+')';$h.setTransform(img,r+s);$h.setTransform(zoomImg,r+s);if(zoomOnly){$img.css('visibility','visible').insertAfter($mark).addClass('file-zoom-detail');$mark.remove();$div.remove()}})},_validateImageOrientation:function($img,file,previewId,fileId,caption,ftype,fsize,iData){var self=this,exifObj=null,value,autoOrientImage=self.autoOrientImage,selector;exifObj=self._getExifObj(iData);if(self.canOrientImage){$img.css('image-orientation',(autoOrientImage?'from-image':'none'));self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);return}selector=$h.getZoomSelector(previewId,' img');value=exifObj?exifObj['0th'][piexif.ImageIFD.Orientation]:null;if(!value){self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj);return}self.setImageOrientation($img,$(selector),value,self._getFrame(previewId));self._raise('fileimageoriented',{'$img':$img,'file':file});self._validateImage(previewId,fileId,caption,ftype,fsize,iData,exifObj)},_validateImage:function(previewId,fileId,fname,ftype,fsize,iData,exifObj){var self=this,$preview=self.$preview,params,w1,w2,$thumb=self._getFrame(previewId),i=$thumb.attr('data-fileindex'),$img=$thumb.find('img');fname=fname||'Untitled';$img.one('load',function(){if($img.data('validated')){return}$img.data('validated',true);w1=$thumb.width();w2=$preview.width();if(w1>w2){$img.css('width','100%')}params={ind:i,id:previewId,fileId:fileId};setTimeout(function(){var isValidWidth,isValidHeight;isValidWidth=self._isValidSize('Small','Width',$img,$thumb,fname,params);isValidHeight=self._isValidSize('Small','Height',$img,$thumb,fname,params);if(!self.resizeImage){isValidWidth=isValidWidth&&self._isValidSize('Large','Width',$img,$thumb,fname,params);isValidHeight=isValidHeight&&self._isValidSize('Large','Height',$img,$thumb,fname,params)}self._raise('fileimageloaded',[previewId]);$thumb.data('exif',exifObj);if(isValidWidth&&isValidHeight){self.fileManager.addImage(fileId,{ind:i,img:$img,thumb:$thumb,pid:previewId,typ:ftype,siz:fsize,validated:false,imgData:iData,exifObj:exifObj});self._validateAllImages()}},self.processDelay)}).one('error',function(){self._raise('fileimageloaderror',[previewId])})},_validateAllImages:function(){var self=this,counter={val:0},numImgs=self.fileManager.getImageCount(),fsize,minSize=self.resizeIfSizeMoreThan;if(numImgs!==self.fileManager.totalImages){return}self._raise('fileimagesloaded');if(!self.resizeImage){return}$.each(self.fileManager.loadedImages,function(id,config){if(!config.validated){fsize=config.siz;if(fsize&&fsize>minSize*self.bytesToKB){self._getResizedImage(id,config,counter,numImgs)}config.validated=true}})},_getResizedImage:function(id,config,counter,numImgs){var self=this,img=$(config.img)[0],width=img.naturalWidth,height=img.naturalHeight,blob,ratio=1,maxWidth=self.maxImageWidth||width,maxHeight=self.maxImageHeight||height,isValidImage=!!(width&&height),chkWidth,chkHeight,canvas=self.imageCanvas,dataURI,context=self.imageCanvasContext,type=config.typ,pid=config.pid,ind=config.ind,$thumb=config.thumb,throwError,msg,exifObj=config.exifObj,exifStr,file,params,evParams;throwError=function(msg,params,ev){if(self.isAjaxUpload){self._showFileError(msg,params,ev);}else{self._showError(msg,params,ev)}self._setPreviewError($thumb)};file=self.fileManager.getFile(id);params={id:pid,'index':ind,fileId:id};evParams=[id,pid,ind];if(!file||!isValidImage||(width<=maxWidth&&height<=maxHeight)){if(isValidImage&&file){self._raise('fileimageresized',evParams)}counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized')}if(!isValidImage){throwError(self.msgImageResizeError,params,'fileimageresizeerror');return}}type=type||self.resizeDefaultImageType;chkWidth=width>maxWidth;chkHeight=height>maxHeight;if(self.resizePreference==='width'){ratio=chkWidth?maxWidth/width:(chkHeight?maxHeight/height:1)}else{ratio=chkHeight?maxHeight/height:(chkWidth?maxWidth/width:1)}self._resetCanvas();width*=ratio;height*=ratio;canvas.width=width;canvas.height=height;try{context.drawImage(img,0,0,width,height);dataURI=canvas.toDataURL(type,self.resizeQuality);if(exifObj){exifStr=window.piexif.dump(exifObj);dataURI=window.piexif.insert(exifStr,dataURI)}blob=$h.dataURI2Blob(dataURI);self.fileManager.setFile(id,blob);self._raise('fileimageresized',evParams);counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined])}if(!(blob instanceof Blob)){throwError(self.msgImageResizeError,params,'fileimageresizeerror');}}catch(err){counter.val++;if(counter.val===numImgs){self._raise('fileimagesresized',[undefined,undefined])}msg=self.msgImageResizeException.replace('{errors}',err.message);throwError(msg,params,'fileimageresizeexception');}},_showProgress:function(){var self=this;if(self.$progress&&self.$progress.length){self.$progress.show()}},_hideProgress:function(){var self=this;if(self.$progress&&self.$progress.length){self.$progress.hide()}},_initBrowse:function($container){var self=this,$el=self.$element;if(self.showBrowse){self.$btnFile=$container.find('.btn-file').append($el)}else{$el.appendTo($container).attr('tabindex',-1);$h.addCss($el,'file-no-browse')}},_initClickable:function(){var self=this,$zone,$tmpZone;if(!self.isClickable){return}$zone=self.$dropZone;if(!self.isAjaxUpload){$tmpZone=self.$preview.find('.file-default-preview');if($tmpZone.length){$zone=$tmpZone}}$h.addCss($zone,'clickable');$zone.attr('tabindex',-1);self._handler($zone,'click',function(e){var $tar=$(e.target);if(!self.$errorContainer.is(':visible')&&(!$tar.parents('.file-preview-thumbnails').length||$tar.parents('.file-default-preview').length)){self.$element.data('zoneClicked',true).trigger('click');$zone.blur()}})},_initCaption:function(){var self=this,cap=self.initialCaption||'';if(self.overwriteInitial||$h.isEmpty(cap)){self.$caption.val('');return false}self._setCaption(cap);return true},_setCaption:function(content,isError){var self=this,title,out,icon,n,cap,file;if(!self.$caption.length){return}self.$captionContainer.removeClass('icon-visible');if(isError){title=$('
    '+self.msgValidationError+'
    ').text();n=self.fileManager.count();if(n){file=self.fileManager.getFirstFile();cap=n===1&&file?file.nameFmt:self._getMsgSelected(n)}else{cap=self._getMsgSelected(self.msgNo)}out=$h.isEmpty(content)?cap:content;icon=''+self.msgValidationErrorIcon+''}else{if($h.isEmpty(content)){self.$caption.attr('title','');return}title=$('
    '+content+'
    ').text();out=title;icon=self._getLayoutTemplate('fileIcon')}self.$captionContainer.addClass('icon-visible');self.$caption.attr('title',title).val(out);$h.setHtml(self.$captionIcon,icon)},_createContainer:function(){var self=this,attribs={'class':'file-input file-input-new'+(self.rtl?' kv-rtl':'')},$container=$h.createElement($h.cspBuffer.stash(self._renderMain()));$h.cspBuffer.apply($container);$container.insertBefore(self.$element).attr(attribs);self._initBrowse($container);if(self.theme){$container.addClass('theme-'+self.theme)}return $container},_refreshContainer:function(){var self=this,$container=self.$container,$el=self.$element;$el.insertAfter($container);$h.setHtml($container,self._renderMain());self._initBrowse($container);self._validateDisabled()},_validateDisabled:function(){var self=this;self.$caption.attr({readonly:self.isDisabled})},_setTabIndex:function(type,html){var self=this,index=self.tabIndexConfig[type];return html.setTokens({tabIndexConfig:index===undefined||index===null?'':'tabindex="'+index+'"'})},_renderMain:function(){var self=this,dropCss=self.dropZoneEnabled?' file-drop-zone':'file-drop-disabled',close=!self.showClose?'':self._getLayoutTemplate('close'),preview=!self.showPreview?'':self._getLayoutTemplate('preview').setTokens({'class':self.previewClass,'dropClass':dropCss}),css=self.isDisabled?self.captionClass+' file-caption-disabled':self.captionClass,caption=self.captionTemplate.setTokens({'class':css+' kv-fileinput-caption'});caption=self._setTabIndex('caption',caption);return self.mainTemplate.setTokens({'class':self.mainClass+(!self.showBrowse&&self.showCaption?' no-browse':''),'inputGroupClass':self.inputGroupClass,'preview':preview,'close':close,'caption':caption,'upload':self._renderButton('upload'),'remove':self._renderButton('remove'),'cancel':self._renderButton('cancel'),'pause':self._renderButton('pause'),'browse':self._renderButton('browse')})},_renderButton:function(type){var self=this,tmplt=self._getLayoutTemplate('btnDefault'),css=self[type+'Class'],title=self[type+'Title'],icon=self[type+'Icon'],label=self[type+'Label'],status=self.isDisabled?' disabled':'',btnType='button';switch(type){case'remove':if(!self.showRemove){return''}break;case'cancel':if(!self.showCancel){return''}css+=' kv-hidden';break;case'pause':if(!self.showPause){return''}css+=' kv-hidden';break;case'upload':if(!self.showUpload){return''}if(self.isAjaxUpload&&!self.isDisabled){tmplt=self._getLayoutTemplate('btnLink').replace('{href}',self.uploadUrl)}else{btnType='submit'}break;case'browse':if(!self.showBrowse){return''}tmplt=self._getLayoutTemplate('btnBrowse');break;default:return''}tmplt=self._setTabIndex(type,tmplt);css+=type==='browse'?' btn-file':' fileinput-'+type+' fileinput-'+type+'-button';if(!$h.isEmpty(label)){label=' '+label+''}return tmplt.setTokens({'type':btnType,'css':css,'title':title,'status':status,'icon':icon,'label':label})},_renderThumbProgress:function(){var self=this;return'
    '+self.progressInfoTemplate.setTokens({percent:101,status:self.msgUploadBegin,stats:''})+'
    '},_renderFileFooter:function(cat,caption,size,width,isError){var self=this,config=self.fileActionSettings,rem=config.showRemove,drg=config.showDrag,upl=config.showUpload,rot=config.showRotate,zoom=config.showZoom,out,params,template=self._getLayoutTemplate('footer'),tInd=self._getLayoutTemplate('indicator'),ind=isError?config.indicatorError:config.indicatorNew,title=isError?config.indicatorErrorTitle:config.indicatorNewTitle,indicator=tInd.setTokens({'indicator':ind,'indicatorTitle':title});size=self._getSize(size);params={type:cat,caption:caption,size:size,width:width,progress:'',indicator:indicator};if(self.isAjaxUpload){params.progress=self._renderThumbProgress();params.actions=self._renderFileActions(params,upl,false,rem,rot,zoom,drg,false,false,false)}else{params.actions=self._renderFileActions(params,false,false,false,false,zoom,drg,false,false,false)}out=template.setTokens(params);out=$h.replaceTags(out,self.previewThumbTags);return out},_renderFileActions:function(cfg,showUpl,showDwn,showDel,showRot,showZoom,showDrag,disabled,url,key,isInit,dUrl,dFile){var self=this;if(!cfg.type&&isInit){cfg.type='image'}if(self.enableResumableUpload){showUpl=false}else{if(typeof showUpl==='function'){showUpl=showUpl(cfg)}}if(typeof showDwn==='function'){showDwn=showDwn(cfg)}if(typeof showDel==='function'){showDel=showDel(cfg)}if(typeof showZoom==='function'){showZoom=showZoom(cfg)}if(typeof showDrag==='function'){showDrag=showDrag(cfg)}if(typeof showRot==='function'){showRot=showRot(cfg)}if(!showUpl&&!showDwn&&!showDel&&!showRot&&!showZoom&&!showDrag){return''}var vUrl=url===false?'':' data-url="'+url+'"',btnZoom='',btnDrag='',btnRotate='',css,vKey=key===false?'':' data-key="'+key+'"',btnDelete='',btnUpload='',btnDownload='',template=self._getLayoutTemplate('actions'),config=self.fileActionSettings,otherButtons=self.otherActionButtons.setTokens({'dataKey':vKey,'key':key}),removeClass=disabled?config.removeClass+' disabled':config.removeClass;if(showDel){btnDelete=self._getLayoutTemplate('actionDelete').setTokens({'removeClass':removeClass,'removeIcon':config.removeIcon,'removeTitle':config.removeTitle,'dataUrl':vUrl,'dataKey':vKey,'key':key})}if(showRot){btnRotate=self._getLayoutTemplate('actionRotate').setTokens({'rotateClass':config.rotateClass,'rotateIcon':config.rotateIcon,'rotateTitle':config.rotateTitle})}if(showUpl){btnUpload=self._getLayoutTemplate('actionUpload').setTokens({'uploadClass':config.uploadClass,'uploadIcon':config.uploadIcon,'uploadTitle':config.uploadTitle})}if(showDwn){btnDownload=self._getLayoutTemplate('actionDownload').setTokens({'downloadClass':config.downloadClass,'downloadIcon':config.downloadIcon,'downloadTitle':config.downloadTitle,'downloadUrl':dUrl||self.initialPreviewDownloadUrl});btnDownload=btnDownload.setTokens({'filename':dFile,'key':key})}if(showZoom){btnZoom=self._getLayoutTemplate('actionZoom').setTokens({'zoomClass':config.zoomClass,'zoomIcon':config.zoomIcon,'zoomTitle':config.zoomTitle})}if(showDrag&&isInit){css='drag-handle-init '+config.dragClass;btnDrag=self._getLayoutTemplate('actionDrag').setTokens({'dragClass':css,'dragTitle':config.dragTitle,'dragIcon':config.dragIcon})}return template.setTokens({'delete':btnDelete,'upload':btnUpload,'download':btnDownload,'rotate':btnRotate,'zoom':btnZoom,'drag':btnDrag,'other':otherButtons})},_browse:function(e){var self=this;if(e&&e.isDefaultPrevented()||!self._raise('filebrowse')){return}if(self.isError&&!self.isAjaxUpload){self.clear()}if(self.focusCaptionOnBrowse){self.$captionContainer.focus()}},_change:function(e){var self=this;$(document.body).off('focusin.fileinput focusout.fileinput');if(self.changeTriggered){self._toggleLoading('hide');return}self._toggleLoading('show');var $el=self.$element,isDragDrop=arguments.length>1,isAjaxUpload=self.isAjaxUpload,tfiles,files=isDragDrop?arguments[1]:$el[0].files,ctr=self.fileManager.count(),total,initCount,len,isSingleUpl=$h.isEmpty($el.attr('multiple')),maxCount=!isAjaxUpload&&isSingleUpl?1:self.maxFileCount,maxTotCount=self.maxTotalFileCount,inclAll=maxTotCount>0&&maxTotCount>maxCount,flagSingle=(isSingleUpl&&ctr>0),throwError=function(mesg,file,previewId,index){var p1=$.extend(true,{},self._getOutData(null,{},{},files),{id:previewId,index:index}),p2={id:previewId,index:index,file:file,files:files};self.isPersistentError=true;self._toggleLoading('hide');return isAjaxUpload?self._showFileError(mesg,p1):self._showError(mesg,p2)},maxCountCheck=function(n,m,all){var msg=all?self.msgTotalFilesTooMany:self.msgFilesTooMany;msg=msg.replace('{m}',m).replace('{n}',n);self.isError=throwError(msg,null,null,null);self.$captionContainer.removeClass('icon-visible');self._setCaption('',true);self.$container.removeClass('file-input-new file-input-ajax-new')};self.reader=null;self._resetUpload();self._hideFileIcon();if(self.dropZoneEnabled){self.$container.find('.file-drop-zone .'+self.dropZoneTitleClass).remove()}if(!isAjaxUpload){if(e.target&&e.target.files===undefined){files=e.target.value?[{name:e.target.value.replace(/^.+\\/,'')}]:[]}else{files=e.target.files||{}}}tfiles=files;if($h.isEmpty(tfiles)||tfiles.length===0){if(!isAjaxUpload){self.clear()}self._raise('fileselectnone');return}self._resetErrors();len=tfiles.length;initCount=isAjaxUpload?(self.fileManager.count()+len):len;total=self._getFileCount(initCount,inclAll?false:undefined);if(maxCount>0&&total>maxCount){if(!self.autoReplace||len>maxCount){maxCountCheck((self.autoReplace&&len>maxCount?len:total),maxCount);return}if(total>maxCount){self._resetPreviewThumbs(isAjaxUpload)}}else{if(inclAll){total=self._getFileCount(initCount,true);if(maxTotCount>0&&total>maxTotCount){if(!self.autoReplace||len>maxCount){maxCountCheck((self.autoReplace&&len>maxTotCount?len:total),maxTotCount,true);return}if(total>maxCount){self._resetPreviewThumbs(isAjaxUpload)}}}if(!isAjaxUpload||flagSingle){self._resetPreviewThumbs(false);if(flagSingle){self.clearFileStack()}}else{if(isAjaxUpload&&ctr===0&&(!self.previewCache.count(true)||self.overwriteInitial)){self._resetPreviewThumbs(true)}}}if(self.autoReplace){self._getThumbs().each(function(){var $thumb=$(this);if($thumb.hasClass('file-preview-success')||$thumb.hasClass('file-preview-error')){$thumb.remove()}})}self.readFiles(tfiles);self._toggleLoading('hide')},_abort:function(params){var self=this,data;if(self.ajaxAborted&&typeof self.ajaxAborted==='object'&&self.ajaxAborted.message!==undefined){data=$.extend(true,{},self._getOutData(null),params);data.abortData=self.ajaxAborted.data||{};data.abortMessage=self.ajaxAborted.message;self._setProgress(101,self.$progress,self.msgCancelled);self._showFileError(self.ajaxAborted.message,data,'filecustomerror');self.cancel();self.unlock();return true}return!!self.ajaxAborted},_resetFileStack:function(){var self=this,i=0;self._getThumbs().each(function(){var $thumb=$(this),ind=$thumb.attr('data-fileindex'),pid=$thumb.attr('id');if(ind==='-1'||ind===-1){return}if(!self._getThumbFile($thumb)){$thumb.attr({'data-fileindex':i});i++}else{$thumb.attr({'data-fileindex':'-1'})}self._getZoom(pid).attr({'data-fileindex':$thumb.attr('data-fileindex')})})},_isFileSelectionValid:function(cnt){var self=this;cnt=cnt||0;if(self.required&&!self.getFilesCount()){self.$errorContainer.html('');self._showFileError(self.msgFileRequired);return false}if(self.minFileCount>0&&self._getFileCount(cnt)maxSize);return!skipPreview&&(allowedTypes||allowedMimes||allowedExts)},addToStack:function(file,id){var self=this;self.stackIsUpdating=true;self.fileManager.add(file,id);self._refreshPreview();self.stackIsUpdating=false},clearFileStack:function(){var self=this;self.fileManager.clear();self._initResumableUpload();if(self.enableResumableUpload){if(self.showPause===null){self.showPause=true}if(self.showCancel===null){self.showCancel=false}}else{self.showPause=false;if(self.showCancel===null){self.showCancel=true}}return self.$element},getFileStack:function(){return this.fileManager.stack},getFileList:function(){return this.fileManager.list()},getFilesSize:function(){return this.fileManager.getTotalSize()},getFilesCount:function(includeInitial){var self=this,len=self.isAjaxUpload?self.fileManager.count():self._inputFileCount();if(includeInitial){len+=self.previewCache.count(true)}return self._getFileCount(len)},_initCapStatus:function(status){var self=this,$cap=self.$caption;$cap.removeClass('is-valid file-processing');if(!status){return}if(status==='processing'){$cap.addClass('file-processing')}else{$cap.addClass('is-valid')}},_toggleLoading:function(type){var self=this;self.$previewStatus.html(type==='hide'?'':self.msgProcessing);self.$container.removeClass('file-thumb-loading');self._initCapStatus(type==='hide'?'':'processing');if(type!=='hide'){if(self.dropZoneEnabled){self.$container.find('.file-drop-zone .'+self.dropZoneTitleClass).remove()}self.$container.addClass('file-thumb-loading')}},_initFileSelected:function(){var self=this,$el=self.$element,$body=$(document.body),ev='focusin.fileinput focusout.fileinput';if($body.length){$body.off(ev).on('focusout.fileinput',function(){self._toggleLoading('show')}).on('focusin.fileinput',function(){setTimeout(function(){if(!$el.val()){self._setFileDropZoneTitle()}$body.off(ev);self._toggleLoading('hide')},2500)})}else{self._toggleLoading('hide')}},readFiles:function(files){this.reader=new FileReader();var self=this,reader=self.reader,$container=self.$previewContainer,$status=self.$previewStatus,msgLoading=self.msgLoading,msgProgress=self.msgProgress,previewInitId=self.previewInitId,numFiles=files.length,settings=self.fileTypeSettings,readFile,fileTypes=self.allowedFileTypes,typLen=fileTypes?fileTypes.length:0,fileExt=self.allowedFileExtensions,strExt=$h.isEmpty(fileExt)?'':fileExt.join(', '),throwError=function(msg,file,previewId,index,fileId){var $thumb,p1=$.extend(true,{},self._getOutData(null,{},{},files),{id:previewId,index:index,fileId:fileId}),p2={id:previewId,index:index,fileId:fileId,file:file,files:files};self._previewDefault(file,true);$thumb=self._getFrame(previewId,true);self._toggleLoading('hide');if(self.isAjaxUpload){setTimeout(function(){readFile(index+1)},self.processDelay)}else{self.unlock();numFiles=0}if(self.removeFromPreviewOnError&&$thumb.length){$thumb.remove()}else{self._initFileActions();$thumb.find('.kv-file-upload').remove()}self.isPersistentError=true;self.isError=self.isAjaxUpload?self._showFileError(msg,p1):self._showError(msg,p2);self._updateFileDetails(numFiles)};self.fileManager.clearImages();$.each(files,function(key,file){var func=self.fileTypeSettings.image;if(func&&func(file.type)){self.fileManager.totalImages++}});readFile=function(i){var $error=self.$errorContainer,errors,fm=self.fileManager;if(i>=numFiles){self.unlock();if(self.duplicateErrors.length){errors='
  • '+self.duplicateErrors.join('
  • ')+'
  • ';if($error.find('ul').length===0){$h.setHtml($error,self.errorCloseButton+'
      '+errors+'
    ')}else{$error.find('ul').append(errors)}$error.fadeIn(self.fadeDelay);self._handler($error.find('.kv-error-close'),'click',function(){$error.fadeOut(self.fadeDelay)});self.duplicateErrors=[]}if(self.isAjaxUpload){self._raise('filebatchselected',[fm.stack]);if(fm.count()===0&&!self.isError){self.reset()}}else{self._raise('filebatchselected',[files])}$container.removeClass('file-thumb-loading');self._initCapStatus('valid');$status.html('');return}self.lock(true);var file=files[i],id,previewId,fileProcessed,fSize=(file&&file.size||0),sizeHuman=self._getSize(fSize,true),j,msg,fnImage=settings.image,chk,typ,typ1,typ2,caption,fileSize=fSize/self.bytesToKB,fileExtExpr='',previewData,fileCount=0,strTypes='',fileId,canLoad,fileReaderAborted=false,func,knownTypes=0,isImage,processFileLoaded,initFileData;initFileData=function(dataSource){dataSource=dataSource||file;id=fileId=self._getFileId(file);previewId=previewInitId+'-'+id;previewData=$h.createObjectURL(dataSource);caption=self._getFileName(file,'')};processFileLoaded=function(){var isImageResized=!!fm.loadedImages[id],msg=msgProgress.setTokens({'index':i+1,'files':numFiles,'percent':50,'name':caption});setTimeout(function(){$status.html(msg);self._updateFileDetails(numFiles);if(self.getFilesCount(true)>0&&self.getFrames(':visible')){self.$dropZone.find('.'+self.dropZoneTitleClass).remove()}readFile(i+1)},self.processDelay);if(self._raise('fileloaded',[file,previewId,id,i,reader])&&self.isAjaxUpload){if(!isImageResized){fm.add(file)}}else{if(isImageResized){fm.removeFile(id)}}};if(!file){return}initFileData();if(typLen>0){for(j=0;j0&&fileSize>self.maxFileSize){msg=self.msgSizeTooLarge.setTokens({'name':caption,'size':sizeHuman,'maxSize':self._getSize(self.maxFileSize*self.bytesToKB,true)});throwError(msg,file,previewId,i,fileId);return}if(self.minFileSize!==null&&fileSize<=$h.getNum(self.minFileSize)){msg=self.msgSizeTooSmall.setTokens({'name':caption,'size':sizeHuman,'minSize':self._getSize(self.minFileSize*self.bytesToKB,true)});throwError(msg,file,previewId,i,fileId);return}if(!$h.isEmpty(fileTypes)&&$h.isArray(fileTypes)){for(j=0;j0){for(i=0;i0){for(i=0;i0)?self.initialCaption:'';self.$caption.attr('title','').val(cap);$h.addCss(self.$container,'file-input-new');self._validateDefaultPreview()}if(self.$container.find($h.FRAMES).length===0){if(!self._initCaption()){self.$captionContainer.removeClass('icon-visible')}}self._hideFileIcon();if(self.focusCaptionOnClear){self.$captionContainer.focus()}self._setFileDropZoneTitle();self._raise('filecleared');return self.$element},reset:function(){var self=this;if(!self._raise('filereset')){return}self.lastProgress=0;self._resetPreview();self.$container.find('.fileinput-filename').text('');$h.addCss(self.$container,'file-input-new');if(self.getFrames().length){self.$container.removeClass('file-input-new')}self.clearFileStack();self._setFileDropZoneTitle();return self.$element},disable:function(){var self=this,$container=self.$container;self.isDisabled=true;self._raise('filedisabled');self.$element.attr('disabled','disabled');$container.addClass('is-locked');$h.addCss($container.find('.btn-file'),'disabled');$container.find('.kv-fileinput-caption').addClass('file-caption-disabled');$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').attr('disabled',true);self._initDragDrop();return self.$element},enable:function(){var self=this,$container=self.$container;self.isDisabled=false;self._raise('fileenabled');self.$element.removeAttr('disabled');$container.removeClass('is-locked');$container.find('.kv-fileinput-caption').removeClass('file-caption-disabled');$container.find('.fileinput-remove, .fileinput-upload, .file-preview-frame button').removeAttr('disabled');$container.find('.btn-file').removeClass('disabled');self._initDragDrop();return self.$element},upload:function(){var self=this,fm=self.fileManager,totLen=fm.count(),i,outData,tm=self.taskManager,hasExtraData=!$.isEmptyObject(self._getExtraData());fm.bpsLog=[];fm.bps=0;if(!self.isAjaxUpload||self.isDisabled||!self._isFileSelectionValid(totLen)){return}self.lastProgress=0;self._resetUpload();if(totLen===0&&!hasExtraData){self._showFileError(self.msgUploadEmpty);return}self.cancelling=false;self.uploadInitiated=true;self._showProgress();self.lock();if(totLen===0&&hasExtraData){self._setProgress(2);self._uploadExtraOnly();return}if(self.enableResumableUpload){return self.resume()}if(self.uploadAsync||self.enableResumableUpload){outData=self._getOutData(null);if(!self._checkBatchPreupload(outData)){return}self.fileBatchCompleted=false;self.uploadCache=[];$.each(self.getFileStack(),function(id){var previewId=self._getThumbId(id);self.uploadCache.push({id:previewId,content:null,config:null,tags:null,append:true})});self.$preview.find('.file-preview-initial').removeClass($h.SORT_CSS);self._initSortable()}self._setProgress(2);self.hasInitData=false;if(self.uploadAsync){i=0;var pool=self.ajaxPool=tm.addPool($h.uniqId());$.each(self.getFileStack(),function(id){pool.addTask(id+i,function(deferrer){self._uploadSingle(i,id,true,deferrer)});i++});pool.run(self.maxAjaxThreads).done(function(){self._log('Async upload batch completed successfully.');self._raise('filebatchuploadsuccess',[fm.stack,self._getExtraData()])}).fail(function(){self._log('Async upload batch completed with errors.');self._raise('filebatchuploaderror',[fm.stack,self._getExtraData()])});return}self._uploadBatch();return self.$element},destroy:function(){var self=this,$form=self.$form,$cont=self.$container,$el=self.$element,ns=self.namespace;$(document).off(ns);$(window).off(ns);if($form&&$form.length){$form.off(ns)}if(self.isAjaxUpload){self._clearFileInput()}self._cleanup();self._initPreviewCache();$el.insertBefore($cont).off(ns).removeData();$cont.off().remove();return $el},refresh:function(options){var self=this,$el=self.$element;if(typeof options!=='object'||$h.isEmpty(options)){options=self.options}else{options=$.extend(true,{},self.options,options)}self._init(options,true);self._listen();return $el},zoom:function(frameId){var self=this,$frame=self._getFrame(frameId);self._showModal($frame)},getExif:function(frameId){var self=this,$frame=self._getFrame(frameId);return $frame&&$frame.data('exif')||null},getFrames:function(cssFilter){var self=this,$frames;cssFilter=cssFilter||'';$frames=self.$preview.find($h.FRAMES+cssFilter);if(self.reversePreviewOrder){$frames=$($frames.get().reverse())}return $frames},getPreview:function(){var self=this;return{content:self.initialPreview,config:self.initialPreviewConfig,tags:self.initialPreviewThumbTags}}};$.fn.fileinput=function(option){if(!$h.hasFileAPISupport()&&!$h.isIE(9)){return}var args=Array.apply(null,arguments),retvals=[];args.shift();this.each(function(){var self=$(this),data=self.data('fileinput'),options=typeof option==='object'&&option,theme=options.theme||self.data('theme'),l={},t={},lang=options.language||self.data('language')||$.fn.fileinput.defaults.language||'en',opt;if(!data){if(theme){t=$.fn.fileinputThemes[theme]||{}}if(lang!=='en'&&!$h.isEmpty($.fn.fileinputLocales[lang])){l=$.fn.fileinputLocales[lang]||{}}opt=$.extend(true,{},$.fn.fileinput.defaults,t,$.fn.fileinputLocales.en,l,options,self.data());data=new FileInput(this,opt);self.data('fileinput',data)}if(typeof option==='string'){retvals.push(data[option].apply(data,args))}});switch(retvals.length){case 0:return this;case 1:return retvals[0];default:return retvals}};var IFRAME_ATTRIBS='class="kv-preview-data file-preview-pdf" src="{renderer}?file={data}" {style}',defBtnCss1='btn btn-sm btn-kv '+$h.defaultButtonCss(),defBtnCss2='btn '+$h.defaultButtonCss();$.fn.fileinput.defaults={language:'zh',bytesToKB:1024,showCaption:true,showBrowse:true,showPreview:true,showRemove:true,showUpload:true,showUploadStats:true,showCancel:null,showPause:null,showClose:true,showUploadedThumbs:true,showConsoleLogs:false,browseOnZoneClick:false,autoReplace:false,showDescriptionClose:true,autoOrientImage:function(){var ua=window.navigator.userAgent,webkit=!!ua.match(/WebKit/i),iOS=!!ua.match(/iP(od|ad|hone)/i),iOSSafari=iOS&&webkit&&!ua.match(/CriOS/i);return!iOSSafari},autoOrientImageInitial:true,showExifErrorLog:false,required:false,rtl:false,hideThumbnailContent:false,encodeUrl:true,focusCaptionOnBrowse:true,focusCaptionOnClear:true,generateFileId:null,previewClass:'',captionClass:'',frameClass:'krajee-default',mainClass:'',inputGroupClass:'',mainTemplate:null,fileSizeGetter:null,initialCaption:'',initialPreview:[],initialPreviewDelimiter:'*$$*',initialPreviewAsData:false,initialPreviewFileType:'image',initialPreviewConfig:[],initialPreviewThumbTags:[],previewThumbTags:{},initialPreviewShowDelete:true,initialPreviewDownloadUrl:'',removeFromPreviewOnError:false,deleteUrl:'',deleteExtraData:{},overwriteInitial:true,sanitizeZoomCache:function(content){var $container=$h.createElement(content);$container.find('input,textarea,select,datalist,form,.file-thumbnail-footer').remove();return $container.html()},previewZoomButtonIcons:{prev:'',next:'',toggleheader:'',fullscreen:'',borderless:'',close:''},previewZoomButtonClasses:{prev:'btn btn-default btn-outline-secondary btn-navigate',next:'btn btn-default btn-outline-secondary btn-navigate',rotate:defBtnCss1,toggleheader:defBtnCss1,fullscreen:defBtnCss1,borderless:defBtnCss1,close:defBtnCss1},previewTemplates:{},previewContentTemplates:{},preferIconicPreview:false,preferIconicZoomPreview:false,alwaysPreviewFileExtensions:[],rotatableFileExtensions:['jpg','jpeg','png','gif'],allowedFileTypes:null,allowedFileExtensions:null,allowedPreviewTypes:undefined,allowedPreviewMimeTypes:null,allowedPreviewExtensions:null,disabledPreviewTypes:undefined,disabledPreviewExtensions:['msi','exe','com','zip','rar','app','vb','scr'],disabledPreviewMimeTypes:null,defaultPreviewContent:null,customLayoutTags:{},customPreviewTags:{},previewFileIcon:'',previewFileIconClass:'file-other-icon',previewFileIconSettings:{},previewFileExtSettings:{},buttonLabelClass:'hidden-xs',browseIcon:' ',browseClass:'btn btn-primary',removeIcon:'',removeClass:defBtnCss2,cancelIcon:'',cancelClass:defBtnCss2,pauseIcon:'',pauseClass:defBtnCss2,uploadIcon:'',uploadClass:defBtnCss2,uploadUrl:null,uploadUrlThumb:null,uploadAsync:true,uploadParamNames:{chunkCount:'chunkCount',chunkIndex:'chunkIndex',chunkSize:'chunkSize',chunkSizeStart:'chunkSizeStart',chunksUploaded:'chunksUploaded',fileBlob:'fileBlob',fileId:'fileId',fileName:'fileName',fileRelativePath:'fileRelativePath',fileSize:'fileSize',retryCount:'retryCount'},maxAjaxThreads:5,fadeDelay:800,processDelay:100,bitrateUpdateDelay:500,queueDelay:10,progressDelay:0,enableResumableUpload:false,resumableUploadOptions:{fallback:null,testUrl:null,chunkSize:2048,maxThreads:4,maxRetries:3,showErrorLog:true,retainErrorHistory:false,skipErrorsAndProceed:false},uploadExtraData:{},zoomModalHeight:485,minImageWidth:null,minImageHeight:null,maxImageWidth:null,maxImageHeight:null,resizeImage:false,resizePreference:'width',resizeQuality:0.92,resizeDefaultImageType:'image/jpeg',resizeIfSizeMoreThan:0,minFileSize:-1,maxFileSize:0,maxFilePreviewSize:25600,minFileCount:0,maxFileCount:0,maxTotalFileCount:0,validateInitialCount:false,msgValidationErrorClass:'text-danger',msgValidationErrorIcon:' ',msgErrorClass:'file-error-message',progressThumbClass:'progress-bar progress-bar-striped active progress-bar-animated',progressClass:'progress-bar bg-success progress-bar-success progress-bar-striped active progress-bar-animated',progressInfoClass:'progress-bar bg-info progress-bar-info progress-bar-striped active progress-bar-animated',progressCompleteClass:'progress-bar bg-success progress-bar-success',progressPauseClass:'progress-bar bg-primary progress-bar-primary progress-bar-striped active progress-bar-animated',progressErrorClass:'progress-bar bg-danger progress-bar-danger',progressUploadThreshold:99,previewFileType:'image',elCaptionContainer:null,elCaptionText:null,elPreviewContainer:null,elPreviewImage:null,elPreviewStatus:null,elErrorContainer:null,errorCloseButton:undefined,slugCallback:null,dropZoneEnabled:true,dropZoneTitleClass:'file-drop-zone-title',fileActionSettings:{},otherActionButtons:'',textEncoding:'UTF-8',preProcessUpload:null,ajaxSettings:{},ajaxDeleteSettings:{},showAjaxErrorDetails:true,mergeAjaxCallbacks:false,mergeAjaxDeleteCallbacks:false,retryErrorUploads:true,reversePreviewOrder:false,usePdfRenderer:function(){var isIE11=!!window.MSInputMethodContext&&!!document.documentMode;return!!navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/i)||isIE11},pdfRendererUrl:'',pdfRendererTemplate:'',tabIndexConfig:{browse:500,remove:500,upload:500,cancel:null,pause:null,modal:-1}};$.fn.fileinputLocales.en={sizeUnits:['B','KB','MB','GB','TB','PB','EB','ZB','YB'],bitRateUnits:['B/s','KB/s','MB/s','GB/s','TB/s','PB/s','EB/s','ZB/s','YB/s'],fileSingle:'file',filePlural:'files',browseLabel:'Browse …',removeLabel:'Remove',removeTitle:'Clear all unprocessed files',cancelLabel:'Cancel',cancelTitle:'Abort ongoing upload',pauseLabel:'Pause',pauseTitle:'Pause ongoing upload',uploadLabel:'Upload',uploadTitle:'Upload selected files',msgNo:'No',msgNoFilesSelected:'No files selected',msgCancelled:'Cancelled',msgPaused:'Paused',msgPlaceholder:'Select {files} ...',msgZoomModalHeading:'Detailed Preview',msgFileRequired:'You must select a file to upload.',msgSizeTooSmall:'File "{name}" ({size}) is too small and must be larger than {minSize}.',msgSizeTooLarge:'File "{name}" ({size}) exceeds maximum allowed upload size of {maxSize}.',msgFilesTooLess:'You must select at least {n} {files} to upload.',msgFilesTooMany:'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}.',msgTotalFilesTooMany:'You can upload a maximum of {m} files ({n} files detected).',msgFileNotFound:'File "{name}" not found!',msgFileSecured:'Security restrictions prevent reading the file "{name}".',msgFileNotReadable:'File "{name}" is not readable.',msgFilePreviewAborted:'File preview aborted for "{name}".',msgFilePreviewError:'An error occurred while reading the file "{name}".',msgInvalidFileName:'Invalid or unsupported characters in file name "{name}".',msgInvalidFileType:'Invalid type for file "{name}". Only "{types}" files are supported.',msgInvalidFileExtension:'Invalid extension for file "{name}". Only "{extensions}" files are supported.',msgFileTypes:{'image':'image','html':'HTML','text':'text','video':'video','audio':'audio','flash':'flash','pdf':'PDF','object':'object'},msgUploadAborted:'The file upload was aborted',msgUploadThreshold:'Processing …',msgUploadBegin:'Initializing …',msgUploadEnd:'Done',msgUploadResume:'Resuming upload …',msgUploadEmpty:'No valid data available for upload.',msgUploadError:'Upload Error',msgDeleteError:'Delete Error',msgProgressError:'Error',msgValidationError:'Validation Error',msgLoading:'Loading file {index} of {files} …',msgProgress:'Loading file {index} of {files} - {name} - {percent}% completed.',msgSelected:'{n} {files} selected',msgProcessing:'Processing ...',msgFoldersNotAllowed:'Drag & drop files only! {n} folder(s) dropped were skipped.',msgImageWidthSmall:'Width of image file "{name}" must be at least {size} px (detected {dimension} px).',msgImageHeightSmall:'Height of image file "{name}" must be at least {size} px (detected {dimension} px).',msgImageWidthLarge:'Width of image file "{name}" cannot exceed {size} px (detected {dimension} px).',msgImageHeightLarge:'Height of image file "{name}" cannot exceed {size} px (detected {dimension} px).',msgImageResizeError:'Could not get the image dimensions to resize.',msgImageResizeException:'Error while resizing the image.
    {errors}
    ',msgAjaxError:'Something went wrong with the {operation} operation. Please try again later!',msgAjaxProgressError:'{operation} failed',msgDuplicateFile:'File "{name}" of same size "{size}" has already been selected earlier. Skipping duplicate selection.',msgResumableUploadRetriesExceeded:'Upload aborted beyond {max} retries for file {file}! Error Details:
    {error}
    ',msgPendingTime:'{time} remaining',msgCalculatingTime:'calculating time remaining',ajaxOperations:{deleteThumb:'file delete',uploadThumb:'file upload',uploadBatch:'batch file upload',uploadExtra:'form data upload'},dropZoneTitle:'Drag & drop files here …',dropZoneClickTitle:'
    (or click to select {files})',previewZoomButtonTitles:{prev:'View previous file',next:'View next file',rotate:'Rotate 90 deg. clockwise',toggleheader:'Toggle header',fullscreen:'Toggle full screen',borderless:'Toggle borderless mode',close:'Close detailed preview'}};$.fn.fileinputLocales.zh={sizeUnits:['B','KB','MB','GB','TB','PB','EB','ZB','YB'],bitRateUnits:['B/s','KB/s','MB/s','GB/s','TB/s','PB/s','EB/s','ZB/s','YB/s'],fileSingle:'文件',filePlural:'个文件',browseLabel:'选择 …',removeLabel:'移除',removeTitle:'清除选中文件',cancelLabel:'取消',cancelTitle:'取消进行中的上传',pauseLabel:'暂停',pauseTitle:'暂停上传',uploadLabel:'上传',uploadTitle:'上传选中文件',msgNo:'没有',msgNoFilesSelected:'未选择文件',msgPaused:'已暂停',msgCancelled:'取消',msgPlaceholder:'选择 {files} ...',msgZoomModalHeading:'详细预览',msgFileRequired:'必须选择一个文件上传.',msgSizeTooSmall:'文件 "{name}" ({size}) 必须大于限定大小 {minSize}.',msgSizeTooLarge:'文件 "{name}" ({size}) 超过了允许大小 {maxSize}.',msgFilesTooLess:'你必须选择最少 {n} {files} 来上传. ',msgFilesTooMany:'选择的上传文件个数 ({n}) 超出最大文件的限制个数 {m}.',msgTotalFilesTooMany:'你最多可以上传 {m} 个文件 (当前有{n} 个文件).',msgFileNotFound:'文件 "{name}" 未找到!',msgFileSecured:'安全限制,为了防止读取文件 "{name}".',msgFileNotReadable:'文件 "{name}" 不可读.',msgFilePreviewAborted:'取消 "{name}" 的预览.',msgFilePreviewError:'读取 "{name}" 时出现了一个错误.',msgInvalidFileName:'文件名 "{name}" 包含非法字符.',msgInvalidFileType:'不正确的类型 "{name}". 只支持 "{types}" 类型的文件.',msgInvalidFileExtension:'不正确的文件扩展名 "{name}". 只支持 "{extensions}" 的文件扩展名.',msgFileTypes:{'image':'image','html':'HTML','text':'text','video':'video','audio':'audio','flash':'flash','pdf':'PDF','object':'object'},msgUploadAborted:'该文件上传被中止',msgUploadThreshold:'处理中 …',msgUploadBegin:'正在初始化 …',msgUploadEnd:'完成',msgUploadResume:'继续上传 …',msgUploadEmpty:'无效的文件上传.',msgUploadError:'上传出错',msgDeleteError:'删除出错',msgProgressError:'上传出错',msgValidationError:'验证错误',msgLoading:'加载第 {index} 文件 共 {files} …',msgProgress:'加载第 {index} 文件 共 {files} - {name} - {percent}% 完成.',msgSelected:'{n} {files} 选中',msgProcessing:'处理中 ...',msgFoldersNotAllowed:'只支持拖拽文件! 跳过 {n} 拖拽的文件夹.',msgImageWidthSmall:'图像文件的"{name}"的宽度必须是至少{size}像素.',msgImageHeightSmall:'图像文件的"{name}"的高度必须至少为{size}像素.',msgImageWidthLarge:'图像文件"{name}"的宽度不能超过{size}像素.',msgImageHeightLarge:'图像文件"{name}"的高度不能超过{size}像素.',msgImageResizeError:'无法获取的图像尺寸调整。',msgImageResizeException:'调整图像大小时发生错误。
    {errors}
    ',msgAjaxError:'{operation} 发生错误. 请重试!',msgAjaxProgressError:'{operation} 失败',msgDuplicateFile:'文件 "{name}",大小 "{size}" 已经被选中.忽略相同的文件.',msgResumableUploadRetriesExceeded:'文件 {file} 上传失败超过 {max} 次重试 ! 错误详情:
    {error}
    ',msgPendingTime:'{time} 剩余',msgCalculatingTime:'计算剩余时间',ajaxOperations:{deleteThumb:'删除文件',uploadThumb:'上传文件',uploadBatch:'批量上传',uploadExtra:'表单数据上传'},dropZoneTitle:'拖拽文件到这里 …
    支持多文件同时上传',dropZoneClickTitle:'
    (或点击{files}按钮选择文件)',fileActionSettings:{removeTitle:'删除文件',uploadTitle:'上传文件',downloadTitle:'下载文件',uploadRetryTitle:'重试',rotateTitle:'顺时针旋转90度',zoomTitle:'查看详情',dragTitle:'移动 / 重置',indicatorNewTitle:'没有上传',indicatorSuccessTitle:'上传',indicatorErrorTitle:'上传错误',indicatorPausedTitle:'上传已暂停',indicatorLoadingTitle:'上传 …'},previewZoomButtonTitles:{prev:'预览上一个文件',next:'预览下一个文件',rotate:'顺时针旋转90度',toggleheader:'缩放',fullscreen:'全屏',borderless:'无边界模式',close:'关闭当前预览'}};$.fn.fileinput.Constructor=FileInput;$(document).ready(function(){var $input=$('input.file[type=file]');if($input.length){$input.fileinput()}})})); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif deleted file mode 100644 index 44e3b7a0f..000000000 Binary files a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading-sm.gif and /dev/null differ diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif deleted file mode 100644 index 0ea146c02..000000000 Binary files a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-fileinput/loading.gif and /dev/null differ diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css deleted file mode 100644 index defdfbbce..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.css +++ /dev/null @@ -1,459 +0,0 @@ -/*! - * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2020 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - -@-webkit-keyframes bs-notify-fadeOut { - 0% { - opacity: 0.9; - } - 100% { - opacity: 0; - } -} -@-o-keyframes bs-notify-fadeOut { - 0% { - opacity: 0.9; - } - 100% { - opacity: 0; - } -} -@keyframes bs-notify-fadeOut { - 0% { - opacity: 0.9; - } - 100% { - opacity: 0; - } -} -select.bs-select-hidden, -.bootstrap-select > select.bs-select-hidden, -select.selectpicker { - display: none !important; -} -.bootstrap-select { - width: 220px \0; - /*IE9 and below*/ - vertical-align: middle; -} -.bootstrap-select > .dropdown-toggle { - position: relative; - width: 100%; - text-align: right; - white-space: nowrap; - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-box-align: center; - -webkit-align-items: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; -} -.bootstrap-select > .dropdown-toggle:after { - margin-top: -1px; -} -.bootstrap-select > .dropdown-toggle.bs-placeholder, -.bootstrap-select > .dropdown-toggle.bs-placeholder:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder:active { - color: #999; -} -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:hover, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:focus, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-primary:active, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-secondary:active, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-success:active, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-danger:active, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-info:active, -.bootstrap-select > .dropdown-toggle.bs-placeholder.btn-dark:active { - color: rgba(255, 255, 255, 0.5); -} -.bootstrap-select > select { - position: absolute !important; - bottom: 0; - left: 50%; - display: block !important; - width: 0.5px !important; - height: 100% !important; - padding: 0 !important; - opacity: 0 !important; - border: none; - z-index: 0 !important; -} -.bootstrap-select > select.mobile-device { - top: 0; - left: 0; - display: block !important; - width: 100% !important; - z-index: 2 !important; -} -.has-error .bootstrap-select .dropdown-toggle, -.error .bootstrap-select .dropdown-toggle, -.bootstrap-select.is-invalid .dropdown-toggle, -.was-validated .bootstrap-select select:invalid + .dropdown-toggle { - border-color: #b94a48; -} -.bootstrap-select.is-valid .dropdown-toggle, -.was-validated .bootstrap-select select:valid + .dropdown-toggle { - border-color: #28a745; -} -.bootstrap-select.fit-width { - width: auto !important; -} -.bootstrap-select:not([class*="col-"]):not([class*="form-control"]):not(.input-group-btn) { - width: 220px; -} -.bootstrap-select > select.mobile-device:focus + .dropdown-toggle, -.bootstrap-select .dropdown-toggle:focus { - outline: thin dotted #333333 !important; - outline: 5px auto -webkit-focus-ring-color !important; - outline-offset: -2px; -} -.bootstrap-select.form-control { - margin-bottom: 0; - padding: 0; - border: none; - height: auto; -} -:not(.input-group) > .bootstrap-select.form-control:not([class*="col-"]) { - width: 100%; -} -.bootstrap-select.form-control.input-group-btn { - float: none; - z-index: auto; -} -.form-inline .bootstrap-select, -.form-inline .bootstrap-select.form-control:not([class*="col-"]) { - width: auto; -} -.bootstrap-select:not(.input-group-btn), -.bootstrap-select[class*="col-"] { - float: none; - display: inline-block; - margin-left: 0; -} -.bootstrap-select.dropdown-menu-right, -.bootstrap-select[class*="col-"].dropdown-menu-right, -.row .bootstrap-select[class*="col-"].dropdown-menu-right { - float: right; -} -.form-inline .bootstrap-select, -.form-horizontal .bootstrap-select, -.form-group .bootstrap-select { - margin-bottom: 0; -} -.form-group-lg .bootstrap-select.form-control, -.form-group-sm .bootstrap-select.form-control { - padding: 0; -} -.form-group-lg .bootstrap-select.form-control .dropdown-toggle, -.form-group-sm .bootstrap-select.form-control .dropdown-toggle { - height: 100%; - font-size: inherit; - line-height: inherit; - border-radius: inherit; -} -.bootstrap-select.form-control-sm .dropdown-toggle, -.bootstrap-select.form-control-lg .dropdown-toggle { - font-size: inherit; - line-height: inherit; - border-radius: inherit; -} -.bootstrap-select.form-control-sm .dropdown-toggle { - padding: 0.25rem 0.5rem; -} -.bootstrap-select.form-control-lg .dropdown-toggle { - padding: 0.5rem 1rem; -} -.form-inline .bootstrap-select .form-control { - width: 100%; -} -.bootstrap-select.disabled, -.bootstrap-select > .disabled { - cursor: not-allowed; -} -.bootstrap-select.disabled:focus, -.bootstrap-select > .disabled:focus { - outline: none !important; -} -.bootstrap-select.bs-container { - position: absolute; - top: 0; - left: 0; - height: 0 !important; - padding: 0 !important; -} -.bootstrap-select.bs-container .dropdown-menu { - z-index: 1060; -} -.bootstrap-select .dropdown-toggle .filter-option { - position: static; - top: 0; - left: 0; - float: left; - height: 100%; - width: 100%; - text-align: left; - overflow: hidden; - -webkit-box-flex: 0; - -webkit-flex: 0 1 auto; - -ms-flex: 0 1 auto; - flex: 0 1 auto; -} -.bs3.bootstrap-select .dropdown-toggle .filter-option { - padding-right: inherit; -} -.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option { - position: absolute; - padding-top: inherit; - padding-bottom: inherit; - padding-left: inherit; - float: none; -} -.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner { - padding-right: inherit; -} -.bootstrap-select .dropdown-toggle .filter-option-inner-inner { - overflow: hidden; -} -.bootstrap-select .dropdown-toggle .filter-expand { - width: 0 !important; - float: left; - opacity: 0 !important; - overflow: hidden; -} -.bootstrap-select .dropdown-toggle .caret { - position: absolute; - top: 50%; - right: 12px; - margin-top: -2px; - vertical-align: middle; -} -.input-group .bootstrap-select.form-control .dropdown-toggle { - border-radius: inherit; -} -.bootstrap-select[class*="col-"] .dropdown-toggle { - width: 100%; -} -.bootstrap-select .dropdown-menu { - min-width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bootstrap-select .dropdown-menu > .inner:focus { - outline: none !important; -} -.bootstrap-select .dropdown-menu.inner { - position: static; - float: none; - border: 0; - padding: 0; - margin: 0; - border-radius: 0; - -webkit-box-shadow: none; - box-shadow: none; -} -.bootstrap-select .dropdown-menu li { - position: relative; -} -.bootstrap-select .dropdown-menu li.active small { - color: rgba(255, 255, 255, 0.5) !important; -} -.bootstrap-select .dropdown-menu li.disabled a { - cursor: not-allowed; -} -.bootstrap-select .dropdown-menu li a { - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.bootstrap-select .dropdown-menu li a.opt { - position: relative; - padding-left: 2.25em; -} -.bootstrap-select .dropdown-menu li a span.check-mark { - display: none; -} -.bootstrap-select .dropdown-menu li a span.text { - display: inline-block; -} -.bootstrap-select .dropdown-menu li small { - padding-left: 0.5em; -} -.bootstrap-select .dropdown-menu .notify { - position: absolute; - bottom: 5px; - width: 96%; - margin: 0 2%; - min-height: 26px; - padding: 3px 5px; - background: #f5f5f5; - border: 1px solid #e3e3e3; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); - pointer-events: none; - opacity: 0.9; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bootstrap-select .dropdown-menu .notify.fadeOut { - -webkit-animation: 300ms linear 750ms forwards bs-notify-fadeOut; - -o-animation: 300ms linear 750ms forwards bs-notify-fadeOut; - animation: 300ms linear 750ms forwards bs-notify-fadeOut; -} -.bootstrap-select .no-results { - padding: 3px; - background: #f5f5f5; - margin: 0 5px; - white-space: nowrap; -} -.bootstrap-select.fit-width .dropdown-toggle .filter-option { - position: static; - display: inline; - padding: 0; -} -.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner, -.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner { - display: inline; -} -.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before { - content: '\00a0'; -} -.bootstrap-select.fit-width .dropdown-toggle .caret { - position: static; - top: auto; - margin-top: -1px; -} -.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark { - position: absolute; - display: inline-block; - right: 15px; - top: 5px; -} -.bootstrap-select.show-tick .dropdown-menu li a span.text { - margin-right: 34px; -} -.bootstrap-select .bs-ok-default:after { - content: ''; - display: block; - width: 0.5em; - height: 1em; - border-style: solid; - border-width: 0 0.26em 0.26em 0; - -webkit-transform-style: preserve-3d; - transform-style: preserve-3d; - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - -o-transform: rotate(45deg); - transform: rotate(45deg); -} -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle, -.bootstrap-select.show-menu-arrow.show > .dropdown-toggle { - z-index: 1061; -} -.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before { - content: ''; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid rgba(204, 204, 204, 0.2); - position: absolute; - bottom: -4px; - left: 9px; - display: none; -} -.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after { - content: ''; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid white; - position: absolute; - bottom: -4px; - left: 10px; - display: none; -} -.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before { - bottom: auto; - top: -4px; - border-top: 7px solid rgba(204, 204, 204, 0.2); - border-bottom: 0; -} -.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after { - bottom: auto; - top: -4px; - border-top: 6px solid white; - border-bottom: 0; -} -.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before { - right: 12px; - left: auto; -} -.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after { - right: 13px; - left: auto; -} -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:before, -.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:before, -.bootstrap-select.show-menu-arrow.open > .dropdown-toggle .filter-option:after, -.bootstrap-select.show-menu-arrow.show > .dropdown-toggle .filter-option:after { - display: block; -} -.bs-searchbox, -.bs-actionsbox, -.bs-donebutton { - padding: 4px 8px; -} -.bs-actionsbox { - width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bs-actionsbox .btn-group button { - width: 50%; -} -.bs-donebutton { - float: left; - width: 100%; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -.bs-donebutton .btn-group button { - width: 100%; -} -.bs-searchbox + .bs-actionsbox { - padding: 0 8px 4px; -} -.bs-searchbox .form-control { - margin-bottom: 0; - width: 100%; - float: none; -} diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js deleted file mode 100644 index 4becc8e60..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.js +++ /dev/null @@ -1,3247 +0,0 @@ -/*! - * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2020 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - -(function (root, factory) { - if (root === undefined && window !== undefined) root = window; - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module unless amdModuleId is set - define(["jquery"], function (a0) { - return (factory(a0)); - }); - } else if (typeof module === 'object' && module.exports) { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(require("jquery")); - } else { - factory(root["jQuery"]); - } -}(this, function (jQuery) { - -(function ($) { - 'use strict'; - - var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; - - var uriAttrs = [ - 'background', - 'cite', - 'href', - 'itemtype', - 'longdesc', - 'poster', - 'src', - 'xlink:href' - ]; - - var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; - - var DefaultWhitelist = { - // Global attributes allowed on any supplied element below. - '*': ['class', 'dir', 'id', 'lang', 'role', 'tabindex', 'style', ARIA_ATTRIBUTE_PATTERN], - a: ['target', 'href', 'title', 'rel'], - area: [], - b: [], - br: [], - col: [], - code: [], - div: [], - em: [], - hr: [], - h1: [], - h2: [], - h3: [], - h4: [], - h5: [], - h6: [], - i: [], - img: ['src', 'alt', 'title', 'width', 'height'], - li: [], - ol: [], - p: [], - pre: [], - s: [], - small: [], - span: [], - sub: [], - sup: [], - strong: [], - u: [], - ul: [] - } - - /** - * A pattern that recognizes a commonly useful subset of URLs that are safe. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; - - /** - * A pattern that matches safe data URLs. Only matches image, video and audio types. - * - * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts - */ - var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; - - function allowedAttribute (attr, allowedAttributeList) { - var attrName = attr.nodeName.toLowerCase() - - if ($.inArray(attrName, allowedAttributeList) !== -1) { - if ($.inArray(attrName, uriAttrs) !== -1) { - return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) - } - - return true - } - - var regExp = $(allowedAttributeList).filter(function (index, value) { - return value instanceof RegExp - }) - - // Check if a regular expression validates the attribute. - for (var i = 0, l = regExp.length; i < l; i++) { - if (attrName.match(regExp[i])) { - return true - } - } - - return false - } - - function sanitizeHtml (unsafeElements, whiteList, sanitizeFn) { - if (sanitizeFn && typeof sanitizeFn === 'function') { - return sanitizeFn(unsafeElements); - } - - var whitelistKeys = Object.keys(whiteList); - - for (var i = 0, len = unsafeElements.length; i < len; i++) { - var elements = unsafeElements[i].querySelectorAll('*'); - - for (var j = 0, len2 = elements.length; j < len2; j++) { - var el = elements[j]; - var elName = el.nodeName.toLowerCase(); - - if (whitelistKeys.indexOf(elName) === -1) { - el.parentNode.removeChild(el); - - continue; - } - - var attributeList = [].slice.call(el.attributes); - var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); - - for (var k = 0, len3 = attributeList.length; k < len3; k++) { - var attr = attributeList[k]; - - if (!allowedAttribute(attr, whitelistedAttributes)) { - el.removeAttribute(attr.nodeName); - } - } - } - } - } - - // Polyfill for browsers with no classList support - // Remove in v2 - if (!('classList' in document.createElement('_'))) { - (function (view) { - if (!('Element' in view)) return; - - var classListProp = 'classList', - protoProp = 'prototype', - elemCtrProto = view.Element[protoProp], - objCtr = Object, - classListGetter = function () { - var $elem = $(this); - - return { - add: function (classes) { - classes = Array.prototype.slice.call(arguments).join(' '); - return $elem.addClass(classes); - }, - remove: function (classes) { - classes = Array.prototype.slice.call(arguments).join(' '); - return $elem.removeClass(classes); - }, - toggle: function (classes, force) { - return $elem.toggleClass(classes, force); - }, - contains: function (classes) { - return $elem.hasClass(classes); - } - } - }; - - if (objCtr.defineProperty) { - var classListPropDesc = { - get: classListGetter, - enumerable: true, - configurable: true - }; - try { - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } catch (ex) { // IE 8 doesn't support enumerable:true - // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36 - // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected - if (ex.number === undefined || ex.number === -0x7FF5EC54) { - classListPropDesc.enumerable = false; - objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc); - } - } - } else if (objCtr[protoProp].__defineGetter__) { - elemCtrProto.__defineGetter__(classListProp, classListGetter); - } - }(window)); - } - - var testElement = document.createElement('_'); - - testElement.classList.add('c1', 'c2'); - - if (!testElement.classList.contains('c2')) { - var _add = DOMTokenList.prototype.add, - _remove = DOMTokenList.prototype.remove; - - DOMTokenList.prototype.add = function () { - Array.prototype.forEach.call(arguments, _add.bind(this)); - } - - DOMTokenList.prototype.remove = function () { - Array.prototype.forEach.call(arguments, _remove.bind(this)); - } - } - - testElement.classList.toggle('c3', false); - - // Polyfill for IE 10 and Firefox <24, where classList.toggle does not - // support the second argument. - if (testElement.classList.contains('c3')) { - var _toggle = DOMTokenList.prototype.toggle; - - DOMTokenList.prototype.toggle = function (token, force) { - if (1 in arguments && !this.contains(token) === !force) { - return force; - } else { - return _toggle.call(this, token); - } - }; - } - - testElement = null; - - // shallow array comparison - function isEqual (array1, array2) { - return array1.length === array2.length && array1.every(function (element, index) { - return element === array2[index]; - }); - }; - - // - if (!String.prototype.startsWith) { - (function () { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var defineProperty = (function () { - // IE 8 only supports `Object.defineProperty` on DOM elements - try { - var object = {}; - var $defineProperty = Object.defineProperty; - var result = $defineProperty(object, object, object) && $defineProperty; - } catch (error) { - } - return result; - }()); - var toString = {}.toString; - var startsWith = function (search) { - if (this == null) { - throw new TypeError(); - } - var string = String(this); - if (search && toString.call(search) == '[object RegExp]') { - throw new TypeError(); - } - var stringLength = string.length; - var searchString = String(search); - var searchLength = searchString.length; - var position = arguments.length > 1 ? arguments[1] : undefined; - // `ToInteger` - var pos = position ? Number(position) : 0; - if (pos != pos) { // better `isNaN` - pos = 0; - } - var start = Math.min(Math.max(pos, 0), stringLength); - // Avoid the `indexOf` call if no match is possible - if (searchLength + start > stringLength) { - return false; - } - var index = -1; - while (++index < searchLength) { - if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) { - return false; - } - } - return true; - }; - if (defineProperty) { - defineProperty(String.prototype, 'startsWith', { - 'value': startsWith, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.startsWith = startsWith; - } - }()); - } - - if (!Object.keys) { - Object.keys = function ( - o, // object - k, // key - r // result array - ) { - // initialize object and result - r = []; - // iterate over object keys - for (k in o) { - // fill result array with non-prototypical keys - r.hasOwnProperty.call(o, k) && r.push(k); - } - // return result - return r; - }; - } - - if (HTMLSelectElement && !HTMLSelectElement.prototype.hasOwnProperty('selectedOptions')) { - Object.defineProperty(HTMLSelectElement.prototype, 'selectedOptions', { - get: function () { - return this.querySelectorAll(':checked'); - } - }); - } - - function getSelectedOptions (select, ignoreDisabled) { - var selectedOptions = select.selectedOptions, - options = [], - opt; - - if (ignoreDisabled) { - for (var i = 0, len = selectedOptions.length; i < len; i++) { - opt = selectedOptions[i]; - - if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { - options.push(opt); - } - } - - return options; - } - - return selectedOptions; - } - - // much faster than $.val() - function getSelectValues (select, selectedOptions) { - var value = [], - options = selectedOptions || select.selectedOptions, - opt; - - for (var i = 0, len = options.length; i < len; i++) { - opt = options[i]; - - if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) { - value.push(opt.value); - } - } - - if (!select.multiple) { - return !value.length ? null : value[0]; - } - - return value; - } - - // set data-selected on select element if the value has been programmatically selected - // prior to initialization of bootstrap-select - // * consider removing or replacing an alternative method * - var valHooks = { - useDefault: false, - _set: $.valHooks.select.set - }; - - $.valHooks.select.set = function (elem, value) { - if (value && !valHooks.useDefault) $(elem).data('selected', true); - - return valHooks._set.apply(this, arguments); - }; - - var changedArguments = null; - - var EventIsSupported = (function () { - try { - new Event('change'); - return true; - } catch (e) { - return false; - } - })(); - - $.fn.triggerNative = function (eventName) { - var el = this[0], - event; - - if (el.dispatchEvent) { // for modern browsers & IE9+ - if (EventIsSupported) { - // For modern browsers - event = new Event(eventName, { - bubbles: true - }); - } else { - // For IE since it doesn't support Event constructor - event = document.createEvent('Event'); - event.initEvent(eventName, true, false); - } - - el.dispatchEvent(event); - } else if (el.fireEvent) { // for IE8 - event = document.createEventObject(); - event.eventType = eventName; - el.fireEvent('on' + eventName, event); - } else { - // fall back to jQuery.trigger - this.trigger(eventName); - } - }; - // - - function stringSearch (li, searchString, method, normalize) { - var stringTypes = [ - 'display', - 'subtext', - 'tokens' - ], - searchSuccess = false; - - for (var i = 0; i < stringTypes.length; i++) { - var stringType = stringTypes[i], - string = li[stringType]; - - if (string) { - string = string.toString(); - - // Strip HTML tags. This isn't perfect, but it's much faster than any other method - if (stringType === 'display') { - string = string.replace(/<[^>]+>/g, ''); - } - - if (normalize) string = normalizeToBase(string); - string = string.toUpperCase(); - - if (method === 'contains') { - searchSuccess = string.indexOf(searchString) >= 0; - } else { - searchSuccess = string.startsWith(searchString); - } - - if (searchSuccess) break; - } - } - - return searchSuccess; - } - - function toInteger (value) { - return parseInt(value, 10) || 0; - } - - // Borrowed from Lodash (_.deburr) - /** Used to map Latin Unicode letters to basic Latin letters. */ - var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 's' - }; - - /** Used to match Latin Unicode letters (excluding mathematical operators). */ - var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - - /** Used to compose unicode character classes. */ - var rsComboMarksRange = '\\u0300-\\u036f', - reComboHalfMarksRange = '\\ufe20-\\ufe2f', - rsComboSymbolsRange = '\\u20d0-\\u20ff', - rsComboMarksExtendedRange = '\\u1ab0-\\u1aff', - rsComboMarksSupplementRange = '\\u1dc0-\\u1dff', - rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange; - - /** Used to compose unicode capture groups. */ - var rsCombo = '[' + rsComboRange + ']'; - - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ - var reComboMark = RegExp(rsCombo, 'g'); - - function deburrLetter (key) { - return deburredLetters[key]; - }; - - function normalizeToBase (string) { - string = string.toString(); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); - } - - // List of HTML entities for escaping. - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - - // Functions for escaping and unescaping strings to/from HTML interpolation. - var createEscaper = function (map) { - var escaper = function (match) { - return map[match]; - }; - // Regexes for identifying a key that needs to be escaped. - var source = '(?:' + Object.keys(map).join('|') + ')'; - var testRegexp = RegExp(source); - var replaceRegexp = RegExp(source, 'g'); - return function (string) { - string = string == null ? '' : '' + string; - return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; - }; - }; - - var htmlEscape = createEscaper(escapeMap); - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - - var keyCodeMap = { - 32: ' ', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 59: ';', - 65: 'A', - 66: 'B', - 67: 'C', - 68: 'D', - 69: 'E', - 70: 'F', - 71: 'G', - 72: 'H', - 73: 'I', - 74: 'J', - 75: 'K', - 76: 'L', - 77: 'M', - 78: 'N', - 79: 'O', - 80: 'P', - 81: 'Q', - 82: 'R', - 83: 'S', - 84: 'T', - 85: 'U', - 86: 'V', - 87: 'W', - 88: 'X', - 89: 'Y', - 90: 'Z', - 96: '0', - 97: '1', - 98: '2', - 99: '3', - 100: '4', - 101: '5', - 102: '6', - 103: '7', - 104: '8', - 105: '9' - }; - - var keyCodes = { - ESCAPE: 27, // KeyboardEvent.which value for Escape (Esc) key - ENTER: 13, // KeyboardEvent.which value for Enter key - SPACE: 32, // KeyboardEvent.which value for space key - TAB: 9, // KeyboardEvent.which value for tab key - ARROW_UP: 38, // KeyboardEvent.which value for up arrow key - ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key - } - - var version = { - success: false, - major: '3' - }; - - try { - version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); - version.major = version.full[0]; - version.success = true; - } catch (err) { - // do nothing - } - - var selectId = 0; - - var EVENT_KEY = '.bs.select'; - - var classNames = { - DISABLED: 'disabled', - DIVIDER: 'divider', - SHOW: 'open', - DROPUP: 'dropup', - MENU: 'dropdown-menu', - MENURIGHT: 'dropdown-menu-right', - MENULEFT: 'dropdown-menu-left', - // to-do: replace with more advanced template/customization options - BUTTONCLASS: 'btn-default', - POPOVERHEADER: 'popover-title', - ICONBASE: 'glyphicon', - TICKICON: 'glyphicon-ok' - } - - var Selector = { - MENU: '.' + classNames.MENU - } - - var elementTemplates = { - div: document.createElement('div'), - span: document.createElement('span'), - i: document.createElement('i'), - subtext: document.createElement('small'), - a: document.createElement('a'), - li: document.createElement('li'), - whitespace: document.createTextNode('\u00A0'), - fragment: document.createDocumentFragment() - } - - elementTemplates.noResults = elementTemplates.li.cloneNode(false); - elementTemplates.noResults.className = 'no-results'; - - elementTemplates.a.setAttribute('role', 'option'); - elementTemplates.a.className = 'dropdown-item'; - - elementTemplates.subtext.className = 'text-muted'; - - elementTemplates.text = elementTemplates.span.cloneNode(false); - elementTemplates.text.className = 'text'; - - elementTemplates.checkMark = elementTemplates.span.cloneNode(false); - - var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN); - var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE); - - var generateOption = { - li: function (content, classes, optgroup) { - var li = elementTemplates.li.cloneNode(false); - - if (content) { - if (content.nodeType === 1 || content.nodeType === 11) { - li.appendChild(content); - } else { - li.innerHTML = content; - } - } - - if (typeof classes !== 'undefined' && classes !== '') li.className = classes; - if (typeof optgroup !== 'undefined' && optgroup !== null) li.classList.add('optgroup-' + optgroup); - - return li; - }, - - a: function (text, classes, inline) { - var a = elementTemplates.a.cloneNode(true); - - if (text) { - if (text.nodeType === 11) { - a.appendChild(text); - } else { - a.insertAdjacentHTML('beforeend', text); - } - } - - if (typeof classes !== 'undefined' && classes !== '') a.classList.add.apply(a.classList, classes.split(/\s+/)); - if (inline) a.setAttribute('style', inline); - - return a; - }, - - text: function (options, useFragment) { - var textElement = elementTemplates.text.cloneNode(false), - subtextElement, - iconElement; - - if (options.content) { - textElement.innerHTML = options.content; - } else { - textElement.textContent = options.text; - - if (options.icon) { - var whitespace = elementTemplates.whitespace.cloneNode(false); - - // need to use for icons in the button to prevent a breaking change - // note: switch to span in next major release - iconElement = (useFragment === true ? elementTemplates.i : elementTemplates.span).cloneNode(false); - iconElement.className = this.options.iconBase + ' ' + options.icon; - - elementTemplates.fragment.appendChild(iconElement); - elementTemplates.fragment.appendChild(whitespace); - } - - if (options.subtext) { - subtextElement = elementTemplates.subtext.cloneNode(false); - subtextElement.textContent = options.subtext; - textElement.appendChild(subtextElement); - } - } - - if (useFragment === true) { - while (textElement.childNodes.length > 0) { - elementTemplates.fragment.appendChild(textElement.childNodes[0]); - } - } else { - elementTemplates.fragment.appendChild(textElement); - } - - return elementTemplates.fragment; - }, - - label: function (options) { - var textElement = elementTemplates.text.cloneNode(false), - subtextElement, - iconElement; - - textElement.innerHTML = options.display; - - if (options.icon) { - var whitespace = elementTemplates.whitespace.cloneNode(false); - - iconElement = elementTemplates.span.cloneNode(false); - iconElement.className = this.options.iconBase + ' ' + options.icon; - - elementTemplates.fragment.appendChild(iconElement); - elementTemplates.fragment.appendChild(whitespace); - } - - if (options.subtext) { - subtextElement = elementTemplates.subtext.cloneNode(false); - subtextElement.textContent = options.subtext; - textElement.appendChild(subtextElement); - } - - elementTemplates.fragment.appendChild(textElement); - - return elementTemplates.fragment; - } - } - - function showNoResults (searchMatch, searchValue) { - if (!searchMatch.length) { - elementTemplates.noResults.innerHTML = this.options.noneResultsText.replace('{0}', '"' + htmlEscape(searchValue) + '"'); - this.$menuInner[0].firstChild.appendChild(elementTemplates.noResults); - } - } - - var Selectpicker = function (element, options) { - var that = this; - - // bootstrap-select has been initialized - revert valHooks.select.set back to its original function - if (!valHooks.useDefault) { - $.valHooks.select.set = valHooks._set; - valHooks.useDefault = true; - } - - this.$element = $(element); - this.$newElement = null; - this.$button = null; - this.$menu = null; - this.options = options; - this.selectpicker = { - main: {}, - search: {}, - current: {}, // current changes if a search is in progress - view: {}, - isSearching: false, - keydown: { - keyHistory: '', - resetKeyHistory: { - start: function () { - return setTimeout(function () { - that.selectpicker.keydown.keyHistory = ''; - }, 800); - } - } - } - }; - - this.sizeInfo = {}; - - // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a - // data-attribute) - if (this.options.title === null) { - this.options.title = this.$element.attr('title'); - } - - // Format window padding - var winPad = this.options.windowPadding; - if (typeof winPad === 'number') { - this.options.windowPadding = [winPad, winPad, winPad, winPad]; - } - - // Expose public methods - this.val = Selectpicker.prototype.val; - this.render = Selectpicker.prototype.render; - this.refresh = Selectpicker.prototype.refresh; - this.setStyle = Selectpicker.prototype.setStyle; - this.selectAll = Selectpicker.prototype.selectAll; - this.deselectAll = Selectpicker.prototype.deselectAll; - this.destroy = Selectpicker.prototype.destroy; - this.remove = Selectpicker.prototype.remove; - this.show = Selectpicker.prototype.show; - this.hide = Selectpicker.prototype.hide; - - this.init(); - }; - - Selectpicker.VERSION = '1.13.18'; - - // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both. - Selectpicker.DEFAULTS = { - noneSelectedText: 'Nothing selected', - noneResultsText: 'No results matched {0}', - countSelectedText: function (numSelected, numTotal) { - return (numSelected == 1) ? '{0} item selected' : '{0} items selected'; - }, - maxOptionsText: function (numAll, numGroup) { - return [ - (numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', - (numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)' - ]; - }, - selectAllText: 'Select All', - deselectAllText: 'Deselect All', - doneButton: false, - doneButtonText: 'Close', - multipleSeparator: ', ', - styleBase: 'btn', - style: classNames.BUTTONCLASS, - size: 'auto', - title: null, - selectedTextFormat: 'values', - width: false, - container: false, - hideDisabled: false, - showSubtext: false, - showIcon: true, - showContent: true, - dropupAuto: true, - header: false, - liveSearch: false, - liveSearchPlaceholder: null, - liveSearchNormalize: false, - liveSearchStyle: 'contains', - actionsBox: false, - iconBase: classNames.ICONBASE, - tickIcon: classNames.TICKICON, - showTick: false, - template: { - caret: '' - }, - maxOptions: false, - mobile: false, - selectOnTab: false, - dropdownAlignRight: false, - windowPadding: 0, - virtualScroll: 600, - display: false, - sanitize: true, - sanitizeFn: null, - whiteList: DefaultWhitelist - }; - - Selectpicker.prototype = { - - constructor: Selectpicker, - - init: function () { - var that = this, - id = this.$element.attr('id'), - element = this.$element[0], - form = element.form; - - selectId++; - this.selectId = 'bs-select-' + selectId; - - element.classList.add('bs-select-hidden'); - - this.multiple = this.$element.prop('multiple'); - this.autofocus = this.$element.prop('autofocus'); - - if (element.classList.contains('show-tick')) { - this.options.showTick = true; - } - - this.$newElement = this.createDropdown(); - this.buildData(); - this.$element - .after(this.$newElement) - .prependTo(this.$newElement); - - // ensure select is associated with form element if it got unlinked after moving it inside newElement - if (form && element.form === null) { - if (!form.id) form.id = 'form-' + this.selectId; - element.setAttribute('form', form.id); - } - - this.$button = this.$newElement.children('button'); - this.$menu = this.$newElement.children(Selector.MENU); - this.$menuInner = this.$menu.children('.inner'); - this.$searchbox = this.$menu.find('input'); - - element.classList.remove('bs-select-hidden'); - - if (this.options.dropdownAlignRight === true) this.$menu[0].classList.add(classNames.MENURIGHT); - - if (typeof id !== 'undefined') { - this.$button.attr('data-id', id); - } - - this.checkDisabled(); - this.clickListener(); - - if (this.options.liveSearch) { - this.liveSearchListener(); - this.focusedParent = this.$searchbox[0]; - } else { - this.focusedParent = this.$menuInner[0]; - } - - this.setStyle(); - this.render(); - this.setWidth(); - if (this.options.container) { - this.selectPosition(); - } else { - this.$element.on('hide' + EVENT_KEY, function () { - if (that.isVirtual()) { - // empty menu on close - var menuInner = that.$menuInner[0], - emptyMenu = menuInner.firstChild.cloneNode(false); - - // replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = '' - menuInner.replaceChild(emptyMenu, menuInner.firstChild); - menuInner.scrollTop = 0; - } - }); - } - this.$menu.data('this', this); - this.$newElement.data('this', this); - if (this.options.mobile) this.mobile(); - - this.$newElement.on({ - 'hide.bs.dropdown': function (e) { - that.$element.trigger('hide' + EVENT_KEY, e); - }, - 'hidden.bs.dropdown': function (e) { - that.$element.trigger('hidden' + EVENT_KEY, e); - }, - 'show.bs.dropdown': function (e) { - that.$element.trigger('show' + EVENT_KEY, e); - }, - 'shown.bs.dropdown': function (e) { - that.$element.trigger('shown' + EVENT_KEY, e); - } - }); - - if (element.hasAttribute('required')) { - this.$element.on('invalid' + EVENT_KEY, function () { - that.$button[0].classList.add('bs-invalid'); - - that.$element - .on('shown' + EVENT_KEY + '.invalid', function () { - that.$element - .val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened - .off('shown' + EVENT_KEY + '.invalid'); - }) - .on('rendered' + EVENT_KEY, function () { - // if select is no longer invalid, remove the bs-invalid class - if (this.validity.valid) that.$button[0].classList.remove('bs-invalid'); - that.$element.off('rendered' + EVENT_KEY); - }); - - that.$button.on('blur' + EVENT_KEY, function () { - that.$element.trigger('focus').trigger('blur'); - that.$button.off('blur' + EVENT_KEY); - }); - }); - } - - setTimeout(function () { - that.buildList(); - that.$element.trigger('loaded' + EVENT_KEY); - }); - }, - - createDropdown: function () { - // Options - // If we are multiple or showTick option is set, then add the show-tick class - var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '', - multiselectable = this.multiple ? ' aria-multiselectable="true"' : '', - inputGroup = '', - autofocus = this.autofocus ? ' autofocus' : ''; - - if (version.major < 4 && this.$element.parent().hasClass('input-group')) { - inputGroup = ' input-group-btn'; - } - - // Elements - var drop, - header = '', - searchbox = '', - actionsbox = '', - donebutton = ''; - - if (this.options.header) { - header = - '
    ' + - '' + - this.options.header + - '
    '; - } - - if (this.options.liveSearch) { - searchbox = - ''; - } - - if (this.multiple && this.options.actionsBox) { - actionsbox = - '
    ' + - '
    ' + - '' + - '' + - '
    ' + - '
    '; - } - - if (this.multiple && this.options.doneButton) { - donebutton = - '
    ' + - '
    ' + - '' + - '
    ' + - '
    '; - } - - drop = - ''; - - return $(drop); - }, - - setPositionData: function () { - this.selectpicker.view.canHighlight = []; - this.selectpicker.view.size = 0; - this.selectpicker.view.firstHighlightIndex = false; - - for (var i = 0; i < this.selectpicker.current.data.length; i++) { - var li = this.selectpicker.current.data[i], - canHighlight = true; - - if (li.type === 'divider') { - canHighlight = false; - li.height = this.sizeInfo.dividerHeight; - } else if (li.type === 'optgroup-label') { - canHighlight = false; - li.height = this.sizeInfo.dropdownHeaderHeight; - } else { - li.height = this.sizeInfo.liHeight; - } - - if (li.disabled) canHighlight = false; - - this.selectpicker.view.canHighlight.push(canHighlight); - - if (canHighlight) { - this.selectpicker.view.size++; - li.posinset = this.selectpicker.view.size; - if (this.selectpicker.view.firstHighlightIndex === false) this.selectpicker.view.firstHighlightIndex = i; - } - - li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height; - } - }, - - isVirtual: function () { - return (this.options.virtualScroll !== false) && (this.selectpicker.main.elements.length >= this.options.virtualScroll) || this.options.virtualScroll === true; - }, - - createView: function (isSearching, setSize, refresh) { - var that = this, - scrollTop = 0, - active = [], - selected, - prevActive; - - this.selectpicker.isSearching = isSearching; - this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main; - - this.setPositionData(); - - if (setSize) { - if (refresh) { - scrollTop = this.$menuInner[0].scrollTop; - } else if (!that.multiple) { - var element = that.$element[0], - selectedIndex = (element.options[element.selectedIndex] || {}).liIndex; - - if (typeof selectedIndex === 'number' && that.options.size !== false) { - var selectedData = that.selectpicker.main.data[selectedIndex], - position = selectedData && selectedData.position; - - if (position) { - scrollTop = position - ((that.sizeInfo.menuInnerHeight + that.sizeInfo.liHeight) / 2); - } - } - } - } - - scroll(scrollTop, true); - - this.$menuInner.off('scroll.createView').on('scroll.createView', function (e, updateValue) { - if (!that.noScroll) scroll(this.scrollTop, updateValue); - that.noScroll = false; - }); - - function scroll (scrollTop, init) { - var size = that.selectpicker.current.elements.length, - chunks = [], - chunkSize, - chunkCount, - firstChunk, - lastChunk, - currentChunk, - prevPositions, - positionIsDifferent, - previousElements, - menuIsDifferent = true, - isVirtual = that.isVirtual(); - - that.selectpicker.view.scrollTop = scrollTop; - - chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk - chunkCount = Math.round(size / chunkSize) || 1; // number of chunks - - for (var i = 0; i < chunkCount; i++) { - var endOfChunk = (i + 1) * chunkSize; - - if (i === chunkCount - 1) { - endOfChunk = size; - } - - chunks[i] = [ - (i) * chunkSize + (!i ? 0 : 1), - endOfChunk - ]; - - if (!size) break; - - if (currentChunk === undefined && scrollTop - 1 <= that.selectpicker.current.data[endOfChunk - 1].position - that.sizeInfo.menuInnerHeight) { - currentChunk = i; - } - } - - if (currentChunk === undefined) currentChunk = 0; - - prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1]; - - // always display previous, current, and next chunks - firstChunk = Math.max(0, currentChunk - 1); - lastChunk = Math.min(chunkCount - 1, currentChunk + 1); - - that.selectpicker.view.position0 = isVirtual === false ? 0 : (Math.max(0, chunks[firstChunk][0]) || 0); - that.selectpicker.view.position1 = isVirtual === false ? size : (Math.min(size, chunks[lastChunk][1]) || 0); - - positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1; - - if (that.activeIndex !== undefined) { - prevActive = that.selectpicker.main.elements[that.prevActiveIndex]; - active = that.selectpicker.main.elements[that.activeIndex]; - selected = that.selectpicker.main.elements[that.selectedIndex]; - - if (init) { - if (that.activeIndex !== that.selectedIndex) { - that.defocusItem(active); - } - that.activeIndex = undefined; - } - - if (that.activeIndex && that.activeIndex !== that.selectedIndex) { - that.defocusItem(selected); - } - } - - if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex) { - that.defocusItem(prevActive); - } - - if (init || positionIsDifferent) { - previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : []; - - if (isVirtual === false) { - that.selectpicker.view.visibleElements = that.selectpicker.current.elements; - } else { - that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1); - } - - that.setOptionStatus(); - - // if searching, check to make sure the list has actually been updated before updating DOM - // this prevents unnecessary repaints - if (isSearching || (isVirtual === false && init)) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements); - - // if virtual scroll is disabled and not searching, - // menu should never need to be updated more than once - if ((init || isVirtual === true) && menuIsDifferent) { - var menuInner = that.$menuInner[0], - menuFragment = document.createDocumentFragment(), - emptyMenu = menuInner.firstChild.cloneNode(false), - marginTop, - marginBottom, - elements = that.selectpicker.view.visibleElements, - toSanitize = []; - - // replace the existing UL with an empty one - this is faster than $.empty() - menuInner.replaceChild(emptyMenu, menuInner.firstChild); - - for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) { - var element = elements[i], - elText, - elementData; - - if (that.options.sanitize) { - elText = element.lastChild; - - if (elText) { - elementData = that.selectpicker.current.data[i + that.selectpicker.view.position0]; - - if (elementData && elementData.content && !elementData.sanitized) { - toSanitize.push(elText); - elementData.sanitized = true; - } - } - } - - menuFragment.appendChild(element); - } - - if (that.options.sanitize && toSanitize.length) { - sanitizeHtml(toSanitize, that.options.whiteList, that.options.sanitizeFn); - } - - if (isVirtual === true) { - marginTop = (that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position); - marginBottom = (that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position); - - menuInner.firstChild.style.marginTop = marginTop + 'px'; - menuInner.firstChild.style.marginBottom = marginBottom + 'px'; - } else { - menuInner.firstChild.style.marginTop = 0; - menuInner.firstChild.style.marginBottom = 0; - } - - menuInner.firstChild.appendChild(menuFragment); - - // if an option is encountered that is wider than the current menu width, update the menu width accordingly - // switch to ResizeObserver with increased browser support - if (isVirtual === true && that.sizeInfo.hasScrollBar) { - var menuInnerInnerWidth = menuInner.firstChild.offsetWidth; - - if (init && menuInnerInnerWidth < that.sizeInfo.menuInnerInnerWidth && that.sizeInfo.totalMenuWidth > that.sizeInfo.selectWidth) { - menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px'; - } else if (menuInnerInnerWidth > that.sizeInfo.menuInnerInnerWidth) { - // set to 0 to get actual width of menu - that.$menu[0].style.minWidth = 0; - - var actualMenuWidth = menuInner.firstChild.offsetWidth; - - if (actualMenuWidth > that.sizeInfo.menuInnerInnerWidth) { - that.sizeInfo.menuInnerInnerWidth = actualMenuWidth; - menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px'; - } - - // reset to default CSS styling - that.$menu[0].style.minWidth = ''; - } - } - } - } - - that.prevActiveIndex = that.activeIndex; - - if (!that.options.liveSearch) { - that.$menuInner.trigger('focus'); - } else if (isSearching && init) { - var index = 0, - newActive; - - if (!that.selectpicker.view.canHighlight[index]) { - index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true); - } - - newActive = that.selectpicker.view.visibleElements[index]; - - that.defocusItem(that.selectpicker.view.currentActive); - - that.activeIndex = (that.selectpicker.current.data[index] || {}).index; - - that.focusItem(newActive); - } - } - - $(window) - .off('resize' + EVENT_KEY + '.' + this.selectId + '.createView') - .on('resize' + EVENT_KEY + '.' + this.selectId + '.createView', function () { - var isActive = that.$newElement.hasClass(classNames.SHOW); - - if (isActive) scroll(that.$menuInner[0].scrollTop); - }); - }, - - focusItem: function (li, liData, noStyle) { - if (li) { - liData = liData || this.selectpicker.main.data[this.activeIndex]; - var a = li.firstChild; - - if (a) { - a.setAttribute('aria-setsize', this.selectpicker.view.size); - a.setAttribute('aria-posinset', liData.posinset); - - if (noStyle !== true) { - this.focusedParent.setAttribute('aria-activedescendant', a.id); - li.classList.add('active'); - a.classList.add('active'); - } - } - } - }, - - defocusItem: function (li) { - if (li) { - li.classList.remove('active'); - if (li.firstChild) li.firstChild.classList.remove('active'); - } - }, - - setPlaceholder: function () { - var that = this, - updateIndex = false; - - if (this.options.title && !this.multiple) { - if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option'); - - // this option doesn't create a new
  • element, but does add a new option at the start, - // so startIndex should increase to prevent having to check every option for the bs-title-option class - updateIndex = true; - - var element = this.$element[0], - selectTitleOption = false, - titleNotAppended = !this.selectpicker.view.titleOption.parentNode, - selectedIndex = element.selectedIndex, - selectedOption = element.options[selectedIndex], - navigation = window.performance && window.performance.getEntriesByType('navigation'), - // Safari doesn't support getEntriesByType('navigation') - fall back to performance.navigation - isNotBackForward = (navigation && navigation.length) ? navigation[0].type !== 'back_forward' : window.performance.navigation.type !== 2; - - if (titleNotAppended) { - // Use native JS to prepend option (faster) - this.selectpicker.view.titleOption.className = 'bs-title-option'; - this.selectpicker.view.titleOption.value = ''; - - // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option. - // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs, - // if so, the select will have the data-selected attribute - selectTitleOption = !selectedOption || (selectedIndex === 0 && selectedOption.defaultSelected === false && this.$element.data('selected') === undefined); - } - - if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) { - element.insertBefore(this.selectpicker.view.titleOption, element.firstChild); - } - - // Set selected *after* appending to select, - // otherwise the option doesn't get selected in IE - // set using selectedIndex, as setting the selected attr to true here doesn't work in IE11 - if (selectTitleOption && isNotBackForward) { - element.selectedIndex = 0; - } else if (document.readyState !== 'complete') { - // if navigation type is back_forward, there's a chance the select will have its value set by BFCache - // wait for that value to be set, then run render again - window.addEventListener('pageshow', function () { - if (that.selectpicker.view.displayedValue !== element.value) that.render(); - }); - } - } - - return updateIndex; - }, - - buildData: function () { - var optionSelector = ':not([hidden]):not([data-hidden="true"])', - mainData = [], - optID = 0, - startIndex = this.setPlaceholder() ? 1 : 0; // append the titleOption if necessary and skip the first option in the loop - - if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; - - var selectOptions = this.$element[0].querySelectorAll('select > *' + optionSelector); - - function addDivider (config) { - var previousData = mainData[mainData.length - 1]; - - // ensure optgroup doesn't create back-to-back dividers - if ( - previousData && - previousData.type === 'divider' && - (previousData.optID || config.optID) - ) { - return; - } - - config = config || {}; - config.type = 'divider'; - - mainData.push(config); - } - - function addOption (option, config) { - config = config || {}; - - config.divider = option.getAttribute('data-divider') === 'true'; - - if (config.divider) { - addDivider({ - optID: config.optID - }); - } else { - var liIndex = mainData.length, - cssText = option.style.cssText, - inlineStyle = cssText ? htmlEscape(cssText) : '', - optionClass = (option.className || '') + (config.optgroupClass || ''); - - if (config.optID) optionClass = 'opt ' + optionClass; - - config.optionClass = optionClass.trim(); - config.inlineStyle = inlineStyle; - config.text = option.textContent; - - config.content = option.getAttribute('data-content'); - config.tokens = option.getAttribute('data-tokens'); - config.subtext = option.getAttribute('data-subtext'); - config.icon = option.getAttribute('data-icon'); - - option.liIndex = liIndex; - - config.display = config.content || config.text; - config.type = 'option'; - config.index = liIndex; - config.option = option; - config.selected = !!option.selected; - config.disabled = config.disabled || !!option.disabled; - - mainData.push(config); - } - } - - function addOptgroup (index, selectOptions) { - var optgroup = selectOptions[index], - // skip placeholder option - previous = index - 1 < startIndex ? false : selectOptions[index - 1], - next = selectOptions[index + 1], - options = optgroup.querySelectorAll('option' + optionSelector); - - if (!options.length) return; - - var config = { - display: htmlEscape(optgroup.label), - subtext: optgroup.getAttribute('data-subtext'), - icon: optgroup.getAttribute('data-icon'), - type: 'optgroup-label', - optgroupClass: ' ' + (optgroup.className || '') - }, - headerIndex, - lastIndex; - - optID++; - - if (previous) { - addDivider({ optID: optID }); - } - - config.optID = optID; - - mainData.push(config); - - for (var j = 0, len = options.length; j < len; j++) { - var option = options[j]; - - if (j === 0) { - headerIndex = mainData.length - 1; - lastIndex = headerIndex + len; - } - - addOption(option, { - headerIndex: headerIndex, - lastIndex: lastIndex, - optID: config.optID, - optgroupClass: config.optgroupClass, - disabled: optgroup.disabled - }); - } - - if (next) { - addDivider({ optID: optID }); - } - } - - for (var len = selectOptions.length, i = startIndex; i < len; i++) { - var item = selectOptions[i]; - - if (item.tagName !== 'OPTGROUP') { - addOption(item, {}); - } else { - addOptgroup(i, selectOptions); - } - } - - this.selectpicker.main.data = this.selectpicker.current.data = mainData; - }, - - buildList: function () { - var that = this, - selectData = this.selectpicker.main.data, - mainElements = [], - widestOptionLength = 0; - - if ((that.options.showTick || that.multiple) && !elementTemplates.checkMark.parentNode) { - elementTemplates.checkMark.className = this.options.iconBase + ' ' + that.options.tickIcon + ' check-mark'; - elementTemplates.a.appendChild(elementTemplates.checkMark); - } - - function buildElement (item) { - var liElement, - combinedLength = 0; - - switch (item.type) { - case 'divider': - liElement = generateOption.li( - false, - classNames.DIVIDER, - (item.optID ? item.optID + 'div' : undefined) - ); - - break; - - case 'option': - liElement = generateOption.li( - generateOption.a( - generateOption.text.call(that, item), - item.optionClass, - item.inlineStyle - ), - '', - item.optID - ); - - if (liElement.firstChild) { - liElement.firstChild.id = that.selectId + '-' + item.index; - } - - break; - - case 'optgroup-label': - liElement = generateOption.li( - generateOption.label.call(that, item), - 'dropdown-header' + item.optgroupClass, - item.optID - ); - - break; - } - - item.element = liElement; - mainElements.push(liElement); - - // count the number of characters in the option - not perfect, but should work in most cases - if (item.display) combinedLength += item.display.length; - if (item.subtext) combinedLength += item.subtext.length; - // if there is an icon, ensure this option's width is checked - if (item.icon) combinedLength += 1; - - if (combinedLength > widestOptionLength) { - widestOptionLength = combinedLength; - - // guess which option is the widest - // use this when calculating menu width - // not perfect, but it's fast, and the width will be updating accordingly when scrolling - that.selectpicker.view.widestOption = mainElements[mainElements.length - 1]; - } - } - - for (var len = selectData.length, i = 0; i < len; i++) { - var item = selectData[i]; - - buildElement(item); - } - - this.selectpicker.main.elements = this.selectpicker.current.elements = mainElements; - }, - - findLis: function () { - return this.$menuInner.find('.inner > li'); - }, - - render: function () { - var that = this, - element = this.$element[0], - // ensure titleOption is appended and selected (if necessary) before getting selectedOptions - placeholderSelected = this.setPlaceholder() && element.selectedIndex === 0, - selectedOptions = getSelectedOptions(element, this.options.hideDisabled), - selectedCount = selectedOptions.length, - button = this.$button[0], - buttonInner = button.querySelector('.filter-option-inner-inner'), - multipleSeparator = document.createTextNode(this.options.multipleSeparator), - titleFragment = elementTemplates.fragment.cloneNode(false), - showCount, - countMax, - hasContent = false; - - button.classList.toggle('bs-placeholder', that.multiple ? !selectedCount : !getSelectValues(element, selectedOptions)); - - if (!that.multiple && selectedOptions.length === 1) { - that.selectpicker.view.displayedValue = getSelectValues(element, selectedOptions); - } - - if (this.options.selectedTextFormat === 'static') { - titleFragment = generateOption.text.call(this, { text: this.options.title }, true); - } else { - showCount = this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1 && selectedCount > 1; - - // determine if the number of selected options will be shown (showCount === true) - if (showCount) { - countMax = this.options.selectedTextFormat.split('>'); - showCount = (countMax.length > 1 && selectedCount > countMax[1]) || (countMax.length === 1 && selectedCount >= 2); - } - - // only loop through all selected options if the count won't be shown - if (showCount === false) { - if (!placeholderSelected) { - for (var selectedIndex = 0; selectedIndex < selectedCount; selectedIndex++) { - if (selectedIndex < 50) { - var option = selectedOptions[selectedIndex], - thisData = this.selectpicker.main.data[option.liIndex], - titleOptions = {}; - - if (this.multiple && selectedIndex > 0) { - titleFragment.appendChild(multipleSeparator.cloneNode(false)); - } - - if (option.title) { - titleOptions.text = option.title; - } else if (thisData) { - if (thisData.content && that.options.showContent) { - titleOptions.content = thisData.content.toString(); - hasContent = true; - } else { - if (that.options.showIcon) { - titleOptions.icon = thisData.icon; - } - if (that.options.showSubtext && !that.multiple && thisData.subtext) titleOptions.subtext = ' ' + thisData.subtext; - titleOptions.text = option.textContent.trim(); - } - } - - titleFragment.appendChild(generateOption.text.call(this, titleOptions, true)); - } else { - break; - } - } - - // add ellipsis - if (selectedCount > 49) { - titleFragment.appendChild(document.createTextNode('...')); - } - } - } else { - var optionSelector = ':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])'; - if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; - - // If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc. - var totalCount = this.$element[0].querySelectorAll('select > option' + optionSelector + ', optgroup' + optionSelector + ' option' + optionSelector).length, - tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedCount, totalCount) : this.options.countSelectedText; - - titleFragment = generateOption.text.call(this, { - text: tr8nText.replace('{0}', selectedCount.toString()).replace('{1}', totalCount.toString()) - }, true); - } - } - - if (this.options.title == undefined) { - // use .attr to ensure undefined is returned if title attribute is not set - this.options.title = this.$element.attr('title'); - } - - // If the select doesn't have a title, then use the default, or if nothing is set at all, use noneSelectedText - if (!titleFragment.childNodes.length) { - titleFragment = generateOption.text.call(this, { - text: typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText - }, true); - } - - // strip all HTML tags and trim the result, then unescape any escaped tags - button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim(); - - if (this.options.sanitize && hasContent) { - sanitizeHtml([titleFragment], that.options.whiteList, that.options.sanitizeFn); - } - - buttonInner.innerHTML = ''; - buttonInner.appendChild(titleFragment); - - if (version.major < 4 && this.$newElement[0].classList.contains('bs3-has-addon')) { - var filterExpand = button.querySelector('.filter-expand'), - clone = buttonInner.cloneNode(true); - - clone.className = 'filter-expand'; - - if (filterExpand) { - button.replaceChild(clone, filterExpand); - } else { - button.appendChild(clone); - } - } - - this.$element.trigger('rendered' + EVENT_KEY); - }, - - /** - * @param [style] - * @param [status] - */ - setStyle: function (newStyle, status) { - var button = this.$button[0], - newElement = this.$newElement[0], - style = this.options.style.trim(), - buttonClass; - - if (this.$element.attr('class')) { - this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, '')); - } - - if (version.major < 4) { - newElement.classList.add('bs3'); - - if (newElement.parentNode.classList && newElement.parentNode.classList.contains('input-group') && - (newElement.previousElementSibling || newElement.nextElementSibling) && - (newElement.previousElementSibling || newElement.nextElementSibling).classList.contains('input-group-addon') - ) { - newElement.classList.add('bs3-has-addon'); - } - } - - if (newStyle) { - buttonClass = newStyle.trim(); - } else { - buttonClass = style; - } - - if (status == 'add') { - if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); - } else if (status == 'remove') { - if (buttonClass) button.classList.remove.apply(button.classList, buttonClass.split(' ')); - } else { - if (style) button.classList.remove.apply(button.classList, style.split(' ')); - if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' ')); - } - }, - - liHeight: function (refresh) { - if (!refresh && (this.options.size === false || Object.keys(this.sizeInfo).length)) return; - - var newElement = elementTemplates.div.cloneNode(false), - menu = elementTemplates.div.cloneNode(false), - menuInner = elementTemplates.div.cloneNode(false), - menuInnerInner = document.createElement('ul'), - divider = elementTemplates.li.cloneNode(false), - dropdownHeader = elementTemplates.li.cloneNode(false), - li, - a = elementTemplates.a.cloneNode(false), - text = elementTemplates.span.cloneNode(false), - header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null, - search = this.options.liveSearch ? elementTemplates.div.cloneNode(false) : null, - actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null, - doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null, - firstOption = this.$element.find('option')[0]; - - this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth; - - text.className = 'text'; - a.className = 'dropdown-item ' + (firstOption ? firstOption.className : ''); - newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW; - newElement.style.width = 0; // ensure button width doesn't affect natural width of menu when calculating - if (this.options.width === 'auto') menu.style.minWidth = 0; - menu.className = classNames.MENU + ' ' + classNames.SHOW; - menuInner.className = 'inner ' + classNames.SHOW; - menuInnerInner.className = classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : ''); - divider.className = classNames.DIVIDER; - dropdownHeader.className = 'dropdown-header'; - - text.appendChild(document.createTextNode('\u200b')); - - if (this.selectpicker.current.data.length) { - for (var i = 0; i < this.selectpicker.current.data.length; i++) { - var data = this.selectpicker.current.data[i]; - if (data.type === 'option') { - li = data.element; - break; - } - } - } else { - li = elementTemplates.li.cloneNode(false); - a.appendChild(text); - li.appendChild(a); - } - - dropdownHeader.appendChild(text.cloneNode(true)); - - if (this.selectpicker.view.widestOption) { - menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true)); - } - - menuInnerInner.appendChild(li); - menuInnerInner.appendChild(divider); - menuInnerInner.appendChild(dropdownHeader); - if (header) menu.appendChild(header); - if (search) { - var input = document.createElement('input'); - search.className = 'bs-searchbox'; - input.className = 'form-control'; - search.appendChild(input); - menu.appendChild(search); - } - if (actions) menu.appendChild(actions); - menuInner.appendChild(menuInnerInner); - menu.appendChild(menuInner); - if (doneButton) menu.appendChild(doneButton); - newElement.appendChild(menu); - - document.body.appendChild(newElement); - - var liHeight = li.offsetHeight, - dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0, - headerHeight = header ? header.offsetHeight : 0, - searchHeight = search ? search.offsetHeight : 0, - actionsHeight = actions ? actions.offsetHeight : 0, - doneButtonHeight = doneButton ? doneButton.offsetHeight : 0, - dividerHeight = $(divider).outerHeight(true), - // fall back to jQuery if getComputedStyle is not supported - menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false, - menuWidth = menu.offsetWidth, - $menu = menuStyle ? null : $(menu), - menuPadding = { - vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + - toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + - toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + - toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')), - horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + - toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + - toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + - toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth')) - }, - menuExtras = { - vert: menuPadding.vert + - toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + - toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2, - horiz: menuPadding.horiz + - toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + - toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2 - }, - scrollBarWidth; - - menuInner.style.overflowY = 'scroll'; - - scrollBarWidth = menu.offsetWidth - menuWidth; - - document.body.removeChild(newElement); - - this.sizeInfo.liHeight = liHeight; - this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight; - this.sizeInfo.headerHeight = headerHeight; - this.sizeInfo.searchHeight = searchHeight; - this.sizeInfo.actionsHeight = actionsHeight; - this.sizeInfo.doneButtonHeight = doneButtonHeight; - this.sizeInfo.dividerHeight = dividerHeight; - this.sizeInfo.menuPadding = menuPadding; - this.sizeInfo.menuExtras = menuExtras; - this.sizeInfo.menuWidth = menuWidth; - this.sizeInfo.menuInnerInnerWidth = menuWidth - menuPadding.horiz; - this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth; - this.sizeInfo.scrollBarWidth = scrollBarWidth; - this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight; - - this.setPositionData(); - }, - - getSelectPosition: function () { - var that = this, - $window = $(window), - pos = that.$newElement.offset(), - $container = $(that.options.container), - containerPos; - - if (that.options.container && $container.length && !$container.is('body')) { - containerPos = $container.offset(); - containerPos.top += parseInt($container.css('borderTopWidth')); - containerPos.left += parseInt($container.css('borderLeftWidth')); - } else { - containerPos = { top: 0, left: 0 }; - } - - var winPad = that.options.windowPadding; - - this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop(); - this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo.selectHeight - containerPos.top - winPad[2]; - this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft(); - this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo.selectWidth - containerPos.left - winPad[1]; - this.sizeInfo.selectOffsetTop -= winPad[0]; - this.sizeInfo.selectOffsetLeft -= winPad[3]; - }, - - setMenuSize: function (isAuto) { - this.getSelectPosition(); - - var selectWidth = this.sizeInfo.selectWidth, - liHeight = this.sizeInfo.liHeight, - headerHeight = this.sizeInfo.headerHeight, - searchHeight = this.sizeInfo.searchHeight, - actionsHeight = this.sizeInfo.actionsHeight, - doneButtonHeight = this.sizeInfo.doneButtonHeight, - divHeight = this.sizeInfo.dividerHeight, - menuPadding = this.sizeInfo.menuPadding, - menuInnerHeight, - menuHeight, - divLength = 0, - minHeight, - _minHeight, - maxHeight, - menuInnerMinHeight, - estimate, - isDropup; - - if (this.options.dropupAuto) { - // Get the estimated height of the menu without scrollbars. - // This is useful for smaller menus, where there might be plenty of room - // below the button without setting dropup, but we can't know - // the exact height of the menu until createView is called later - estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert; - - isDropup = this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot; - - // ensure dropup doesn't change while searching (so menu doesn't bounce back and forth) - if (this.selectpicker.isSearching === true) { - isDropup = this.selectpicker.dropup; - } - - this.$newElement.toggleClass(classNames.DROPUP, isDropup); - this.selectpicker.dropup = isDropup; - } - - if (this.options.size === 'auto') { - _minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0; - menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert; - minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; - menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0); - - if (this.$newElement.hasClass(classNames.DROPUP)) { - menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert; - } - - maxHeight = menuHeight; - menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert; - } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { - for (var i = 0; i < this.options.size; i++) { - if (this.selectpicker.current.data[i].type === 'divider') divLength++; - } - - menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert; - menuInnerHeight = menuHeight - menuPadding.vert; - maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight; - minHeight = menuInnerMinHeight = ''; - } - - this.$menu.css({ - 'max-height': maxHeight + 'px', - 'overflow': 'hidden', - 'min-height': minHeight + 'px' - }); - - this.$menuInner.css({ - 'max-height': menuInnerHeight + 'px', - 'overflow-y': 'auto', - 'min-height': menuInnerMinHeight + 'px' - }); - - // ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView - this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1); - - if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) { - this.sizeInfo.hasScrollBar = true; - this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth; - } - - if (this.options.dropdownAlignRight === 'auto') { - this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < (this.sizeInfo.totalMenuWidth - selectWidth)); - } - - if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update(); - }, - - setSize: function (refresh) { - this.liHeight(refresh); - - if (this.options.header) this.$menu.css('padding-top', 0); - - if (this.options.size !== false) { - var that = this, - $window = $(window); - - this.setMenuSize(); - - if (this.options.liveSearch) { - this.$searchbox - .off('input.setMenuSize propertychange.setMenuSize') - .on('input.setMenuSize propertychange.setMenuSize', function () { - return that.setMenuSize(); - }); - } - - if (this.options.size === 'auto') { - $window - .off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize') - .on('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize', function () { - return that.setMenuSize(); - }); - } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) { - $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize'); - } - } - - this.createView(false, true, refresh); - }, - - setWidth: function () { - var that = this; - - if (this.options.width === 'auto') { - requestAnimationFrame(function () { - that.$menu.css('min-width', '0'); - - that.$element.on('loaded' + EVENT_KEY, function () { - that.liHeight(); - that.setMenuSize(); - - // Get correct width if element is hidden - var $selectClone = that.$newElement.clone().appendTo('body'), - btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth(); - - $selectClone.remove(); - - // Set width to whatever's larger, button title or longest option - that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth); - that.$newElement.css('width', that.sizeInfo.selectWidth + 'px'); - }); - }); - } else if (this.options.width === 'fit') { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', '').addClass('fit-width'); - } else if (this.options.width) { - // Remove inline min-width so width can be changed from 'auto' - this.$menu.css('min-width', ''); - this.$newElement.css('width', this.options.width); - } else { - // Remove inline min-width/width so width can be changed - this.$menu.css('min-width', ''); - this.$newElement.css('width', ''); - } - // Remove fit-width class if width is changed programmatically - if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') { - this.$newElement[0].classList.remove('fit-width'); - } - }, - - selectPosition: function () { - this.$bsContainer = $('
    '); - - var that = this, - $container = $(this.options.container), - pos, - containerPos, - actualHeight, - getPlacement = function ($element) { - var containerPosition = {}, - // fall back to dropdown's default display setting if display is not manually set - display = that.options.display || ( - // Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default - $.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display - : false - ); - - that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP)); - pos = $element.offset(); - - if (!$container.is('body')) { - containerPos = $container.offset(); - containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop(); - containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft(); - } else { - containerPos = { top: 0, left: 0 }; - } - - actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight; - - // Bootstrap 4+ uses Popper for menu positioning - if (version.major < 4 || display === 'static') { - containerPosition.top = pos.top - containerPos.top + actualHeight; - containerPosition.left = pos.left - containerPos.left; - } - - containerPosition.width = $element[0].offsetWidth; - - that.$bsContainer.css(containerPosition); - }; - - this.$button.on('click.bs.dropdown.data-api', function () { - if (that.isDisabled()) { - return; - } - - getPlacement(that.$newElement); - - that.$bsContainer - .appendTo(that.options.container) - .toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW)) - .append(that.$menu); - }); - - $(window) - .off('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId) - .on('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId, function () { - var isActive = that.$newElement.hasClass(classNames.SHOW); - - if (isActive) getPlacement(that.$newElement); - }); - - this.$element.on('hide' + EVENT_KEY, function () { - that.$menu.data('height', that.$menu.height()); - that.$bsContainer.detach(); - }); - }, - - setOptionStatus: function (selectedOnly) { - var that = this; - - that.noScroll = false; - - if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) { - for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) { - var liData = that.selectpicker.current.data[i + that.selectpicker.view.position0], - option = liData.option; - - if (option) { - if (selectedOnly !== true) { - that.setDisabled( - liData.index, - liData.disabled - ); - } - - that.setSelected( - liData.index, - option.selected - ); - } - } - } - }, - - /** - * @param {number} index - the index of the option that is being changed - * @param {boolean} selected - true if the option is being selected, false if being deselected - */ - setSelected: function (index, selected) { - var li = this.selectpicker.main.elements[index], - liData = this.selectpicker.main.data[index], - activeIndexIsSet = this.activeIndex !== undefined, - thisIsActive = this.activeIndex === index, - prevActive, - a, - // if current option is already active - // OR - // if the current option is being selected, it's NOT multiple, and - // activeIndex is undefined: - // - when the menu is first being opened, OR - // - after a search has been performed, OR - // - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex) - keepActive = thisIsActive || (selected && !this.multiple && !activeIndexIsSet); - - liData.selected = selected; - - a = li.firstChild; - - if (selected) { - this.selectedIndex = index; - } - - li.classList.toggle('selected', selected); - - if (keepActive) { - this.focusItem(li, liData); - this.selectpicker.view.currentActive = li; - this.activeIndex = index; - } else { - this.defocusItem(li); - } - - if (a) { - a.classList.toggle('selected', selected); - - if (selected) { - a.setAttribute('aria-selected', true); - } else { - if (this.multiple) { - a.setAttribute('aria-selected', false); - } else { - a.removeAttribute('aria-selected'); - } - } - } - - if (!keepActive && !activeIndexIsSet && selected && this.prevActiveIndex !== undefined) { - prevActive = this.selectpicker.main.elements[this.prevActiveIndex]; - - this.defocusItem(prevActive); - } - }, - - /** - * @param {number} index - the index of the option that is being disabled - * @param {boolean} disabled - true if the option is being disabled, false if being enabled - */ - setDisabled: function (index, disabled) { - var li = this.selectpicker.main.elements[index], - a; - - this.selectpicker.main.data[index].disabled = disabled; - - a = li.firstChild; - - li.classList.toggle(classNames.DISABLED, disabled); - - if (a) { - if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled); - - if (disabled) { - a.setAttribute('aria-disabled', disabled); - a.setAttribute('tabindex', -1); - } else { - a.removeAttribute('aria-disabled'); - a.setAttribute('tabindex', 0); - } - } - }, - - isDisabled: function () { - return this.$element[0].disabled; - }, - - checkDisabled: function () { - if (this.isDisabled()) { - this.$newElement[0].classList.add(classNames.DISABLED); - this.$button.addClass(classNames.DISABLED).attr('aria-disabled', true); - } else { - if (this.$button[0].classList.contains(classNames.DISABLED)) { - this.$newElement[0].classList.remove(classNames.DISABLED); - this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false); - } - } - }, - - clickListener: function () { - var that = this, - $document = $(document); - - $document.data('spaceSelect', false); - - this.$button.on('keyup', function (e) { - if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) { - e.preventDefault(); - $document.data('spaceSelect', false); - } - }); - - this.$newElement.on('show.bs.dropdown', function () { - if (version.major > 3 && !that.dropdown) { - that.dropdown = that.$button.data('bs.dropdown'); - that.dropdown._menu = that.$menu[0]; - } - }); - - this.$button.on('click.bs.dropdown.data-api', function () { - if (!that.$newElement.hasClass(classNames.SHOW)) { - that.setSize(); - } - }); - - function setFocus () { - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$menuInner.trigger('focus'); - } - } - - function checkPopperExists () { - if (that.dropdown && that.dropdown._popper && that.dropdown._popper.state.isCreated) { - setFocus(); - } else { - requestAnimationFrame(checkPopperExists); - } - } - - this.$element.on('shown' + EVENT_KEY, function () { - if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) { - that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop; - } - - if (version.major > 3) { - requestAnimationFrame(checkPopperExists); - } else { - setFocus(); - } - }); - - // ensure posinset and setsize are correct before selecting an option via a click - this.$menuInner.on('mouseenter', 'li a', function (e) { - var hoverLi = this.parentElement, - position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, - index = Array.prototype.indexOf.call(hoverLi.parentElement.children, hoverLi), - hoverData = that.selectpicker.current.data[index + position0]; - - that.focusItem(hoverLi, hoverData, true); - }); - - this.$menuInner.on('click', 'li a', function (e, retainActive) { - var $this = $(this), - element = that.$element[0], - position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0, - clickedData = that.selectpicker.current.data[$this.parent().index() + position0], - clickedIndex = clickedData.index, - prevValue = getSelectValues(element), - prevIndex = element.selectedIndex, - prevOption = element.options[prevIndex], - triggerChange = true; - - // Don't close on multi choice menu - if (that.multiple && that.options.maxOptions !== 1) { - e.stopPropagation(); - } - - e.preventDefault(); - - // Don't run if the select is disabled - if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) { - var option = clickedData.option, - $option = $(option), - state = option.selected, - $optgroup = $option.parent('optgroup'), - $optgroupOptions = $optgroup.find('option'), - maxOptions = that.options.maxOptions, - maxOptionsGrp = $optgroup.data('maxOptions') || false; - - if (clickedIndex === that.activeIndex) retainActive = true; - - if (!retainActive) { - that.prevActiveIndex = that.activeIndex; - that.activeIndex = undefined; - } - - if (!that.multiple) { // Deselect all others if not multi select box - if (prevOption) prevOption.selected = false; - option.selected = true; - that.setSelected(clickedIndex, true); - } else { // Toggle the one we have chosen if we are multi select. - option.selected = !state; - - that.setSelected(clickedIndex, !state); - that.focusedParent.focus(); - - if (maxOptions !== false || maxOptionsGrp !== false) { - var maxReached = maxOptions < getSelectedOptions(element).length, - maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length; - - if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) { - if (maxOptions && maxOptions == 1) { - element.selectedIndex = -1; - option.selected = true; - that.setOptionStatus(true); - } else if (maxOptionsGrp && maxOptionsGrp == 1) { - for (var i = 0; i < $optgroupOptions.length; i++) { - var _option = $optgroupOptions[i]; - _option.selected = false; - that.setSelected(_option.liIndex, false); - } - - option.selected = true; - that.setSelected(clickedIndex, true); - } else { - var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText, - maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText, - maxTxt = maxOptionsArr[0].replace('{n}', maxOptions), - maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp), - $notify = $('
    '); - // If {var} is set in array, replace it - /** @deprecated */ - if (maxOptionsArr[2]) { - maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]); - maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]); - } - - option.selected = false; - - that.$menu.append($notify); - - if (maxOptions && maxReached) { - $notify.append($('
    ' + maxTxt + '
    ')); - triggerChange = false; - that.$element.trigger('maxReached' + EVENT_KEY); - } - - if (maxOptionsGrp && maxReachedGrp) { - $notify.append($('
    ' + maxTxtGrp + '
    ')); - triggerChange = false; - that.$element.trigger('maxReachedGrp' + EVENT_KEY); - } - - setTimeout(function () { - that.setSelected(clickedIndex, false); - }, 10); - - $notify[0].classList.add('fadeOut'); - - setTimeout(function () { - $notify.remove(); - }, 1050); - } - } - } - } - - if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) { - that.$button.trigger('focus'); - } else if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } - - // Trigger select 'change' - if (triggerChange) { - if (that.multiple || prevIndex !== element.selectedIndex) { - // $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed. - changedArguments = [option.index, $option.prop('selected'), prevValue]; - that.$element - .triggerNative('change'); - } - } - } - }); - - this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function (e) { - if (e.currentTarget == this) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch && !$(e.target).hasClass('close')) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - } - }); - - this.$menuInner.on('click', '.divider, .dropdown-header', function (e) { - e.preventDefault(); - e.stopPropagation(); - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - }); - - this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function () { - that.$button.trigger('click'); - }); - - this.$searchbox.on('click', function (e) { - e.stopPropagation(); - }); - - this.$menu.on('click', '.actions-btn', function (e) { - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - that.$button.trigger('focus'); - } - - e.preventDefault(); - e.stopPropagation(); - - if ($(this).hasClass('bs-select-all')) { - that.selectAll(); - } else { - that.deselectAll(); - } - }); - - this.$button - .on('focus' + EVENT_KEY, function (e) { - var tabindex = that.$element[0].getAttribute('tabindex'); - - // only change when button is actually focused - if (tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) { - // apply select element's tabindex to ensure correct order is followed when tabbing to the next element - this.setAttribute('tabindex', tabindex); - // set element's tabindex to -1 to allow for reverse tabbing - that.$element[0].setAttribute('tabindex', -1); - that.selectpicker.view.tabindex = tabindex; - } - }) - .on('blur' + EVENT_KEY, function (e) { - // revert everything to original tabindex - if (that.selectpicker.view.tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) { - that.$element[0].setAttribute('tabindex', that.selectpicker.view.tabindex); - this.setAttribute('tabindex', -1); - that.selectpicker.view.tabindex = undefined; - } - }); - - this.$element - .on('change' + EVENT_KEY, function () { - that.render(); - that.$element.trigger('changed' + EVENT_KEY, changedArguments); - changedArguments = null; - }) - .on('focus' + EVENT_KEY, function () { - if (!that.options.mobile) that.$button[0].focus(); - }); - }, - - liveSearchListener: function () { - var that = this; - - this.$button.on('click.bs.dropdown.data-api', function () { - if (!!that.$searchbox.val()) { - that.$searchbox.val(''); - that.selectpicker.search.previousValue = undefined; - } - }); - - this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function (e) { - e.stopPropagation(); - }); - - this.$searchbox.on('input propertychange', function () { - var searchValue = that.$searchbox[0].value; - - that.selectpicker.search.elements = []; - that.selectpicker.search.data = []; - - if (searchValue) { - var i, - searchMatch = [], - q = searchValue.toUpperCase(), - cache = {}, - cacheArr = [], - searchStyle = that._searchStyle(), - normalizeSearch = that.options.liveSearchNormalize; - - if (normalizeSearch) q = normalizeToBase(q); - - for (var i = 0; i < that.selectpicker.main.data.length; i++) { - var li = that.selectpicker.main.data[i]; - - if (!cache[i]) { - cache[i] = stringSearch(li, q, searchStyle, normalizeSearch); - } - - if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) { - if (li.headerIndex > 0) { - cache[li.headerIndex - 1] = true; - cacheArr.push(li.headerIndex - 1); - } - - cache[li.headerIndex] = true; - cacheArr.push(li.headerIndex); - - cache[li.lastIndex + 1] = true; - } - - if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i); - } - - for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) { - var index = cacheArr[i], - prevIndex = cacheArr[i - 1], - li = that.selectpicker.main.data[index], - liPrev = that.selectpicker.main.data[prevIndex]; - - if (li.type !== 'divider' || (li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i)) { - that.selectpicker.search.data.push(li); - searchMatch.push(that.selectpicker.main.elements[index]); - } - } - - that.activeIndex = undefined; - that.noScroll = true; - that.$menuInner.scrollTop(0); - that.selectpicker.search.elements = searchMatch; - that.createView(true); - showNoResults.call(that, searchMatch, searchValue); - } else if (that.selectpicker.search.previousValue) { // for IE11 (#2402) - that.$menuInner.scrollTop(0); - that.createView(false); - } - - that.selectpicker.search.previousValue = searchValue; - }); - }, - - _searchStyle: function () { - return this.options.liveSearchStyle || 'contains'; - }, - - val: function (value) { - var element = this.$element[0]; - - if (typeof value !== 'undefined') { - var prevValue = getSelectValues(element); - - changedArguments = [null, null, prevValue]; - - this.$element - .val(value) - .trigger('changed' + EVENT_KEY, changedArguments); - - if (this.$newElement.hasClass(classNames.SHOW)) { - if (this.multiple) { - this.setOptionStatus(true); - } else { - var liSelectedIndex = (element.options[element.selectedIndex] || {}).liIndex; - - if (typeof liSelectedIndex === 'number') { - this.setSelected(this.selectedIndex, false); - this.setSelected(liSelectedIndex, true); - } - } - } - - this.render(); - - changedArguments = null; - - return this.$element; - } else { - return this.$element.val(); - } - }, - - changeAll: function (status) { - if (!this.multiple) return; - if (typeof status === 'undefined') status = true; - - var element = this.$element[0], - previousSelected = 0, - currentSelected = 0, - prevValue = getSelectValues(element); - - element.classList.add('bs-select-hidden'); - - for (var i = 0, data = this.selectpicker.current.data, len = data.length; i < len; i++) { - var liData = data[i], - option = liData.option; - - if (option && !liData.disabled && liData.type !== 'divider') { - if (liData.selected) previousSelected++; - option.selected = status; - if (status === true) currentSelected++; - } - } - - element.classList.remove('bs-select-hidden'); - - if (previousSelected === currentSelected) return; - - this.setOptionStatus(); - - changedArguments = [null, null, prevValue]; - - this.$element - .triggerNative('change'); - }, - - selectAll: function () { - return this.changeAll(true); - }, - - deselectAll: function () { - return this.changeAll(false); - }, - - toggle: function (e) { - e = e || window.event; - - if (e) e.stopPropagation(); - - this.$button.trigger('click.bs.dropdown.data-api'); - }, - - keydown: function (e) { - var $this = $(this), - isToggle = $this.hasClass('dropdown-toggle'), - $parent = isToggle ? $this.closest('.dropdown') : $this.closest(Selector.MENU), - that = $parent.data('this'), - $items = that.findLis(), - index, - isActive, - liActive, - activeLi, - offset, - updateScroll = false, - downOnTab = e.which === keyCodes.TAB && !isToggle && !that.options.selectOnTab, - isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab, - scrollTop = that.$menuInner[0].scrollTop, - isVirtual = that.isVirtual(), - position0 = isVirtual === true ? that.selectpicker.view.position0 : 0; - - // do nothing if a function key is pressed - if (e.which >= 112 && e.which <= 123) return; - - isActive = that.$newElement.hasClass(classNames.SHOW); - - if ( - !isActive && - ( - isArrowKey || - (e.which >= 48 && e.which <= 57) || - (e.which >= 96 && e.which <= 105) || - (e.which >= 65 && e.which <= 90) - ) - ) { - that.$button.trigger('click.bs.dropdown.data-api'); - - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - return; - } - } - - if (e.which === keyCodes.ESCAPE && isActive) { - e.preventDefault(); - that.$button.trigger('click.bs.dropdown.data-api').trigger('focus'); - } - - if (isArrowKey) { // if up or down - if (!$items.length) return; - - liActive = that.selectpicker.main.elements[that.activeIndex]; - index = liActive ? Array.prototype.indexOf.call(liActive.parentElement.children, liActive) : -1; - - if (index !== -1) { - that.defocusItem(liActive); - } - - if (e.which === keyCodes.ARROW_UP) { // up - if (index !== -1) index--; - if (index + position0 < 0) index += $items.length; - - if (!that.selectpicker.view.canHighlight[index + position0]) { - index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0; - if (index === -1) index = $items.length - 1; - } - } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down - index++; - if (index + position0 >= that.selectpicker.view.canHighlight.length) index = that.selectpicker.view.firstHighlightIndex; - - if (!that.selectpicker.view.canHighlight[index + position0]) { - index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true); - } - } - - e.preventDefault(); - - var liActiveIndex = position0 + index; - - if (e.which === keyCodes.ARROW_UP) { // up - // scroll to bottom and highlight last option - if (position0 === 0 && index === $items.length - 1) { - that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight; - - liActiveIndex = that.selectpicker.current.elements.length - 1; - } else { - activeLi = that.selectpicker.current.data[liActiveIndex]; - offset = activeLi.position - activeLi.height; - - updateScroll = offset < scrollTop; - } - } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down - // scroll to top and highlight first option - if (index === that.selectpicker.view.firstHighlightIndex) { - that.$menuInner[0].scrollTop = 0; - - liActiveIndex = that.selectpicker.view.firstHighlightIndex; - } else { - activeLi = that.selectpicker.current.data[liActiveIndex]; - offset = activeLi.position - that.sizeInfo.menuInnerHeight; - - updateScroll = offset > scrollTop; - } - } - - liActive = that.selectpicker.current.elements[liActiveIndex]; - - that.activeIndex = that.selectpicker.current.data[liActiveIndex].index; - - that.focusItem(liActive); - - that.selectpicker.view.currentActive = liActive; - - if (updateScroll) that.$menuInner[0].scrollTop = offset; - - if (that.options.liveSearch) { - that.$searchbox.trigger('focus'); - } else { - $this.trigger('focus'); - } - } else if ( - (!$this.is('input') && !REGEXP_TAB_OR_ESCAPE.test(e.which)) || - (e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory) - ) { - var searchMatch, - matches = [], - keyHistory; - - e.preventDefault(); - - that.selectpicker.keydown.keyHistory += keyCodeMap[e.which]; - - if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel); - that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start(); - - keyHistory = that.selectpicker.keydown.keyHistory; - - // if all letters are the same, set keyHistory to just the first character when searching - if (/^(.)\1+$/.test(keyHistory)) { - keyHistory = keyHistory.charAt(0); - } - - // find matches - for (var i = 0; i < that.selectpicker.current.data.length; i++) { - var li = that.selectpicker.current.data[i], - hasMatch; - - hasMatch = stringSearch(li, keyHistory, 'startsWith', true); - - if (hasMatch && that.selectpicker.view.canHighlight[i]) { - matches.push(li.index); - } - } - - if (matches.length) { - var matchIndex = 0; - - $items.removeClass('active').find('a').removeClass('active'); - - // either only one key has been pressed or they are all the same key - if (keyHistory.length === 1) { - matchIndex = matches.indexOf(that.activeIndex); - - if (matchIndex === -1 || matchIndex === matches.length - 1) { - matchIndex = 0; - } else { - matchIndex++; - } - } - - searchMatch = matches[matchIndex]; - - activeLi = that.selectpicker.main.data[searchMatch]; - - if (scrollTop - activeLi.position > 0) { - offset = activeLi.position - activeLi.height; - updateScroll = true; - } else { - offset = activeLi.position - that.sizeInfo.menuInnerHeight; - // if the option is already visible at the current scroll position, just keep it the same - updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight; - } - - liActive = that.selectpicker.main.elements[searchMatch]; - - that.activeIndex = matches[matchIndex]; - - that.focusItem(liActive); - - if (liActive) liActive.firstChild.focus(); - - if (updateScroll) that.$menuInner[0].scrollTop = offset; - - $this.trigger('focus'); - } - } - - // Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu. - if ( - isActive && - ( - (e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory) || - e.which === keyCodes.ENTER || - (e.which === keyCodes.TAB && that.options.selectOnTab) - ) - ) { - if (e.which !== keyCodes.SPACE) e.preventDefault(); - - if (!that.options.liveSearch || e.which !== keyCodes.SPACE) { - that.$menuInner.find('.active a').trigger('click', true); // retain active class - $this.trigger('focus'); - - if (!that.options.liveSearch) { - // Prevent screen from scrolling if the user hits the spacebar - e.preventDefault(); - // Fixes spacebar selection of dropdown items in FF & IE - $(document).data('spaceSelect', true); - } - } - } - }, - - mobile: function () { - // ensure mobile is set to true if mobile function is called after init - this.options.mobile = true; - this.$element[0].classList.add('mobile-device'); - }, - - refresh: function () { - // update options if data attributes have been changed - var config = $.extend({}, this.options, this.$element.data()); - this.options = config; - - this.checkDisabled(); - this.buildData(); - this.setStyle(); - this.render(); - this.buildList(); - this.setWidth(); - - this.setSize(true); - - this.$element.trigger('refreshed' + EVENT_KEY); - }, - - hide: function () { - this.$newElement.hide(); - }, - - show: function () { - this.$newElement.show(); - }, - - remove: function () { - this.$newElement.remove(); - this.$element.remove(); - }, - - destroy: function () { - this.$newElement.before(this.$element).remove(); - - if (this.$bsContainer) { - this.$bsContainer.remove(); - } else { - this.$menu.remove(); - } - - if (this.selectpicker.view.titleOption && this.selectpicker.view.titleOption.parentNode) { - this.selectpicker.view.titleOption.parentNode.removeChild(this.selectpicker.view.titleOption); - } - - this.$element - .off(EVENT_KEY) - .removeData('selectpicker') - .removeClass('bs-select-hidden selectpicker'); - - $(window).off(EVENT_KEY + '.' + this.selectId); - } - }; - - // SELECTPICKER PLUGIN DEFINITION - // ============================== - function Plugin (option) { - // get the args of the outer function.. - var args = arguments; - // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them - // to get lost/corrupted in android 2.3 and IE9 #715 #775 - var _option = option; - - [].shift.apply(args); - - // if the version was not set successfully - if (!version.success) { - // try to retreive it again - try { - version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.'); - } catch (err) { - // fall back to use BootstrapVersion if set - if (Selectpicker.BootstrapVersion) { - version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.'); - } else { - version.full = [version.major, '0', '0']; - - console.warn( - 'There was an issue retrieving Bootstrap\'s version. ' + - 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' + - 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.', - err - ); - } - } - - version.major = version.full[0]; - version.success = true; - } - - if (version.major === '4') { - // some defaults need to be changed if using Bootstrap 4 - // check to see if they have already been manually changed before forcing them to update - var toUpdate = []; - - if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({ name: 'style', className: 'BUTTONCLASS' }); - if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({ name: 'iconBase', className: 'ICONBASE' }); - if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({ name: 'tickIcon', className: 'TICKICON' }); - - classNames.DIVIDER = 'dropdown-divider'; - classNames.SHOW = 'show'; - classNames.BUTTONCLASS = 'btn-light'; - classNames.POPOVERHEADER = 'popover-header'; - classNames.ICONBASE = ''; - classNames.TICKICON = 'bs-ok-default'; - - for (var i = 0; i < toUpdate.length; i++) { - var option = toUpdate[i]; - Selectpicker.DEFAULTS[option.name] = classNames[option.className]; - } - } - - var value; - var chain = this.each(function () { - var $this = $(this); - if ($this.is('select')) { - var data = $this.data('selectpicker'), - options = typeof _option == 'object' && _option; - - if (!data) { - var dataAttributes = $this.data(); - - for (var dataAttr in dataAttributes) { - if (Object.prototype.hasOwnProperty.call(dataAttributes, dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { - delete dataAttributes[dataAttr]; - } - } - - var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, dataAttributes, options); - config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), dataAttributes.template, options.template); - $this.data('selectpicker', (data = new Selectpicker(this, config))); - } else if (options) { - for (var i in options) { - if (Object.prototype.hasOwnProperty.call(options, i)) { - data.options[i] = options[i]; - } - } - } - - if (typeof _option == 'string') { - if (data[_option] instanceof Function) { - value = data[_option].apply(data, args); - } else { - value = data.options[_option]; - } - } - } - }); - - if (typeof value !== 'undefined') { - // noinspection JSUnusedAssignment - return value; - } else { - return chain; - } - } - - var old = $.fn.selectpicker; - $.fn.selectpicker = Plugin; - $.fn.selectpicker.Constructor = Selectpicker; - - // SELECTPICKER NO CONFLICT - // ======================== - $.fn.selectpicker.noConflict = function () { - $.fn.selectpicker = old; - return this; - }; - - // get Bootstrap's keydown event handler for either Bootstrap 4 or Bootstrap 3 - function keydownHandler () { - if ($.fn.dropdown) { - // wait to define until function is called in case Bootstrap isn't loaded yet - var bootstrapKeydown = $.fn.dropdown.Constructor._dataApiKeydownHandler || $.fn.dropdown.Constructor.prototype.keydown; - return bootstrapKeydown.apply(this, arguments); - } - } - - $(document) - .off('keydown.bs.dropdown.data-api') - .on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > [data-toggle="dropdown"]', keydownHandler) - .on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > .dropdown-menu', keydownHandler) - .on('keydown' + EVENT_KEY, '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', Selectpicker.prototype.keydown) - .on('focusin.modal', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input', function (e) { - e.stopPropagation(); - }); - - // SELECTPICKER DATA-API - // ===================== - $(window).on('load' + EVENT_KEY + '.data-api', function () { - $('.selectpicker').each(function () { - var $selectpicker = $(this); - Plugin.call($selectpicker, $selectpicker.data()); - }) - }); -})(jQuery); - - -})); diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css deleted file mode 100644 index f2a6c0c87..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2020 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */@-webkit-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@-o-keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}@keyframes bs-notify-fadeOut{0%{opacity:.9}100%{opacity:0}}.bootstrap-select>select.bs-select-hidden,select.bs-select-hidden,select.selectpicker{display:none!important}.bootstrap-select{width:220px\0;vertical-align:middle}.bootstrap-select>.dropdown-toggle{position:relative;width:100%;text-align:right;white-space:nowrap;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.bootstrap-select>.dropdown-toggle:after{margin-top:-1px}.bootstrap-select>.dropdown-toggle.bs-placeholder,.bootstrap-select>.dropdown-toggle.bs-placeholder:active,.bootstrap-select>.dropdown-toggle.bs-placeholder:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder:hover{color:#999}.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-danger:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-dark:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-info:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-primary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-secondary:hover,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:active,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:focus,.bootstrap-select>.dropdown-toggle.bs-placeholder.btn-success:hover{color:rgba(255,255,255,.5)}.bootstrap-select>select{position:absolute!important;bottom:0;left:50%;display:block!important;width:.5px!important;height:100%!important;padding:0!important;opacity:0!important;border:none;z-index:0!important}.bootstrap-select>select.mobile-device{top:0;left:0;display:block!important;width:100%!important;z-index:2!important}.bootstrap-select.is-invalid .dropdown-toggle,.error .bootstrap-select .dropdown-toggle,.has-error .bootstrap-select .dropdown-toggle,.was-validated .bootstrap-select select:invalid+.dropdown-toggle{border-color:#b94a48}.bootstrap-select.is-valid .dropdown-toggle,.was-validated .bootstrap-select select:valid+.dropdown-toggle{border-color:#28a745}.bootstrap-select.fit-width{width:auto!important}.bootstrap-select:not([class*=col-]):not([class*=form-control]):not(.input-group-btn){width:220px}.bootstrap-select .dropdown-toggle:focus,.bootstrap-select>select.mobile-device:focus+.dropdown-toggle{outline:thin dotted #333!important;outline:5px auto -webkit-focus-ring-color!important;outline-offset:-2px}.bootstrap-select.form-control{margin-bottom:0;padding:0;border:none;height:auto}:not(.input-group)>.bootstrap-select.form-control:not([class*=col-]){width:100%}.bootstrap-select.form-control.input-group-btn{float:none;z-index:auto}.form-inline .bootstrap-select,.form-inline .bootstrap-select.form-control:not([class*=col-]){width:auto}.bootstrap-select:not(.input-group-btn),.bootstrap-select[class*=col-]{float:none;display:inline-block;margin-left:0}.bootstrap-select.dropdown-menu-right,.bootstrap-select[class*=col-].dropdown-menu-right,.row .bootstrap-select[class*=col-].dropdown-menu-right{float:right}.form-group .bootstrap-select,.form-horizontal .bootstrap-select,.form-inline .bootstrap-select{margin-bottom:0}.form-group-lg .bootstrap-select.form-control,.form-group-sm .bootstrap-select.form-control{padding:0}.form-group-lg .bootstrap-select.form-control .dropdown-toggle,.form-group-sm .bootstrap-select.form-control .dropdown-toggle{height:100%;font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-lg .dropdown-toggle,.bootstrap-select.form-control-sm .dropdown-toggle{font-size:inherit;line-height:inherit;border-radius:inherit}.bootstrap-select.form-control-sm .dropdown-toggle{padding:.25rem .5rem}.bootstrap-select.form-control-lg .dropdown-toggle{padding:.5rem 1rem}.form-inline .bootstrap-select .form-control{width:100%}.bootstrap-select.disabled,.bootstrap-select>.disabled{cursor:not-allowed}.bootstrap-select.disabled:focus,.bootstrap-select>.disabled:focus{outline:0!important}.bootstrap-select.bs-container{position:absolute;top:0;left:0;height:0!important;padding:0!important}.bootstrap-select.bs-container .dropdown-menu{z-index:1060}.bootstrap-select .dropdown-toggle .filter-option{position:static;top:0;left:0;float:left;height:100%;width:100%;text-align:left;overflow:hidden;-webkit-box-flex:0;-webkit-flex:0 1 auto;-ms-flex:0 1 auto;flex:0 1 auto}.bs3.bootstrap-select .dropdown-toggle .filter-option{padding-right:inherit}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option{position:absolute;padding-top:inherit;padding-bottom:inherit;padding-left:inherit;float:none}.input-group .bs3-has-addon.bootstrap-select .dropdown-toggle .filter-option .filter-option-inner{padding-right:inherit}.bootstrap-select .dropdown-toggle .filter-option-inner-inner{overflow:hidden}.bootstrap-select .dropdown-toggle .filter-expand{width:0!important;float:left;opacity:0!important;overflow:hidden}.bootstrap-select .dropdown-toggle .caret{position:absolute;top:50%;right:12px;margin-top:-2px;vertical-align:middle}.input-group .bootstrap-select.form-control .dropdown-toggle{border-radius:inherit}.bootstrap-select[class*=col-] .dropdown-toggle{width:100%}.bootstrap-select .dropdown-menu{min-width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .dropdown-menu>.inner:focus{outline:0!important}.bootstrap-select .dropdown-menu.inner{position:static;float:none;border:0;padding:0;margin:0;border-radius:0;-webkit-box-shadow:none;box-shadow:none}.bootstrap-select .dropdown-menu li{position:relative}.bootstrap-select .dropdown-menu li.active small{color:rgba(255,255,255,.5)!important}.bootstrap-select .dropdown-menu li.disabled a{cursor:not-allowed}.bootstrap-select .dropdown-menu li a{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.bootstrap-select .dropdown-menu li a.opt{position:relative;padding-left:2.25em}.bootstrap-select .dropdown-menu li a span.check-mark{display:none}.bootstrap-select .dropdown-menu li a span.text{display:inline-block}.bootstrap-select .dropdown-menu li small{padding-left:.5em}.bootstrap-select .dropdown-menu .notify{position:absolute;bottom:5px;width:96%;margin:0 2%;min-height:26px;padding:3px 5px;background:#f5f5f5;border:1px solid #e3e3e3;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05);pointer-events:none;opacity:.9;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-select .dropdown-menu .notify.fadeOut{-webkit-animation:.3s linear 750ms forwards bs-notify-fadeOut;-o-animation:.3s linear 750ms forwards bs-notify-fadeOut;animation:.3s linear 750ms forwards bs-notify-fadeOut}.bootstrap-select .no-results{padding:3px;background:#f5f5f5;margin:0 5px;white-space:nowrap}.bootstrap-select.fit-width .dropdown-toggle .filter-option{position:static;display:inline;padding:0}.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner,.bootstrap-select.fit-width .dropdown-toggle .filter-option-inner-inner{display:inline}.bootstrap-select.fit-width .dropdown-toggle .bs-caret:before{content:'\00a0'}.bootstrap-select.fit-width .dropdown-toggle .caret{position:static;top:auto;margin-top:-1px}.bootstrap-select.show-tick .dropdown-menu .selected span.check-mark{position:absolute;display:inline-block;right:15px;top:5px}.bootstrap-select.show-tick .dropdown-menu li a span.text{margin-right:34px}.bootstrap-select .bs-ok-default:after{content:'';display:block;width:.5em;height:1em;border-style:solid;border-width:0 .26em .26em 0;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle{z-index:1061}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:before{content:'';border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid rgba(204,204,204,.2);position:absolute;bottom:-4px;left:9px;display:none}.bootstrap-select.show-menu-arrow .dropdown-toggle .filter-option:after{content:'';border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute;bottom:-4px;left:10px;display:none}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:before{bottom:auto;top:-4px;border-top:7px solid rgba(204,204,204,.2);border-bottom:0}.bootstrap-select.show-menu-arrow.dropup .dropdown-toggle .filter-option:after{bottom:auto;top:-4px;border-top:6px solid #fff;border-bottom:0}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:before{right:12px;left:auto}.bootstrap-select.show-menu-arrow.pull-right .dropdown-toggle .filter-option:after{right:13px;left:auto}.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.open>.dropdown-toggle .filter-option:before,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:after,.bootstrap-select.show-menu-arrow.show>.dropdown-toggle .filter-option:before{display:block}.bs-actionsbox,.bs-donebutton,.bs-searchbox{padding:4px 8px}.bs-actionsbox{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-actionsbox .btn-group button{width:50%}.bs-donebutton{float:left;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bs-donebutton .btn-group button{width:100%}.bs-searchbox+.bs-actionsbox{padding:0 8px 4px}.bs-searchbox .form-control{margin-bottom:0;width:100%;float:none} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js deleted file mode 100644 index 46cf10e9d..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-select/bootstrap-select.min.js +++ /dev/null @@ -1,8 +0,0 @@ -/*! - * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select) - * - * Copyright 2012-2020 SnapAppointments, LLC - * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) - */ - -!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(e){!function(P){"use strict";var d=["sanitize","whiteList","sanitizeFn"],r=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],e={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},l=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,a=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function v(e,t){var i=e.nodeName.toLowerCase();if(-1!==P.inArray(i,t))return-1===P.inArray(i,r)||Boolean(e.nodeValue.match(l)||e.nodeValue.match(a));for(var s=P(t).filter(function(e,t){return t instanceof RegExp}),n=0,o=s.length;n]+>/g,"")),s&&(a=w(a)),a=a.toUpperCase(),o="contains"===i?0<=a.indexOf(t):a.startsWith(t)))break}return o}function N(e){return parseInt(e,10)||0}P.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(u?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var f={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},m=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,g=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function b(e){return f[e]}function w(e){return(e=e.toString())&&e.replace(m,b).replace(g,"")}var I,x,y,$,S=(I={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},x="(?:"+Object.keys(I).join("|")+")",y=RegExp(x),$=RegExp(x,"g"),function(e){return e=null==e?"":""+e,y.test(e)?e.replace($,E):e});function E(e){return I[e]}var C={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},A=27,L=13,D=32,H=9,B=38,R=40,M={success:!1,major:"3"};try{M.full=(P.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var U=0,j=".bs.select",V={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},F={MENU:"."+V.MENU},_={div:document.createElement("div"),span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode("\xa0"),fragment:document.createDocumentFragment()};_.noResults=_.li.cloneNode(!1),_.noResults.className="no-results",_.a.setAttribute("role","option"),_.a.className="dropdown-item",_.subtext.className="text-muted",_.text=_.span.cloneNode(!1),_.text.className="text",_.checkMark=_.span.cloneNode(!1);var G=new RegExp(B+"|"+R),q=new RegExp("^"+H+"$|"+A),K={li:function(e,t,i){var s=_.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},a:function(e,t,i){var s=_.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&s.classList.add.apply(s.classList,t.split(/\s+/)),i&&s.setAttribute("style",i),s},text:function(e,t){var i,s,n=_.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=_.whitespace.cloneNode(!1);(s=(!0===t?_.i:_.span).cloneNode(!1)).className=this.options.iconBase+" "+e.icon,_.fragment.appendChild(s),_.fragment.appendChild(o)}e.subtext&&((i=_.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;0'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:e},Y.prototype={constructor:Y,init:function(){var i=this,e=this.$element.attr("id"),t=this.$element[0],s=t.form;U++,this.selectId="bs-select-"+U,t.classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),t.classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.buildData(),this.$element.after(this.$newElement).prependTo(this.$newElement),s&&null===t.form&&(s.id||(s.id="form-"+this.selectId),t.setAttribute("form",s.id)),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(F.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),t.classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(V.MENURIGHT),void 0!==e&&this.$button.attr("data-id",e),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide"+j,function(){if(i.isVirtual()){var e=i.$menuInner[0],t=e.firstChild.cloneNode(!1);e.replaceChild(t,e.firstChild),e.scrollTop=0}}),this.$menu.data("this",this),this.$newElement.data("this",this),this.options.mobile&&this.mobile(),this.$newElement.on({"hide.bs.dropdown":function(e){i.$element.trigger("hide"+j,e)},"hidden.bs.dropdown":function(e){i.$element.trigger("hidden"+j,e)},"show.bs.dropdown":function(e){i.$element.trigger("show"+j,e)},"shown.bs.dropdown":function(e){i.$element.trigger("shown"+j,e)}}),t.hasAttribute("required")&&this.$element.on("invalid"+j,function(){i.$button[0].classList.add("bs-invalid"),i.$element.on("shown"+j+".invalid",function(){i.$element.val(i.$element.val()).off("shown"+j+".invalid")}).on("rendered"+j,function(){this.validity.valid&&i.$button[0].classList.remove("bs-invalid"),i.$element.off("rendered"+j)}),i.$button.on("blur"+j,function(){i.$element.trigger("focus").trigger("blur"),i.$button.off("blur"+j)})}),setTimeout(function(){i.buildList(),i.$element.trigger("loaded"+j)})},createDropdown:function(){var e=this.multiple||this.options.showTick?" show-tick":"",t=this.multiple?' aria-multiselectable="true"':"",i="",s=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(i=" input-group-btn");var n,o="",r="",l="",a="";return this.options.header&&(o='
    '+this.options.header+"
    "),this.options.liveSearch&&(r=''),this.multiple&&this.options.actionsBox&&(l='
    "),this.multiple&&this.options.doneButton&&(a='
    "),n='",P(n)},setPositionData:function(){this.selectpicker.view.canHighlight=[],this.selectpicker.view.size=0,this.selectpicker.view.firstHighlightIndex=!1;for(var e=0;e=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(N,e,t){var A,L,D=this,i=0,H=[];if(this.selectpicker.isSearching=N,this.selectpicker.current=N?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),e)if(t)i=this.$menuInner[0].scrollTop;else if(!D.multiple){var s=D.$element[0],n=(s.options[s.selectedIndex]||{}).liIndex;if("number"==typeof n&&!1!==D.options.size){var o=D.selectpicker.main.data[n],r=o&&o.position;r&&(i=r-(D.sizeInfo.menuInnerHeight+D.sizeInfo.liHeight)/2)}}function l(e,t){var i,s,n,o,r,l,a,c,d=D.selectpicker.current.elements.length,h=[],p=!0,u=D.isVirtual();D.selectpicker.view.scrollTop=e,i=Math.ceil(D.sizeInfo.menuInnerHeight/D.sizeInfo.liHeight*1.5),s=Math.round(d/i)||1;for(var f=0;fd-1?0:D.selectpicker.current.data[d-1].position-D.selectpicker.current.data[D.selectpicker.view.position1-1].position,b.firstChild.style.marginTop=v+"px",b.firstChild.style.marginBottom=g+"px"):(b.firstChild.style.marginTop=0,b.firstChild.style.marginBottom=0),b.firstChild.appendChild(w),!0===u&&D.sizeInfo.hasScrollBar){var C=b.firstChild.offsetWidth;if(t&&CD.sizeInfo.selectWidth)b.firstChild.style.minWidth=D.sizeInfo.menuInnerInnerWidth+"px";else if(C>D.sizeInfo.menuInnerInnerWidth){D.$menu[0].style.minWidth=0;var O=b.firstChild.offsetWidth;O>D.sizeInfo.menuInnerInnerWidth&&(D.sizeInfo.menuInnerInnerWidth=O,b.firstChild.style.minWidth=D.sizeInfo.menuInnerInnerWidth+"px"),D.$menu[0].style.minWidth=""}}}if(D.prevActiveIndex=D.activeIndex,D.options.liveSearch){if(N&&t){var z,T=0;D.selectpicker.view.canHighlight[T]||(T=1+D.selectpicker.view.canHighlight.slice(1).indexOf(!0)),z=D.selectpicker.view.visibleElements[T],D.defocusItem(D.selectpicker.view.currentActive),D.activeIndex=(D.selectpicker.current.data[T]||{}).index,D.focusItem(z)}}else D.$menuInner.trigger("focus")}l(i,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",function(e,t){D.noScroll||l(this.scrollTop,t),D.noScroll=!1}),P(window).off("resize"+j+"."+this.selectId+".createView").on("resize"+j+"."+this.selectId+".createView",function(){D.$newElement.hasClass(V.SHOW)&&l(D.$menuInner[0].scrollTop)})},focusItem:function(e,t,i){if(e){t=t||this.selectpicker.main.data[this.activeIndex];var s=e.firstChild;s&&(s.setAttribute("aria-setsize",this.selectpicker.view.size),s.setAttribute("aria-posinset",t.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",s.id),e.classList.add("active"),s.classList.add("active")))}},defocusItem:function(e){e&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=this,t=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),t=!0;var i=this.$element[0],s=!1,n=!this.selectpicker.view.titleOption.parentNode,o=i.selectedIndex,r=i.options[o],l=window.performance&&window.performance.getEntriesByType("navigation"),a=l&&l.length?"back_forward"!==l[0].type:2!==window.performance.navigation.type;n&&(this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",s=!r||0===o&&!1===r.defaultSelected&&void 0===this.$element.data("selected")),!n&&0===this.selectpicker.view.titleOption.index||i.insertBefore(this.selectpicker.view.titleOption,i.firstChild),s&&a?i.selectedIndex=0:"complete"!==document.readyState&&window.addEventListener("pageshow",function(){e.selectpicker.view.displayedValue!==i.value&&e.render()})}return t},buildData:function(){var p=':not([hidden]):not([data-hidden="true"])',u=[],f=0,m=this.setPlaceholder()?1:0;this.options.hideDisabled&&(p+=":not(:disabled)");var e=this.$element[0].querySelectorAll("select > *"+p);function v(e){var t=u[u.length-1];t&&"divider"===t.type&&(t.optID||e.optID)||((e=e||{}).type="divider",u.push(e))}function g(e,t){if((t=t||{}).divider="true"===e.getAttribute("data-divider"),t.divider)v({optID:t.optID});else{var i=u.length,s=e.style.cssText,n=s?S(s):"",o=(e.className||"")+(t.optgroupClass||"");t.optID&&(o="opt "+o),t.optionClass=o.trim(),t.inlineStyle=n,t.text=e.textContent,t.content=e.getAttribute("data-content"),t.tokens=e.getAttribute("data-tokens"),t.subtext=e.getAttribute("data-subtext"),t.icon=e.getAttribute("data-icon"),e.liIndex=i,t.display=t.content||t.text,t.type="option",t.index=i,t.option=e,t.selected=!!e.selected,t.disabled=t.disabled||!!e.disabled,u.push(t)}}function t(e,t){var i=t[e],s=!(e-1 li")},render:function(){var e,t=this,i=this.$element[0],s=this.setPlaceholder()&&0===i.selectedIndex,n=O(i,this.options.hideDisabled),o=n.length,r=this.$button[0],l=r.querySelector(".filter-option-inner-inner"),a=document.createTextNode(this.options.multipleSeparator),c=_.fragment.cloneNode(!1),d=!1;if(r.classList.toggle("bs-placeholder",t.multiple?!o:!z(i,n)),t.multiple||1!==n.length||(t.selectpicker.view.displayedValue=z(i,n)),"static"===this.options.selectedTextFormat)c=K.text.call(this,{text:this.options.title},!0);else if(!1===(this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count")&&1")).length&&o>e[1]||1===e.length&&2<=o))){if(!s){for(var h=0;h option"+m+", optgroup"+m+" option"+m).length,g="function"==typeof this.options.countSelectedText?this.options.countSelectedText(o,v):this.options.countSelectedText;c=K.text.call(this,{text:g.replace("{0}",o.toString()).replace("{1}",v.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),c.childNodes.length||(c=K.text.call(this,{text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),r.title=c.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&d&&W([c],t.options.whiteList,t.options.sanitizeFn),l.innerHTML="",l.appendChild(c),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var b=r.querySelector(".filter-expand"),w=l.cloneNode(!0);w.className="filter-expand",b?r.replaceChild(w,b):r.appendChild(w)}this.$element.trigger("rendered"+j)},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList&&n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(e){if(e||!1!==this.options.size&&!Object.keys(this.sizeInfo).length){var t,i=_.div.cloneNode(!1),s=_.div.cloneNode(!1),n=_.div.cloneNode(!1),o=document.createElement("ul"),r=_.li.cloneNode(!1),l=_.li.cloneNode(!1),a=_.a.cloneNode(!1),c=_.span.cloneNode(!1),d=this.options.header&&0this.sizeInfo.menuExtras.vert&&l+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot,!0===this.selectpicker.isSearching&&(a=this.selectpicker.dropup),this.$newElement.toggleClass(V.DROPUP,a),this.selectpicker.dropup=a),"auto"===this.options.size)n=3this.options.size){for(var b=0;bthis.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth),"auto"===this.options.dropdownAlignRight&&this.$menu.toggleClass(V.MENURIGHT,this.sizeInfo.selectOffsetLeft>this.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRightthis.options.size&&i.off("resize"+j+"."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize")}this.createView(!1,!0,e)},setWidth:function(){var i=this;"auto"===this.options.width?requestAnimationFrame(function(){i.$menu.css("min-width","0"),i.$element.on("loaded"+j,function(){i.liHeight(),i.setMenuSize();var e=i.$newElement.clone().appendTo("body"),t=e.css("width","auto").children("button").outerWidth();e.remove(),i.sizeInfo.selectWidth=Math.max(i.sizeInfo.totalMenuWidth,t),i.$newElement.css("width",i.sizeInfo.selectWidth+"px")})}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width","")),this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=P('
    ');function e(e){var t={},i=r.options.display||!!P.fn.dropdown.Constructor.Default&&P.fn.dropdown.Constructor.Default.display;r.$bsContainer.addClass(e.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(V.DROPUP,e.hasClass(V.DROPUP)),s=e.offset(),l.is("body")?n={top:0,left:0}:((n=l.offset()).top+=parseInt(l.css("borderTopWidth"))-l.scrollTop(),n.left+=parseInt(l.css("borderLeftWidth"))-l.scrollLeft()),o=e.hasClass(V.DROPUP)?0:e[0].offsetHeight,(M.major<4||"static"===i)&&(t.top=s.top-n.top+o,t.left=s.left-n.left),t.width=e[0].offsetWidth,r.$bsContainer.css(t)}var s,n,o,r=this,l=P(this.options.container);this.$button.on("click.bs.dropdown.data-api",function(){r.isDisabled()||(e(r.$newElement),r.$bsContainer.appendTo(r.options.container).toggleClass(V.SHOW,!r.$button.hasClass(V.SHOW)).append(r.$menu))}),P(window).off("resize"+j+"."+this.selectId+" scroll"+j+"."+this.selectId).on("resize"+j+"."+this.selectId+" scroll"+j+"."+this.selectId,function(){r.$newElement.hasClass(V.SHOW)&&e(r.$newElement)}),this.$element.on("hide"+j,function(){r.$menu.data("height",r.$menu.height()),r.$bsContainer.detach()})},setOptionStatus:function(e){var t=this;if(t.noScroll=!1,t.selectpicker.view.visibleElements&&t.selectpicker.view.visibleElements.length)for(var i=0;i
    ');y[2]&&($=$.replace("{var}",y[2][1"+$+"
    ")),d=!1,C.$element.trigger("maxReached"+j)),g&&w&&(E.append(P("
    "+S+"
    ")),d=!1,C.$element.trigger("maxReachedGrp"+j)),setTimeout(function(){C.setSelected(r,!1)},10),E[0].classList.add("fadeOut"),setTimeout(function(){E.remove()},1050)}}}else c&&(c.selected=!1),h.selected=!0,C.setSelected(r,!0);!C.multiple||C.multiple&&1===C.options.maxOptions?C.$button.trigger("focus"):C.options.liveSearch&&C.$searchbox.trigger("focus"),d&&(!C.multiple&&a===s.selectedIndex||(T=[h.index,p.prop("selected"),l],C.$element.triggerNative("change")))}}),this.$menu.on("click","li."+V.DISABLED+" a, ."+V.POPOVERHEADER+", ."+V.POPOVERHEADER+" :not(.close)",function(e){e.currentTarget==this&&(e.preventDefault(),e.stopPropagation(),C.options.liveSearch&&!P(e.target).hasClass("close")?C.$searchbox.trigger("focus"):C.$button.trigger("focus"))}),this.$menuInner.on("click",".divider, .dropdown-header",function(e){e.preventDefault(),e.stopPropagation(),C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus")}),this.$menu.on("click","."+V.POPOVERHEADER+" .close",function(){C.$button.trigger("click")}),this.$searchbox.on("click",function(e){e.stopPropagation()}),this.$menu.on("click",".actions-btn",function(e){C.options.liveSearch?C.$searchbox.trigger("focus"):C.$button.trigger("focus"),e.preventDefault(),e.stopPropagation(),P(this).hasClass("bs-select-all")?C.selectAll():C.deselectAll()}),this.$button.on("focus"+j,function(e){var t=C.$element[0].getAttribute("tabindex");void 0!==t&&e.originalEvent&&e.originalEvent.isTrusted&&(this.setAttribute("tabindex",t),C.$element[0].setAttribute("tabindex",-1),C.selectpicker.view.tabindex=t)}).on("blur"+j,function(e){void 0!==C.selectpicker.view.tabindex&&e.originalEvent&&e.originalEvent.isTrusted&&(C.$element[0].setAttribute("tabindex",C.selectpicker.view.tabindex),this.setAttribute("tabindex",-1),C.selectpicker.view.tabindex=void 0)}),this.$element.on("change"+j,function(){C.render(),C.$element.trigger("changed"+j,T),T=null}).on("focus"+j,function(){C.options.mobile||C.$button[0].focus()})},liveSearchListener:function(){var u=this;this.$button.on("click.bs.dropdown.data-api",function(){u.$searchbox.val()&&(u.$searchbox.val(""),u.selectpicker.search.previousValue=void 0)}),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(e){e.stopPropagation()}),this.$searchbox.on("input propertychange",function(){var e=u.$searchbox[0].value;if(u.selectpicker.search.elements=[],u.selectpicker.search.data=[],e){var t=[],i=e.toUpperCase(),s={},n=[],o=u._searchStyle(),r=u.options.liveSearchNormalize;r&&(i=w(i));for(var l=0;l=a.selectpicker.view.canHighlight.length&&(t=a.selectpicker.view.firstHighlightIndex),a.selectpicker.view.canHighlight[t+f]||(t=t+1+a.selectpicker.view.canHighlight.slice(t+f+1).indexOf(!0))),e.preventDefault();var m=f+t;e.which===B?0===f&&t===c.length-1?(a.$menuInner[0].scrollTop=a.$menuInner[0].scrollHeight,m=a.selectpicker.current.elements.length-1):d=(o=(n=a.selectpicker.current.data[m]).position-n.height)u+a.sizeInfo.menuInnerHeight),s=a.selectpicker.main.elements[v],a.activeIndex=b[x],a.focusItem(s),s&&s.firstChild.focus(),d&&(a.$menuInner[0].scrollTop=o),r.trigger("focus")}}i&&(e.which===D&&!a.selectpicker.keydown.keyHistory||e.which===L||e.which===H&&a.options.selectOnTab)&&(e.which!==D&&e.preventDefault(),a.options.liveSearch&&e.which===D||(a.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),a.options.liveSearch||(e.preventDefault(),P(document).data("spaceSelect",!0))))}},mobile:function(){this.options.mobile=!0,this.$element[0].classList.add("mobile-device")},refresh:function(){var e=P.extend({},this.options,this.$element.data());this.options=e,this.checkDisabled(),this.buildData(),this.setStyle(),this.render(),this.buildList(),this.setWidth(),this.setSize(!0),this.$element.trigger("refreshed"+j)},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove(),this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove(),this.$bsContainer?this.$bsContainer.remove():this.$menu.remove(),this.selectpicker.view.titleOption&&this.selectpicker.view.titleOption.parentNode&&this.selectpicker.view.titleOption.parentNode.removeChild(this.selectpicker.view.titleOption),this.$element.off(j).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),P(window).off(j+"."+this.selectId)}};var J=P.fn.selectpicker;function Q(){if(P.fn.dropdown)return(P.fn.dropdown.Constructor._dataApiKeydownHandler||P.fn.dropdown.Constructor.prototype.keydown).apply(this,arguments)}P.fn.selectpicker=Z,P.fn.selectpicker.Constructor=Y,P.fn.selectpicker.noConflict=function(){return P.fn.selectpicker=J,this},P(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api",':not(.bootstrap-select) > [data-toggle="dropdown"]',Q).on("keydown.bs.dropdown.data-api",":not(.bootstrap-select) > .dropdown-menu",Q).on("keydown"+j,'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',Y.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',function(e){e.stopPropagation()}),P(window).on("load"+j+".data-api",function(){P(".selectpicker").each(function(){var e=P(this);Z.call(e,e.data())})})}(e)}); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css deleted file mode 100644 index 7e150cf59..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @author zhixin wen - * version: 1.19.1 - * https://github.com/wenzhixin/bootstrap-table/ - */ -.bootstrap-table .fixed-table-toolbar::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-toolbar .bs-bars,.bootstrap-table .fixed-table-toolbar .columns,.bootstrap-table .fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group>.btn{border-radius:0}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .fixed-table-toolbar .columns .dropdown-menu{text-align:left;max-height:300px;overflow:auto;-ms-overflow-style:scrollbar;z-index:1001}.bootstrap-table .fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.bootstrap-table .fixed-table-toolbar .columns-left{margin-right:5px}.bootstrap-table .fixed-table-toolbar .columns-right{margin-left:5px}.bootstrap-table .fixed-table-toolbar .pull-right .dropdown-menu{right:0;left:auto}.bootstrap-table .fixed-table-container{position:relative;clear:both}.bootstrap-table .fixed-table-container .table{width:100%;margin-bottom:0!important}.bootstrap-table .fixed-table-container .table td,.bootstrap-table .fixed-table-container .table th{vertical-align:middle;box-sizing:border-box}.bootstrap-table .fixed-table-container .table thead th{vertical-align:bottom;padding:0;margin:0}.bootstrap-table .fixed-table-container .table thead th:focus{outline:0 solid transparent}.bootstrap-table .fixed-table-container .table thead th.detail{width:30px}.bootstrap-table .fixed-table-container .table thead th .th-inner{padding:.75rem;vertical-align:bottom;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bootstrap-table .fixed-table-container .table thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px!important}.bootstrap-table .fixed-table-container .table thead th .both{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC")}.bootstrap-table .fixed-table-container .table thead th .asc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==")}.bootstrap-table .fixed-table-container .table thead th .desc{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII= ")}.bootstrap-table .fixed-table-container .table tbody tr.selected td{background-color:rgba(0,0,0,.075)}.bootstrap-table .fixed-table-container .table tbody tr.no-records-found td{text-align:center}.bootstrap-table .fixed-table-container .table tbody tr .card-view{display:flex}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-title{font-weight:700;display:inline-block;min-width:30%;width:auto!important;text-align:left!important}.bootstrap-table .fixed-table-container .table tbody tr .card-view .card-view-value{width:100%!important}.bootstrap-table .fixed-table-container .table .bs-checkbox{text-align:center}.bootstrap-table .fixed-table-container .table .bs-checkbox label{margin-bottom:0}.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=checkbox],.bootstrap-table .fixed-table-container .table .bs-checkbox label input[type=radio]{margin:0 auto!important}.bootstrap-table .fixed-table-container .table.table-sm .th-inner{padding:.3rem}.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer){border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height.has-card-view{border-top:1px solid #dee2e6;border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .fixed-table-border{border-left:1px solid #dee2e6;border-right:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table thead th{border-bottom:1px solid #dee2e6}.bootstrap-table .fixed-table-container.fixed-height .table-dark thead th{border-bottom:1px solid #32383e}.bootstrap-table .fixed-table-container .fixed-table-header{overflow:hidden}.bootstrap-table .fixed-table-container .fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading{align-items:center;background:#fff;display:flex;justify-content:center;position:absolute;bottom:0;width:100%;max-width:100%;z-index:1000;transition:visibility 0s,opacity .15s ease-in-out;opacity:0;visibility:hidden}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.open{visibility:visible;opacity:1}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap{align-items:baseline;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .loading-text{margin-right:6px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap{align-items:center;display:flex;justify-content:center}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::before{content:"";animation-duration:1.5s;animation-iteration-count:infinite;animation-name:LOADING;background:#212529;border-radius:50%;display:block;height:5px;margin:0 4px;opacity:0;width:5px}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-dot{animation-delay:.3s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading .loading-wrap .animation-wrap::after{animation-delay:.6s}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark{background:#212529}.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-dot,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::after,.bootstrap-table .fixed-table-container .fixed-table-body .fixed-table-loading.table-dark .animation-wrap::before{background:#fff}.bootstrap-table .fixed-table-container .fixed-table-footer{overflow:hidden}.bootstrap-table .fixed-table-pagination::after{content:"";display:block;clear:both}.bootstrap-table .fixed-table-pagination>.pagination,.bootstrap-table .fixed-table-pagination>.pagination-detail{margin-top:10px;margin-bottom:10px}.bootstrap-table .fixed-table-pagination>.pagination-detail .pagination-info{line-height:34px;margin-right:5px}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list{display:inline-block}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group{position:relative;display:inline-block;vertical-align:middle}.bootstrap-table .fixed-table-pagination>.pagination-detail .page-list .btn-group .dropdown-menu{margin-bottom:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination{margin:0}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a{color:#c8c8c8}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::before{content:'\2B05'}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.page-intermediate a::after{content:'\27A1'}.bootstrap-table .fixed-table-pagination>.pagination ul.pagination li.disabled a{pointer-events:none;cursor:default}.bootstrap-table.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%!important;background:#fff;height:calc(100vh);overflow-y:scroll}.bootstrap-table.bootstrap4 .pagination-lg .page-link,.bootstrap-table.bootstrap5 .pagination-lg .page-link{padding:.5rem 1rem}.bootstrap-table.bootstrap5 .float-left{float:left}.bootstrap-table.bootstrap5 .float-right{float:right}div.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}@keyframes LOADING{0%{opacity:0}50%{opacity:1}to{opacity:0}} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js deleted file mode 100644 index f7e0b862a..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/bootstrap-table.min.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * @author zhixin wen - * version: 1.19.1 - * https://github.com/wenzhixin/bootstrap-table/ - */ -function getRememberRowIds(t,e){return $.isArray(t)?props=$.map(t,function(t){return t[e]}):props=[t[e]],props}function addRememberRow(t,e){var i=null==table.options.uniqueId?table.options.columns[1].field:table.options.uniqueId,n=getRememberRowIds(t,i);-1==$.inArray(e[i],n)&&(t[t.length]=e)}function removeRememberRow(t,e){var i=null==table.options.uniqueId?table.options.columns[1].field:table.options.uniqueId,n=getRememberRowIds(t,i),o=$.inArray(e[i],n);-1!=o&&t.splice(o,1)}!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,t.BootstrapTable=e(t.jQuery))}(this,function(t){function e(t){return t&&"object"==typeof t&&"default" in t?t:{"default":t}}function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e)){throw new TypeError("Cannot call a class as a function")}}function o(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=Array(e);e>i;i++){n[i]=t[i]}return n}function p(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=d(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return s=t.done,t},e:function(t){r=!0,a=t},f:function(){try{s||null==i["return"]||i["return"]()}finally{if(r){throw a}}}}}function b(t,e){return e={exports:{}},t(e,e.exports),e.exports}function m(t,e){return RegExp(t,e)}var y=e(t),w="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S=function(t){return t&&t.Math==Math&&t},x=S("object"==typeof globalThis&&globalThis)||S("object"==typeof window&&window)||S("object"==typeof self&&self)||S("object"==typeof w&&w)||function(){return this}()||Function("return this")(),k=function(t){try{return !!t()}catch(e){return !0}},O=!k(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),T={}.propertyIsEnumerable,C=Object.getOwnPropertyDescriptor,P=C&&!T.call({1:2},1),I=P?function(t){var e=C(this,t);return !!e&&e.enumerable}:T,A={f:I},$=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},R={}.toString,E=function(t){return R.call(t).slice(8,-1)},j="".split,_=k(function(){return !Object("z").propertyIsEnumerable(0)})?function(t){return"String"==E(t)?j.call(t,""):Object(t)}:Object,N=function(t){if(void 0==t){throw TypeError("Can't call method on "+t)}return t},F=function(t){return _(N(t))},D=function(t){return"object"==typeof t?null!==t:"function"==typeof t},V=function(t,e){if(!D(t)){return t}var i,n;if(e&&"function"==typeof(i=t.toString)&&!D(n=i.call(t))){return n}if("function"==typeof(i=t.valueOf)&&!D(n=i.call(t))){return n}if(!e&&"function"==typeof(i=t.toString)&&!D(n=i.call(t))){return n}throw TypeError("Can't convert object to primitive value")},B={}.hasOwnProperty,L=function(t,e){return B.call(t,e)},H=x.document,M=D(H)&&D(H.createElement),U=function(t){return M?H.createElement(t):{}},q=!O&&!k(function(){return 7!=Object.defineProperty(U("div"),"a",{get:function(){return 7}}).a}),z=Object.getOwnPropertyDescriptor,W=O?z:function(t,e){if(t=F(t),e=V(e,!0),q){try{return z(t,e)}catch(i){}}return L(t,e)?$(!A.f.call(t,e),t[e]):void 0},G={f:W},K=function(t){if(!D(t)){throw TypeError(t+" is not an object")}return t},Y=Object.defineProperty,X=O?Y:function(t,e,i){if(K(t),e=V(e,!0),K(i),q){try{return Y(t,e,i)}catch(n){}}if("get" in i||"set" in i){throw TypeError("Accessors not supported")}return"value" in i&&(t[e]=i.value),t},J={f:X},Q=O?function(t,e,i){return J.f(t,e,$(1,i))}:function(t,e,i){return t[e]=i,t},Z=function(t,e){try{Q(x,t,e)}catch(i){x[t]=e}return e},tt="__core-js_shared__",et=x[tt]||Z(tt,{}),it=et,nt=Function.toString;"function"!=typeof it.inspectSource&&(it.inspectSource=function(t){return nt.call(t)});var ot,at,st,rt=it.inspectSource,lt=x.WeakMap,ct="function"==typeof lt&&/native code/.test(rt(lt)),ht=b(function(t){(t.exports=function(t,e){return it[t]||(it[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.10.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})}),ut=0,dt=Math.random(),ft=function(t){return"Symbol("+((void 0===t?"":t)+"")+")_"+(++ut+dt).toString(36)},pt=ht("keys"),gt=function(t){return pt[t]||(pt[t]=ft(t))},vt={},bt=x.WeakMap,mt=function(t){return st(t)?at(t):ot(t,{})},yt=function(t){return function(e){var i;if(!D(e)||(i=at(e)).type!==t){throw TypeError("Incompatible receiver, "+t+" required")}return i}};if(ct){var wt=it.state||(it.state=new bt),St=wt.get,xt=wt.has,kt=wt.set;ot=function(t,e){return e.facade=t,kt.call(wt,t,e),e},at=function(t){return St.call(wt,t)||{}},st=function(t){return xt.call(wt,t)}}else{var Ot=gt("state");vt[Ot]=!0,ot=function(t,e){return e.facade=t,Q(t,Ot,e),e},at=function(t){return L(t,Ot)?t[Ot]:{}},st=function(t){return L(t,Ot)}}var Tt={set:ot,get:at,has:st,enforce:mt,getterFor:yt},Ct=b(function(t){var e=Tt.get,i=Tt.enforce,n=(String+"").split("String");(t.exports=function(t,e,o,a){var s,r=a?!!a.unsafe:!1,l=a?!!a.enumerable:!1,c=a?!!a.noTargetGet:!1;return"function"==typeof o&&("string"!=typeof e||L(o,"name")||Q(o,"name",e),s=i(o),s.source||(s.source=n.join("string"==typeof e?e:""))),t===x?void (l?t[e]=o:Z(e,o)):(r?!c&&t[e]&&(l=!0):delete t[e],void (l?t[e]=o:Q(t,e,o)))})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||rt(this)})}),Pt=x,It=function(t){return"function"==typeof t?t:void 0},At=function(t,e){return arguments.length<2?It(Pt[t])||It(x[t]):Pt[t]&&Pt[t][e]||x[t]&&x[t][e]},$t=Math.ceil,Rt=Math.floor,Et=function(t){return isNaN(t=+t)?0:(t>0?Rt:$t)(t)},jt=Math.min,_t=function(t){return t>0?jt(Et(t),9007199254740991):0},Nt=Math.max,Ft=Math.min,Dt=function(t,e){var i=Et(t);return 0>i?Nt(i+e,0):Ft(i,e)},Vt=function(t){return function(e,i,n){var o,a=F(e),s=_t(a.length),r=Dt(n,s);if(t&&i!=i){for(;s>r;){if(o=a[r++],o!=o){return !0}}}else{for(;s>r;r++){if((t||r in a)&&a[r]===i){return t||r||0}}}return !t&&-1}},Bt={includes:Vt(!0),indexOf:Vt(!1)},Lt=Bt.indexOf,Ht=function(t,e){var i,n=F(t),o=0,a=[];for(i in n){!L(vt,i)&&L(n,i)&&a.push(i)}for(;e.length>o;){L(n,i=e[o++])&&(~Lt(a,i)||a.push(i))}return a},Mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ut=Mt.concat("length","prototype"),qt=Object.getOwnPropertyNames||function(t){return Ht(t,Ut)},zt={f:qt},Wt=Object.getOwnPropertySymbols,Gt={f:Wt},Kt=At("Reflect","ownKeys")||function(t){var e=zt.f(K(t)),i=Gt.f;return i?e.concat(i(t)):e},Yt=function(t,e){for(var i=Kt(e),n=J.f,o=G.f,a=0;a0&&(!a.multiline||a.multiline&&"\n"!==t[a.lastIndex-1])&&(l="(?: "+l+")",h=" "+h,c++),i=RegExp("^(?:"+l+")",r)),Pe&&(i=RegExp("^"+l+"$(?!\\s)",r)),Te&&(e=a.lastIndex),n=xe.call(s?i:a,h),s?n?(n.input=n.input.slice(c),n[0]=n[0].slice(c),n.index=a.lastIndex,a.lastIndex+=n[0].length):a.lastIndex=0:Te&&n&&(a.lastIndex=a.global?n.index+n[0].length:e),Pe&&n&&n.length>1&&ke.call(n[0],i,function(){for(o=1;o=74)&&($e=je.match(/Chrome\/(\d+)/),$e&&(Re=$e[1])));var De=Re&&+Re,Ve=!!Object.getOwnPropertySymbols&&!k(function(){return !Symbol.sham&&(Ee?38===De:De>37&&41>De)}),Be=Ve&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Le=ht("wks"),He=x.Symbol,Me=Be?He:He&&He.withoutSetter||ft,Ue=function(t){return(!L(Le,t)||!Ve&&"string"!=typeof Le[t])&&(Ve&&L(He,t)?Le[t]=He[t]:Le[t]=Me("Symbol."+t)),Le[t]},qe=Ue("species"),ze=!k(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}),We=function(){return"$0"==="a".replace(/./,"$0")}(),Ge=Ue("replace"),Ke=function(){return/./[Ge]?""===/./[Ge]("a","$0"):!1}(),Ye=!k(function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var i="ab".split(t);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}),Xe=function(t,e,i,n){var o=Ue(t),a=!k(function(){var e={};return e[o]=function(){return 7},7!=""[t](e)}),s=a&&!k(function(){var e=!1,i=/a/;return"split"===t&&(i={},i.constructor={},i.constructor[qe]=function(){return i},i.flags="",i[o]=/./[o]),i.exec=function(){return e=!0,null},i[o](""),!e});if(!a||!s||"replace"===t&&(!ze||!We||Ke)||"split"===t&&!Ye){var r=/./[o],l=i(o,""[t],function(t,e,i,n,o){return e.exec===RegExp.prototype.exec?a&&!o?{done:!0,value:r.call(e,i,n)}:{done:!0,value:t.call(i,e,n)}:{done:!1}},{REPLACE_KEEPS_$0:We,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Ke}),c=l[0],h=l[1];Ct(String.prototype,t,c),Ct(RegExp.prototype,o,2==e?function(t,e){return h.call(t,this,e)}:function(t){return h.call(t,this)})}n&&Q(RegExp.prototype[o],"sham",!0)},Je=Ue("match"),Qe=function(t){var e;return D(t)&&(void 0!==(e=t[Je])?!!e:"RegExp"==E(t))},Ze=function(t){if("function"!=typeof t){throw TypeError(t+" is not a function")}return t},ti=Ue("species"),ei=function(t,e){var i,n=K(t).constructor;return void 0===n||void 0==(i=K(n)[ti])?e:Ze(i)},ii=function(t){return function(e,i){var n,o,a=N(e)+"",s=Et(i),r=a.length;return 0>s||s>=r?t?"":void 0:(n=a.charCodeAt(s),55296>n||n>56319||s+1===r||(o=a.charCodeAt(s+1))<56320||o>57343?t?a.charAt(s):n:t?a.slice(s,s+2):(n-55296<<10)+(o-56320)+65536)}},ni={codeAt:ii(!1),charAt:ii(!0)},oi=ni.charAt,ai=function(t,e,i){return e+(i?oi(t,e).length:1)},si=function(t,e){var i=t.exec;if("function"==typeof i){var n=i.call(t,e);if("object"!=typeof n){throw TypeError("RegExp exec method returned something other than an Object or null")}return n}if("RegExp"!==E(t)){throw TypeError("RegExp#exec called on incompatible receiver")}return Ae.call(t,e)},ri=Se.UNSUPPORTED_Y,li=[].push,ci=Math.min,hi=4294967295;Xe("split",2,function(t,e,i){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,i){var n=N(this)+"",o=void 0===i?hi:i>>>0;if(0===o){return[]}if(void 0===t){return[n]}if(!Qe(t)){return e.call(n,t,o)}for(var a,s,r,l=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),h=0,u=RegExp(t.source,c+"g");(a=Ae.call(u,n))&&(s=u.lastIndex,!(s>h&&(l.push(n.slice(h,a.index)),a.length>1&&a.index=o)));){u.lastIndex===a.index&&u.lastIndex++}return h===n.length?(r||!u.test(""))&&l.push(""):l.push(n.slice(h)),l.length>o?l.slice(0,o):l}:"0".split(void 0,0).length?function(t,i){return void 0===t&&0===i?[]:e.call(this,t,i)}:e,[function(e,i){var o=N(this),a=void 0==e?void 0:e[t];return void 0!==a?a.call(e,o,i):n.call(o+"",e,i)},function(t,o){var a=i(n,t,this,o,n!==e);if(a.done){return a.value}var s=K(t),r=this+"",l=ei(s,RegExp),c=s.unicode,h=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(ri?"g":"y"),u=new l(ri?"^(?:"+s.source+")":s,h),d=void 0===o?hi:o>>>0;if(0===d){return[]}if(0===r.length){return null===si(u,r)?[r]:[]}for(var f=0,p=0,g=[];ps;){i=o[s++],(!O||di.call(n,i))&&r.push(t?[i,n[i]]:n[i])}return r}},pi={entries:fi(!0),values:fi(!1)},gi=pi.entries;oe({target:"Object",stat:!0},{entries:function(t){return gi(t)}});var vi,bi=O?Object.defineProperties:function(t,e){K(t);for(var i,n=ui(e),o=n.length,a=0;o>a;){J.f(t,i=n[a++],e[i])}return t},mi=At("document","documentElement"),yi=">",wi="<",Si="prototype",xi="script",ki=gt("IE_PROTO"),Oi=function(){},Ti=function(t){return wi+xi+yi+t+wi+"/"+xi+yi},Ci=function(t){t.write(Ti("")),t.close();var e=t.parentWindow.Object;return t=null,e},Pi=function(){var t,e=U("iframe"),i="java"+xi+":";return e.style.display="none",mi.appendChild(e),e.src=i+"",t=e.contentWindow.document,t.open(),t.write(Ti("document.F=Object")),t.close(),t.F},Ii=function(){try{vi=document.domain&&new ActiveXObject("htmlfile")}catch(t){}Ii=vi?Ci(vi):Pi();for(var e=Mt.length;e--;){delete Ii[Si][Mt[e]]}return Ii()};vt[ki]=!0;var Ai=Object.create||function(t,e){var i;return null!==t?(Oi[Si]=K(t),i=new Oi,Oi[Si]=null,i[ki]=t):i=Ii(),void 0===e?i:bi(i,e)},$i=Ue("unscopables"),Ri=Array.prototype;void 0==Ri[$i]&&J.f(Ri,$i,{configurable:!0,value:Ai(null)});var Ei=function(t){Ri[$i][t]=!0},ji=Bt.includes;oe({target:"Array",proto:!0},{includes:function(t){return ji(this,t,arguments.length>1?arguments[1]:void 0)}}),Ei("includes");var _i=Array.isArray||function(t){return"Array"==E(t)},Ni=function(t){return Object(N(t))},Fi=function(t,e,i){var n=V(e);n in t?J.f(t,n,$(0,i)):t[n]=i},Di=Ue("species"),Vi=function(t,e){var i;return _i(t)&&(i=t.constructor,"function"!=typeof i||i!==Array&&!_i(i.prototype)?D(i)&&(i=i[Di],null===i&&(i=void 0)):i=void 0),new (void 0===i?Array:i)(0===e?0:e)},Bi=Ue("species"),Li=function(t){return De>=51||!k(function(){var e=[],i=e.constructor={};return i[Bi]=function(){return{foo:1}},1!==e[t](Boolean).foo})},Hi=Ue("isConcatSpreadable"),Mi=9007199254740991,Ui="Maximum allowed index exceeded",qi=De>=51||!k(function(){var t=[];return t[Hi]=!1,t.concat()[0]!==t}),zi=Li("concat"),Wi=function(t){if(!D(t)){return !1}var e=t[Hi];return void 0!==e?!!e:_i(t)},Gi=!qi||!zi;oe({target:"Array",proto:!0,forced:Gi},{concat:function(t){var e,i,n,o,a,s=Ni(this),r=Vi(s,0),l=0;for(e=-1,n=arguments.length;n>e;e++){if(a=-1===e?s:arguments[e],Wi(a)){if(o=_t(a.length),l+o>Mi){throw TypeError(Ui)}for(i=0;o>i;i++,l++){i in a&&Fi(r,l,a[i])}}else{if(l>=Mi){throw TypeError(Ui)}Fi(r,l++,a)}}return r.length=l,r}});var Ki=function(t,e,i){if(Ze(t),void 0===e){return t}switch(i){case 0:return function(){return t.call(e)};case 1:return function(i){return t.call(e,i)};case 2:return function(i,n){return t.call(e,i,n)};case 3:return function(i,n,o){return t.call(e,i,n,o)}}return function(){return t.apply(e,arguments)}},Yi=[].push,Xi=function(t){var e=1==t,i=2==t,n=3==t,o=4==t,a=6==t,s=7==t,r=5==t||a;return function(l,c,h,u){for(var d,f,p=Ni(l),g=_(p),v=Ki(c,h,3),b=_t(g.length),m=0,y=u||Vi,w=e?y(l,b):i||s?y(l,0):void 0;b>m;m++){if((r||m in g)&&(d=g[m],f=v(d,m,p),t)){if(e){w[m]=f}else{if(f){switch(t){case 3:return !0;case 5:return d;case 6:return m;case 2:Yi.call(w,d)}}else{switch(t){case 4:return !1;case 7:Yi.call(w,d)}}}}}return a?-1:n||o?o:w}},Ji={forEach:Xi(0),map:Xi(1),filter:Xi(2),some:Xi(3),every:Xi(4),find:Xi(5),findIndex:Xi(6),filterOut:Xi(7)},Qi=Ji.find,Zi="find",tn=!0;Zi in []&&Array(1)[Zi](function(){tn=!1}),oe({target:"Array",proto:!0,forced:tn},{find:function(t){return Qi(this,t,arguments.length>1?arguments[1]:void 0)}}),Ei(Zi);var en=function(t){if(Qe(t)){throw TypeError("The method doesn't accept regular expressions")}return t},nn=Ue("match"),on=function(t){var e=/./;try{"/./"[t](e)}catch(i){try{return e[nn]=!1,"/./"[t](e)}catch(n){}}return !1};oe({target:"String",proto:!0,forced:!on("includes")},{includes:function(t){return !!~(N(this)+"").indexOf(en(t),arguments.length>1?arguments[1]:void 0)}});var an={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},sn=Ji.forEach,rn=pe("forEach"),ln=rn?[].forEach:function(t){return sn(this,t,arguments.length>1?arguments[1]:void 0)};for(var cn in an){var hn=x[cn],un=hn&&hn.prototype;if(un&&un.forEach!==ln){try{Q(un,"forEach",ln)}catch(dn){un.forEach=ln}}}var fn=he.trim,pn=x.parseFloat,gn=1/pn(ae+"-0")!==-(1/0),vn=gn?function(t){var e=fn(t+""),i=pn(e);return 0===i&&"-"==e.charAt(0)?-0:i}:pn;oe({global:!0,forced:parseFloat!=vn},{parseFloat:vn});var bn=Bt.indexOf,mn=[].indexOf,yn=!!mn&&1/[1].indexOf(1,-0)<0,wn=pe("indexOf");oe({target:"Array",proto:!0,forced:yn||!wn},{indexOf:function(t){return yn?mn.apply(this,arguments)||0:bn(this,t,arguments.length>1?arguments[1]:void 0)}});var Sn=[],xn=Sn.sort,kn=k(function(){Sn.sort(void 0)}),On=k(function(){Sn.sort(null)}),Tn=pe("sort"),Cn=kn||!On||!Tn;oe({target:"Array",proto:!0,forced:Cn},{sort:function(t){return void 0===t?xn.call(Ni(this)):xn.call(Ni(this),Ze(t))}});var Pn=Math.floor,In="".replace,An=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,$n=/\$([$&'`]|\d{1,2})/g,Rn=function(t,e,i,n,o,a){var s=i+t.length,r=n.length,l=$n;return void 0!==o&&(o=Ni(o),l=An),In.call(a,l,function(a,l){var c;switch(l.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,i);case"'":return e.slice(s);case"<":c=o[l.slice(1,-1)];break;default:var h=+l;if(0===h){return a}if(h>r){var u=Pn(h/10);return 0===u?a:r>=u?void 0===n[u-1]?l.charAt(1):n[u-1]+l.charAt(1):a}c=n[h-1]}return void 0===c?"":c})},En=Math.max,jn=Math.min,_n=function(t){return void 0===t?t:t+""};Xe("replace",2,function(t,e,i,n){var o=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE,a=n.REPLACE_KEEPS_$0,s=o?"$":"$0";return[function(i,n){var o=N(this),a=void 0==i?void 0:i[t];return void 0!==a?a.call(i,o,n):e.call(o+"",i,n)},function(t,n){if(!o&&a||"string"==typeof n&&-1===n.indexOf(s)){var r=i(e,t,this,n);if(r.done){return r.value}}var l=K(t),c=this+"",h="function"==typeof n;h||(n+="");var u=l.global;if(u){var d=l.unicode;l.lastIndex=0}for(var f=[];;){var p=si(l,c);if(null===p){break}if(f.push(p),!u){break}var g=p[0]+"";""===g&&(l.lastIndex=ai(c,_t(l.lastIndex),d))}for(var v="",b=0,m=0;m=b&&(v+=c.slice(b,w)+T,b=w+y.length)}return v+c.slice(b)}]});var Nn=Object.assign,Fn=Object.defineProperty,Dn=!Nn||k(function(){if(O&&1!==Nn({b:1},Nn(Fn({},"a",{enumerable:!0,get:function(){Fn(this,"b",{value:3,enumerable:!1})}}),{b:2})).b){return !0}var t={},e={},i=Symbol(),n="abcdefghijklmnopqrst";return t[i]=7,n.split("").forEach(function(t){e[t]=t}),7!=Nn({},t)[i]||ui(Nn({},e)).join("")!=n})?function(t,e){for(var i=Ni(t),n=arguments.length,o=1,a=Gt.f,s=A.f;n>o;){for(var r,l=_(arguments[o++]),c=a?ui(l).concat(a(l)):ui(l),h=c.length,u=0;h>u;){r=c[u++],(!O||s.call(l,r))&&(i[r]=l[r])}}return i}:Nn;oe({target:"Object",stat:!0,forced:Object.assign!==Dn},{assign:Dn});var Vn=Ji.filter,Bn=Li("filter");oe({target:"Array",proto:!0,forced:!Bn},{filter:function(t){return Vn(this,t,arguments.length>1?arguments[1]:void 0)}});var Ln=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e};Xe("search",1,function(t,e,i){return[function(e){var i=N(this),n=void 0==e?void 0:e[t];return void 0!==n?n.call(e,i):RegExp(e)[t](i+"")},function(t){var n=i(e,t,this);if(n.done){return n.value}var o=K(t),a=this+"",s=o.lastIndex;Ln(s,0)||(o.lastIndex=0);var r=si(o,a);return Ln(o.lastIndex,s)||(o.lastIndex=s),null===r?-1:r.index}]});var Hn=he.trim,Mn=x.parseInt,Un=/^[+-]?0[Xx]/,qn=8!==Mn(ae+"08")||22!==Mn(ae+"0x16"),zn=qn?function(t,e){var i=Hn(t+"");return Mn(i,e>>>0||(Un.test(i)?16:10))}:Mn;oe({global:!0,forced:parseInt!=zn},{parseInt:zn});var Wn=Ji.map,Gn=Li("map");oe({target:"Array",proto:!0,forced:!Gn},{map:function(t){return Wn(this,t,arguments.length>1?arguments[1]:void 0)}});var Kn=Ji.findIndex,Yn="findIndex",Xn=!0;Yn in []&&Array(1)[Yn](function(){Xn=!1}),oe({target:"Array",proto:!0,forced:Xn},{findIndex:function(t){return Kn(this,t,arguments.length>1?arguments[1]:void 0)}}),Ei(Yn);var Jn=function(t){if(!D(t)&&null!==t){throw TypeError("Can't set "+(t+"")+" as a prototype")}return t},Qn=Object.setPrototypeOf||("__proto__" in {}?function(){var t,e=!1,i={};try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,t.call(i,[]),e=i instanceof Array}catch(n){}return function(i,n){return K(i),Jn(n),e?t.call(i,n):i.__proto__=n,i}}():void 0),Zn=function(t,e,i){var n,o;return Qn&&"function"==typeof(n=e.constructor)&&n!==i&&D(o=n.prototype)&&o!==i.prototype&&Qn(t,o),t},to=Ue("species"),eo=function(t){var e=At(t),i=J.f;O&&e&&!e[to]&&i(e,to,{configurable:!0,get:function(){return this}})},io=J.f,no=zt.f,oo=Tt.set,ao=Ue("match"),so=x.RegExp,ro=so.prototype,lo=/a/g,co=/a/g,ho=new so(lo)!==lo,uo=Se.UNSUPPORTED_Y,fo=O&&ie("RegExp",!ho||uo||k(function(){return co[ao]=!1,so(lo)!=lo||so(co)==co||"/a/i"!=so(lo,"i")}));if(fo){for(var po=function(t,e){var i,n=this instanceof po,o=Qe(t),a=void 0===e;if(!n&&o&&t.constructor===po&&a){return t}ho?o&&!a&&(t=t.source):t instanceof po&&(a&&(e=me.call(t)),t=t.source),uo&&(i=!!e&&e.indexOf("y")>-1,i&&(e=e.replace(/y/g,"")));var s=Zn(ho?new so(t,e):so(t,e),n?this:ro,po);return uo&&i&&oo(s,{sticky:i}),s},go=(function(t){t in po||io(po,t,{configurable:!0,get:function(){return so[t]},set:function(e){so[t]=e}})}),vo=no(so),bo=0;vo.length>bo;){go(vo[bo++])}ro.constructor=po,po.prototype=ro,Ct(x,"RegExp",po)}eo("RegExp");var mo="toString",yo=RegExp.prototype,wo=yo[mo],So=k(function(){return"/a/b"!=wo.call({source:"a",flags:"b"})}),xo=wo.name!=mo;(So||xo)&&Ct(RegExp.prototype,mo,function(){var t=K(this),e=t.source+"",i=t.flags,n=(void 0===i&&t instanceof RegExp&&!("flags" in yo)?me.call(t):i)+"";return"/"+e+"/"+n},{unsafe:!0});var ko=Ue("toStringTag"),Oo={};Oo[ko]="z";var To=Oo+""=="[object z]",Co=Ue("toStringTag"),Po="Arguments"==E(function(){return arguments}()),Io=function(t,e){try{return t[e]}catch(i){}},Ao=To?E:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=Io(e=Object(t),Co))?i:Po?E(e):"Object"==(n=E(e))&&"function"==typeof e.callee?"Arguments":n},$o=To?{}.toString:function(){return"[object "+Ao(this)+"]"};To||Ct(Object.prototype,"toString",$o,{unsafe:!0});var Ro=Li("slice"),Eo=Ue("species"),jo=[].slice,_o=Math.max;oe({target:"Array",proto:!0,forced:!Ro},{slice:function(t,e){var i,n,o,a=F(this),s=_t(a.length),r=Dt(t,s),l=Dt(void 0===e?s:e,s);if(_i(a)&&(i=a.constructor,"function"!=typeof i||i!==Array&&!_i(i.prototype)?D(i)&&(i=i[Eo],null===i&&(i=void 0)):i=void 0,i===Array||void 0===i)){return jo.call(a,r,l)}for(n=new (void 0===i?Array:i)(_o(l-r,0)),o=0;l>r;r++,o++){r in a&&Fi(n,o,a[r])}return n.length=o,n}});var No,Fo,Do,Vo=!k(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Bo=gt("IE_PROTO"),Lo=Object.prototype,Ho=Vo?Object.getPrototypeOf:function(t){return t=Ni(t),L(t,Bo)?t[Bo]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Lo:null},Mo=Ue("iterator"),Uo=!1,qo=function(){return this};[].keys&&(Do=[].keys(),"next" in Do?(Fo=Ho(Ho(Do)),Fo!==Object.prototype&&(No=Fo)):Uo=!0);var zo=void 0==No||k(function(){var t={};return No[Mo].call(t)!==t});zo&&(No={}),L(No,Mo)||Q(No,Mo,qo);var Wo={IteratorPrototype:No,BUGGY_SAFARI_ITERATORS:Uo},Go=J.f,Ko=Ue("toStringTag"),Yo=function(t,e,i){t&&!L(t=i?t:t.prototype,Ko)&&Go(t,Ko,{configurable:!0,value:e})},Xo=Wo.IteratorPrototype,Jo=function(t,e,i){var n=e+" Iterator";return t.prototype=Ai(Xo,{next:$(1,i)}),Yo(t,n,!1),t},Qo=Wo.IteratorPrototype,Zo=Wo.BUGGY_SAFARI_ITERATORS,ta=Ue("iterator"),ea="keys",ia="values",na="entries",oa=function(){return this},aa=function(t,e,i,n,o,a,s){Jo(i,e,n);var r,l,c,h=function(t){if(t===o&&g){return g}if(!Zo&&t in f){return f[t]}switch(t){case ea:return function(){return new i(this,t)};case ia:return function(){return new i(this,t)};case na:return function(){return new i(this,t)}}return function(){return new i(this)}},u=e+" Iterator",d=!1,f=t.prototype,p=f[ta]||f["@@iterator"]||o&&f[o],g=!Zo&&p||h(o),v="Array"==e?f.entries||p:p;if(v&&(r=Ho(v.call(new t)),Qo!==Object.prototype&&r.next&&(Ho(r)!==Qo&&(Qn?Qn(r,Qo):"function"!=typeof r[ta]&&Q(r,ta,oa)),Yo(r,u,!0))),o==ia&&p&&p.name!==ia&&(d=!0,g=function(){return p.call(this)}),f[ta]!==g&&Q(f,ta,g),o){if(l={values:h(ia),keys:a?g:h(ea),entries:h(na)},s){for(c in l){!Zo&&!d&&c in f||Ct(f,c,l[c])}}else{oe({target:e,proto:!0,forced:Zo||d},l)}}return l},sa="Array Iterator",ra=Tt.set,la=Tt.getterFor(sa),ca=aa(Array,"Array",function(t,e){ra(this,{type:sa,target:F(t),index:0,kind:e})},function(){var t=la(this),e=t.target,i=t.kind,n=t.index++;return !e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}},"values");Ei("keys"),Ei("values"),Ei("entries");var ha=Ue("iterator"),ua=Ue("toStringTag"),da=ca.values;for(var fa in an){var pa=x[fa],ga=pa&&pa.prototype;if(ga){if(ga[ha]!==da){try{Q(ga,ha,da)}catch(dn){ga[ha]=da}}if(ga[ua]||Q(ga,ua,fa),an[fa]){for(var va in ca){if(ga[va]!==ca[va]){try{Q(ga,va,ca[va])}catch(dn){ga[va]=ca[va]}}}}}}var ba=Li("splice"),ma=Math.max,ya=Math.min,wa=9007199254740991,Sa="Maximum allowed length exceeded";oe({target:"Array",proto:!0,forced:!ba},{splice:function(t,e){var i,n,o,a,s,r,l=Ni(this),c=_t(l.length),h=Dt(t,c),u=arguments.length;if(0===u?i=n=0:1===u?(i=0,n=c-h):(i=u-2,n=ya(ma(Et(e),0),c-h)),c+i-n>wa){throw TypeError(Sa)}for(o=Vi(l,n),a=0;n>a;a++){s=h+a,s in l&&Fi(o,a,l[s])}if(o.length=n,n>i){for(a=h;c-n>a;a++){s=a+n,r=a+i,s in l?l[r]=l[s]:delete l[r]}for(a=c;a>c-n+i;a--){delete l[a-1]}}else{if(i>n){for(a=c-n;a>h;a--){s=a+n-1,r=a+i-1,s in l?l[r]=l[s]:delete l[r]}}}for(a=0;i>a;a++){l[a+h]=arguments[a+2]}return l.length=c-n+i,o}});var xa=zt.f,ka=G.f,Oa=J.f,Ta=he.trim,Ca="Number",Pa=x[Ca],Ia=Pa.prototype,Aa=E(Ai(Ia))==Ca,$a=function(t){var e,i,n,o,a,s,r,l,c=V(t,!1);if("string"==typeof c&&c.length>2){if(c=Ta(c),e=c.charCodeAt(0),43===e||45===e){if(i=c.charCodeAt(2),88===i||120===i){return NaN}}else{if(48===e){switch(c.charCodeAt(1)){case 66:case 98:n=2,o=49;break;case 79:case 111:n=8,o=55;break;default:return +c}for(a=c.slice(2),s=a.length,r=0;s>r;r++){if(l=a.charCodeAt(r),48>l||l>o){return NaN}}return parseInt(a,n)}}}return +c};if(ie(Ca,!Pa(" 0o1")||!Pa("0b1")||Pa("+0x1"))){for(var Ra,Ea=function(t){var e=arguments.length<1?0:t,i=this;return i instanceof Ea&&(Aa?k(function(){Ia.valueOf.call(i)}):E(i)!=Ca)?Zn(new Pa($a(e)),i,Ea):$a(e)},ja=O?xa(Pa):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),_a=0;ja.length>_a;_a++){L(Pa,Ra=ja[_a])&&!L(Ea,Ra)&&Oa(Ea,Ra,ka(Pa,Ra))}Ea.prototype=Ia,Ia.constructor=Ea,Ct(x,Ca,Ea)}var Na=[].reverse,Fa=[1,2];oe({target:"Array",proto:!0,forced:Fa+""==Fa.reverse()+""},{reverse:function(){return _i(this)&&(this.length=this.length),Na.call(this)}});var Da="1.19.1",Va=4;try{var Ba=y["default"].fn.dropdown.Constructor.VERSION;void 0!==Ba&&(Va=parseInt(Ba,10))}catch(La){}try{var Ha=bootstrap.Tooltip.VERSION;void 0!==Ha&&(Va=parseInt(Ha,10))}catch(La){}var Ma={3:{iconsPrefix:"glyphicon",icons:{paginationSwitchDown:"glyphicon-collapse-down icon-chevron-down",paginationSwitchUp:"glyphicon-collapse-up icon-chevron-up",refresh:"glyphicon-refresh icon-refresh",toggleOff:"glyphicon-list-alt icon-list-alt",toggleOn:"glyphicon-list-alt icon-list-alt",columns:"glyphicon-th icon-th",detailOpen:"glyphicon-plus icon-plus",detailClose:"glyphicon-minus icon-minus",fullscreen:"glyphicon-fullscreen",search:"glyphicon-search",clearSearch:"glyphicon-trash"},classes:{buttonsPrefix:"btn",buttons:"default",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"pull",inputGroup:"input-group",inputPrefix:"input-",input:"form-control",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{toolbarDropdown:['"],toolbarDropdownItem:'
  • ',toolbarDropdownSeparator:'
  • ',pageDropdown:['"],pageDropdownItem:'
    ',dropdownCaret:'',pagination:['
      ',"
    "],paginationItem:'
  • %s
  • ',icon:'',inputGroup:'
    %s%s
    ',searchInput:'',searchButton:'',searchClearButton:''}},4:{iconsPrefix:"fa",icons:{paginationSwitchDown:"fa-caret-square-down",paginationSwitchUp:"fa-caret-square-up",refresh:"fa-sync",toggleOff:"fa-toggle-off",toggleOn:"fa-toggle-on",columns:"fa-th-list",detailOpen:"fa-plus",detailClose:"fa-minus",fullscreen:"fa-arrows-alt",search:"fa-search",clearSearch:"fa-trash"},classes:{buttonsPrefix:"btn",buttons:"secondary",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"float",inputGroup:"btn-group",inputPrefix:"form-control-",input:"form-control",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{toolbarDropdown:['"],toolbarDropdownItem:'',pageDropdown:['"],pageDropdownItem:'%s',toolbarDropdownSeparator:'',dropdownCaret:'',pagination:['
      ',"
    "],paginationItem:'
  • %s
  • ',icon:'',inputGroup:'
    %s
    %s
    ',searchInput:'',searchButton:'',searchClearButton:''}},5:{iconsPrefix:"bi",icons:{paginationSwitchDown:"bi-caret-down-square",paginationSwitchUp:"bi-caret-up-square",refresh:"bi-arrow-clockwise",toggleOff:"bi-toggle-off",toggleOn:"bi-toggle-on",columns:"bi-list-ul",detailOpen:"bi-plus",detailClose:"bi-dash",fullscreen:"bi-arrows-move",search:"bi-search",clearSearch:"bi-trash"},classes:{buttonsPrefix:"btn",buttons:"secondary",buttonsGroup:"btn-group",buttonsDropdown:"btn-group",pull:"float",inputGroup:"btn-group",inputPrefix:"form-control-",input:"form-control",paginationDropdown:"btn-group dropdown",dropup:"dropup",dropdownActive:"active",paginationActive:"active",buttonActive:"active"},html:{dataToggle:"data-bs-toggle",toolbarDropdown:['"],toolbarDropdownItem:'',pageDropdown:['"],pageDropdownItem:'%s',toolbarDropdownSeparator:'',dropdownCaret:'',pagination:['
      ',"
    "],paginationItem:'
  • %s
  • ',icon:'',inputGroup:'
    %s%s
    ',searchInput:'',searchButton:'',searchClearButton:''}}}[Va],Ua={id:void 0,firstLoad:!0,height:void 0,classes:"table table-bordered table-hover",buttons:{},theadClasses:"",striped:!1,headerStyle:function(t){return{}},rowStyle:function(t,e){return{}},rowAttributes:function(t,e){return{}},undefinedText:"-",locale:void 0,virtualScroll:!1,virtualScrollItemHeight:void 0,sortable:!0,sortClass:void 0,silentSort:!0,sortName:void 0,sortOrder:void 0,sortReset:!1,sortStable:!1,rememberOrder:!1,serverSort:!0,customSort:void 0,columns:[[]],data:[],url:void 0,method:"get",cache:!0,contentType:"application/json",dataType:"json",ajax:void 0,ajaxOptions:{},queryParams:function(t){return t},queryParamsType:"limit",responseHandler:function(t){return t},totalField:"total",totalNotFilteredField:"totalNotFiltered",dataField:"rows",footerField:"footer",pagination:!1,paginationParts:["pageInfo","pageSize","pageList"],showExtendedPagination:!1,paginationLoop:!0,sidePagination:"client",totalRows:0,totalNotFiltered:0,pageNumber:1,pageSize:10,pageList:[10,25,50,100],paginationHAlign:"right",paginationVAlign:"bottom",paginationDetailHAlign:"left",paginationPreText:"‹",paginationNextText:"›",paginationSuccessivelySize:5,paginationPagesBySide:1,paginationUseIntermediate:!1,search:!1,searchHighlight:!1,searchOnEnterKey:!1,strictSearch:!1,regexSearch:!1,searchSelector:!1,visibleSearch:!1,showButtonIcons:!0,showButtonText:!1,showSearchButton:!1,showSearchClearButton:!1,trimOnSearch:!0,searchAlign:"right",searchTimeOut:500,searchText:"",customSearch:void 0,showHeader:!0,showFooter:!1,footerStyle:function(t){return{}},searchAccentNeutralise:!1,showColumns:!1,showSearch:!1,showPageGo:!1,showColumnsToggleAll:!1,showColumnsSearch:!1,minimumCountColumns:1,showPaginationSwitch:!1,showRefresh:!1,showToggle:!1,showFullscreen:!1,smartDisplay:!0,escape:!1,filterOptions:{filterAlgorithm:"and"},idField:void 0,selectItemName:"btSelectItem",clickToSelect:!1,ignoreClickToSelectOn:function(t){var e=t.tagName;return["A","BUTTON"].includes(e)},singleSelect:!1,checkboxHeader:!0,maintainMetaData:!1,multipleSelectRow:!1,uniqueId:void 0,cardView:!1,detailView:!1,detailViewIcon:!0,detailViewByClick:!1,detailViewAlign:"left",detailFormatter:function(t,e){return""},detailFilter:function(t,e){return !0},toolbar:void 0,toolbarAlign:"left",buttonsToolbar:void 0,buttonsAlign:"right",buttonsOrder:["search","paginationSwitch","refresh","toggle","fullscreen","columns"],buttonsPrefix:Ma.classes.buttonsPrefix,buttonsClass:Ma.classes.buttons,icons:Ma.icons,iconSize:void 0,iconsPrefix:Ma.iconsPrefix,loadingFontSize:"auto",loadingTemplate:function(t){return'\n '.concat(t,'\n \n \n ')},onAll:function(t,e){return !1},onClickCell:function(t,e,i,n){return !1},onDblClickCell:function(t,e,i,n){return !1},onClickRow:function(t,e){return !1},onDblClickRow:function(t,e){return !1},onSort:function(t,e){return !1},onCheck:function(t){return !1},onUncheck:function(t){return !1},onCheckAll:function(t){return !1},onUncheckAll:function(t){return !1},onCheckSome:function(t){return !1},onUncheckSome:function(t){return !1},onLoadSuccess:function(t){return !1},onLoadError:function(t){return !1},onColumnSwitch:function(t,e){return !1},onPageChange:function(t,e){return !1},onSearch:function(t){return !1},onShowSearch:function(){return !1},onToggle:function(t){return !1},onPreBody:function(t){return !1},onPostBody:function(){return !1},onPostHeader:function(){return !1},onPostFooter:function(){return !1},onExpandRow:function(t,e,i){return !1},onCollapseRow:function(t,e){return !1},onRefreshOptions:function(t){return !1},onRefresh:function(t){return !1},onResetView:function(){return !1},onScrollBody:function(){return !1},onTogglePagination:function(t){return !1}},qa={formatLoadingMessage:function(){return"Loading, please wait"},formatRecordsPerPage:function(t){return"".concat(t," rows per page")},formatShowingRows:function(t,e,i,n){return void 0!==n&&n>0&&n>i?"Showing ".concat(t," to ").concat(e," of ").concat(i," rows (filtered from ").concat(n," total rows)"):"Showing ".concat(t," to ").concat(e," of ").concat(i," rows")},formatSRPaginationPreText:function(){return"previous page"},formatSRPaginationPageText:function(t){return"to page ".concat(t)},formatSRPaginationNextText:function(){return"next page"},formatDetailPagination:function(t){return"Showing ".concat(t," rows")},formatSearch:function(){return"Search"},formatShowSearch:function(){return"Show Search"},formatPageGo:function(){return"Go"},formatClearSearch:function(){return"Clear Search"},formatNoMatches:function(){return"No matching records found"},formatPaginationSwitch:function(){return"Hide/Show pagination"},formatPaginationSwitchDown:function(){return"Show pagination"},formatPaginationSwitchUp:function(){return"Hide pagination"},formatRefresh:function(){return"Refresh"},formatToggle:function(){return"Toggle"},formatToggleOn:function(){return"Show card view"},formatToggleOff:function(){return"Hide card view"},formatColumns:function(){return"Columns"},formatColumnsToggleAll:function(){return"Toggle all"},formatFullscreen:function(){return"Fullscreen"},formatAllRows:function(){return"All"}},za={field:void 0,title:void 0,titleTooltip:void 0,"class":void 0,width:void 0,widthUnit:"px",rowspan:void 0,colspan:void 0,align:void 0,halign:void 0,falign:void 0,valign:void 0,cellStyle:void 0,radio:!1,checkbox:!1,checkboxEnabled:!0,clickToSelect:!0,showSelectTitle:!1,sortable:!1,sortName:void 0,order:"asc",sorter:void 0,visible:!0,ignore:!1,switchable:!0,cardVisible:!0,searchable:!0,formatter:void 0,footerFormatter:void 0,detailFormatter:void 0,searchFormatter:!0,searchHighlightFormatter:!1,escape:!1,events:void 0},Wa=["getOptions","refreshOptions","getData","getSelections","load","append","prepend","remove","removeAll","insertRow","updateRow","getRowByUniqueId","updateByUniqueId","removeByUniqueId","updateCell","updateCellByUniqueId","showRow","hideRow","getHiddenRows","showColumn","hideColumn","getVisibleColumns","getHiddenColumns","showAllColumns","hideAllColumns","mergeCells","checkAll","uncheckAll","checkInvert","check","uncheck","checkBy","uncheckBy","refresh","destroy","resetView","showLoading","hideLoading","togglePagination","toggleFullscreen","toggleView","resetSearch","filterBy","scrollTo","getScrollPosition","selectPage","prevPage","nextPage","toggleDetailView","expandRow","collapseRow","expandRowByUniqueId","collapseRowByUniqueId","expandAllRows","collapseAllRows","updateColumnTitle","updateFormatText"],Ga={"all.bs.table":"onAll","click-row.bs.table":"onClickRow","dbl-click-row.bs.table":"onDblClickRow","click-cell.bs.table":"onClickCell","dbl-click-cell.bs.table":"onDblClickCell","sort.bs.table":"onSort","check.bs.table":"onCheck","uncheck.bs.table":"onUncheck","check-all.bs.table":"onCheckAll","uncheck-all.bs.table":"onUncheckAll","check-some.bs.table":"onCheckSome","uncheck-some.bs.table":"onUncheckSome","load-success.bs.table":"onLoadSuccess","load-error.bs.table":"onLoadError","column-switch.bs.table":"onColumnSwitch","page-change.bs.table":"onPageChange","search.bs.table":"onSearch","toggle.bs.table":"onToggle","pre-body.bs.table":"onPreBody","post-body.bs.table":"onPostBody","post-header.bs.table":"onPostHeader","post-footer.bs.table":"onPostFooter","expand-row.bs.table":"onExpandRow","collapse-row.bs.table":"onCollapseRow","refresh-options.bs.table":"onRefreshOptions","reset-view.bs.table":"onResetView","refresh.bs.table":"onRefresh","scroll-body.bs.table":"onScrollBody","toggle-pagination.bs.table":"onTogglePagination","virtual-scroll.bs.table":"onVirtualScroll"};Object.assign(Ua,qa);var Ka={VERSION:Da,THEME:"bootstrap".concat(Va),CONSTANTS:Ma,DEFAULTS:Ua,COLUMN_DEFAULTS:za,METHODS:Wa,EVENTS:Ga,LOCALES:{en:qa,"en-US":qa}},Ya=k(function(){ui(1)});oe({target:"Object",stat:!0,forced:Ya},{keys:function(t){return ui(Ni(t))}}),Xe("match",1,function(t,e,i){return[function(e){var i=N(this),n=void 0==e?void 0:e[t];return void 0!==n?n.call(e,i):RegExp(e)[t](i+"")},function(t){var n=i(e,t,this);if(n.done){return n.value}var o=K(t),a=this+"";if(!o.global){return si(o,a)}var s=o.unicode;o.lastIndex=0;for(var r,l=[],c=0;null!==(r=si(o,a));){var h=r[0]+"";l[c]=h,""===h&&(o.lastIndex=ai(a,_t(o.lastIndex),s)),c++}return 0===c?null:l}]});var Xa=G.f,Ja="".startsWith,Qa=Math.min,Za=on("startsWith"),ts=!Za&&!!function(){var t=Xa(String.prototype,"startsWith");return t&&!t.writable}();oe({target:"String",proto:!0,forced:!ts&&!Za},{startsWith:function(t){var e=N(this)+"";en(t);var i=_t(Qa(arguments.length>1?arguments[1]:void 0,e.length)),n=t+"";return Ja?Ja.call(e,n,i):e.slice(i,i+n.length)===n}});var es=G.f,is="".endsWith,ns=Math.min,os=on("endsWith"),as=!os&&!!function(){var t=es(String.prototype,"endsWith");return t&&!t.writable}();oe({target:"String",proto:!0,forced:!as&&!os},{endsWith:function(t){var e=N(this)+"";en(t);var i=arguments.length>1?arguments[1]:void 0,n=_t(e.length),o=void 0===i?n:ns(_t(i),n),a=t+"";return is?is.call(e,a,o):e.slice(o-a.length,o)===a}});var ss={getSearchInput:function(t){return"string"==typeof t.options.searchSelector?y["default"](t.options.searchSelector):t.$toolbar.find(".search input")},sprintf:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),n=1;e>n;n++){i[n-1]=arguments[n]}var o=!0,a=0,s=t.replace(/%s/g,function(){var t=i[a++];return void 0===t?(o=!1,""):t});return o?s:""},isObject:function(t){return t instanceof Object&&!Array.isArray(t)},isEmptyObject:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===Object.entries(t).length&&t.constructor===Object},isNumeric:function(t){return !isNaN(parseFloat(t))&&isFinite(t)},getFieldTitle:function(t,e){var i,n=v(t);try{for(n.s();!(i=n.n()).done;){var o=i.value;if(o.field===e){return o.title}}}catch(a){n.e(a)}finally{n.f()}return""},setFieldIndex:function(t){var e,i=0,n=[],o=v(t[0]);try{for(o.s();!(e=o.n()).done;){var a=e.value;i+=a.colspan||1}}catch(s){o.e(s)}finally{o.f()}for(var r=0;rl;l++){n[r][l]=!1}}for(var c=0;cb;b++){for(var m=0;p>m;m++){n[c+b][g+m]=!0}}}}catch(s){u.e(s)}finally{u.f()}}},normalizeAccent:function(t){return"string"!=typeof t?t:t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")},updateFieldGroup:function(t){var e,i,n=(e=[]).concat.apply(e,r(t)),o=v(t);try{for(o.s();!(i=o.n()).done;){var a,s=i.value,l=v(s);try{for(l.s();!(a=l.n()).done;){var c=a.value;if(c.colspanGroup>1){for(var h=0,u=function(t){var e=n.find(function(e){return e.fieldIndex===t});e.visible&&h++},d=c.colspanIndex;d0}}}catch(f){l.e(f)}finally{l.f()}}}catch(f){o.e(f)}finally{o.f()}},getScrollBarWidth:function(){if(void 0===this.cachedWidth){var t=y["default"]("
    ").addClass("fixed-table-scroll-inner"),e=y["default"]("
    ").addClass("fixed-table-scroll-outer");e.append(t),y["default"]("body").append(e);var i=t[0].offsetWidth;e.css("overflow","scroll");var n=t[0].offsetWidth;i===n&&(n=e[0].clientWidth),e.remove(),this.cachedWidth=i-n}return this.cachedWidth},calculateObjectValue:function(t,e,n,o){var a=e;if("string"==typeof e){var s=e.split(".");if(s.length>1){a=window;var l,c=v(s);try{for(c.s();!(l=c.n()).done;){var h=l.value;a=a[h]}}catch(u){c.e(u)}finally{c.f()}}else{a=window[e]}}return null!==a&&"object"===i(a)?a:"function"==typeof a?a.apply(t,n||[]):!a&&"string"==typeof e&&this.sprintf.apply(this,[e].concat(r(n)))?this.sprintf.apply(this,[e].concat(r(n))):o},compareObjects:function(t,e,i){var n=Object.keys(t),o=Object.keys(e);if(i&&n.length!==o.length){return !1}for(var a=0,s=n;a/g,">").replace(/"/g,""").replace(/'/g,"'"):t},unescapeHTML:function(t){return t?(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'"):t},getRealDataAttr:function(t){for(var e=0,i=Object.entries(t);etd,>th").each(function(n,a){for(var s=y["default"](a),l=+s.attr("colspan")||1,c=+s.attr("rowspan")||1,h=n;o[e]&&o[e][h];h++){}for(var u=h;h+l>u;u++){for(var d=e;e+c>d;d++){o[d]||(o[d]=[]),o[d][u]=!0}}var f=t[h].field;r[f]=s.html().trim(),r["_".concat(f,"_id")]=s.attr("id"),r["_".concat(f,"_class")]=s.attr("class"),r["_".concat(f,"_rowspan")]=s.attr("rowspan"),r["_".concat(f,"_colspan")]=s.attr("colspan"),r["_".concat(f,"_title")]=s.attr("title"),r["_".concat(f,"_data")]=i.getRealDataAttr(s.data()),r["_".concat(f,"_style")]=s.attr("style")}),n.push(r)}),n},sort:function(t,e,i,n,o,a){return(void 0===t||null===t)&&(t=""),(void 0===e||null===e)&&(e=""),n&&t===e&&(t=o,e=a),this.isNumeric(t)&&this.isNumeric(e)?(t=parseFloat(t),e=parseFloat(e),e>t?-1*i:t>e?i:0):t===e?0:("string"!=typeof t&&(t=""+t),-1===t.localeCompare(e)?-1*i:i)},getEventName:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=e||"".concat(+new Date).concat(~~(1000000*Math.random())),"".concat(t,"-").concat(e)},hasDetailViewIcon:function(t){return t.detailView&&t.detailViewIcon&&!t.cardView},getDetailViewIndexOffset:function(t){return this.hasDetailViewIcon(t)&&"right"!==t.detailViewAlign?1:0},checkAutoMergeCells:function(t){var e,i=v(t);try{for(i.s();!(e=i.n()).done;){for(var n=e.value,o=0,a=Object.keys(n);oo&&r++;for(var l=i;n>l;l++){t[l]&&s.push(t[l])}return{start:i,end:n,topOffset:o,bottomOffset:a,rowsAbove:r,rows:s}}},{key:"checkChanges",value:function(t,e){var i=e!==this.cache[t];return this.cache[t]=e,i}},{key:"getExtra",value:function(t,e){var i=document.createElement("tr");return i.className="virtual-scroll-".concat(t),e&&(i.style.height="".concat(e,"px")),i.outerHTML}}]),t}(),hs=function(){function e(t,i){n(this,e),this.options=i,this.$el=y["default"](t),this.$el_=this.$el.clone(),this.timeoutId_=0,this.timeoutFooter_=0}return a(e,[{key:"init",value:function(){this.initConstants(),this.initLocale(),this.initContainer(),this.initTable(),this.initHeader(),this.initData(),this.initHiddenRows(),this.initToolbar(),this.initPagination(),this.initBody(),this.initSearchText(),this.initServer()}},{key:"initConstants",value:function(){var t=this.options;this.constants=Ka.CONSTANTS,this.constants.theme=y["default"].fn.bootstrapTable.theme,this.constants.dataToggle=this.constants.html.dataToggle||"data-toggle";var e=t.buttonsPrefix?"".concat(t.buttonsPrefix,"-"):"";this.constants.buttonsClass=[t.buttonsPrefix,e+t.buttonsClass,ss.sprintf("".concat(e,"%s"),t.iconSize)].join(" ").trim(),this.buttons=ss.calculateObjectValue(this,t.buttons,[],{}),"object"!==i(this.buttons)&&(this.buttons={}),"string"==typeof t.icons&&(t.icons=ss.calculateObjectValue(null,t.icons))}},{key:"initLocale",value:function(){if(this.options.locale){var t=y["default"].fn.bootstrapTable.locales,i=this.options.locale.split(/-|_/);i[0]=i[0].toLowerCase(),i[1]&&(i[1]=i[1].toUpperCase());var n={};t[this.options.locale]?n=t[this.options.locale]:t[i.join("-")]?n=t[i.join("-")]:t[i[0]]&&(n=t[i[0]]);for(var o=0,a=Object.entries(n);o
    ':"",e=["bottom","both"].includes(this.options.paginationVAlign)?'
    ':"",i=ss.calculateObjectValue(this.options,this.options.loadingTemplate,[this.options.formatLoadingMessage()]);this.$container=y["default"]('\n
    \n
    \n ').concat(t,'\n
    \n
    \n
    \n
    \n ').concat(i,'\n
    \n
    \n \n
    \n ').concat(e,"\n
    \n ")),this.$container.insertAfter(this.$el),this.$tableContainer=this.$container.find(".fixed-table-container"),this.$tableHeader=this.$container.find(".fixed-table-header"),this.$tableBody=this.$container.find(".fixed-table-body"),this.$tableLoading=this.$container.find(".fixed-table-loading"),this.$tableFooter=this.$el.find("tfoot"),this.options.buttonsToolbar?this.$toolbar=y["default"]("body").find(this.options.buttonsToolbar):this.$toolbar=this.$container.find(".fixed-table-toolbar"),this.$pagination=this.$container.find(".fixed-table-pagination"),this.$tableBody.append(this.$el),this.$container.after('
    '),this.$el.addClass(this.options.classes),this.$tableLoading.addClass(this.options.classes),this.options.striped&&this.$el.addClass("table-striped"),this.options.height&&(this.$tableContainer.addClass("fixed-height"),this.options.showFooter&&this.$tableContainer.addClass("has-footer"),this.options.classes.split(" ").includes("table-bordered")&&(this.$tableBody.append('
    '),this.$tableBorder=this.$tableBody.find(".fixed-table-border"),this.$tableLoading.addClass("fixed-table-border")),this.$tableFooter=this.$container.find(".fixed-table-footer"))}},{key:"initTable",value:function(){var t=this,i=[];if(this.$header=this.$el.find(">thead"),this.$header.length?this.options.theadClasses&&this.$header.addClass(this.options.theadClasses):this.$header=y["default"]('')).appendTo(this.$el),this._headerTrClasses=[],this._headerTrStyles=[],this.$header.find("tr").each(function(e,n){var o=y["default"](n),a=[];o.find("th").each(function(t,e){var i=y["default"](e);void 0!==i.data("field")&&i.data("field","".concat(i.data("field"))),a.push(y["default"].extend({},{title:i.html(),"class":i.attr("class"),titleTooltip:i.attr("title"),rowspan:i.attr("rowspan")?+i.attr("rowspan"):void 0,colspan:i.attr("colspan")?+i.attr("colspan"):void 0},i.data()))}),i.push(a),o.attr("class")&&t._headerTrClasses.push(o.attr("class")),o.attr("style")&&t._headerTrStyles.push(o.attr("style"))}),Array.isArray(this.options.columns[0])||(this.options.columns=[this.options.columns]),this.options.columns=y["default"].extend(!0,[],i,this.options.columns),this.columns=[],this.fieldsColumnsIndex=[],ss.setFieldIndex(this.options.columns),this.options.columns.forEach(function(i,n){i.forEach(function(i,o){var a=y["default"].extend({},e.COLUMN_DEFAULTS,i);void 0!==a.fieldIndex&&(t.columns[a.fieldIndex]=a,t.fieldsColumnsIndex[a.field]=a.fieldIndex),t.options.columns[n][o]=a})}),!this.options.data.length){var n=ss.trToData(this.columns,this.$el.find(">tbody>tr"));n.length&&(this.options.data=n,this.fromHtml=!0)}this.options.pagination&&"server"!==this.options.sidePagination||(this.footerData=ss.trToData(this.columns,this.$el.find(">tfoot>tr"))),this.footerData&&this.$el.find("tfoot").html(""),!this.options.showFooter||this.options.cardView?this.$tableFooter.hide():this.$tableFooter.show()}},{key:"initHeader",value:function(){var t=this,e={},i=[];this.header={fields:[],styles:[],classes:[],formatters:[],detailFormatters:[],events:[],sorters:[],sortNames:[],cellStyles:[],searchables:[]},ss.updateFieldGroup(this.options.columns),this.options.columns.forEach(function(n,o){var a=[];a.push(""));var r="";if(0===o&&ss.hasDetailViewIcon(t.options)){var l=t.options.columns.length>1?' rowspan="'.concat(t.options.columns.length,'"'):"";r='\n
    \n ')}r&&"right"!==t.options.detailViewAlign&&a.push(r),n.forEach(function(i,n){var r=ss.sprintf(' class="%s"',i["class"]),l=i.widthUnit,c=parseFloat(i.width),h=ss.sprintf("text-align: %s; ",i.halign?i.halign:i.align),u=ss.sprintf("text-align: %s; ",i.align),d=ss.sprintf("vertical-align: %s; ",i.valign);if(d+=ss.sprintf("width: %s; ",!i.checkbox&&!i.radio||c?c?c+l:void 0:i.showSelectTitle?void 0:"36px"),void 0!==i.fieldIndex||i.visible){var f=ss.calculateObjectValue(null,t.options.headerStyle,[i]),p=[],g="";if(f&&f.css){for(var v=0,b=Object.entries(f.css);v0?" data-not-first-th":"",">"),a.push(ss.sprintf('
    ',t.options.sortable&&i.sortable?"sortable both":""));var S=t.options.escape?ss.escapeHTML(i.title):i.title,x=S;i.checkbox&&(S="",!t.options.singleSelect&&t.options.checkboxHeader&&(S=''),t.header.stateField=i.field),i.radio&&(S="",t.header.stateField=i.field),!S&&i.showSelectTitle&&(S+=x),a.push(S),a.push("
    "),a.push('
    '),a.push("
    "),a.push("")}}),r&&"right"===t.options.detailViewAlign&&a.push(r),a.push(""),a.length>3&&i.push(a.join(""))}),this.$header.html(i.join("")),this.$header.find("th[data-field]").each(function(t,i){y["default"](i).data(e[y["default"](i).data("field")])}),this.$container.off("click",".th-inner").on("click",".th-inner",function(e){var i=y["default"](e.currentTarget);return t.options.detailView&&!i.parent().hasClass("bs-checkbox")&&i.closest(".bootstrap-table")[0]!==t.$container[0]?!1:void (t.options.sortable&&i.parent().data().sortable&&t.onSort(e))});var n=ss.getEventName("resize.bootstrap-table",this.$el.attr("id"));y["default"](window).off(n),!this.options.showHeader||this.options.cardView?(this.$header.hide(),this.$tableHeader.hide(),this.$tableLoading.css("top",0)):(this.$header.show(),this.$tableHeader.show(),this.$tableLoading.css("top",this.$header.outerHeight()+1),this.getCaret(),y["default"](window).on(n,function(){return t.resetView()})),this.$selectAll=this.$header.find('[name="btSelectAll"]'),this.$selectAll.off("click").on("click",function(e){e.stopPropagation();var i=y["default"](e.currentTarget).prop("checked");t[i?"checkAll":"uncheckAll"](),t.updateSelected()})}},{key:"initData",value:function(t,e){"append"===e?this.options.data=this.options.data.concat(t):"prepend"===e?this.options.data=[].concat(t).concat(this.options.data):(t=t||ss.deepCopy(this.options.data),this.options.data=Array.isArray(t)?t:t[this.options.dataField]),this.data=r(this.options.data),this.options.sortReset&&(this.unsortedData=r(this.data)),"server"!==this.options.sidePagination&&this.initSort()}},{key:"initSort",value:function(){var t=this,e=this.options.sortName,i="desc"===this.options.sortOrder?-1:1,n=this.header.fields.indexOf(this.options.sortName),o=0;-1!==n?(this.options.sortStable&&this.data.forEach(function(t,e){t.hasOwnProperty("_position")||(t._position=e)}),this.options.customSort?ss.calculateObjectValue(this.options,this.options.customSort,[this.options.sortName,this.options.sortOrder,this.data]):this.data.sort(function(o,a){t.header.sortNames[n]&&(e=t.header.sortNames[n]);var s=ss.getItemField(o,e,t.options.escape),r=ss.getItemField(a,e,t.options.escape),l=ss.calculateObjectValue(t.header,t.header.sorters[n],[s,r,o,a]);return void 0!==l?t.options.sortStable&&0===l?i*(o._position-a._position):i*l:ss.sort(s,r,i,t.options.sortStable,o._position,a._position)}),void 0!==this.options.sortClass&&(clearTimeout(o),o=setTimeout(function(){t.$el.removeClass(t.options.sortClass);var e=t.$header.find('[data-field="'.concat(t.options.sortName,'"]')).index();t.$el.find("tr td:nth-child(".concat(e+1,")")).addClass(t.options.sortClass)},250))):this.options.sortReset&&(this.data=r(this.unsortedData))}},{key:"onSort",value:function(t){var e=t.type,i=t.currentTarget,n="keypress"===e?y["default"](i):y["default"](i).parent(),o=this.$header.find("th").eq(n.index());if(this.$header.add(this.$header_).find("span.order").remove(),this.options.sortName===n.data("field")){var a=this.options.sortOrder;void 0===a?this.options.sortOrder="asc":"asc"===a?this.options.sortOrder="desc":"desc"===this.options.sortOrder&&(this.options.sortOrder=this.options.sortReset?void 0:"asc"),void 0===this.options.sortOrder&&(this.options.sortName=void 0)}else{this.options.sortName=n.data("field"),this.options.rememberOrder?this.options.sortOrder="asc"===n.data("order")?"desc":"asc":this.options.sortOrder=this.columns[this.fieldsColumnsIndex[n.data("field")]].sortOrder||this.columns[this.fieldsColumnsIndex[n.data("field")]].order}return this.trigger("sort",this.options.sortName,this.options.sortOrder),n.add(o).data("order",this.options.sortOrder),this.getCaret(),"server"===this.options.sidePagination&&this.options.serverSort?(this.options.pageNumber=1,void this.initServer(this.options.silentSort)):(this.initSort(),void this.initBody())}},{key:"initToolbar",value:function(){var t,e=this,n=this.options,o=[],a=0,r=0;this.$toolbar.find(".bs-bars").children().length&&y["default"]("body").append(y["default"](n.toolbar)),this.$toolbar.html(""),("string"==typeof n.toolbar||"object"===i(n.toolbar))&&y["default"](ss.sprintf('
    ',this.constants.classes.pull,n.toolbarAlign)).appendTo(this.$toolbar).append(y["default"](n.toolbar)),o=['
    ')],"string"==typeof n.buttonsOrder&&(n.buttonsOrder=n.buttonsOrder.replace(/\[|\]| |'/g,"").split(",")),this.buttons=Object.assign(this.buttons,{search:{text:n.formatSearch(),icon:n.icons.search,render:!1,event:this.toggleShowSearch,attributes:{"aria-label":n.formatShowSearch(),title:n.formatShowSearch()}},paginationSwitch:{text:n.pagination?n.formatPaginationSwitchUp():n.formatPaginationSwitchDown(),icon:n.pagination?n.icons.paginationSwitchDown:n.icons.paginationSwitchUp,render:!1,event:this.togglePagination,attributes:{"aria-label":n.formatPaginationSwitch(),title:n.formatPaginationSwitch()}},refresh:{text:n.formatRefresh(),icon:n.icons.refresh,render:!1,event:this.refresh,attributes:{"aria-label":n.formatRefresh(),title:n.formatRefresh()}},toggle:{text:n.formatToggle(),icon:n.icons.toggleOff,render:!1,event:this.toggleView,attributes:{"aria-label":n.formatToggleOn(),title:n.formatToggleOn()}},fullscreen:{text:n.formatFullscreen(),icon:n.icons.fullscreen,render:!1,event:this.toggleFullscreen,attributes:{"aria-label":n.formatFullscreen(),title:n.formatFullscreen()}},columns:{render:!1,html:function X(){var X=[];if(X.push('
    \n \n ").concat(e.constants.html.toolbarDropdown[0])),n.showColumnsSearch&&(X.push(ss.sprintf(e.constants.html.toolbarDropdownItem,ss.sprintf('',e.constants.classes.input,n.formatSearch()))),X.push(e.constants.html.toolbarDropdownSeparator)),n.showColumnsToggleAll){var t=e.getVisibleColumns().length===e.columns.filter(function(t){return !e.isSelectionColumn(t)}).length;X.push(ss.sprintf(e.constants.html.toolbarDropdownItem,ss.sprintf(' %s',t?'checked="checked"':"",n.formatColumnsToggleAll()))),X.push(e.constants.html.toolbarDropdownSeparator)}var i=0;return e.columns.forEach(function(t){t.visible&&i++}),e.columns.forEach(function(t,o){if(!e.isSelectionColumn(t)&&(!n.cardView||t.cardVisible)&&!t.ignore){var a=t.visible?' checked="checked"':"",s=i<=n.minimumCountColumns&&a?' disabled="disabled"':"";t.switchable&&(X.push(ss.sprintf(e.constants.html.toolbarDropdownItem,ss.sprintf(' %s',t.field,o,a,s,t.title))),r++)}}),X.push(e.constants.html.toolbarDropdown[1],"
    "),X.join("")}}});for(var l={},c=0,h=Object.entries(this.buttons);c"}l[d]=p;var x="show".concat(d.charAt(0).toUpperCase()).concat(d.substring(1)),k=n[x];!(!f.hasOwnProperty("render")||f.hasOwnProperty("render")&&f.render)||void 0!==k&&k!==!0||(n[x]=!0),n.buttonsOrder.includes(d)||n.buttonsOrder.push(d)}var O,T=v(n.buttonsOrder);try{for(T.s();!(O=T.n()).done;){var C=O.value,P=n["show".concat(C.charAt(0).toUpperCase()).concat(C.substring(1))];P&&o.push(l[C])}}catch(I){T.e(I)}finally{T.f()}o.push("
    "),(this.showToolbar||o.length>2)&&this.$toolbar.append(o.join("")),n.showSearch&&this.$toolbar.find('button[name="showSearch"]').off("click").on("click",function(){return e.toggleShowSearch()});for(var A=0,$=Object.entries(this.buttons);A<$.length;A++){var R=s($[A],2),E=R[0],j=R[1];if(j.hasOwnProperty("event")){if("function"==typeof j.event||"string"==typeof j.event){var _=function(){var t="string"==typeof j.event?window[j.event]:j.event;return e.$toolbar.find('button[name="'.concat(E,'"]')).off("click").on("click",function(){return t.call(e)}),"continue"}();if("continue"===_){continue}}for(var N=function(){var t=s(D[F],2),i=t[0],n=t[1],o="string"==typeof n?window[n]:n;e.$toolbar.find('button[name="'.concat(E,'"]')).off(i).on(i,function(){return o.call(e)})},F=0,D=Object.entries(j.event);F'),W=z;if(n.showSearchButton||n.showSearchClearButton){var G=(n.showSearchButton?U:"")+(n.showSearchClearButton?q:"");W=n.search?ss.sprintf(this.constants.html.inputGroup,z,G):G}o.push(ss.sprintf('\n
    \n %s\n
    \n '),W)),this.$toolbar.append(o.join(""));var K=ss.getSearchInput(this);n.showSearchButton?(this.$toolbar.find(".search button[name=search]").off("click").on("click",function(){clearTimeout(a),a=setTimeout(function(){e.onSearch({currentTarget:K})},n.searchTimeOut)}),n.searchOnEnterKey&&M(K)):M(K),n.showSearchClearButton&&this.$toolbar.find(".search button[name=clearSearch]").click(function(){e.resetSearch()})}else{if("string"==typeof n.searchSelector){var Y=ss.getSearchInput(this);M(Y)}}}},{key:"onSearch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.currentTarget,i=t.firedByInitSearchText,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:!0;if(void 0!==e&&y["default"](e).length&&n){var o=y["default"](e).val().trim();if(this.options.trimOnSearch&&y["default"](e).val()!==o&&y["default"](e).val(o),this.searchText===o){return}var a=ss.getSearchInput(this),s=e instanceof jQuery?e:y["default"](e);(s.is(a)||s.hasClass("search-input"))&&(this.searchText=o,this.options.searchText=o)}i||(this.options.pageNumber=1),this.initSearch(),i?"client"===this.options.sidePagination&&this.updatePagination():this.updatePagination(),this.trigger("search",this.searchText)}},{key:"initSearch",value:function(){var t=this;if(this.filterOptions=this.filterOptions||this.options.filterOptions,"server"!==this.options.sidePagination){if(this.options.customSearch){return this.data=ss.calculateObjectValue(this.options,this.options.customSearch,[this.options.data,this.searchText,this.filterColumns]),void (this.options.sortReset&&(this.unsortedData=r(this.data)))}var e=this.searchText&&(this.fromHtml?ss.escapeHTML(this.searchText):this.searchText),i=e?e.toLowerCase():"",n=ss.isEmptyObject(this.filterColumns)?null:this.filterColumns;this.options.searchAccentNeutralise&&(i=ss.normalizeAccent(i)),"function"==typeof this.filterOptions.filterAlgorithm?this.data=this.options.data.filter(function(e){return t.filterOptions.filterAlgorithm.apply(null,[e,n])}):"string"==typeof this.filterOptions.filterAlgorithm&&(this.data=n?this.options.data.filter(function(e){var i=t.filterOptions.filterAlgorithm;if("and"===i){for(var o in n){if(Array.isArray(n[o])&&!n[o].includes(e[o])||!Array.isArray(n[o])&&e[o]!==n[o]){return !1}}}else{if("or"===i){var a=!1;for(var s in n){(Array.isArray(n[s])&&n[s].includes(e[s])||!Array.isArray(n[s])&&e[s]===n[s])&&(a=!0)}return a}}return !0}):r(this.options.data));var o=this.getVisibleFields();this.data=i?this.data.filter(function(n,a){for(var s=0;s|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm,f=d.exec(t.searchText),p=!1;if(f){var g=f[1]||"".concat(f[5],"l"),v=f[2]||f[3],b=parseInt(c,10),m=parseInt(v,10);switch(g){case">":case"m;break;case"<":case">l":p=m>b;break;case"<=":case"=<":case">=l":case"=>l":p=m>=b;break;case">=":case"=>":case"<=l":case"==m}}if(p||"".concat(c).toLowerCase().includes(i)){return !0}}}}return !1}):this.data,this.options.sortReset&&(this.unsortedData=r(this.data)),this.initSort()}}},{key:"initPagination",value:function(){var e=this,i=this.options;if(!i.pagination){return void this.$pagination.hide()}this.$pagination.show();var n,o,a,s,r,l,c,h=[],u=!1,d=this.getData({includeHiddenRows:!1}),f=i.pageList;if("string"==typeof f&&(f=f.replace(/\[|\]| /g,"").toLowerCase().split(",")),f=f.map(function(t){return"string"==typeof t?t.toLowerCase()===i.formatAllRows().toLowerCase()||["all","unlimited"].includes(t.toLowerCase())?i.formatAllRows():+t:t}),this.paginationParts=i.paginationParts,"string"==typeof this.paginationParts&&(this.paginationParts=this.paginationParts.replace(/\[|\]| |'/g,"").split(",")),"server"!==i.sidePagination&&(i.totalRows=d.length),this.totalPages=0,i.totalRows&&(i.pageSize===i.formatAllRows()&&(i.pageSize=i.totalRows,u=!0),this.totalPages=~~((i.totalRows-1)/i.pageSize)+1,i.totalPages=this.totalPages),this.totalPages>0&&i.pageNumber>this.totalPages&&(i.pageNumber=this.totalPages),this.pageFrom=(i.pageNumber-1)*i.pageSize+1,this.pageTo=i.pageNumber*i.pageSize,this.pageTo>i.totalRows&&(this.pageTo=i.totalRows),this.options.pagination&&"server"!==this.options.sidePagination&&(this.options.totalNotFiltered=this.options.data.length),this.options.showExtendedPagination||(this.options.totalNotFiltered=void 0),(this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")||this.paginationParts.includes("pageSize"))&&h.push('
    ')),this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")){var p=this.paginationParts.includes("pageInfoShort")?i.formatDetailPagination(i.totalRows):i.formatShowingRows(this.pageFrom,this.pageTo,i.totalRows,i.totalNotFiltered);h.push('\n '.concat(p,"\n "))}if(this.paginationParts.includes("pageSize")){h.push('
    ');var g=['
    \n \n ").concat(this.constants.html.pageDropdown[0])];f.forEach(function(t,n){if(!i.smartDisplay||0===n||f[n-1]")),h.push(i.formatRecordsPerPage(g.join("")))}if((this.paginationParts.includes("pageInfo")||this.paginationParts.includes("pageInfoShort")||this.paginationParts.includes("pageSize"))&&h.push("
    "),this.paginationParts.includes("pageList")){h.push('
    '),ss.sprintf(this.constants.html.pagination[0],ss.sprintf(" pagination-%s",i.iconSize)),ss.sprintf(this.constants.html.paginationItem," page-pre",i.formatSRPaginationPreText(),i.paginationPreText)),this.totalPagesthis.totalPages-o&&(o=o-(i.paginationSuccessivelySize-(this.totalPages-o))+1),1>o&&(o=1),a>this.totalPages&&(a=this.totalPages);var v=Math.round(i.paginationPagesBySide/2),b=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return ss.sprintf(e.constants.html.paginationItem,n+(t===i.pageNumber?" ".concat(e.constants.classes.paginationActive):""),i.formatSRPaginationPageText(t),t)};if(o>1){var m=i.paginationPagesBySide;for(m>=o&&(m=o-1),n=1;m>=n;n++){h.push(b(n))}o-1===m+1?(n=o-1,h.push(b(n))):o-1>m&&(o-2*i.paginationPagesBySide>i.paginationPagesBySide&&i.paginationUseIntermediate?(n=Math.round((o-v)/2+v),h.push(b(n," page-intermediate"))):h.push(ss.sprintf(this.constants.html.paginationItem," page-first-separator disabled","","...")))}for(n=o;a>=n;n++){h.push(b(n))}if(this.totalPages>a){var y=this.totalPages-(i.paginationPagesBySide-1);for(a>=y&&(y=a+1),a+1===y-1?(n=a+1,h.push(b(n))):y>a+1&&(this.totalPages-a>2*i.paginationPagesBySide&&i.paginationUseIntermediate?(n=Math.round((this.totalPages-v-a)/2+a),h.push(b(n," page-intermediate"))):h.push(ss.sprintf(this.constants.html.paginationItem," page-last-separator disabled","","..."))),n=y;n<=this.totalPages;n++){h.push(b(n))}}h.push(ss.sprintf(this.constants.html.paginationItem," page-next",i.formatSRPaginationNextText(),i.paginationNextText)),h.push(this.constants.html.pagination[1],"
    ")}this.$pagination.html(h.join(""));var w=["bottom","both"].includes(i.paginationVAlign)?" ".concat(this.constants.classes.dropup):"";if(this.$pagination.last().find(".page-list > div").addClass(w),!i.onlyInfoPagination&&(s=this.$pagination.find(".page-list a"),r=this.$pagination.find(".page-pre"),l=this.$pagination.find(".page-next"),c=this.$pagination.find(".page-item").not(".page-next, .page-pre, .page-last-separator, .page-first-separator"),this.totalPages<=1&&this.$pagination.find("div.pagination").hide(),i.smartDisplay&&(f.length<2||i.totalRows<=f[0])&&this.$pagination.find("div.page-list").hide(),this.$pagination[this.getData().length?"show":"hide"](),i.paginationLoop||(1===i.pageNumber&&r.addClass("disabled"),i.pageNumber===this.totalPages&&l.addClass("disabled")),u&&(i.pageSize=i.formatAllRows()),s.off("click").on("click",function(t){return e.onPageListChange(t)}),r.off("click").on("click",function(t){return e.onPagePre(t)}),l.off("click").on("click",function(t){return e.onPageNext(t)}),c.off("click").on("click",function(t){return e.onPageNumber(t)}),this.options.showPageGo)){var S=this,x=this.$pagination.find("ul.pagination"),k=x.find("li.pageGo");k.length||(k=t('
  • '+ss.sprintf('',this.options.pageNumber)+('
  • ").appendTo(x),k.find("button").click(function(){var t=parseInt(k.find("input").val())||1;(1>t||t>S.options.totalPages)&&(t=1),S.selectPage(t)}))}}},{key:"updatePagination",value:function(t){t&&y["default"](t.currentTarget).hasClass("disabled")||(this.options.maintainMetaData||this.resetRows(),this.initPagination(),this.trigger("page-change",this.options.pageNumber,this.options.pageSize),"server"===this.options.sidePagination?this.initServer():this.initBody())}},{key:"onPageListChange",value:function(t){t.preventDefault();var e=y["default"](t.currentTarget);return e.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive),this.options.pageSize=e.text().toUpperCase()===this.options.formatAllRows().toUpperCase()?this.options.formatAllRows():+e.text(),this.$toolbar.find(".page-size").text(this.options.pageSize),this.updatePagination(t),!1}},{key:"onPagePre",value:function(t){return y["default"](t.target).hasClass("disabled")?void 0:(t.preventDefault(),this.options.pageNumber-1===0?this.options.pageNumber=this.options.totalPages:this.options.pageNumber--,this.updatePagination(t),!1)}},{key:"onPageNext",value:function(t){return y["default"](t.target).hasClass("disabled")?void 0:(t.preventDefault(),this.options.pageNumber+1>this.options.totalPages?this.options.pageNumber=1:this.options.pageNumber++,this.updatePagination(t),!1)}},{key:"onPageNumber",value:function(t){return t.preventDefault(),this.options.pageNumber!==+y["default"](t.currentTarget).text()?(this.options.pageNumber=+y["default"](t.currentTarget).text(),this.updatePagination(t),!1):void 0}},{key:"initRow",value:function(t,e,n,o){var a=this,r=[],l={},c=[],h="",u={},d=[];if(!(ss.findIndex(this.hiddenRows,t)>-1)){if(l=ss.calculateObjectValue(this.options,this.options.rowStyle,[t,e],l),l&&l.css){for(var f=0,p=Object.entries(l.css);f"),this.options.cardView&&r.push('
    '));var I="";return ss.hasDetailViewIcon(this.options)&&(I="",ss.calculateObjectValue(null,this.options.detailFilter,[e,t])&&(I+='\n \n '.concat(ss.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailOpen),"\n \n ")),I+=""),I&&"right"!==this.options.detailViewAlign&&r.push(I),this.header.fields.forEach(function(i,n){var o="",l=ss.getItemField(t,i,a.options.escape),h="",u="",d={},f="",p=a.header.classes[n],g="",v="",b="",m="",y="",w="",S=a.columns[n];if((!a.fromHtml&&!a.autoMergeCells||void 0!==l||S.checkbox||S.radio)&&S.visible&&(!a.options.cardView||S.cardVisible)){if(S.escape&&(l=ss.escapeHTML(l)),c.concat([a.header.styles[n]]).length&&(v+="".concat(c.concat([a.header.styles[n]]).join("; "))),t["_".concat(i,"_style")]&&(v+="".concat(t["_".concat(i,"_style")])),v&&(g=' style="'.concat(v,'"')),t["_".concat(i,"_id")]&&(f=ss.sprintf(' id="%s"',t["_".concat(i,"_id")])),t["_".concat(i,"_class")]&&(p=ss.sprintf(' class="%s"',t["_".concat(i,"_class")])),t["_".concat(i,"_rowspan")]&&(m=ss.sprintf(' rowspan="%s"',t["_".concat(i,"_rowspan")])),t["_".concat(i,"_colspan")]&&(y=ss.sprintf(' colspan="%s"',t["_".concat(i,"_colspan")])),t["_".concat(i,"_title")]&&(w=ss.sprintf(' title="%s"',t["_".concat(i,"_title")])),d=ss.calculateObjectValue(a.header,a.header.cellStyles[n],[l,t,e,i],d),d.classes&&(p=' class="'.concat(d.classes,'"')),d.css){for(var x=[],k=0,O=Object.entries(d.css);k$1",R=h&&/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(h);if(R){var E=(new DOMParser).parseFromString(""+h,"text/html").documentElement.textContent,j=E.replace(A,$);E=E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),I=h.replace(RegExp("(>\\s*)(".concat(E,")(\\s*)"),"gm"),"$1".concat(j,"$3"))}else{I=(""+h).replace(A,$)}h=ss.calculateObjectValue(S,S.searchHighlightFormatter,[h,a.searchText],I)}if(t["_".concat(i,"_data")]&&!ss.isEmptyObject(t["_".concat(i,"_data")])){for(var _=0,N=Object.entries(t["_".concat(i,"_data")]);_'):'"))+'")+(a.header.formatters[n]&&"string"==typeof h?h:"")+(a.options.cardView?"
    ":""),t[a.header.stateField]=h===!0||!!l||h&&h.checked}else{if(a.options.cardView){var M=a.options.showHeader?'").concat(ss.getFieldTitle(a.columns,i),""):"";o='
    '.concat(M,'").concat(h,"
    "),a.options.smartDisplay&&""===h&&(o='
    ')}else{o="").concat(h,"")}}r.push(o)}}),I&&"right"===this.options.detailViewAlign&&r.push(I),this.options.cardView&&r.push("
    "),r.push(""),r.join("")}}},{key:"initBody",value:function(t,e){var i=this,n=this.getData();this.trigger("pre-body",n),this.$body=this.$el.find(">tbody"),this.$body.length||(this.$body=y["default"]("").appendTo(this.$el)),this.options.pagination&&"server"!==this.options.sidePagination||(this.pageFrom=1,this.pageTo=n.length);var o=[],a=y["default"](document.createDocumentFragment()),s=!1,r=[];this.autoMergeCells=ss.checkAutoMergeCells(n.slice(this.pageFrom-1,this.pageTo));for(var l=this.pageFrom-1;l tr[data-uniqueid="%s"][data-has-detail-view]',d)),p=f.next();p.is("tr.detail-view")&&(r.push(l),e&&d===e||(h+=p[0].outerHTML))}this.options.virtualScroll?o.push(h):a.append(h)}}s?this.options.virtualScroll?(this.virtualScroll&&this.virtualScroll.destroy(),this.virtualScroll=new cs({rows:o,fixedScroll:t,scrollEl:this.$tableBody[0],contentEl:this.$body[0],itemHeight:this.options.virtualScrollItemHeight,callback:function(t,e){i.fitHeader(),i.initBodyEvent(),i.trigger("virtual-scroll",t,e)}})):this.$body.html(a):this.$body.html(''.concat(ss.sprintf('%s',this.getVisibleFields().length+ss.getDetailViewIndexOffset(this.options),this.options.formatNoMatches()),"")),r.forEach(function(t){i.expandRow(t)}),t||this.scrollTo(0),this.initBodyEvent(),this.initFooter(),this.resetView(),this.updateSelected(),"server"!==this.options.sidePagination&&(this.options.totalRows=n.length),this.trigger("post-body",n)}},{key:"initBodyEvent",value:function(){var t=this;this.$body.find("> tr[data-index] > td").off("click dblclick").on("click dblclick",function(e){var i=y["default"](e.currentTarget),n=i.parent(),o=y["default"](e.target).parents(".card-views").children(),a=y["default"](e.target).parents(".card-view"),s=n.data("index"),r=t.data[s],l=t.options.cardView?o.index(a):i[0].cellIndex,c=t.getVisibleFields(),h=c[l-ss.getDetailViewIndexOffset(t.options)],u=t.columns[t.fieldsColumnsIndex[h]],d=ss.getItemField(r,h,t.options.escape);if(!i.find(".detail-icon").length){if(t.trigger("click"===e.type?"click-cell":"dbl-click-cell",h,d,r,i),t.trigger("click"===e.type?"click-row":"dbl-click-row",r,n,h),"click"===e.type&&t.options.clickToSelect&&u.clickToSelect&&!ss.calculateObjectValue(t.options,t.options.ignoreClickToSelectOn,[e.target])){var f=n.find(ss.sprintf('[name="%s"]',t.options.selectItemName));f.length&&f[0].click()}"click"===e.type&&t.options.detailViewByClick&&t.toggleDetailView(s,t.header.detailFormatters[t.fieldsColumnsIndex[h]])}}).off("mousedown").on("mousedown",function(e){t.multipleSelectRowCtrlKey=e.ctrlKey||e.metaKey,t.multipleSelectRowShiftKey=e.shiftKey}),this.$body.find("> tr[data-index] > td > .detail-icon").off("click").on("click",function(e){return e.preventDefault(),t.toggleDetailView(y["default"](e.currentTarget).parent().parent().data("index")),!1}),this.$selectItem=this.$body.find(ss.sprintf('[name="%s"]',this.options.selectItemName)),this.$selectItem.off("click").on("click",function(e){e.stopImmediatePropagation();var i=y["default"](e.currentTarget);t._toggleCheck(i.prop("checked"),i.data("index"))}),this.header.events.forEach(function(e,i){var n=e;if(n){"string"==typeof n&&(n=ss.calculateObjectValue(null,n));var o=t.header.fields[i],a=t.getVisibleFields().indexOf(o);if(-1!==a){a+=ss.getDetailViewIndexOffset(t.options);var s=function(e){if(!n.hasOwnProperty(e)){return"continue"}var i=n[e];t.$body.find(">tr:not(.no-records-found)").each(function(n,s){var r=y["default"](s),l=r.find(t.options.cardView?".card-views>.card-view":">td").eq(a),c=e.indexOf(" "),h=e.substring(0,c),u=e.substring(c+1);l.find(u).off(h).on(h,function(e){var n=r.data("index"),a=t.data[n],s=a[o];i.apply(t,[e,s,a,n])})})};for(var r in n){s(r)}}}})}},{key:"initServer",value:function(t,e,i){var n=this,o={},a=this.header.fields.indexOf(this.options.sortName),s={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder};if(this.header.sortNames[a]&&(s.sortName=this.header.sortNames[a]),this.options.pagination&&"server"===this.options.sidePagination&&(s.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,s.pageNumber=this.options.pageNumber),!this.options.firstLoad&&!firstLoadTable.includes(this.options.id)){return void firstLoadTable.push(this.options.id)}if(i||this.options.url||this.options.ajax){if("limit"===this.options.queryParamsType&&(s={search:s.searchText,sort:s.sortName,order:s.sortOrder},this.options.pagination&&"server"===this.options.sidePagination&&(s.offset=this.options.pageSize===this.options.formatAllRows()?0:this.options.pageSize*(this.options.pageNumber-1),s.limit=this.options.pageSize,(0===s.limit||this.options.pageSize===this.options.formatAllRows())&&delete s.limit)),this.options.search&&"server"===this.options.sidePagination&&this.columns.filter(function(t){return !t.searchable}).length){s.searchable=[];var r,l=v(this.columns);try{for(l.s();!(r=l.n()).done;){var c=r.value;!c.checkbox&&c.searchable&&(this.options.visibleSearch&&c.visible||!this.options.visibleSearch)&&s.searchable.push(c.field)}}catch(h){l.e(h)}finally{l.f()}}if(ss.isEmptyObject(this.filterColumnsPartial)||(s.filter=JSON.stringify(this.filterColumnsPartial,null)),y["default"].extend(s,e||{}),o=ss.calculateObjectValue(this.options,this.options.queryParams,[s],o),o!==!1){t||this.showLoading();var u=y["default"].extend({},ss.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:i||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(o):o,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(e,i,o){var a=ss.calculateObjectValue(n.options,n.options.responseHandler,[e,o],e);n.load(a),n.trigger("load-success",a,o&&o.status,o),t||n.hideLoading(),"server"===n.options.sidePagination&&n.options.pageNumber>1&&a[n.options.totalField]>0&&!a[n.options.dataField].length&&n.updatePagination()},error:function(e){if(e&&0===e.status&&n._xhrAbort){return void (n._xhrAbort=!1)}var i=[];"server"===n.options.sidePagination&&(i={},i[n.options.totalField]=0,i[n.options.dataField]=[]),n.load(i),n.trigger("load-error",e&&e.status,e),t||n.$tableLoading.hide()}});return this.options.ajax?ss.calculateObjectValue(this,this.options.ajax,[u],null):(this._xhr&&4!==this._xhr.readyState&&(this._xhrAbort=!0,this._xhr.abort()),this._xhr=y["default"].ajax(u)),o}}}},{key:"initSearchText",value:function(){if(this.options.search&&(this.searchText="",""!==this.options.searchText)){var t=ss.getSearchInput(this);t.val(this.options.searchText),this.onSearch({currentTarget:t,firedByInitSearchText:!0})}}},{key:"getCaret",value:function(){var t=this;this.$header.find("th").each(function(e,i){y["default"](i).find(".sortable").removeClass("desc asc").addClass(y["default"](i).data("field")===t.options.sortName?t.options.sortOrder:"both")})}},{key:"updateSelected",value:function(){var t=this.$selectItem.filter(":enabled").length&&this.$selectItem.filter(":enabled").length===this.$selectItem.filter(":enabled").filter(":checked").length;this.$selectAll.add(this.$selectAll_).prop("checked",t),this.$selectItem.each(function(t,e){y["default"](e).closest("tr")[y["default"](e).prop("checked")?"addClass":"removeClass"]("selected")})}},{key:"updateRows",value:function(){var t=this;this.$selectItem.each(function(e,i){t.data[y["default"](i).data("index")][t.header.stateField]=y["default"](i).prop("checked")})}},{key:"resetRows",value:function(){var t,e=v(this.data);try{for(e.s();!(t=e.n()).done;){var i=t.value;this.$selectAll.prop("checked",!1),this.$selectItem.prop("checked",!1),this.header.stateField&&(i[this.header.stateField]=!1)}}catch(n){e.e(n)}finally{e.f()}this.initHiddenRows()}},{key:"trigger",value:function(t){for(var i,n,o="".concat(t,".bs.table"),a=arguments.length,s=Array(a>1?a-1:0),r=1;a>r;r++){s[r-1]=arguments[r]}(i=this.options)[e.EVENTS[o]].apply(i,[].concat(s,[this])),this.$el.trigger(y["default"].Event(o,{sender:this}),s),(n=this.options).onAll.apply(n,[o].concat([].concat(s,[this]))),this.$el.trigger(y["default"].Event("all.bs.table",{sender:this}),[o,s])}},{key:"resetHeader",value:function(){var t=this;clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(function(){return t.fitHeader()},this.$el.is(":hidden")?100:0)}},{key:"fitHeader",value:function(){var t=this;if(this.$el.is(":hidden")){return void (this.timeoutId_=setTimeout(function(){return t.fitHeader()},100))}var e=this.$tableBody.get(0),i=e.scrollWidth>e.clientWidth&&e.scrollHeight>e.clientHeight+this.$header.outerHeight()?ss.getScrollBarWidth():0;this.$el.css("margin-top",-this.$header.outerHeight());var n=y["default"](":focus");if(n.length>0){var o=n.parents("th");if(o.length>0){var a=o.attr("data-field");if(void 0!==a){var s=this.$header.find("[data-field='".concat(a,"']"));s.length>0&&s.find(":input").addClass("focus-temp")}}}this.$header_=this.$header.clone(!0,!0),this.$selectAll_=this.$header_.find('[name="btSelectAll"]'),this.$tableHeader.css("margin-right",i).find("table").css("width",this.$el.outerWidth()).html("").attr("class",this.$el.attr("class")).append(this.$header_),this.$tableLoading.css("width",this.$el.outerWidth());var r=y["default"](".focus-temp:visible:eq(0)");r.length>0&&(r.focus(),this.$header.find(".focus-temp").removeClass("focus-temp")),this.$header.find("th[data-field]").each(function(e,i){t.$header_.find(ss.sprintf('th[data-field="%s"]',y["default"](i).data("field"))).data(y["default"](i).data())});for(var l=this.getVisibleFields(),c=this.$header_.find("th"),h=this.$body.find(">tr:not(.no-records-found,.virtual-scroll-top)").eq(0);h.length&&h.find('>td[colspan]:not([colspan="1"])').length;){h=h.next()}var u=h.find("> *").length;h.find("> *").each(function(e,i){var n=y["default"](i);if(ss.hasDetailViewIcon(t.options)&&(0===e&&"right"!==t.options.detailViewAlign||e===u-1&&"right"===t.options.detailViewAlign)){var o=c.filter(".detail"),a=o.innerWidth()-o.find(".fht-cell").width();return void o.find(".fht-cell").width(n.innerWidth()-a)}var s=e-ss.getDetailViewIndexOffset(t.options),r=t.$header_.find(ss.sprintf('th[data-field="%s"]',l[s]));r.length>1&&(r=y["default"](c[n[0].cellIndex]));var h=r.innerWidth()-r.find(".fht-cell").width();r.find(".fht-cell").width(n.innerWidth()-h)}),this.horizontalScroll(),this.trigger("post-header")}},{key:"initFooter",value:function(){if(this.options.showFooter&&!this.options.cardView){var t=this.getData(),e=[],i="";ss.hasDetailViewIcon(this.options)&&(i='
    '),i&&"right"!==this.options.detailViewAlign&&e.push(i);var n,o=v(this.columns);try{for(o.s();!(n=o.n()).done;){var a=n.value,r="",l="",c=[],h={},u=ss.sprintf(' class="%s"',a["class"]);if(a.visible&&(!(this.footerData&&this.footerData.length>0)||a.field in this.footerData[0])){if(this.options.cardView&&!a.cardVisible){return}if(r=ss.sprintf("text-align: %s; ",a.falign?a.falign:a.align),l=ss.sprintf("vertical-align: %s; ",a.valign),h=ss.calculateObjectValue(null,this.options.footerStyle,[a]),h&&h.css){for(var d=0,f=Object.entries(h.css);d0&&(m=this.footerData[0]["_".concat(a.field,"_colspan")]||0),m&&e.push(' colspan="'.concat(m,'" ')),e.push(">"),e.push('
    ');var y="";this.footerData&&this.footerData.length>0&&(y=this.footerData[0][a.field]||""),e.push(ss.calculateObjectValue(a,a.footerFormatter,[t,y],y)),e.push("
    "),e.push('
    '),e.push("
    "),e.push("")}}}catch(w){o.e(w)}finally{o.f()}i&&"right"===this.options.detailViewAlign&&e.push(i),this.options.height||this.$tableFooter.length||(this.$el.append(""),this.$tableFooter=this.$el.find("tfoot")),this.$tableFooter.find("tr").length||this.$tableFooter.html("
    "),this.$tableFooter.find("tr").html(e.join("")),this.trigger("post-footer",this.$tableFooter)}}},{key:"fitFooter",value:function(){var t=this;if(this.$el.is(":hidden")){return void setTimeout(function(){return t.fitFooter()},100)}var e=this.$tableBody.get(0),i=e.scrollWidth>e.clientWidth&&e.scrollHeight>e.clientHeight+this.$header.outerHeight()?ss.getScrollBarWidth():0;this.$tableFooter.css("margin-right",i).find("table").css("width",this.$el.outerWidth()).attr("class",this.$el.attr("class"));var n=this.$tableFooter.find("th"),o=this.$body.find(">tr:first-child:not(.no-records-found)");for(n.find(".fht-cell").width("auto");o.length&&o.find('>td[colspan]:not([colspan="1"])').length;){o=o.next()}var a=o.find("> *").length;o.find("> *").each(function(e,i){var o=y["default"](i);if(ss.hasDetailViewIcon(t.options)&&(0===e&&"left"===t.options.detailViewAlign||e===a-1&&"right"===t.options.detailViewAlign)){var s=n.filter(".detail"),r=s.innerWidth()-s.find(".fht-cell").width();return void s.find(".fht-cell").width(o.innerWidth()-r)}var l=n.eq(e),c=l.innerWidth()-l.find(".fht-cell").width();l.find(".fht-cell").width(o.innerWidth()-c)}),this.horizontalScroll()}},{key:"horizontalScroll",value:function(){var t=this;this.$tableBody.off("scroll").on("scroll",function(){var e=t.$tableBody.scrollLeft();t.options.showHeader&&t.options.height&&t.$tableHeader.scrollLeft(e),t.options.showFooter&&!t.options.cardView&&t.$tableFooter.scrollLeft(e),t.trigger("scroll-body",t.$tableBody)})}},{key:"getVisibleFields",value:function(){var t,e=[],i=v(this.header.fields);try{for(i.s();!(t=i.n()).done;){var n=t.value,o=this.columns[this.fieldsColumnsIndex[n]];o&&o.visible&&e.push(n)}}catch(a){i.e(a)}finally{i.f()}return e}},{key:"initHiddenRows",value:function(){this.hiddenRows=[]}},{key:"getOptions",value:function(){var t=y["default"].extend({},this.options);return delete t.data,y["default"].extend(!0,{},t)}},{key:"refreshOptions",value:function(t){ss.compareObjects(this.options,t,!0)||(this.options=y["default"].extend(this.options,t),this.trigger("refresh-options",this.options),this.destroy(),this.init())}},{key:"getData",value:function(t){var e=this,i=this.options.data;if(!(this.searchText||this.options.customSearch||void 0!==this.options.sortName||this.enableCustomSort)&&ss.isEmptyObject(this.filterColumns)&&ss.isEmptyObject(this.filterColumnsPartial)||t&&t.unfiltered||(i=this.data),t&&t.useCurrentPage&&(i=i.slice(this.pageFrom-1,this.pageTo)),t&&!t.includeHiddenRows){var n=this.getHiddenRows();i=i.filter(function(t){return -1===ss.findIndex(n,t)})}return t&&t.formatted&&i.forEach(function(t){for(var i=0,n=Object.entries(t);i=0;i--){var n=this.options.data[i];(n.hasOwnProperty(t.field)||"$index"===t.field)&&(!n.hasOwnProperty(t.field)&&"$index"===t.field&&t.values.includes(i)||t.values.includes(n[t.field]))&&(e++,this.options.data.splice(i,1))}e&&("server"===this.options.sidePagination&&(this.options.totalRows-=e,this.data=r(this.options.data)),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},{key:"removeAll",value:function(){this.options.data.length>0&&(this.options.data.splice(0,this.options.data.length),this.initSearch(),this.initPagination(),this.initBody(!0))}},{key:"insertRow",value:function(t){t.hasOwnProperty("index")&&t.hasOwnProperty("row")&&(this.options.data.splice(t.index,0,t.row),this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0))}},{key:"updateRow",value:function(t){var e,i=Array.isArray(t)?t:[t],n=v(i);try{for(n.s();!(e=n.n()).done;){var o=e.value;o.hasOwnProperty("index")&&o.hasOwnProperty("row")&&(o.hasOwnProperty("replace")&&o.replace?this.options.data[o.index]=o.row:y["default"].extend(this.options.data[o.index],o.row))}}catch(a){n.e(a)}finally{n.f()}this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0)}},{key:"getRowByUniqueId",value:function(t){var e,i,n,o=this.options.uniqueId,a=this.options.data.length,s=t,r=null;for(e=a-1;e>=0;e--){if(i=this.options.data[e],i.hasOwnProperty(o)){n=i[o]}else{if(!i._data||!i._data.hasOwnProperty(o)){continue}n=i._data[o]}if("string"==typeof n?s=""+s:"number"==typeof n&&(+n===n&&n%1===0?s=parseInt(s,10):n===+n&&0!==n&&(s=parseFloat(s))),n===s){r=i;break}}return r}},{key:"updateByUniqueId",value:function(t){var e,i=Array.isArray(t)?t:[t],n=null,o=v(i);try{for(o.s();!(e=o.n()).done;){var a=e.value;if(a.hasOwnProperty("id")&&a.hasOwnProperty("row")){var s=this.options.data.indexOf(this.getRowByUniqueId(a.id));-1!==s&&(a.hasOwnProperty("replace")&&a.replace?this.options.data[s]=a.row:y["default"].extend(this.options.data[s],a.row),n=a.id)}}}catch(r){o.e(r)}finally{o.f()}this.initSearch(),this.initPagination(),this.initSort(),this.initBody(!0,n)}},{key:"removeByUniqueId",value:function(t){var e=this.options.data.length,i=this.getRowByUniqueId(t);i&&this.options.data.splice(this.options.data.indexOf(i),1),e!==this.options.data.length&&("server"===this.options.sidePagination&&(this.options.totalRows-=1,this.data=r(this.options.data)),this.initSearch(),this.initPagination(),this.initBody(!0))}},{key:"updateCell",value:function(t){t.hasOwnProperty("index")&&t.hasOwnProperty("field")&&t.hasOwnProperty("value")&&(this.data[t.index][t.field]=t.value,t.reinit!==!1&&(this.initSort(),this.initBody(!0)))}},{key:"updateCellByUniqueId",value:function(t){var e=this,i=Array.isArray(t)?t:[t];i.forEach(function(t){var i=t.id,n=t.field,o=t.value,a=e.options.data.indexOf(e.getRowByUniqueId(i));-1!==a&&(e.options.data[a][n]=o)}),t.reinit!==!1&&(this.initSort(),this.initBody(!0))}},{key:"showRow",value:function(t){this._toggleRow(t,!0)}},{key:"hideRow",value:function(t){this._toggleRow(t,!1)}},{key:"_toggleRow",value:function(t,e){var i;if(t.hasOwnProperty("index")?i=this.getData()[t.index]:t.hasOwnProperty("uniqueId")&&(i=this.getRowByUniqueId(t.uniqueId)),i){var n=ss.findIndex(this.hiddenRows,i);e||-1!==n?e&&n>-1&&this.hiddenRows.splice(n,1):this.hiddenRows.push(i),this.initBody(!0),this.initPagination()}}},{key:"getHiddenRows",value:function(t){if(t){return this.initHiddenRows(),this.initBody(!0),void this.initPagination()}var e,i=this.getData(),n=[],o=v(i);try{for(o.s();!(e=o.n()).done;){var a=e.value;this.hiddenRows.includes(a)&&n.push(a)}}catch(s){o.e(s)}finally{o.f()}return this.hiddenRows=n,n}},{key:"showColumn",value:function(t){var e=this,i=Array.isArray(t)?t:[t];i.forEach(function(t){e._toggleColumn(e.fieldsColumnsIndex[t],!0,!0)})}},{key:"hideColumn",value:function(t){var e=this,i=Array.isArray(t)?t:[t];i.forEach(function(t){e._toggleColumn(e.fieldsColumnsIndex[t],!1,!0)})}},{key:"_toggleColumn",value:function(t,e,i){if(-1!==t&&this.columns[t].visible!==e&&(this.columns[t].visible=e,this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns)){var n=this.$toolbar.find('.keep-open input:not(".toggle-all")').prop("disabled",!1);i&&n.filter(ss.sprintf('[value="%s"]',t)).prop("checked",e),n.filter(":checked").length<=this.options.minimumCountColumns&&n.filter(":checked").prop("disabled",!0)}}},{key:"getVisibleColumns",value:function(){var t=this;return this.columns.filter(function(e){return e.visible&&!t.isSelectionColumn(e)})}},{key:"getHiddenColumns",value:function(){return this.columns.filter(function(t){var e=t.visible;return !e})}},{key:"isSelectionColumn",value:function(t){return t.radio||t.checkbox}},{key:"showAllColumns",value:function(){this._toggleAllColumns(!0)}},{key:"hideAllColumns",value:function(){this._toggleAllColumns(!1)}},{key:"_toggleAllColumns",value:function(t){var e,i=this,n=v(this.columns.slice().reverse());try{for(n.s();!(e=n.n()).done;){var o=e.value;if(o.switchable){if(!t&&this.options.showColumns&&this.getVisibleColumns().length===this.options.minimumCountColumns){continue}o.visible=t}}}catch(a){n.e(a)}finally{n.f()}if(this.initHeader(),this.initSearch(),this.initPagination(),this.initBody(),this.options.showColumns){var s=this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop("disabled",!1);t?s.prop("checked",t):s.get().reverse().forEach(function(e){s.filter(":checked").length>i.options.minimumCountColumns&&y["default"](e).prop("checked",t)}),s.filter(":checked").length<=this.options.minimumCountColumns&&s.filter(":checked").prop("disabled",!0)}}},{key:"mergeCells",value:function(t){var e,i,n=t.index,o=this.getVisibleFields().indexOf(t.field),a=t.rowspan||1,s=t.colspan||1,r=this.$body.find(">tr[data-index]");o+=ss.getDetailViewIndexOffset(this.options);var l=r.eq(n).find(">td").eq(o);if(!(0>n||0>o||n>=this.data.length)){for(e=n;n+a>e;e++){for(i=o;o+s>i;i++){r.eq(e).find(">td").eq(i).hide()}}l.attr("rowspan",a).attr("colspan",s).show()}}},{key:"checkAll",value:function(){this._toggleCheckAll(!0)}},{key:"uncheckAll",value:function(){this._toggleCheckAll(!1)}},{key:"_toggleCheckAll",value:function(t){var e=this.getSelections();this.$selectAll.add(this.$selectAll_).prop("checked",t),this.$selectItem.filter(":enabled").prop("checked",t),this.updateRows(),this.updateSelected();var i=this.getSelections();return t?void this.trigger("check-all",i,e):void this.trigger("uncheck-all",i,e)}},{key:"checkInvert",value:function(){var t=this.$selectItem.filter(":enabled"),e=t.filter(":checked");t.each(function(t,e){y["default"](e).prop("checked",!y["default"](e).prop("checked"))}),this.updateRows(),this.updateSelected(),this.trigger("uncheck-some",e),e=this.getSelections(),this.trigger("check-some",e)}},{key:"check",value:function(t){this._toggleCheck(!0,t)}},{key:"uncheck",value:function(t){this._toggleCheck(!1,t)}},{key:"_toggleCheck",value:function(t,e){var i=this.$selectItem.filter('[data-index="'.concat(e,'"]')),n=this.data[e];if(i.is(":radio")||this.options.singleSelect||this.options.multipleSelectRow&&!this.multipleSelectRowCtrlKey&&!this.multipleSelectRowShiftKey){var o,a=v(this.options.data);try{for(a.s();!(o=a.n()).done;){var r=o.value;r[this.header.stateField]=!1}}catch(l){a.e(l)}finally{a.f()}this.$selectItem.filter(":checked").not(i).prop("checked",!1)}if(n[this.header.stateField]=t,this.options.multipleSelectRow){if(this.multipleSelectRowShiftKey&&this.multipleSelectRowLastSelectedIndex>=0){for(var c=this.multipleSelectRowLastSelectedIndexf;f++){this.data[f][this.header.stateField]=!0,this.$selectItem.filter('[data-index="'.concat(f,'"]')).prop("checked",!0)}}this.multipleSelectRowCtrlKey=!1,this.multipleSelectRowShiftKey=!1,this.multipleSelectRowLastSelectedIndex=t?e:-1}i.prop("checked",t),this.updateSelected(),this.trigger(t?"check":"uncheck",this.data[e],i)}},{key:"checkBy",value:function(t){this._toggleCheckBy(!0,t)}},{key:"uncheckBy",value:function(t){this._toggleCheckBy(!1,t)}},{key:"_toggleCheckBy",value:function(t,e){var i=this;if(e.hasOwnProperty("field")&&e.hasOwnProperty("values")){var n=[];this.data.forEach(function(o,a){if(!o.hasOwnProperty(e.field)){return !1}if(e.values.includes(o[e.field])){var s=i.$selectItem.filter(":enabled").filter(ss.sprintf('[data-index="%s"]',a)),r=e.hasOwnProperty("onlyCurrentPage")?e.onlyCurrentPage:!1;if(s=t?s.not(":checked"):s.filter(":checked"),!s.length&&r){return}s.prop("checked",t),o[i.header.stateField]=t,n.push(o),i.trigger(t?"check":"uncheck",o,s)}}),this.updateSelected(),this.trigger(t?"check-some":"uncheck-some",n)}}},{key:"refresh",value:function(t){t&&t.url&&(this.options.url=t.url),t&&t.pageNumber&&(this.options.pageNumber=t.pageNumber),t&&t.pageSize&&(this.options.pageSize=t.pageSize),table.rememberSelecteds={},table.rememberSelectedIds={},this.trigger("refresh",this.initServer(t&&t.silent,t&&t.query,t&&t.url))}},{key:"destroy",value:function(){this.$el.insertBefore(this.$container),y["default"](this.options.toolbar).insertBefore(this.$el),this.$container.next().remove(),this.$container.remove(),this.$el.html(this.$el_.html()).css("margin-top","0").attr("class",this.$el_.attr("class")||"")}},{key:"resetView",value:function(t){var e=0;if(t&&t.height&&(this.options.height=t.height),this.$tableContainer.toggleClass("has-card-view",this.options.cardView),!this.options.cardView&&this.options.showHeader&&this.options.height?(this.$tableHeader.show(),this.resetHeader(),e+=this.$header.outerHeight(!0)+1):(this.$tableHeader.hide(),this.trigger("post-header")),!this.options.cardView&&this.options.showFooter&&(this.$tableFooter.show(),this.fitFooter(),this.options.height&&(e+=this.$tableFooter.outerHeight(!0))),this.$container.hasClass("fullscreen")){this.$tableContainer.css("height",""),this.$tableContainer.css("width","")}else{if(this.options.height){this.$tableBorder&&(this.$tableBorder.css("width",""),this.$tableBorder.css("height",""));var i=this.$toolbar.outerHeight(!0),n=this.$pagination.outerHeight(!0),o=this.options.height-i-n,a=this.$tableBody.find(">table"),s=a.outerHeight();if(this.$tableContainer.css("height","".concat(o,"px")),this.$tableBorder&&a.is(":visible")){var r=o-s-2;this.$tableBody[0].scrollWidth-this.$tableBody.innerWidth()&&(r-=ss.getScrollBarWidth()),this.$tableBorder.css("width","".concat(a.outerWidth(),"px")),this.$tableBorder.css("height","".concat(r,"px"))}}}this.options.cardView?(this.$el.css("margin-top","0"),this.$tableContainer.css("padding-bottom","0"),this.$tableFooter.hide()):(this.getCaret(),this.$tableContainer.css("padding-bottom","".concat(e,"px"))),this.trigger("reset-view")}},{key:"showLoading",value:function(){this.$tableLoading.toggleClass("open",!0);var t=this.options.loadingFontSize;"auto"===this.options.loadingFontSize&&(t=0.04*this.$tableLoading.width(),t=Math.max(12,t),t=Math.min(32,t),t="".concat(t,"px")),this.$tableLoading.find(".loading-text").css("font-size",t)}},{key:"hideLoading",value:function(){this.$tableLoading.toggleClass("open",!1)}},{key:"toggleShowSearch",value:function(){this.$el.parents(".select-table").siblings().slideToggle()}},{key:"togglePagination",value:function(){this.options.pagination=!this.options.pagination;var t=this.options.showButtonIcons?this.options.pagination?this.options.icons.paginationSwitchDown:this.options.icons.paginationSwitchUp:"",e=this.options.showButtonText?this.options.pagination?this.options.formatPaginationSwitchUp():this.options.formatPaginationSwitchDown():"";this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(ss.sprintf(this.constants.html.icon,this.options.iconsPrefix,t)," ").concat(e)),this.updatePagination(),this.trigger("toggle-pagination",this.options.pagination)}},{key:"toggleFullscreen",value:function(){this.$el.closest(".bootstrap-table").toggleClass("fullscreen"),this.resetView()}},{key:"toggleView",value:function(){this.options.cardView=!this.options.cardView,this.initHeader();var t=this.options.showButtonIcons?this.options.cardView?this.options.icons.toggleOn:this.options.icons.toggleOff:"",e=this.options.showButtonText?this.options.cardView?this.options.formatToggleOff():this.options.formatToggleOn():"";this.$toolbar.find('button[name="toggle"]').html("".concat(ss.sprintf(this.constants.html.icon,this.options.iconsPrefix,t)," ").concat(e)),this.initBody(),this.trigger("toggle",this.options.cardView)}},{key:"resetSearch",value:function(t){var e=ss.getSearchInput(this);e.val(t||""),this.onSearch({currentTarget:e})}},{key:"filterBy",value:function(t,e){this.filterOptions=ss.isEmptyObject(e)?this.options.filterOptions:y["default"].extend(this.options.filterOptions,e),this.filterColumns=ss.isEmptyObject(t)?{}:t,this.options.pageNumber=1,this.initSearch(),this.updatePagination()}},{key:"scrollTo",value:function o(t){var e={unit:"px",value:0};"object"===i(t)?e=Object.assign(e,t):"string"==typeof t&&"bottom"===t?e.value=this.$tableBody[0].scrollHeight:("string"==typeof t||"number"==typeof t)&&(e.value=t);var o=e.value;"rows"===e.unit&&(o=0,this.$body.find("> tr:lt(".concat(e.value,")")).each(function(t,e){o+=y["default"](e).outerHeight(!0)})),this.$tableBody.scrollTop(o)}},{key:"getScrollPosition",value:function(){return this.$tableBody.scrollTop()}},{key:"selectPage",value:function(t){t>0&&t<=this.options.totalPages&&(this.options.pageNumber=t,this.updatePagination())}},{key:"prevPage",value:function(){this.options.pageNumber>1&&(this.options.pageNumber--,this.updatePagination())}},{key:"nextPage",value:function(){this.options.pageNumber tr[data-index="%s"]',t));i.next().is("tr.detail-view")?this.collapseRow(t):this.expandRow(t,e),this.resetView()}},{key:"expandRow",value:function(t,e){var i=this.data[t],n=this.$body.find(ss.sprintf('> tr[data-index="%s"][data-has-detail-view]',t));if(this.options.detailViewIcon&&n.find("a.detail-icon").html(ss.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailClose)),!n.next().is("tr.detail-view")){n.after(ss.sprintf('',n.children("td").length));var o=n.next().find("td"),a=e||this.options.detailFormatter,s=ss.calculateObjectValue(this.options,a,[t,i,o],"");1===o.length&&o.append(s),this.trigger("expand-row",t,i,o)}}},{key:"expandRowByUniqueId",value:function(t){var e=this.getRowByUniqueId(t);e&&this.expandRow(this.data.indexOf(e))}},{key:"collapseRow",value:function(t){var e=this.data[t],i=this.$body.find(ss.sprintf('> tr[data-index="%s"][data-has-detail-view]',t));i.next().is("tr.detail-view")&&(this.options.detailViewIcon&&i.find("a.detail-icon").html(ss.sprintf(this.constants.html.icon,this.options.iconsPrefix,this.options.icons.detailOpen)),this.trigger("collapse-row",t,e,i.next()),i.next().remove())}},{key:"collapseRowByUniqueId",value:function(t){var e=this.getRowByUniqueId(t);e&&this.collapseRow(this.data.indexOf(e))}},{key:"expandAllRows",value:function(){for(var t=this.$body.find("> tr[data-index][data-has-detail-view]"),e=0;e tr[data-index][data-has-detail-view]"),e=0;e1?e-1:0),o=1;e>o;o++){n[o-1]=arguments[o]}var a;return this.each(function(e,o){var s=y["default"](o).data("bootstrap.table"),r=y["default"].extend({},hs.DEFAULTS,y["default"](o).data(),"object"===i(t)&&t);if("string"==typeof t){var l;if(!Ka.METHODS.includes(t)){throw Error("Unknown method: ".concat(t))}if(!s){return}a=(l=s)[t].apply(l,n),"destroy"===t&&y["default"](o).removeData("bootstrap.table")}s||(s=new y["default"].BootstrapTable(o,r),y["default"](o).data("bootstrap.table",s),s.init())}),void 0===a?this:a},y["default"].fn.bootstrapTable.Constructor=hs,y["default"].fn.bootstrapTable.theme=Ka.THEME,y["default"].fn.bootstrapTable.VERSION=Ka.VERSION,y["default"].fn.bootstrapTable.defaults=hs.DEFAULTS,y["default"].fn.bootstrapTable.columnDefaults=hs.COLUMN_DEFAULTS,y["default"].fn.bootstrapTable.events=hs.EVENTS,y["default"].fn.bootstrapTable.locales=hs.LOCALES,y["default"].fn.bootstrapTable.methods=hs.METHODS,y["default"].fn.bootstrapTable.utils=ss,y["default"](function(){y["default"]('[data-toggle="table"]').bootstrapTable()}),hs});var TABLE_EVENTS="all.bs.table click-cell.bs.table dbl-click-cell.bs.table click-row.bs.table dbl-click-row.bs.table sort.bs.table check.bs.table uncheck.bs.table onUncheck check-all.bs.table uncheck-all.bs.table check-some.bs.table uncheck-some.bs.table load-success.bs.table load-error.bs.table column-switch.bs.table page-change.bs.table search.bs.table toggle.bs.table show-search.bs.table expand-row.bs.table collapse-row.bs.table refresh-options.bs.table reset-view.bs.table refresh.bs.table",firstLoadTable=[],union=function(t,e){return $.isPlainObject(e)?addRememberRow(t,e):$.isArray(e)?$.each(e,function(e,i){$.isPlainObject(i)?addRememberRow(t,i):-1==$.inArray(i,t)&&(t[t.length]=i)}):-1==$.inArray(e,t)&&(t[t.length]=e),t},difference=function(t,e){if($.isPlainObject(e)){removeRememberRow(t,e)}else{if($.isArray(e)){$.each(e,function(e,i){if($.isPlainObject(i)){removeRememberRow(t,i)}else{var n=$.inArray(i,t);-1!=n&&t.splice(n,1)}})}else{var i=$.inArray(e,t);-1!=i&&t.splice(i,1)}}return t},_={union:union,difference:difference}; \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js deleted file mode 100644 index 56ec11b3e..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @author: Alec Fenichel - * @webSite: https://fenichelar.com - * @update: zhixin wen - */ - -var Utils = $.fn.bootstrapTable.utils - -$.extend($.fn.bootstrapTable.defaults, { - autoRefresh: false, - showAutoRefresh: true, - autoRefreshInterval: 60, - autoRefreshSilent: true, - autoRefreshStatus: true, - autoRefreshFunction: null -}) - -$.extend($.fn.bootstrapTable.defaults.icons, { - autoRefresh: { - bootstrap3: 'glyphicon-time icon-time', - bootstrap5: 'bi-clock', - materialize: 'access_time', - 'bootstrap-table': 'icon-clock' - }[$.fn.bootstrapTable.theme] || 'fa-clock' -}) - -$.extend($.fn.bootstrapTable.locales, { - formatAutoRefresh () { - return 'Auto Refresh' - } -}) - -$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) - -$.BootstrapTable = class extends $.BootstrapTable { - init (...args) { - super.init(...args) - - if (this.options.autoRefresh && this.options.autoRefreshStatus) { - this.setupRefreshInterval() - } - } - - initToolbar (...args) { - if (this.options.autoRefresh) { - this.buttons = Object.assign(this.buttons, { - autoRefresh: { - html: ` - - `, - event: this.toggleAutoRefresh - } - }) - } - - super.initToolbar(...args) - } - - toggleAutoRefresh () { - if (this.options.autoRefresh) { - if (this.options.autoRefreshStatus) { - clearInterval(this.options.autoRefreshFunction) - this.$toolbar.find('>.columns .auto-refresh') - .removeClass(this.constants.classes.buttonActive) - } else { - this.setupRefreshInterval() - this.$toolbar.find('>.columns .auto-refresh') - .addClass(this.constants.classes.buttonActive) - } - this.options.autoRefreshStatus = !this.options.autoRefreshStatus - } - } - - destroy () { - if (this.options.autoRefresh && this.options.autoRefreshStatus) { - clearInterval(this.options.autoRefreshFunction) - } - - super.destroy() - } - - setupRefreshInterval () { - this.options.autoRefreshFunction = setInterval(() => { - if (!this.options.autoRefresh || !this.options.autoRefreshStatus) { - return - } - this.refresh({ silent: this.options.autoRefreshSilent }) - }, this.options.autoRefreshInterval * 1000) - } -} diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js deleted file mode 100644 index e35b89f93..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * @author zhixin wen - * @github: bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.min.js - */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n0&&S[0]<4?1:+(S[0]+S[1])),!j&<&&(!(S=lt.match(/Edge\/(\d+)/))||S[1]>=74)&&(S=lt.match(/Chrome\/(\d+)/))&&(j=+S[1]);var bt=j,gt=bt,vt=y,mt=!!Object.getOwnPropertySymbols&&!vt((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&>&><41})),xt=mt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,$t=at,wt=et,Ct=ct,Ot=Object,St=xt?function(t){return"symbol"==typeof t}:function(t){var e=$t("Symbol");return wt(e)&&Ct(e.prototype,Ot(t))},jt=String,Rt=et,Bt=function(t){try{return jt(t)}catch(t){return"Object"}},Tt=TypeError,Ft=function(t){if(Rt(t))return t;throw Tt(Bt(t)+" is not a function")},kt=Ft,Pt=Y,Et=x,At=et,Nt=rt,Ht=TypeError,Dt={exports:{}},It=h,Lt=Object.defineProperty,Mt=function(t,e){try{Lt(It,t,{value:e,configurable:!0,writable:!0})}catch(n){It[t]=e}return e},_t=Mt,Wt="__core-js_shared__",zt=h[Wt]||_t(Wt,{}),Xt=zt;(Dt.exports=function(t,e){return Xt[t]||(Xt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.25.5",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE",source:"https://github.com/zloirock/core-js"});var Yt=V,qt=Object,Gt=function(t){return qt(Yt(t))},Vt=Gt,Ut=L({}.hasOwnProperty),Kt=Object.hasOwn||function(t,e){return Ut(Vt(t),e)},Qt=L,Zt=0,Jt=Math.random(),te=Qt(1..toString),ee=function(t){return"Symbol("+(void 0===t?"":t)+")_"+te(++Zt+Jt,36)},ne=h,ie=Dt.exports,re=Kt,oe=ee,ue=mt,fe=xt,ae=ie("wks"),ce=ne.Symbol,se=ce&&ce.for,le=fe?ce:ce&&ce.withoutSetter||oe,de=function(t){if(!re(ae,t)||!ue&&"string"!=typeof ae[t]){var e="Symbol."+t;ue&&re(ce,t)?ae[t]=ce[t]:ae[t]=fe&&se?se(e):le(e)}return ae[t]},he=x,pe=rt,ye=St,be=function(t,e){var n=t[e];return Pt(n)?void 0:kt(n)},ge=function(t,e){var n,i;if("string"===e&&At(n=t.toString)&&!Nt(i=Et(n,t)))return i;if(At(n=t.valueOf)&&!Nt(i=Et(n,t)))return i;if("string"!==e&&At(n=t.toString)&&!Nt(i=Et(n,t)))return i;throw Ht("Can't convert object to primitive value")},ve=TypeError,me=de("toPrimitive"),xe=function(t,e){if(!pe(t)||ye(t))return t;var n,i=be(t,me);if(i){if(void 0===e&&(e="default"),n=he(i,t,e),!pe(n)||ye(n))return n;throw ve("Can't convert object to primitive value")}return void 0===e&&(e="number"),ge(t,e)},$e=St,we=function(t){var e=xe(t,"string");return $e(e)?e:e+""},Ce=rt,Oe=h.document,Se=Ce(Oe)&&Ce(Oe.createElement),je=function(t){return Se?Oe.createElement(t):{}},Re=je,Be=!b&&!y((function(){return 7!=Object.defineProperty(Re("div"),"a",{get:function(){return 7}}).a})),Te=b,Fe=x,ke=$,Pe=R,Ee=Q,Ae=we,Ne=Kt,He=Be,De=Object.getOwnPropertyDescriptor;p.f=Te?De:function(t,e){if(t=Ee(t),e=Ae(e),He)try{return De(t,e)}catch(t){}if(Ne(t,e))return Pe(!Fe(ke.f,t,e),t[e])};var Ie={},Le=b&&y((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Me=rt,_e=String,We=TypeError,ze=function(t){if(Me(t))return t;throw We(_e(t)+" is not an object")},Xe=b,Ye=Be,qe=Le,Ge=ze,Ve=we,Ue=TypeError,Ke=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,Ze="enumerable",Je="configurable",tn="writable";Ie.f=Xe?qe?function(t,e,n){if(Ge(t),e=Ve(e),Ge(n),"function"==typeof t&&"prototype"===e&&"value"in n&&tn in n&&!n.writable){var i=Qe(t,e);i&&i.writable&&(t[e]=n.value,n={configurable:Je in n?n.configurable:i.configurable,enumerable:Ze in n?n.enumerable:i.enumerable,writable:!1})}return Ke(t,e,n)}:Ke:function(t,e,n){if(Ge(t),e=Ve(e),Ge(n),Ye)try{return Ke(t,e,n)}catch(t){}if("get"in n||"set"in n)throw Ue("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var en=Ie,nn=R,rn=b?function(t,e,n){return en.f(t,e,nn(1,n))}:function(t,e,n){return t[e]=n,t},on={exports:{}},un=b,fn=Kt,an=Function.prototype,cn=un&&Object.getOwnPropertyDescriptor,sn=fn(an,"name"),ln={EXISTS:sn,PROPER:sn&&"something"===function(){}.name,CONFIGURABLE:sn&&(!un||un&&cn(an,"name").configurable)},dn=et,hn=zt,pn=L(Function.toString);dn(hn.inspectSource)||(hn.inspectSource=function(t){return pn(t)});var yn,bn,gn,vn=hn.inspectSource,mn=et,xn=h.WeakMap,$n=mn(xn)&&/native code/.test(String(xn)),wn=Dt.exports,Cn=ee,On=wn("keys"),Sn=function(t){return On[t]||(On[t]=Cn(t))},jn={},Rn=$n,Bn=h,Tn=rt,Fn=rn,kn=Kt,Pn=zt,En=Sn,An=jn,Nn="Object already initialized",Hn=Bn.TypeError,Dn=Bn.WeakMap;if(Rn||Pn.state){var In=Pn.state||(Pn.state=new Dn);In.get=In.get,In.has=In.has,In.set=In.set,yn=function(t,e){if(In.has(t))throw Hn(Nn);return e.facade=t,In.set(t,e),e},bn=function(t){return In.get(t)||{}},gn=function(t){return In.has(t)}}else{var Ln=En("state");An[Ln]=!0,yn=function(t,e){if(kn(t,Ln))throw Hn(Nn);return e.facade=t,Fn(t,Ln,e),e},bn=function(t){return kn(t,Ln)?t[Ln]:{}},gn=function(t){return kn(t,Ln)}}var Mn={set:yn,get:bn,has:gn,enforce:function(t){return gn(t)?bn(t):yn(t,{})},getterFor:function(t){return function(e){var n;if(!Tn(e)||(n=bn(e)).type!==t)throw Hn("Incompatible receiver, "+t+" required");return n}}},_n=y,Wn=et,zn=Kt,Xn=b,Yn=ln.CONFIGURABLE,qn=vn,Gn=Mn.enforce,Vn=Mn.get,Un=Object.defineProperty,Kn=Xn&&!_n((function(){return 8!==Un((function(){}),"length",{value:8}).length})),Qn=String(String).split("String"),Zn=on.exports=function(t,e,n){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!zn(t,"name")||Yn&&t.name!==e)&&(Xn?Un(t,"name",{value:e,configurable:!0}):t.name=e),Kn&&n&&zn(n,"arity")&&t.length!==n.arity&&Un(t,"length",{value:n.arity});try{n&&zn(n,"constructor")&&n.constructor?Xn&&Un(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=Gn(t);return zn(i,"source")||(i.source=Qn.join("string"==typeof e?e:"")),t};Function.prototype.toString=Zn((function(){return Wn(this)&&Vn(this).source||qn(this)}),"toString");var Jn=et,ti=Ie,ei=on.exports,ni=Mt,ii=function(t,e,n,i){i||(i={});var r=i.enumerable,o=void 0!==i.name?i.name:e;if(Jn(n)&&ei(n,o,i),i.global)r?t[e]=n:ni(e,n);else{try{i.unsafe?t[e]&&(r=!0):delete t[e]}catch(t){}r?t[e]=n:ti.f(t,e,{value:n,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return t},ri={},oi=Math.ceil,ui=Math.floor,fi=Math.trunc||function(t){var e=+t;return(e>0?ui:oi)(e)},ai=function(t){var e=+t;return e!=e||0===e?0:fi(e)},ci=ai,si=Math.max,li=Math.min,di=ai,hi=Math.min,pi=function(t){return t>0?hi(di(t),9007199254740991):0},yi=function(t){return pi(t.length)},bi=Q,gi=function(t,e){var n=ci(t);return n<0?si(n+e,0):li(n,e)},vi=yi,mi=function(t){return function(e,n,i){var r,o=bi(e),u=vi(o),f=gi(i,u);if(t&&n!=n){for(;u>f;)if((r=o[f++])!=r)return!0}else for(;u>f;f++)if((t||f in o)&&o[f]===n)return t||f||0;return!t&&-1}},xi={includes:mi(!0),indexOf:mi(!1)},$i=Kt,wi=Q,Ci=xi.indexOf,Oi=jn,Si=L([].push),ji=function(t,e){var n,i=wi(t),r=0,o=[];for(n in i)!$i(Oi,n)&&$i(i,n)&&Si(o,n);for(;e.length>r;)$i(i,n=e[r++])&&(~Ci(o,n)||Si(o,n));return o},Ri=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bi=ji,Ti=Ri.concat("length","prototype");ri.f=Object.getOwnPropertyNames||function(t){return Bi(t,Ti)};var Fi={};Fi.f=Object.getOwnPropertySymbols;var ki=at,Pi=ri,Ei=Fi,Ai=ze,Ni=L([].concat),Hi=ki("Reflect","ownKeys")||function(t){var e=Pi.f(Ai(t)),n=Ei.f;return n?Ni(e,n(t)):e},Di=Kt,Ii=Hi,Li=p,Mi=Ie,_i=y,Wi=et,zi=/#|\.prototype\./,Xi=function(t,e){var n=qi[Yi(t)];return n==Vi||n!=Gi&&(Wi(e)?_i(e):!!e)},Yi=Xi.normalize=function(t){return String(t).replace(zi,".").toLowerCase()},qi=Xi.data={},Gi=Xi.NATIVE="N",Vi=Xi.POLYFILL="P",Ui=Xi,Ki=h,Qi=p.f,Zi=rn,Ji=ii,tr=Mt,er=function(t,e,n){for(var i=Ii(e),r=Mi.f,o=Li.f,u=0;uv;v++)if((f||v in y)&&(h=b(d=y[v],v,p),t))if(e)x[v]=h;else if(h)switch(t){case 3:return!0;case 5:return d;case 6:return v;case 2:Xr(x,d)}else switch(t){case 4:return!1;case 7:Xr(x,d)}return o?-1:i||r?r:x}},qr={forEach:Yr(0),map:Yr(1),filter:Yr(2),some:Yr(3),every:Yr(4),find:Yr(5),findIndex:Yr(6),filterReject:Yr(7)},Gr={},Vr=ji,Ur=Ri,Kr=Object.keys||function(t){return Vr(t,Ur)},Qr=b,Zr=Le,Jr=Ie,to=ze,eo=Q,no=Kr;Gr.f=Qr&&!Zr?Object.defineProperties:function(t,e){to(t);for(var n,i=eo(e),r=no(e),o=r.length,u=0;o>u;)Jr.f(t,n=r[u++],i[n]);return t};var io,ro=at("document","documentElement"),oo=ze,uo=Gr,fo=Ri,ao=jn,co=ro,so=je,lo=Sn("IE_PROTO"),ho=function(){},po=function(t){return" - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html b/ruoyi-admin/src/main/resources/templates/demo/form/basic.html deleted file mode 100644 index 2988a6578..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/basic.html +++ /dev/null @@ -1,593 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    基本表单 简单登录表单示例
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -

    登录

    -

    欢迎登录本站(⊙o⊙)

    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    -

    还不是会员?

    -

    您可以注册一个新账户

    -

    - -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    横向表单
    -
    - - - - - - - - - - -
    -
    -
    -
    -

    欢迎登录本站(⊙o⊙)

    -
    - - -
    - 请输入您注册时所填的E-mail -
    -
    -
    - - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    内联表单
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    弹出表单 弹出框登录示例
    -
    - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    所有表单元素 包括自定义样式的复选和单选按钮
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - -
    - 帮助文本,可能会超过一行,以块级元素显示 -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    -

    ruoyi.vip

    -
    -
    -
    -
    - - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    - - - -
    -
    -
    -
    - - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    - - - -
    -
    -
    -
    - - -
    - - -
    - -
    -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    - - -
    - - - -
    -
    -
    -
    - - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - - -
    -
    @ - -
    -
    - .00 -
    -
    ¥ - .00 -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -
    - - -
    - -
    -
    - - -
    - - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    - - - -
    - -
    -
    - - -
    - - - -
    -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/button.html b/ruoyi-admin/src/main/resources/templates/demo/form/button.html deleted file mode 100644 index 70e8b0808..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/button.html +++ /dev/null @@ -1,620 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    按钮颜色
    -
    - - - - - - - - - - -
    -
    -
    -

    - 可使用class来快速改变按钮的颜色,如.btn-primary -

    - -

    - 普通按钮 -

    -

    - - - - - - - - -

    -
    -
    -
    -
    -
    -
    -
    按钮大小
    -
    - - - - - - - - - - -
    -
    -
    -

    - 可以通过添加class的值为.btn-lg, .btn-sm, or .btn-xs来修改按钮的大小 -

    -

    按钮尺寸

    -

    - - -
    - - -
    - - -
    - - -

    -
    -
    -
    -
    -
    -
    -
    线性按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 要使用线性按钮,可添加class.btn-block.btn-outline -

    - -

    线性按钮

    -

    - - - - - - - -

    -

    块级按钮

    -

    - -

    -
    -
    -
    -
    -
    -
    -
    3D按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 可以通过添加.dimclass来使用3D按钮. -

    -

    3D按钮

    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    下拉按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 下拉按钮可使用任何颜色任何大小 -

    - -

    下拉按钮

    -
    - - -
    -
    - - -
    -
    - - -
    - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    按钮组
    -
    - - - - - - - - - - -
    -
    -
    - -

    按钮组

    -
    - - - -
    -
    -
    -
    - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    图标按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 任何按钮都可以在左侧或右侧添加图标 -

    - -

    图标按钮

    -

    - - - - - - - - 分享到微信 - - - 使用QQ账号登录 - - - - - - - - - - - - - - - - - - - - - - - - 收藏 - -

    - -

    按钮切换

    - - -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    圆形图标按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 要使用圆形图标按钮,可以通过添加class为.btn-circle实现 -

    - -

    圆形按钮

    -
    - - - - - - - -
    -
    - - - - - - - - -
    -
    -
    -
    -
    -
    -
    圆角按钮
    -
    - - - - - - - - - - -
    -
    -
    -

    - 可以通过添加class的值微.btn-rounded来实现圆角按钮 -

    - -

    按钮组

    -

    - 默认 - 主要 - 成果 - 信息 - 警告 - 危险 - 危险 -
    -
    - 圆角块级带图标按钮 -

    -
    -
    -
    - -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/cards.html b/ruoyi-admin/src/main/resources/templates/demo/form/cards.html deleted file mode 100644 index 35a7f68d4..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/cards.html +++ /dev/null @@ -1,319 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - NEW -
    IT-01 - 设计部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    48%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 12 -
    -
    -
    周期
    - 4个月 -
    -
    -
    预算
    - ¥200,913 -
    -
    - -
    -
    -
    -
    -
    IT-04 - 市场部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    32%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 24 -
    -
    -
    周期
    - 3个月 -
    -
    -
    预算
    - ¥190,325 -
    -
    - -
    -
    -
    -
    -
    IT-07 - 财务部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    73%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 11 -
    -
    -
    周期
    - 6个月 -
    -
    -
    预算
    - ¥560,105 -
    -
    - -
    -
    -
    -
    -
    -
    -
    IT-02 - 开发部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    61%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 43 -
    -
    -
    周期
    - 1个月 -
    -
    -
    预算
    - ¥705,913 -
    -
    - -
    -
    -
    -
    - 截止 -
    IT-05 - 管理层
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    14%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 8 -
    -
    -
    周期
    - 7个月 -
    -
    -
    预算
    - ¥40,200 -
    -
    - -
    -
    -
    -
    -
    IT-08 - 销售部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    25%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 25 -
    -
    -
    周期
    - 4个月 -
    -
    -
    预算
    - ¥140,105 -
    -
    - -
    -
    -
    -
    -
    -
    - -
    IT-02 - 销售部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    82%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 68 -
    -
    -
    周期
    - 2个月 -
    -
    -
    预算
    - ¥701,400 -
    -
    - -
    -
    -
    -
    -
    IT-06 - 销售部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    26%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 16 -
    -
    -
    周期
    - 8个月 -
    -
    -
    预算
    - ¥160,100 -
    -
    - -
    -
    -
    -
    -
    IT-09 - 销售部
    -
    -
    -

    部门简介

    -

    - 平面设计(graphic design),也称为视觉传达设计,是以“视觉”作为沟通和表现的方式,透过多种方式来创造和结合符号、图片和文字,借此作出用来传达想法或讯息的视觉表现。 -

    -
    - 当前项目进度: -
    18%
    -
    -
    -
    -
    -
    -
    -
    项目
    - 53 -
    -
    -
    周期
    - 9个月 -
    -
    -
    预算
    - ¥60,140 -
    -
    - -
    -
    -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html b/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html deleted file mode 100644 index 450fcec85..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/cxselect.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    多级联动下拉https://github.com/ciaoca/cxSelect
    -
    -
    -

    简单联动示例。

    -
    -
    - -
    -
    - -
    -
    -
    - -

    国内省市区联动。

    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -

    自定义选项。

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/datetime.html b/ruoyi-admin/src/main/resources/templates/demo/form/datetime.html deleted file mode 100644 index 591ba101b..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/datetime.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    日期选择器 https://github.com/smalot/bootstrap-datetimepicker
    -
    -
    -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - - - -
    -
    - -
    - -
    - - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    日期选择器 https://github.com/sentsin/laydate
    -
    -
    -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    - -
    - -
    - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/duallistbox.html b/ruoyi-admin/src/main/resources/templates/demo/form/duallistbox.html deleted file mode 100644 index ef80a3dec..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/duallistbox.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    双重列表框 https://github.com/istvan-ujjmeszaros/bootstrap-duallistbox
    -
    -
    -

    - Bootstrap Dual Listbox是针对Twitter Bootstrap进行了优化的响应式双列表框。它适用于所有现代浏览器和触摸设备。 -

    - -
    - -
    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/grid.html b/ruoyi-admin/src/main/resources/templates/demo/form/grid.html deleted file mode 100644 index 402805d32..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/grid.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    栅格设置
    -
    - - - - - - - - - - -
    -
    -
    - -

    通过下表可以详细查看 Bootstrap 的栅格系统是如何在多种屏幕设备上工作的。

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - 超小屏幕 - 手机 (<768px) - - 小屏幕 - 平板 (≥768px) - - 中等屏幕 - 桌面显示器 (≥992px) - - 大屏幕 - 大桌面显示器 (≥1200px) -
    栅格系统行为总是水平排列开始是堆叠在一起的,当大于这些阈值时将变为水平排列C
    .container 最大宽度None (自动)750px970px1170px
    类前缀.col-xs- - .col-sm- - .col-md- - .col-lg- -
    列(column)数12
    最大列(column)宽自动~62px~81px~97px
    槽(gutter)宽30px (每列左右均有 15px)
    可嵌套
    偏移(Offsets)
    列排序
    -
    - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    从堆叠到水平排列
    -
    - - - - - - - - - - -
    -
    -
    - -

    使用单一的一组 .col-md-* 栅格类,就可以创建一个基本的栅格系统,在手机和平板设备上一开始是堆叠在一起的(超小屏幕到小屏幕这一范围),在桌面(中等)屏幕设备上变为水平排列。所有“列(column)必须放在 ” .row 内。

    -
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    .col-md-1
    -
    -
    -
    .col-md-8
    -
    .col-md-4
    -
    -
    -
    .col-md-4
    -
    .col-md-4
    -
    .col-md-4
    -
    -
    -
    .col-md-6
    -
    .col-md-6
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    移动设备和桌面屏幕
    -
    - - - - - - - - - - -
    -
    -
    - -

    是否不希望在小屏幕设备上所有列都堆叠在一起?那就使用针对超小屏幕和中等屏幕设备所定义的类吧,即 .col-xs-*.col-md-*。请看下面的实例,研究一下这些是如何工作的。

    -
    -
    .col-xs-12 .col-md-8
    -
    .col-xs-6 .col-md-4
    -
    -
    -
    .col-xs-6 .col-md-4
    -
    .col-xs-6 .col-md-4
    -
    .col-xs-6 .col-md-4
    -
    -
    -
    .col-xs-6
    -
    .col-xs-6
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    手机、平板、桌面
    -
    - - - - - - - - - - -
    -
    -
    - -

    在上面案例的基础上,通过使用针对平板设备的 .col-sm-* 类,我们来创建更加动态和强大的布局吧。

    -
    -
    .col-xs-12 .col-sm-6 .col-md-8
    -
    .col-xs-6 .col-md-4
    -
    -
    -
    .col-xs-6 .col-sm-4
    -
    .col-xs-6 .col-sm-4
    - -
    -
    .col-xs-6 .col-sm-4
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    多余的列(column)将另起一行排列
    - -
    - - - - - - - - - - -
    -
    -
    -

    在等宽的4网格中,网格不等高会碰到问题,为了解决这个问题,可使用.clearfix响应实用工具类 -

    -
    -
    - .col-xs-6 .col-sm-3 -
    调整窗口大小或者在手机上查看本示例 -
    -
    .col-xs-6 .col-sm-3
    - - -
    - -
    .col-xs-6 .col-sm-3
    -
    .col-xs-6 .col-sm-3
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    列偏移
    - -
    - - - - - - - - - - -
    -
    -
    - -

    使用 .col-md-offset-* 类可以将列向右侧偏移。这些类实际是通过使用 * 选择器为当前元素增加了左侧的边距(margin)。例如,.col-md-offset-4 类将 .col-md-4 元素向右侧偏移了4个列(column)的宽度。

    -
    -
    .col-md-4
    -
    .col-md-4 .col-md-offset-4
    -
    -
    -
    .col-md-3 .col-md-offset-3
    -
    .col-md-3 .col-md-offset-3
    -
    -
    -
    .col-md-6 .col-md-offset-3
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    嵌套列
    - -
    - - - - - - - - - - -
    -
    -
    -

    为了使用内置的栅格系统将内容再次嵌套,可以通过添加一个新的 .row 元素和一系列 .col-sm-* 元素到已经存在的 .col-sm-* 元素内。被嵌套的行(row)所包含的列(column)的个数不能超过12(其实,没有要求你必须占满12列)。

    -
    -
    - 第一级: .col-md-9 -
    -
    - 第二级: .col-md-6 -
    -
    - 第二级: .col-md-6 -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    列排序
    -
    - - - - - - - - - - -
    -
    -
    -

    通过使用 .col-md-push-*.col-md-pull-* 类就可以很容易的改变列(column)的顺序。

    -
    -
    .col-md-9 .col-md-push-3
    -
    .col-md-3 .col-md-pull-9
    -
    -
    -
    - -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/invoice.html b/ruoyi-admin/src/main/resources/templates/demo/form/invoice.html deleted file mode 100644 index d321ff2d8..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/invoice.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - -
    - -
    -
    -
    -
    -
    -
    - 北京百度在线网络技术有限公司
    - 北京市海淀区上地十街10号
    - 总机: (+86 10) 5992 8888 -
    -
    - -
    -

    单据编号:

    -

    H+-000567F7-00

    -
    - 阿里巴巴集团
    - 中国杭州市华星路99号东部软件园创业大厦6层(310099)
    - 总机: (86) 571-8502-2088 -
    -

    - 日期: 2014-11-11 -

    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    清单数量单价税率总价
    -
    尚都比拉2013冬装新款女装 韩版修身呢子大衣 秋冬气质羊毛呢外套 -
    -
    1¥26.00¥1.20¥31,98
    -
    11*11夏娜 新款斗篷毛呢外套 女秋冬呢子大衣 韩版大码宽松呢大衣 -
    - 双十一特价 - -
    2¥80.00¥1.20¥196.80
    -
    2013秋装 新款女装韩版学生秋冬加厚加绒保暖开衫卫衣 百搭女外套 -
    -
    3¥420.00¥1.20¥1033.20
    -
    - - - - - - - - - - - - - - - - - -
    总价: - ¥1026.00
    税: - ¥235.98
    总计 - ¥1261.98
    - -
    - -
    - -
    注意: 请在30日内完成付款,否则订单会自动取消。 -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/jasny.html b/ruoyi-admin/src/main/resources/templates/demo/form/jasny.html deleted file mode 100644 index 5cdf730b1..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/jasny.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    文件上传控件 https://github.com/jasny/bootstrap
    -
    -
    -
    - - -
    -
    - 选择文件更改 - 清除 -
    -
    - -
    - -
    -
    - 选择文件更改 - - × -
    -
    - -
    - -
    -
    -
    -
    - 选择图片更改 - 清除 -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    - 选择图片更改 - 清除 -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    固定格式文本 https://github.com/jasny/bootstrap
    -
    -
    -
    - - - 158-8888-88888 -
    - -
    - - - 0730-8888888 -
    - -
    - - - yyyy-mm-dd -
    - -
    - - - 192.168.100.200 -
    - -
    - - - 99-9999999 -
    -
    - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/labels_tips.html b/ruoyi-admin/src/main/resources/templates/demo/form/labels_tips.html deleted file mode 100644 index 599897de5..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/labels_tips.html +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    徽章 (Badges)
    -
    - - - - - - - - - - -
    -
    -
    -

    - 要添加徽章,只需要在元素上添加.badge即可,改变徽章的颜色可使用如下class,如.badge-primary。 -

    -

    -

    -

    badge-primary -

    -

    badge-info -

    -

    badge-success -

    -

    badge-warning -

    -

    badge-danger -

    -
    -
    -
    - -
    -
    -
    -
    标签 (Labels)
    -
    - - - - - - - - - - -
    -
    -
    -

    - 要添加徽章,只需要在元素上添加class.label即可,如果需要修改颜色,添加如下class,如.label-primary -

    -

    -

    -

    label-primary -

    -

    label-info -

    -

    label-success -

    -

    label-warning -

    -

    label-danger -

    -
    -
    -
    -
    - -
    -
    -
    -
    -
    通知样式
    -
    - - - - - - - - - - -
    -
    -
    -
    - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    -
    -
    -
    -
    -
    -
    带关闭按钮的通知样式
    -
    - - - - - - - - - - -
    -
    -
    -
    - - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    - - RuoYi是一个很棒的后台UI框架 了解更多. -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    工具提示
    -
    - - - - - - - - - - -
    -
    -
    -

    工具提示示例 深色背景

    -
    - - - - -
    -
    -

    工具提示 - 单击提示

    -
    - - - - -
    -
    -
    -
    - -
    - -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/localrefresh.html b/ruoyi-admin/src/main/resources/templates/demo/form/localrefresh.html deleted file mode 100644 index 530092744..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/localrefresh.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -

    任务列表

    -

    - - 点击刷新按钮刷新数据到列表中 -

    - -
    - - - - -
    -
    - -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/progress_bars.html b/ruoyi-admin/src/main/resources/templates/demo/form/progress_bars.html deleted file mode 100644 index 032c58303..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/progress_bars.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    进度条 (Progress Bars)
    -
    - - - - - - - - - - -
    -
    -
    - -
    基本
    -
    -
    - 35% Complete (success) -
    -
    - -
    -
    - 43% Complete (success) -
    -
    - -
    条纹效果
    -
    -
    - 50% Complete (success) -
    -
    - -
    动画效果
    -
    -
    - 75% Complete (success) -
    -
    - -
    堆叠效果
    -
    -
    - 30% Complete (success) -
    -
    - 20% Complete (warning) -
    -
    - 40% Complete (danger) -
    -
    - -
    带有提示标签的进度条
    -
    -
    - 95% -
    -
    - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/select.html b/ruoyi-admin/src/main/resources/templates/demo/form/select.html deleted file mode 100644 index 2abac45cd..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/select.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - -
    -
    -
    -
    -
    -
    -
    下拉框 https://github.com/select2/select2
    -
    -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    - -
    -
    -
    -
    -
    -
    -
    下拉框 https://github.com/snapappointments/bootstrap-select
    -
    -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    - -
    -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/sortable.html b/ruoyi-admin/src/main/resources/templates/demo/form/sortable.html deleted file mode 100644 index 99ede8935..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/sortable.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -

    任务列表

    -

    在列表之间拖动任务面板

    - -
    - - - - -
    - -
      -
    • - 加强过程管理,及时统计教育经费使用情况,做到底码清楚, -
      - 标签 - 2018.09.01 -
      -
    • -
    • - 支持财会人员的继续培训工作。 -
      - 标记 - 2018.05.12 -
      -
    • -
    • - 协同教导处搞好助学金、减免教科书费的工作。 -
      - 标记 - 2018.09.10 -
      -
    • -
    • - 要求会计、出纳人员严格执行财务制度,遵守岗位职责,按时上报各种资料。 -
      - 确定 - 2018.06.10 -
      -
    • -
    • - 做好职工公费医疗工作,按时发放门诊费。 -
      - 标签 - 2018.09.09 -
      -
    • -
    • - 有计划地把课本复习三至五遍。 -
      - 确定 - 2018.08.04 -
      -
    • -
    • - 看一本高质量的高中语法书 -
      - 标记 - 2018.05.12 -
      -
    • -
    • - 选择一份较好的英语报纸,通过阅读提高英语学习效果。 -
      - 标记 - 2018.09.10 -
      -
    • -
    -
    -
    -
    -
    -
    -
    -

    进行中

    -

    在列表之间拖动任务面板

    -
      -
    • - 全面、较深入地掌握我们“产品”的功能、特色和优势并做到应用自如。 -
      - 标签 - 2018.09.01 -
      -
    • -
    • - 根据自己以前所了解的和从其他途径搜索到的信息,录入客户资料150家。 -
      - 标记 - 2018.05.12 -
      -
    • -
    • - 锁定有意向客户20家。 -
      - 标记 - 2018.09.10 -
      -
    • -
    • - 力争完成销售指标。 -
      - 标签 - 2018.09.09 -
      -
    • -
    • - 在总结和摸索中前进。 -
      - 确定 - 2018.08.04 -
      -
    • -
    • - 不断学习行业知识、产品知识,为客户带来实用介绍内容 -
      - 标记 - 2018.05.12 -
      -
    • -
    • - 先友后单:与客户发展良好友谊,转换销售员角色,处处为客户着想 -
      - 标记 - 2018.11.04 -
      -
    • -
    -
    -
    -
    -
    -
    -
    -

    已完成

    -

    在列表之间拖动任务面板

    -
      -
    • - 制定工作日程表 -
      - 标记 - 2018.09.10 -
      -
    • -
    • - 每天坚持打40个有效电话,挖掘潜在客户 -
      - 标签 - 2018.09.09 -
      -
    • -
    • - 拜访客户之前要对该客户做全面的了解(客户的潜在需求、职位、权限以及个人性格和爱好) -
      - 标签 - 2018.09.09 -
      -
    • -
    • - 提高自己电话营销技巧,灵活专业地与客户进行电话交流 -
      - 确定 - 2018.08.04 -
      -
    • -
    • - 通过电话销售过程中了解各盛市的设备仪器使用、采购情况及相关重要追踪人 -
      - 标记 - 2018.05.12 -
      -
    • - -
    -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/summernote.html b/ruoyi-admin/src/main/resources/templates/demo/form/summernote.html deleted file mode 100644 index a14b04319..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/summernote.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    Summernote 富文本编辑器
    -
    -
    -
    -

    若依后台管理系统

    -

    ruoyi是一个完全响应式,基于Bootstrap3.3.7最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术,她提供了诸多的强大的可以重新组合的UI组件,并集成了最新的jQuery版本(v2.1.1),当然,也集成了很多功能强大,用途广泛的就jQuery插件,她可以用于所有的Web应用程序,如网站管理后台网站会员中心CMSCRMOA等等,当然,您也可以对她进行深度定制,以做出更强系统。

    -

    - 当前版本:v4.7.8 -

    -

    - 免费开源 -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Summernote

    -

    - Summernote是一个简单的基于Bootstrap的WYSIWYG富文本编辑器 -

    -
    官方文档请参考: - https://github.com/summernote/summernote -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    编辑/保存为html代码示例
    - - -
    -
    - -
    -

    你好,若依

    -

    H+是一个完全响应式,基于Bootstrap3.3.7最新版本开发的扁平化主题,她采用了主流的左右两栏式布局,使用了Html5+CSS3等现代技术,她提供了诸多的强大的可以重新组合的UI组件,并集成了最新的jQuery版本(v2.1.1),当然,也集成了很多功能强大,用途广泛的就jQuery插件,她可以用于所有的Web应用程序,如网站管理后台网站会员中心CMSCRMOA等等,当然,您也可以对她进行深度定制,以做出更强系统。

    -

    - 当前版本:v4.7.8 -

    -

    - 开源免费 -

    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/tabs_panels.html b/ruoyi-admin/src/main/resources/templates/demo/form/tabs_panels.html deleted file mode 100644 index 3cc586677..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/tabs_panels.html +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    基本面板 这是一个自定义面板
    -
    - - - - - - - - - - -
    -
    -
    -

    - Bootstrap
    -

    -

    - 简洁、直观、强悍的前端开发框架,让web开发更迅速、简单。

    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - HTML5 文档类型 -

    Bootstrap 使用到的某些 HTML 元素和 CSS 属性需要将页面设置为 HTML5 文档类型。在你项目中的每个页面都要参照下面的格式进行设置。

    -
    -
    -
    -
    - 移动设备优先 -

    在 Bootstrap 2 中,我们对框架中的某些关键部分增加了对移动设备友好的样式。而在 Bootstrap 3 中,我们重写了整个框架,使其一开始就是对移动设备友好的。这次不是简单的增加一些可选的针对移动设备的样式,而是直接融合进了框架的内核中。也就是说,Bootstrap 是移动设备优先的。针对移动设备的样式融合进了框架的每个角落,而不是增加一个额外的文件。

    -
    -
    -
    - - -
    -
    - -
    -
    - -
    -
    -

    图标选项卡

    -
    -
    - - -
    -
    - -
    -
    -
    - 排版与链接 - -

    Bootstrap 排版、链接样式设置了基本的全局样式。分别是: 为 body 元素设置 background-color: #fff; 使用 @font-family-base、@font-size-base 和 @line-height-base a变量作为排版的基本参数 为所有链接设置了基本颜色 @link-color ,并且当链接处于 :hover 状态时才添加下划线 这些样式都能在 scaffolding.less 文件中找到对应的源码。

    -
    - -
    - Normalize.css - -

    为了增强跨浏览器表现的一致性,我们使用了 Normalize.css,这是由 Nicolas Gallagher 和 Jonathan Neal 维护的一个CSS 重置样式库。

    -
    -
    - 布局容器 - -

    Bootstrap 需要为页面内容和栅格系统包裹一个 .container 容器。我们提供了两个作此用处的类。注意,由于 padding 等属性的原因,这两种 容器类不能互相嵌套。

    -
    -
    - 栅格系统 - -

    Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列。它包含了易于使用的预定义类,还有强大的mixin 用于生成更具语义的布局。

    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - 排版与链接 - -

    Bootstrap 排版、链接样式设置了基本的全局样式。分别是: 为 body 元素设置 background-color: #fff; 使用 @font-family-base、@font-size-base 和 @line-height-base a变量作为排版的基本参数 为所有链接设置了基本颜色 @link-color ,并且当链接处于 :hover 状态时才添加下划线 这些样式都能在 scaffolding.less 文件中找到对应的源码。

    -
    -
    -
    -
    - 栅格系统 - -

    Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列。它包含了易于使用的预定义类,还有强大的mixin 用于生成更具语义的布局。

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    -
    - 排版与链接 - -

    Bootstrap 排版、链接样式设置了基本的全局样式。分别是: 为 body 元素设置 background-color: #fff; 使用 @font-family-base、@font-size-base 和 @line-height-base a变量作为排版的基本参数 为所有链接设置了基本颜色 @link-color ,并且当链接处于 :hover 状态时才添加下划线 这些样式都能在 scaffolding.less 文件中找到对应的源码。

    -
    -
    -
    -
    - 栅格系统 - -

    Bootstrap 提供了一套响应式、移动设备优先的流式栅格系统,随着屏幕或视口(viewport)尺寸的增加,系统会自动分为最多12列。它包含了易于使用的预定义类,还有强大的mixin 用于生成更具语义的布局。

    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    Bootstrap面板 自定义背景
    -
    -
    - -
    -
    -
    -
    - 默认面板 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    - -
    -
    -
    -
    -
    - 主要 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    -
    -
    -
    -
    -
    - 成功 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    -
    -
    -
    -
    -
    -
    -
    - 信息 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    - -
    -
    -
    -
    -
    - 警告 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    -
    -
    -
    -
    -
    - 危险 -
    -
    -

    通过 .panel-heading 可以很简单地为面板加入一个标题容器。你也可以通过添加设置了 .panel-title 类的标签,添加一个预定义样式的标题。 为了给链接设置合适的颜色,务必将链接放到带有 .panel-title 类的标题标签内。

    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    折叠面板
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - 标题 #1 -
    -
    -
    -
    - Bootstrap相关优质项目推荐 这些项目或者是对Bootstrap进行了有益的补充,或者是基于Bootstrap开发的 -
    -
    -
    -
    -
    -

    - 标题 #2 -

    -
    -
    -
    - Bootstrap相关优质项目推荐 这些项目或者是对Bootstrap进行了有益的补充,或者是基于Bootstrap开发的 -
    -
    -
    -
    -
    -

    - 标题 #3 -

    -
    -
    -
    - Bootstrap相关优质项目推荐 这些项目或者是对Bootstrap进行了有益的补充,或者是基于Bootstrap开发的 -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    超大屏幕

    -

    Bootstrap 支持的另一个特性,超大屏幕(Jumbotron)。顾名思义该组件可以增加标题的大小,并为登录页面内容添加更多的外边距(margin)。使用超大屏幕(Jumbotron)的步骤如下:

    -
    -
      -
    1. 创建一个带有 class .jumbotron. 的容器
    2. -
    3. 除了更大的 <h1>,字体粗细 font-weight 被减为 200px。
    4. -
    -
    - -

    了解更多 -

    -
    -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/timeline.html b/ruoyi-admin/src/main/resources/templates/demo/form/timeline.html deleted file mode 100644 index 132977e58..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/timeline.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - 时间轴 - - - - - - -
    -
    -
    - 打开/关闭颜色/背景或方向版本: - 轻型版本 - 黑色版本 -
    -
    -
    -
    - - -
    -

    会议

    -

    上一年的销售业绩发布会。总结产品营销和销售趋势及销售的现状。 -

    - 更多信息 - - 今天
    - 2月3日 -
    -
    -
    - -
    -
    - -
    - -
    -

    给张三发送文档

    -

    发送上年度《销售业绩报告》

    - 下载文档 - - 今天
    - 2月3日 -
    -
    -
    - -
    -
    - -
    - -
    -

    喝咖啡休息

    -

    喝咖啡啦,啦啦啦~~

    - 更多 - 昨天
    2月2日
    -
    -
    - -
    -
    - -
    - -
    -

    给李四打电话

    -

    给李四打电话分配本月工作任务

    - 昨天
    2月2日
    -
    -
    - -
    -
    - -
    - -
    -

    公司年会

    -

    发年终奖啦,啦啦啦~~

    - 前天
    2月1日
    -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/upload.html b/ruoyi-admin/src/main/resources/templates/demo/form/upload.html deleted file mode 100644 index 0a7b9d959..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/upload.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    文件上传控件 https://github.com/kartik-v/bootstrap-fileinput
    -
    -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/validate.html b/ruoyi-admin/src/main/resources/templates/demo/form/validate.html deleted file mode 100644 index 8fb68d729..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/validate.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    jQuery Validate 简介
    -
    -
    -

    jquery.validate.js 是一款优秀的jQuery表单验证插件。它具有如下特点:

    -
      -
    • 安装简单
    • -
    • 内置超过20种数据验证方法
    • -
    • 直列错误提示信息
    • -
    • 可扩展的数据验证方法
    • -
    • 使用内置的元数据或插件选项来指定您的验证规则
    • -
    • 优雅的交互设计
    • -
    -

    官网:http://jqueryvalidation.org/ -

    -
    -
    -
    -
    -
    -
    -
    -
    -
    简单示例
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -

    更多示例请访问官方示例页面:查看 -

    -

    中文API可参考:http://doc.ruoyi.vip/ruoyi/document/zjwd.html#jquery-validate -

    -
    -
    -
    -
    -
    -
    -
    完整验证表单
    -
    -
    -
    -
    - -
    - - 这里写点提示的内容 -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 请再次输入您的密码 -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/form/wizard.html b/ruoyi-admin/src/main/resources/templates/demo/form/wizard.html deleted file mode 100644 index 696870d2d..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/form/wizard.html +++ /dev/null @@ -1,339 +0,0 @@ - - - - - - - - -
    -
    -
    -
    -
    -
    - 表单向导 - https://github.com/techlab/jquery-smartwizard -
    -
    -
    -
    - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - - 这里写点提示的内容 - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - 请再次输入您的密码 - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    1、如果不需要工具栏固定在页面底部, 将style中下面的部分取消注释

    .sw>.toolbar-bottom

    -

    2、如果设置了自动调节高度(autoAdjustHeight)为true, 将style中下面的部分取消注释

    .sw>.tab-content

    -

    3、工具栏的按钮样式会被表单插件中.btn样式覆盖导致bootstrap中的按钮样式无效, 如果需要改变按钮样式可以自己定义并提高优先级

    -
    -
    -
    -
    -

    测试多行显示

    -
    -$('#smartwizard').smartWizard({
    -  selected: 0, // Initial selected step, 0 = first step
    -  theme: 'default', // theme for the wizard, related css need to include for other than default theme
    -  justified: true, // Nav menu justification. true/false
    -  darkMode:false, // Enable/disable Dark Mode if the theme supports. true/false
    -  autoAdjustHeight: true, // Automatically adjust content height
    -  cycleSteps: false, // Allows to cycle the navigation of steps
    -  backButtonSupport: true, // Enable the back button support
    -  enableURLhash: true, // Enable selection of the step based on url hash
    -  transition: {
    -      animation: 'none', // Effect on navigation, none/fade/slide-horizontal/slide-vertical/slide-swing
    -      speed: '400', // Transition animation speed
    -      easing:'' // Transition animation easing. Not supported without a jQuery easing plugin
    -  },
    -  toolbarSettings: {
    -      toolbarPosition: 'bottom', // none, top, bottom, both
    -      toolbarButtonPosition: 'right', // left, right, center
    -      showNextButton: true, // show/hide a Next button
    -      showPreviousButton: true, // show/hide a Previous button
    -      toolbarExtraButtons: [] // Extra buttons to show on toolbar, array of jQuery input/buttons elements
    -  },
    -  anchorSettings: {
    -      anchorClickable: true, // Enable/Disable anchor navigation
    -      enableAllAnchors: false, // Activates all anchors clickable all times
    -      markDoneStep: true, // Add done state on navigation
    -      markAllPreviousStepsAsDone: true, // When a step selected by url hash, all previous steps are marked done
    -      removeDoneStepOnNavigateBack: false, // While navigate back done step after active step will be cleared
    -      enableAnchorOnDoneStep: true // Enable/Disable the done steps navigation
    -  },
    -  keyboardSettings: {
    -      keyNavigation: true, // Enable/Disable keyboard navigation(left and right keys are used if enabled)
    -      keyLeft: [37], // Left key code
    -      keyRight: [39] // Right key code
    -  },
    -  lang: { // Language variables for button
    -      next: 'Next',
    -      previous: 'Previous'
    -  },
    -  disabledSteps: [], // Array Steps disabled
    -  errorSteps: [], // Highlight step with errors
    -  hiddenSteps: [] // Hidden steps
    -});
    -										
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/icon/fontawesome.html b/ruoyi-admin/src/main/resources/templates/demo/icon/fontawesome.html deleted file mode 100644 index b16b56cbb..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/icon/fontawesome.html +++ /dev/null @@ -1,1054 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    所有图标 所有图标集合 - Font Awesome
    -
    - - - - - - - - - - -
    -
    -
    -
    - -
    -
    address-book
    -
    address-book-o
    -
    address-card
    -
    address-card-o
    -
    adjust
    -
    american-sign-language-interpreting
    -
    anchor
    -
    archive
    -
    area-chart
    -
    arrows
    -
    arrows-h
    -
    arrows-v
    -
    asl-interpreting (alias)
    -
    assistive-listening-systems
    -
    asterisk
    -
    at
    -
    audio-description
    -
    automobile (alias)
    -
    balance-scale
    -
    ban
    -
    bank (alias)
    -
    bar-chart
    -
    bar-chart-o (alias)
    -
    barcode
    -
    bars
    -
    bath
    -
    bathtub (alias)
    -
    battery (alias)
    -
    battery-0 (alias)
    -
    battery-1 (alias)
    -
    battery-2 (alias)
    -
    battery-3 (alias)
    -
    battery-4 (alias)
    -
    battery-empty
    -
    battery-full
    -
    battery-half
    -
    battery-quarter
    -
    battery-three-quarters
    -
    bed
    -
    beer
    -
    bell
    -
    bell-o
    -
    bell-slash
    -
    bell-slash-o
    -
    bicycle
    -
    binoculars
    -
    birthday-cake
    -
    blind
    -
    bluetooth
    -
    bluetooth-b
    -
    bolt
    -
    bomb
    -
    book
    -
    bookmark
    -
    bookmark-o
    -
    braille
    -
    briefcase
    -
    bug
    -
    building
    -
    building-o
    -
    bullhorn
    -
    bullseye
    -
    bus
    -
    cab (alias)
    -
    calculator
    -
    calendar
    -
    calendar-check-o
    -
    calendar-minus-o
    -
    calendar-o
    -
    calendar-plus-o
    -
    calendar-times-o
    -
    camera
    -
    camera-retro
    -
    car
    -
    caret-square-o-down
    -
    caret-square-o-left
    -
    caret-square-o-right
    -
    caret-square-o-up
    -
    cart-arrow-down
    -
    cart-plus
    -
    cc
    -
    certificate
    -
    check
    -
    check-circle
    -
    check-circle-o
    -
    check-square
    -
    check-square-o
    -
    child
    -
    circle
    -
    circle-o
    -
    circle-o-notch
    -
    circle-thin
    -
    clock-o
    -
    clone
    -
    close (alias)
    -
    cloud
    -
    cloud-download
    -
    cloud-upload
    -
    code
    -
    code-fork
    -
    coffee
    -
    cog
    -
    cogs
    -
    comment
    -
    comment-o
    -
    commenting
    -
    commenting-o
    -
    comments
    -
    comments-o
    -
    compass
    -
    copyright
    -
    creative-commons
    -
    credit-card
    -
    credit-card-alt
    -
    crop
    -
    crosshairs
    -
    cube
    -
    cubes
    -
    cutlery
    -
    dashboard (alias)
    -
    database
    -
    deaf
    -
    deafness (alias)
    -
    desktop
    -
    diamond
    -
    dot-circle-o
    -
    download
    -
    drivers-license (alias)
    -
    drivers-license-o (alias)
    -
    edit (alias)
    -
    ellipsis-h
    -
    ellipsis-v
    -
    envelope
    -
    envelope-o
    -
    envelope-open
    -
    envelope-open-o
    -
    envelope-square
    -
    eraser
    -
    exchange
    -
    exclamation
    -
    exclamation-circle
    -
    exclamation-triangle
    -
    external-link
    -
    external-link-square
    -
    eye
    -
    eye-slash
    -
    eyedropper
    -
    fax
    -
    feed (alias)
    -
    female
    -
    fighter-jet
    -
    file-archive-o
    -
    file-audio-o
    -
    file-code-o
    -
    file-excel-o
    -
    file-image-o
    -
    file-movie-o (alias)
    -
    file-pdf-o
    -
    file-photo-o (alias)
    -
    file-picture-o (alias)
    -
    file-powerpoint-o
    -
    file-sound-o (alias)
    -
    file-video-o
    -
    file-word-o
    -
    file-zip-o (alias)
    -
    film
    -
    filter
    -
    fire
    -
    fire-extinguisher
    -
    flag
    -
    flag-checkered
    -
    flag-o
    -
    flash (alias)
    -
    flask
    -
    folder
    -
    folder-o
    -
    folder-open
    -
    folder-open-o
    -
    frown-o
    -
    futbol-o
    -
    gamepad
    -
    gavel
    -
    gear (alias)
    -
    gears (alias)
    -
    gift
    -
    glass
    -
    globe
    -
    graduation-cap
    -
    group (alias)
    -
    hand-grab-o (alias)
    -
    hand-lizard-o
    -
    hand-paper-o
    -
    hand-peace-o
    -
    hand-pointer-o
    -
    hand-rock-o
    -
    hand-scissors-o
    -
    hand-spock-o
    -
    hand-stop-o (alias)
    -
    handshake-o
    -
    hard-of-hearing (alias)
    -
    hashtag
    -
    hdd-o
    -
    headphones
    -
    heart
    -
    heart-o
    -
    heartbeat
    -
    history
    -
    home
    -
    hotel (alias)
    -
    hourglass
    -
    hourglass-1 (alias)
    -
    hourglass-2 (alias)
    -
    hourglass-3 (alias)
    -
    hourglass-end
    -
    hourglass-half
    -
    hourglass-o
    -
    hourglass-start
    -
    i-cursor
    -
    id-badge
    -
    id-card
    -
    id-card-o
    -
    image (alias)
    -
    inbox
    -
    industry
    -
    info
    -
    info-circle
    -
    institution (alias)
    -
    key
    -
    keyboard-o
    -
    language
    -
    laptop
    -
    leaf
    -
    legal (alias)
    -
    lemon-o
    -
    level-down
    -
    level-up
    -
    life-bouy (alias)
    -
    life-buoy (alias)
    -
    life-ring
    -
    life-saver (alias)
    -
    lightbulb-o
    -
    line-chart
    -
    location-arrow
    -
    lock
    -
    low-vision
    -
    magic
    -
    magnet
    -
    mail-forward (alias)
    -
    mail-reply (alias)
    -
    mail-reply-all (alias)
    -
    male
    -
    map
    -
    map-marker
    -
    map-o
    -
    map-pin
    -
    map-signs
    -
    meh-o
    -
    microchip
    -
    microphone
    -
    microphone-slash
    -
    minus
    -
    minus-circle
    -
    minus-square
    -
    minus-square-o
    -
    mobile
    -
    mobile-phone (alias)
    -
    money
    -
    moon-o
    -
    mortar-board (alias)
    -
    motorcycle
    -
    mouse-pointer
    -
    music
    -
    navicon (alias)
    -
    newspaper-o
    -
    object-group
    -
    object-ungroup
    -
    paint-brush
    -
    paper-plane
    -
    paper-plane-o
    -
    paw
    -
    pencil
    -
    pencil-square
    -
    pencil-square-o
    -
    percent
    -
    phone
    -
    phone-square
    -
    photo (alias)
    -
    picture-o
    -
    pie-chart
    -
    plane
    -
    plug
    -
    plus
    -
    plus-circle
    -
    plus-square
    -
    plus-square-o
    -
    podcast
    -
    power-off
    -
    print
    -
    puzzle-piece
    -
    qrcode
    -
    question
    -
    question-circle
    -
    question-circle-o
    -
    quote-left
    -
    quote-right
    -
    random
    -
    recycle
    -
    refresh
    -
    registered
    -
    remove (alias)
    -
    reorder (alias)
    -
    reply
    -
    reply-all
    -
    retweet
    -
    road
    -
    rocket
    -
    rss
    -
    rss-square
    -
    s15 (alias)
    -
    search
    -
    search-minus
    -
    search-plus
    -
    send (alias)
    -
    send-o (alias)
    -
    server
    -
    share
    -
    share-alt
    -
    share-alt-square
    -
    share-square
    -
    share-square-o
    -
    shield
    -
    ship
    -
    shopping-bag
    -
    shopping-basket
    -
    shopping-cart
    -
    shower
    -
    sign-in
    -
    sign-language
    -
    sign-out
    -
    signal
    -
    signing (alias)
    -
    sitemap
    -
    sliders
    -
    smile-o
    -
    snowflake-o
    -
    soccer-ball-o (alias)
    -
    sort
    -
    sort-alpha-asc
    -
    sort-alpha-desc
    -
    sort-amount-asc
    -
    sort-amount-desc
    -
    sort-asc
    -
    sort-desc
    -
    sort-down (alias)
    -
    sort-numeric-asc
    -
    sort-numeric-desc
    -
    sort-up (alias)
    -
    space-shuttle
    -
    spinner
    -
    spoon
    -
    square
    -
    square-o
    -
    star
    -
    star-half
    -
    star-half-empty (alias)
    -
    star-half-full (alias)
    -
    star-half-o
    -
    star-o
    -
    sticky-note
    -
    sticky-note-o
    -
    street-view
    -
    suitcase
    -
    sun-o
    -
    support (alias)
    -
    tablet
    -
    tachometer
    -
    tag
    -
    tags
    -
    tasks
    -
    taxi
    -
    television
    -
    terminal
    -
    thermometer (alias)
    -
    thermometer-0 (alias)
    -
    thermometer-1 (alias)
    -
    thermometer-2 (alias)
    -
    thermometer-3 (alias)
    -
    thermometer-4 (alias)
    -
    thermometer-empty
    -
    thermometer-full
    -
    thermometer-half
    -
    thermometer-quarter
    -
    thermometer-three-quarters
    -
    thumb-tack
    -
    thumbs-down
    -
    thumbs-o-down
    -
    thumbs-o-up
    -
    thumbs-up
    -
    ticket
    -
    times
    -
    times-circle
    -
    times-circle-o
    -
    times-rectangle (alias)
    -
    times-rectangle-o (alias)
    -
    tint
    -
    toggle-down (alias)
    -
    toggle-left (alias)
    -
    toggle-off
    -
    toggle-on
    -
    toggle-right (alias)
    -
    toggle-up (alias)
    -
    trademark
    -
    trash
    -
    trash-o
    -
    tree
    -
    trophy
    -
    truck
    -
    tty
    -
    tv (alias)
    -
    umbrella
    -
    universal-access
    -
    university
    -
    unlock
    -
    unlock-alt
    -
    unsorted (alias)
    -
    upload
    -
    user
    -
    user-circle
    -
    user-circle-o
    -
    user-o
    -
    user-plus
    -
    user-secret
    -
    user-times
    -
    users
    -
    vcard (alias)
    -
    vcard-o (alias)
    -
    video-camera
    -
    volume-control-phone
    -
    volume-down
    -
    volume-off
    -
    volume-up
    -
    warning (alias)
    -
    wheelchair
    -
    wheelchair-alt
    -
    wifi
    -
    window-close
    -
    window-close-o
    -
    window-maximize
    -
    window-minimize
    -
    window-restore
    -
    wrench
    -
    -
    -
    - -
    -
    american-sign-language-interpreting
    -
    asl-interpreting (alias)
    -
    assistive-listening-systems
    -
    audio-description
    -
    blind
    -
    braille
    -
    cc
    -
    deaf
    -
    deafness (alias)
    -
    hard-of-hearing (alias)
    -
    low-vision
    -
    question-circle-o
    -
    sign-language
    -
    signing (alias)
    -
    tty
    -
    universal-access
    -
    volume-control-phone
    -
    wheelchair
    -
    wheelchair-alt
    -
    -
    -
    - -
    -
    hand-grab-o (alias)
    -
    hand-lizard-o
    -
    hand-o-down
    -
    hand-o-left
    -
    hand-o-right
    -
    hand-o-up
    -
    hand-paper-o
    -
    hand-peace-o
    -
    hand-pointer-o
    -
    hand-rock-o
    -
    hand-scissors-o
    -
    hand-spock-o
    -
    hand-stop-o (alias)
    -
    thumbs-down
    -
    thumbs-o-down
    -
    thumbs-o-up
    -
    thumbs-up
    -
    -
    -
    - -
    -
    ambulance
    -
    automobile (alias)
    -
    bicycle
    -
    bus
    -
    cab (alias)
    -
    car
    -
    fighter-jet
    -
    motorcycle
    -
    plane
    -
    rocket
    -
    ship
    -
    space-shuttle
    -
    subway
    -
    taxi
    -
    train
    -
    truck
    -
    wheelchair
    -
    wheelchair-alt
    -
    -
    -
    - -
    -
    genderless
    -
    intersex (alias)
    -
    mars
    -
    mars-double
    -
    mars-stroke
    -
    mars-stroke-h
    -
    mars-stroke-v
    -
    mercury
    -
    neuter
    -
    transgender
    -
    transgender-alt
    -
    venus
    -
    venus-double
    -
    venus-mars
    -
    -
    -
    - -
    -
    file
    -
    file-archive-o
    -
    file-audio-o
    -
    file-code-o
    -
    file-excel-o
    -
    file-image-o
    -
    file-movie-o (alias)
    -
    file-o
    -
    file-pdf-o
    -
    file-photo-o (alias)
    -
    file-picture-o (alias)
    -
    file-powerpoint-o
    -
    file-sound-o (alias)
    -
    file-text
    -
    file-text-o
    -
    file-video-o
    -
    file-word-o
    -
    file-zip-o (alias)
    -
    -
    -
    - -
    -
      -
    • - 给这些图标加上 - fa-spin class,就可以表现出加载动画了 -
    • -
    -
    -
    -
    circle-o-notch
    -
    cog
    -
    gear (alias)
    -
    refresh
    -
    spinner
    -
    -
    -
    - -
    -
    check-square
    -
    check-square-o
    -
    circle
    -
    circle-o
    -
    dot-circle-o
    -
    minus-square
    -
    minus-square-o
    -
    plus-square
    -
    plus-square-o
    -
    square
    -
    square-o
    -
    -
    -
    - -
    -
    cc-amex
    -
    cc-diners-club
    -
    cc-discover
    -
    cc-jcb
    -
    cc-mastercard
    -
    cc-paypal
    -
    cc-stripe
    -
    cc-visa
    -
    credit-card
    -
    credit-card-alt
    -
    google-wallet
    -
    paypal
    -
    -
    -
    - -
    -
    area-chart
    -
    bar-chart
    -
    bar-chart-o (alias)
    -
    line-chart
    -
    pie-chart
    -
    -
    -
    - -
    -
    bitcoin (alias)
    -
    btc
    -
    cny (alias)
    -
    dollar (alias)
    -
    eur
    -
    euro (alias)
    -
    gbp
    -
    gg
    -
    gg-circle
    -
    ils
    -
    inr
    -
    jpy
    -
    krw
    -
    money
    -
    rmb (alias)
    -
    rouble (alias)
    -
    rub
    -
    ruble (alias)
    -
    rupee (alias)
    -
    shekel (alias)
    -
    sheqel (alias)
    -
    try
    -
    turkish-lira (alias)
    -
    usd
    -
    won (alias)
    -
    yen (alias)
    -
    -
    -
    - -
    -
    align-center
    -
    align-justify
    -
    align-left
    -
    align-right
    -
    bold
    -
    chain (alias)
    -
    chain-broken
    -
    clipboard
    -
    columns
    -
    copy (alias)
    -
    cut (alias)
    -
    dedent (alias)
    -
    eraser
    -
    file
    -
    file-o
    -
    file-text
    -
    file-text-o
    -
    files-o
    -
    floppy-o
    -
    font
    -
    header
    -
    indent
    -
    italic
    -
    link
    -
    list
    -
    list-alt
    -
    list-ol
    -
    list-ul
    -
    outdent
    -
    paperclip
    -
    paragraph
    -
    paste (alias)
    -
    repeat
    -
    rotate-left (alias)
    -
    rotate-right (alias)
    -
    save (alias)
    -
    scissors
    -
    strikethrough
    -
    subscript
    -
    superscript
    -
    table
    -
    text-height
    -
    text-width
    -
    th
    -
    th-large
    -
    th-list
    -
    underline
    -
    undo
    -
    unlink (alias)
    -
    -
    -
    - -
    -
    angle-double-down
    -
    angle-double-left
    -
    angle-double-right
    -
    angle-double-up
    -
    angle-down
    -
    angle-left
    -
    angle-right
    -
    angle-up
    -
    arrow-circle-down
    -
    arrow-circle-left
    -
    arrow-circle-o-down
    -
    arrow-circle-o-left
    -
    arrow-circle-o-right
    -
    arrow-circle-o-up
    -
    arrow-circle-right
    -
    arrow-circle-up
    -
    arrow-down
    -
    arrow-left
    -
    arrow-right
    -
    arrow-up
    -
    arrows
    -
    arrows-alt
    -
    arrows-h
    -
    arrows-v
    -
    caret-down
    -
    caret-left
    -
    caret-right
    -
    caret-square-o-down
    -
    caret-square-o-left
    -
    caret-square-o-right
    -
    caret-square-o-up
    -
    caret-up
    -
    chevron-circle-down
    -
    chevron-circle-left
    -
    chevron-circle-right
    -
    chevron-circle-up
    -
    chevron-down
    -
    chevron-left
    -
    chevron-right
    -
    chevron-up
    -
    exchange
    -
    hand-o-down
    -
    hand-o-left
    -
    hand-o-right
    -
    hand-o-up
    -
    long-arrow-down
    -
    long-arrow-left
    -
    long-arrow-right
    -
    long-arrow-up
    -
    toggle-down (alias)
    -
    toggle-left (alias)
    -
    toggle-right (alias)
    -
    toggle-up (alias)
    -
    -
    -
    - -
    -
    arrows-alt
    -
    backward
    -
    compress
    -
    eject
    -
    expand
    -
    fast-backward
    -
    fast-forward
    -
    forward
    -
    pause
    -
    pause-circle
    -
    pause-circle-o
    -
    play
    -
    play-circle
    -
    play-circle-o
    -
    random
    -
    step-backward
    -
    step-forward
    -
    stop
    -
    stop-circle
    -
    stop-circle-o
    -
    youtube-play
    -
    -
    -
    - -
    -
    500px
    -
    adn
    -
    amazon
    -
    android
    -
    angellist
    -
    apple
    -
    bandcamp
    -
    behance
    -
    behance-square
    -
    bitbucket
    -
    bitbucket-square
    -
    bitcoin (alias)
    -
    black-tie
    -
    bluetooth
    -
    bluetooth-b
    -
    btc
    -
    buysellads
    -
    cc-amex
    -
    cc-diners-club
    -
    cc-discover
    -
    cc-jcb
    -
    cc-mastercard
    -
    cc-paypal
    -
    cc-stripe
    -
    cc-visa
    -
    chrome
    -
    codepen
    -
    codiepie
    -
    connectdevelop
    -
    contao
    -
    css3
    -
    dashcube
    -
    delicious
    -
    deviantart
    -
    digg
    -
    dribbble
    -
    dropbox
    -
    drupal
    -
    edge
    -
    eercast
    -
    empire
    -
    envira
    -
    etsy
    -
    expeditedssl
    -
    fa (alias)
    -
    facebook
    -
    facebook-f (alias)
    -
    facebook-official
    -
    facebook-square
    -
    firefox
    -
    first-order
    -
    flickr
    -
    font-awesome
    -
    fonticons
    -
    fort-awesome
    -
    forumbee
    -
    foursquare
    -
    free-code-camp
    -
    ge (alias)
    -
    get-pocket
    -
    gg
    -
    gg-circle
    -
    git
    -
    git-square
    -
    github
    -
    github-alt
    -
    github-square
    -
    gitlab
    -
    gittip (alias)
    -
    glide
    -
    glide-g
    -
    google
    -
    google-plus
    -
    google-plus-circle (alias)
    -
    google-plus-official
    -
    google-plus-square
    -
    google-wallet
    -
    gratipay
    -
    grav
    -
    hacker-news
    -
    houzz
    -
    html5
    -
    imdb
    -
    instagram
    -
    internet-explorer
    -
    ioxhost
    -
    joomla
    -
    jsfiddle
    -
    lastfm
    -
    lastfm-square
    -
    leanpub
    -
    linkedin
    -
    linkedin-square
    -
    linode
    -
    linux
    -
    maxcdn
    -
    meanpath
    -
    medium
    -
    meetup
    -
    mixcloud
    -
    modx
    -
    odnoklassniki
    -
    odnoklassniki-square
    -
    opencart
    -
    openid
    -
    opera
    -
    optin-monster
    -
    pagelines
    -
    paypal
    -
    pied-piper
    -
    pied-piper-alt
    -
    pied-piper-pp
    -
    pinterest
    -
    pinterest-p
    -
    pinterest-square
    -
    product-hunt
    -
    qq
    -
    quora
    -
    ra (alias)
    -
    ravelry
    -
    rebel
    -
    reddit
    -
    reddit-alien
    -
    reddit-square
    -
    renren
    -
    resistance (alias)
    -
    safari
    -
    scribd
    -
    sellsy
    -
    share-alt
    -
    share-alt-square
    -
    shirtsinbulk
    -
    simplybuilt
    -
    skyatlas
    -
    skype
    -
    slack
    -
    slideshare
    -
    snapchat
    -
    snapchat-ghost
    -
    snapchat-square
    -
    soundcloud
    -
    spotify
    -
    stack-exchange
    -
    stack-overflow
    -
    steam
    -
    steam-square
    -
    stumbleupon
    -
    stumbleupon-circle
    -
    superpowers
    -
    telegram
    -
    tencent-weibo
    -
    themeisle
    -
    trello
    -
    tripadvisor
    -
    tumblr
    -
    tumblr-square
    -
    twitch
    -
    twitter
    -
    twitter-square
    -
    usb
    -
    viacoin
    -
    viadeo
    -
    viadeo-square
    -
    vimeo
    -
    vimeo-square
    -
    vine
    -
    vk
    -
    wechat (alias)
    -
    weibo
    -
    weixin
    -
    whatsapp
    -
    wikipedia-w
    -
    windows
    -
    wordpress
    -
    wpbeginner
    -
    wpexplorer
    -
    wpforms
    -
    xing
    -
    xing-square
    -
    y-combinator
    -
    y-combinator-square (alias)
    -
    yahoo
    -
    yc (alias)
    -
    yc-square (alias)
    -
    yelp
    -
    yoast
    -
    youtube
    -
    youtube-play
    -
    youtube-square
    -
    -
    -
    - -
    -
    ambulance
    -
    h-square
    -
    heart
    -
    heart-o
    -
    heartbeat
    -
    hospital-o
    -
    medkit
    -
    plus-square
    -
    stethoscope
    -
    user-md
    -
    wheelchair
    -
    wheelchair-alt
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/icon/glyphicons.html b/ruoyi-admin/src/main/resources/templates/demo/icon/glyphicons.html deleted file mode 100644 index fdeae0ba3..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/icon/glyphicons.html +++ /dev/null @@ -1,1364 +0,0 @@ - - - - - - -
    -
    -
    -
    -

    Glyphicons 字体图标

    包括250多个来自 Glyphicon Halflings 的字体图标。Glyphicons Halflings 一般是收费的,但是他们的作者允许 Bootstrap 免费使用。为了表示感谢,希望你在使用时尽量为 Glyphicons 添加一个友情链接。 -
    -
    -
    -
    -
    -
    所有图标 所有图标集合 - Glyphicons
    -
    - - - - - - - - - - -
    -
    -
    -
    -
      - -
    • - - glyphicon glyphicon-asterisk -
    • - -
    • - - glyphicon glyphicon-plus -
    • - -
    • - - glyphicon glyphicon-euro -
    • - -
    • - - glyphicon glyphicon-eur -
    • - -
    • - - glyphicon glyphicon-minus -
    • - -
    • - - glyphicon glyphicon-cloud -
    • - -
    • - - glyphicon glyphicon-envelope -
    • - -
    • - - glyphicon glyphicon-pencil -
    • - -
    • - - glyphicon glyphicon-glass -
    • - -
    • - - glyphicon glyphicon-music -
    • - -
    • - - glyphicon glyphicon-search -
    • - -
    • - - glyphicon glyphicon-heart -
    • - -
    • - - glyphicon glyphicon-star -
    • - -
    • - - glyphicon glyphicon-star-empty -
    • - -
    • - - glyphicon glyphicon-user -
    • - -
    • - - glyphicon glyphicon-film -
    • - -
    • - - glyphicon glyphicon-th-large -
    • - -
    • - - glyphicon glyphicon-th -
    • - -
    • - - glyphicon glyphicon-th-list -
    • - -
    • - - glyphicon glyphicon-ok -
    • - -
    • - - glyphicon glyphicon-remove -
    • - -
    • - - glyphicon glyphicon-zoom-in -
    • - -
    • - - glyphicon glyphicon-zoom-out -
    • - -
    • - - glyphicon glyphicon-off -
    • - -
    • - - glyphicon glyphicon-signal -
    • - -
    • - - glyphicon glyphicon-cog -
    • - -
    • - - glyphicon glyphicon-trash -
    • - -
    • - - glyphicon glyphicon-home -
    • - -
    • - - glyphicon glyphicon-file -
    • - -
    • - - glyphicon glyphicon-time -
    • - -
    • - - glyphicon glyphicon-road -
    • - -
    • - - glyphicon glyphicon-download-alt -
    • - -
    • - - glyphicon glyphicon-download -
    • - -
    • - - glyphicon glyphicon-upload -
    • - -
    • - - glyphicon glyphicon-inbox -
    • - -
    • - - glyphicon glyphicon-play-circle -
    • - -
    • - - glyphicon glyphicon-repeat -
    • - -
    • - - glyphicon glyphicon-refresh -
    • - -
    • - - glyphicon glyphicon-list-alt -
    • - -
    • - - glyphicon glyphicon-lock -
    • - -
    • - - glyphicon glyphicon-flag -
    • - -
    • - - glyphicon glyphicon-headphones -
    • - -
    • - - glyphicon glyphicon-volume-off -
    • - -
    • - - glyphicon glyphicon-volume-down -
    • - -
    • - - glyphicon glyphicon-volume-up -
    • - -
    • - - glyphicon glyphicon-qrcode -
    • - -
    • - - glyphicon glyphicon-barcode -
    • - -
    • - - glyphicon glyphicon-tag -
    • - -
    • - - glyphicon glyphicon-tags -
    • - -
    • - - glyphicon glyphicon-book -
    • - -
    • - - glyphicon glyphicon-bookmark -
    • - -
    • - - glyphicon glyphicon-print -
    • - -
    • - - glyphicon glyphicon-camera -
    • - -
    • - - glyphicon glyphicon-font -
    • - -
    • - - glyphicon glyphicon-bold -
    • - -
    • - - glyphicon glyphicon-italic -
    • - -
    • - - glyphicon glyphicon-text-height -
    • - -
    • - - glyphicon glyphicon-text-width -
    • - -
    • - - glyphicon glyphicon-align-left -
    • - -
    • - - glyphicon glyphicon-align-center -
    • - -
    • - - glyphicon glyphicon-align-right -
    • - -
    • - - glyphicon glyphicon-align-justify -
    • - -
    • - - glyphicon glyphicon-list -
    • - -
    • - - glyphicon glyphicon-indent-left -
    • - -
    • - - glyphicon glyphicon-indent-right -
    • - -
    • - - glyphicon glyphicon-facetime-video -
    • - -
    • - - glyphicon glyphicon-picture -
    • - -
    • - - glyphicon glyphicon-map-marker -
    • - -
    • - - glyphicon glyphicon-adjust -
    • - -
    • - - glyphicon glyphicon-tint -
    • - -
    • - - glyphicon glyphicon-edit -
    • - -
    • - - glyphicon glyphicon-share -
    • - -
    • - - glyphicon glyphicon-check -
    • - -
    • - - glyphicon glyphicon-move -
    • - -
    • - - glyphicon glyphicon-step-backward -
    • - -
    • - - glyphicon glyphicon-fast-backward -
    • - -
    • - - glyphicon glyphicon-backward -
    • - -
    • - - glyphicon glyphicon-play -
    • - -
    • - - glyphicon glyphicon-pause -
    • - -
    • - - glyphicon glyphicon-stop -
    • - -
    • - - glyphicon glyphicon-forward -
    • - -
    • - - glyphicon glyphicon-fast-forward -
    • - -
    • - - glyphicon glyphicon-step-forward -
    • - -
    • - - glyphicon glyphicon-eject -
    • - -
    • - - glyphicon glyphicon-chevron-left -
    • - -
    • - - glyphicon glyphicon-chevron-right -
    • - -
    • - - glyphicon glyphicon-plus-sign -
    • - -
    • - - glyphicon glyphicon-minus-sign -
    • - -
    • - - glyphicon glyphicon-remove-sign -
    • - -
    • - - glyphicon glyphicon-ok-sign -
    • - -
    • - - glyphicon glyphicon-question-sign -
    • - -
    • - - glyphicon glyphicon-info-sign -
    • - -
    • - - glyphicon glyphicon-screenshot -
    • - -
    • - - glyphicon glyphicon-remove-circle -
    • - -
    • - - glyphicon glyphicon-ok-circle -
    • - -
    • - - glyphicon glyphicon-ban-circle -
    • - -
    • - - glyphicon glyphicon-arrow-left -
    • - -
    • - - glyphicon glyphicon-arrow-right -
    • - -
    • - - glyphicon glyphicon-arrow-up -
    • - -
    • - - glyphicon glyphicon-arrow-down -
    • - -
    • - - glyphicon glyphicon-share-alt -
    • - -
    • - - glyphicon glyphicon-resize-full -
    • - -
    • - - glyphicon glyphicon-resize-small -
    • - -
    • - - glyphicon glyphicon-exclamation-sign -
    • - -
    • - - glyphicon glyphicon-gift -
    • - -
    • - - glyphicon glyphicon-leaf -
    • - -
    • - - glyphicon glyphicon-fire -
    • - -
    • - - glyphicon glyphicon-eye-open -
    • - -
    • - - glyphicon glyphicon-eye-close -
    • - -
    • - - glyphicon glyphicon-warning-sign -
    • - -
    • - - glyphicon glyphicon-plane -
    • - -
    • - - glyphicon glyphicon-calendar -
    • - -
    • - - glyphicon glyphicon-random -
    • - -
    • - - glyphicon glyphicon-comment -
    • - -
    • - - glyphicon glyphicon-magnet -
    • - -
    • - - glyphicon glyphicon-chevron-up -
    • - -
    • - - glyphicon glyphicon-chevron-down -
    • - -
    • - - glyphicon glyphicon-retweet -
    • - -
    • - - glyphicon glyphicon-shopping-cart -
    • - -
    • - - glyphicon glyphicon-folder-close -
    • - -
    • - - glyphicon glyphicon-folder-open -
    • - -
    • - - glyphicon glyphicon-resize-vertical -
    • - -
    • - - glyphicon glyphicon-resize-horizontal -
    • - -
    • - - glyphicon glyphicon-hdd -
    • - -
    • - - glyphicon glyphicon-bullhorn -
    • - -
    • - - glyphicon glyphicon-bell -
    • - -
    • - - glyphicon glyphicon-certificate -
    • - -
    • - - glyphicon glyphicon-thumbs-up -
    • - -
    • - - glyphicon glyphicon-thumbs-down -
    • - -
    • - - glyphicon glyphicon-hand-right -
    • - -
    • - - glyphicon glyphicon-hand-left -
    • - -
    • - - glyphicon glyphicon-hand-up -
    • - -
    • - - glyphicon glyphicon-hand-down -
    • - -
    • - - glyphicon glyphicon-circle-arrow-right -
    • - -
    • - - glyphicon glyphicon-circle-arrow-left -
    • - -
    • - - glyphicon glyphicon-circle-arrow-up -
    • - -
    • - - glyphicon glyphicon-circle-arrow-down -
    • - -
    • - - glyphicon glyphicon-globe -
    • - -
    • - - glyphicon glyphicon-wrench -
    • - -
    • - - glyphicon glyphicon-tasks -
    • - -
    • - - glyphicon glyphicon-filter -
    • - -
    • - - glyphicon glyphicon-briefcase -
    • - -
    • - - glyphicon glyphicon-fullscreen -
    • - -
    • - - glyphicon glyphicon-dashboard -
    • - -
    • - - glyphicon glyphicon-paperclip -
    • - -
    • - - glyphicon glyphicon-heart-empty -
    • - -
    • - - glyphicon glyphicon-link -
    • - -
    • - - glyphicon glyphicon-phone -
    • - -
    • - - glyphicon glyphicon-pushpin -
    • - -
    • - - glyphicon glyphicon-usd -
    • - -
    • - - glyphicon glyphicon-gbp -
    • - -
    • - - glyphicon glyphicon-sort -
    • - -
    • - - glyphicon glyphicon-sort-by-alphabet -
    • - -
    • - - glyphicon glyphicon-sort-by-alphabet-alt -
    • - -
    • - - glyphicon glyphicon-sort-by-order -
    • - -
    • - - glyphicon glyphicon-sort-by-order-alt -
    • - -
    • - - glyphicon glyphicon-sort-by-attributes -
    • - -
    • - - glyphicon glyphicon-sort-by-attributes-alt -
    • - -
    • - - glyphicon glyphicon-unchecked -
    • - -
    • - - glyphicon glyphicon-expand -
    • - -
    • - - glyphicon glyphicon-collapse-down -
    • - -
    • - - glyphicon glyphicon-collapse-up -
    • - -
    • - - glyphicon glyphicon-log-in -
    • - -
    • - - glyphicon glyphicon-flash -
    • - -
    • - - glyphicon glyphicon-log-out -
    • - -
    • - - glyphicon glyphicon-new-window -
    • - -
    • - - glyphicon glyphicon-record -
    • - -
    • - - glyphicon glyphicon-save -
    • - -
    • - - glyphicon glyphicon-open -
    • - -
    • - - glyphicon glyphicon-saved -
    • - -
    • - - glyphicon glyphicon-import -
    • - -
    • - - glyphicon glyphicon-export -
    • - -
    • - - glyphicon glyphicon-send -
    • - -
    • - - glyphicon glyphicon-floppy-disk -
    • - -
    • - - glyphicon glyphicon-floppy-saved -
    • - -
    • - - glyphicon glyphicon-floppy-remove -
    • - -
    • - - glyphicon glyphicon-floppy-save -
    • - -
    • - - glyphicon glyphicon-floppy-open -
    • - -
    • - - glyphicon glyphicon-credit-card -
    • - -
    • - - glyphicon glyphicon-transfer -
    • - -
    • - - glyphicon glyphicon-cutlery -
    • - -
    • - - glyphicon glyphicon-header -
    • - -
    • - - glyphicon glyphicon-compressed -
    • - -
    • - - glyphicon glyphicon-earphone -
    • - -
    • - - glyphicon glyphicon-phone-alt -
    • - -
    • - - glyphicon glyphicon-tower -
    • - -
    • - - glyphicon glyphicon-stats -
    • - -
    • - - glyphicon glyphicon-sd-video -
    • - -
    • - - glyphicon glyphicon-hd-video -
    • - -
    • - - glyphicon glyphicon-subtitles -
    • - -
    • - - glyphicon glyphicon-sound-stereo -
    • - -
    • - - glyphicon glyphicon-sound-dolby -
    • - -
    • - - glyphicon glyphicon-sound-5-1 -
    • - -
    • - - glyphicon glyphicon-sound-6-1 -
    • - -
    • - - glyphicon glyphicon-sound-7-1 -
    • - -
    • - - glyphicon glyphicon-copyright-mark -
    • - -
    • - - glyphicon glyphicon-registration-mark -
    • - -
    • - - glyphicon glyphicon-cloud-download -
    • - -
    • - - glyphicon glyphicon-cloud-upload -
    • - -
    • - - glyphicon glyphicon-tree-conifer -
    • - -
    • - - glyphicon glyphicon-tree-deciduous -
    • - -
    • - - glyphicon glyphicon-cd -
    • - -
    • - - glyphicon glyphicon-save-file -
    • - -
    • - - glyphicon glyphicon-open-file -
    • - -
    • - - glyphicon glyphicon-level-up -
    • - -
    • - - glyphicon glyphicon-copy -
    • - -
    • - - glyphicon glyphicon-paste -
    • - -
    • - - glyphicon glyphicon-alert -
    • - -
    • - - glyphicon glyphicon-equalizer -
    • - -
    • - - glyphicon glyphicon-king -
    • - -
    • - - glyphicon glyphicon-queen -
    • - -
    • - - glyphicon glyphicon-pawn -
    • - -
    • - - glyphicon glyphicon-bishop -
    • - -
    • - - glyphicon glyphicon-knight -
    • - -
    • - - glyphicon glyphicon-baby-formula -
    • - -
    • - - glyphicon glyphicon-tent -
    • - -
    • - - glyphicon glyphicon-blackboard -
    • - -
    • - - glyphicon glyphicon-bed -
    • - -
    • - - glyphicon glyphicon-apple -
    • - -
    • - - glyphicon glyphicon-erase -
    • - -
    • - - glyphicon glyphicon-hourglass -
    • - -
    • - - glyphicon glyphicon-lamp -
    • - -
    • - - glyphicon glyphicon-duplicate -
    • - -
    • - - glyphicon glyphicon-piggy-bank -
    • - -
    • - - glyphicon glyphicon-scissors -
    • - -
    • - - glyphicon glyphicon-bitcoin -
    • - -
    • - - glyphicon glyphicon-btc -
    • - -
    • - - glyphicon glyphicon-xbt -
    • - -
    • - - glyphicon glyphicon-yen -
    • - -
    • - - glyphicon glyphicon-jpy -
    • - -
    • - - glyphicon glyphicon-ruble -
    • - -
    • - - glyphicon glyphicon-rub -
    • - -
    • - - glyphicon glyphicon-scale -
    • - -
    • - - glyphicon glyphicon-ice-lolly -
    • - -
    • - - glyphicon glyphicon-ice-lolly-tasted -
    • - -
    • - - glyphicon glyphicon-education -
    • - -
    • - - glyphicon glyphicon-option-horizontal -
    • - -
    • - - glyphicon glyphicon-option-vertical -
    • - -
    • - - glyphicon glyphicon-menu-hamburger -
    • - -
    • - - glyphicon glyphicon-modal-window -
    • - -
    • - - glyphicon glyphicon-oil -
    • - -
    • - - glyphicon glyphicon-grain -
    • - -
    • - - glyphicon glyphicon-sunglasses -
    • - -
    • - - glyphicon glyphicon-text-size -
    • - -
    • - - glyphicon glyphicon-text-color -
    • - -
    • - - glyphicon glyphicon-text-background -
    • - -
    • - - glyphicon glyphicon-object-align-top -
    • - -
    • - - glyphicon glyphicon-object-align-bottom -
    • - -
    • - - glyphicon glyphicon-object-align-horizontal -
    • - -
    • - - glyphicon glyphicon-object-align-left -
    • - -
    • - - glyphicon glyphicon-object-align-vertical -
    • - -
    • - - glyphicon glyphicon-object-align-right -
    • - -
    • - - glyphicon glyphicon-triangle-right -
    • - -
    • - - glyphicon glyphicon-triangle-left -
    • - -
    • - - glyphicon glyphicon-triangle-bottom -
    • - -
    • - - glyphicon glyphicon-triangle-top -
    • - -
    • - - glyphicon glyphicon-console -
    • - -
    • - - glyphicon glyphicon-superscript -
    • - -
    • - - glyphicon glyphicon-subscript -
    • - -
    • - - glyphicon glyphicon-menu-left -
    • - -
    • - - glyphicon glyphicon-menu-right -
    • - -
    • - - glyphicon glyphicon-menu-down -
    • - -
    • - - glyphicon glyphicon-menu-up -
    • - -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/dialog.html b/ruoyi-admin/src/main/resources/templates/demo/modal/dialog.html deleted file mode 100644 index 6cbad431f..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/dialog.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    模态窗口
    - -
    -
    -

    创建自定义的RuoYi模态窗口可通过添加.inmodal类来实现。

    -
    - -
    - - -
    -
    -
    -
    -
    大小设置
    - -
    -
    -

    模态窗口提供两种大小尺寸,可以通过为模态窗口的.modal-dialog添加类来实现

    - -
    - - -
    - - - -
    -
    -
    -
    -
    -
    -
    动画窗口
    - -
    -
    -

    您可以通过为模态窗口的.modal-content添加类来实现动画效果

    - - - - - - - -
    -
    -
    -
    -
    设置选项
    - -
    -
    -

    可以通过数据绑定或者Javascript来实现模态窗口的相关功能,如果使用数据绑定,可以为元素添加data-,如data-backdrop=""

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    名称类型默认值说明
    backdropboolean 或 string 'static'true遮罩层,或使用'static'指定遮罩层与关闭模态窗口不关联
    keyboardbooleantrue按Esc键时退出模态窗口
    showbooleantrue初始化完成后显示模态窗口
    remotepathfalse -

    推荐使用数据绑定方式,或使用 - jQuery.load

    -

    远程URL示例:

    -
    -
    <a data-toggle="modal" href="remote.html" data-target="#modal">Click me</a>
    -
    -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/form.html b/ruoyi-admin/src/main/resources/templates/demo/modal/form.html deleted file mode 100644 index f9c749d65..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/form.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/layer.html b/ruoyi-admin/src/main/resources/templates/demo/modal/layer.html deleted file mode 100644 index 1dc924fa6..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/layer.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    信息框
    -
    -
    -

    通过调用$.modal.alert()实现。

    - - - - -
    -
    -
    - -
    -
    -
    -
    提示框
    -
    -
    -

    通过调用$.modal.msg()实现。

    - - - - -
    -
    -
    -
    - -
    -
    -
    -
    -
    询问框
    -
    -
    -

    通过调用$.modal.confirm()实现。

    - -
    -
    -
    - -
    -
    -
    -
    消息提示并刷新父窗体
    -
    -
    -

    通过调用$.modal.msgReload()实现。

    - -
    -
    -
    - -
    -
    -
    -
    普通弹出层
    -
    -
    -

    通过调用$.modal.open()实现。

    - - - - - -
    -
    -
    - -
    -
    -
    -
    选卡页方式
    -
    -
    -

    通过调用$.modal.openTab()实现。

    - - - - -
    -
    -
    - -
    -
    -
    -
    其他内容
    -
    -
    -

    通过调用layer实现。

    - - - - -
    -
    -
    - -
    -
    -
    -
    遮罩层
    -
    -
    -

    通过调用blockUI实现。

    - - - -
    -
    -
    - -
    -
    -
    - - -
    -
    - -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table.html deleted file mode 100644 index f573615d0..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    弹层框
    -
    -
    -

    弹出复选框表格及单选框表格(点击提交后得到数据)。

    - - -
    -
    -
    -
    -
    -
    -
    弹层框
    -
    -
    -

    弹出层,点击提交后得到数据并回显到父窗体。

    - - - -

    -
    -
    -
    -
    -
    -
    -
    弹层框
    -
    -
    -

    多层弹出,点击提交后得到数据并回显到父窗体。

    - -

    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html deleted file mode 100644 index 61599fe7c..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/check.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame1.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame1.html deleted file mode 100644 index af5fe62dd..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame1.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    - -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame2.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame2.html deleted file mode 100644 index b4940fefb..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/frame2.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html deleted file mode 100644 index c1fa36b99..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html deleted file mode 100644 index 832c79de2..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/radio.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/add.html b/ruoyi-admin/src/main/resources/templates/demo/operate/add.html deleted file mode 100644 index e1cf566ec..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/add.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/detail.html b/ruoyi-admin/src/main/resources/templates/demo/operate/detail.html deleted file mode 100644 index ca302663d..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/detail.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/edit.html b/ruoyi-admin/src/main/resources/templates/demo/operate/edit.html deleted file mode 100644 index 2e6adc073..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/edit.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/other.html b/ruoyi-admin/src/main/resources/templates/demo/operate/other.html deleted file mode 100644 index 19da6b355..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/other.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -   -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -   -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/operate/table.html b/ruoyi-admin/src/main/resources/templates/demo/operate/table.html deleted file mode 100644 index 04dcb7d47..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/operate/table.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html b/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html deleted file mode 100644 index 799800bde..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/report/echarts.html +++ /dev/null @@ -1,1264 +0,0 @@ - - - - - - -
    -
    -

    ECharts开源来自百度商业前端数据可视化团队,基于html5 Canvas,是一个纯Javascript图表库,提供直观,生动,可交互,可个性化定制的数据可视化图表。创新的拖拽重计算、数据视图、值域漫游等特性大大增强了用户体验,赋予了用户对数据进行挖掘、整合的能力。 了解更多 -

    -

    ECharts官网:https://echarts.apache.org/ -

    - -
    -
    -
    -
    -
    -
    -
    -
    折线图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    柱状图
    -
    - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    散点图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    K线图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    饼状图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    雷达图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    仪表盘
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    漏斗图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    中国地图
    -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html b/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html deleted file mode 100644 index 6493eed7a..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/report/metrics.html +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    Q1 销量
    -

    - 上升 -

    - 更新时间:12天以前 -
    -
    -
    -
    -
    -
    -
    Q2 销量
    -

    - 上升 -

    - 更新时间:12天以前 -
    -
    -
    -
    -
    -
    -
    Q3 销量
    -

    - 下降 -

    - 更新时间:12天以前 -
    -
    -
    -
    -
    -
    -
    Q4 销量
    -

    - 下降 -

    - 更新时间:12天以前 -
    -
    -
    - -
    -
    -
    -
    -
    -
    本日访问量
    -

    198 009

    -
    -
    -
    -
    -
    -
    -
    -
    本周访问量
    -

    65 000

    -
    -
    -
    -
    -
    -
    -
    -
    本月访问量
    -

    680 900

    -
    -
    -
    -
    -
    -
    -
    -
    平均停留时间
    -

    00:06:40

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    使用率
    -

    65%

    -
    -
    -
    - -
    4:32更新
    -
    -
    -
    - -
    -
    -
    -
    使用率
    -

    50%

    -
    -
    -
    - -
    4:32更新
    -
    -
    -
    - -
    -
    -
    -
    使用率
    -

    14%

    -
    -
    -
    - -
    4:32更新
    -
    -
    -
    - -
    -
    -
    -
    使用率
    -

    20%

    -
    -
    -
    - -
    4:32更新
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    百分比
    -

    42/20

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    百分比
    -

    100/54

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    百分比
    -

    685/211

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    百分比
    -

    240/32

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    收入
    -

    886,200

    -
    98%
    - 总收入 -
    -
    -
    -
    -
    -
    -
    本月收入
    -

    1 738,200

    -
    98%
    - 总收入 -
    -
    -
    -
    -
    -
    -
    本日收入
    -

    -200,100

    -
    12%
    - 总收入 -
    -
    -
    -
    -
    -
    -
    搜索有收入
    -

    54,200

    -
    24%
    - 总收入 -
    -
    -
    -
    -
    -
    -
    -
    -
    预警
    - - - - - - - - - - - - - - - -
    - - - 示例 01 -
    - - - 示例 02 -
    - - - 示例 03 -
    -
    -
    -
    -
    -
    -
    -
    项目
    - - - - - - - - - - - - - - - -
    - - - 示例 01 -
    - - - 示例 02 -
    - - - 示例 03 -
    -
    -
    -
    -
    -
    -
    -
    消息
    - - - - - - - - - - - - - - - -
    - - - 示例 01 -
    - - - 示例 02 -
    - - - 示例 03 -
    -
    -
    -
    -
    -
    -
    -
    通知
    - - - - - - - - - - - - - - - -
    - - - 示例 01 -
    - - - 示例 02 -
    - - - 示例 03 -
    -
    -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/peity.html b/ruoyi-admin/src/main/resources/templates/demo/report/peity.html deleted file mode 100644 index 4ebbc17c8..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/report/peity.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - -
    - -
    -
    -
    -

    Peity图表

    -

    是一个内嵌数据图形可视化的图表库

    -

    了解 Peity -

    -
    -
    -
    -
    -
    -
    饼状图 自定义颜色
    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    图表代码
    - 1/5 - - <span class="pie">1/5</span> -
    - 226/360 - - <span class="pie">226/360</span> -
    - 0.52/1.561 - - <span class="pie">0.52/1.561</span> -
    - 1,4 - - <span class="pie">1,4</span> -
    - 226,134 - - <span class="pie">226,134</span> -
    - 0.52,1.041 - - <span class="pie">0.52,1.041</span> -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    线性图
    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    图表代码
    - 5,3,9,6,5,9,7,3,5,2,5,3,9,6,5,9,7,3,5,2 - - <span class="line">5,3,9,6,5,9,7,3,5,2</span> -
    - 5,3,9,6,5,9,7,3,5,2 - - <span class="line">5,3,9,6,5,9,7,3,5,2</span> -
    - 5,3,2,-1,-3,-2,2,3,5,2 - - <span class="line">5,3,2,-1,-3,-2,2,3,5,2</span> -
    - 0,-3,-6,-4,-5,-4,-7,-3,-5,-2 - - <span class="line">0,-3,-6,-4,-5,-4,-7,-3,-5,-2</span> -
    - 5,3,9,6,5,9,7,3,5,2 - - <span class="bar">5,3,9,6,5,9,7,3,5,2</span> -
    - 5,3,2,-1,-3,-2,2,3,5,2 - - <span class="bar">5,3,2,-1,-3,-2,2,3,5,2</span> -
    -
    -
    -
    - -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html b/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html deleted file mode 100644 index 401900b18..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/report/sparkline.html +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - -
    - -
    -
    -
    -

    Sparkline

    -

    这是另一个可视化图表库

    -

    了解 Sparkline -

    -
    -
    -
    -
    -
    -
    Sparkline图表 自定义颜色
    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    图表类型
    - - - 内联线性图 -
    - - - 柱状图 -
    - - - 饼状图 -
    - - - 长线性图 -
    - - - 三态图 -
    - - - 散点图 -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    自定义饼状图尺寸
    -
    - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    自定义柱状图尺寸
    -
    - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    自定义线性图尺寸
    -
    - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/asynTree.html b/ruoyi-admin/src/main/resources/templates/demo/table/asynTree.html deleted file mode 100644 index 90e71f8e6..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/asynTree.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/button.html b/ruoyi-admin/src/main/resources/templates/demo/table/button.html deleted file mode 100644 index bfc23af5a..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/button.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/child.html b/ruoyi-admin/src/main/resources/templates/demo/table/child.html deleted file mode 100644 index 44448bac5..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/child.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/curd.html b/ruoyi-admin/src/main/resources/templates/demo/table/curd.html deleted file mode 100644 index ee7617729..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/curd.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/customView.html b/ruoyi-admin/src/main/resources/templates/demo/table/customView.html deleted file mode 100644 index 70111d85b..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/customView.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - -
    -
    -
    - -
    -
    -
    -
    - - - -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/data.html b/ruoyi-admin/src/main/resources/templates/demo/table/data.html deleted file mode 100644 index 50a9d0c46..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/data.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/detail.html b/ruoyi-admin/src/main/resources/templates/demo/table/detail.html deleted file mode 100644 index d0031db62..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/detail.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/dynamicColumns.html b/ruoyi-admin/src/main/resources/templates/demo/table/dynamicColumns.html deleted file mode 100644 index 392b95248..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/dynamicColumns.html +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 要增加的列: - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/editable.html b/ruoyi-admin/src/main/resources/templates/demo/table/editable.html deleted file mode 100644 index 7a25782dc..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/editable.html +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/event.html b/ruoyi-admin/src/main/resources/templates/demo/table/event.html deleted file mode 100644 index bafc455b0..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/event.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - -
    -
    -
    -

    自定义触发事件(点击某行/双击某行/单击某格/双击某格/服务器发送数据前触发/数据被加载时触发)

    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/export.html b/ruoyi-admin/src/main/resources/templates/demo/table/export.html deleted file mode 100644 index 65cb3bf2c..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/export.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html b/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html deleted file mode 100644 index 657bb8357..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/exportSelected.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    - 勾选数据导出指定列,否则为全部 - - 导出 - -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html b/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html deleted file mode 100644 index c93622a7b..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/fixedColumns.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/footer.html b/ruoyi-admin/src/main/resources/templates/demo/table/footer.html deleted file mode 100644 index 3aaed27e0..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/footer.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html b/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html deleted file mode 100644 index a152dfb4f..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/groupHeader.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/headerStyle.html b/ruoyi-admin/src/main/resources/templates/demo/table/headerStyle.html deleted file mode 100644 index 0af7a0249..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/headerStyle.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/image.html b/ruoyi-admin/src/main/resources/templates/demo/table/image.html deleted file mode 100644 index 9a34e86bb..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/image.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/multi.html b/ruoyi-admin/src/main/resources/templates/demo/table/multi.html deleted file mode 100644 index 949077714..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/multi.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    - - -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/other.html b/ruoyi-admin/src/main/resources/templates/demo/table/other.html deleted file mode 100644 index b0a6e9cce..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/other.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html b/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html deleted file mode 100644 index 7f3d59701..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/pageGo.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/params.html b/ruoyi-admin/src/main/resources/templates/demo/table/params.html deleted file mode 100644 index 30b12572e..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/params.html +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - -
    -
    -
    -

    通过queryParams方法设置

    -
    -
    - -
    -
    -
    -
      -
    • - 用户姓名: -
    • -
    -
    -
    -
    -
    -

    通过form自动填充

    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/print.html b/ruoyi-admin/src/main/resources/templates/demo/table/print.html deleted file mode 100644 index 8695376ad..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/print.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html b/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html deleted file mode 100644 index 44fbb8878..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/refresh.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/remember.html b/ruoyi-admin/src/main/resources/templates/demo/table/remember.html deleted file mode 100644 index 1fff9a3f2..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/remember.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - -
    - -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/reorderColumns.html b/ruoyi-admin/src/main/resources/templates/demo/table/reorderColumns.html deleted file mode 100644 index 8e15f2e53..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/reorderColumns.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - -
    - -
    -
    -

    按住表格列拖拽

    -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/reorderRows.html b/ruoyi-admin/src/main/resources/templates/demo/table/reorderRows.html deleted file mode 100644 index ded9ecec9..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/reorderRows.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - -
    - -
    -
    -

    按住表格行拖拽

    -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/resizable.html b/ruoyi-admin/src/main/resources/templates/demo/table/resizable.html deleted file mode 100644 index 680cfdd8e..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/resizable.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/search.html b/ruoyi-admin/src/main/resources/templates/demo/table/search.html deleted file mode 100644 index 553cf71de..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/search.html +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - -
    -
    -
    -

    普通条件查询

    -
    -
    -
      -
    • - 商户编号: -
    • -
    • - 终端编号: -
    • -
    • - 处理状态: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - -
    -

    时间条件查询

    -
    -
    -
      -
    • - 商户编号: -
    • -
    • - 终端编号: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - -
    -

    多级联动下拉查询

    -
    -
    -
      -
    • - 商户编号: -
    • -
    • - 充值类型: -
    • -
    • - 充值路由: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - -
    -

    下拉多选条件查询

    -
    -
    -
      -
    • - 商户编号: -
    • -
    • - 终端编号: -
    • -
    • - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - -
    -

    复杂条件查询

    -
    -
    -
      -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    • - - -
    • -
    • - - - - - -
    • - -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    -
    -
    - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html b/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html deleted file mode 100644 index 99330d762..000000000 --- a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html +++ /dev/null @@ -1,242 +0,0 @@ - - - - - - - - -
    -
    -

    客户信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -

    商品数据

    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -   - -
    -
    - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/error/404.html b/ruoyi-admin/src/main/resources/templates/error/404.html deleted file mode 100644 index cbf1968f9..000000000 --- a/ruoyi-admin/src/main/resources/templates/error/404.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - RuoYi - 404 - - - - - -
    -

    404

    -

    找不到网页!

    -
    - 对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。 - 主页 -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/error/500.html b/ruoyi-admin/src/main/resources/templates/error/500.html deleted file mode 100644 index fbcefd0d0..000000000 --- a/ruoyi-admin/src/main/resources/templates/error/500.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - RuoYi - 500 - - - - - -
    -

    500

    -

    内部服务器错误!

    - -
    - 服务器遇到意外事件,不允许完成请求。我们抱歉。您可以返回主页面。 - 主页 -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/error/service.html b/ruoyi-admin/src/main/resources/templates/error/service.html deleted file mode 100644 index b64341d3f..000000000 --- a/ruoyi-admin/src/main/resources/templates/error/service.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - RuoYi - 500 - - - - - -
    -

    操作异常!

    - -
    - [[${errorMessage}]] -
    -
    - - diff --git a/ruoyi-admin/src/main/resources/templates/error/unauth.html b/ruoyi-admin/src/main/resources/templates/error/unauth.html deleted file mode 100644 index 64c8de8fe..000000000 --- a/ruoyi-admin/src/main/resources/templates/error/unauth.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - RuoYi - 403 - - - - - -
    -

    403

    -

    您没有访问权限!

    - -
    - 对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面 - 返回主页 -
    -
    - - - diff --git a/ruoyi-admin/src/main/resources/templates/include.html b/ruoyi-admin/src/main/resources/templates/include.html deleted file mode 100644 index 7a600944c..000000000 --- a/ruoyi-admin/src/main/resources/templates/include.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    -
    - -
    - - -
    - - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - - -
    - -
    -
    - - -
    - - -
    - - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    diff --git a/ruoyi-admin/src/main/resources/templates/index-topnav.html b/ruoyi-admin/src/main/resources/templates/index-topnav.html deleted file mode 100644 index 2d99720de..000000000 --- a/ruoyi-admin/src/main/resources/templates/index-topnav.html +++ /dev/null @@ -1,447 +0,0 @@ - - - - - - - 若依系统首页 - - - - - - - - - - - - - -
    - - - - - - -
    - -
    - - - - 刷新 -
    - - - -
    - -
    - - -
    - -
    - - - - - - - - - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html deleted file mode 100644 index 22377fd7b..000000000 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ /dev/null @@ -1,381 +0,0 @@ - - - - - - - 若依系统首页 - - - - - - - - - - - - -
    - - - - - - -
    - -
    - - - - 刷新 -
    - - - -
    - -
    - - -
    - -
    - - - - - - - - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/lock.html b/ruoyi-admin/src/main/resources/templates/lock.html deleted file mode 100644 index 3700ec452..000000000 --- a/ruoyi-admin/src/main/resources/templates/lock.html +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - 锁定屏幕 - - - - - - -
    -
    -
    [[ ${user.loginName} ]] / [[${#strings.defaultString(user.userName, '-')}]]
    - -
    -
    - User Image -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    系统锁屏,请输入密码登录!
    - -
    - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html deleted file mode 100644 index 6614e55a4..000000000 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - 登录若依系统 - - - - - - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -

    登录:

    -

    你若不离不弃,我必生死相依

    - - -
    -
    - -
    -
    - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/main.html b/ruoyi-admin/src/main/resources/templates/main.html deleted file mode 100644 index 4f26eb75a..000000000 --- a/ruoyi-admin/src/main/resources/templates/main.html +++ /dev/null @@ -1,1712 +0,0 @@ - - - - - - - 若依介绍 - - - - - - - -
    -
    -
    - 领取阿里云通用云产品1888优惠券 -
    https://www.aliyun.com/minisite/goods?userCode=brki8iof
    - 领取腾讯云通用云产品2860优惠券 -
    https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console
    - 阿里云服务器折扣区 ☛☛点我进入☚☚     腾讯云服务器秒杀区 ☛☛点我进入☚☚
    -

    云产品通用红包,可叠加官网常规优惠使用。(仅限新用户)

    -
    - -
    -
    -
    -

    Hello,Guest

    - 移动设备访问请扫描以下二维码: -
    -
    - -
    -
    -
    -

    若依后台管理框架

    -

    一直想做一款后台管理系统,看了很多优秀的开源项目但是发现没有合适自己的。于是利用空闲休息时间开始自己写一套后台系统。如此有了若依管理系统。,她可以用于所有的Web应用程序,如网站管理后台网站会员中心CMSCRMOA等等,当然,您也可以对她进行深度定制,以做出更强系统。所有前端后台代码封装过后十分精简易上手,出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。

    -

    - 当前版本:v[[${version}]] -

    -

    - ¥免费开源 -

    -
    -

    - - 访问码云 - - - 访问主页 - -

    -
    -
    -

    技术选型:

    -
      -
    1. 核心框架:Spring Boot。
    2. -
    3. 安全框架:Apache Shiro。
    4. -
    5. 模板引擎:Thymeleaf。
    6. -
    7. 持久层框架:MyBatis。
    8. -
    9. 定时任务:Quartz。
    10. -
    11. 数据库连接池:Druid。
    12. -
    13. 工具类:Fastjson。
    14. -
    15. 更多……
    16. -
    -
    - -
    -
    -
    -
    - -
    -
    -
    联系信息
    - -
    -
    -

    官网:http://www.ruoyi.vip -

    -

    QQ群:满1389287 满1679294 满1529866 满1772718 满1366522 满1382251 满1145125 满86752435 满134072510 满210336300 满339522636 满130035985 满143151071 满158781320 满201531282 满101526938 满264355400 满298522656 满139845794 满185760789 满175104288 174942938 -

    -

    微信:/ *若依 -

    -

    支付宝:/ *若依 -

    -
    -
    -
    -
    -
    -
    -
    更新日志
    -
    -
    -
    -
    -
    -
    -
    - v4.7.82023.11.23 -
    -
    -
    -
    -
      -
    1. 用户列表新增抽屉效果详细信息
    2. -
    3. 操作日志列表新增IP地址查询
    4. -
    5. 定时任务新增页去除状态选项
    6. -
    7. 系统管理角色列表显示数据权限
    8. -
    9. 通用排序属性orderBy参数限制长度
    10. -
    11. 新增isScrollToTop页签切换滚动到顶部
    12. -
    13. Excel自定义数据处理器增加单元格/工作簿对象
    14. -
    15. 新增表格参数(数据值为空时显示的内容undefinedText)
    16. -
    17. 升级oshi到最新版本6.4.7
    18. -
    19. 升级shiro到最新版本1.13.0
    20. -
    21. 升级druid到最新版本1.2.20
    22. -
    23. 升级pagehelper到最新版1.4.7
    24. -
    25. 升级spring-boot到最新版本2.5.15
    26. -
    27. 升级jquery到最新版v3.7.1
    28. -
    29. 升级layer到最新版本v3.7.0
    30. -
    31. 升级layui到最新版本v2.8.18
    32. -
    33. 升级x-editable到最新版本1.5.3
    34. -
    35. 修复自定义字典样式不生效的问题
    36. -
    37. 修复弹窗按钮启用禁用方法无效问题
    38. -
    39. 修复横向菜单关闭最后一个页签状态问题
    40. -
    41. 修复Excel导入数据临时文件无法删除问题
    42. -
    43. 修复表格行内编辑启用翻页记住选择无效问题
    44. -
    45. 修复Excels导入时无法获取到dictType字典值问题
    46. -
    47. 优化重置密码鼠标按下显示密码
    48. -
    49. 优化参数键值文本框改为文本域
    50. -
    51. 优化表格重置默认返回到第一页
    52. -
    53. 优化菜单管理类型为按钮状态可选
    54. -
    55. 优化数字金额大写转换精度丢失问题
    56. -
    57. 优化树表查询无数据时清除分页信息
    58. -
    59. 优化通用detail详细信息弹窗不显示按钮
    60. -
    61. 其他细节优化
    62. -
    -
    -
    -
    -
    -
    -
    - v4.7.72023.04.14 -
    -
    -
    -
    -
      -
    1. 操作日志新增消耗时间属性
    2. -
    3. 日志管理使用索引提升查询性能
    4. -
    5. 日志注解支持排除指定的请求参数
    6. -
    7. 新增监控页面图标显示
    8. -
    9. 新增支持登录IP黑名单限制
    10. -
    11. 更新fontawesome图标示例
    12. -
    13. 屏蔽定时任务bean违规的字符
    14. -
    15. 支持自定义隐藏属性列过滤子对象
    16. -
    17. 连接池Druid支持新的配置connectTimeout和socketTimeout
    18. -
    19. 升级jquery到最新版v3.6.3
    20. -
    21. 升级layui到最新版本2.7.6
    22. -
    23. 升级jasny-bootstrap到最新版4.0.0
    24. -
    25. 升级oshi到最新版本6.4.1
    26. -
    27. 升级druid到最新版本1.2.16
    28. -
    29. 修复异步表格树子项排序问题
    30. -
    31. 修复冻结列不支持IE浏览器的问题
    32. -
    33. 修复主子表使用suggest插件无法新增问题
    34. -
    35. 修复菜单栏快速点击导致展开折叠样式问题
    36. -
    37. 修复用户多角色数据权限可能出现权限抬升的情况
    38. -
    39. 修复异步加载表格树重置列表父节点展开异常问题
    40. -
    41. 修复页签属性refresh为undefined时页面被刷新问题
    42. -
    43. 移除apache/commons-fileupload依赖
    44. -
    45. 优化前端属性提醒说明
    46. -
    47. 优化用户导入更新时需获取用户编号问题
    48. -
    49. 优化主子表根据序号删除方法加入表格ID参数
    50. -
    51. 优化导出Excel时设置dictType属性重复查缓存问题
    52. -
    53. 优化在线用户服务缓存改为从Bean容器获取不使用自动装配
    54. -
    55. 优化表格示例行拖拽后列表底部总记录条数变成了undefined问题
    56. -
    57. 其他细节优化
    58. -
    -
    -
    -
    -
    -
    -
    - v4.7.62022.12.16 -
    -
    -
    -
    -
      -
    1. 定时任务违规的字符
    2. -
    3. 忽略不必要的属性数据返回
    4. -
    5. 导入更新用户数据前校验数据权限
    6. -
    7. 修改参数键名时移除前缓存配置
    8. -
    9. 修改用户登录账号进行重复验证
    10. -
    11. 兼容Excel下拉框内容过多无法显示
    12. -
    13. 升级oshi到最新版本6.4.0
    14. -
    15. 升级kaptcha到最新版2.3.3
    16. -
    17. 升级druid到最新版本1.2.15
    18. -
    19. 升级shiro到最新版本1.10.1
    20. -
    21. 升级pagehelper到最新版1.4.6
    22. -
    23. 升级bootstrap-fileinput到最新版本5.5.2
    24. -
    25. 修复sheet超出最大行数异常问题
    26. -
    27. 修复关闭父页签后提交无法跳转的问题
    28. -
    29. 修复操作日志类型多选导出不生效问题
    30. -
    31. 修复导出包含空子列表数据异常的问题
    32. -
    33. 优化树形表格层级显示
    34. -
    35. 优化SQL关键字检查防止注入
    36. -
    37. 优化用户管理重置时取消部门选择
    38. -
    39. 优化代码生成同步后字典值NULL问题
    40. -
    41. 优化导出对象的子列表为空会出现[]问题
    42. -
    43. 优化select2搜索下拉后校验必填样式问题
    44. -
    45. 其他细节优化
    46. -
    -
    -
    -
    -
    -
    -
    - v4.7.52022.09.05 -
    -
    -
    -
    -
      -
    1. Excel支持导出对象的子列表方法
    2. -
    3. 数据逻辑删除不进行唯一验证
    4. -
    5. 优化多角色数据权限匹配规则
    6. -
    7. 新增主子表提交校验示例
    8. -
    9. 支持自定义隐藏Excel属性列
    10. -
    11. Excel注解支持backgroundColor属性设置背景颜色
    12. -
    13. 菜单配置刷新时Tab页签切换时刷新
    14. -
    15. 增加对AjaxResult消息结果类型的判断
    16. -
    17. 新增示例(进度条)
    18. -
    19. 新增内容编码/解码方便插件集成使用
    20. -
    21. 升级jquery到最新版3.6.1
    22. -
    23. 升级layui到最新版本2.7.5
    24. -
    25. 升级shiro到最新版本1.9.1
    26. -
    27. 升级druid到最新版本1.2.11
    28. -
    29. 升级pagehelper到最新版1.4.3
    30. -
    31. 升级oshi到最新版本6.2.2
    32. -
    33. 修复树表onLoadSuccess不生效的问题
    34. -
    35. 修复用户分配角色大于默认页数丢失问题
    36. -
    37. 定时任务支持执行父类方法
    38. -
    39. 自动设置切换多个树表格实例配置
    40. -
    41. 页签创建标题优先data-title属性
    42. -
    43. 优化任务过期不执行调度
    44. -
    45. 优化横向菜单下激活菜单样式
    46. -
    47. 优化按钮打开窗口后按回车反复弹出
    48. -
    49. 优化excel/scale属性导出单元格数值类型
    50. -
    51. 优化druid开启wall过滤器出现的异常问题
    52. -
    53. 优化多个相同角色数据导致权限SQL重复问题
    54. -
    55. 其他细节优化
    56. -
    -
    -
    -
    -
    -
    -
    - v4.7.42022.06.01 -
    -
    -
    -
    -
      -
    1. 用户头像上传图片格式限制
    2. -
    3. Excel注解支持color属性设置字体颜色
    4. -
    5. 设置分页参数默认值
    6. -
    7. 主子表操作列新增单个删除
    8. -
    9. 定时任务检查Bean包名是否为白名单配置
    10. -
    11. 升级spring-boot到最新版本2.5.14
    12. -
    13. 升级shiro到最新版本1.9.0
    14. -
    15. 升级oshi到最新版本6.1.6
    16. -
    17. 升级fastjson到最新版1.2.83 安全修复版本
    18. -
    19. 文件上传兼容Weblogic环境
    20. -
    21. 新增清理分页的线程变量方法
    22. -
    23. 新增获取不带后缀文件名称方法
    24. -
    25. 用户缓存信息添加部门ancestors祖级列表
    26. -
    27. 自定义ShiroFilterFactoryBean防止中文请求被拦截
    28. -
    29. 字典类型必须以字母开头,且只能为(小写字母,数字,下滑线)
    30. -
    31. 优化IP地址获取到多个的问题
    32. -
    33. 优化表格冻结列阴影效果显示
    34. -
    35. 优化菜单侧边栏滚动条尺寸及颜色
    36. -
    37. 优化显示顺序orderNum类型为整型
    38. -
    39. 优化接口使用泛型使其看到响应属性字段
    40. -
    41. 优化导出数据LocalDateTime类型无数据问题
    42. -
    43. 修复导入Excel时字典字段类型为Long转义为空问题
    44. -
    45. 优化导出excel单元格验证,包含变更为开头.防止正常内容被替换
    46. -
    47. 修复URL类型回退键被禁止问题
    48. -
    49. 修复表格客户端分页序号显示错误问题
    50. -
    51. 修复代码生成拖拽多次出现的排序不正确问题
    52. -
    53. 修复表格打印组件不识别多层对象属性值问题
    54. -
    55. 修复操作日志查询类型条件为0时会查到所有数据
    56. -
    57. 修复Excel注解prompt/combo同时使用不生效问题
    58. -
    59. 修复初始化多表格处理回调函数时获取的表格配置不一致问题
    60. -
    61. 其他细节优化
    62. -
    -
    -
    -
    -
    -
    -
    - v4.7.32022.03.01 -
    -
    -
    -
    -
      -
    1. 表格树支持分页/异步加载
    2. -
    3. 代码生成预览支持复制内容
    4. -
    5. 定时任务默认保存到内存中执行
    6. -
    7. 代码生成同步保留必填/类型选项
    8. -
    9. 页面若未匹配到字典标签则返回原字典值
    10. -
    11. 用户访问控制时校验数据权限,防止越权
    12. -
    13. 导出Excel时屏蔽公式,防止CSV注入风险
    14. -
    15. 升级spring-boot到最新版本2.5.10
    16. -
    17. 升级spring-boot-mybatis到最新版2.2.2
    18. -
    19. 升级pagehelper到最新版1.4.1
    20. -
    21. 升级oshi到最新版本6.1.2
    22. -
    23. 升级bootstrap-table到最新版本1.19.1
    24. -
    25. 服务监控新增运行参数信息显示
    26. -
    27. 定时任务目标字符串验证包名白名单
    28. -
    29. 文件上传接口新增原/新文件名返回参数
    30. -
    31. 定时任务屏蔽违规的字符
    32. -
    33. 分页数据新增分页参数合理化参数
    34. -
    35. 表格父子视图添加点击事件打开示例
    36. -
    37. 优化上传文件名称命名规则
    38. -
    39. 优化加载字典缓存数据
    40. -
    41. 优化任务队列满时任务拒绝策略
    42. -
    43. 优化IE11上传预览不显示的问题
    44. -
    45. 优化Excel格式化不同类型的日期对象
    46. -
    47. 优化国际化配置多余的zh请求问题
    48. -
    49. 优化新版Chrome浏览器回退出现的遮罩层
    50. -
    51. 修复EMAIL类型回退键被禁止问题
    52. -
    53. 修复Xss注解字段值为空时的异常问题
    54. -
    55. 其他细节优化
    56. -
    -
    -
    -
    -
    -
    -
    - v4.7.22021.12.23 -
    -
    -
    -
    -
      -
    1. 自定义xss校验注解实现
    2. -
    3. 进入修改页面方法添加权限标识
    4. -
    5. 代码生成创建按钮添加超级管理员权限
    6. -
    7. 代码生成创建表检查关键字,防止注入风险
    8. -
    9. 修复定时任务多参数逗号分隔的问题
    10. -
    11. 修复表格插件一起使用出现的声明报错问题
    12. -
    13. 修复代码生成主子表模板删除方法缺少事务
    14. -
    15. 升级oshi到最新版本v5.8.6
    16. -
    17. 升级velocity到最新版本2.3
    18. -
    19. 升级fastjson到最新版1.2.79
    20. -
    21. 升级log4j2到最新版2.17.0 防止漏洞风险
    22. -
    23. 升级thymeleaf到最新版3.0.14 阻止远程代码执行漏洞
    24. -
    25. 优化修改/授权角色实时生效
    26. -
    27. 修整tomcat配置参数已过期问题
    28. -
    29. 前端添加单独的二代身份证校验
    30. -
    31. 优化新增部门时验证用户所属部门
    32. -
    33. 优化查询用户的角色组&岗位组代码
    34. -
    35. 请求分页方法设置成通用方便灵活调用
    36. -
    37. 优化日期类型错误提示与图标重叠问题
    38. -
    39. 其他细节优化
    40. -
    -
    -
    -
    -
    -
    -
    - v4.7.12021.11.10 -
    -
    -
    -
    -
      -
    1. 新增是否开启页签功能
    2. -
    3. 代码生成的模块增加创建表功能
    4. -
    5. Excel导入支持@Excels注解
    6. -
    7. Excel注解支持导入导出标题信息
    8. -
    9. Excel注解支持自定义数据处理器
    10. -
    11. 日志注解新增是否保存响应参数
    12. -
    13. 防重提交注解支持配置间隔时间/提示消息
    14. -
    15. 网页部分操作禁止使用后退键(Backspace)
    16. -
    17. 实例演示中增加多层窗口获取值
    18. -
    19. 弹出层openOptions增加动画属性
    20. -
    21. 升级spring-boot到最新版本2.5.6
    22. -
    23. 升级spring-boot-mybatis到最新版2.2.0
    24. -
    25. 升级pagehelper到最新版1.4.0
    26. -
    27. 升级oshi到最新版本v5.8.2
    28. -
    29. 升级druid到最新版1.2.8
    30. -
    31. 升级fastjson到最新版1.2.78
    32. -
    33. 升级thymeleaf-extras-shiro到最新版本v2.1.0
    34. -
    35. 升级bootstrap-fileinput到最新版本v5.2.4
    36. -
    37. 修改阿里云maven仓库地址为新版地址
    38. -
    39. 定时任务屏蔽违规字符
    40. -
    41. 增加sendGet无参请求方法
    42. -
    43. 代码生成去掉多余的排序字段
    44. -
    45. 优化启动脚本参数优化
    46. -
    47. 优化页签关闭右侧清除iframe元素
    48. -
    49. 优化多表格切换表单查询参数
    50. -
    51. 优化表格实例切换event不能为空
    52. -
    53. 优化mybatis全局默认的执行器
    54. -
    55. 优化导入Excel数据关闭时清理file
    56. -
    57. 优化Excel导入图片可能出现的异常
    58. -
    59. 优化记录登录信息,防止不必要的修改
    60. -
    61. 优化aop语法,使用spring自动注入注解
    62. -
    63. 修复无法被反转义问题
    64. -
    65. 修复拖拽行数据错位问题
    66. -
    67. 修复新窗口打开页面关闭弹窗报错
    68. -
    69. 修复富文本回退键被禁止&控制台报错问题
    70. -
    71. 修复自定义弹出层全屏参数无效问题
    72. -
    73. 修复树表代码生成短字段无法识别问题
    74. -
    75. 修复apple/webkit浏览器时间无法格式化
    76. -
    77. 修复后端主子表代码模板方法名生成错误问题
    78. -
    79. 修复swagger没有指定dataTypeClass导致启动出现warn日志
    80. -
    81. 其他细节优化
    82. -
    -
    -
    -
    -
    -
    -
    - v4.7.02021.09.01 -
    -
    -
    -
    -
      -
    1. 优化弹出层显示在顶层窗口
    2. -
    3. 定时任务支持在线生成cron表达式
    4. -
    5. Excel注解支持Image图片导入
    6. -
    7. 支持配置是否开启记住我功能
    8. -
    9. 修改时检查用户数据权限范围
    10. -
    11. 表单重置开始/结束时间控件
    12. -
    13. 新增多图上传示例
    14. -
    15. 启用父部门状态排除顶级节点
    16. -
    17. 富文本默认dialogsInBody属性
    18. -
    19. 去除默认分页合理化参数
    20. -
    21. 顶部菜单跳转添加绝对路径
    22. -
    23. 升级oshi到最新版本v5.8.0
    24. -
    25. 升级shiro到最新版本v1.8.0
    26. -
    27. 升级commons.io到最新版本v2.11.0
    28. -
    29. 升级jquery到最新版v3.6.0
    30. -
    31. 升级icheck到最新版v1.0.3
    32. -
    33. 升级layer到最新版本v3.5.1
    34. -
    35. 升级layui到最新版本v2.6.8
    36. -
    37. 升级laydate到最新版本v5.3.1
    38. -
    39. 升级select2到最新版v4.0.13
    40. -
    41. 升级cropper到最新版本v1.5.12
    42. -
    43. 升级summernote到最新版本v0.8.18
    44. -
    45. 升级duallistbox到最新版本v3.0.9
    46. -
    47. 升级jquery.validate到最新版本v1.19.3
    48. -
    49. 升级bootstrap-suggest到最新版本v0.1.29
    50. -
    51. 升级bootstrap-select到最新版本v1.13.18
    52. -
    53. 升级bootstrap-fileinput到最新版本v5.2.3
    54. -
    55. 查询表格指定列值增加是否去重属性
    56. -
    57. 删除sourceMappingURL源映射
    58. -
    59. 去除多余的favicon.ico引入
    60. -
    61. 优化代码生成模板
    62. -
    63. 优化XSS跨站脚本过滤
    64. -
    65. 补充定时任务表字段注释
    66. -
    67. 定时任务屏蔽ldap远程调用
    68. -
    69. 定时任务屏蔽http(s)远程调用
    70. -
    71. 定时任务对检查异常进行事务回滚
    72. -
    73. 调度日志详细页添加关闭按钮
    74. -
    75. 优化异常打印输出信息
    76. -
    77. 优化移动端进入首页样式
    78. -
    79. 优化用户操作不能删除自己
    80. -
    81. 默认开始/结束时间绑定控件选择类型
    82. -
    83. 其他细节优化
    84. -
    -
    -
    -
    -
    -
    -
    - v4.6.22021.07.01 -
    -
    -
    -
    -
      -
    1. 优化参数&字典缓存操作
    2. -
    3. 新增表格参数(导出方式&导出文件类型)
    4. -
    5. 新增表格示例(自定义视图分页)
    6. -
    7. 新增示例(表格列拖拽)
    8. -
    9. 集成yuicompressor实现(CSS/JS压缩)
    10. -
    11. 新增表格参数(是否支持打印页面showPrint)
    12. -
    13. 支持bat脚本执行应用
    14. -
    15. 修复存在的SQL注入漏洞问题
    16. -
    17. 定时任务屏蔽rmi远程调用
    18. -
    19. 导出Excel文件支持数据流下载方式
    20. -
    21. 实例演示弹层组件增加相册层示例
    22. -
    23. 删除操作日志记录信息
    24. -
    25. 增加表格重置分页的参数
    26. -
    27. 限制超级管理员不允许操作
    28. -
    29. 树级结构更新子节点使用replaceFirst
    30. -
    31. 支持动态生成密匙,防止默认密钥泄露
    32. -
    33. 升级pagehelper到最新版1.3.1
    34. -
    35. 升级oshi到最新版本v5.7.4
    36. -
    37. 升级swagger到最新版本v3.0.0
    38. -
    39. 升级commons.io到最新版本v2.10.0
    40. -
    41. 升级commons.fileupload到最新版本v1.4
    42. -
    43. 升级bootstrap-table到最新版本v1.18.3
    44. -
    45. 升级druid到最新版本v1.2.6
    46. -
    47. 升级fastjson到最新版1.2.76
    48. -
    49. 升级layui到最新版本v2.6.6
    50. -
    51. 升级layer到最新版本v3.5.0
    52. -
    53. 升级laydate到最新版本v5.3.0
    54. -
    55. 优化表格树移动端&边框显示
    56. -
    57. 新增表格刷新options配置方法
    58. -
    59. 优化图片工具类读取文件,防止异常
    60. -
    61. 修复表格图片预览移动端宽高无效问题
    62. -
    63. 主子表通用操作封装处理增加文本域类型
    64. -
    65. 日志注解兼容获取json类型的参数
    66. -
    67. 修复表单向导插件有滚动条时底部工具栏无法固定问题
    68. -
    69. 修复导出角色数据范围翻译缺少仅本人
    70. -
    71. 修正Velocity模板初始字符集
    72. -
    73. 升级mybatis到最新版3.5.6 阻止远程代码执行漏洞
    74. -
    75. 优化代码生成导出模板名称
    76. -
    77. 修改个人中心密码长度提醒
    78. -
    79. 实例演示中弹出表格增加以回调形式回显到父窗体
    80. -
    81. 修复登录页面弹窗文字不显示的问题
    82. -
    83. 其他细节优化
    84. -
    -
    -
    -
    -
    -
    -
    - v4.6.12021.04.12 -
    -
    -
    -
    -
      -
    1. 新增IE浏览器版本过低提示页面
    2. -
    3. 新增详细信息tab页签方式
    4. -
    5. 新增解锁屏幕打开上次页签
    6. -
    7. 数据监控默认账户密码防止越权访问
    8. -
    9. 新增表格示例(导出选择列)
    10. -
    11. 个人信息添加手机&邮箱重复验证
    12. -
    13. 个人中心刷新后样式问题
    14. -
    15. 操作日志返回参数添加非空验证
    16. -
    17. velocity剔除commons-collections版本,防止3.2.1版本的反序列化漏洞
    18. -
    19. 子表模板默认日期格式化
    20. -
    21. 代码生成预览语言根据后缀名高亮显示
    22. -
    23. 代码生成主子表相同字段导致数据问题
    24. -
    25. 升级SpringBoot到最新版本2.2.13
    26. -
    27. 升级shiro到最新版1.7.1 阻止身份认证绕过漏洞
    28. -
    29. 升级bootstrapTable到最新版本v1.18.2
    30. -
    31. 升级bootstrapTable相关组件到最新版本v1.18.2
    32. -
    33. 升级fastjson到最新版1.2.75
    34. -
    35. 升级druid到最新版本v1.2.4
    36. -
    37. 升级oshi到最新版本v5.6.0
    38. -
    39. 修改ip字段长度防止ipv6地址长度不够
    40. -
    41. 搜索建议示例选择后隐藏列表
    42. -
    43. 主子表示例增加初始化数据
    44. -
    45. 优化Excel导入增加空行判断
    46. -
    47. 修复横向菜单无法打开页签问题
    48. -
    49. 修复导入数据为负浮点数时,导入结果会丢失精度问题
    50. -
    51. 优化更多操作按钮左侧移入内容闪现消失情况
    52. -
    53. 修复主子表提交中列隐藏后出现列偏移问题
    54. -
    55. 单据打印网页时通过hidden-print隐藏元素
    56. -
    57. 表格销毁清除记住选择数据
    58. -
    59. 增加表格动态列示例
    60. -
    61. 代码生成选择主子表关联元素必填
    62. -
    63. tree根据Id和Name选中指定节点增加空判断
    64. -
    65. 其他细节优化
    66. -
    -
    -
    -
    -
    -
    -
    - v4.6.02021.01.01 -
    -
    -
    -
    -
      -
    1. 新增缓存监控管理
    2. -
    3. 新增锁定屏幕功能
    4. -
    5. 菜单新增是否刷新页面
    6. -
    7. 删除用户和角色解绑关联
    8. -
    9. 新增密码强度字符范围提示
    10. -
    11. 防止匿名访问进行过滤
    12. -
    13. 升级SpringBoot到最新版本2.2.12
    14. -
    15. 升级poi到最新版本4.1.2
    16. -
    17. 升级bitwalker到最新版本1.21
    18. -
    19. 升级bootstrap-fileinput到最新版本5.1.3
    20. -
    21. 升级bootstrapTable到最新版本v1.18.0
    22. -
    23. 升级bootstrapTable相关组件到最新版本v1.18.0
    24. -
    25. 升级oshi到最新版本v5.3.6
    26. -
    27. 新增示例(标签 & 提示)
    28. -
    29. 添加单据打印示例
    30. -
    31. 修改表格初始参数sortName默认值为undefined
    32. -
    33. 新增表格参数(自定义打印页面模板printPageBuilder)
    34. -
    35. 新增表格参数(是否显示行间隔色striped)
    36. -
    37. 新增表格参数(渲染完成后执行的事件onPostBody)
    38. -
    39. Excel注解支持Image图片导出
    40. -
    41. Excel支持注解align对齐方式
    42. -
    43. Excel支持导入Boolean型数据
    44. -
    45. 主子表操作添加通用addColumn方法
    46. -
    47. 代码生成日期控件区分范围
    48. -
    49. 代码生成数据库文本类型生成表单文本域
    50. -
    51. 修复生成主子表外键名错误
    52. -
    53. 选项卡新增是否刷新属性
    54. -
    55. 修复树表格表头跟表格宽度不同步的问题
    56. -
    57. 表格树加载完成触发tooltip方法
    58. -
    59. 使用widthUnit定义树表格选项单位
    60. -
    61. 修复主子表editColumn序列问题
    62. -
    63. 修复添加全屏在无参数时没有替换url参数问题
    64. -
    65. 弹出层openOptions移动端自适应
    66. -
    67. 防止错误页返回主页出现嵌套问题
    68. -
    69. 设置回显数据字典验证防止空值
    70. -
    71. 其他细节优化
    72. -
    -
    -
    -
    -
    -
    -
    - v4.5.12020.11.18 -
    -
    -
    -
    -
      -
    1. 阻止任意文件下载漏洞
    2. -
    3. 升级shiro到最新版1.7.0 阻止权限绕过漏洞
    4. -
    5. 升级druid到最新版本v1.2.2
    6. -
    7. 新增表格行触发事件(onCheck、onUncheck、onCheckAll、onUncheckAll)
    8. -
    9. 修复多页签关闭非当前选项出现空白问题
    10. -
    11. 代码生成预览支持高亮显示
    12. -
    13. mapperLocations配置支持分隔符
    14. -
    15. 权限信息调整
    16. -
    17. 个人中心头像和上传头像增加默认图片
    18. -
    19. 全局配置类保持和其他应用命名相同
    20. -
    -
    -
    -
    -
    -
    -
    - v4.5.02020.10.20 -
    -
    -
    -
    -
      -
    1. 新增菜单导航显示风格(default为左侧导航菜单,topnav为顶部导航菜单)
    2. -
    3. 菜单&数据权限新增(展开/折叠 全选/全不选 父子联动)
    4. -
    5. 账号密码支持自定义更新周期
    6. -
    7. 初始密码支持自定义修改策略
    8. -
    9. 新增校验用户修改新密码不能与旧密码相同
    10. -
    11. 添加检查密码范围支持的特殊字符包括:~!@#$%^&*()-=_+
    12. -
    13. 注册账号设置默认用户名称及密码最后更新时间
    14. -
    15. 去除用户手机邮箱部门必填验证
    16. -
    17. 新增日期格式化方法
    18. -
    19. 代码生成添加bit类型
    20. -
    21. 树结构加载添加callBack回调方法
    22. -
    23. 修复用户管理页面滚动返回顶部条失效
    24. -
    25. 修复代码生成模板文件上传组件缺少ctx的问题
    26. -
    27. 限制系统内置参数不允许删除
    28. -
    29. 新增表格列宽拖动插件
    30. -
    31. 新增Ajax局部刷新demo
    32. -
    33. 新增是否开启页脚功能
    34. -
    35. 新增表格参数(通过自定义函数设置标题样式headerStyle)
    36. -
    37. 新增表格参数(通过自定义函数设置页脚样式footerStyle)
    38. -
    39. 修复窗体大小改变后浮动提示框失效问题
    40. -
    41. 生成代码补充必填样式
    42. -
    43. 生成页面时不忽略remark属性
    44. -
    45. 字典数据列表页添加关闭按钮
    46. -
    47. Excel注解支持自动统计数据总和
    48. -
    49. 升级springboot到2.1.17 提升安全性
    50. -
    51. 升级pagehelper到最新版1.3.0
    52. -
    53. 升级druid到最新版本v1.2.1
    54. -
    55. 升级fastjson到最新版1.2.74
    56. -
    57. 升级bootstrap-fileinput到最新版本5.1.2
    58. -
    59. 升级oshi到最新版本v5.2.5
    60. -
    61. 表单向导插件更换为jquery-smartwizard
    62. -
    63. 修改主子表提交示例代码防止渲染失效
    64. -
    65. 添加导入数据弹出窗体自定义宽高
    66. -
    67. 用户信息参数返回忽略掉密码字段
    68. -
    69. 优化关闭窗体添加index参数
    70. -
    71. 回显数据字典(字符串数组)增加空值判断
    72. -
    73. 修改前端密码长度校验和错误提示不符问题
    74. -
    75. AjaxResult重写put方法,以方便链式调用
    76. -
    77. 增强验证码校验的语义,更易懂
    78. -
    79. 导入excel整形值校验优化
    80. -
    81. Excel导出类型NUMERIC支持精度浮点类型
    82. -
    83. 导出Excel调整targetAttr获取值方法,防止get方法不规范
    84. -
    85. 输入框组验证错误后置图标提示颜色
    86. -
    87. 上传媒体类型添加视频格式
    88. -
    89. 数据权限判断参数类型
    90. -
    91. 修正数据库字符串类型nvarchar
    92. -
    93. 优化递归子节点
    94. -
    95. 修复多表格搜索formId无效
    96. -
    97. 其他细节优化
    98. -
    -
    -
    -
    -
    -
    -
    - v4.4.02020.08.24 -
    -
    -
    -
    -
      -
    1. 升级bootstrapTable到最新版本1.17.1
    2. -
    3. 升级shiro到最新版1.6.0 阻止权限绕过漏洞
    4. -
    5. 升级fastjson到最新版1.2.73
    6. -
    7. 代码生成支持同步数据库
    8. -
    9. 代码生成支持富文本控件
    10. -
    11. 用户密码支持自定义配置规则
    12. -
    13. 新增表格自动刷新插件
    14. -
    15. 新增表格打印配置插件
    16. -
    17. 更换图片裁剪工具为cropper
    18. -
    19. Excel支持sort导出排序
    20. -
    21. 代码生成支持自定义路径
    22. -
    23. 代码生成支持选择上级菜单
    24. -
    25. 代码生成支持上传控件
    26. -
    27. 新增表格参数(自定义加载文本的字体大小loadingFontSize)
    28. -
    29. Excel注解支持设置BigDecimal精度&舍入规则
    30. -
    31. 操作日志记录排除敏感属性字段
    32. -
    33. 修复不同浏览器附件下载中文名乱码的问题
    34. -
    35. 用户分配角色不允许选择超级管理员角色
    36. -
    37. 更换表格冻结列插件
    38. -
    39. 添加右侧冻结列示例
    40. -
    41. 升级表格行编辑&移动端适应插件
    42. -
    43. 修复更新表格插件后无法设置实例配置问题
    44. -
    45. 修复更新表格插件后导致的主子表错误
    46. -
    47. 修复页面存在多表格,回调函数res数据不正确问题
    48. -
    49. 强退&过期清理登录帐号缓存会话
    50. -
    51. 表格树标题内容支持html语义化标签
    52. -
    53. 修复配置应用的访问路径首页页签重复问题
    54. -
    55. 优化openTab打开时滚动到当前页签
    56. -
    57. 表格请求方式method支持自定义配置
    58. -
    59. 菜单页签联动优化
    60. -
    61. 用户邮箱长度限制修改为50
    62. -
    63. 主子表示例添加日期格式案例
    64. -
    65. 修改表格行内编辑示例旧值参数
    66. -
    67. 操作日志查询方式调整
    68. -
    69. 唯一限制条件只返回单条数据
    70. -
    71. 修改Excel设置STRING单元格类型
    72. -
    73. 添加获取当前的环境配置方法
    74. -
    75. 截取返回参数长度,防止超出异常
    76. -
    77. 定时任务cron表达式验证
    78. -
    79. 拆分表格插件,按需引入
    80. -
    81. 多行文本框补齐必填错误提示背景
    82. -
    83. 其他细节优化
    84. -
    -
    -
    -
    -
    -
    -
    - v4.3.12020.07.05 -
    -
    -
    -
    -
      -
    1. 国家信息安全漏洞(请务必保持cipherKey密钥唯一性)
    2. -
    3. 升级shiro到最新版1.5.3 阻止权限绕过漏洞
    4. -
    5. 修改验证码在使用后清除,防止多次使用
    6. -
    7. 检查字符支持小数点&降级改成异常提醒
    8. -
    9. openOptions函数中加入自定义maxmin属性
    10. -
    11. 支持openOptions方法最大化
    12. -
    13. 支持openOptions方法多个按钮回调
    14. -
    15. 新增isLinkage支持页签与菜单联动
    16. -
    17. 修改代码生成导入表结构出现异常页面不提醒问题
    18. -
    19. 优化用户头像发生错误,则显示一个默认头像
    20. -
    21. Excel导出支持字典类型
    22. -
    -
    -
    -
    -
    -
    -
    - v4.3.02020.06.22 -
    -
    -
    -
    -
      -
    1. 代码生成模板支持主子表
    2. -
    3. 代码生成显示类型支持复选框
    4. -
    5. 前端表单样式修改成圆角
    6. -
    7. 新增回显数据字典(字符串数组)
    8. -
    9. 修复浏览器手动缩放比例后菜单无法自适应问题
    10. -
    11. 限制用户不允许选择系统管理员角色
    12. -
    13. 用户信息添加输入框组图标&鼠标按下显示密码
    14. -
    15. 升级fastjson到最新版1.2.70 修复高危安全漏洞
    16. -
    17. 升级Bootstrap版本到v3.3.7
    18. -
    19. 修复selectColumns方法获取子对象数据无效问题
    20. -
    21. 修改数据源类型优先级,先根据方法,再根据类
    22. -
    23. 修改上级部门(选择项排除本身和下级)
    24. -
    25. 首页菜单显示调整
    26. -
    27. 添加是否开启swagger配置
    28. -
    29. 新增示例(主子表提交)
    30. -
    31. 新增示例(多级联动下拉示例)
    32. -
    33. 新增示例(表格属性data数据加载)
    34. -
    35. 新增表格列参数(是否列选项可见ignore)
    36. -
    37. 新增表格参数(是否启用显示卡片视图cardView)
    38. -
    39. 新增表格参数(是否显示全屏按钮showFullscreen)
    40. -
    41. 新增表格参数(是否启用分页条无限循环的功能paginationLoop)
    42. -
    43. 新增表格参数(是否显示表头showHeader)
    44. -
    45. 表格添加显示/隐藏所有列方法 showAllColumns/hideAllColumns
    46. -
    47. 修复部分情况节点不展开问题
    48. -
    49. 修复关闭标签页后刷新还是上次地址问题
    50. -
    51. 修复选择菜单后刷新页面,菜单箭头显示不对问题
    52. -
    53. 修复jquery表单序列化时复选框未选中不会序列化到对象中问题
    54. -
    55. Excel支持readConverterExp读取字符串组内容
    56. -
    57. 更换IP地址查询接口
    58. -
    59. 默认关闭获取ip地址
    60. -
    61. 操作处理ajaxSuccess判断修正
    62. -
    63. HttpUtils.sendPost()方法,参数无需拼接参数到url
    64. -
    65. 通用http发送方法增加参数 contentType 编码类型
    66. -
    67. HTML过滤器不替换&实体
    68. -
    69. 代码生成浮点型改用BigDecimal
    70. -
    71. 修复表单构建单选和多选框渲染问题
    72. -
    73. 代码生成模板调整,字段为String并且必填则加空串条件
    74. -
    75. 字典数据查询列表根据dictSort升序排序
    76. -
    77. 修复树表对imageView和tooltip方法无效问题
    78. -
    79. 修复Long类型比较相等问题调整
    80. -
    81. 示例demo页面清除html链接,防止点击后跳转出现404
    82. -
    83. 在线用户强退方法合并
    84. -
    85. 添加校验部门包含未停用的子部门
    86. -
    87. 取消回车自动提交表单
    88. -
    89. 'A','I','BUTTON' 标签忽略clickToSelect事件,防止点击操作按钮时选中
    90. -
    91. 邮箱显示截取部分字符串,防止低分辨率错位
    92. -
    93. 代码生成列属性根据sort排序
    94. -
    95. 修复更多操作部分浏览器不兼容情况
    96. -
    97. 图片预览事件属性修正
    98. -
    99. 修复冻结列排序样式无效问题
    100. -
    101. 修复context-path的情况下个人中心刷新导致样式问题
    102. -
    103. 全屏editFull打开适配表树
    104. -
    105. 其他细节优化
    106. -
    -
    -
    -
    -
    -
    -
    - v4.2.02020.03.23 -
    -
    -
    -
    -
      -
    1. 用户管理添加分配角色页面
    2. -
    3. 定时任务添加调度日志按钮
    4. -
    5. 新增是否开启用户注册功能
    6. -
    7. 新增页面滚动显示返回顶部按钮
    8. -
    9. 用户&角色&任务添加更多操作按钮
    10. -
    11. iframe框架页会话过期弹出超时提示
    12. -
    13. 移动端登录不显示左侧菜单
    14. -
    15. 侧边栏添加一套深蓝色主题
    16. -
    17. 首页logo固定,不随菜单滚动
    18. -
    19. 支持mode配置history(表示去掉地址栏的#)
    20. -
    21. 任务分组字典翻译(调度日志详细)
    22. -
    23. 字典管理添加缓存读取
    24. -
    25. 字典数据列表标签显示样式
    26. -
    27. 参数管理支持缓存操作
    28. -
    29. 日期控件清空结束时间设置开始默认值为2099-12-31
    30. -
    31. 表格树添加获取数据后响应回调处理
    32. -
    33. 批量替换表前缀调整
    34. -
    35. 支持表格导入模板的弹窗表单加入其它输入控件
    36. -
    37. 表单重置刷新表格树
    38. -
    39. 新增支持导出数据字段排序
    40. -
    41. 新增表格参数(是否单选checkbox)
    42. -
    43. druid未授权不允许访问
    44. -
    45. 表格树父节点兼容0,'0','',null
    46. -
    47. 表单必填的项添加星号
    48. -
    49. 修复select2不显示校验错误信息
    50. -
    51. 添加自定义HTML过滤器
    52. -
    53. 修复多数据源下开关关闭出现异常问题
    54. -
    55. 修复翻页记住选择项数据问题
    56. -
    57. 用户邮箱长度限制20
    58. -
    59. 修改错误页面返回主页出现嵌套问题
    60. -
    61. 表格浮动提示单双引号转义
    62. -
    63. 支持配置四级菜单
    64. -
    65. 升级shiro到最新版1.4.2 阻止rememberMe漏洞攻击
    66. -
    67. 升级summernote到最新版本v0.8.12
    68. -
    69. 导入Excel根据dateFormat属性格式处理
    70. -
    71. 修复War部署无法正常shutdown,ehcache内存泄漏
    72. -
    73. 修复代码生成短字段无法识别问题
    74. -
    75. 修复serviceImpl模版,修改方法判断日期错误
    76. -
    77. 代码生成模板增加导出功能日志记录
    78. -
    79. 代码生成唯一编号调整为tableId
    80. -
    81. 代码生成查询时忽略大小写
    82. -
    83. 代码生成支持翻页记住选中
    84. -
    85. 代码生成表注释未填写也允许导入
    86. -
    87. Global全局配置类修改为注解,防止多环境配置下读取问题
    88. -
    89. 修复多表格情况下,firstLoad只对第一个表格生效
    90. -
    91. 处理Maven打包出现警告问题
    92. -
    93. 默认主题样式,防止网速慢情况下出现空白
    94. -
    95. 修复文件上传多级目录识别问题
    96. -
    97. 锚链接解码url,防止中文导致页面不能加载问题
    98. -
    99. 修复右键Tab页刷新事件重复请求问题
    100. -
    101. 角色禁用&菜单隐藏不查询权限
    102. -
    103. 其他细节优化
    104. -
    -
    -
    -
    -
    -
    -
    - v4.1.02019.10.22 -
    -
    -
    -
    -
      -
    1. 支持多表格实例操作
    2. -
    3. 浮动提示方法tooltip支持弹窗
    4. -
    5. 代码生成&字典数据支持模糊条件查询
    6. -
    7. 增加页签全屏方法
    8. -
    9. 增加清除表单验证错误信息方法
    10. -
    11. 支持iframe局部刷新页面
    12. -
    13. 支持在线切换主题
    14. -
    15. 修改图片预览设置的高宽参数颠倒问题
    16. -
    17. 操作日志新增解锁账户功能
    18. -
    19. 管理员用户&角色不允许操作
    20. -
    21. 去掉jsoup包调用自定义转义工具
    22. -
    23. 添加时间轴示例
    24. -
    25. 修复翻页记住选择时获取指定列值的问题
    26. -
    27. 代码生成sql脚本添加导出按钮
    28. -
    29. 添加表格父子视图示例
    30. -
    31. 添加表格行内编辑示例
    32. -
    33. 升级fastjson到最新版1.2.60 阻止漏洞攻击
    34. -
    35. 升级echarts到最新版4.2.1
    36. -
    37. 操作日志新增返回参数
    38. -
    39. 支持mybatis通配符扫描任意多个包
    40. -
    41. 权限验证多种情况处理
    42. -
    43. 修复树形类型的代码生成的部分必要属性无法显示
    44. -
    45. 修复非表格插件情况下重置出现异常
    46. -
    47. 修复富文本编辑器有序列表冲突
    48. -
    49. 代码生成表前缀配置支持多个
    50. -
    51. 修复自动去除表前缀配置无效问题
    52. -
    53. 菜单列表按钮数据可见不显示(权限标识控制)
    54. -
    55. 修复设置会话超时时间无效问题
    56. -
    57. 新增本地资源通用下载方法
    58. -
    59. 操作日志记录新增请求方式
    60. -
    61. 代码生成单选按钮属性重名修复
    62. -
    63. 优化select2下拉框宽度不会随浏览器改变
    64. -
    65. 修复代码生成树表异常
    66. -
    67. 其他细节优化
    68. -
    -
    -
    -
    -
    -
    -
    - v4.0.02019.08.08 -
    -
    -
    -
    -
      -
    1. 代码生成支持预览、编辑,保存方案
    2. -
    3. 新增防止表单重复提交注解
    4. -
    5. 新增后端校验(和前端保持一致)
    6. -
    7. 新增同一个用户最大会话数控制
    8. -
    9. Excel导出子对象支持多个字段
    10. -
    11. 定时任务支持静态调用和多参数
    12. -
    13. 定时任务增加分组条件查询
    14. -
    15. 字典类型增加任务分组数据
    16. -
    17. 新增表格是否首次加载数据
    18. -
    19. 新增parentTab选项卡可在同一页签打开
    20. -
    21. 多数据源支持类注解(允许继承父类的注解)
    22. -
    23. 部门及以下数据权限(调整为以下及所有子节点)
    24. -
    25. 新增角色数据权限配(仅本人数据权限)
    26. -
    27. 修改菜单权限显示问题
    28. -
    29. 上传文件修改路径及返回名称
    30. -
    31. 添加报表插件及示例
    32. -
    33. 添加首页统计模板
    34. -
    35. 添加表格拖拽示例
    36. -
    37. 添加卡片列表示例
    38. -
    39. 添加富文本编辑器示例
    40. -
    41. 添加表格动态增删改查示例
    42. -
    43. 添加用户页面岗位选择框提示
    44. -
    45. 点击菜单操作添加背景高亮显示
    46. -
    47. 表格树新增showSearch是否显示检索信息
    48. -
    49. 解决表格列设置sortName无效问题
    50. -
    51. 表格图片预览支持自定义设置宽高
    52. -
    53. 添加表格列浮动提示(单击文本复制)
    54. -
    55. PC端收起菜单后支持浮动显示
    56. -
    57. 详细操作样式调整
    58. -
    59. 修改用户更新描述空串不更新问题
    60. -
    61. 导入修改为模板渲染
    62. -
    63. 修改菜单及部门排序规则
    64. -
    65. 角色导出数据范围表达式翻译
    66. -
    67. 添加summernote富文本字体大小
    68. -
    69. 优化表格底部下边框防重叠&汇总像素问题
    70. -
    71. 树表格支持属性多层级访问
    72. -
    73. 修复IE浏览器用户管理界面右侧留白问题
    74. -
    75. 重置按钮刷新表格
    76. -
    77. 重置密码更新用户缓存
    78. -
    79. 优化验证码属性参数
    80. -
    81. 支持数据监控配置用户名和密码
    82. -
    83. 文件上传修改按钮背景及加载动画
    84. -
    85. 支持配置一级菜单href跳转
    86. -
    87. 侧边栏添加一套浅色主题
    88. -
    89. 树表格添加回调函数(校验异常状态)
    90. -
    91. 用户个人中心适配手机端显示
    92. -
    93. Excel支持设置导出类型&更换样式
    94. -
    95. 检查属性改变修改为克隆方式(防止热部署强转异常)
    96. -
    97. 其他细节优化
    98. -
    -
    -
    -
    -
    -
    -
    - v3.4.02019.06.03 -
    -
    -
    -
    -
      -
    1. 新增实例演示菜单及demo
    2. -
    3. 新增页签右键操作
    4. -
    5. 菜单管理新增打开方式
    6. -
    7. 新增点击某行触发的事件
    8. -
    9. 新增双击某行触发的事件
    10. -
    11. 新增单击某格触发的事件
    12. -
    13. 新增双击某格触发的事件
    14. -
    15. 新增是否启用显示细节视图
    16. -
    17. 支持上传任意格式文件
    18. -
    19. 修复角色权限注解失效问题
    20. -
    21. 左侧的菜单栏宽度调整
    22. -
    23. 新增响应完成后自定义回调函数
    24. -
    25. 支持前端及其他模块直接获取用户信息
    26. -
    27. 升级swagger到最新版2.9.2
    28. -
    29. 升级jquery.slimscroll到最新版1.3.8
    30. -
    31. 升级select2到最新版4.0.7
    32. -
    33. 新增角色配置本部门数据权限
    34. -
    35. 新增角色配置本部门及以下数据权限
    36. -
    37. 优化底部操作防止跳到页面顶端
    38. -
    39. 修改冻结列选框无效及样式问题
    40. -
    41. 修复部门四层级修改祖级无效问题
    42. -
    43. 更换开关切换按钮样式
    44. -
    45. 新增select2-bootstrap美化下拉框
    46. -
    47. 添加表格内图片预览方法
    48. -
    49. 修复权限校验失败跳转页面路径错误
    50. -
    51. 国际化资源文件调整
    52. -
    53. 通知公告布局调整
    54. -
    55. 删除页签操作功能
    56. -
    57. 表格树新增查询指定列值
    58. -
    59. 更改系统接口扫描方式及完善测试案例
    60. -
    61. 表格列浮动提示及字典回显默认去背景
    62. -
    63. 修复启用翻页记住前面的选择check没选中问题
    64. -
    65. 去除监控页面底部的广告
    66. -
    67. 日期控件功问题修复及data功能增强
    68. -
    69. 新增角色权限可见性(前端直接调用)
    70. -
    71. 新增获取当前登录用户方法(前端及子模块调用)
    72. -
    73. 修复热部署重启导致菜单丢失问题
    74. -
    75. 优化业务校验失败普通请求跳转页面
    76. -
    77. 操作日志新增状态条件查询
    78. -
    79. 操作类型支持多选条件查询
    80. -
    81. 通知公告防止滚动触底回弹优化
    82. -
    83. 其他细节优化
    84. -
    -
    -
    -
    -
    -
    -
    - v3.3.02019.04.01 -
    -
    -
    -
    -
      -
    1. 新增线程池统一管理
    2. -
    3. 新增支持左右冻结列
    4. -
    5. 新增表格字符超长浮动提示
    6. -
    7. 升级datepicker拓展并汉化
    8. -
    9. 升级druid到最新版本v1.1.14
    10. -
    11. 修复个人头像为图片服务器跨域问题
    12. -
    13. 修改上传文件按日期存储
    14. -
    15. 新增表格客户端分页选项
    16. -
    17. 新增表格的高度参数
    18. -
    19. 新增表格销毁方法
    20. -
    21. 新增表格下拉按钮切换方法
    22. -
    23. 新增表格分页跳转到指定页码
    24. -
    25. 新增表格启用点击选中行参数
    26. -
    27. 修复表格数据重新加载未触发部分按钮禁用
    28. -
    29. 使用jsonview展示操作日志参数
    30. -
    31. 新增方法(addTab、editTab)
    32. -
    33. 修改用户管理界面为Tab打开方式
    34. -
    35. 表单验证代码优化
    36. -
    37. 修复@Excel注解 prompt 属性使用报错
    38. -
    39. 修复combo属性Excel兼容性问题
    40. -
    41. 新增@Excel导入导出支持父类字段
    42. -
    43. 修复关闭最后选项卡无法激活滚动问题
    44. -
    45. 增加日期控件显示类型及回显格式扩展选项
    46. -
    47. 修复定时任务执行失败后入库状态为成功状态
    48. -
    49. 支持定时任务并发开关控制
    50. -
    51. 优化权限校验失败普通请求跳转页面
    52. -
    53. 捕获线程池执行任务抛出的异常
    54. -
    55. 修复IE浏览器导出功能报错
    56. -
    57. 新增角色管理分配用户功能
    58. -
    59. 新增表格翻页记住前面的选择
    60. -
    61. 调整用户个人中心页面
    62. -
    63. 修复界面存在的一些安全问题
    64. -
    65. 其他细节优化
    66. -
    -
    -
    -
    -
    -
    -
    - v3.2.02019.01.18 -
    -
    -
    -
    -
      -
    1. 部门修改时不允许选择最后节点
    2. -
    3. 修复部门菜单排序字段无效
    4. -
    5. 修复光驱磁盘导致服务监控异常
    6. -
    7. 登录界面去除check插件
    8. -
    9. 验证码文本字符间距修正
    10. -
    11. 升级SpringBoot到最新版本2.1.1
    12. -
    13. 升级MYSQL驱动
    14. -
    15. 修正登录必填项位置偏移
    16. -
    17. Session会话检查优化
    18. -
    19. Excel注解支持多级获取
    20. -
    21. 新增序列号生成方法
    22. -
    23. 修复WAR部署tomcat退出线程异常
    24. -
    25. 全屏操作增加默认确认/关闭
    26. -
    27. 修复个人信息可能导致漏洞
    28. -
    29. 字典数据根据下拉选择新增类型
    30. -
    31. 升级Summernote到最新版本v0.8.11
    32. -
    33. 新增用户数据导入
    34. -
    35. 首页主题样式更换
    36. -
    37. layer扩展主题更换
    38. -
    39. 用户管理移动端默认隐藏左侧布局
    40. -
    41. 详细信息弹出层显示在顶层
    42. -
    43. 表格支持切换状态(用户/角色/定时任务)
    44. -
    45. Druid数据源支持配置继承
    46. -
    47. 修正部分iPhone手机端表格适配问题
    48. -
    49. 新增防止重复提交表单方法
    50. -
    51. 新增表格数据统计汇总方法
    52. -
    53. 支持富文本上传图片文件
    54. -
    -
    -
    -
    -
    -
    -
    - v3.1.02018.12.03 -
    -
    -
    -
    -
      -
    1. 新增内网不获取IP地址
    2. -
    3. 新增cron表达式有效校验
    4. -
    5. 定时任务新增详细信息
    6. -
    7. 定时任务默认策略修改(不触发立即执行)
    8. -
    9. 定时任务显示下一个执行周期
    10. -
    11. 支持前端任意日期格式处理
    12. -
    13. 上传头像删除多余提交按钮
    14. -
    15. 表格增加行间隔色配置项
    16. -
    17. 表格增加转义HTML字符串配置项
    18. -
    19. 表格增加显示/隐藏指定列
    20. -
    21. 代码生成优化
    22. -
    23. 操作日志参数格式化显示
    24. -
    25. 页签新增新增全屏显示
    26. -
    27. 新增一键打包部署
    28. -
    29. Excel注解新增多个参数
    30. -
    31. 新增提交静默更新表格方法
    32. -
    33. 新增服务监控菜单
    34. -
    -
    -
    -
    -
    -
    -
    - v3.0.02018.10.08 -
    -
    -
    -
    -
      -
    1. 升级poi到最新版3.17
    2. -
    3. 导出修改临时目录绝对路径
    4. -
    5. 升级laydate到最新版5.0.9
    6. -
    7. 升级SpringBoot到最新版本2.0.5
    8. -
    9. 优化开始/结束时间校验限制
    10. -
    11. 重置密码参数表中获取默认值
    12. -
    13. 修复头像修改显示问题
    14. -
    15. 新增数据权限过滤注解
    16. -
    17. 新增表格检索折叠按钮
    18. -
    19. 新增清空(登录、操作、调度)日志
    20. -
    21. 固定按钮位置(提交/关闭)
    22. -
    23. 部门/菜单支持(展开/折叠)
    24. -
    25. 部分细节调整优化
    26. -
    27. 项目采用分模块
    28. -
    -
    -
    -
    -
    -
    -
    - v2.4.02018.09.03 -
    -
    -
    -
    -
      -
    1. 支持部门多级查询
    2. -
    3. 修复菜单状态查询无效
    4. -
    5. 支持IP地址开关
    6. -
    7. 支持XSS开关
    8. -
    9. 记录日志异步处理
    10. -
    11. 字典回显样式更改为下拉框
    12. -
    13. 菜单类型必填校验
    14. -
    15. 修复在线用户排序报错
    16. -
    17. 增加重置按钮
    18. -
    19. 支持注解导入数据
    20. -
    21. 支持弹层外区域关闭
    22. -
    23. 备注更换为文本区域
    24. -
    25. 新增角色逻辑删除
    26. -
    27. 新增部门逻辑删除
    28. -
    29. 支持部门数据权限
    30. -
    31. 管理员默认拥有所有授权
    32. -
    33. 字典数据采用分页
    34. -
    35. 部分细节调整优化
    36. -
    -
    -
    -
    -
    -
    -
    - v2.3.02018.08.06 -
    -
    -
    -
    -
      -
    1. 支持表格不分页开关控制
    2. -
    3. 修改字典类型同步修改字典数据
    4. -
    5. 代码生成新增修改后缀处理
    6. -
    7. 代码生成新增实体toString
    8. -
    9. 代码生成非字符串去除!=''
    10. -
    11. 导出数据前加载遮罩层
    12. -
    13. 部门删除校验条件修改
    14. -
    15. 搜索查询下载优化
    16. -
    17. 手机打开弹出层自适应
    18. -
    19. 角色岗位禁用显示置灰
    20. -
    21. 角色禁用不显示菜单
    22. -
    23. 新增导出权限
    24. -
    25. 角色权限唯一校验
    26. -
    27. 岗位名称编码唯一校验
    28. -
    29. TreeTable优化
    30. -
    31. 支持多数据源
    32. -
    33. 其他细节优化
    34. -
    -
    -
    -
    -
    -
    -
    - v2.2.02018.07.23 -
    -
    -
    -
    -
      -
    1. 修复批量生成代码异常问题
    2. -
    3. 修复定时器保存失败问题
    4. -
    5. 修复热部署转换问题
    6. -
    7. 支持查询菜单管理,部门管理
    8. -
    9. 大多数功能支持时间查询
    10. -
    11. 自定义导出注解自动匹配column
    12. -
    13. 新增任务执行策略
    14. -
    15. 操作详细动态显示类型
    16. -
    17. 支持动态回显字典数据
    18. -
    19. 后台代码优化调整
    20. -
    21. 其他细节优化
    22. -
    -
    -
    -
    -
    -
    -
    - v2.1.02018.07.10 -
    -
    -
    -
    -
      -
    1. 新增登录超时提醒
    2. -
    3. 修复定时器热部署转换问题
    4. -
    5. 修复登录验证码校验无效问题
    6. -
    7. 定时任务新增立即执行一次
    8. -
    9. 存在字典数据不允许删除字典
    10. -
    11. 字典数据支持按名称查询
    12. -
    13. 代码生成增加日志注解&表格优化
    14. -
    15. 修复用户逻辑删除后能登录问题
    16. -
    17. 表格支持多字段动态排序
    18. -
    19. 支持三级菜单显示
    20. -
    21. 新增ry.sh启动程序脚本
    22. -
    23. 其他细节优化
    24. -
    -
    -
    -
    -
    -
    -
    - v2.0.02018.07.02 -
    -
    -
    -
    -
      -
    1. 升级SpringBoot到最新版本2.0.3
    2. -
    3. 新增公告管理
    4. -
    5. 表单校验示提体验优化
    6. -
    7. 前端通用方法封装调整
    8. -
    9. 前端去除js文件,合并到html
    10. -
    11. 操作加载遮罩层
    12. -
    13. 支持全屏模式操作
    14. -
    15. 支持注解导出数据
    16. -
    17. 系统支持多查询&下载
    18. -
    19. 系统样式调整
    20. -
    -
    -
    -
    -
    -
    -
    - v1.1.62018.06.04 -
    -
    -
    -
    -
      -
    1. 新增用户列表部门列
    2. -
    3. 新增登录地点
    4. -
    5. 新增swagger
    6. -
    7. 修复排序数字校验
    8. -
    9. 优化头像上传文件类型限定为图片
    10. -
    11. 新增XSS过滤
    12. -
    13. 新增热部署提高开发效率
    14. -
    15. 修复treegrid居中无效
    16. -
    17. 角色多条件查询
    18. -
    -
    -
    -
    -
    -
    -
    - v1.1.52018.05.28 -
    -
    -
    -
    -
      -
    1. 优化登录失败刷新验证码
    2. -
    3. 新增用户登录地址时间
    4. -
    5. 修复ajax超时退出问题
    6. -
    7. 新增html调用数据字典(若依首创)
    8. -
    9. 调整系统部分样式
    10. -
    11. 新增用户逻辑删除
    12. -
    13. 新增管理员不允许删除修改
    14. -
    15. 升级bootstrapTable到最新版本1.12.1
    16. -
    17. 升级layer到最新版本3.1.1
    18. -
    -
    -
    -
    -
    -
    -
    - v1.1.42018.05.20 -
    -
    -
    -
    -
      -
    1. 新增参数管理
    2. -
    3. 修复头像上传bug
    4. -
    5. 手机邮箱唯一校验
    6. -
    7. 支持手机邮箱登录
    8. -
    9. 代码生成优化
    10. -
    11. 支持模糊查询
    12. -
    13. 支持切换主题皮肤
    14. -
    15. 修改权限即时生效
    16. -
    17. 修复页签Tab关闭问题
    18. -
    -
    -
    -
    -
    -
    -
    - v1.1.32018.05.14 -
    -
    -
    -
    -
      -
    1. 新增验证码(数组计算、字符验证)
    2. -
    3. 新增cookie记住我
    4. -
    5. 新增头像上传
    6. -
    7. 用户名密码长度限制
    8. -
    9. 通用字段提取
    10. -
    11. 支持自定义条件查询
    12. -
    13. 部门名称必填、时间格式调整
    14. -
    15. 其他细节优化
    16. -
    -
    -
    -
    -
    -
    -
    - v1.1.22018.05.07 -
    -
    -
    -
    -
      -
    1. 新增个人信息修改
    2. -
    3. 菜单存在子菜单不允许删除
    4. -
    5. 菜单分配角色不允许删除
    6. -
    7. 角色分配人员不允许删除
    8. -
    9. 岗位使用后不允许删除
    10. -
    11. 保证用户的数据完整性加入事物
    12. -
    13. 新增环境使用手册、数据建模
    14. -
    15. Thymeleaf升级到3.0
    16. -
    17. 支持非ROOT部署
    18. -
    -
    -
    -
    -
    -
    -
    - v1.1.12018.04.23 -
    -
    -
    -
    -
      -
    1. 新增表单构建器
    2. -
    3. 代码生成优化
    4. -
    5. 支持新增主部门
    6. -
    7. 支持选择上级部门、上级菜单
    8. -
    9. 新增字典管理单条删除
    10. -
    11. 优化一些其他细节
    12. -
    -
    -
    -
    -
    -
    -
    - v1.1.02018.04.20 -
    -
    -
    -
    -
      -
    1. 支持密码盐
    2. -
    3. 支持新增主目录
    4. -
    5. 支持批量生成代码
    6. -
    7. 支持表格导出(csv、txt、doc、excel)
    8. -
    9. 自动适应宽高模式窗体
    10. -
    11. 重复校验(角色名、菜单名、部门名)
    12. -
    13. 优化一些其他细节
    14. -
    -
    -
    -
    -
    -
    -
    - v1.0.92018.04.14 -
    -
    -
    -
    -
      -
    1. 新增代码生成(生成包括 java、html、js、xml、sql)
    2. -
    3. 新增按钮权限控制隐藏(若依首创)
    4. -
    -
    -
    -
    -
    -
    -
    - v1.0.82018.04.08 -
    -
    -
    -
    -
      -
    1. 新增定时任务(新增、修改、删除、查询、启动/暂停)
    2. -
    3. 新增调度日志(查询、删除)
    4. -
    -
    -
    -
    -
    -
    -
    - v1.0.72018.04.04 -
    -
    -
    -
    -
      -
    1. 新增岗位管理(新增、修改、删除、查询)
    2. -
    3. 优化用户管理,菜单管理部分细节
    4. -
    -
    -
    -
    -
    -
    -
    - v1.0.62018.03.15 -
    -
    -
    -
    -
      -
    1. 新增字典管理(新增、删除、修改、查询、数据选择)
    2. -
    3. 新增用户密码重置
    4. -
    5. 优化一些其他细节
    6. -
    -
    -
    -
    -
    -
    -
    - v1.0.52018.03.12 -
    -
    -
    -
    -
      -
    1. 新增菜单管理(新增、删除、修改、查询、图标选择)
    2. -
    3. 部门管理优化(添加责任人、联系电话、邮箱、修改者)
    4. -
    -
    -
    -
    -
    -
    -
    - v1.0.42018.03.11 -
    -
    -
    -
    -
      -
    1. 新增角色管理(新增、删除、修改、查询、菜单选择)
    2. -
    -
    -
    -
    -
    -
    -
    - v1.0.32018.03.08 -
    -
    -
    -
    -
      -
    1. 新增用户管理(新增、删除、修改、查询、部门选择)
    2. -
    -
    -
    -
    -
    -
    -
    - v1.0.22018.03.04 -
    -
    -
    -
    -
      -
    1. 新增部门管理 (新增、删除、修改、查询)
    2. -
    -
    -
    -
    -
    -
    -
    - v1.0.12018.03.03 -
    -
    -
    -
    -
      -
    1. 新增在线用户 (批量强退、单条强退、查询)
    2. -
    3. 新增登录日志 (批量删除、查询)
    4. -
    5. 新增操作日志 (批量删除、查询、详细)
    6. -
    7. 新增数据监控 (监控DB池连接和SQL的执行)
    8. -
    -
    -
    -
    -
    -
    -

    - v1.0.02018.03.01 -

    -
    -
    -
    -
      -
    1. 若依管理系统正式发布。
    2. -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    捐赠
    -
    -
    -
    - 请作者喝杯咖啡(点击图片放大) -
    -

    - 请使用手机支付宝或者微信扫码支付 - -

    - -
    -
    -
    -
    -
    - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/main_v1.html b/ruoyi-admin/src/main/resources/templates/main_v1.html deleted file mode 100644 index 4df4d1aab..000000000 --- a/ruoyi-admin/src/main/resources/templates/main_v1.html +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - 统计 - - - - - - - - -
    - -
    -
    -
    -
    - -
    收入
    -
    -
    -

    40 886,200

    -
    98% -
    - 总收入 -
    -
    -
    -
    -
    -
    - 全年 -
    订单
    -
    -
    -

    275,800

    -
    20% -
    - 新订单 -
    -
    -
    -
    -
    -
    - 今天 -
    访客
    -
    -
    -

    106,120

    -
    44% -
    - 新访客 -
    -
    -
    -
    -
    -
    - 最近一个月 -
    活跃用户
    -
    -
    -

    80,600

    -
    38% -
    - 12月 -
    -
    -
    -
    - -
    -
    -
    -
    -
    订单
    -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
      -
    • -

      2,346

      - 订单总数 -
      48% -
      -
      -
      -
      -
    • -
    • -

      4,422

      - 最近一个月订单 -
      60% -
      -
      -
      -
      -
    • -
    • -

      9,180

      - 最近一个月销售额 -
      22% -
      -
      -
      -
      -
    • -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    用户项目列表
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    状态日期用户
    进行中... - 11:20青衣5858 24%
    已取消 - 10:40徐子崴 66%
    进行中... - 01:30姜岚昕 54%
    进行中... - 02:20武汉大兵哥 12%
    进行中... - 09:40荆莹儿 22%
    已完成 - 04:10栾某某 66%
    进行中... - 12:08范范范二妮 23%
    -
    -
    -
    -
    -
    -
    - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/monitor/cache/cache.html b/ruoyi-admin/src/main/resources/templates/monitor/cache/cache.html deleted file mode 100644 index 38df336ac..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/cache/cache.html +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - -
    - -
    -
    -
    -
    -
    -
    缓存列表
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - -
    缓存名称操作
    [[${stat.index + 1}]][[${cacheName}]]
    -
    -
    -
    -
    -
    -
    -
    键名列表
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - -
    缓存键名操作
    [[${stat.index + 1}]][[${cacheKey}]]
    -
    -
    -
    -
    -
    -
    -
    缓存内容
    - -
    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html b/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html deleted file mode 100644 index 7b2df062f..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/logininfor/logininfor.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html b/ruoyi-admin/src/main/resources/templates/monitor/online/online.html deleted file mode 100644 index 88e5a543f..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html deleted file mode 100644 index 3ef3dd4d0..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html deleted file mode 100644 index 1022216af..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/monitor/server/server.html b/ruoyi-admin/src/main/resources/templates/monitor/server/server.html deleted file mode 100644 index 18c3315b1..000000000 --- a/ruoyi-admin/src/main/resources/templates/monitor/server/server.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
    -
    CPU
    -
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    属性
    核心数0个
    用户使用率0%
    系统使用率0%
    当前空闲率0%
    -
    -
    -
    - -
    -
    -
    -
    内存
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    属性内存JVM
    总内存0GB0MB
    已用内存0GB0MB
    剩余内存0GB0MB
    使用率[[${server.mem.usage}]]%[[${server.jvm.usage}]]%
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    服务器信息
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    服务器名称RuoYi操作系统Linux
    服务器IP127.0.0.1系统架构amd64
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    Java虚拟机信息
    - -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Java名称JavaJava版本1.8.0
    启动时间2018-12-31 00:00:00运行时长0天0时0分0秒
    安装路径
    项目路径
    运行参数
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    磁盘状态
    - -
    -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    盘符路径文件系统盘符类型总大小可用大小已用大小已用百分比
    C:\NTFSlocal0GB0GB0GB[[${sysFile.usage}]]%
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/register.html b/ruoyi-admin/src/main/resources/templates/register.html deleted file mode 100644 index dacc5209c..000000000 --- a/ruoyi-admin/src/main/resources/templates/register.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - 注册若依系统 - - - - - - - - - - - - - - -
    -
    -
    - -
    -
    -
    -

    注册:

    -

    你若不离不弃,我必生死相依

    - - - -
    -
    - -
    -
    - - - -
    -
    -
    - - 使用条款 -
    - -
    -
    -
    - -
    - - - - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/skin.html b/ruoyi-admin/src/main/resources/templates/skin.html deleted file mode 100644 index c25f24e42..000000000 --- a/ruoyi-admin/src/main/resources/templates/skin.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - 主题选择 - - - - - - - - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/config/add.html b/ruoyi-admin/src/main/resources/templates/system/config/add.html deleted file mode 100644 index fd718e6fe..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/config/add.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/config/config.html b/ruoyi-admin/src/main/resources/templates/system/config/config.html deleted file mode 100644 index 4f54c2229..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/config/config.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 参数名称: -
    • -
    • - 参数键名: -
    • -
    • - 系统内置: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/config/edit.html b/ruoyi-admin/src/main/resources/templates/system/config/edit.html deleted file mode 100644 index bff71221b..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/config/edit.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/add.html b/ruoyi-admin/src/main/resources/templates/system/dept/add.html deleted file mode 100644 index bc3739ee8..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dept/add.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/dept.html b/ruoyi-admin/src/main/resources/templates/system/dept/dept.html deleted file mode 100644 index 6663d1848..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dept/dept.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 部门名称: -
    • -
    • - 部门状态: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/edit.html b/ruoyi-admin/src/main/resources/templates/system/dept/edit.html deleted file mode 100644 index 46bfcb867..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dept/edit.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - -
    -
    - - -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dept/tree.html b/ruoyi-admin/src/main/resources/templates/system/dept/tree.html deleted file mode 100644 index a681811a7..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dept/tree.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - -
    - - -
    - -
    - 展开 / - 折叠 -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/data/add.html b/ruoyi-admin/src/main/resources/templates/system/dict/data/add.html deleted file mode 100644 index 068ddb260..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/data/add.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - table表格字典列显示样式属性 -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html b/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html deleted file mode 100644 index 917f51531..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 字典名称: -
    • -
    • - 字典标签: -
    • -
    • - 数据状态: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html b/ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html deleted file mode 100644 index a1a55531f..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/data/edit.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - table表格字典列显示样式属性 -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/type/add.html b/ruoyi-admin/src/main/resources/templates/system/dict/type/add.html deleted file mode 100644 index fe9fd8071..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/type/add.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 数据存储中的Key值,如:sys_user_sex -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html b/ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html deleted file mode 100644 index 82c33808c..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/type/edit.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - - 数据存储中的Key值,如:sys_user_sex -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html b/ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html deleted file mode 100644 index aae7d18e4..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/type/tree.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - -
    - - -
    - -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/type/type.html b/ruoyi-admin/src/main/resources/templates/system/dict/type/type.html deleted file mode 100644 index cfd18cb6a..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/dict/type/type.html +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 字典名称: -
    • -
    • - 字典类型: -
    • -
    • - 字典状态: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/add.html b/ruoyi-admin/src/main/resources/templates/system/menu/add.html deleted file mode 100644 index b9a6cb1d1..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/menu/add.html +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    - -
    - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 控制器中定义的权限标识,如:@RequiresPermissions("") -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    - -
    -
    -
    -
    - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/edit.html b/ruoyi-admin/src/main/resources/templates/system/menu/edit.html deleted file mode 100644 index d20194cea..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/menu/edit.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - -
    -
    - - -
    - -
    -
    - - -
    -
    -
    -
    - -
    - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 控制器中定义的权限标识,如:@RequiresPermissions("") -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    - -
    -
    -
    -
    - -
    -
    - - -
    -
    - -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/icon.html b/ruoyi-admin/src/main/resources/templates/system/menu/icon.html deleted file mode 100644 index 61cb177ba..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/menu/icon.html +++ /dev/null @@ -1,928 +0,0 @@ - - - - - Font Awesome Ico list - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html b/ruoyi-admin/src/main/resources/templates/system/menu/menu.html deleted file mode 100644 index 45baba914..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - -
    -
    -
    - -
    - - -
    -
    -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/tree.html b/ruoyi-admin/src/main/resources/templates/system/menu/tree.html deleted file mode 100644 index c578b1c72..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/menu/tree.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - -
    - - -
    - -
    - 展开 / - 折叠 -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/add.html b/ruoyi-admin/src/main/resources/templates/system/notice/add.html deleted file mode 100644 index 6a1a94b4d..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/notice/add.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/edit.html b/ruoyi-admin/src/main/resources/templates/system/notice/edit.html deleted file mode 100644 index 311d54bd6..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/notice/edit.html +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/notice.html b/ruoyi-admin/src/main/resources/templates/system/notice/notice.html deleted file mode 100644 index 4ad5c8950..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/notice/notice.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 公告标题: -
    • -
    • - 操作人员: -
    • -
    • - 公告类型: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/notice/view.html b/ruoyi-admin/src/main/resources/templates/system/notice/view.html deleted file mode 100644 index 38791c64a..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/notice/view.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -

    [[${notice.noticeTitle}]]

    -
    - 发送时间:[[${#dates.format(notice.createTime, 'yyyy-MM-dd HH:mm:ss')}]] - 发件人: [[${notice.createBy}]] -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/post/add.html b/ruoyi-admin/src/main/resources/templates/system/post/add.html deleted file mode 100644 index ac2d554f8..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/post/add.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/post/edit.html b/ruoyi-admin/src/main/resources/templates/system/post/edit.html deleted file mode 100644 index d3e84be28..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/post/edit.html +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/post/post.html b/ruoyi-admin/src/main/resources/templates/system/post/post.html deleted file mode 100644 index 52700770f..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/post/post.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 岗位编码: -
    • -
    • - 岗位名称: -
    • -
    • - 岗位状态: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/role/add.html b/ruoyi-admin/src/main/resources/templates/system/role/add.html deleted file mode 100644 index 216c13c4e..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/add.html +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 控制器中定义的权限字符,如:@RequiresRoles("") -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html b/ruoyi-admin/src/main/resources/templates/system/role/authUser.html deleted file mode 100644 index a3d087be6..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - -
    -
    -
    -
    - -
    - -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html b/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html deleted file mode 100644 index 2f3b0f751..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/dataScope.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - 特殊情况下,设置为“自定数据权限” -
    -
    -
    - -
    - - - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/role/edit.html b/ruoyi-admin/src/main/resources/templates/system/role/edit.html deleted file mode 100644 index d85f8ebbb..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/edit.html +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - - 控制器中定义的权限字符,如:@RequiresRoles("") -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/role/role.html b/ruoyi-admin/src/main/resources/templates/system/role/role.html deleted file mode 100644 index f464ea576..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/role.html +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 角色名称: -
    • -
    • - 权限字符: -
    • -
    • - 角色状态: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html b/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html deleted file mode 100644 index 018d8b81f..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/user/add.html b/ruoyi-admin/src/main/resources/templates/system/user/add.html deleted file mode 100644 index 017497763..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/add.html +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - -
    -
    - -

    基本信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -

    其他信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -   - -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/user/authRole.html b/ruoyi-admin/src/main/resources/templates/system/user/authRole.html deleted file mode 100644 index feaee5094..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/authRole.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - -
    -
    - -

    基本信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - -

    分配角色

    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -   - -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/user/deptTree.html b/ruoyi-admin/src/main/resources/templates/system/user/deptTree.html deleted file mode 100644 index 1286ba3a2..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/deptTree.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - -
    - - -
    - -
    - 展开 / - 折叠 -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/user/edit.html b/ruoyi-admin/src/main/resources/templates/system/user/edit.html deleted file mode 100644 index 74cc8d4f0..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/edit.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - -
    -
    - - -

    基本信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -

    其他信息

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -   - -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html deleted file mode 100644 index f64b96f28..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - -
    -
    -
    - -
    -
    - - - - - - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html deleted file mode 100644 index 4cb88b1ee..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/profile.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - -
    -
    -
    -
    -
    -
    个人资料
    -
    -
    -
    - -

    修改头像

    -
    -
      -
    • - 登录名称: -

      [[${user.loginName}]]

      -
    • -
    • - 手机号码: -

      [[${user.phonenumber}]]

      -
    • -
    • - 所属部门: -

      [[${user.dept?.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]

      -
    • -
    • - 邮箱地址: -

      [[${#strings.abbreviate(user.email, 16)}]]

      -
    • -
    • - 创建时间: -

      [[${#dates.format(user.createTime, 'yyyy-MM-dd')}]]

      -
    • -
    -
    -
    -
    - -
    -
    -
    -
    基本资料
    -
    -
    - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html deleted file mode 100644 index dfb4ee2a8..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - 密码只能为0-9数字 - 密码只能为a-z和A-Z字母 - 密码必须包含(字母,数字) - 密码必须包含(字母,数字,特殊字符!@#$%^&*()-=_+) - - - -
    -
    -
    - -
    - - 请再次输入您的密码 -
    -
    -
    -
    - - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html b/ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html deleted file mode 100644 index fb57bd88b..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/resetPwd.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - -
    -
    - -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - - - - - diff --git a/ruoyi-admin/src/main/resources/templates/system/user/user.html b/ruoyi-admin/src/main/resources/templates/system/user/user.html deleted file mode 100644 index a241941be..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/user.html +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - -
    -
    -
    -
    - 组织机构 -
    -
    - - - - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - -
    -
      -
    • - 登录名称: -
    • -
    • - 手机号码: -
    • -
    • - 用户状态: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    -
    - - - - - - - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/user/view.html b/ruoyi-admin/src/main/resources/templates/system/user/view.html deleted file mode 100644 index d3d17716f..000000000 --- a/ruoyi-admin/src/main/resources/templates/system/user/view.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - -
    -
    -

    基本信息

    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    [[${#strings.defaultString(postGroup, '无岗位')}]]

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    [[${#strings.defaultString(roleGroup, '无角色')}]]

    -
    -
    -
    -
    -

    其他信息

    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    -
    - -
    -

    -
    -
    -
    -
    -
    -
    - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/tool/build/build.html b/ruoyi-admin/src/main/resources/templates/tool/build/build.html deleted file mode 100644 index b60c9eb36..000000000 --- a/ruoyi-admin/src/main/resources/templates/tool/build/build.html +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - -
    -
    -
    -
    -
    -
    元素
    -
    - - - - - - - - - - -
    -
    -
    -
    - 拖拽左侧的表单元素到右侧区域,即可生成相应的HTML代码,表单代码,轻松搞定! -
    -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -

    这里是纯文字信息

    -
    -
    -
    - - -
    - - -
    -
    -
    - - -
    - - - -
    -
    -
    - - -
    - -
    -
    -
    - - -
    -
    - - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    拖拽左侧表单元素到此区域
    -
    - 请选择显示的列数: - -
    -
    - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    - - - - - - - diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 8806c451e..38326a1fa 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 4.7.8 + 3.8.7 4.0.0 @@ -29,16 +29,10 @@ spring-web - + - org.apache.shiro - shiro-core - - - - - org.apache.shiro - shiro-ehcache + org.springframework.boot + spring-boot-starter-security @@ -58,17 +52,24 @@ org.apache.commons commons-lang3 - + com.fasterxml.jackson.core jackson-databind + + + + com.baomidou + dynamic-datasource-spring-boot-starter + 3.5.2 + - com.alibaba - fastjson + com.alibaba.fastjson2 + fastjson2 @@ -89,6 +90,36 @@ snakeyaml + + + io.jsonwebtoken + jjwt + + + + + javax.xml.bind + jaxb-api + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + org.apache.commons + commons-pool2 + + + + + eu.bitwalker + UserAgentUtils + + javax.servlet diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java index d3115328e..cebe592c6 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/DataScope.java @@ -27,7 +27,7 @@ public @interface DataScope public String userAlias() default ""; /** - * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@RequiresPermissions获取,多个权限用逗号分隔开来 + * 权限字符(用于多个角色匹配符合要求的权限)默认根据权限注解@ss获取,多个权限用逗号分隔开来 */ public String permission() default ""; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java index 8c6870c20..1f1cc81bf 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excels.java @@ -14,5 +14,5 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface Excels { - Excel[] value(); -} \ No newline at end of file + public Excel[] value(); +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java index 18fd2313d..5ae846a1a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Log.java @@ -12,6 +12,7 @@ import com.ruoyi.common.enums.OperatorType; * 自定义操作日志记录注解 * * @author ruoyi + * */ @Target({ ElementType.PARAMETER, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java new file mode 100644 index 000000000..0f024c7d4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RateLimiter.java @@ -0,0 +1,40 @@ +package com.ruoyi.common.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.enums.LimitType; + +/** + * 限流注解 + * + * @author ruoyi + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RateLimiter +{ + /** + * 限流key + */ + public String key() default CacheConstants.RATE_LIMIT_KEY; + + /** + * 限流时间,单位秒 + */ + public int time() default 60; + + /** + * 限流次数 + */ + public int count() default 100; + + /** + * 限流类型 + */ + public LimitType limitType() default LimitType.DEFAULT; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java index 3e06e9584..b76974819 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/RepeatSubmit.java @@ -2,6 +2,7 @@ package com.ruoyi.common.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -12,6 +13,7 @@ import java.lang.annotation.Target; * @author ruoyi * */ +@Inherited @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @Documented @@ -25,5 +27,5 @@ public @interface RepeatSubmit /** * 提示消息 */ - public String message() default "不允许重复提交,请稍后再试"; -} \ No newline at end of file + public String message() default "不允许重复提交,请稍候再试"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java index cee48bcac..eac3da152 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java @@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; /** - * 全局配置类 + * 读取项目相关配置 * * @author ruoyi */ @@ -13,16 +13,13 @@ import org.springframework.stereotype.Component; public class RuoYiConfig { /** 项目名称 */ - private static String name; + private String name; /** 版本 */ - private static String version; + private String version; /** 版权年份 */ - private static String copyrightYear; - - /** 实例演示开关 */ - private static boolean demoEnabled; + private String copyrightYear; /** 上传路径 */ private static String profile; @@ -30,44 +27,37 @@ public class RuoYiConfig /** 获取地址开关 */ private static boolean addressEnabled; - public static String getName() + /** 验证码类型 */ + private static String captchaType; + + public String getName() { return name; } public void setName(String name) { - RuoYiConfig.name = name; + this.name = name; } - public static String getVersion() + public String getVersion() { return version; } public void setVersion(String version) { - RuoYiConfig.version = version; + this.version = version; } - public static String getCopyrightYear() + public String getCopyrightYear() { return copyrightYear; } public void setCopyrightYear(String copyrightYear) { - RuoYiConfig.copyrightYear = copyrightYear; - } - - public static boolean isDemoEnabled() - { - return demoEnabled; - } - - public void setDemoEnabled(boolean demoEnabled) - { - RuoYiConfig.demoEnabled = demoEnabled; + this.copyrightYear = copyrightYear; } public static String getProfile() @@ -90,6 +80,14 @@ public class RuoYiConfig RuoYiConfig.addressEnabled = addressEnabled; } + public static String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + RuoYiConfig.captchaType = captchaType; + } + /** * 获取导入上传路径 */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java index 02241c5a2..e819a1d7b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/serializer/SensitiveJsonSerializer.java @@ -9,9 +9,9 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.ruoyi.common.annotation.Sensitive; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.DesensitizedType; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; /** * 数据脱敏序列化过滤 @@ -53,12 +53,15 @@ public class SensitiveJsonSerializer extends JsonSerializer implements C */ private boolean desensitization() { - SysUser securityUser = ShiroUtils.getSysUser(); - if (securityUser == null) + try + { + LoginUser securityUser = SecurityUtils.getLoginUser(); + // 管理员不脱敏 + return !securityUser.getUser().isAdmin(); + } + catch (Exception e) { return true; } - // 管理员不脱敏 - return !securityUser.isAdmin(); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java new file mode 100644 index 000000000..0080343a9 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/CacheConstants.java @@ -0,0 +1,44 @@ +package com.ruoyi.common.constant; + +/** + * 缓存的key 常量 + * + * @author ruoyi + */ +public class CacheConstants +{ + /** + * 登录用户 redis key + */ + public static final String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 验证码 redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 参数管理 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 字典管理 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 防重提交 redis key + */ + public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 限流 redis key + */ + public static final String RATE_LIMIT_KEY = "rate_limit:"; + + /** + * 登录账户密码错误次数 redis key + */ + public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 9da01ab4f..a94c3fa35 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -1,6 +1,7 @@ package com.ruoyi.common.constant; import java.util.Locale; +import io.jsonwebtoken.Claims; /** * 通用常量信息 @@ -24,6 +25,11 @@ public class Constants */ public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE; + /** + * www主域 + */ + public static final String WWW = "www."; + /** * http请求 */ @@ -65,29 +71,69 @@ public class Constants public static final String LOGIN_FAIL = "Error"; /** - * 系统用户授权缓存 + * 所有权限标识 */ - public static final String SYS_AUTH_CACHE = "sys-authCache"; + public static final String ALL_PERMISSION = "*:*:*"; /** - * 参数管理 cache name + * 管理员角色权限标识 */ - public static final String SYS_CONFIG_CACHE = "sys-config"; + public static final String SUPER_ADMIN = "admin"; /** - * 参数管理 cache key + * 角色权限分隔符 */ - public static final String SYS_CONFIG_KEY = "sys_config:"; + public static final String ROLE_DELIMETER = ","; /** - * 字典管理 cache name + * 权限标识分隔符 */ - public static final String SYS_DICT_CACHE = "sys-dict"; + public static final String PERMISSION_DELIMETER = ","; /** - * 字典管理 cache key + * 验证码有效期(分钟) */ - public static final String SYS_DICT_KEY = "sys_dict:"; + public static final Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + public static final String TOKEN = "token"; + + /** + * 令牌前缀 + */ + public static final String TOKEN_PREFIX = "Bearer "; + + /** + * 令牌前缀 + */ + public static final String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + public static final String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + public static final String JWT_USERNAME = Claims.SUBJECT; + + /** + * 用户头像 + */ + public static final String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + public static final String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + public static final String JWT_AUTHORITIES = "authorities"; /** * 资源映射路径 前缀 @@ -109,6 +155,11 @@ public class Constants */ public static final String LOOKUP_LDAPS = "ldaps:"; + /** + * 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全) + */ + public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" }; + /** * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加) */ @@ -119,4 +170,4 @@ 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.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" }; -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java index d5fa65e14..e7382b3f1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/GenConstants.java @@ -59,7 +59,7 @@ public class GenConstants public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; /** Tree基类字段 */ - public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" }; + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" }; /** 文本框 */ public static final String HTML_INPUT = "input"; @@ -79,11 +79,14 @@ public class GenConstants /** 日期控件 */ public static final String HTML_DATETIME = "datetime"; - /** 上传控件 */ - public static final String HTML_UPLOAD = "upload"; + /** 图片上传控件 */ + public static final String HTML_IMAGE_UPLOAD = "imageUpload"; + + /** 文件上传控件 */ + public static final String HTML_FILE_UPLOAD = "fileUpload"; /** 富文本控件 */ - public static final String HTML_SUMMERNOTE = "summernote"; + public static final String HTML_EDITOR = "editor"; /** 字符串类型 */ public static final String TYPE_STRING = "String"; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java new file mode 100644 index 000000000..a983c77ec --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/HttpStatus.java @@ -0,0 +1,94 @@ +package com.ruoyi.common.constant; + +/** + * 返回状态码 + * + * @author ruoyi + */ +public class HttpStatus +{ + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + + /** + * 对象创建成功 + */ + public static final int CREATED = 201; + + /** + * 请求已经被接受 + */ + public static final int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + public static final int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + public static final int MOVED_PERM = 301; + + /** + * 重定向 + */ + public static final int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + public static final int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + public static final int BAD_REQUEST = 400; + + /** + * 未授权 + */ + public static final int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + public static final int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + public static final int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + public static final int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + public static final int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + public static final int ERROR = 500; + + /** + * 接口未实现 + */ + public static final int NOT_IMPLEMENTED = 501; + + /** + * 系统警告消息 + */ + public static final int WARN = 601; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java deleted file mode 100644 index 7caf18542..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/PermissionConstants.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * 权限通用常量 - * - * @author ruoyi - */ -public class PermissionConstants -{ - /** 新增权限 */ - public static final String ADD_PERMISSION = "add"; - - /** 修改权限 */ - public static final String EDIT_PERMISSION = "edit"; - - /** 删除权限 */ - public static final String REMOVE_PERMISSION = "remove"; - - /** 导出权限 */ - public static final String EXPORT_PERMISSION = "export"; - - /** 显示权限 */ - public static final String VIEW_PERMISSION = "view"; - - /** 查询权限 */ - public static final String LIST_PERMISSION = "list"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java deleted file mode 100644 index 239d36fc7..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ShiroConstants.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ruoyi.common.constant; - -/** - * Shiro通用常量 - * - * @author ruoyi - */ -public class ShiroConstants -{ - /** - * 当前登录的用户 - */ - public static final String CURRENT_USER = "currentUser"; - - /** - * 用户名字段 - */ - public static final String CURRENT_USERNAME = "username"; - - /** - * 锁定屏幕字段 - */ - public static final String LOCK_SCREEN = "lockscreen"; - - /** - * 消息key - */ - public static final String MESSAGE = "message"; - - /** - * 错误key - */ - public static final String ERROR = "errorMsg"; - - /** - * 编码格式 - */ - public static final String ENCODING = "UTF-8"; - - /** - * 当前在线会话 - */ - public static final String ONLINE_SESSION = "online_session"; - - /** - * 验证码key - */ - public static final String CURRENT_CAPTCHA = "captcha"; - - /** - * 验证码开关 - */ - public static final String CURRENT_ENABLED = "captchaEnabled"; - - /** - * 验证码类型 - */ - public static final String CURRENT_TYPE = "captchaType"; - - /** - * 验证码 - */ - public static final String CURRENT_VALIDATECODE = "validateCode"; - - /** - * 验证码错误 - */ - public static final String CAPTCHA_ERROR = "captchaError"; - - /** - * 登录记录缓存 - */ - public static final String LOGIN_RECORD_CACHE = "loginRecordCache"; - - /** - * 系统活跃用户缓存 - */ - public static final String SYS_USERCACHE = "sys-userCache"; -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index 90779ca2e..b09b6f3d5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -35,8 +35,32 @@ public class UserConstants /** 是否为系统默认(是) */ public static final String YES = "Y"; + + /** 是否菜单外链(是) */ + public static final String YES_FRAME = "0"; + + /** 是否菜单外链(否) */ + public static final String NO_FRAME = "1"; + + /** 菜单类型(目录) */ + public static final String TYPE_DIR = "M"; + + /** 菜单类型(菜单) */ + public static final String TYPE_MENU = "C"; + + /** 菜单类型(按钮) */ + public static final String TYPE_BUTTON = "F"; + + /** Layout组件标识 */ + public final static String LAYOUT = "Layout"; - /** 是否唯一的返回标识 */ + /** ParentView组件标识 */ + public final static String PARENT_VIEW = "ParentView"; + + /** InnerLink组件标识 */ + public final static String INNER_LINK = "InnerLink"; + + /** 校验是否唯一的返回标识 */ public final static boolean UNIQUE = true; public final static boolean NOT_UNIQUE = false; @@ -51,20 +75,4 @@ public class UserConstants */ public static final int PASSWORD_MIN_LENGTH = 5; public static final int PASSWORD_MAX_LENGTH = 20; - - /** - * 用户类型 - */ - public static final String SYSTEM_USER_TYPE = "00"; - public static final String REGISTER_USER_TYPE = "01"; - - /** - * 手机号码格式限制 - */ - public static final String MOBILE_PHONE_NUMBER_PATTERN = "^0{0,1}(13[0-9]|15[0-9]|14[0-9]|18[0-9])[0-9]{8}$"; - - /** - * 邮箱格式限制 - */ - public static final String EMAIL_PATTERN = "^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index c2985040a..c131bc478 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -3,25 +3,21 @@ package com.ruoyi.common.core.controller; import java.beans.PropertyEditorSupport; import java.util.Date; import java.util.List; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; 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.constant.HttpStatus; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.AjaxResult.Type; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.PageUtils; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.sql.SqlUtil; @@ -80,30 +76,6 @@ public class BaseController PageUtils.clearPage(); } - /** - * 获取request - */ - public HttpServletRequest getRequest() - { - return ServletUtils.getRequest(); - } - - /** - * 获取response - */ - public HttpServletResponse getResponse() - { - return ServletUtils.getResponse(); - } - - /** - * 获取session - */ - public HttpSession getSession() - { - return getRequest().getSession(); - } - /** * 响应请求分页数据 */ @@ -111,34 +83,13 @@ public class BaseController protected TableDataInfo getDataTable(List list) { TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(0); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); rspData.setRows(list); rspData.setTotal(new PageInfo(list).getTotal()); return rspData; } - /** - * 响应返回结果 - * - * @param rows 影响行数 - * @return 操作结果 - */ - protected AjaxResult toAjax(int rows) - { - return rows > 0 ? success() : error(); - } - - /** - * 响应返回结果 - * - * @param result 结果 - * @return 操作结果 - */ - protected AjaxResult toAjax(boolean result) - { - return result ? success() : error(); - } - /** * 返回成功 */ @@ -162,13 +113,13 @@ public class BaseController { return AjaxResult.success(message); } - + /** - * 返回成功数据 + * 返回成功消息 */ - public static AjaxResult success(Object data) + public AjaxResult success(Object data) { - return AjaxResult.success("操作成功", data); + return AjaxResult.success(data); } /** @@ -180,11 +131,33 @@ public class BaseController } /** - * 返回错误码消息 + * 返回警告消息 */ - public AjaxResult error(Type type, String message) + public AjaxResult warn(String message) { - return new AjaxResult(type, message); + return AjaxResult.warn(message); + } + + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(int rows) + { + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + } + + /** + * 响应返回结果 + * + * @param result 结果 + * @return 操作结果 + */ + protected AjaxResult toAjax(boolean result) + { + return result ? success() : error(); } /** @@ -198,17 +171,9 @@ public class BaseController /** * 获取用户缓存信息 */ - public SysUser getSysUser() + public LoginUser getLoginUser() { - return ShiroUtils.getSysUser(); - } - - /** - * 设置用户缓存信息 - */ - public void setSysUser(SysUser user) - { - ShiroUtils.setSysUser(user); + return SecurityUtils.getLoginUser(); } /** @@ -216,14 +181,22 @@ public class BaseController */ public Long getUserId() { - return getSysUser().getUserId(); + return getLoginUser().getUserId(); + } + + /** + * 获取登录部门id + */ + public Long getDeptId() + { + return getLoginUser().getDeptId(); } /** * 获取登录用户名 */ - public String getLoginName() + public String getUsername() { - return getSysUser().getLoginName(); + return getLoginUser().getUsername(); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index 1f59cbcb9..42dcbcded 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -2,11 +2,12 @@ package com.ruoyi.common.core.domain; import java.util.HashMap; import java.util.Objects; +import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.utils.StringUtils; /** * 操作消息提醒 - * + * * @author ruoyi */ public class AjaxResult extends HashMap @@ -22,30 +23,6 @@ public class AjaxResult extends HashMap /** 数据对象 */ public static final String DATA_TAG = "data"; - /** - * 状态类型 - */ - public enum Type - { - /** 成功 */ - SUCCESS(0), - /** 警告 */ - WARN(301), - /** 错误 */ - ERROR(500); - private final int value; - - Type(int value) - { - this.value = value; - } - - public int value() - { - return this.value; - } - } - /** * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 */ @@ -55,26 +32,26 @@ public class AjaxResult extends HashMap /** * 初始化一个新创建的 AjaxResult 对象 - * - * @param type 状态类型 + * + * @param code 状态码 * @param msg 返回内容 */ - public AjaxResult(Type type, String msg) + public AjaxResult(int code, String msg) { - super.put(CODE_TAG, type.value); + super.put(CODE_TAG, code); super.put(MSG_TAG, msg); } /** * 初始化一个新创建的 AjaxResult 对象 - * - * @param type 状态类型 + * + * @param code 状态码 * @param msg 返回内容 * @param data 数据对象 */ - public AjaxResult(Type type, String msg, Object data) + public AjaxResult(int code, String msg, Object data) { - super.put(CODE_TAG, type.value); + super.put(CODE_TAG, code); super.put(MSG_TAG, msg); if (StringUtils.isNotNull(data)) { @@ -84,7 +61,7 @@ public class AjaxResult extends HashMap /** * 返回成功消息 - * + * * @return 成功消息 */ public static AjaxResult success() @@ -94,7 +71,7 @@ public class AjaxResult extends HashMap /** * 返回成功数据 - * + * * @return 成功消息 */ public static AjaxResult success(Object data) @@ -104,7 +81,7 @@ public class AjaxResult extends HashMap /** * 返回成功消息 - * + * * @param msg 返回内容 * @return 成功消息 */ @@ -115,14 +92,14 @@ public class AjaxResult extends HashMap /** * 返回成功消息 - * + * * @param msg 返回内容 * @param data 数据对象 * @return 成功消息 */ public static AjaxResult success(String msg, Object data) { - return new AjaxResult(Type.SUCCESS, msg, data); + return new AjaxResult(HttpStatus.SUCCESS, msg, data); } /** @@ -145,13 +122,13 @@ public class AjaxResult extends HashMap */ public static AjaxResult warn(String msg, Object data) { - return new AjaxResult(Type.WARN, msg, data); + return new AjaxResult(HttpStatus.WARN, msg, data); } /** * 返回错误消息 - * - * @return + * + * @return 错误消息 */ public static AjaxResult error() { @@ -160,9 +137,9 @@ public class AjaxResult extends HashMap /** * 返回错误消息 - * + * * @param msg 返回内容 - * @return 警告消息 + * @return 错误消息 */ public static AjaxResult error(String msg) { @@ -171,14 +148,26 @@ public class AjaxResult extends HashMap /** * 返回错误消息 - * + * * @param msg 返回内容 * @param data 数据对象 - * @return 警告消息 + * @return 错误消息 */ public static AjaxResult error(String msg, Object data) { - return new AjaxResult(Type.ERROR, msg, data); + return new AjaxResult(HttpStatus.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 错误消息 + */ + public static AjaxResult error(int code, String msg) + { + return new AjaxResult(code, msg, null); } /** @@ -188,7 +177,7 @@ public class AjaxResult extends HashMap */ public boolean isSuccess() { - return Objects.equals(Type.SUCCESS.value, this.get(CODE_TAG)); + return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG)); } /** @@ -198,7 +187,7 @@ public class AjaxResult extends HashMap */ public boolean isWarn() { - return Objects.equals(Type.WARN.value, this.get(CODE_TAG)); + return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG)); } /** @@ -208,7 +197,7 @@ public class AjaxResult extends HashMap */ public boolean isError() { - return Objects.equals(Type.ERROR.value, this.get(CODE_TAG)); + return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG)); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java deleted file mode 100644 index 28c123520..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/CxSelect.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.io.Serializable; -import java.util.List; - -/** - * CxSelect树结构实体类 - * - * @author ruoyi - */ -public class CxSelect implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** - * 数据值字段名称 - */ - private String v; - - /** - * 数据标题字段名称 - */ - private String n; - - /** - * 子集数据字段名称 - */ - private List s; - - public CxSelect() - { - } - - public CxSelect(String v, String n) - { - this.v = v; - this.n = n; - } - - public List getS() - { - return s; - } - - public void setN(String n) - { - this.n = n; - } - - public String getN() - { - return n; - } - - public void setS(List s) - { - this.s = s; - } - - public String getV() - { - return v; - } - - public void setV(String v) - { - this.v = v; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java index 835f68b86..e0626d0ce 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/R.java @@ -1,6 +1,7 @@ package com.ruoyi.common.core.domain; import java.io.Serializable; +import com.ruoyi.common.constant.HttpStatus; /** * 响应信息主体 @@ -12,10 +13,10 @@ public class R implements Serializable private static final long serialVersionUID = 1L; /** 成功 */ - public static final int SUCCESS = 0; + public static final int SUCCESS = HttpStatus.SUCCESS; /** 失败 */ - public static final int FAIL = 500; + public static final int FAIL = HttpStatus.ERROR; private int code; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java index 7a0efe62a..171f04c9b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeEntity.java @@ -1,5 +1,8 @@ package com.ruoyi.common.core.domain; +import java.util.ArrayList; +import java.util.List; + /** * Tree基类 * @@ -21,6 +24,9 @@ public class TreeEntity extends BaseEntity /** 祖级列表 */ private String ancestors; + /** 子部门 */ + private List children = new ArrayList<>(); + public String getParentName() { return parentName; @@ -60,4 +66,14 @@ public class TreeEntity extends BaseEntity { this.ancestors = ancestors; } -} \ No newline at end of file + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java new file mode 100644 index 000000000..bd835db99 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java @@ -0,0 +1,77 @@ +package com.ruoyi.common.core.domain; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysMenu; + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelect implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private Long id; + + /** 节点名称 */ + private String label; + + /** 子节点 */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelect() + { + + } + + public TreeSelect(SysDept dept) + { + this.id = dept.getDeptId(); + this.label = dept.getDeptName(); + this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public TreeSelect(SysMenu menu) + { + this.id = menu.getMenuId(); + this.label = menu.getMenuName(); + this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public String getLabel() + { + return label; + } + + public void setLabel(String label) + { + this.label = label; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java deleted file mode 100644 index e7fe780e4..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.ruoyi.common.core.domain; - -import java.io.Serializable; - -/** - * Ztree树结构实体类 - * - * @author ruoyi - */ -public class Ztree implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 节点ID */ - private Long id; - - /** 节点父ID */ - private Long pId; - - /** 节点名称 */ - private String name; - - /** 节点标题 */ - private String title; - - /** 是否勾选 */ - private boolean checked = false; - - /** 是否展开 */ - private boolean open = false; - - /** 是否能勾选 */ - private boolean nocheck = false; - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getpId() - { - return pId; - } - - public void setpId(Long pId) - { - this.pId = pId; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getTitle() - { - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public boolean isChecked() - { - return checked; - } - - public void setChecked(boolean checked) - { - this.checked = checked; - } - - public boolean isOpen() - { - return open; - } - - public void setOpen(boolean open) - { - this.open = open; - } - - public boolean isNocheck() - { - return nocheck; - } - - public void setNocheck(boolean nocheck) - { - this.nocheck = nocheck; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java index a3a25d09d..693461b9f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDept.java @@ -1,12 +1,13 @@ package com.ruoyi.common.core.domain.entity; +import java.util.ArrayList; +import java.util.List; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.ruoyi.common.core.domain.BaseEntity; /** @@ -50,9 +51,9 @@ public class SysDept extends BaseEntity /** 父部门名称 */ private String parentName; - - /** 排除编号 */ - private Long excludeId; + + /** 子部门 */ + private List children = new ArrayList(); public Long getDeptId() { @@ -170,15 +171,14 @@ public class SysDept extends BaseEntity this.parentName = parentName; } - @JsonIgnore - public Long getExcludeId() + public List getChildren() { - return excludeId; + return children; } - public void setExcludeId(Long excludeId) + public void setChildren(List children) { - this.excludeId = excludeId; + this.children = children; } @Override diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java index 404c14bb1..e79eaa20c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictData.java @@ -1,6 +1,7 @@ package com.ruoyi.common.core.domain.entity; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -38,7 +39,6 @@ public class SysDictData extends BaseEntity private String dictType; /** 样式属性(其他样式扩展) */ - @Excel(name = "字典样式") private String cssClass; /** 表格字典样式 */ @@ -153,7 +153,7 @@ public class SysDictData extends BaseEntity { this.status = status; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java index 1ce61a824..0befbf434 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysDictType.java @@ -1,6 +1,8 @@ package com.ruoyi.common.core.domain.entity; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -76,7 +78,7 @@ public class SysDictType extends BaseEntity { this.status = status; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index da1869a5c..9f3a6f659 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -1,8 +1,10 @@ package com.ruoyi.common.core.domain.entity; -import java.util.List; import java.util.ArrayList; -import javax.validation.constraints.*; +import java.util.List; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.domain.BaseEntity; @@ -29,22 +31,31 @@ public class SysMenu extends BaseEntity private Long parentId; /** 显示顺序 */ - private String orderNum; + private Integer orderNum; - /** 菜单URL */ - private String url; + /** 路由地址 */ + private String path; - /** 打开方式(menuItem页签 menuBlank新窗口) */ - private String target; + /** 组件路径 */ + private String component; + + /** 路由参数 */ + private String query; + + /** 是否为外链(0是 1否) */ + private String isFrame; + + /** 是否缓存(0缓存 1不缓存) */ + private String isCache; /** 类型(M目录 C菜单 F按钮) */ private String menuType; - /** 菜单状态(0显示 1隐藏) */ + /** 显示状态(0显示 1隐藏) */ private String visible; - - /** 是否刷新(0刷新 1不刷新) */ - private String isRefresh; + + /** 菜单状态(0正常 1停用) */ + private String status; /** 权限字符串 */ private String perms; @@ -97,36 +108,67 @@ public class SysMenu extends BaseEntity this.parentId = parentId; } - @NotBlank(message = "显示顺序不能为空") - public String getOrderNum() + @NotNull(message = "显示顺序不能为空") + public Integer getOrderNum() { return orderNum; } - public void setOrderNum(String orderNum) + public void setOrderNum(Integer orderNum) { this.orderNum = orderNum; } - @Size(min = 0, max = 200, message = "请求地址不能超过200个字符") - public String getUrl() + @Size(min = 0, max = 200, message = "路由地址不能超过200个字符") + public String getPath() { - return url; + return path; } - public void setUrl(String url) + public void setPath(String path) { - this.url = url; + this.path = path; } - public String getTarget() + @Size(min = 0, max = 200, message = "组件路径不能超过255个字符") + public String getComponent() { - return target; + return component; } - public void setTarget(String target) + public void setComponent(String component) { - this.target = target; + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public String getIsFrame() + { + return isFrame; + } + + public void setIsFrame(String isFrame) + { + this.isFrame = isFrame; + } + + public String getIsCache() + { + return isCache; + } + + public void setIsCache(String isCache) + { + this.isCache = isCache; } @NotBlank(message = "菜单类型不能为空") @@ -150,14 +192,14 @@ public class SysMenu extends BaseEntity this.visible = visible; } - public String getIsRefresh() + public String getStatus() { - return isRefresh; + return status; } - public void setIsRefresh(String isRefresh) + public void setStatus(String status) { - this.isRefresh = isRefresh; + this.status = status; } @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符") @@ -190,7 +232,7 @@ public class SysMenu extends BaseEntity { this.children = children; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -198,10 +240,13 @@ public class SysMenu extends BaseEntity .append("menuName", getMenuName()) .append("parentId", getParentId()) .append("orderNum", getOrderNum()) - .append("url", getUrl()) - .append("target", getTarget()) + .append("path", getPath()) + .append("component", getComponent()) + .append("isFrame", getIsFrame()) + .append("IsCache", getIsCache()) .append("menuType", getMenuType()) .append("visible", getVisible()) + .append("status ", getStatus()) .append("perms", getPerms()) .append("icon", getIcon()) .append("createBy", getCreateBy()) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 03aa3b0ac..2396f8022 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -1,7 +1,9 @@ package com.ruoyi.common.core.domain.entity; import java.util.Set; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -30,13 +32,19 @@ public class SysRole extends BaseEntity private String roleKey; /** 角色排序 */ - @Excel(name = "角色排序", cellType = ColumnType.NUMERIC) - private String roleSort; + @Excel(name = "角色排序") + private Integer roleSort; /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */ @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限") private String dataScope; + /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */ + private boolean menuCheckStrictly; + + /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */ + private boolean deptCheckStrictly; + /** 角色状态(0正常 1停用) */ @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用") private String status; @@ -86,16 +94,6 @@ public class SysRole extends BaseEntity return roleId != null && 1L == roleId; } - public String getDataScope() - { - return dataScope; - } - - public void setDataScope(String dataScope) - { - this.dataScope = dataScope; - } - @NotBlank(message = "角色名称不能为空") @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符") public String getRoleName() @@ -120,22 +118,57 @@ public class SysRole extends BaseEntity this.roleKey = roleKey; } - @NotBlank(message = "显示顺序不能为空") - public String getRoleSort() + @NotNull(message = "显示顺序不能为空") + public Integer getRoleSort() { return roleSort; } - public void setRoleSort(String roleSort) + public void setRoleSort(Integer roleSort) { this.roleSort = roleSort; } + public String getDataScope() + { + return dataScope; + } + + public void setDataScope(String dataScope) + { + this.dataScope = dataScope; + } + + public boolean isMenuCheckStrictly() + { + return menuCheckStrictly; + } + + public void setMenuCheckStrictly(boolean menuCheckStrictly) + { + this.menuCheckStrictly = menuCheckStrictly; + } + + public boolean isDeptCheckStrictly() + { + return deptCheckStrictly; + } + + public void setDeptCheckStrictly(boolean deptCheckStrictly) + { + this.deptCheckStrictly = deptCheckStrictly; + } + public String getStatus() { return status; } + public void setStatus(String status) + { + this.status = status; + } + public String getDelFlag() { return delFlag; @@ -146,11 +179,6 @@ public class SysRole extends BaseEntity this.delFlag = delFlag; } - public void setStatus(String status) - { - this.status = status; - } - public boolean isFlag() { return flag; @@ -199,6 +227,8 @@ public class SysRole extends BaseEntity .append("roleKey", getRoleKey()) .append("roleSort", getRoleSort()) .append("dataScope", getDataScope()) + .append("menuCheckStrictly", isMenuCheckStrictly()) + .append("deptCheckStrictly", isDeptCheckStrictly()) .append("status", getStatus()) .append("delFlag", getDelFlag()) .append("createBy", getCreateBy()) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java index 15c1dead2..4e04642d0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java @@ -5,7 +5,6 @@ import java.util.List; import javax.validation.constraints.*; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.annotation.Excel.Type; @@ -30,22 +29,13 @@ public class SysUser extends BaseEntity @Excel(name = "部门编号", type = Type.IMPORT) private Long deptId; - /** 部门父ID */ - private Long parentId; - - /** 角色ID */ - private Long roleId; - - /** 登录名称 */ + /** 用户账号 */ @Excel(name = "登录名称") - private String loginName; - - /** 用户名称 */ - @Excel(name = "用户名称") private String userName; - /** 用户类型 */ - private String userType; + /** 用户昵称 */ + @Excel(name = "用户名称") + private String nickName; /** 用户邮箱 */ @Excel(name = "用户邮箱") @@ -65,9 +55,6 @@ public class SysUser extends BaseEntity /** 密码 */ private String password; - /** 盐加密 */ - private String salt; - /** 帐号状态(0正常 1停用) */ @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") private String status; @@ -83,9 +70,6 @@ public class SysUser extends BaseEntity @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) private Date loginDate; - /** 密码最后更新时间 */ - private Date pwdUpdateDate; - /** 部门对象 */ @Excels({ @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), @@ -93,6 +77,7 @@ public class SysUser extends BaseEntity }) private SysDept dept; + /** 角色对象 */ private List roles; /** 角色组 */ @@ -101,6 +86,9 @@ public class SysUser extends BaseEntity /** 岗位组 */ private Long[] postIds; + /** 角色ID */ + private Long roleId; + public SysUser() { @@ -141,41 +129,21 @@ public class SysUser extends BaseEntity this.deptId = deptId; } - public Long getParentId() - { - return parentId; - } - - public void setParentId(Long parentId) - { - this.parentId = parentId; - } - - public Long getRoleId() - { - return roleId; - } - - public void setRoleId(Long roleId) - { - this.roleId = roleId; - } - - @Xss(message = "登录账号不能包含脚本字符") - @NotBlank(message = "登录账号不能为空") - @Size(min = 0, max = 30, message = "登录账号长度不能超过30个字符") - public String getLoginName() - { - return loginName; - } - - public void setLoginName(String loginName) - { - this.loginName = loginName; - } - @Xss(message = "用户昵称不能包含脚本字符") @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + public String getNickName() + { + return nickName; + } + + public void setNickName(String nickName) + { + this.nickName = nickName; + } + + @Xss(message = "用户账号不能包含脚本字符") + @NotBlank(message = "用户账号不能为空") + @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") public String getUserName() { return userName; @@ -186,16 +154,6 @@ public class SysUser extends BaseEntity this.userName = userName; } - public String getUserType() - { - return userType; - } - - public void setUserType(String userType) - { - this.userType = userType; - } - @Email(message = "邮箱格式不正确") @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") public String getEmail() @@ -239,7 +197,6 @@ public class SysUser extends BaseEntity this.avatar = avatar; } - @JsonIgnore public String getPassword() { return password; @@ -250,17 +207,6 @@ public class SysUser extends BaseEntity this.password = password; } - @JsonIgnore - public String getSalt() - { - return salt; - } - - public void setSalt(String salt) - { - this.salt = salt; - } - public String getStatus() { return status; @@ -301,22 +247,8 @@ public class SysUser extends BaseEntity this.loginDate = loginDate; } - public Date getPwdUpdateDate() - { - return pwdUpdateDate; - } - - public void setPwdUpdateDate(Date pwdUpdateDate) - { - this.pwdUpdateDate = pwdUpdateDate; - } - public SysDept getDept() { - if (dept == null) - { - dept = new SysDept(); - } return dept; } @@ -355,20 +287,28 @@ public class SysUser extends BaseEntity this.postIds = postIds; } + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("userId", getUserId()) .append("deptId", getDeptId()) - .append("loginName", getLoginName()) .append("userName", getUserName()) - .append("userType", getUserType()) + .append("nickName", getNickName()) .append("email", getEmail()) .append("phonenumber", getPhonenumber()) .append("sex", getSex()) .append("avatar", getAvatar()) .append("password", getPassword()) - .append("salt", getSalt()) .append("status", getStatus()) .append("delFlag", getDelFlag()) .append("loginIp", getLoginIp()) @@ -379,7 +319,6 @@ public class SysUser extends BaseEntity .append("updateTime", getUpdateTime()) .append("remark", getRemark()) .append("dept", getDept()) - .append("roles", getRoles()) .toString(); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java new file mode 100644 index 000000000..b5bc8c8e2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginBody.java @@ -0,0 +1,69 @@ +package com.ruoyi.common.core.domain.model; + +/** + * 用户登录对象 + * + * @author ruoyi + */ +public class LoginBody +{ + /** + * 用户名 + */ + private String username; + + /** + * 用户密码 + */ + private String password; + + /** + * 验证码 + */ + private String code; + + /** + * 唯一标识 + */ + private String uuid; + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + public String getUuid() + { + return uuid; + } + + public void setUuid(String uuid) + { + this.uuid = uuid; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java new file mode 100644 index 000000000..670e6b353 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/LoginUser.java @@ -0,0 +1,266 @@ +package com.ruoyi.common.core.domain.model; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.ruoyi.common.core.domain.entity.SysUser; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; +import java.util.Collection; +import java.util.Set; + +/** + * 登录用户身份权限 + * + * @author ruoyi + */ +public class LoginUser implements UserDetails +{ + private static final long serialVersionUID = 1L; + + /** + * 用户ID + */ + private Long userId; + + /** + * 部门ID + */ + private Long deptId; + + /** + * 用户唯一标识 + */ + private String token; + + /** + * 登录时间 + */ + private Long loginTime; + + /** + * 过期时间 + */ + private Long expireTime; + + /** + * 登录IP地址 + */ + private String ipaddr; + + /** + * 登录地点 + */ + private String loginLocation; + + /** + * 浏览器类型 + */ + private String browser; + + /** + * 操作系统 + */ + private String os; + + /** + * 权限列表 + */ + private Set permissions; + + /** + * 用户信息 + */ + private SysUser user; + + public LoginUser() + { + } + + public LoginUser(SysUser user, Set permissions) + { + this.user = user; + this.permissions = permissions; + } + + public LoginUser(Long userId, Long deptId, SysUser user, Set permissions) + { + this.userId = userId; + this.deptId = deptId; + this.user = user; + this.permissions = permissions; + } + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getDeptId() + { + return deptId; + } + + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public String getToken() + { + return token; + } + + public void setToken(String token) + { + this.token = token; + } + + @JSONField(serialize = false) + @Override + public String getPassword() + { + return user.getPassword(); + } + + @Override + public String getUsername() + { + return user.getUserName(); + } + + /** + * 账户是否未过期,过期无法验证 + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonExpired() + { + return true; + } + + /** + * 指定用户是否解锁,锁定的用户无法进行身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isAccountNonLocked() + { + return true; + } + + /** + * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isCredentialsNonExpired() + { + return true; + } + + /** + * 是否可用 ,禁用的用户不能身份验证 + * + * @return + */ + @JSONField(serialize = false) + @Override + public boolean isEnabled() + { + return true; + } + + public Long getLoginTime() + { + return loginTime; + } + + public void setLoginTime(Long loginTime) + { + this.loginTime = loginTime; + } + + public String getIpaddr() + { + return ipaddr; + } + + public void setIpaddr(String ipaddr) + { + this.ipaddr = ipaddr; + } + + public String getLoginLocation() + { + return loginLocation; + } + + public void setLoginLocation(String loginLocation) + { + this.loginLocation = loginLocation; + } + + public String getBrowser() + { + return browser; + } + + public void setBrowser(String browser) + { + this.browser = browser; + } + + public String getOs() + { + return os; + } + + public void setOs(String os) + { + this.os = os; + } + + public Long getExpireTime() + { + return expireTime; + } + + public void setExpireTime(Long expireTime) + { + this.expireTime = expireTime; + } + + public Set getPermissions() + { + return permissions; + } + + public void setPermissions(Set permissions) + { + this.permissions = permissions; + } + + public SysUser getUser() + { + return user; + } + + public void setUser(SysUser user) + { + this.user = user; + } + + @Override + public Collection getAuthorities() + { + return null; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java new file mode 100644 index 000000000..868a1fc52 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/model/RegisterBody.java @@ -0,0 +1,11 @@ +package com.ruoyi.common.core.domain.model; + +/** + * 用户注册对象 + * + * @author ruoyi + */ +public class RegisterBody extends LoginBody +{ + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java index 975c465b3..844168c6a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java @@ -70,7 +70,19 @@ public class PageDomain public void setIsAsc(String isAsc) { - this.isAsc = isAsc; + if (StringUtils.isNotEmpty(isAsc)) + { + // 兼容前端排序类型 + if ("ascending".equals(isAsc)) + { + isAsc = "asc"; + } + else if ("descending".equals(isAsc)) + { + isAsc = "desc"; + } + this.isAsc = isAsc; + } } public Boolean getReasonable() diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index 29f60e7fc..a3487b8ed 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -82,4 +82,4 @@ public class TableDataInfo implements Serializable { this.msg = msg; } -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java new file mode 100644 index 000000000..44e80d83a --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -0,0 +1,268 @@ +package com.ruoyi.common.core.redis; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.BoundSetOperations; +import org.springframework.data.redis.core.HashOperations; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.stereotype.Component; + +/** + * spring redis 工具类 + * + * @author ruoyi + **/ +@SuppressWarnings(value = { "unchecked", "rawtypes" }) +@Component +public class RedisCache +{ + @Autowired + public RedisTemplate redisTemplate; + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + */ + public void setCacheObject(final String key, final T value) + { + redisTemplate.opsForValue().set(key, value); + } + + /** + * 缓存基本的对象,Integer、String、实体类等 + * + * @param key 缓存的键值 + * @param value 缓存的值 + * @param timeout 时间 + * @param timeUnit 时间颗粒度 + */ + public void setCacheObject(final String key, final T value, final Integer timeout, final TimeUnit timeUnit) + { + redisTemplate.opsForValue().set(key, value, timeout, timeUnit); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout) + { + return expire(key, timeout, TimeUnit.SECONDS); + } + + /** + * 设置有效时间 + * + * @param key Redis键 + * @param timeout 超时时间 + * @param unit 时间单位 + * @return true=设置成功;false=设置失败 + */ + public boolean expire(final String key, final long timeout, final TimeUnit unit) + { + return redisTemplate.expire(key, timeout, unit); + } + + /** + * 获取有效时间 + * + * @param key Redis键 + * @return 有效时间 + */ + public long getExpire(final String key) + { + return redisTemplate.getExpire(key); + } + + /** + * 判断 key是否存在 + * + * @param key 键 + * @return true 存在 false不存在 + */ + public Boolean hasKey(String key) + { + return redisTemplate.hasKey(key); + } + + /** + * 获得缓存的基本对象。 + * + * @param key 缓存键值 + * @return 缓存键值对应的数据 + */ + public T getCacheObject(final String key) + { + ValueOperations operation = redisTemplate.opsForValue(); + return operation.get(key); + } + + /** + * 删除单个对象 + * + * @param key + */ + public boolean deleteObject(final String key) + { + return redisTemplate.delete(key); + } + + /** + * 删除集合对象 + * + * @param collection 多个对象 + * @return + */ + public boolean deleteObject(final Collection collection) + { + return redisTemplate.delete(collection) > 0; + } + + /** + * 缓存List数据 + * + * @param key 缓存的键值 + * @param dataList 待缓存的List数据 + * @return 缓存的对象 + */ + public long setCacheList(final String key, final List dataList) + { + Long count = redisTemplate.opsForList().rightPushAll(key, dataList); + return count == null ? 0 : count; + } + + /** + * 获得缓存的list对象 + * + * @param key 缓存的键值 + * @return 缓存键值对应的数据 + */ + public List getCacheList(final String key) + { + return redisTemplate.opsForList().range(key, 0, -1); + } + + /** + * 缓存Set + * + * @param key 缓存键值 + * @param dataSet 缓存的数据 + * @return 缓存数据的对象 + */ + public BoundSetOperations setCacheSet(final String key, final Set dataSet) + { + BoundSetOperations setOperation = redisTemplate.boundSetOps(key); + Iterator it = dataSet.iterator(); + while (it.hasNext()) + { + setOperation.add(it.next()); + } + return setOperation; + } + + /** + * 获得缓存的set + * + * @param key + * @return + */ + public Set getCacheSet(final String key) + { + return redisTemplate.opsForSet().members(key); + } + + /** + * 缓存Map + * + * @param key + * @param dataMap + */ + public void setCacheMap(final String key, final Map dataMap) + { + if (dataMap != null) { + redisTemplate.opsForHash().putAll(key, dataMap); + } + } + + /** + * 获得缓存的Map + * + * @param key + * @return + */ + public Map getCacheMap(final String key) + { + return redisTemplate.opsForHash().entries(key); + } + + /** + * 往Hash中存入数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @param value 值 + */ + public void setCacheMapValue(final String key, final String hKey, final T value) + { + redisTemplate.opsForHash().put(key, hKey, value); + } + + /** + * 获取Hash中的数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return Hash中的对象 + */ + public T getCacheMapValue(final String key, final String hKey) + { + HashOperations opsForHash = redisTemplate.opsForHash(); + return opsForHash.get(key, hKey); + } + + /** + * 获取多个Hash中的数据 + * + * @param key Redis键 + * @param hKeys Hash键集合 + * @return Hash对象集合 + */ + public List getMultiCacheMapValue(final String key, final Collection hKeys) + { + return redisTemplate.opsForHash().multiGet(key, hKeys); + } + + /** + * 删除Hash中的某条数据 + * + * @param key Redis键 + * @param hKey Hash键 + * @return 是否成功 + */ + public boolean deleteCacheMapValue(final String key, final String hKey) + { + return redisTemplate.opsForHash().delete(key, hKey) > 0; + } + + /** + * 获得缓存的基本对象列表 + * + * @param pattern 字符串前缀 + * @return 对象列表 + */ + public Collection keys(final String pattern) + { + return redisTemplate.keys(pattern); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java index 43612e5d7..78188fc16 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessStatus.java @@ -4,6 +4,7 @@ package com.ruoyi.common.enums; * 操作状态 * * @author ruoyi + * */ public enum BusinessStatus { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java index d22bccbd3..2bbeaf7d3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/BusinessType.java @@ -53,7 +53,7 @@ public enum BusinessType GENCODE, /** - * 清空 + * 清空数据 */ CLEAN, } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java new file mode 100644 index 000000000..be6f73929 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/HttpMethod.java @@ -0,0 +1,36 @@ +package com.ruoyi.common.enums; + +import java.util.HashMap; +import java.util.Map; +import org.springframework.lang.Nullable; + +/** + * 请求方式 + * + * @author ruoyi + */ +public enum HttpMethod +{ + GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE; + + private static final Map mappings = new HashMap<>(16); + + static + { + for (HttpMethod httpMethod : values()) + { + mappings.put(httpMethod.name(), httpMethod); + } + } + + @Nullable + public static HttpMethod resolve(@Nullable String method) + { + return (method != null ? mappings.get(method) : null); + } + + public boolean matches(String method) + { + return (this == resolve(method)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java new file mode 100644 index 000000000..c609fd8ac --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/LimitType.java @@ -0,0 +1,20 @@ +package com.ruoyi.common.enums; + +/** + * 限流类型 + * + * @author ruoyi + */ + +public enum LimitType +{ + /** + * 默认策略全局限流 + */ + DEFAULT, + + /** + * 根据请求者IP进行限流 + */ + IP +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java deleted file mode 100644 index b0bdd1003..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/OnlineStatus.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.ruoyi.common.enums; - -/** - * 用户会话 - * - * @author ruoyi - */ -public enum OnlineStatus -{ - /** 用户状态 */ - on_line("在线"), off_line("离线"); - - private final String info; - - private OnlineStatus(String info) - { - this.info = info; - } - - public String getInfo() - { - return info; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java index e04facca1..a9247b570 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java @@ -9,6 +9,11 @@ public final class ServiceException extends RuntimeException { private static final long serialVersionUID = 1L; + /** + * 错误码 + */ + private Integer code; + /** * 错误提示 */ @@ -33,26 +38,37 @@ public final class ServiceException extends RuntimeException this.message = message; } + public ServiceException(String message, Integer code) + { + this.message = message; + this.code = code; + } + public String getDetailMessage() { return detailMessage; } - public ServiceException setDetailMessage(String detailMessage) - { - this.detailMessage = detailMessage; - return this; - } - @Override public String getMessage() { return message; } + public Integer getCode() + { + return code; + } + public ServiceException setMessage(String message) { this.message = message; return this; } + + public ServiceException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } } \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java index f24d744ac..f3e9c3314 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/InvalidExtensionException.java @@ -67,7 +67,7 @@ public class InvalidExtensionException extends FileUploadException super(allowedExtension, extension, filename); } } - + public static class InvalidVideoExtensionException extends InvalidExtensionException { private static final long serialVersionUID = 1L; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java new file mode 100644 index 000000000..85f94861b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaExpireException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.user; + +/** + * 验证码失效异常类 + * + * @author ruoyi + */ +public class CaptchaExpireException extends UserException +{ + private static final long serialVersionUID = 1L; + + public CaptchaExpireException() + { + super("user.jcaptcha.expire", null); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java deleted file mode 100644 index e11624426..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 角色锁定异常类 - * - * @author ruoyi - */ -public class RoleBlockedException extends UserException -{ - private static final long serialVersionUID = 1L; - - public RoleBlockedException() - { - super("role.blocked", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java deleted file mode 100644 index 8feb8493e..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 用户锁定异常类 - * - * @author ruoyi - */ -public class UserBlockedException extends UserException -{ - private static final long serialVersionUID = 1L; - - public UserBlockedException() - { - super("user.blocked", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java deleted file mode 100644 index cf0724228..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 用户账号已被删除 - * - * @author ruoyi - */ -public class UserDeleteException extends UserException -{ - private static final long serialVersionUID = 1L; - - public UserDeleteException() - { - super("user.password.delete", null); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java deleted file mode 100644 index 4222135f5..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.ruoyi.common.exception.user; - -/** - * 用户错误记数异常类 - * - * @author ruoyi - */ -public class UserPasswordRetryLimitCountException extends UserException -{ - private static final long serialVersionUID = 1L; - - public UserPasswordRetryLimitCountException(int retryLimitCount) - { - super("user.password.retry.limit.count", new Object[] { retryLimitCount }); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java index b48c40657..0de8d2408 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java @@ -9,8 +9,8 @@ public class UserPasswordRetryLimitExceedException extends UserException { private static final long serialVersionUID = 1L; - public UserPasswordRetryLimitExceedException(int retryLimitCount) + public UserPasswordRetryLimitExceedException(int retryLimitCount, int lockTime) { - super("user.password.retry.limit.exceed", new Object[] { retryLimitCount }); + super("user.password.retry.limit.exceed", new Object[] { retryLimitCount, lockTime }); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java new file mode 100644 index 000000000..e1e431b19 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/PropertyPreExcludeFilter.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.filter; + +import com.alibaba.fastjson2.filter.SimplePropertyPreFilter; + +/** + * 排除JSON敏感属性 + * + * @author ruoyi + */ +public class PropertyPreExcludeFilter extends SimplePropertyPreFilter +{ + public PropertyPreExcludeFilter() + { + } + + public PropertyPreExcludeFilter addExcludes(String... filters) + { + for (int i = 0; i < filters.length; i++) + { + this.getExcludes().add(filters[i]); + } + return this; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java new file mode 100644 index 000000000..a1bcfe2a4 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java @@ -0,0 +1,52 @@ +package com.ruoyi.common.filter; + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import org.springframework.http.MediaType; +import com.ruoyi.common.utils.StringUtils; + +/** + * Repeatable 过滤器 + * + * @author ruoyi + */ +public class RepeatableFilter implements Filter +{ + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + ServletRequest requestWrapper = null; + if (request instanceof HttpServletRequest + && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) + { + requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); + } + if (null == requestWrapper) + { + chain.doFilter(request, response); + } + else + { + chain.doFilter(requestWrapper, response); + } + } + + @Override + public void destroy() + { + + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java new file mode 100644 index 000000000..407d1ba42 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatedlyRequestWrapper.java @@ -0,0 +1,76 @@ +package com.ruoyi.common.filter; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import com.ruoyi.common.utils.http.HttpHelper; +import com.ruoyi.common.constant.Constants; + +/** + * 构建可重复读取inputStream的request + * + * @author ruoyi + */ +public class RepeatedlyRequestWrapper extends HttpServletRequestWrapper +{ + private final byte[] body; + + public RepeatedlyRequestWrapper(HttpServletRequest request, ServletResponse response) throws IOException + { + super(request); + request.setCharacterEncoding(Constants.UTF8); + response.setCharacterEncoding(Constants.UTF8); + + body = HttpHelper.getBodyString(request).getBytes(Constants.UTF8); + } + + @Override + public BufferedReader getReader() throws IOException + { + return new BufferedReader(new InputStreamReader(getInputStream())); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + final ByteArrayInputStream bais = new ByteArrayInputStream(body); + return new ServletInputStream() + { + @Override + public int read() throws IOException + { + return bais.read(); + } + + @Override + public int available() throws IOException + { + return body.length; + } + + @Override + public boolean isFinished() + { + return false; + } + + @Override + public boolean isReady() + { + return false; + } + + @Override + public void setReadListener(ReadListener readListener) + { + + } + }; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java similarity index 91% rename from ruoyi-common/src/main/java/com/ruoyi/common/xss/XssFilter.java rename to ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java index 30fd69ce8..9052f0da3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssFilter.java @@ -1,74 +1,75 @@ -package com.ruoyi.common.xss; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import com.ruoyi.common.utils.StringUtils; - -/** - * 防止XSS攻击的过滤器 - * - * @author ruoyi - */ -public class XssFilter implements Filter -{ - /** - * 排除链接 - */ - public List excludes = new ArrayList<>(); - - @Override - public void init(FilterConfig filterConfig) throws ServletException - { - String tempExcludes = filterConfig.getInitParameter("excludes"); - if (StringUtils.isNotEmpty(tempExcludes)) - { - String[] url = tempExcludes.split(","); - for (int i = 0; url != null && i < url.length; i++) - { - excludes.add(url[i]); - } - } - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException - { - HttpServletRequest req = (HttpServletRequest) request; - HttpServletResponse resp = (HttpServletResponse) response; - if (handleExcludeURL(req, resp)) - { - chain.doFilter(request, response); - return; - } - XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); - chain.doFilter(xssRequest, response); - } - - private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) - { - String url = request.getServletPath(); - String method = request.getMethod(); - // GET DELETE 不过滤 - if (method == null || method.matches("GET") || method.matches("DELETE")) - { - return true; - } - return StringUtils.matches(url, excludes); - } - - @Override - public void destroy() - { - - } +package com.ruoyi.common.filter; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.enums.HttpMethod; + +/** + * 防止XSS攻击的过滤器 + * + * @author ruoyi + */ +public class XssFilter implements Filter +{ + /** + * 排除链接 + */ + public List excludes = new ArrayList<>(); + + @Override + public void init(FilterConfig filterConfig) throws ServletException + { + String tempExcludes = filterConfig.getInitParameter("excludes"); + if (StringUtils.isNotEmpty(tempExcludes)) + { + String[] url = tempExcludes.split(","); + for (int i = 0; url != null && i < url.length; i++) + { + excludes.add(url[i]); + } + } + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException + { + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse resp = (HttpServletResponse) response; + if (handleExcludeURL(req, resp)) + { + chain.doFilter(request, response); + return; + } + XssHttpServletRequestWrapper xssRequest = new XssHttpServletRequestWrapper((HttpServletRequest) request); + chain.doFilter(xssRequest, response); + } + + private boolean handleExcludeURL(HttpServletRequest request, HttpServletResponse response) + { + String url = request.getServletPath(); + String method = request.getMethod(); + // GET DELETE 不过滤 + if (method == null || HttpMethod.GET.matches(method) || HttpMethod.DELETE.matches(method)) + { + return true; + } + return StringUtils.matches(url, excludes); + } + + @Override + public void destroy() + { + + } } \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java new file mode 100644 index 000000000..05149f018 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -0,0 +1,111 @@ +package com.ruoyi.common.filter; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import javax.servlet.ReadListener; +import javax.servlet.ServletInputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import org.apache.commons.io.IOUtils; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.html.EscapeUtil; + +/** + * XSS过滤处理 + * + * @author ruoyi + */ +public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper +{ + /** + * @param request + */ + public XssHttpServletRequestWrapper(HttpServletRequest request) + { + super(request); + } + + @Override + public String[] getParameterValues(String name) + { + String[] values = super.getParameterValues(name); + if (values != null) + { + int length = values.length; + String[] escapesValues = new String[length]; + for (int i = 0; i < length; i++) + { + // 防xss攻击和过滤前后空格 + escapesValues[i] = EscapeUtil.clean(values[i]).trim(); + } + return escapesValues; + } + return super.getParameterValues(name); + } + + @Override + public ServletInputStream getInputStream() throws IOException + { + // 非json类型,直接返回 + if (!isJsonRequest()) + { + return super.getInputStream(); + } + + // 为空,直接返回 + String json = IOUtils.toString(super.getInputStream(), "utf-8"); + if (StringUtils.isEmpty(json)) + { + return super.getInputStream(); + } + + // xss过滤 + json = EscapeUtil.clean(json).trim(); + byte[] jsonBytes = json.getBytes("utf-8"); + final ByteArrayInputStream bis = new ByteArrayInputStream(jsonBytes); + return new ServletInputStream() + { + @Override + public boolean isFinished() + { + return true; + } + + @Override + public boolean isReady() + { + return true; + } + + @Override + public int available() throws IOException + { + return jsonBytes.length; + } + + @Override + public void setReadListener(ReadListener readListener) + { + } + + @Override + public int read() throws IOException + { + return bis.read(); + } + }; + } + + /** + * 是否是Json请求 + * + * @param request + */ + public boolean isJsonRequest() + { + String header = super.getHeader(HttpHeaders.CONTENT_TYPE); + return StringUtils.startsWithIgnoreCase(header, MediaType.APPLICATION_JSON_VALUE); + } +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java deleted file mode 100644 index 119147b6a..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSON.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.ruoyi.common.json; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; - -/** - * JSON解析处理 - * - * @author ruoyi - */ -public class JSON -{ - public static final String DEFAULT_FAIL = "\"Parse failed\""; - private static final ObjectMapper objectMapper = new ObjectMapper(); - private static final ObjectWriter objectWriter = objectMapper.writerWithDefaultPrettyPrinter(); - - public static void marshal(File file, Object value) throws Exception - { - try - { - objectWriter.writeValue(file, value); - } - catch (JsonGenerationException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static void marshal(OutputStream os, Object value) throws Exception - { - try - { - objectWriter.writeValue(os, value); - } - catch (JsonGenerationException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static String marshal(Object value) throws Exception - { - try - { - return objectWriter.writeValueAsString(value); - } - catch (JsonGenerationException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static byte[] marshalBytes(Object value) throws Exception - { - try - { - return objectWriter.writeValueAsBytes(value); - } - catch (JsonGenerationException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static T unmarshal(File file, Class valueType) throws Exception - { - try - { - return objectMapper.readValue(file, valueType); - } - catch (JsonParseException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static T unmarshal(InputStream is, Class valueType) throws Exception - { - try - { - return objectMapper.readValue(is, valueType); - } - catch (JsonParseException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static T unmarshal(String str, Class valueType) throws Exception - { - try - { - return objectMapper.readValue(str, valueType); - } - catch (JsonParseException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } - - public static T unmarshal(byte[] bytes, Class valueType) throws Exception - { - try - { - if (bytes == null) - { - bytes = new byte[0]; - } - return objectMapper.readValue(bytes, 0, bytes.length, valueType); - } - catch (JsonParseException e) - { - throw new Exception(e); - } - catch (JsonMappingException e) - { - throw new Exception(e); - } - catch (IOException e) - { - throw new Exception(e); - } - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java deleted file mode 100644 index 24ef6ccb7..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java +++ /dev/null @@ -1,749 +0,0 @@ -package com.ruoyi.common.json; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ruoyi.common.utils.StringUtils; - -/** - * 通用消息对象,基于Map实现的可嵌套数据结构。 支持JSON数据结构。 - * - * @author ruoyi - */ -public class JSONObject extends LinkedHashMap -{ - private static final long serialVersionUID = 1L; - private static final Pattern arrayNamePattern = Pattern.compile("(\\w+)((\\[\\d+\\])+)"); - private static final ObjectMapper objectMapper = new ObjectMapper(); - - /** - * 数组结构。 - */ - public static class JSONArray extends ArrayList - { - private static final long serialVersionUID = 1L; - - public JSONArray() - { - super(); - } - - public JSONArray(int size) - { - super(size); - } - - @Override - public String toString() - { - try - { - return JSON.marshal(this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - @Override - public Object set(int index, Object element) - { - return super.set(index, transfer(element)); - } - - @Override - public boolean add(Object element) - { - return super.add(transfer(element)); - } - - @Override - public void add(int index, Object element) - { - super.add(index, transfer(element)); - } - } - - public JSONObject() - { - super(); - } - - public JSONObject(final JSONObject other) - { - super(other); - } - - @Override - public String toString() - { - try - { - return JSON.marshal(this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - * 转换为紧凑格式的字符串。 - * - * @return 返回本对象紧凑格式字符串。 - */ - public String toCompactString() - { - try - { - return objectMapper.writeValueAsString(this); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - * 获取指定字段的整数值。如果字段不存在,或者无法转换为整数,返回null。 - * - * @param name 字段名,支持多级。 - * @return 返回指定的整数值,或者null。 - */ - public Integer intValue(final String name) - { - return valueAsInt(value(name)); - } - - /** - * 获取指定字段的整数值。如果字段不存在,或者无法转换为整数,返回defaultValue。 - * - * @param name 字段名,支持多级。 - * @param defaultValue 查询失败时,返回的值。 - * @return 返回指定的整数值,或者defaultValue。 - */ - public Integer intValue(final String name, final Integer defaultValue) - { - return StringUtils.nvl(intValue(name), defaultValue); - } - - /** - * 获取指定字段的长整数值。如果字段不存在,或者无法转换为长整数,返回null。 - * - * @param name 字段名,支持多级。 - * @return 返回指定的长整数值,或者null。 - */ - public Long longValue(final String name) - { - return valueAsLong(value(name)); - } - - /** - * 获取指定字段的长整数值。如果字段不存在,或者无法转换为长整数,返回defaultValue。 - * - * @param name 字段名,支持多级。 - * @param defaultValue 查询失败时,返回的值。 - * @return 返回指定的长整数值,或者defaultValue。 - */ - public Long longValue(final String name, final Long defaultValue) - { - return StringUtils.nvl(longValue(name), defaultValue); - } - - /** - * 获取指定字段的布尔值。如果字段不存在,或者无法转换为布尔型,返回null。 - * - * @param name 字段名,支持多级。 - * @return 返回指定的布尔值,或者null。 - */ - public Boolean boolValue(final String name) - { - return valueAsBool(value(name)); - } - - /** - * 获取指定字段的布尔值。如果字段不存在,或者无法转换为布尔型,返回defaultValue。 - * - * @param name 字段名,支持多级。 - * @param defaultValue 查询失败时,返回的值。 - * @return 返回指定的布尔值,或者defaultValue。 - */ - public Boolean boolValue(final String name, final Boolean defaultValue) - { - return StringUtils.nvl(boolValue(name), defaultValue); - } - - /** - * 获取指定字段的字符串值。如果字段不存在,返回null。 - * - * @param name 字段名,支持多级。 - * @return 返回指定的字符串值,或者null。 - */ - public String strValue(final String name) - { - return valueAsStr(value(name)); - } - - /** - * 获取指定字段的字符串值。如果字段不存在,返回defaultValue。 - * - * @param name 字段名,支持多级。 - * @param defaultValue 查询失败时,返回的值。 - * @return 返回指定的字符串值,或者defaultValue。 - */ - public String strValue(final String name, final String defaultValue) - { - return StringUtils.nvl(strValue(name), defaultValue); - } - - /** - * 获取指定字段的值。 - * - * @param name 字段名,支持多级,支持数组下标。 - * @return 返回指定字段的值。 - */ - public Object value(final String name) - { - final int indexDot = name.indexOf('.'); - if (indexDot >= 0) - { - return obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1)); - } - else - { - final Matcher matcher = arrayNamePattern.matcher(name); - if (matcher.find()) - { - return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() - { - @Override - public Object callback(JSONArray arr, int index) - { - return elementAt(arr, index); - } - }); - } - else - { - return get(name); - } - } - } - - /** - * 设置指定字段的值。 - * - * @param name 字段名,支持多级,支持数组下标。 - * @param value 字段值。 - * @return 返回本对象。 - */ - public JSONObject value(final String name, final Object value) - { - final int indexDot = name.indexOf('.'); - if (indexDot >= 0) - { - obj(name.substring(0, indexDot)).value(name.substring(indexDot + 1), value); - } - else - { - final Matcher matcher = arrayNamePattern.matcher(name); - if (matcher.find()) - { - endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() - { - @Override - public Void callback(JSONArray arr, int index) - { - elementAt(arr, index, value); - return null; - } - }); - } - else - { - set(name, value); - } - } - return this; - } - - /** - * 获取对象(非标量类型)字段。返回的数据是一个结构体。当不存在指定对象时,则为指定的名字创建一个空的MessageObject对象。 - * - * @param name 字段名。不支持多级名字,支持数组下标。 - * @return 返回指定的对象。如果对象不存在,则为指定的名字创建一个空的MessageObject对象。 - */ - public JSONObject obj(final String name) - { - final Matcher matcher = arrayNamePattern.matcher(name); - if (matcher.find()) - { - return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() - { - @Override - public JSONObject callback(JSONArray arr, int index) - { - return objAt(arr, index); - } - }); - } - else - { - JSONObject obj = getObj(name); - if (obj == null) - { - obj = new JSONObject(); - put(name, obj); - } - return obj; - } - } - - /** - * 获取数组字段。将名字对应的对象以数组对象返回,当指定的字段不存在时,创建一个空的数组。 - * - * @param name 字段名。不支持多级名字,不支持下标。 - * @return 返回一个数组(List)。 - */ - public JSONArray arr(final String name) - { - JSONArray arr = getArr(name); - if (arr == null) - { - arr = new JSONArray(); - put(name, arr); - } - return arr; - } - - /** - * 获取对象(非标量类型)字段。返回的数据是一个结构体。 - * - * @param name 字段名。 - * @return 返回指定的对象字段。 - */ - public JSONObject getObj(final String name) - { - return (JSONObject) get(name); - } - - /** - * 获取数组类型字段。 - * - * @param name 字段名。 - * @return 返回数组类型字段。 - */ - public JSONArray getArr(final String name) - { - return (JSONArray) get(name); - } - - /** - * 返回字段整数值。如果不存在,返回null。 - * - * @param name 字段名。 - * @return 返回指定字段整数值。 - */ - public Integer getInt(final String name) - { - return valueAsInt(get(name)); - } - - /** - * 返回字段整数值。如果不存在,返回defaultValue。 - * - * @param name 字段名。 - * @param defaultValue 字段不存在时,返回的值。 - * @return 返回指定字段整数值。 - */ - public Integer getInt(final String name, Integer defaultValue) - { - return StringUtils.nvl(getInt(name), defaultValue); - } - - /** - * 返回字段长整数值。如果不存在,返回null。 - * - * @param name 字段名。 - * @return 返回指定字段长整数值。 - */ - public Long getLong(final String name) - { - return valueAsLong(get(name)); - } - - /** - * 返回字段长整数值。如果不存在,返回defaultValue。 - * - * @param name 字段名。 - * @param defaultValue 字段不存在时,返回的值。 - * @return 返回指定字段长整数值。 - */ - public Long getLong(final String name, Long defaultValue) - { - return StringUtils.nvl(getLong(name), defaultValue); - } - - /** - * 返回字段字符串值。如果不存在,返回null。 - * - * @param name 字段名。 - * @return 返回指定字段字符串值。 - */ - public String getStr(final String name) - { - return valueAsStr(get(name)); - } - - /** - * 返回字段字符串值。如果不存在,返回defaultValue。 - * - * @param name 字段名。 - * @param defaultValue 字段不存在时,返回的值。 - * @return 返回指定字段字符串值。 - */ - public String getStr(final String name, final String defaultValue) - { - return StringUtils.nvl(getStr(name), defaultValue); - } - - /** - * 字段值按照布尔类型返回。如果不存在,返回null。 - * - * @param name 字段名。 - * @return 字段值。 - */ - public Boolean getBool(final String name) - { - return valueAsBool(get(name)); - } - - /** - * 字段值按照布尔类型返回。如果不存在,返回defaultValue。 - * - * @param name 字段名。 - * @param defaultValue 字段不存在时,返回的值。 - * @return 字段值。 - */ - public Boolean getBool(final String name, final Boolean defaultValue) - { - return StringUtils.nvl(getBool(name), defaultValue); - } - - /** - * 设置字段值 - * - * @param name 字段名 - * @param value 字段值(标量:数字、字符串、布尔型;结构体:MessageObject)。 如果是Map类型同时非MessageObject类型,则自动转换为MessageObject类型再存入 - * (此时,再修改Map中的数据,将不会体现到本对象中)。 - * @return 返回本对象 - */ - public JSONObject set(final String name, final Object value) - { - put(name, value); - return this; - } - - /** - * 将本对象转换为Java Bean。 - * - * @param beanClass Java Bean的类对象。 - * @return 返回转换后的Java Bean。 - */ - public T asBean(Class beanClass) - { - try - { - return JSON.unmarshal(JSON.marshal(this), beanClass); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - /** - * 重载基类的方法。如果 value 是 Map 类型,但不是 MessageObject 类型,则创建一个包含内容等同于原 Map 的 MessageObject 作为 value(注意:此后再更改 Map 的内容,将不会反映到 - * MessageObject 中)。 重载此方法的目的是为了使JSON能够正确地解析为MessageObject对象。不建议直接调用此方法,请使用 set(name, value)方法设置字段值。 - */ - @Override - public Object put(String key, Object value) - { - return super.put(key, transfer(value)); - } - - public static Integer valueAsInt(Object value) - { - if (value instanceof Integer) - { - return (Integer) value; - } - else if (value instanceof Number) - { - return ((Number) value).intValue(); - } - else if (value instanceof String) - { - return Integer.valueOf((String) value); - } - else if (value instanceof Boolean) - { - return ((Boolean) value) ? 1 : 0; - } - else - { - return null; - } - } - - public static Long valueAsLong(Object value) - { - if (value instanceof Long) - { - return (Long) value; - } - else if (value instanceof Number) - { - return ((Number) value).longValue(); - } - else if (value instanceof String) - { - return Long.valueOf((String) value); - } - else if (value instanceof Boolean) - { - return ((Boolean) value) ? 1L : 0L; - } - else - { - return null; - } - } - - public static String valueAsStr(Object value) - { - if (value instanceof String) - { - return (String) value; - } - else if (value != null) - { - return value.toString(); - } - else - { - return null; - } - } - - public static Boolean valueAsBool(Object value) - { - if (value instanceof Boolean) - { - return (Boolean) value; - } - else if (value instanceof Number) - { - return ((Number) value).doubleValue() != 0.0; - } - else if (value instanceof String) - { - return Boolean.valueOf((String) value); - } - else - { - return null; - } - } - - /** - * 将所有层次中凡是Map类型同时又不是MessageObject的类型,转换为MessageObject类型。 - * - * @param value 值。 - * @return 返回转换后的值。 - */ - @SuppressWarnings("unchecked") - private static Object transfer(final Object value) - { - if (!(value instanceof JSONObject) && value instanceof Map) - { - return toObj((Map) value); - } - else if (!(value instanceof JSONArray) && value instanceof Collection) - { - return toArr((Collection) value); - } - else - { - return value; - } - } - - private static JSONArray toArr(final Collection list) - { - final JSONArray arr = new JSONArray(list.size()); - for (final Object element : list) - { - arr.add(element); - } - return arr; - } - - private static JSONObject toObj(final Map map) - { - final JSONObject obj = new JSONObject(); - for (final Map.Entry ent : map.entrySet()) - { - obj.put(ent.getKey(), transfer(ent.getValue())); - } - return obj; - } - - /** - * 将指定下标元素作为数组返回,如果不存在,则在该位置创建一个空的数组。 - * - * @param arr 当前数组。 - * @param index 下标。 - * @return 返回当前数组指定下标的元素,该元素应该是一个数组。 - */ - private static JSONArray arrayAt(JSONArray arr, int index) - { - expand(arr, index); - if (arr.get(index) == null) - { - arr.set(index, new JSONArray()); - } - return (JSONArray) arr.get(index); - } - - /** - * 将指定下标元素作为结构体返回,如果不存在,则在该位置创建一个空的结构体。 - * - * @param arr 当前数组。 - * @param index 下标。 - * @return 返回当前数组指定下标元素,该元素是一个结构体。 - */ - private static JSONObject objAt(final JSONArray arr, int index) - { - expand(arr, index); - if (arr.get(index) == null) - { - arr.set(index, new JSONObject()); - } - return (JSONObject) arr.get(index); - } - - /** - * 设置数组指定下标位置的值。 - * - * @param arr 数组。 - * @param index 下标。 - * @param value 值。 - */ - private static void elementAt(final JSONArray arr, final int index, final Object value) - { - expand(arr, index).set(index, value); - } - - /** - * 获取数组指定下标元素的值。 - * - * @param arr 数组。 - * @param index 下标。 - * @return 值。 - */ - private static Object elementAt(final JSONArray arr, final int index) - { - return expand(arr, index).get(index); - } - - /** - * 扩展数组到指定下标,以防止访问时下标越界。 - * - * @param arr 数组 - * @param index 下标 - * @return 返回传入的数组 - */ - private static JSONArray expand(final JSONArray arr, final int index) - { - while (arr.size() <= index) - { - arr.add(null); - } - return arr; - } - - /** - * 最后数组回调。 - * - * @author Mike - * - * @param 回调返回数据类型。 - */ - private interface EndArrayCallback - { - /** - * 当定位到最后一级数组,将调用本方法。 - * - * @param arr 最后一级数组对象。 - * @param index 最后一级索引。 - * @return 返回回调的返回值。 - */ - T callback(JSONArray arr, int index); - } - - /** - * 处理多维数组的工具函数(包括一维数组)。多维数组的名字如:arrary[1][2][3], 则name=array,indexStr=[1][2][3],在callback中,endArr将是 - * array[1][2]指定的对象,indexe=3。 - * - * @param name 不带下标的名字,不支持多级名字。 - * @param indexesStr 索引部分的字符串,如:[1][2][3] - * @param callback 回调函数。 - * @return 返回回调函数的返回值。 - */ - private T endArray(final String name, final String indexesStr, final EndArrayCallback callback) - { - JSONArray endArr = arr(name); - final int[] indexes = parseIndexes(indexesStr); - int i = 0; - while (i < indexes.length - 1) - { - endArr = arrayAt(endArr, indexes[i++]); - } - return callback.callback(endArr, indexes[i]); - } - - private static int[] parseIndexes(final String s) - { - int[] indexes = null; - List list = new ArrayList(); - - final StringTokenizer st = new StringTokenizer(s, "[]"); - while (st.hasMoreTokens()) - { - final int index = Integer.valueOf(st.nextToken()); - if (index < 0) - { - throw new RuntimeException(String.format("Illegal index %1$d in \"%2$s\"", index, s)); - } - - list.add(index); - } - - indexes = new int[list.size()]; - int i = 0; - for (Integer tmp : list.toArray(new Integer[list.size()])) - { - indexes[i++] = tmp; - } - - return indexes; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CacheUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CacheUtils.java deleted file mode 100644 index ae27682de..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CacheUtils.java +++ /dev/null @@ -1,197 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.Iterator; -import java.util.Set; -import org.apache.shiro.cache.Cache; -import org.apache.shiro.cache.CacheManager; -import org.apache.shiro.cache.ehcache.EhCacheManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.utils.spring.SpringUtils; - -/** - * Cache工具类 - * - * @author ruoyi - */ -public class CacheUtils -{ - private static Logger logger = LoggerFactory.getLogger(CacheUtils.class); - - private static CacheManager cacheManager = SpringUtils.getBean(CacheManager.class); - - private static final String SYS_CACHE = "sys-cache"; - - /** - * 获取SYS_CACHE缓存 - * - * @param key - * @return - */ - public static Object get(String key) - { - return get(SYS_CACHE, key); - } - - /** - * 获取SYS_CACHE缓存 - * - * @param key - * @param defaultValue - * @return - */ - public static Object get(String key, Object defaultValue) - { - Object value = get(key); - return value != null ? value : defaultValue; - } - - /** - * 写入SYS_CACHE缓存 - * - * @param key - * @return - */ - public static void put(String key, Object value) - { - put(SYS_CACHE, key, value); - } - - /** - * 从SYS_CACHE缓存中移除 - * - * @param key - * @return - */ - public static void remove(String key) - { - remove(SYS_CACHE, key); - } - - /** - * 获取缓存 - * - * @param cacheName - * @param key - * @return - */ - public static Object get(String cacheName, String key) - { - return getCache(cacheName).get(getKey(key)); - } - - /** - * 获取缓存 - * - * @param cacheName - * @param key - * @param defaultValue - * @return - */ - public static Object get(String cacheName, String key, Object defaultValue) - { - Object value = get(cacheName, getKey(key)); - return value != null ? value : defaultValue; - } - - /** - * 写入缓存 - * - * @param cacheName - * @param key - * @param value - */ - public static void put(String cacheName, String key, Object value) - { - getCache(cacheName).put(getKey(key), value); - } - - /** - * 从缓存中移除 - * - * @param cacheName - * @param key - */ - public static void remove(String cacheName, String key) - { - getCache(cacheName).remove(getKey(key)); - } - - /** - * 从缓存中移除所有 - * - * @param cacheName - */ - public static void removeAll(String cacheName) - { - Cache cache = getCache(cacheName); - Set keys = cache.keys(); - for (Iterator it = keys.iterator(); it.hasNext();) - { - cache.remove(it.next()); - } - logger.info("清理缓存: {} => {}", cacheName, keys); - } - - /** - * 从缓存中移除指定key - * - * @param keys - */ - public static void removeByKeys(Set keys) - { - removeByKeys(SYS_CACHE, keys); - } - - /** - * 从缓存中移除指定key - * - * @param cacheName - * @param keys - */ - public static void removeByKeys(String cacheName, Set keys) - { - for (Iterator it = keys.iterator(); it.hasNext();) - { - remove(it.next()); - } - logger.info("清理缓存: {} => {}", cacheName, keys); - } - - /** - * 获取缓存键名 - * - * @param key - * @return - */ - private static String getKey(String key) - { - return key; - } - - /** - * 获得一个Cache,没有则显示日志。 - * - * @param cacheName - * @return - */ - public static Cache getCache(String cacheName) - { - Cache cache = cacheManager.getCache(cacheName); - if (cache == null) - { - throw new RuntimeException("当前系统中没有定义“" + cacheName + "”这个缓存。"); - } - return cache; - } - - /** - * 获取所有缓存 - * - * @return 缓存组 - */ - public static String[] getCacheNames() - { - return ((EhCacheManager) cacheManager).getCacheManager().getCacheNames(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CookieUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/CookieUtils.java deleted file mode 100644 index 13c1d5ed0..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/CookieUtils.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.ruoyi.common.utils; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.net.URLEncoder; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Cookie工具类 - * - * @author ruoyi - */ -public class CookieUtils -{ - /** - * 设置 Cookie(生成时间为1天) - * - * @param name 名称 - * @param value 值 - */ - public static void setCookie(HttpServletResponse response, String name, String value) - { - setCookie(response, name, value, 60 * 60 * 24); - } - - /** - * 设置 Cookie - * - * @param name 名称 - * @param value 值 - * @param maxAge 生存时间(单位秒) - * @param uri 路径 - */ - public static void setCookie(HttpServletResponse response, String name, String value, String path) - { - setCookie(response, name, value, path, 60 * 60 * 24); - } - - /** - * 设置 Cookie - * - * @param name 名称 - * @param value 值 - * @param maxAge 生存时间(单位秒) - * @param uri 路径 - */ - public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) - { - setCookie(response, name, value, "/", maxAge); - } - - /** - * 设置 Cookie - * - * @param name 名称 - * @param value 值 - * @param maxAge 生存时间(单位秒) - * @param uri 路径 - */ - public static void setCookie(HttpServletResponse response, String name, String value, String path, int maxAge) - { - Cookie cookie = new Cookie(name, null); - cookie.setPath(path); - cookie.setMaxAge(maxAge); - try - { - cookie.setValue(URLEncoder.encode(value, "utf-8")); - } - catch (UnsupportedEncodingException e) - { - e.printStackTrace(); - } - response.addCookie(cookie); - } - - /** - * 获得指定Cookie的值 - * - * @param name 名称 - * @return 值 - */ - public static String getCookie(HttpServletRequest request, String name) - { - return getCookie(request, null, name, false); - } - - /** - * 获得指定Cookie的值,并删除。 - * - * @param name 名称 - * @return 值 - */ - public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name) - { - return getCookie(request, response, name, true); - } - - /** - * 获得指定Cookie的值 - * - * @param request 请求对象 - * @param response 响应对象 - * @param name 名字 - * @param isRemove 是否移除 - * @return 值 - */ - public static String getCookie(HttpServletRequest request, HttpServletResponse response, String name, - boolean isRemove) - { - String value = null; - Cookie[] cookies = request.getCookies(); - if (cookies != null) - { - for (Cookie cookie : cookies) - { - if (cookie.getName().equals(name)) - { - try - { - value = URLDecoder.decode(cookie.getValue(), "utf-8"); - } - catch (UnsupportedEncodingException e) - { - e.printStackTrace(); - } - if (isRemove) - { - cookie.setMaxAge(0); - response.addCookie(cookie); - } - } - } - } - return value; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java index 5d5dedf1e..cc5eab2c5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java @@ -1,16 +1,18 @@ package com.ruoyi.common.utils; +import java.util.Collection; import java.util.List; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; +import com.alibaba.fastjson2.JSONArray; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.core.domain.entity.SysDictData; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.spring.SpringUtils; /** * 字典工具类 * * @author ruoyi */ -@Component public class DictUtils { /** @@ -26,7 +28,7 @@ public class DictUtils */ public static void setDictCache(String key, List dictDatas) { - CacheUtils.put(getCacheName(), getCacheKey(key), dictDatas); + SpringUtils.getBean(RedisCache.class).setCacheObject(getCacheKey(key), dictDatas); } /** @@ -37,10 +39,10 @@ public class DictUtils */ public static List getDictCache(String key) { - Object cacheObj = CacheUtils.get(getCacheName(), getCacheKey(key)); - if (StringUtils.isNotNull(cacheObj)) + JSONArray arrayCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getCacheKey(key)); + if (StringUtils.isNotNull(arrayCache)) { - return StringUtils.cast(cacheObj); + return arrayCache.toList(SysDictData.class); } return null; } @@ -82,27 +84,30 @@ public class DictUtils StringBuilder propertyString = new StringBuilder(); List datas = getDictCache(dictType); - if (StringUtils.containsAny(dictValue, separator) && StringUtils.isNotEmpty(datas)) + if (StringUtils.isNotNull(datas)) { - for (SysDictData dict : datas) + if (StringUtils.containsAny(separator, dictValue)) { - for (String value : dictValue.split(separator)) + for (SysDictData dict : datas) { - if (value.equals(dict.getDictValue())) + for (String value : dictValue.split(separator)) { - propertyString.append(dict.getDictLabel()).append(separator); - break; + if (value.equals(dict.getDictValue())) + { + propertyString.append(dict.getDictLabel()).append(separator); + break; + } } } } - } - else - { - for (SysDictData dict : datas) + else { - if (dictValue.equals(dict.getDictValue())) + for (SysDictData dict : datas) { - return dict.getDictLabel(); + if (dictValue.equals(dict.getDictValue())) + { + return dict.getDictLabel(); + } } } } @@ -122,7 +127,7 @@ public class DictUtils StringBuilder propertyString = new StringBuilder(); List datas = getDictCache(dictType); - if (StringUtils.containsAny(dictLabel, separator) && StringUtils.isNotEmpty(datas)) + if (StringUtils.containsAny(separator, dictLabel) && StringUtils.isNotEmpty(datas)) { for (SysDictData dict : datas) { @@ -156,7 +161,7 @@ public class DictUtils */ public static void removeDictCache(String key) { - CacheUtils.remove(getCacheName(), getCacheKey(key)); + SpringUtils.getBean(RedisCache.class).deleteObject(getCacheKey(key)); } /** @@ -164,17 +169,8 @@ public class DictUtils */ public static void clearDictCache() { - CacheUtils.removeAll(getCacheName()); - } - - /** - * 获取cache name - * - * @return 缓存名 - */ - public static String getCacheName() - { - return Constants.SYS_DICT_CACHE; + Collection keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.SYS_DICT_KEY + "*"); + SpringUtils.getBean(RedisCache.class).deleteObject(keys); } /** @@ -185,6 +181,6 @@ public class DictUtils */ public static String getCacheKey(String configKey) { - return Constants.SYS_DICT_KEY + configKey; + return CacheConstants.SYS_DICT_KEY + configKey; } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java index d5a357c53..e415c9c38 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/LogUtils.java @@ -1,14 +1,5 @@ package com.ruoyi.common.utils; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import org.apache.shiro.SecurityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.json.JSON; - /** * 处理并记录日志文件 * @@ -16,93 +7,6 @@ import com.ruoyi.common.json.JSON; */ public class LogUtils { - public static final Logger ERROR_LOG = LoggerFactory.getLogger("sys-error"); - public static final Logger ACCESS_LOG = LoggerFactory.getLogger("sys-access"); - - /** - * 记录访问日志 [username][jsessionid][ip][accept][UserAgent][url][params][Referer] - * - * @param request - * @throws Exception - */ - public static void logAccess(HttpServletRequest request) throws Exception - { - String username = getUsername(); - String jsessionId = request.getRequestedSessionId(); - String ip = IpUtils.getIpAddr(request); - String accept = request.getHeader("accept"); - String userAgent = request.getHeader("User-Agent"); - String url = request.getRequestURI(); - String params = getParams(request); - - StringBuilder s = new StringBuilder(); - s.append(getBlock(username)); - s.append(getBlock(jsessionId)); - s.append(getBlock(ip)); - s.append(getBlock(accept)); - s.append(getBlock(userAgent)); - s.append(getBlock(url)); - s.append(getBlock(params)); - s.append(getBlock(request.getHeader("Referer"))); - getAccessLog().info(s.toString()); - } - - /** - * 记录异常错误 格式 [exception] - * - * @param message - * @param e - */ - public static void logError(String message, Throwable e) - { - String username = getUsername(); - StringBuilder s = new StringBuilder(); - s.append(getBlock("exception")); - s.append(getBlock(username)); - s.append(getBlock(message)); - ERROR_LOG.error(s.toString(), e); - } - - /** - * 记录页面错误 错误日志记录 [page/eception][username][statusCode][errorMessage][servletName][uri][exceptionName][ip][exception] - * - * @param request - */ - public static void logPageError(HttpServletRequest request) - { - String username = getUsername(); - - Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); - String message = (String) request.getAttribute("javax.servlet.error.message"); - String uri = (String) request.getAttribute("javax.servlet.error.request_uri"); - Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception"); - - if (statusCode == null) - { - statusCode = 0; - } - - StringBuilder s = new StringBuilder(); - s.append(getBlock(t == null ? "page" : "exception")); - s.append(getBlock(username)); - s.append(getBlock(statusCode)); - s.append(getBlock(message)); - s.append(getBlock(IpUtils.getIpAddr(request))); - - s.append(getBlock(uri)); - s.append(getBlock(request.getHeader("Referer"))); - StringWriter sw = new StringWriter(); - - while (t != null) - { - t.printStackTrace(new PrintWriter(sw)); - t = t.getCause(); - } - s.append(getBlock(sw.toString())); - getErrorLog().error(s.toString()); - - } - public static String getBlock(Object msg) { if (msg == null) @@ -111,25 +15,4 @@ public class LogUtils } return "[" + msg.toString() + "]"; } - - protected static String getParams(HttpServletRequest request) throws Exception - { - Map params = request.getParameterMap(); - return JSON.marshal(params); - } - - protected static String getUsername() - { - return (String) SecurityUtils.getSubject().getPrincipal(); - } - - public static Logger getAccessLog() - { - return ACCESS_LOG; - } - - public static Logger getErrorLog() - { - return ERROR_LOG; - } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MapDataUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MapDataUtil.java deleted file mode 100644 index 327e54fd1..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MapDataUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.ruoyi.common.utils; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import javax.servlet.http.HttpServletRequest; - -/** - * Map通用处理方法 - * - * @author ruoyi - */ -public class MapDataUtil -{ - public static Map convertDataMap(HttpServletRequest request) - { - Map properties = request.getParameterMap(); - Map returnMap = new HashMap(); - Iterator entries = properties.entrySet().iterator(); - Map.Entry entry; - String name = ""; - String value = ""; - while (entries.hasNext()) - { - entry = (Entry) entries.next(); - name = (String) entry.getKey(); - Object valueObj = entry.getValue(); - if (null == valueObj) - { - value = ""; - } - else if (valueObj instanceof String[]) - { - String[] values = (String[]) valueObj; - value = ""; - for (int i = 0; i < values.length; i++) - { - value += values[i] + ","; - } - if (value.length() > 0) - { - value = value.substring(0, value.length() - 1); - } - } - else - { - value = valueObj.toString(); - } - returnMap.put(name, value); - } - return returnMap; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java new file mode 100644 index 000000000..0d3ac5f59 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SecurityUtils.java @@ -0,0 +1,178 @@ +package com.ruoyi.common.utils; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.util.PatternMatchUtils; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.exception.ServiceException; + +/** + * 安全服务工具类 + * + * @author ruoyi + */ +public class SecurityUtils +{ + + /** + * 用户ID + **/ + public static Long getUserId() + { + try + { + return getLoginUser().getUserId(); + } + catch (Exception e) + { + throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取部门ID + **/ + public static Long getDeptId() + { + try + { + return getLoginUser().getDeptId(); + } + catch (Exception e) + { + throw new ServiceException("获取部门ID异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户账户 + **/ + public static String getUsername() + { + try + { + return getLoginUser().getUsername(); + } + catch (Exception e) + { + throw new ServiceException("获取用户账户异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取用户 + **/ + public static LoginUser getLoginUser() + { + try + { + return (LoginUser) getAuthentication().getPrincipal(); + } + catch (Exception e) + { + throw new ServiceException("获取用户信息异常", HttpStatus.UNAUTHORIZED); + } + } + + /** + * 获取Authentication + */ + public static Authentication getAuthentication() + { + return SecurityContextHolder.getContext().getAuthentication(); + } + + /** + * 生成BCryptPasswordEncoder密码 + * + * @param password 密码 + * @return 加密字符串 + */ + public static String encryptPassword(String password) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.encode(password); + } + + /** + * 判断密码是否相同 + * + * @param rawPassword 真实密码 + * @param encodedPassword 加密后字符 + * @return 结果 + */ + public static boolean matchesPassword(String rawPassword, String encodedPassword) + { + BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); + return passwordEncoder.matches(rawPassword, encodedPassword); + } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } + + /** + * 验证用户是否具备某权限 + * + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public static boolean hasPermi(String permission) + { + return hasPermi(getLoginUser().getPermissions(), permission); + } + + /** + * 判断是否包含权限 + * + * @param authorities 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 + */ + public static boolean hasPermi(Collection authorities, String permission) + { + return authorities.stream().filter(StringUtils::hasText) + .anyMatch(x -> Constants.ALL_PERMISSION.equals(x) || PatternMatchUtils.simpleMatch(x, permission)); + } + + /** + * 验证用户是否拥有某个角色 + * + * @param role 角色标识 + * @return 用户是否具备某角色 + */ + public static boolean hasRole(String role) + { + List roleList = getLoginUser().getUser().getRoles(); + Collection roles = roleList.stream().map(SysRole::getRoleKey).collect(Collectors.toSet()); + return hasRole(roles, role); + } + + /** + * 判断是否包含角色 + * + * @param roles 角色列表 + * @param role 角色 + * @return 用户是否具备某角色权限 + */ + public static boolean hasRole(Collection roles, String role) + { + return roles.stream().filter(StringUtils::hasText) + .anyMatch(x -> Constants.SUPER_ADMIN.equals(x) || PatternMatchUtils.simpleMatch(x, role)); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java index 6214f5643..292b8dacc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -4,6 +4,10 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @@ -20,11 +24,6 @@ import com.ruoyi.common.core.text.Convert; */ public class ServletUtils { - /** - * 定义移动端请求的所有可能类型 - */ - private final static String[] agent = { "Android", "iPhone", "iPod", "iPad", "Windows Phone", "MQQBrowser" }; - /** * 获取String参数 */ @@ -73,6 +72,34 @@ public class ServletUtils return Convert.toBool(getRequest().getParameter(name), defaultValue); } + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParams(ServletRequest request) + { + final Map map = request.getParameterMap(); + return Collections.unmodifiableMap(map); + } + + /** + * 获得所有请求参数 + * + * @param request 请求对象{@link ServletRequest} + * @return Map + */ + public static Map getParamMap(ServletRequest request) + { + Map params = new HashMap<>(); + for (Map.Entry entry : getParams(request).entrySet()) + { + params.put(entry.getKey(), StringUtils.join(entry.getValue(), ",")); + } + return params; + } + /** * 获取request */ @@ -108,12 +135,12 @@ public class ServletUtils * * @param response 渲染对象 * @param string 待渲染的字符串 - * @return null */ - public static String renderString(HttpServletResponse response, String string) + public static void renderString(HttpServletResponse response, String string) { try { + response.setStatus(200); response.setContentType("application/json"); response.setCharacterEncoding("utf-8"); response.getWriter().print(string); @@ -122,7 +149,6 @@ public class ServletUtils { e.printStackTrace(); } - return null; } /** @@ -154,30 +180,6 @@ public class ServletUtils return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); } - /** - * 判断User-Agent 是不是来自于手机 - */ - public static boolean checkAgentIsMobile(String ua) - { - boolean flag = false; - if (!ua.contains("Windows NT") || (ua.contains("Windows NT") && ua.contains("compatible; MSIE 9.0;"))) - { - // 排除 苹果桌面系统 - if (!ua.contains("Windows NT") && !ua.contains("Macintosh")) - { - for (String item : agent) - { - if (ua.contains(item)) - { - flag = true; - break; - } - } - } - } - return flag; - } - /** * 内容编码 * diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShiroUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShiroUtils.java deleted file mode 100644 index 1c7ab4ddb..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShiroUtils.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ruoyi.common.utils; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.crypto.SecureRandomNumberGenerator; -import org.apache.shiro.session.Session; -import org.apache.shiro.subject.Subject; -import org.apache.shiro.subject.PrincipalCollection; -import org.apache.shiro.subject.SimplePrincipalCollection; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.bean.BeanUtils; - -/** - * shiro 工具类 - * - * @author ruoyi - */ -public class ShiroUtils -{ - public static Subject getSubject() - { - return SecurityUtils.getSubject(); - } - - public static Session getSession() - { - return SecurityUtils.getSubject().getSession(); - } - - public static void logout() - { - getSubject().logout(); - } - - public static SysUser getSysUser() - { - SysUser user = null; - Object obj = getSubject().getPrincipal(); - if (StringUtils.isNotNull(obj)) - { - user = new SysUser(); - BeanUtils.copyBeanProp(user, obj); - } - return user; - } - - public static void setSysUser(SysUser user) - { - Subject subject = getSubject(); - PrincipalCollection principalCollection = subject.getPrincipals(); - String realmName = principalCollection.getRealmNames().iterator().next(); - PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realmName); - // 重新加载Principal - subject.runAs(newPrincipalCollection); - } - - public static Long getUserId() - { - return getSysUser().getUserId().longValue(); - } - - public static String getLoginName() - { - return getSysUser().getLoginName(); - } - - public static String getIp() - { - return StringUtils.substring(getSubject().getSession().getHost(), 0, 128); - } - - public static String getSessionId() - { - return String.valueOf(getSubject().getSession().getId()); - } - - /** - * 生成随机盐 - */ - public static String randomSalt() - { - // 一个Byte占两个字节,此处生成的3字节,字符串长度为6 - SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator(); - String hex = secureRandom.nextBytes(3).toHex(); - return hex; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java index b623672a7..fc6c6b5e0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java @@ -286,6 +286,30 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils return str.substring(start, end); } + /** + * 判断是否为空,并且不是空白字符 + * + * @param str 要判断的value + * @return 结果 + */ + public static boolean hasText(String str) + { + return (str != null && !str.isEmpty() && containsText(str)); + } + + private static boolean containsText(CharSequence str) + { + int strLen = str.length(); + for (int i = 0; i < strLen; i++) + { + if (!Character.isWhitespace(str.charAt(i))) + { + return true; + } + } + return false; + } + /** * 格式化文本, {} 表示占位符
    * 此方法只是简单将占位符 {} 按照顺序替换为参数
    @@ -490,22 +514,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 * @@ -673,4 +681,4 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } return sb.toString(); } -} +} \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java index 193419506..71fe6d52e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java @@ -36,7 +36,7 @@ public class Threads * 停止线程池 * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. - * 如果仍人超時,則強制退出. + * 如果仍然超時,則強制退出. * 另对在shutdown时线程本身被调用中断做了处理. */ public static void shutdownAndAwaitTermination(ExecutorService pool) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 51fa59c84..4652a2985 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -17,7 +17,7 @@ import com.ruoyi.common.utils.uuid.Seq; /** * 文件上传工具类 - * + * * @author ruoyi */ public class FileUploadUtils @@ -102,8 +102,8 @@ public class FileUploadUtils throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, InvalidExtensionException { - int fileNameLength = Objects.requireNonNull(file.getOriginalFilename()).length(); - if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) + int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); + if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) { throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); } @@ -216,7 +216,7 @@ public class FileUploadUtils /** * 获取文件名的后缀 - * + * * @param file 表单文件 * @return 后缀名 */ @@ -229,4 +229,4 @@ public class FileUploadUtils } return extension; } -} \ No newline at end of file +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index 7d5aa6f89..5c96f7cba 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -11,13 +11,13 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.IdUtils; +import org.apache.commons.io.FilenameUtils; /** * 文件处理工具类 @@ -196,7 +196,6 @@ public class FileUtils * * @param response 响应对象 * @param realFileName 真实文件名 - * @return */ public static void setAttachmentResponseHeader(HttpServletResponse response, String realFileName) throws UnsupportedEncodingException { @@ -210,7 +209,9 @@ public class FileUtils .append("utf-8''") .append(percentEncodedFileName); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); response.setHeader("Content-disposition", contentDispositionValue.toString()); + response.setHeader("download-filename", percentEncodedFileName); } /** @@ -288,4 +289,3 @@ public class FileUtils return baseName; } } - diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java index 371e82323..f968f1a12 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java @@ -16,7 +16,7 @@ public class MimeTypeUtils public static final String IMAGE_BMP = "image/bmp"; public static final String IMAGE_GIF = "image/gif"; - + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; public static final String[] FLASH_EXTENSION = { "swf", "flv" }; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java index cd8cd4ff8..ebff3fd63 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/html/HTMLFilter.java @@ -332,7 +332,7 @@ public final class HTMLFilter final String name = m.group(1).toLowerCase(); if (allowed(name)) { - if (false == inArray(name, vSelfClosingTags)) + if (!inArray(name, vSelfClosingTags)) { if (vTagCounts.containsKey(name)) { @@ -387,7 +387,7 @@ public final class HTMLFilter { paramValue = processParamProtocol(paramValue); } - params.append(' ').append(paramName).append("=\"").append(paramValue).append("\""); + params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\\\""); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java new file mode 100644 index 000000000..589d12310 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpHelper.java @@ -0,0 +1,55 @@ +package com.ruoyi.common.utils.http; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; +import javax.servlet.ServletRequest; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 通用http工具封装 + * + * @author ruoyi + */ +public class HttpHelper +{ + private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); + + public static String getBodyString(ServletRequest request) + { + StringBuilder sb = new StringBuilder(); + BufferedReader reader = null; + try (InputStream inputStream = request.getInputStream()) + { + reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + String line = ""; + while ((line = reader.readLine()) != null) + { + sb.append(line); + } + } + catch (IOException e) + { + LOGGER.warn("getBodyString出现问题!"); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + LOGGER.error(ExceptionUtils.getMessage(e)); + } + } + } + return sb.toString(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java index 46f56ab02..d3b61cad5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/http/HttpUtils.java @@ -216,7 +216,7 @@ public class HttpUtils String ret = ""; while ((ret = br.readLine()) != null) { - if (ret != null && !ret.trim().equals("")) + if (ret != null && !"".equals(ret.trim())) { result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/AddressUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java similarity index 83% rename from ruoyi-common/src/main/java/com/ruoyi/common/utils/AddressUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java index a259975ba..edfe419a0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/AddressUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/AddressUtils.java @@ -1,54 +1,56 @@ -package com.ruoyi.common.utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.alibaba.fastjson.JSONObject; -import com.ruoyi.common.config.RuoYiConfig; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.http.HttpUtils; - -/** - * 获取地址类 - * - * @author ruoyi - */ -public class AddressUtils -{ - private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); - - // IP地址查询 - public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; - - // 未知地址 - public static final String UNKNOWN = "XX XX"; - - public static String getRealAddressByIP(String ip) - { - // 内网不查询 - if (IpUtils.internalIp(ip)) - { - return "内网IP"; - } - if (RuoYiConfig.isAddressEnabled()) - { - try - { - String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); - if (StringUtils.isEmpty(rspStr)) - { - log.error("获取地理位置异常 {}", ip); - return UNKNOWN; - } - JSONObject obj = JSONObject.parseObject(rspStr); - String region = obj.getString("pro"); - String city = obj.getString("city"); - return String.format("%s %s", region, city); - } - catch (Exception e) - { - log.error("获取地理位置异常 {}", e); - } - } - return UNKNOWN; - } -} +package com.ruoyi.common.utils.ip; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; + +/** + * 获取地址类 + * + * @author ruoyi + */ +public class AddressUtils +{ + private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); + + // IP地址查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; + + // 未知地址 + public static final String UNKNOWN = "XX XX"; + + public static String getRealAddressByIP(String ip) + { + // 内网不查询 + if (IpUtils.internalIp(ip)) + { + return "内网IP"; + } + if (RuoYiConfig.isAddressEnabled()) + { + try + { + String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); + if (StringUtils.isEmpty(rspStr)) + { + log.error("获取地理位置异常 {}", ip); + return UNKNOWN; + } + JSONObject obj = JSON.parseObject(rspStr); + String region = obj.getString("pro"); + String city = obj.getString("city"); + return String.format("%s %s", region, city); + } + catch (Exception e) + { + log.error("获取地理位置异常 {}", ip); + } + } + return UNKNOWN; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/IpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java similarity index 96% rename from ruoyi-common/src/main/java/com/ruoyi/common/utils/IpUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java index 1a3f210cd..8e89e30d0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/IpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java @@ -1,370 +1,382 @@ -package com.ruoyi.common.utils; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import javax.servlet.http.HttpServletRequest; - -/** - * 获取IP方法 - * - * @author ruoyi - */ -public class IpUtils -{ - public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)"; - // 匹配 ip - public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; - public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))"; - // 匹配网段 - public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")"; - - /** - * 获取客户端IP - * - * @param request 请求对象 - * @return IP地址 - */ - public static String getIpAddr(HttpServletRequest request) - { - if (request == null) - { - return "unknown"; - } - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("X-Forwarded-For"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getHeader("X-Real-IP"); - } - - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) - { - ip = request.getRemoteAddr(); - } - - return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); - } - - /** - * 检查是否为内部IP地址 - * - * @param ip IP地址 - * @return 结果 - */ - public static boolean internalIp(String ip) - { - byte[] addr = textToNumericFormatV4(ip); - return internalIp(addr) || "127.0.0.1".equals(ip); - } - - /** - * 检查是否为内部IP地址 - * - * @param addr byte地址 - * @return 结果 - */ - private static boolean internalIp(byte[] addr) - { - if (StringUtils.isNull(addr) || addr.length < 2) - { - return true; - } - final byte b0 = addr[0]; - final byte b1 = addr[1]; - // 10.x.x.x/8 - final byte SECTION_1 = 0x0A; - // 172.16.x.x/12 - final byte SECTION_2 = (byte) 0xAC; - final byte SECTION_3 = (byte) 0x10; - final byte SECTION_4 = (byte) 0x1F; - // 192.168.x.x/16 - final byte SECTION_5 = (byte) 0xC0; - final byte SECTION_6 = (byte) 0xA8; - switch (b0) - { - case SECTION_1: - return true; - case SECTION_2: - if (b1 >= SECTION_3 && b1 <= SECTION_4) - { - return true; - } - case SECTION_5: - switch (b1) - { - case SECTION_6: - return true; - } - default: - return false; - } - } - - /** - * 将IPv4地址转换成字节 - * - * @param text IPv4地址 - * @return byte 字节 - */ - public static byte[] textToNumericFormatV4(String text) - { - if (text.length() == 0) - { - return null; - } - - byte[] bytes = new byte[4]; - String[] elements = text.split("\\.", -1); - try - { - long l; - int i; - switch (elements.length) - { - case 1: - l = Long.parseLong(elements[0]); - if ((l < 0L) || (l > 4294967295L)) - { - return null; - } - bytes[0] = (byte) (int) (l >> 24 & 0xFF); - bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); - bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 2: - l = Integer.parseInt(elements[0]); - if ((l < 0L) || (l > 255L)) - { - return null; - } - bytes[0] = (byte) (int) (l & 0xFF); - l = Integer.parseInt(elements[1]); - if ((l < 0L) || (l > 16777215L)) - { - return null; - } - bytes[1] = (byte) (int) (l >> 16 & 0xFF); - bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 3: - for (i = 0; i < 2; ++i) - { - l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) - { - return null; - } - bytes[i] = (byte) (int) (l & 0xFF); - } - l = Integer.parseInt(elements[2]); - if ((l < 0L) || (l > 65535L)) - { - return null; - } - bytes[2] = (byte) (int) (l >> 8 & 0xFF); - bytes[3] = (byte) (int) (l & 0xFF); - break; - case 4: - for (i = 0; i < 4; ++i) - { - l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) - { - return null; - } - bytes[i] = (byte) (int) (l & 0xFF); - } - break; - default: - return null; - } - } - catch (NumberFormatException e) - { - return null; - } - return bytes; - } - - /** - * 获取IP地址 - * - * @return 本地IP地址 - */ - public static String getHostIp() - { - try - { - return InetAddress.getLocalHost().getHostAddress(); - } - catch (UnknownHostException e) - { - } - return "127.0.0.1"; - } - - /** - * 获取主机名 - * - * @return 本地主机名 - */ - public static String getHostName() - { - try - { - return InetAddress.getLocalHost().getHostName(); - } - catch (UnknownHostException e) - { - } - return "未知"; - } - - /** - * 从多级反向代理中获得第一个非unknown IP地址 - * - * @param ip 获得的IP地址 - * @return 第一个非unknown IP地址 - */ - public static String getMultistageReverseProxyIp(String ip) - { - // 多级反向代理检测 - if (ip != null && ip.indexOf(",") > 0) - { - final String[] ips = ip.trim().split(","); - for (String subIp : ips) - { - if (false == isUnknown(subIp)) - { - ip = subIp; - break; - } - } - } - return StringUtils.substring(ip, 0, 255); - } - - /** - * 检测给定字符串是否为未知,多用于检测HTTP请求相关 - * - * @param checkString 被检测的字符串 - * @return 是否未知 - */ - public static boolean isUnknown(String checkString) - { - return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); - } - - /** - * 是否为IP - */ - public static boolean isIP(String ip) - { - return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP); - } - - /** - * 是否为IP,或 *为间隔的通配符地址 - */ - public static boolean isIpWildCard(String ip) - { - return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD); - } - - /** - * 检测参数是否在ip通配符里 - */ - public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip) - { - String[] s1 = ipWildCard.split("\\."); - String[] s2 = ip.split("\\."); - boolean isMatchedSeg = true; - for (int i = 0; i < s1.length && !s1[i].equals("*"); i++) - { - if (!s1[i].equals(s2[i])) - { - isMatchedSeg = false; - break; - } - } - return isMatchedSeg; - } - - /** - * 是否为特定格式如:“10.10.10.1-10.10.10.99”的ip段字符串 - */ - public static boolean isIPSegment(String ipSeg) - { - return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG); - } - - /** - * 判断ip是否在指定网段中 - */ - public static boolean ipIsInNetNoCheck(String iparea, String ip) - { - int idx = iparea.indexOf('-'); - String[] sips = iparea.substring(0, idx).split("\\."); - String[] sipe = iparea.substring(idx + 1).split("\\."); - String[] sipt = ip.split("\\."); - long ips = 0L, ipe = 0L, ipt = 0L; - for (int i = 0; i < 4; ++i) - { - ips = ips << 8 | Integer.parseInt(sips[i]); - ipe = ipe << 8 | Integer.parseInt(sipe[i]); - ipt = ipt << 8 | Integer.parseInt(sipt[i]); - } - if (ips > ipe) - { - long t = ips; - ips = ipe; - ipe = t; - } - return ips <= ipt && ipt <= ipe; - } - - /** - * 校验ip是否符合过滤串规则 - * - * @param filter 过滤IP列表,支持后缀'*'通配,支持网段如:`10.10.10.1-10.10.10.99` - * @param ip 校验IP地址 - * @return boolean 结果 - */ - public static boolean isMatchedIp(String filter, String ip) - { - if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip)) - { - return false; - } - String[] ips = filter.split(";"); - for (String iStr : ips) - { - if (isIP(iStr) && iStr.equals(ip)) - { - return true; - } - else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip)) - { - return true; - } - else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip)) - { - return true; - } - } - return false; - } +package com.ruoyi.common.utils.ip; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import javax.servlet.http.HttpServletRequest; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * 获取IP方法 + * + * @author ruoyi + */ +public class IpUtils +{ + public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)"; + // 匹配 ip + public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; + public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))"; + // 匹配网段 + public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")"; + + /** + * 获取客户端IP + * + * @return IP地址 + */ + public static String getIpAddr() + { + return getIpAddr(ServletUtils.getRequest()); + } + + /** + * 获取客户端IP + * + * @param request 请求对象 + * @return IP地址 + */ + public static String getIpAddr(HttpServletRequest request) + { + if (request == null) + { + return "unknown"; + } + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Forwarded-For"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Real-IP"); + } + + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getRemoteAddr(); + } + + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param ip IP地址 + * @return 结果 + */ + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + /** + * 检查是否为内部IP地址 + * + * @param addr byte地址 + * @return 结果 + */ + private static boolean internalIp(byte[] addr) + { + if (StringUtils.isNull(addr) || addr.length < 2) + { + return true; + } + final byte b0 = addr[0]; + final byte b1 = addr[1]; + // 10.x.x.x/8 + final byte SECTION_1 = 0x0A; + // 172.16.x.x/12 + final byte SECTION_2 = (byte) 0xAC; + final byte SECTION_3 = (byte) 0x10; + final byte SECTION_4 = (byte) 0x1F; + // 192.168.x.x/16 + final byte SECTION_5 = (byte) 0xC0; + final byte SECTION_6 = (byte) 0xA8; + switch (b0) + { + case SECTION_1: + return true; + case SECTION_2: + if (b1 >= SECTION_3 && b1 <= SECTION_4) + { + return true; + } + case SECTION_5: + switch (b1) + { + case SECTION_6: + return true; + } + default: + return false; + } + } + + /** + * 将IPv4地址转换成字节 + * + * @param text IPv4地址 + * @return byte 字节 + */ + public static byte[] textToNumericFormatV4(String text) + { + if (text.length() == 0) + { + return null; + } + + byte[] bytes = new byte[4]; + String[] elements = text.split("\\.", -1); + try + { + long l; + int i; + switch (elements.length) + { + case 1: + l = Long.parseLong(elements[0]); + if ((l < 0L) || (l > 4294967295L)) + { + return null; + } + bytes[0] = (byte) (int) (l >> 24 & 0xFF); + bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 2: + l = Integer.parseInt(elements[0]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[0] = (byte) (int) (l & 0xFF); + l = Integer.parseInt(elements[1]); + if ((l < 0L) || (l > 16777215L)) + { + return null; + } + bytes[1] = (byte) (int) (l >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 3: + for (i = 0; i < 2; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + l = Integer.parseInt(elements[2]); + if ((l < 0L) || (l > 65535L)) + { + return null; + } + bytes[2] = (byte) (int) (l >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 4: + for (i = 0; i < 4; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) + { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + break; + default: + return null; + } + } + catch (NumberFormatException e) + { + return null; + } + return bytes; + } + + /** + * 获取IP地址 + * + * @return 本地IP地址 + */ + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + /** + * 获取主机名 + * + * @return 本地主机名 + */ + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } + + /** + * 从多级反向代理中获得第一个非unknown IP地址 + * + * @param ip 获得的IP地址 + * @return 第一个非unknown IP地址 + */ + public static String getMultistageReverseProxyIp(String ip) + { + // 多级反向代理检测 + if (ip != null && ip.indexOf(",") > 0) + { + final String[] ips = ip.trim().split(","); + for (String subIp : ips) + { + if (false == isUnknown(subIp)) + { + ip = subIp; + break; + } + } + } + return StringUtils.substring(ip, 0, 255); + } + + /** + * 检测给定字符串是否为未知,多用于检测HTTP请求相关 + * + * @param checkString 被检测的字符串 + * @return 是否未知 + */ + public static boolean isUnknown(String checkString) + { + return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); + } + + /** + * 是否为IP + */ + public static boolean isIP(String ip) + { + return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP); + } + + /** + * 是否为IP,或 *为间隔的通配符地址 + */ + public static boolean isIpWildCard(String ip) + { + return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD); + } + + /** + * 检测参数是否在ip通配符里 + */ + public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip) + { + String[] s1 = ipWildCard.split("\\."); + String[] s2 = ip.split("\\."); + boolean isMatchedSeg = true; + for (int i = 0; i < s1.length && !s1[i].equals("*"); i++) + { + if (!s1[i].equals(s2[i])) + { + isMatchedSeg = false; + break; + } + } + return isMatchedSeg; + } + + /** + * 是否为特定格式如:“10.10.10.1-10.10.10.99”的ip段字符串 + */ + public static boolean isIPSegment(String ipSeg) + { + return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG); + } + + /** + * 判断ip是否在指定网段中 + */ + public static boolean ipIsInNetNoCheck(String iparea, String ip) + { + int idx = iparea.indexOf('-'); + String[] sips = iparea.substring(0, idx).split("\\."); + String[] sipe = iparea.substring(idx + 1).split("\\."); + String[] sipt = ip.split("\\."); + long ips = 0L, ipe = 0L, ipt = 0L; + for (int i = 0; i < 4; ++i) + { + ips = ips << 8 | Integer.parseInt(sips[i]); + ipe = ipe << 8 | Integer.parseInt(sipe[i]); + ipt = ipt << 8 | Integer.parseInt(sipt[i]); + } + if (ips > ipe) + { + long t = ips; + ips = ipe; + ipe = t; + } + return ips <= ipt && ipt <= ipe; + } + + /** + * 校验ip是否符合过滤串规则 + * + * @param filter 过滤IP列表,支持后缀'*'通配,支持网段如:`10.10.10.1-10.10.10.99` + * @param ip 校验IP地址 + * @return boolean 结果 + */ + public static boolean isMatchedIp(String filter, String ip) + { + if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip)) + { + return false; + } + String[] ips = filter.split(";"); + for (String iStr : ips) + { + if (isIP(iStr) && iStr.equals(ip)) + { + return true; + } + else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip)) + { + return true; + } + else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip)) + { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/CipherUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/CipherUtils.java deleted file mode 100644 index 34c1a79de..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/CipherUtils.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ruoyi.common.utils.security; - -import java.security.Key; -import java.security.NoSuchAlgorithmException; -import javax.crypto.KeyGenerator; - -/** - * 对称密钥密码算法工具类 - * - * @author ruoyi - */ -public class CipherUtils -{ - /** - * 生成随机秘钥 - * - * @param keyBitSize 字节大小 - * @param algorithmName 算法名称 - * @return 创建密匙 - */ - public static Key generateNewKey(int keyBitSize, String algorithmName) - { - KeyGenerator kg; - try - { - kg = KeyGenerator.getInstance(algorithmName); - } - catch (NoSuchAlgorithmException e) - { - String msg = "Unable to acquire " + algorithmName + " algorithm. This is required to function."; - throw new IllegalStateException(msg, e); - } - kg.init(keyBitSize); - return kg.generateKey(); - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/PermissionUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/PermissionUtils.java deleted file mode 100644 index 3b6f098ca..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/PermissionUtils.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.ruoyi.common.utils.security; - -import java.beans.BeanInfo; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.subject.Subject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.PermissionConstants; -import com.ruoyi.common.utils.MessageUtils; - -/** - * permission 工具类 - * - * @author ruoyi - */ -public class PermissionUtils -{ - private static final Logger log = LoggerFactory.getLogger(PermissionUtils.class); - - /** - * 查看数据的权限 - */ - public static final String VIEW_PERMISSION = "no.view.permission"; - - /** - * 创建数据的权限 - */ - public static final String CREATE_PERMISSION = "no.create.permission"; - - /** - * 修改数据的权限 - */ - public static final String UPDATE_PERMISSION = "no.update.permission"; - - /** - * 删除数据的权限 - */ - public static final String DELETE_PERMISSION = "no.delete.permission"; - - /** - * 导出数据的权限 - */ - public static final String EXPORT_PERMISSION = "no.export.permission"; - - /** - * 其他数据的权限 - */ - public static final String PERMISSION = "no.permission"; - - /** - * 权限错误消息提醒 - * - * @param permissionsStr 错误信息 - * @return 提示信息 - */ - public static String getMsg(String permissionsStr) - { - String permission = StringUtils.substringBetween(permissionsStr, "[", "]"); - String msg = MessageUtils.message(PERMISSION, permission); - if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.ADD_PERMISSION)) - { - msg = MessageUtils.message(CREATE_PERMISSION, permission); - } - else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.EDIT_PERMISSION)) - { - msg = MessageUtils.message(UPDATE_PERMISSION, permission); - } - else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.REMOVE_PERMISSION)) - { - msg = MessageUtils.message(DELETE_PERMISSION, permission); - } - else if (StringUtils.endsWithIgnoreCase(permission, PermissionConstants.EXPORT_PERMISSION)) - { - msg = MessageUtils.message(EXPORT_PERMISSION, permission); - } - else if (StringUtils.endsWithAny(permission, - new String[] { PermissionConstants.VIEW_PERMISSION, PermissionConstants.LIST_PERMISSION })) - { - msg = MessageUtils.message(VIEW_PERMISSION, permission); - } - return msg; - } - - /** - * 返回用户属性值 - * - * @param property 属性名称 - * @return 用户属性值 - */ - public static Object getPrincipalProperty(String property) - { - Subject subject = SecurityUtils.getSubject(); - if (subject != null) - { - Object principal = subject.getPrincipal(); - try - { - BeanInfo bi = Introspector.getBeanInfo(principal.getClass()); - for (PropertyDescriptor pd : bi.getPropertyDescriptors()) - { - if (pd.getName().equals(property) == true) - { - return pd.getReadMethod().invoke(principal, (Object[]) null); - } - } - } - catch (Exception e) - { - log.error("Error reading property [{}] from principal of type [{}]", property, - principal.getClass().getName()); - } - } - return null; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java new file mode 100644 index 000000000..ca1cd9248 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package com.ruoyi.common.utils.sign; + +/** + * Base64工具类 + * + * @author ruoyi + */ +public final class Base64 +{ + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static + { + for (int i = 0; i < BASELENGTH; ++i) + { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) + { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) + { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) + { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) + { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + } + + private static boolean isWhiteSpace(char octect) + { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) + { + return (octect == PAD); + } + + private static boolean isData(char octect) + { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) + { + if (binaryData == null) + { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) + { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + + for (int i = 0; i < numberTriplets; i++) + { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) + { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } + else if (fewerThan24bits == SIXTEENBIT) + { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) + { + if (encoded == null) + { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) + { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) + { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) + { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) + { + return null; + } // if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) + { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) + {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) + { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } + else if (!isPad(d3) && isPad(d4)) + { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } + else + { + return null; + } + } + else + { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) + { + if (data == null) + { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) + { + if (!isWhiteSpace(data[i])) + { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java similarity index 93% rename from ruoyi-common/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java index 502eb0fd9..c1c58dbc0 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java @@ -1,67 +1,67 @@ -package com.ruoyi.common.utils.security; - -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Md5加密方法 - * - * @author ruoyi - */ -public class Md5Utils -{ - private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); - - private static byte[] md5(String s) - { - MessageDigest algorithm; - try - { - algorithm = MessageDigest.getInstance("MD5"); - algorithm.reset(); - algorithm.update(s.getBytes("UTF-8")); - byte[] messageDigest = algorithm.digest(); - return messageDigest; - } - catch (Exception e) - { - log.error("MD5 Error...", e); - } - return null; - } - - private static final String toHex(byte hash[]) - { - if (hash == null) - { - return null; - } - StringBuffer buf = new StringBuffer(hash.length * 2); - int i; - - for (i = 0; i < hash.length; i++) - { - if ((hash[i] & 0xff) < 0x10) - { - buf.append("0"); - } - buf.append(Long.toString(hash[i] & 0xff, 16)); - } - return buf.toString(); - } - - public static String hash(String s) - { - try - { - return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); - } - catch (Exception e) - { - log.error("not supported charset...{}", e); - return s; - } - } -} +package com.ruoyi.common.utils.sign; + +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Md5加密方法 + * + * @author ruoyi + */ +public class Md5Utils +{ + private static final Logger log = LoggerFactory.getLogger(Md5Utils.class); + + private static byte[] md5(String s) + { + MessageDigest algorithm; + try + { + algorithm = MessageDigest.getInstance("MD5"); + algorithm.reset(); + algorithm.update(s.getBytes("UTF-8")); + byte[] messageDigest = algorithm.digest(); + return messageDigest; + } + catch (Exception e) + { + log.error("MD5 Error...", e); + } + return null; + } + + private static final String toHex(byte hash[]) + { + if (hash == null) + { + return null; + } + StringBuffer buf = new StringBuffer(hash.length * 2); + int i; + + for (i = 0; i < hash.length; i++) + { + if ((hash[i] & 0xff) < 0x10) + { + buf.append("0"); + } + buf.append(Long.toString(hash[i] & 0xff, 16)); + } + return buf.toString(); + } + + public static String hash(String s) + { + try + { + return new String(toHex(md5(s)).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); + } + catch (Exception e) + { + log.error("not supported charset...{}", e); + return s; + } + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java index c5699ad49..f290ec376 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java @@ -16,7 +16,7 @@ import com.ruoyi.common.utils.StringUtils; * @author ruoyi */ @Component -public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware +public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware { /** Spring应用上下文环境 */ private static ConfigurableListableBeanFactory beanFactory; @@ -24,13 +24,13 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC private static ApplicationContext applicationContext; @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { SpringUtils.beanFactory = beanFactory; } @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { SpringUtils.applicationContext = applicationContext; } @@ -155,5 +155,4 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC { return applicationContext.getEnvironment().getRequiredProperty(key); } - } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java index e3b032f4e..97497f285 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java @@ -66,7 +66,7 @@ public final class UUID implements java.io.Serializable, Comparable } /** - * 获取类型 4(伪随机生成的)UUID 的静态工厂。 + * 获取类型 4(伪随机生成的)UUID 的静态工厂。 * * @return 随机生成的 {@code UUID} */ @@ -343,25 +343,25 @@ public final class UUID implements java.io.Serializable, Comparable final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36); // time_low builder.append(digits(mostSigBits >> 32, 8)); - if (false == isSimple) + if (!isSimple) { builder.append('-'); } // time_mid builder.append(digits(mostSigBits >> 16, 4)); - if (false == isSimple) + if (!isSimple) { builder.append('-'); } // time_high_and_version builder.append(digits(mostSigBits, 4)); - if (false == isSimple) + if (!isSimple) { builder.append('-'); } // variant_and_sequence builder.append(digits(leastSigBits >> 48, 4)); - if (false == isSimple) + if (!isSimple) { builder.append('-'); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssHttpServletRequestWrapper.java deleted file mode 100644 index 516db0a90..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/xss/XssHttpServletRequestWrapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ruoyi.common.xss; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; -import com.ruoyi.common.utils.html.EscapeUtil; - -/** - * XSS过滤处理 - * - * @author ruoyi - */ -public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper -{ - /** - * @param request - */ - public XssHttpServletRequestWrapper(HttpServletRequest request) - { - super(request); - } - - @Override - public String[] getParameterValues(String name) - { - String[] values = super.getParameterValues(name); - if (values != null) - { - int length = values.length; - String[] escapseValues = new String[length]; - for (int i = 0; i < length; i++) - { - // 防xss攻击和过滤前后空格 - escapseValues[i] = EscapeUtil.clean(values[i]).trim(); - } - return escapseValues; - } - return super.getParameterValues(name); - } -} \ No newline at end of file diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 002b5a9ee..a81c38cda 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 4.7.8 + 3.8.7 4.0.0 @@ -18,7 +18,7 @@ - + org.springframework.boot spring-boot-starter-web @@ -47,24 +47,6 @@ - - - org.apache.shiro - shiro-spring - - - - - com.github.theborakompanioni - thymeleaf-extras-shiro - - - - - eu.bitwalker - UserAgentUtils - - com.github.oshi diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 85ba2f215..35a6b50d0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -7,17 +7,18 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.springframework.stereotype.Component; import com.ruoyi.common.annotation.DataScope; -import com.ruoyi.common.core.context.PermissionContextHolder; import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.text.Convert; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.security.context.PermissionContextHolder; /** * 数据过滤处理 - * + * * @author ruoyi */ @Aspect @@ -64,11 +65,12 @@ public class DataScopeAspect protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope) { // 获取当前的用户 - SysUser currentUser = ShiroUtils.getSysUser(); - if (currentUser != null) + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNotNull(loginUser)) { + SysUser currentUser = loginUser.getUser(); // 如果是超级管理员,则不过滤数据 - if (!currentUser.isAdmin()) + if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) { String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext()); dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), @@ -79,7 +81,7 @@ public class DataScopeAspect /** * 数据范围过滤 - * + * * @param joinPoint 切点 * @param user 用户 * @param deptAlias 部门别名 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java index f72b8051b..4648fcd3c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java @@ -12,8 +12,8 @@ import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.ruoyi.common.annotation.DataSource; -import com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder; /** * 多数据源处理 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index d40b0f8ed..bd2205257 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -16,14 +16,17 @@ import org.springframework.core.NamedThreadLocal; import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import org.springframework.web.multipart.MultipartFile; -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.support.spring.PropertyPreFilters; +import com.alibaba.fastjson2.JSON; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.enums.BusinessStatus; +import com.ruoyi.common.enums.HttpMethod; +import com.ruoyi.common.filter.PropertyPreExcludeFilter; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.system.domain.SysOperLog; @@ -82,20 +85,20 @@ public class LogAspect try { // 获取当前的用户 - SysUser currentUser = ShiroUtils.getSysUser(); + LoginUser loginUser = SecurityUtils.getLoginUser(); // *========数据库日志=========*// SysOperLog operLog = new SysOperLog(); operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); // 请求的地址 - String ip = ShiroUtils.getIp(); + String ip = IpUtils.getIpAddr(); operLog.setOperIp(ip); operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255)); - if (currentUser != null) + if (loginUser != null) { - operLog.setOperName(currentUser.getLoginName()); - if (StringUtils.isNotNull(currentUser.getDept()) - && StringUtils.isNotEmpty(currentUser.getDept().getDeptName())) + operLog.setOperName(loginUser.getUsername()); + SysUser currentUser = loginUser.getUser(); + if (StringUtils.isNotNull(currentUser) && StringUtils.isNotNull(currentUser.getDept())) { operLog.setDeptName(currentUser.getDept().getDeptName()); } @@ -155,7 +158,7 @@ public class LogAspect // 是否需要保存response,参数和值 if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult)) { - operLog.setJsonResult(StringUtils.substring(JSONObject.toJSONString(jsonResult), 0, 2000)); + operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000)); } } @@ -167,31 +170,20 @@ public class LogAspect */ private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception { - Map map = ServletUtils.getRequest().getParameterMap(); - if (StringUtils.isNotEmpty(map)) + Map paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest()); + String requestMethod = operLog.getRequestMethod(); + if (StringUtils.isEmpty(paramsMap) + && (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod))) { - String params = JSONObject.toJSONString(map, excludePropertyPreFilter(excludeParamNames)); + String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames); operLog.setOperParam(StringUtils.substring(params, 0, 2000)); } else { - Object args = joinPoint.getArgs(); - if (StringUtils.isNotNull(args)) - { - String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames); - operLog.setOperParam(StringUtils.substring(params, 0, 2000)); - } + operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, 2000)); } } - /** - * 忽略敏感属性 - */ - public PropertyPreFilters.MySimplePropertyPreFilter excludePropertyPreFilter(String[] excludeParamNames) - { - return new PropertyPreFilters().addFilter().addExcludes(ArrayUtils.addAll(EXCLUDE_PROPERTIES, excludeParamNames)); - } - /** * 参数拼装 */ @@ -206,7 +198,7 @@ public class LogAspect { try { - Object jsonObj = JSONObject.toJSONString(o, excludePropertyPreFilter(excludeParamNames)); + String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames)); params += jsonObj.toString() + " "; } catch (Exception e) @@ -218,6 +210,14 @@ public class LogAspect return params.trim(); } + /** + * 忽略敏感属性 + */ + public PropertyPreExcludeFilter excludePropertyPreFilter(String[] excludeParamNames) + { + return new PropertyPreExcludeFilter().addExcludes(ArrayUtils.addAll(EXCLUDE_PROPERTIES, excludeParamNames)); + } + /** * 判断是否需要过滤的对象。 * diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/PermissionsAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/PermissionsAspect.java deleted file mode 100644 index 9d9831f82..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/PermissionsAspect.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ruoyi.framework.aspectj; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -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.context.PermissionContextHolder; -import com.ruoyi.common.utils.StringUtils; - -/** - * 自定义权限拦截器,将权限字符串放到当前请求中以便用于多个角色匹配符合要求的权限 - * - * @author ruoyi - */ -@Aspect -@Component -public class PermissionsAspect -{ - @Before("@annotation(controllerRequiresPermissions)") - public void doBefore(JoinPoint point, RequiresPermissions controllerRequiresPermissions) throws Throwable - { - handleRequiresPermissions(point, controllerRequiresPermissions); - } - - protected void handleRequiresPermissions(final JoinPoint joinPoint, RequiresPermissions requiresPermissions) - { - PermissionContextHolder.setContext(StringUtils.join(requiresPermissions.value(), ",")); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java new file mode 100644 index 000000000..b720bc182 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java @@ -0,0 +1,89 @@ +package com.ruoyi.framework.aspectj; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.List; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.RedisScript; +import org.springframework.stereotype.Component; +import com.ruoyi.common.annotation.RateLimiter; +import com.ruoyi.common.enums.LimitType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; + +/** + * 限流处理 + * + * @author ruoyi + */ +@Aspect +@Component +public class RateLimiterAspect +{ + private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class); + + private RedisTemplate redisTemplate; + + private RedisScript limitScript; + + @Autowired + public void setRedisTemplate1(RedisTemplate redisTemplate) + { + this.redisTemplate = redisTemplate; + } + + @Autowired + public void setLimitScript(RedisScript limitScript) + { + this.limitScript = limitScript; + } + + @Before("@annotation(rateLimiter)") + public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable + { + int time = rateLimiter.time(); + int count = rateLimiter.count(); + + String combineKey = getCombineKey(rateLimiter, point); + List keys = Collections.singletonList(combineKey); + try + { + Long number = redisTemplate.execute(limitScript, keys, count, time); + if (StringUtils.isNull(number) || number.intValue() > count) + { + throw new ServiceException("访问过于频繁,请稍候再试"); + } + log.info("限制请求'{}',当前请求'{}',缓存key'{}'", count, number.intValue(), combineKey); + } + catch (ServiceException e) + { + throw e; + } + catch (Exception e) + { + throw new RuntimeException("服务器限流异常,请稍候再试"); + } + } + + public String getCombineKey(RateLimiter rateLimiter, JoinPoint point) + { + StringBuffer stringBuffer = new StringBuffer(rateLimiter.key()); + if (rateLimiter.limitType() == LimitType.IP) + { + stringBuffer.append(IpUtils.getIpAddr()).append("-"); + } + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + Class targetClass = method.getDeclaringClass(); + stringBuffer.append(targetClass.getName()).append("-").append(method.getName()); + return stringBuffer.toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java index b6b0e88c6..1d4dc1f72 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java @@ -1,6 +1,9 @@ package com.ruoyi.framework.config; +import java.util.TimeZone; import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; @@ -16,5 +19,12 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; @MapperScan("com.ruoyi.**.mapper") public class ApplicationConfig { - + /** + * 时区配置 + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() + { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault()); + } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java index b4c356bb0..f671b3a30 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -58,7 +58,7 @@ public class DruidConfig setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource"); return new DynamicDataSource(masterDataSource, targetDataSources); } - + /** * 设置数据源 * @@ -99,7 +99,6 @@ public class DruidConfig public void init(javax.servlet.FilterConfig filterConfig) throws ServletException { } - @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException @@ -114,7 +113,6 @@ public class DruidConfig text = text.replaceAll("powered.*?shrek.wang", ""); response.getWriter().write(text); } - @Override public void destroy() { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java new file mode 100644 index 000000000..4adbb7fd9 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FastJson2JsonRedisSerializer.java @@ -0,0 +1,52 @@ +package com.ruoyi.framework.config; + +import java.nio.charset.Charset; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.SerializationException; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONReader; +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.filter.Filter; +import com.ruoyi.common.constant.Constants; + +/** + * Redis使用FastJson序列化 + * + * @author ruoyi + */ +public class FastJson2JsonRedisSerializer implements RedisSerializer +{ + public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + + static final Filter AUTO_TYPE_FILTER = JSONReader.autoTypeFilter(Constants.JSON_WHITELIST_STR); + + private Class clazz; + + public FastJson2JsonRedisSerializer(Class clazz) + { + super(); + this.clazz = clazz; + } + + @Override + public byte[] serialize(T t) throws SerializationException + { + if (t == null) + { + return new byte[0]; + } + return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET); + } + + @Override + public T deserialize(byte[] bytes) throws SerializationException + { + if (bytes == null || bytes.length <= 0) + { + return null; + } + String str = new String(bytes, DEFAULT_CHARSET); + + return JSON.parseObject(str, clazz, AUTO_TYPE_FILTER); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java index b7d10b8f9..610807a86 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/FilterConfig.java @@ -8,8 +8,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import com.ruoyi.common.filter.RepeatableFilter; +import com.ruoyi.common.filter.XssFilter; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.xss.XssFilter; /** * Filter配置 @@ -17,7 +18,6 @@ import com.ruoyi.common.xss.XssFilter; * @author ruoyi */ @Configuration -@ConditionalOnProperty(value = "xss.enabled", havingValue = "true") public class FilterConfig { @Value("${xss.excludes}") @@ -28,6 +28,7 @@ public class FilterConfig @SuppressWarnings({ "rawtypes", "unchecked" }) @Bean + @ConditionalOnProperty(value = "xss.enabled", havingValue = "true") public FilterRegistrationBean xssFilterRegistration() { FilterRegistrationBean registration = new FilterRegistrationBean(); @@ -41,4 +42,17 @@ public class FilterConfig registration.setInitParameters(initParameters); return registration; } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Bean + public FilterRegistrationBean someFilterRegistration() + { + FilterRegistrationBean registration = new FilterRegistrationBean(); + registration.setFilter(new RepeatableFilter()); + registration.addUrlPatterns("/*"); + registration.setName("repeatableFilter"); + registration.setOrder(FilterRegistrationBean.LOWEST_PRECEDENCE); + return registration; + } + } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java index 1e977ba0e..7d0838b88 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/I18nConfig.java @@ -40,4 +40,4 @@ public class I18nConfig implements WebMvcConfigurer { registry.addInterceptor(localeChangeInterceptor()); } -} \ No newline at end of file +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java index bd0dabb01..1907319f0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/KaptchaTextCreator.java @@ -1,12 +1,11 @@ package com.ruoyi.framework.config; -import java.security.SecureRandom; import java.util.Random; import com.google.code.kaptcha.text.impl.DefaultTextCreator; /** * 验证码文本生成器 - * + * * @author ruoyi */ public class KaptchaTextCreator extends DefaultTextCreator @@ -17,11 +16,11 @@ public class KaptchaTextCreator extends DefaultTextCreator public String getText() { Integer result = 0; - Random random = new SecureRandom(); + Random random = new Random(); int x = random.nextInt(10); int y = random.nextInt(10); StringBuilder suChinese = new StringBuilder(); - int randomoperands = (int) Math.round(Math.random() * 2); + int randomoperands = random.nextInt(3); if (randomoperands == 0) { result = x * y; @@ -31,7 +30,7 @@ public class KaptchaTextCreator extends DefaultTextCreator } else if (randomoperands == 1) { - if (!(x == 0) && y % x == 0) + if ((x != 0) && y % x == 0) { result = y / x; suChinese.append(CNUMBERS[y]); @@ -46,7 +45,7 @@ public class KaptchaTextCreator extends DefaultTextCreator suChinese.append(CNUMBERS[y]); } } - else if (randomoperands == 2) + else { if (x >= y) { @@ -63,14 +62,7 @@ public class KaptchaTextCreator extends DefaultTextCreator suChinese.append(CNUMBERS[x]); } } - else - { - result = x + y; - suChinese.append(CNUMBERS[x]); - suChinese.append("+"); - suChinese.append(CNUMBERS[y]); - } suChinese.append("=?@" + result); return suChinese.toString(); } -} +} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java new file mode 100644 index 000000000..3f4f485f0 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -0,0 +1,69 @@ +package com.ruoyi.framework.config; + +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.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.script.DefaultRedisScript; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * redis配置 + * + * @author ruoyi + */ +@Configuration +@EnableCaching +public class RedisConfig extends CachingConfigurerSupport +{ + @Bean + @SuppressWarnings(value = { "unchecked", "rawtypes" }) + public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) + { + RedisTemplate template = new RedisTemplate<>(); + template.setConnectionFactory(connectionFactory); + + FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); + + // 使用StringRedisSerializer来序列化和反序列化redis的key值 + template.setKeySerializer(new StringRedisSerializer()); + template.setValueSerializer(serializer); + + // Hash的key也采用StringRedisSerializer的序列化方式 + template.setHashKeySerializer(new StringRedisSerializer()); + template.setHashValueSerializer(serializer); + + template.afterPropertiesSet(); + return template; + } + + @Bean + public DefaultRedisScript limitScript() + { + DefaultRedisScript redisScript = new DefaultRedisScript<>(); + redisScript.setScriptText(limitScriptText()); + redisScript.setResultType(Long.class); + return redisScript; + } + + /** + * 限流脚本 + */ + private String limitScriptText() + { + return "local key = KEYS[1]\n" + + "local count = tonumber(ARGV[1])\n" + + "local time = tonumber(ARGV[2])\n" + + "local current = redis.call('get', key);\n" + + "if current and tonumber(current) > count then\n" + + " return tonumber(current);\n" + + "end\n" + + "current = redis.call('incr', key)\n" + + "if tonumber(current) == 1 then\n" + + " redis.call('expire', key, time)\n" + + "end\n" + + "return tonumber(current);"; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java index 98c36c6a8..4e067a7b1 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java @@ -1,11 +1,15 @@ package com.ruoyi.framework.config; +import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.CacheControl; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.Constants; @@ -19,32 +23,20 @@ import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; @Configuration public class ResourcesConfig implements WebMvcConfigurer { - /** - * 首页地址 - */ - @Value("${shiro.user.indexUrl}") - private String indexUrl; - @Autowired private RepeatSubmitInterceptor repeatSubmitInterceptor; - /** - * 默认首页的设置,当输入域名是可以自动跳转到默认指定的网页 - */ - @Override - public void addViewControllers(ViewControllerRegistry registry) - { - registry.addViewController("/").setViewName("forward:" + indexUrl); - } - @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { /** 本地文件上传路径 */ - registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") + .addResourceLocations("file:" + RuoYiConfig.getProfile() + "/"); /** swagger配置 */ - registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); + registry.addResourceHandler("/swagger-ui/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/") + .setCacheControl(CacheControl.maxAge(5, TimeUnit.HOURS).cachePublic());; } /** @@ -55,4 +47,27 @@ public class ResourcesConfig implements WebMvcConfigurer { registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**"); } + + /** + * 跨域配置 + */ + @Bean + public CorsFilter corsFilter() + { + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + // 设置访问源地址 + config.addAllowedOriginPattern("*"); + // 设置访问源请求头 + config.addAllowedHeader("*"); + // 设置访问源请求方法 + config.addAllowedMethod("*"); + // 有效期 1800秒 + config.setMaxAge(1800L); + // 添加映射路径,拦截一切请求 + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", config); + // 返回新的CorsFilter + return new CorsFilter(source); + } } \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java new file mode 100644 index 000000000..212585323 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -0,0 +1,148 @@ +package com.ruoyi.framework.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.web.filter.CorsFilter; +import com.ruoyi.framework.config.properties.PermitAllUrlProperties; +import com.ruoyi.framework.security.filter.JwtAuthenticationTokenFilter; +import com.ruoyi.framework.security.handle.AuthenticationEntryPointImpl; +import com.ruoyi.framework.security.handle.LogoutSuccessHandlerImpl; + +/** + * spring security配置 + * + * @author ruoyi + */ +@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) +public class SecurityConfig extends WebSecurityConfigurerAdapter +{ + /** + * 自定义用户认证逻辑 + */ + @Autowired + private UserDetailsService userDetailsService; + + /** + * 认证失败处理类 + */ + @Autowired + private AuthenticationEntryPointImpl unauthorizedHandler; + + /** + * 退出处理类 + */ + @Autowired + private LogoutSuccessHandlerImpl logoutSuccessHandler; + + /** + * token认证过滤器 + */ + @Autowired + private JwtAuthenticationTokenFilter authenticationTokenFilter; + + /** + * 跨域过滤器 + */ + @Autowired + private CorsFilter corsFilter; + + /** + * 允许匿名访问的地址 + */ + @Autowired + private PermitAllUrlProperties permitAllUrl; + + /** + * 解决 无法直接注入 AuthenticationManager + * + * @return + * @throws Exception + */ + @Bean + @Override + public AuthenticationManager authenticationManagerBean() throws Exception + { + return super.authenticationManagerBean(); + } + + /** + * anyRequest | 匹配所有请求路径 + * access | SpringEl表达式结果为true时可以访问 + * anonymous | 匿名可以访问 + * denyAll | 用户不能访问 + * fullyAuthenticated | 用户完全认证可以访问(非remember-me下自动登录) + * hasAnyAuthority | 如果有参数,参数表示权限,则其中任何一个权限可以访问 + * hasAnyRole | 如果有参数,参数表示角色,则其中任何一个角色可以访问 + * hasAuthority | 如果有参数,参数表示权限,则其权限可以访问 + * hasIpAddress | 如果有参数,参数表示IP地址,如果用户IP和参数匹配,则可以访问 + * hasRole | 如果有参数,参数表示角色,则其角色可以访问 + * permitAll | 用户可以任意访问 + * rememberMe | 允许通过remember-me登录的用户访问 + * authenticated | 用户登录后可访问 + */ + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception + { + // 注解标记允许匿名访问的url + ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry = httpSecurity.authorizeRequests(); + permitAllUrl.getUrls().forEach(url -> registry.antMatchers(url).permitAll()); + + httpSecurity + // CSRF禁用,因为不使用session + .csrf().disable() + // 禁用HTTP响应标头 + .headers().cacheControl().disable().and() + // 认证失败处理类 + .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and() + // 基于token,所以不需要session + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() + // 过滤请求 + .authorizeRequests() + // 对于登录login 注册register 验证码captchaImage 允许匿名访问 + .antMatchers("/login", "/register", "/captchaImage").permitAll() + // 静态资源,可匿名访问 + .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() + .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll() + // 除上面外的所有请求全部需要鉴权认证 + .anyRequest().authenticated() + .and() + .headers().frameOptions().disable(); + // 添加Logout filter + httpSecurity.logout().logoutUrl("/logout").logoutSuccessHandler(logoutSuccessHandler); + // 添加JWT filter + httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); + // 添加CORS filter + httpSecurity.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class); + httpSecurity.addFilterBefore(corsFilter, LogoutFilter.class); + } + + /** + * 强散列哈希加密实现 + */ + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() + { + return new BCryptPasswordEncoder(); + } + + /** + * 身份认证接口 + */ + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception + { + auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java similarity index 92% rename from ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java rename to ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java index ddb873097..b5b7de316 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java @@ -1,33 +1,32 @@ -package com.ruoyi.common.config; - -import javax.servlet.http.HttpServletRequest; -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.ServletUtils; - -/** - * 服务相关配置 - * - * @author ruoyi - * - */ -@Component -public class ServerConfig -{ - /** - * 获取完整的请求路径,包括:域名,端口,上下文访问路径 - * - * @return 服务地址 - */ - public String getUrl() - { - HttpServletRequest request = ServletUtils.getRequest(); - return getDomain(request); - } - - public static String getDomain(HttpServletRequest request) - { - StringBuffer url = request.getRequestURL(); - String contextPath = request.getServletContext().getContextPath(); - return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); - } -} +package com.ruoyi.framework.config; + +import javax.servlet.http.HttpServletRequest; +import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.ServletUtils; + +/** + * 服务相关配置 + * + * @author ruoyi + */ +@Component +public class ServerConfig +{ + /** + * 获取完整的请求路径,包括:域名,端口,上下文访问路径 + * + * @return 服务地址 + */ + public String getUrl() + { + HttpServletRequest request = ServletUtils.getRequest(); + return getDomain(request); + } + + public static String getDomain(HttpServletRequest request) + { + StringBuffer url = request.getRequestURL(); + String contextPath = request.getServletContext().getContextPath(); + return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java deleted file mode 100644 index cd3e41164..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java +++ /dev/null @@ -1,423 +0,0 @@ -package com.ruoyi.framework.config; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.servlet.Filter; -import org.apache.commons.io.IOUtils; -import org.apache.shiro.cache.ehcache.EhCacheManager; -import org.apache.shiro.codec.Base64; -import org.apache.shiro.config.ConfigurationException; -import org.apache.shiro.io.ResourceUtils; -import org.apache.shiro.mgt.SecurityManager; -import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; -import org.apache.shiro.spring.web.ShiroFilterFactoryBean; -import org.apache.shiro.web.mgt.CookieRememberMeManager; -import org.apache.shiro.web.mgt.DefaultWebSecurityManager; -import org.apache.shiro.web.servlet.SimpleCookie; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.security.CipherUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.config.properties.PermitAllUrlProperties; -import com.ruoyi.framework.shiro.realm.UserRealm; -import com.ruoyi.framework.shiro.session.OnlineSessionDAO; -import com.ruoyi.framework.shiro.session.OnlineSessionFactory; -import com.ruoyi.framework.shiro.web.CustomShiroFilterFactoryBean; -import com.ruoyi.framework.shiro.web.filter.LogoutFilter; -import com.ruoyi.framework.shiro.web.filter.captcha.CaptchaValidateFilter; -import com.ruoyi.framework.shiro.web.filter.kickout.KickoutSessionFilter; -import com.ruoyi.framework.shiro.web.filter.online.OnlineSessionFilter; -import com.ruoyi.framework.shiro.web.filter.sync.SyncOnlineSessionFilter; -import com.ruoyi.framework.shiro.web.session.OnlineWebSessionManager; -import com.ruoyi.framework.shiro.web.session.SpringSessionValidationScheduler; -import at.pollux.thymeleaf.shiro.dialect.ShiroDialect; - -/** - * 权限配置加载 - * - * @author ruoyi - */ -@Configuration -public class ShiroConfig -{ - /** - * Session超时时间,单位为毫秒(默认30分钟) - */ - @Value("${shiro.session.expireTime}") - private int expireTime; - - /** - * 相隔多久检查一次session的有效性,单位毫秒,默认就是10分钟 - */ - @Value("${shiro.session.validationInterval}") - private int validationInterval; - - /** - * 同一个用户最大会话数 - */ - @Value("${shiro.session.maxSession}") - private int maxSession; - - /** - * 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 - */ - @Value("${shiro.session.kickoutAfter}") - private boolean kickoutAfter; - - /** - * 验证码开关 - */ - @Value("${shiro.user.captchaEnabled}") - private boolean captchaEnabled; - - /** - * 验证码类型 - */ - @Value("${shiro.user.captchaType}") - private String captchaType; - - /** - * 设置Cookie的域名 - */ - @Value("${shiro.cookie.domain}") - private String domain; - - /** - * 设置cookie的有效访问路径 - */ - @Value("${shiro.cookie.path}") - private String path; - - /** - * 设置HttpOnly属性 - */ - @Value("${shiro.cookie.httpOnly}") - private boolean httpOnly; - - /** - * 设置Cookie的过期时间,秒为单位 - */ - @Value("${shiro.cookie.maxAge}") - private int maxAge; - - /** - * 设置cipherKey密钥 - */ - @Value("${shiro.cookie.cipherKey}") - private String cipherKey; - - /** - * 登录地址 - */ - @Value("${shiro.user.loginUrl}") - private String loginUrl; - - /** - * 权限认证失败地址 - */ - @Value("${shiro.user.unauthorizedUrl}") - private String unauthorizedUrl; - - /** - * 是否开启记住我功能 - */ - @Value("${shiro.rememberMe.enabled: false}") - private boolean rememberMe; - - @Autowired - private PermitAllUrlProperties permitAllUrl; - - /** - * 缓存管理器 使用Ehcache实现 - */ - @Bean - public EhCacheManager getEhCacheManager() - { - net.sf.ehcache.CacheManager cacheManager = net.sf.ehcache.CacheManager.getCacheManager("ruoyi"); - EhCacheManager em = new EhCacheManager(); - if (StringUtils.isNull(cacheManager)) - { - em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream())); - return em; - } - else - { - em.setCacheManager(cacheManager); - return em; - } - } - - /** - * 返回配置文件流 避免ehcache配置文件一直被占用,无法完全销毁项目重新部署 - */ - protected InputStream getCacheManagerConfigFileInputStream() - { - String configFile = "classpath:ehcache/ehcache-shiro.xml"; - InputStream inputStream = null; - try - { - inputStream = ResourceUtils.getInputStreamForPath(configFile); - byte[] b = IOUtils.toByteArray(inputStream); - InputStream in = new ByteArrayInputStream(b); - return in; - } - catch (IOException e) - { - throw new ConfigurationException( - "Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e); - } - finally - { - IOUtils.closeQuietly(inputStream); - } - } - - /** - * 自定义Realm - */ - @Bean - public UserRealm userRealm(EhCacheManager cacheManager) - { - UserRealm userRealm = new UserRealm(); - userRealm.setAuthorizationCacheName(Constants.SYS_AUTH_CACHE); - userRealm.setCacheManager(cacheManager); - return userRealm; - } - - /** - * 自定义sessionDAO会话 - */ - @Bean - public OnlineSessionDAO sessionDAO() - { - OnlineSessionDAO sessionDAO = new OnlineSessionDAO(); - return sessionDAO; - } - - /** - * 自定义sessionFactory会话 - */ - @Bean - public OnlineSessionFactory sessionFactory() - { - OnlineSessionFactory sessionFactory = new OnlineSessionFactory(); - return sessionFactory; - } - - /** - * 会话管理器 - */ - @Bean - public OnlineWebSessionManager sessionManager() - { - OnlineWebSessionManager manager = new OnlineWebSessionManager(); - // 加入缓存管理器 - manager.setCacheManager(getEhCacheManager()); - // 删除过期的session - manager.setDeleteInvalidSessions(true); - // 设置全局session超时时间 - manager.setGlobalSessionTimeout(expireTime * 60 * 1000); - // 去掉 JSESSIONID - manager.setSessionIdUrlRewritingEnabled(false); - // 定义要使用的无效的Session定时调度器 - manager.setSessionValidationScheduler(SpringUtils.getBean(SpringSessionValidationScheduler.class)); - // 是否定时检查session - manager.setSessionValidationSchedulerEnabled(true); - // 自定义SessionDao - manager.setSessionDAO(sessionDAO()); - // 自定义sessionFactory - manager.setSessionFactory(sessionFactory()); - return manager; - } - - /** - * 安全管理器 - */ - @Bean - public SecurityManager securityManager(UserRealm userRealm) - { - DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); - // 设置realm. - securityManager.setRealm(userRealm); - // 记住我 - securityManager.setRememberMeManager(rememberMe ? rememberMeManager() : null); - // 注入缓存管理器; - securityManager.setCacheManager(getEhCacheManager()); - // session管理器 - securityManager.setSessionManager(sessionManager()); - return securityManager; - } - - /** - * 退出过滤器 - */ - public LogoutFilter logoutFilter() - { - LogoutFilter logoutFilter = new LogoutFilter(); - logoutFilter.setLoginUrl(loginUrl); - return logoutFilter; - } - - /** - * Shiro过滤器配置 - */ - @Bean - public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) - { - CustomShiroFilterFactoryBean shiroFilterFactoryBean = new CustomShiroFilterFactoryBean(); - // Shiro的核心安全接口,这个属性是必须的 - shiroFilterFactoryBean.setSecurityManager(securityManager); - // 身份认证失败,则跳转到登录页面的配置 - shiroFilterFactoryBean.setLoginUrl(loginUrl); - // 权限认证失败,则跳转到指定页面 - shiroFilterFactoryBean.setUnauthorizedUrl(unauthorizedUrl); - // Shiro连接约束配置,即过滤链的定义 - LinkedHashMap filterChainDefinitionMap = new LinkedHashMap<>(); - // 对静态资源设置匿名访问 - filterChainDefinitionMap.put("/favicon.ico**", "anon"); - filterChainDefinitionMap.put("/ruoyi.png**", "anon"); - filterChainDefinitionMap.put("/html/**", "anon"); - filterChainDefinitionMap.put("/css/**", "anon"); - filterChainDefinitionMap.put("/docs/**", "anon"); - filterChainDefinitionMap.put("/fonts/**", "anon"); - filterChainDefinitionMap.put("/img/**", "anon"); - filterChainDefinitionMap.put("/ajax/**", "anon"); - filterChainDefinitionMap.put("/js/**", "anon"); - filterChainDefinitionMap.put("/ruoyi/**", "anon"); - filterChainDefinitionMap.put("/captcha/captchaImage**", "anon"); - // 匿名访问不鉴权注解列表 - permitAllUrl.getUrls().forEach(url -> filterChainDefinitionMap.put(url, "anon")); - // 退出 logout地址,shiro去清除session - filterChainDefinitionMap.put("/logout", "logout"); - // 不需要拦截的访问 - filterChainDefinitionMap.put("/login", "anon,captchaValidate"); - // 注册相关 - filterChainDefinitionMap.put("/register", "anon,captchaValidate"); - // 系统权限列表 - // filterChainDefinitionMap.putAll(SpringUtils.getBean(IMenuService.class).selectPermsAll()); - - Map filters = new LinkedHashMap(); - filters.put("onlineSession", onlineSessionFilter()); - filters.put("syncOnlineSession", syncOnlineSessionFilter()); - filters.put("captchaValidate", captchaValidateFilter()); - filters.put("kickout", kickoutSessionFilter()); - // 注销成功,则跳转到指定页面 - filters.put("logout", logoutFilter()); - shiroFilterFactoryBean.setFilters(filters); - - // 所有请求需要认证 - filterChainDefinitionMap.put("/**", "user,kickout,onlineSession,syncOnlineSession"); - shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); - - return shiroFilterFactoryBean; - } - - /** - * 自定义在线用户处理过滤器 - */ - public OnlineSessionFilter onlineSessionFilter() - { - OnlineSessionFilter onlineSessionFilter = new OnlineSessionFilter(); - onlineSessionFilter.setLoginUrl(loginUrl); - onlineSessionFilter.setOnlineSessionDAO(sessionDAO()); - return onlineSessionFilter; - } - - /** - * 自定义在线用户同步过滤器 - */ - public SyncOnlineSessionFilter syncOnlineSessionFilter() - { - SyncOnlineSessionFilter syncOnlineSessionFilter = new SyncOnlineSessionFilter(); - syncOnlineSessionFilter.setOnlineSessionDAO(sessionDAO()); - return syncOnlineSessionFilter; - } - - /** - * 自定义验证码过滤器 - */ - public CaptchaValidateFilter captchaValidateFilter() - { - CaptchaValidateFilter captchaValidateFilter = new CaptchaValidateFilter(); - captchaValidateFilter.setCaptchaEnabled(captchaEnabled); - captchaValidateFilter.setCaptchaType(captchaType); - return captchaValidateFilter; - } - - /** - * cookie 属性设置 - */ - public SimpleCookie rememberMeCookie() - { - SimpleCookie cookie = new SimpleCookie("rememberMe"); - cookie.setDomain(domain); - cookie.setPath(path); - cookie.setHttpOnly(httpOnly); - cookie.setMaxAge(maxAge * 24 * 60 * 60); - return cookie; - } - - /** - * 记住我 - */ - public CookieRememberMeManager rememberMeManager() - { - CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager(); - cookieRememberMeManager.setCookie(rememberMeCookie()); - if (StringUtils.isNotEmpty(cipherKey)) - { - cookieRememberMeManager.setCipherKey(Base64.decode(cipherKey)); - } - else - { - cookieRememberMeManager.setCipherKey(CipherUtils.generateNewKey(128, "AES").getEncoded()); - } - return cookieRememberMeManager; - } - - /** - * 同一个用户多设备登录限制 - */ - public KickoutSessionFilter kickoutSessionFilter() - { - KickoutSessionFilter kickoutSessionFilter = new KickoutSessionFilter(); - kickoutSessionFilter.setCacheManager(getEhCacheManager()); - kickoutSessionFilter.setSessionManager(sessionManager()); - // 同一个用户最大的会话数,默认-1无限制;比如2的意思是同一个用户允许最多同时两个人登录 - kickoutSessionFilter.setMaxSession(maxSession); - // 是否踢出后来登录的,默认是false;即后者登录的用户踢出前者登录的用户;踢出顺序 - kickoutSessionFilter.setKickoutAfter(kickoutAfter); - // 被踢出后重定向到的地址; - kickoutSessionFilter.setKickoutUrl("/login?kickout=1"); - return kickoutSessionFilter; - } - - /** - * thymeleaf模板引擎和shiro框架的整合 - */ - @Bean - public ShiroDialect shiroDialect() - { - return new ShiroDialect(); - } - - /** - * 开启Shiro注解通知器 - */ - @Bean - public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor( - @Qualifier("securityManager") SecurityManager securityManager) - { - AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); - authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); - return authorizationAttributeSourceAdvisor; - } -} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java similarity index 95% rename from ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java rename to ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java index 8a4c7ce2a..7840141e5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java @@ -1,63 +1,63 @@ -package com.ruoyi.common.config.thread; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; -import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import com.ruoyi.common.utils.Threads; - -/** - * 线程池配置 - * - * @author ruoyi - **/ -@Configuration -public class ThreadPoolConfig -{ - // 核心线程池大小 - private int corePoolSize = 50; - - // 最大可创建的线程数 - private int maxPoolSize = 200; - - // 队列最大长度 - private int queueCapacity = 1000; - - // 线程池维护线程所允许的空闲时间 - private int keepAliveSeconds = 300; - - @Bean(name = "threadPoolTaskExecutor") - public ThreadPoolTaskExecutor threadPoolTaskExecutor() - { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(maxPoolSize); - executor.setCorePoolSize(corePoolSize); - executor.setQueueCapacity(queueCapacity); - executor.setKeepAliveSeconds(keepAliveSeconds); - // 线程池对拒绝任务(无线程可用)的处理策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - return executor; - } - - /** - * 执行周期性或定时任务 - */ - @Bean(name = "scheduledExecutorService") - protected ScheduledExecutorService scheduledExecutorService() - { - return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), - new ThreadPoolExecutor.CallerRunsPolicy()) - { - @Override - protected void afterExecute(Runnable r, Throwable t) - { - super.afterExecute(r, t); - Threads.printException(r, t); - } - }; - } -} +package com.ruoyi.framework.config; + +import com.ruoyi.common.utils.Threads; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + +/** + * 线程池配置 + * + * @author ruoyi + **/ +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), + new ThreadPoolExecutor.CallerRunsPolicy()) + { + @Override + protected void afterExecute(Runnable r, Throwable t) + { + super.afterExecute(r, t); + Threads.printException(r, t); + } + }; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java index 068310246..29118fa80 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java @@ -1,22 +1,21 @@ package com.ruoyi.framework.config.properties; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; -import org.springframework.aop.framework.Advised; +import java.util.Optional; +import java.util.regex.Pattern; +import org.apache.commons.lang3.RegExUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import com.ruoyi.common.annotation.Anonymous; /** @@ -27,81 +26,33 @@ import com.ruoyi.common.annotation.Anonymous; @Configuration public class PermitAllUrlProperties implements InitializingBean, ApplicationContextAware { - private List urls = new ArrayList<>(); + private static final Pattern PATTERN = Pattern.compile("\\{(.*?)\\}"); private ApplicationContext applicationContext; + private List urls = new ArrayList<>(); + + public String ASTERISK = "*"; + @Override - public void afterPropertiesSet() throws Exception + public void afterPropertiesSet() { - Map controllers = applicationContext.getBeansWithAnnotation(Controller.class); - for (Object bean : controllers.values()) - { - if (!(bean instanceof Advised)) - { - continue; - } - Class beanClass = ((Advised) bean).getTargetSource().getTarget().getClass(); - RequestMapping base = beanClass.getAnnotation(RequestMapping.class); - String[] baseUrl = {}; - if (Objects.nonNull(base)) - { - baseUrl = base.value(); - } - Method[] methods = beanClass.getDeclaredMethods(); - for (Method method : methods) - { - if (method.isAnnotationPresent(Anonymous.class) && method.isAnnotationPresent(RequestMapping.class)) - { - RequestMapping requestMapping = method.getAnnotation(RequestMapping.class); - String[] uri = requestMapping.value(); - urls.addAll(rebuildUrl(baseUrl, uri)); - } - else if (method.isAnnotationPresent(Anonymous.class) && method.isAnnotationPresent(GetMapping.class)) - { - GetMapping requestMapping = method.getAnnotation(GetMapping.class); - String[] uri = requestMapping.value(); - urls.addAll(rebuildUrl(baseUrl, uri)); - } - else if (method.isAnnotationPresent(Anonymous.class) && method.isAnnotationPresent(PostMapping.class)) - { - PostMapping requestMapping = method.getAnnotation(PostMapping.class); - String[] uri = requestMapping.value(); - urls.addAll(rebuildUrl(baseUrl, uri)); - } - else if (method.isAnnotationPresent(Anonymous.class) && method.isAnnotationPresent(PutMapping.class)) - { - PutMapping requestMapping = method.getAnnotation(PutMapping.class); - String[] uri = requestMapping.value(); - urls.addAll(rebuildUrl(baseUrl, uri)); - } - else if (method.isAnnotationPresent(Anonymous.class) && method.isAnnotationPresent(DeleteMapping.class)) - { - DeleteMapping requestMapping = method.getAnnotation(DeleteMapping.class); - String[] uri = requestMapping.value(); - urls.addAll(rebuildUrl(baseUrl, uri)); - } - } + RequestMappingHandlerMapping mapping = applicationContext.getBean(RequestMappingHandlerMapping.class); + Map map = mapping.getHandlerMethods(); - } - } + map.keySet().forEach(info -> { + HandlerMethod handlerMethod = map.get(info); - private List rebuildUrl(String[] bases, String[] uris) - { - List urls = new ArrayList<>(); - for (String base : bases) - { - for (String uri : uris) - { - urls.add(prefix(base) + prefix(uri)); - } - } - return urls; - } + // 获取方法上边的注解 替代path variable 为 * + Anonymous method = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Anonymous.class); + Optional.ofNullable(method).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns()) + .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK)))); - private String prefix(String seg) - { - return seg.startsWith("/") ? seg : "/" + seg; + // 获取类上边的注解, 替代path variable 为 * + Anonymous controller = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), Anonymous.class); + Optional.ofNullable(controller).ifPresent(anonymous -> Objects.requireNonNull(info.getPatternsCondition().getPatterns()) + .forEach(url -> urls.add(RegExUtils.replaceAll(url, PATTERN, ASTERISK)))); + }); } @Override diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java index a5f764072..014ae3804 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java @@ -3,7 +3,6 @@ package com.ruoyi.framework.datasource; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; -import com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder; /** * 动态数据源 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java similarity index 92% rename from ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java rename to ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java index 3b089f66a..9770af6dd 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java @@ -1,45 +1,45 @@ -package com.ruoyi.common.config.datasource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * 数据源切换处理 - * - * @author ruoyi - */ -public class DynamicDataSourceContextHolder -{ - public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); - - /** - * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, - * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 - */ - private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); - - /** - * 设置数据源的变量 - */ - public static void setDataSourceType(String dsType) - { - log.info("切换到{}数据源", dsType); - CONTEXT_HOLDER.set(dsType); - } - - /** - * 获得数据源的变量 - */ - public static String getDataSourceType() - { - return CONTEXT_HOLDER.get(); - } - - /** - * 清空数据源变量 - */ - public static void clearDataSourceType() - { - CONTEXT_HOLDER.remove(); - } -} +package com.ruoyi.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 数据源切换处理 + * + * @author ruoyi + */ +public class DynamicDataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); + + /** + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 + */ + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源的变量 + */ + public static void setDataSourceType(String dsType) + { + log.info("切换到{}数据源", dsType); + CONTEXT_HOLDER.set(dsType); + } + + /** + * 获得数据源的变量 + */ + public static String getDataSourceType() + { + return CONTEXT_HOLDER.get(); + } + + /** + * 清空数据源变量 + */ + public static void clearDataSourceType() + { + CONTEXT_HOLDER.remove(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java index 6df2e5edd..c49eaf4c6 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/RepeatSubmitInterceptor.java @@ -6,7 +6,7 @@ import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; -import com.ruoyi.common.json.JSON; +import com.alibaba.fastjson2.JSON; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.ServletUtils; @@ -32,7 +32,7 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor if (this.isRepeatSubmit(request, annotation)) { AjaxResult ajaxResult = AjaxResult.error(annotation.message()); - ServletUtils.renderString(response, JSON.marshal(ajaxResult)); + ServletUtils.renderString(response, JSON.toJSONString(ajaxResult)); return false; } } @@ -47,9 +47,10 @@ public abstract class RepeatSubmitInterceptor implements HandlerInterceptor /** * 验证是否重复提交由子类实现具体的防重复提交的规则 * - * @param request 请求对象 - * @param annotation 防复注解 + * @param request 请求信息 + * @param annotation 防重复注解参数 * @return 结果 + * @throws Exception */ - public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) throws Exception; + public abstract boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation); } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java index fc0e1e998..9dc9511b3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java @@ -2,15 +2,22 @@ package com.ruoyi.framework.interceptor.impl; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import com.alibaba.fastjson2.JSON; import com.ruoyi.common.annotation.RepeatSubmit; -import com.ruoyi.common.json.JSON; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.filter.RepeatedlyRequestWrapper; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpHelper; import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor; /** - * 判断请求url和数据是否和上一次相同, + * 判断请求url和数据是否和上一次相同, * 如果和上次相同,则是重复提交表单。 有效时间为10秒内。 * * @author ruoyi @@ -22,23 +29,43 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor public final String REPEAT_TIME = "repeatTime"; - public final String SESSION_REPEAT_KEY = "repeatData"; + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + @Autowired + private RedisCache redisCache; @SuppressWarnings("unchecked") @Override - public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) throws Exception + public boolean isRepeatSubmit(HttpServletRequest request, RepeatSubmit annotation) { - // 本次参数及系统时间 - String nowParams = JSON.marshal(request.getParameterMap()); + String nowParams = ""; + if (request instanceof RepeatedlyRequestWrapper) + { + RepeatedlyRequestWrapper repeatedlyRequest = (RepeatedlyRequestWrapper) request; + nowParams = HttpHelper.getBodyString(repeatedlyRequest); + } + + // body参数为空,获取Parameter的数据 + if (StringUtils.isEmpty(nowParams)) + { + nowParams = JSON.toJSONString(request.getParameterMap()); + } Map nowDataMap = new HashMap(); nowDataMap.put(REPEAT_PARAMS, nowParams); nowDataMap.put(REPEAT_TIME, System.currentTimeMillis()); - // 请求地址(作为存放session的key值) + // 请求地址(作为存放cache的key值) String url = request.getRequestURI(); - HttpSession session = request.getSession(); - Object sessionObj = session.getAttribute(SESSION_REPEAT_KEY); + // 唯一值(没有消息头则使用请求地址) + String submitKey = StringUtils.trimToEmpty(request.getHeader(header)); + + // 唯一标识(指定key + url + 消息头) + String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey; + + Object sessionObj = redisCache.getCacheObject(cacheRepeatKey); if (sessionObj != null) { Map sessionMap = (Map) sessionObj; @@ -51,9 +78,9 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor } } } - Map sessionMap = new HashMap(); - sessionMap.put(url, nowDataMap); - session.setAttribute(SESSION_REPEAT_KEY, sessionMap); + Map cacheMap = new HashMap(); + cacheMap.put(url, nowDataMap); + redisCache.setCacheObject(cacheRepeatKey, cacheMap, annotation.interval(), TimeUnit.MILLISECONDS); return false; } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java index a30067dd9..6ed6d5b74 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java @@ -9,7 +9,7 @@ import com.ruoyi.common.utils.spring.SpringUtils; /** * 异步任务管理器 * - * @author liuhulu + * @author ruoyi */ public class AsyncManager { diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java index 78a4af372..e36ca3c58 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/ShutdownManager.java @@ -1,55 +1,24 @@ package com.ruoyi.framework.manager; -import com.ruoyi.framework.shiro.web.session.SpringSessionValidationScheduler; -import net.sf.ehcache.CacheManager; -import org.apache.shiro.cache.ehcache.EhCacheManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PreDestroy; /** * 确保应用退出时能关闭后台线程 * - * @author cj + * @author ruoyi */ @Component public class ShutdownManager { private static final Logger logger = LoggerFactory.getLogger("sys-user"); - @Autowired(required = false) - private SpringSessionValidationScheduler springSessionValidationScheduler; - - @Autowired(required = false) - private EhCacheManager ehCacheManager; - @PreDestroy public void destroy() { - shutdownSpringSessionValidationScheduler(); shutdownAsyncManager(); - shutdownEhCacheManager(); - } - - /** - * 停止Seesion会话检查 - */ - private void shutdownSpringSessionValidationScheduler() - { - if (springSessionValidationScheduler != null && springSessionValidationScheduler.isEnabled()) - { - try - { - logger.info("====关闭会话验证任务===="); - springSessionValidationScheduler.disableSessionValidation(); - } - catch (Exception e) - { - logger.error(e.getMessage(), e); - } - } } /** @@ -67,21 +36,4 @@ public class ShutdownManager logger.error(e.getMessage(), e); } } - - private void shutdownEhCacheManager() - { - try - { - logger.info("====关闭缓存===="); - if (ehCacheManager != null) - { - CacheManager cacheManager = ehCacheManager.getCacheManager(); - cacheManager.shutdown(); - } - } - catch (Exception e) - { - logger.error(e.getMessage(), e); - } - } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java index f125664c6..98517b781 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java @@ -4,58 +4,78 @@ import java.util.TimerTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.AddressUtils; import com.ruoyi.common.utils.LogUtils; import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; +import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.shiro.session.OnlineSession; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysOperLog; -import com.ruoyi.system.domain.SysUserOnline; +import com.ruoyi.system.service.ISysLogininforService; import com.ruoyi.system.service.ISysOperLogService; -import com.ruoyi.system.service.ISysUserOnlineService; -import com.ruoyi.system.service.impl.SysLogininforServiceImpl; import eu.bitwalker.useragentutils.UserAgent; /** * 异步工厂(产生任务用) * - * @author liuhulu - * + * @author ruoyi */ public class AsyncFactory { private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user"); /** - * 同步session到数据库 + * 记录登录信息 * - * @param session 在线用户会话 + * @param username 用户名 + * @param status 状态 + * @param message 消息 + * @param args 列表 * @return 任务task */ - public static TimerTask syncSessionToDb(final OnlineSession session) + public static TimerTask recordLogininfor(final String username, final String status, final String message, + final Object... args) { + final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + final String ip = IpUtils.getIpAddr(); return new TimerTask() { @Override public void run() { - SysUserOnline online = new SysUserOnline(); - online.setSessionId(String.valueOf(session.getId())); - online.setDeptName(session.getDeptName()); - online.setLoginName(session.getLoginName()); - online.setStartTimestamp(session.getStartTimestamp()); - online.setLastAccessTime(session.getLastAccessTime()); - online.setExpireTime(session.getTimeout()); - online.setIpaddr(session.getHost()); - online.setLoginLocation(AddressUtils.getRealAddressByIP(session.getHost())); - online.setBrowser(session.getBrowser()); - online.setOs(session.getOs()); - online.setStatus(session.getStatus()); - SpringUtils.getBean(ISysUserOnlineService.class).saveOnline(online); - + String address = AddressUtils.getRealAddressByIP(ip); + StringBuilder s = new StringBuilder(); + s.append(LogUtils.getBlock(ip)); + s.append(address); + s.append(LogUtils.getBlock(username)); + s.append(LogUtils.getBlock(status)); + s.append(LogUtils.getBlock(message)); + // 打印信息到日志 + sys_user_logger.info(s.toString(), args); + // 获取客户端操作系统 + String os = userAgent.getOperatingSystem().getName(); + // 获取客户端浏览器 + String browser = userAgent.getBrowser().getName(); + // 封装对象 + SysLogininfor logininfor = new SysLogininfor(); + logininfor.setUserName(username); + logininfor.setIpaddr(ip); + logininfor.setLoginLocation(address); + logininfor.setBrowser(browser); + logininfor.setOs(os); + logininfor.setMsg(message); + // 日志状态 + if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) + { + logininfor.setStatus(Constants.SUCCESS); + } + else if (Constants.LOGIN_FAIL.equals(status)) + { + logininfor.setStatus(Constants.FAIL); + } + // 插入数据 + SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); } }; } @@ -79,58 +99,4 @@ public class AsyncFactory } }; } - - /** - * 记录登录信息 - * - * @param username 用户名 - * @param status 状态 - * @param message 消息 - * @param args 列表 - * @return 任务task - */ - public static TimerTask recordLogininfor(final String username, final String status, final String message, final Object... args) - { - final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); - final String ip = ShiroUtils.getIp(); - return new TimerTask() - { - @Override - public void run() - { - String address = AddressUtils.getRealAddressByIP(ip); - StringBuilder s = new StringBuilder(); - s.append(LogUtils.getBlock(ip)); - s.append(address); - s.append(LogUtils.getBlock(username)); - s.append(LogUtils.getBlock(status)); - s.append(LogUtils.getBlock(message)); - // 打印信息到日志 - sys_user_logger.info(s.toString(), args); - // 获取客户端操作系统 - String os = userAgent.getOperatingSystem().getName(); - // 获取客户端浏览器 - String browser = userAgent.getBrowser().getName(); - // 封装对象 - SysLogininfor logininfor = new SysLogininfor(); - logininfor.setLoginName(username); - logininfor.setIpaddr(ip); - logininfor.setLoginLocation(address); - logininfor.setBrowser(browser); - logininfor.setOs(os); - logininfor.setMsg(message); - // 日志状态 - if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) - { - logininfor.setStatus(Constants.SUCCESS); - } - else if (Constants.LOGIN_FAIL.equals(status)) - { - logininfor.setStatus(Constants.FAIL); - } - // 插入数据 - SpringUtils.getBean(SysLogininforServiceImpl.class).insertLogininfor(logininfor); - } - }; - } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java new file mode 100644 index 000000000..6c776ce3f --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/AuthenticationContextHolder.java @@ -0,0 +1,28 @@ +package com.ruoyi.framework.security.context; + +import org.springframework.security.core.Authentication; + +/** + * 身份验证信息 + * + * @author ruoyi + */ +public class AuthenticationContextHolder +{ + private static final ThreadLocal contextHolder = new ThreadLocal<>(); + + public static Authentication getContext() + { + return contextHolder.get(); + } + + public static void setContext(Authentication context) + { + contextHolder.set(context); + } + + public static void clearContext() + { + contextHolder.remove(); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/context/PermissionContextHolder.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java similarity index 94% rename from ruoyi-common/src/main/java/com/ruoyi/common/core/context/PermissionContextHolder.java rename to ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java index f06b8fab2..5472f3d2b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/context/PermissionContextHolder.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/context/PermissionContextHolder.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.core.context; +package com.ruoyi.framework.security.context; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java new file mode 100644 index 000000000..3eb24954e --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/filter/JwtAuthenticationTokenFilter.java @@ -0,0 +1,44 @@ +package com.ruoyi.framework.security.filter; + +import java.io.IOException; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.web.service.TokenService; + +/** + * token过滤器 验证token有效性 + * + * @author ruoyi + */ +@Component +public class JwtAuthenticationTokenFilter extends OncePerRequestFilter +{ + @Autowired + private TokenService tokenService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication())) + { + tokenService.verifyToken(loginUser); + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities()); + authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + SecurityContextHolder.getContext().setAuthentication(authenticationToken); + } + chain.doFilter(request, response); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java new file mode 100644 index 000000000..93b703259 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/AuthenticationEntryPointImpl.java @@ -0,0 +1,34 @@ +package com.ruoyi.framework.security.handle; + +import java.io.IOException; +import java.io.Serializable; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.constant.HttpStatus; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; + +/** + * 认证失败处理类 返回未授权 + * + * @author ruoyi + */ +@Component +public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, Serializable +{ + private static final long serialVersionUID = -8970718410437077606L; + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) + throws IOException + { + int code = HttpStatus.UNAUTHORIZED; + String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI()); + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg))); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java new file mode 100644 index 000000000..2f89a91be --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/security/handle/LogoutSuccessHandlerImpl.java @@ -0,0 +1,53 @@ +package com.ruoyi.framework.security.handle; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +import com.alibaba.fastjson2.JSON; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.web.service.TokenService; + +/** + * 自定义退出处理类 返回成功 + * + * @author ruoyi + */ +@Configuration +public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler +{ + @Autowired + private TokenService tokenService; + + /** + * 退出处理 + * + * @return + */ + @Override + public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) + throws IOException, ServletException + { + LoginUser loginUser = tokenService.getLoginUser(request); + if (StringUtils.isNotNull(loginUser)) + { + String userName = loginUser.getUsername(); + // 删除用户缓存记录 + tokenService.delLoginUser(loginUser.getToken()); + // 记录用户退出日志 + AsyncManager.me().execute(AsyncFactory.recordLogininfor(userName, Constants.LOGOUT, MessageUtils.message("user.logout.success"))); + } + ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.success(MessageUtils.message("user.logout.success")))); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java deleted file mode 100644 index 8cda35e2d..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.ruoyi.framework.shiro.realm; - -import java.util.HashSet; -import java.util.Set; -import org.apache.shiro.authc.AuthenticationException; -import org.apache.shiro.authc.AuthenticationInfo; -import org.apache.shiro.authc.AuthenticationToken; -import org.apache.shiro.authc.ExcessiveAttemptsException; -import org.apache.shiro.authc.IncorrectCredentialsException; -import org.apache.shiro.authc.LockedAccountException; -import org.apache.shiro.authc.SimpleAuthenticationInfo; -import org.apache.shiro.authc.UnknownAccountException; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.apache.shiro.authz.AuthorizationInfo; -import org.apache.shiro.authz.SimpleAuthorizationInfo; -import org.apache.shiro.cache.Cache; -import org.apache.shiro.realm.AuthorizingRealm; -import org.apache.shiro.subject.PrincipalCollection; -import org.apache.shiro.subject.SimplePrincipalCollection; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.exception.user.CaptchaException; -import com.ruoyi.common.exception.user.RoleBlockedException; -import com.ruoyi.common.exception.user.UserBlockedException; -import com.ruoyi.common.exception.user.UserNotExistsException; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; -import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.framework.shiro.service.SysLoginService; -import com.ruoyi.system.service.ISysMenuService; -import com.ruoyi.system.service.ISysRoleService; - -/** - * 自定义Realm 处理登录 权限 - * - * @author ruoyi - */ -public class UserRealm extends AuthorizingRealm -{ - private static final Logger log = LoggerFactory.getLogger(UserRealm.class); - - @Autowired - private ISysMenuService menuService; - - @Autowired - private ISysRoleService roleService; - - @Autowired - private SysLoginService loginService; - - /** - * 授权 - */ - @Override - protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0) - { - SysUser user = ShiroUtils.getSysUser(); - // 角色列表 - Set roles = new HashSet(); - // 功能列表 - Set menus = new HashSet(); - SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); - // 管理员拥有所有权限 - if (user.isAdmin()) - { - info.addRole("admin"); - info.addStringPermission("*:*:*"); - } - else - { - roles = roleService.selectRoleKeys(user.getUserId()); - menus = menuService.selectPermsByUserId(user.getUserId()); - // 角色加入AuthorizationInfo认证对象 - info.setRoles(roles); - // 权限加入AuthorizationInfo认证对象 - info.setStringPermissions(menus); - } - return info; - } - - /** - * 登录认证 - */ - @Override - protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException - { - UsernamePasswordToken upToken = (UsernamePasswordToken) token; - String username = upToken.getUsername(); - String password = ""; - if (upToken.getPassword() != null) - { - password = new String(upToken.getPassword()); - } - - SysUser user = null; - try - { - user = loginService.login(username, password); - } - catch (CaptchaException e) - { - throw new AuthenticationException(e.getMessage(), e); - } - catch (UserNotExistsException e) - { - throw new UnknownAccountException(e.getMessage(), e); - } - catch (UserPasswordNotMatchException e) - { - throw new IncorrectCredentialsException(e.getMessage(), e); - } - catch (UserPasswordRetryLimitExceedException e) - { - throw new ExcessiveAttemptsException(e.getMessage(), e); - } - catch (UserBlockedException e) - { - throw new LockedAccountException(e.getMessage(), e); - } - catch (RoleBlockedException e) - { - throw new LockedAccountException(e.getMessage(), e); - } - catch (Exception e) - { - log.info("对用户[" + username + "]进行登录验证..验证未通过{}", e.getMessage()); - throw new AuthenticationException(e.getMessage(), e); - } - SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName()); - return info; - } - - /** - * 清理指定用户授权信息缓存 - */ - public void clearCachedAuthorizationInfo(Object principal) - { - SimplePrincipalCollection principals = new SimplePrincipalCollection(principal, getName()); - this.clearCachedAuthorizationInfo(principals); - } - - /** - * 清理所有用户授权信息缓存 - */ - public void clearAllCachedAuthorizationInfo() - { - Cache cache = getAuthorizationCache(); - if (cache != null) - { - for (Object key : cache.keys()) - { - cache.remove(key); - } - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java deleted file mode 100644 index 8e9db1db5..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.ruoyi.framework.shiro.service; - -import java.util.List; -import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.entity.SysRole; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.enums.UserStatus; -import com.ruoyi.common.exception.user.BlackListException; -import com.ruoyi.common.exception.user.CaptchaException; -import com.ruoyi.common.exception.user.UserBlockedException; -import com.ruoyi.common.exception.user.UserDeleteException; -import com.ruoyi.common.exception.user.UserNotExistsException; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.IpUtils; -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.system.service.ISysConfigService; -import com.ruoyi.system.service.ISysMenuService; -import com.ruoyi.system.service.ISysUserService; - -/** - * 登录校验方法 - * - * @author ruoyi - */ -@Component -public class SysLoginService -{ - @Autowired - private SysPasswordService passwordService; - - @Autowired - private ISysUserService userService; - - @Autowired - private ISysMenuService menuService; - - @Autowired - private ISysConfigService configService; - - /** - * 登录 - */ - public SysUser login(String username, String password) - { - // 验证码校验 - if (ShiroConstants.CAPTCHA_ERROR.equals(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA))) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); - throw new CaptchaException(); - } - // 用户名或密码为空 错误 - if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); - throw new UserNotExistsException(); - } - // 密码如果不在指定范围内 错误 - if (password.length() < UserConstants.PASSWORD_MIN_LENGTH - || password.length() > UserConstants.PASSWORD_MAX_LENGTH) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); - throw new UserPasswordNotMatchException(); - } - - // 用户名不在指定范围内 错误 - if (username.length() < UserConstants.USERNAME_MIN_LENGTH - || username.length() > UserConstants.USERNAME_MAX_LENGTH) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); - throw new UserPasswordNotMatchException(); - } - - // IP黑名单校验 - String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); - if (IpUtils.isMatchedIp(blackStr, ShiroUtils.getIp())) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked"))); - throw new BlackListException(); - } - - // 查询用户信息 - SysUser user = userService.selectUserByLoginName(username); - - /** - if (user == null && maybeMobilePhoneNumber(username)) - { - user = userService.selectUserByPhoneNumber(username); - } - - if (user == null && maybeEmail(username)) - { - user = userService.selectUserByEmail(username); - } - */ - - if (user == null) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists"))); - throw new UserNotExistsException(); - } - - if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.delete"))); - throw new UserDeleteException(); - } - - if (UserStatus.DISABLE.getCode().equals(user.getStatus())) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked"))); - throw new UserBlockedException(); - } - - passwordService.validate(user, password); - - AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); - setRolePermission(user); - recordLoginInfo(user.getUserId()); - return user; - } - - /** - private boolean maybeEmail(String username) - { - if (!username.matches(UserConstants.EMAIL_PATTERN)) - { - return false; - } - return true; - } - - private boolean maybeMobilePhoneNumber(String username) - { - if (!username.matches(UserConstants.MOBILE_PHONE_NUMBER_PATTERN)) - { - return false; - } - return true; - } - */ - - /** - * 设置角色权限 - * - * @param user 用户信息 - */ - public void setRolePermission(SysUser user) - { - List roles = user.getRoles(); - if (!roles.isEmpty() && roles.size() > 1) - { - // 多角色设置permissions属性,以便数据权限匹配权限 - for (SysRole role : roles) - { - Set rolePerms = menuService.selectPermsByRoleId(role.getRoleId()); - role.setPermissions(rolePerms); - } - } - } - - /** - * 记录登录信息 - * - * @param userId 用户ID - */ - public void recordLoginInfo(Long userId) - { - SysUser user = new SysUser(); - user.setUserId(userId); - user.setLoginIp(ShiroUtils.getIp()); - user.setLoginDate(DateUtils.getNowDate()); - userService.updateUserInfo(user); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java deleted file mode 100644 index 338e7293e..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ruoyi.framework.shiro.service; - -import java.util.concurrent.atomic.AtomicInteger; -import javax.annotation.PostConstruct; -import org.apache.shiro.cache.Cache; -import org.apache.shiro.cache.CacheManager; -import org.apache.shiro.crypto.hash.Md5Hash; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.exception.user.UserPasswordNotMatchException; -import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; - -/** - * 登录密码方法 - * - * @author ruoyi - */ -@Component -public class SysPasswordService -{ - @Autowired - private CacheManager cacheManager; - - private Cache loginRecordCache; - - @Value(value = "${user.password.maxRetryCount}") - private String maxRetryCount; - - @PostConstruct - public void init() - { - loginRecordCache = cacheManager.getCache(ShiroConstants.LOGIN_RECORD_CACHE); - } - - public void validate(SysUser user, String password) - { - String loginName = user.getLoginName(); - - AtomicInteger retryCount = loginRecordCache.get(loginName); - - if (retryCount == null) - { - retryCount = new AtomicInteger(0); - loginRecordCache.put(loginName, retryCount); - } - if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue()) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount))); - throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue()); - } - - if (!matches(user, password)) - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount))); - loginRecordCache.put(loginName, retryCount); - throw new UserPasswordNotMatchException(); - } - else - { - clearLoginRecordCache(loginName); - } - } - - public boolean matches(SysUser user, String newPassword) - { - return user.getPassword().equals(encryptPassword(user.getLoginName(), newPassword, user.getSalt())); - } - - public void clearLoginRecordCache(String loginName) - { - loginRecordCache.remove(loginName); - } - - public String encryptPassword(String loginName, String password, String salt) - { - return new Md5Hash(loginName + password + salt).toHex(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java deleted file mode 100644 index b0b84498a..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysRegisterService.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ruoyi.framework.shiro.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.system.service.ISysUserService; - -/** - * 注册校验方法 - * - * @author ruoyi - */ -@Component -public class SysRegisterService -{ - @Autowired - private ISysUserService userService; - - @Autowired - private SysPasswordService passwordService; - - /** - * 注册 - */ - public String register(SysUser user) - { - String msg = "", loginName = user.getLoginName(), password = user.getPassword(); - - if (ShiroConstants.CAPTCHA_ERROR.equals(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA))) - { - msg = "验证码错误"; - } - else if (StringUtils.isEmpty(loginName)) - { - msg = "用户名不能为空"; - } - else if (StringUtils.isEmpty(password)) - { - msg = "用户密码不能为空"; - } - else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH - || password.length() > UserConstants.PASSWORD_MAX_LENGTH) - { - msg = "密码长度必须在5到20个字符之间"; - } - else if (loginName.length() < UserConstants.USERNAME_MIN_LENGTH - || loginName.length() > UserConstants.USERNAME_MAX_LENGTH) - { - msg = "账户长度必须在2到20个字符之间"; - } - else if (!userService.checkLoginNameUnique(user)) - { - msg = "保存用户'" + loginName + "'失败,注册账号已存在"; - } - else - { - user.setPwdUpdateDate(DateUtils.getNowDate()); - user.setUserName(loginName); - user.setSalt(ShiroUtils.randomSalt()); - user.setPassword(passwordService.encryptPassword(loginName, password, user.getSalt())); - boolean regFlag = userService.registerUser(user); - if (!regFlag) - { - msg = "注册失败,请联系系统管理人员"; - } - else - { - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.REGISTER, MessageUtils.message("user.register.success"))); - } - } - return msg; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysShiroService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysShiroService.java deleted file mode 100644 index 1fb9c7e46..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysShiroService.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.ruoyi.framework.shiro.service; - -import java.io.Serializable; -import org.apache.shiro.session.Session; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.system.domain.SysUserOnline; -import com.ruoyi.system.service.ISysUserOnlineService; - -/** - * 会话db操作处理 - * - * @author ruoyi - */ -@Component -public class SysShiroService -{ - @Autowired - private ISysUserOnlineService onlineService; - - /** - * 删除会话 - * - * @param onlineSession 会话信息 - */ - public void deleteSession(OnlineSession onlineSession) - { - onlineService.deleteOnlineById(String.valueOf(onlineSession.getId())); - } - - /** - * 获取会话信息 - * - * @param sessionId - * @return - */ - public Session getSession(Serializable sessionId) - { - SysUserOnline userOnline = onlineService.selectOnlineById(String.valueOf(sessionId)); - return StringUtils.isNull(userOnline) ? null : createSession(userOnline); - } - - public Session createSession(SysUserOnline userOnline) - { - OnlineSession onlineSession = new OnlineSession(); - if (StringUtils.isNotNull(userOnline)) - { - onlineSession.setId(userOnline.getSessionId()); - onlineSession.setHost(userOnline.getIpaddr()); - onlineSession.setBrowser(userOnline.getBrowser()); - onlineSession.setOs(userOnline.getOs()); - onlineSession.setDeptName(userOnline.getDeptName()); - onlineSession.setLoginName(userOnline.getLoginName()); - onlineSession.setStartTimestamp(userOnline.getStartTimestamp()); - onlineSession.setLastAccessTime(userOnline.getLastAccessTime()); - onlineSession.setTimeout(userOnline.getExpireTime()); - } - return onlineSession; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSession.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSession.java deleted file mode 100644 index 95d9b4c7e..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSession.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.ruoyi.framework.shiro.session; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.apache.shiro.session.mgt.SimpleSession; -import com.ruoyi.common.enums.OnlineStatus; - -/** - * 在线用户会话属性 - * - * @author ruoyi - */ -public class OnlineSession extends SimpleSession -{ - private static final long serialVersionUID = 1L; - - /** 用户ID */ - private Long userId; - - /** 用户名称 */ - private String loginName; - - /** 部门名称 */ - private String deptName; - - /** 用户头像 */ - private String avatar; - - /** 登录IP地址 */ - private String host; - - /** 浏览器类型 */ - private String browser; - - /** 操作系统 */ - private String os; - - /** 在线状态 */ - private OnlineStatus status = OnlineStatus.on_line; - - /** 属性是否改变 优化session数据同步 */ - private transient boolean attributeChanged = false; - - @Override - public String getHost() - { - return host; - } - - @Override - public void setHost(String host) - { - this.host = host; - } - - public String getBrowser() - { - return browser; - } - - public void setBrowser(String browser) - { - this.browser = browser; - } - - public String getOs() - { - return os; - } - - public void setOs(String os) - { - this.os = os; - } - - public Long getUserId() - { - return userId; - } - - public void setUserId(Long userId) - { - this.userId = userId; - } - - public String getLoginName() - { - return loginName; - } - - public void setLoginName(String loginName) - { - this.loginName = loginName; - } - - public String getDeptName() - { - return deptName; - } - - public void setDeptName(String deptName) - { - this.deptName = deptName; - } - - public OnlineStatus getStatus() - { - return status; - } - - public void setStatus(OnlineStatus status) - { - this.status = status; - } - - public void markAttributeChanged() - { - this.attributeChanged = true; - } - - public void resetAttributeChanged() - { - this.attributeChanged = false; - } - - public boolean isAttributeChanged() - { - return attributeChanged; - } - - public String getAvatar() { - return avatar; - } - - public void setAvatar(String avatar) { - this.avatar = avatar; - } - - @Override - public void setAttribute(Object key, Object value) - { - super.setAttribute(key, value); - } - - @Override - public Object removeAttribute(Object key) - { - return super.removeAttribute(key); - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("userId", getUserId()) - .append("loginName", getLoginName()) - .append("deptName", getDeptName()) - .append("avatar", getAvatar()) - .append("host", getHost()) - .append("browser", getBrowser()) - .append("os", getOs()) - .append("status", getStatus()) - .append("attributeChanged", isAttributeChanged()) - .toString(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java deleted file mode 100644 index bbcf1e342..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.ruoyi.framework.shiro.session; - -import java.io.Serializable; -import java.util.Date; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.UnknownSessionException; -import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import com.ruoyi.common.enums.OnlineStatus; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.shiro.service.SysShiroService; - -/** - * 针对自定义的ShiroSession的db操作 - * - * @author ruoyi - */ -public class OnlineSessionDAO extends EnterpriseCacheSessionDAO -{ - /** - * 同步session到数据库的周期 单位为毫秒(默认1分钟) - */ - @Value("${shiro.session.dbSyncPeriod}") - private int dbSyncPeriod; - - /** - * 上次同步数据库的时间戳 - */ - private static final String LAST_SYNC_DB_TIMESTAMP = OnlineSessionDAO.class.getName() + "LAST_SYNC_DB_TIMESTAMP"; - - @Autowired - private SysShiroService sysShiroService; - - public OnlineSessionDAO() - { - super(); - } - - public OnlineSessionDAO(long expireTime) - { - super(); - } - - /** - * 根据会话ID获取会话 - * - * @param sessionId 会话ID - * @return ShiroSession - */ - @Override - protected Session doReadSession(Serializable sessionId) - { - return sysShiroService.getSession(sessionId); - } - - @Override - public void update(Session session) throws UnknownSessionException - { - super.update(session); - } - - /** - * 更新会话;如更新会话最后访问时间/停止会话/设置超时时间/设置移除属性等会调用 - */ - public void syncToDb(OnlineSession onlineSession) - { - Date lastSyncTimestamp = (Date) onlineSession.getAttribute(LAST_SYNC_DB_TIMESTAMP); - if (lastSyncTimestamp != null) - { - boolean needSync = true; - long deltaTime = onlineSession.getLastAccessTime().getTime() - lastSyncTimestamp.getTime(); - if (deltaTime < dbSyncPeriod * 60 * 1000) - { - // 时间差不足 无需同步 - needSync = false; - } - // isGuest = true 访客 - boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L; - - // session 数据变更了 同步 - if (!isGuest && onlineSession.isAttributeChanged()) - { - needSync = true; - } - - if (!needSync) - { - return; - } - } - // 更新上次同步数据库时间 - onlineSession.setAttribute(LAST_SYNC_DB_TIMESTAMP, onlineSession.getLastAccessTime()); - // 更新完后 重置标识 - if (onlineSession.isAttributeChanged()) - { - onlineSession.resetAttributeChanged(); - } - AsyncManager.me().execute(AsyncFactory.syncSessionToDb(onlineSession)); - } - - /** - * 当会话过期/停止(如用户退出时)属性等会调用 - */ - @Override - protected void doDelete(Session session) - { - OnlineSession onlineSession = (OnlineSession) session; - if (null == onlineSession) - { - return; - } - onlineSession.setStatus(OnlineStatus.off_line); - sysShiroService.deleteSession(onlineSession); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java deleted file mode 100644 index f1e5a3ee7..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.ruoyi.framework.shiro.session; - -import javax.servlet.http.HttpServletRequest; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.mgt.SessionContext; -import org.apache.shiro.session.mgt.SessionFactory; -import org.apache.shiro.web.session.mgt.WebSessionContext; -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.IpUtils; -import eu.bitwalker.useragentutils.UserAgent; - -/** - * 自定义sessionFactory会话 - * - * @author ruoyi - */ -@Component -public class OnlineSessionFactory implements SessionFactory -{ - @Override - public Session createSession(SessionContext initData) - { - OnlineSession session = new OnlineSession(); - if (initData != null && initData instanceof WebSessionContext) - { - WebSessionContext sessionContext = (WebSessionContext) initData; - HttpServletRequest request = (HttpServletRequest) sessionContext.getServletRequest(); - if (request != null) - { - UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent")); - // 获取客户端操作系统 - String os = userAgent.getOperatingSystem().getName(); - // 获取客户端浏览器 - String browser = userAgent.getBrowser().getName(); - session.setHost(IpUtils.getIpAddr(request)); - session.setBrowser(browser); - session.setOs(os); - } - } - return session; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/util/AuthorizationUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/util/AuthorizationUtils.java deleted file mode 100644 index 3334ec792..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/util/AuthorizationUtils.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.ruoyi.framework.shiro.util; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.mgt.RealmSecurityManager; -import com.ruoyi.framework.shiro.realm.UserRealm; - -/** - * 用户授权信息 - * - * @author ruoyi - */ -public class AuthorizationUtils -{ - /** - * 清理所有用户授权信息缓存 - */ - public static void clearAllCachedAuthorizationInfo() - { - getUserRealm().clearAllCachedAuthorizationInfo(); - } - - /** - * 获取自定义Realm - */ - public static UserRealm getUserRealm() - { - RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager(); - return (UserRealm) rsm.getRealms().iterator().next(); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/CustomShiroFilterFactoryBean.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/CustomShiroFilterFactoryBean.java deleted file mode 100644 index 1d42bdf75..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/CustomShiroFilterFactoryBean.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.ruoyi.framework.shiro.web; - -import org.apache.shiro.spring.web.ShiroFilterFactoryBean; -import org.apache.shiro.web.filter.InvalidRequestFilter; -import org.apache.shiro.web.filter.mgt.DefaultFilter; -import org.apache.shiro.web.filter.mgt.FilterChainManager; -import org.apache.shiro.web.filter.mgt.FilterChainResolver; -import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; -import org.apache.shiro.web.mgt.WebSecurityManager; -import org.apache.shiro.web.servlet.AbstractShiroFilter; -import org.apache.shiro.mgt.SecurityManager; -import org.springframework.beans.factory.BeanInitializationException; -import javax.servlet.Filter; -import java.util.Map; - -/** - * 自定义ShiroFilterFactoryBean解决资源中文路径问题 - * - * @author ruoyi - */ -public class CustomShiroFilterFactoryBean extends ShiroFilterFactoryBean -{ - @Override - public Class getObjectType() - { - return MySpringShiroFilter.class; - } - - @Override - protected AbstractShiroFilter createInstance() throws Exception - { - - SecurityManager securityManager = getSecurityManager(); - if (securityManager == null) - { - String msg = "SecurityManager property must be set."; - throw new BeanInitializationException(msg); - } - - if (!(securityManager instanceof WebSecurityManager)) - { - String msg = "The security manager does not implement the WebSecurityManager interface."; - throw new BeanInitializationException(msg); - } - - FilterChainManager manager = createFilterChainManager(); - // Expose the constructed FilterChainManager by first wrapping it in a - // FilterChainResolver implementation. The AbstractShiroFilter implementations - // do not know about FilterChainManagers - only resolvers: - PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver(); - chainResolver.setFilterChainManager(manager); - - Map filterMap = manager.getFilters(); - Filter invalidRequestFilter = filterMap.get(DefaultFilter.invalidRequest.name()); - if (invalidRequestFilter instanceof InvalidRequestFilter) - { - // 此处是关键,设置false跳过URL携带中文400,servletPath中文校验bug - ((InvalidRequestFilter) invalidRequestFilter).setBlockNonAscii(false); - } - // Now create a concrete ShiroFilter instance and apply the acquired SecurityManager and built - // FilterChainResolver. It doesn't matter that the instance is an anonymous inner class - // here - we're just using it because it is a concrete AbstractShiroFilter instance that accepts - // injection of the SecurityManager and FilterChainResolver: - return new MySpringShiroFilter((WebSecurityManager) securityManager, chainResolver); - } - - private static final class MySpringShiroFilter extends AbstractShiroFilter - { - protected MySpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) - { - if (webSecurityManager == null) - { - throw new IllegalArgumentException("WebSecurityManager property cannot be null."); - } - else - { - this.setSecurityManager(webSecurityManager); - if (resolver != null) - { - this.setFilterChainResolver(resolver); - } - } - } - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java deleted file mode 100644 index f8861b649..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.ruoyi.framework.shiro.web.filter; - -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import org.apache.shiro.session.SessionException; -import org.apache.shiro.subject.Subject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.MessageUtils; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.manager.AsyncManager; -import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.system.service.ISysUserOnlineService; - -/** - * 退出过滤器 - * - * @author ruoyi - */ -public class LogoutFilter extends org.apache.shiro.web.filter.authc.LogoutFilter -{ - private static final Logger log = LoggerFactory.getLogger(LogoutFilter.class); - - /** - * 退出后重定向的地址 - */ - private String loginUrl; - - public String getLoginUrl() - { - return loginUrl; - } - - public void setLoginUrl(String loginUrl) - { - this.loginUrl = loginUrl; - } - - @Override - protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception - { - try - { - Subject subject = getSubject(request, response); - String redirectUrl = getRedirectUrl(request, response, subject); - try - { - SysUser user = ShiroUtils.getSysUser(); - if (StringUtils.isNotNull(user)) - { - String loginName = user.getLoginName(); - // 记录用户退出日志 - AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGOUT, MessageUtils.message("user.logout.success"))); - // 清理缓存 - SpringUtils.getBean(ISysUserOnlineService.class).removeUserCache(loginName, ShiroUtils.getSessionId()); - } - // 退出登录 - subject.logout(); - } - catch (SessionException ise) - { - log.error("logout fail.", ise); - } - issueRedirect(request, response, redirectUrl); - } - catch (Exception e) - { - log.error("Encountered session exception during logout. This can generally safely be ignored.", e); - } - return false; - } - - /** - * 退出跳转URL - */ - @Override - protected String getRedirectUrl(ServletRequest request, ServletResponse response, Subject subject) - { - String url = getLoginUrl(); - if (StringUtils.isNotEmpty(url)) - { - return url; - } - return super.getRedirectUrl(request, response, subject); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java deleted file mode 100644 index 40939e91c..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/captcha/CaptchaValidateFilter.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.ruoyi.framework.shiro.web.filter.captcha; - -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import org.apache.shiro.web.filter.AccessControlFilter; -import com.google.code.kaptcha.Constants; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.common.utils.StringUtils; - -/** - * 验证码过滤器 - * - * @author ruoyi - */ -public class CaptchaValidateFilter extends AccessControlFilter -{ - /** - * 是否开启验证码 - */ - private boolean captchaEnabled = true; - - /** - * 验证码类型 - */ - private String captchaType = "math"; - - public void setCaptchaEnabled(boolean captchaEnabled) - { - this.captchaEnabled = captchaEnabled; - } - - public void setCaptchaType(String captchaType) - { - this.captchaType = captchaType; - } - - @Override - public boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception - { - request.setAttribute(ShiroConstants.CURRENT_ENABLED, captchaEnabled); - request.setAttribute(ShiroConstants.CURRENT_TYPE, captchaType); - return super.onPreHandle(request, response, mappedValue); - } - - @Override - protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) - throws Exception - { - HttpServletRequest httpServletRequest = (HttpServletRequest) request; - // 验证码禁用 或不是表单提交 允许访问 - if (captchaEnabled == false || !"post".equals(httpServletRequest.getMethod().toLowerCase())) - { - return true; - } - return validateResponse(httpServletRequest, httpServletRequest.getParameter(ShiroConstants.CURRENT_VALIDATECODE)); - } - - public boolean validateResponse(HttpServletRequest request, String validateCode) - { - Object obj = ShiroUtils.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY); - String code = String.valueOf(obj != null ? obj : ""); - // 验证码清除,防止多次使用。 - request.getSession().removeAttribute(Constants.KAPTCHA_SESSION_KEY); - if (StringUtils.isEmpty(validateCode) || !validateCode.equalsIgnoreCase(code)) - { - return false; - } - return true; - } - - @Override - protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception - { - request.setAttribute(ShiroConstants.CURRENT_CAPTCHA, ShiroConstants.CAPTCHA_ERROR); - return true; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/kickout/KickoutSessionFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/kickout/KickoutSessionFilter.java deleted file mode 100644 index d92db3401..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/kickout/KickoutSessionFilter.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.ruoyi.framework.shiro.web.filter.kickout; - -import java.io.IOException; -import java.io.Serializable; -import java.util.ArrayDeque; -import java.util.Deque; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.shiro.cache.Cache; -import org.apache.shiro.cache.CacheManager; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.mgt.DefaultSessionKey; -import org.apache.shiro.session.mgt.SessionManager; -import org.apache.shiro.subject.Subject; -import org.apache.shiro.web.filter.AccessControlFilter; -import org.apache.shiro.web.util.WebUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.ShiroUtils; - -/** - * 登录帐号控制过滤器 - * - * @author ruoyi - */ -public class KickoutSessionFilter extends AccessControlFilter -{ - private final static ObjectMapper objectMapper = new ObjectMapper(); - - /** - * 同一个用户最大会话数 - **/ - private int maxSession = -1; - - /** - * 踢出之前登录的/之后登录的用户 默认false踢出之前登录的用户 - **/ - private Boolean kickoutAfter = false; - - /** - * 踢出后到的地址 - **/ - private String kickoutUrl; - - private SessionManager sessionManager; - private Cache> cache; - - @Override - protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) - throws Exception - { - return false; - } - - @Override - protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception - { - Subject subject = getSubject(request, response); - if (!subject.isAuthenticated() && !subject.isRemembered() || maxSession == -1) - { - // 如果没有登录或用户最大会话数为-1,直接进行之后的流程 - return true; - } - try - { - Session session = subject.getSession(); - // 当前登录用户 - SysUser user = ShiroUtils.getSysUser(); - String loginName = user.getLoginName(); - Serializable sessionId = session.getId(); - - // 读取缓存用户 没有就存入 - Deque deque = cache.get(loginName); - if (deque == null) - { - // 初始化队列 - deque = new ArrayDeque(); - } - - // 如果队列里没有此sessionId,且用户没有被踢出;放入队列 - if (!deque.contains(sessionId) && session.getAttribute("kickout") == null) - { - // 将sessionId存入队列 - deque.push(sessionId); - // 将用户的sessionId队列缓存 - cache.put(loginName, deque); - } - - // 如果队列里的sessionId数超出最大会话数,开始踢人 - while (deque.size() > maxSession) - { - // 是否踢出后来登录的,默认是false;即后者登录的用户踢出前者登录的用户; - Serializable kickoutSessionId = kickoutAfter ? deque.removeFirst() : deque.removeLast(); - // 踢出后再更新下缓存队列 - cache.put(loginName, deque); - - try - { - // 获取被踢出的sessionId的session对象 - Session kickoutSession = sessionManager.getSession(new DefaultSessionKey(kickoutSessionId)); - if (null != kickoutSession) - { - // 设置会话的kickout属性表示踢出了 - kickoutSession.setAttribute("kickout", true); - } - } - catch (Exception e) - { - // 面对异常,我们选择忽略 - } - } - - // 如果被踢出了,(前者或后者)直接退出,重定向到踢出后的地址 - if (session.getAttribute("kickout") != null && (Boolean) session.getAttribute("kickout") == true) - { - // 退出登录 - subject.logout(); - saveRequest(request); - return isAjaxResponse(request, response); - } - return true; - } - catch (Exception e) - { - return isAjaxResponse(request, response); - } - } - - private boolean isAjaxResponse(ServletRequest request, ServletResponse response) throws IOException - { - HttpServletRequest req = (HttpServletRequest) request; - HttpServletResponse res = (HttpServletResponse) response; - if (ServletUtils.isAjaxRequest(req)) - { - AjaxResult ajaxResult = AjaxResult.error("您已在别处登录,请您修改密码或重新登录"); - ServletUtils.renderString(res, objectMapper.writeValueAsString(ajaxResult)); - } - else - { - WebUtils.issueRedirect(request, response, kickoutUrl); - } - return false; - } - - public void setMaxSession(int maxSession) - { - this.maxSession = maxSession; - } - - public void setKickoutAfter(boolean kickoutAfter) - { - this.kickoutAfter = kickoutAfter; - } - - public void setKickoutUrl(String kickoutUrl) - { - this.kickoutUrl = kickoutUrl; - } - - public void setSessionManager(SessionManager sessionManager) - { - this.sessionManager = sessionManager; - } - - // 设置Cache的key的前缀 - public void setCacheManager(CacheManager cacheManager) - { - // 必须和ehcache缓存配置中的缓存name一致 - this.cache = cacheManager.getCache(ShiroConstants.SYS_USERCACHE); - } -} \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java deleted file mode 100644 index bbbe6d66e..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/online/OnlineSessionFilter.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.ruoyi.framework.shiro.web.filter.online; - -import java.io.IOException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import org.apache.shiro.session.Session; -import org.apache.shiro.subject.Subject; -import org.apache.shiro.web.filter.AccessControlFilter; -import org.apache.shiro.web.util.WebUtils; -import org.springframework.beans.factory.annotation.Value; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.enums.OnlineStatus; -import com.ruoyi.common.utils.ShiroUtils; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.framework.shiro.session.OnlineSessionDAO; - -/** - * 自定义访问控制 - * - * @author ruoyi - */ -public class OnlineSessionFilter extends AccessControlFilter -{ - /** - * 强制退出后重定向的地址 - */ - @Value("${shiro.user.loginUrl}") - private String loginUrl; - - private OnlineSessionDAO onlineSessionDAO; - - /** - * 表示是否允许访问;mappedValue就是[urls]配置中拦截器参数部分,如果允许访问返回true,否则false; - */ - @Override - protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) - throws Exception - { - Subject subject = getSubject(request, response); - if (subject == null || subject.getSession() == null) - { - return true; - } - Session session = onlineSessionDAO.readSession(subject.getSession().getId()); - if (session != null && session instanceof OnlineSession) - { - OnlineSession onlineSession = (OnlineSession) session; - request.setAttribute(ShiroConstants.ONLINE_SESSION, onlineSession); - // 把user对象设置进去 - boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L; - if (isGuest == true) - { - SysUser user = ShiroUtils.getSysUser(); - if (user != null) - { - onlineSession.setUserId(user.getUserId()); - onlineSession.setLoginName(user.getLoginName()); - onlineSession.setAvatar(user.getAvatar()); - onlineSession.setDeptName(user.getDept().getDeptName()); - onlineSession.markAttributeChanged(); - } - } - - if (onlineSession.getStatus() == OnlineStatus.off_line) - { - return false; - } - } - return true; - } - - /** - * 表示当访问拒绝时是否已经处理了;如果返回true表示需要继续处理;如果返回false表示该拦截器实例已经处理了,将直接返回即可。 - */ - @Override - protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception - { - Subject subject = getSubject(request, response); - if (subject != null) - { - subject.logout(); - } - saveRequestAndRedirectToLogin(request, response); - return false; - } - - // 跳转到登录页 - @Override - protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException - { - WebUtils.issueRedirect(request, response, loginUrl); - } - - public void setOnlineSessionDAO(OnlineSessionDAO onlineSessionDAO) - { - this.onlineSessionDAO = onlineSessionDAO; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java deleted file mode 100644 index f8e51422c..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/sync/SyncOnlineSessionFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.ruoyi.framework.shiro.web.filter.sync; - -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import org.apache.shiro.web.filter.PathMatchingFilter; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.framework.shiro.session.OnlineSessionDAO; - -/** - * 同步Session数据到Db - * - * @author ruoyi - */ -public class SyncOnlineSessionFilter extends PathMatchingFilter -{ - private OnlineSessionDAO onlineSessionDAO; - - /** - * 同步会话数据到DB 一次请求最多同步一次 防止过多处理 需要放到Shiro过滤器之前 - */ - @Override - protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception - { - OnlineSession session = (OnlineSession) request.getAttribute(ShiroConstants.ONLINE_SESSION); - // 如果session stop了 也不同步 - // session停止时间,如果stopTimestamp不为null,则代表已停止 - if (session != null && session.getUserId() != null && session.getStopTimestamp() == null) - { - onlineSessionDAO.syncToDb(session); - } - return true; - } - - public void setOnlineSessionDAO(OnlineSessionDAO onlineSessionDAO) - { - this.onlineSessionDAO = onlineSessionDAO; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java deleted file mode 100644 index 695824243..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.ruoyi.framework.shiro.web.session; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.shiro.session.ExpiredSessionException; -import org.apache.shiro.session.InvalidSessionException; -import org.apache.shiro.session.Session; -import org.apache.shiro.session.mgt.DefaultSessionKey; -import org.apache.shiro.session.mgt.SessionKey; -import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.bean.BeanUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.system.domain.SysUserOnline; -import com.ruoyi.system.service.ISysUserOnlineService; - -/** - * 主要是在此如果会话的属性修改了 就标识下其修改了 然后方便 OnlineSessionDao同步 - * - * @author ruoyi - */ -public class OnlineWebSessionManager extends DefaultWebSessionManager -{ - private static final Logger log = LoggerFactory.getLogger(OnlineWebSessionManager.class); - - @Override - public void setAttribute(SessionKey sessionKey, Object attributeKey, Object value) throws InvalidSessionException - { - super.setAttribute(sessionKey, attributeKey, value); - if (value != null && needMarkAttributeChanged(attributeKey)) - { - OnlineSession session = getOnlineSession(sessionKey); - session.markAttributeChanged(); - } - } - - private boolean needMarkAttributeChanged(Object attributeKey) - { - if (attributeKey == null) - { - return false; - } - String attributeKeyStr = attributeKey.toString(); - // 优化 flash属性没必要持久化 - if (attributeKeyStr.startsWith("org.springframework")) - { - return false; - } - if (attributeKeyStr.startsWith("javax.servlet")) - { - return false; - } - if (attributeKeyStr.equals(ShiroConstants.CURRENT_USERNAME)) - { - return false; - } - return true; - } - - @Override - public Object removeAttribute(SessionKey sessionKey, Object attributeKey) throws InvalidSessionException - { - Object removed = super.removeAttribute(sessionKey, attributeKey); - if (removed != null) - { - OnlineSession s = getOnlineSession(sessionKey); - s.markAttributeChanged(); - } - - return removed; - } - - public OnlineSession getOnlineSession(SessionKey sessionKey) - { - OnlineSession session = null; - Object obj = doGetSession(sessionKey); - if (StringUtils.isNotNull(obj)) - { - session = new OnlineSession(); - BeanUtils.copyBeanProp(session, obj); - } - return session; - } - - /** - * 验证session是否有效 用于删除过期session - */ - @Override - public void validateSessions() - { - if (log.isInfoEnabled()) - { - log.info("invalidation sessions..."); - } - - int invalidCount = 0; - - int timeout = (int) this.getGlobalSessionTimeout(); - if (timeout < 0) - { - // 永不过期不进行处理 - return; - } - Date expiredDate = DateUtils.addMilliseconds(new Date(), 0 - timeout); - ISysUserOnlineService userOnlineService = SpringUtils.getBean(ISysUserOnlineService.class); - List userOnlineList = userOnlineService.selectOnlineByExpired(expiredDate); - // 批量过期删除 - List needOfflineIdList = new ArrayList(); - for (SysUserOnline userOnline : userOnlineList) - { - try - { - SessionKey key = new DefaultSessionKey(userOnline.getSessionId()); - Session session = retrieveSession(key); - if (session != null) - { - throw new InvalidSessionException(); - } - } - catch (InvalidSessionException e) - { - if (log.isDebugEnabled()) - { - boolean expired = (e instanceof ExpiredSessionException); - String msg = "Invalidated session with id [" + userOnline.getSessionId() + "]" - + (expired ? " (expired)" : " (stopped)"); - log.debug(msg); - } - invalidCount++; - needOfflineIdList.add(userOnline.getSessionId()); - userOnlineService.removeUserCache(userOnline.getLoginName(), userOnline.getSessionId()); - } - - } - if (needOfflineIdList.size() > 0) - { - try - { - userOnlineService.batchDeleteOnline(needOfflineIdList); - } - catch (Exception e) - { - log.error("batch delete db session error.", e); - } - } - - if (log.isInfoEnabled()) - { - String msg = "Finished invalidation session."; - if (invalidCount > 0) - { - msg += " [" + invalidCount + "] sessions were stopped."; - } - else - { - msg += " No sessions were stopped."; - } - log.info(msg); - } - - } - - @Override - protected Collection getActiveSessions() - { - throw new UnsupportedOperationException("getActiveSessions method not supported"); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java deleted file mode 100644 index f5c9d1e6a..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.ruoyi.framework.shiro.web.session; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.apache.shiro.session.mgt.DefaultSessionManager; -import org.apache.shiro.session.mgt.SessionValidationScheduler; -import org.apache.shiro.session.mgt.ValidatingSessionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Lazy; -import org.springframework.stereotype.Component; -import com.ruoyi.common.utils.Threads; - -/** - * 自定义任务调度器完成 - * - * @author ruoyi - */ -@Component -public class SpringSessionValidationScheduler implements SessionValidationScheduler -{ - private static final Logger log = LoggerFactory.getLogger(SpringSessionValidationScheduler.class); - - public static final long DEFAULT_SESSION_VALIDATION_INTERVAL = DefaultSessionManager.DEFAULT_SESSION_VALIDATION_INTERVAL; - - /** - * 定时器,用于处理超时的挂起请求,也用于连接断开时的重连。 - */ - @Autowired - @Qualifier("scheduledExecutorService") - private ScheduledExecutorService executorService; - - private volatile boolean enabled = false; - - /** - * 会话验证管理器 - */ - @Autowired - @Qualifier("sessionManager") - @Lazy - private ValidatingSessionManager sessionManager; - - // 相隔多久检查一次session的有效性,单位毫秒,默认就是10分钟 - @Value("${shiro.session.validationInterval}") - private long sessionValidationInterval; - - @Override - public boolean isEnabled() - { - return this.enabled; - } - - /** - * Specifies how frequently (in milliseconds) this Scheduler will call the - * {@link org.apache.shiro.session.mgt.ValidatingSessionManager#validateSessions() - * ValidatingSessionManager#validateSessions()} method. - * - *

    - * Unless this method is called, the default value is {@link #DEFAULT_SESSION_VALIDATION_INTERVAL}. - * - * @param sessionValidationInterval - */ - public void setSessionValidationInterval(long sessionValidationInterval) - { - this.sessionValidationInterval = sessionValidationInterval; - } - - /** - * Starts session validation by creating a spring PeriodicTrigger. - */ - @Override - public void enableSessionValidation() - { - - enabled = true; - - if (log.isDebugEnabled()) - { - log.debug("Scheduling session validation job using Spring Scheduler with " - + "session validation interval of [" + sessionValidationInterval + "]ms..."); - } - - try - { - executorService.scheduleAtFixedRate(new Runnable() - { - @Override - public void run() - { - if (enabled) - { - sessionManager.validateSessions(); - } - } - }, 1000, sessionValidationInterval * 60 * 1000, TimeUnit.MILLISECONDS); - - this.enabled = true; - - if (log.isDebugEnabled()) - { - log.debug("Session validation job successfully scheduled with Spring Scheduler."); - } - - } - catch (Exception e) - { - if (log.isErrorEnabled()) - { - log.error("Error starting the Spring Scheduler session validation job. Session validation may not occur.", e); - } - } - } - - @Override - public void disableSessionValidation() - { - if (log.isDebugEnabled()) - { - log.debug("Stopping Spring Scheduler session validation job..."); - } - - if (this.enabled) - { - Threads.shutdownAndAwaitTermination(executorService); - } - this.enabled = false; - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java index e7312f05b..30a1957eb 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/domain/Server.java @@ -5,7 +5,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Properties; import com.ruoyi.common.utils.Arith; -import com.ruoyi.common.utils.IpUtils; +import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.framework.web.domain.server.Cpu; import com.ruoyi.framework.web.domain.server.Jvm; import com.ruoyi.framework.web.domain.server.Mem; @@ -28,7 +28,6 @@ import oshi.util.Util; */ public class Server { - private static final int OSHI_WAIT_SECOND = 1000; /** diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index 10f30f456..a3ec18232 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -1,21 +1,21 @@ package com.ruoyi.framework.web.exception; import javax.servlet.http.HttpServletRequest; -import org.apache.shiro.authz.AuthorizationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.security.access.AccessDeniedException; import org.springframework.validation.BindException; import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MissingPathVariableException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; -import org.springframework.web.servlet.ModelAndView; +import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.DemoModeException; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.ServletUtils; -import com.ruoyi.common.utils.security.PermissionUtils; +import com.ruoyi.common.utils.StringUtils; /** * 全局异常处理器 @@ -28,21 +28,14 @@ public class GlobalExceptionHandler private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); /** - * 权限校验异常(ajax请求返回json,redirect请求跳转页面) + * 权限校验异常 */ - @ExceptionHandler(AuthorizationException.class) - public Object handleAuthorizationException(AuthorizationException e, HttpServletRequest request) + @ExceptionHandler(AccessDeniedException.class) + public AjaxResult handleAccessDeniedException(AccessDeniedException e, HttpServletRequest request) { String requestURI = request.getRequestURI(); log.error("请求地址'{}',权限校验失败'{}'", requestURI, e.getMessage()); - if (ServletUtils.isAjaxRequest(request)) - { - return AjaxResult.error(PermissionUtils.getMsg(e.getMessage())); - } - else - { - return new ModelAndView("error/unauth"); - } + return AjaxResult.error(HttpStatus.FORBIDDEN, "没有权限,请联系管理员授权"); } /** @@ -57,6 +50,39 @@ public class GlobalExceptionHandler return AjaxResult.error(e.getMessage()); } + /** + * 业务异常 + */ + @ExceptionHandler(ServiceException.class) + public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) + { + log.error(e.getMessage(), e); + Integer code = e.getCode(); + return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); + } + + /** + * 请求路径中缺少必需的路径变量 + */ + @ExceptionHandler(MissingPathVariableException.class) + public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求路径中缺少必需的路径变量'{}',发生系统异常.", requestURI, e); + return AjaxResult.error(String.format("请求路径中缺少必需的路径变量[%s]", e.getVariableName())); + } + + /** + * 请求参数类型不匹配 + */ + @ExceptionHandler(MethodArgumentTypeMismatchException.class) + public AjaxResult handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI, e); + return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), e.getValue())); + } + /** * 拦截未知的运行时异常 */ @@ -79,46 +105,6 @@ public class GlobalExceptionHandler return AjaxResult.error(e.getMessage()); } - /** - * 业务异常 - */ - @ExceptionHandler(ServiceException.class) - public Object handleServiceException(ServiceException e, HttpServletRequest request) - { - log.error(e.getMessage(), e); - if (ServletUtils.isAjaxRequest(request)) - { - return AjaxResult.error(e.getMessage()); - } - else - { - return new ModelAndView("error/service", "errorMessage", e.getMessage()); - } - } - - /** - * 请求路径中缺少必需的路径变量 - */ - @ExceptionHandler(MissingPathVariableException.class) - public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request) - { - String requestURI = request.getRequestURI(); - log.error("请求路径中缺少必需的路径变量'{}',发生系统异常.", requestURI, e); - return AjaxResult.error(String.format("请求路径中缺少必需的路径变量[%s]", e.getVariableName())); - } - - /** - * 请求参数类型不匹配 - */ - @ExceptionHandler(MethodArgumentTypeMismatchException.class) - public AjaxResult handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, - HttpServletRequest request) - { - String requestURI = request.getRequestURI(); - log.error("请求参数类型不匹配'{}',发生系统异常.", requestURI, e); - return AjaxResult.error(String.format("请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'", e.getName(), e.getRequiredType().getName(), e.getValue())); - } - /** * 自定义验证异常 */ @@ -130,6 +116,17 @@ public class GlobalExceptionHandler return AjaxResult.error(message); } + /** + * 自定义验证异常 + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) + { + log.error(e.getMessage(), e); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error(message); + } + /** * 演示模式异常 */ diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/CacheService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/CacheService.java deleted file mode 100644 index 33d17ac46..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/CacheService.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.ruoyi.framework.web.service; - -import java.util.Set; -import org.apache.commons.lang3.ArrayUtils; -import org.springframework.stereotype.Service; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.utils.CacheUtils; - -/** - * 缓存操作处理 - * - * @author ruoyi - */ -@Service -public class CacheService -{ - /** - * 获取所有缓存名称 - * - * @return 缓存列表 - */ - public String[] getCacheNames() - { - String[] cacheNames = CacheUtils.getCacheNames(); - return ArrayUtils.removeElement(cacheNames, Constants.SYS_AUTH_CACHE); - } - - /** - * 根据缓存名称获取所有键名 - * - * @param cacheName 缓存名称 - * @return 键名列表 - */ - public Set getCacheKeys(String cacheName) - { - return CacheUtils.getCache(cacheName).keys(); - } - - /** - * 根据缓存名称和键名获取内容值 - * - * @param cacheName 缓存名称 - * @param cacheKey 键名 - * @return 键值 - */ - public Object getCacheValue(String cacheName, String cacheKey) - { - return CacheUtils.get(cacheName, cacheKey); - } - - /** - * 根据名称删除缓存信息 - * - * @param cacheName 缓存名称 - */ - public void clearCacheName(String cacheName) - { - CacheUtils.removeAll(cacheName); - } - - /** - * 根据名称和键名删除缓存信息 - * - * @param cacheName 缓存名称 - * @param cacheKey 键名 - */ - public void clearCacheKey(String cacheName, String cacheKey) - { - CacheUtils.remove(cacheName, cacheKey); - } - - /** - * 清理所有缓存 - */ - public void clearAll() - { - String[] cacheNames = getCacheNames(); - for (String cacheName : cacheNames) - { - CacheUtils.removeAll(cacheName); - } - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java deleted file mode 100644 index 3b2d0566b..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/ConfigService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.ruoyi.framework.web.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.system.service.ISysConfigService; - -/** - * RuoYi首创 html调用 thymeleaf 实现参数管理 - * - * @author ruoyi - */ -@Service("config") -public class ConfigService -{ - @Autowired - private ISysConfigService configService; - - /** - * 根据键名查询参数配置信息 - * - * @param configKey 参数键名 - * @return 参数键值 - */ - public String getKey(String configKey) - { - return configService.selectConfigByKey(configKey); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java deleted file mode 100644 index ced0e787e..000000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/DictService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.ruoyi.framework.web.service; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.system.service.ISysDictDataService; -import com.ruoyi.system.service.ISysDictTypeService; - -/** - * RuoYi首创 html调用 thymeleaf 实现字典读取 - * - * @author ruoyi - */ -@Service("dict") -public class DictService -{ - @Autowired - private ISysDictTypeService dictTypeService; - - @Autowired - private ISysDictDataService dictDataService; - - /** - * 根据字典类型查询字典数据信息 - * - * @param dictType 字典类型 - * @return 参数键值 - */ - public List getType(String dictType) - { - return dictTypeService.selectDictDataByType(dictType); - } - - /** - * 根据字典类型和字典键值查询字典数据信息 - * - * @param dictType 字典类型 - * @param dictValue 字典键值 - * @return 字典标签 - */ - public String getLabel(String dictType, String dictValue) - { - return dictDataService.selectDictLabel(dictType, dictValue); - } -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java index c806a364e..6892467db 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java @@ -1,169 +1,81 @@ package com.ruoyi.framework.web.service; -import java.beans.BeanInfo; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.subject.Subject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.Set; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.security.context.PermissionContextHolder; /** - * RuoYi首创 js调用 thymeleaf 实现按钮权限可见性 + * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 * * @author ruoyi */ -@Service("permission") +@Service("ss") public class PermissionService { - private static final Logger log = LoggerFactory.getLogger(PermissionService.class); - - /** 没有权限,hidden用于前端隐藏按钮 */ - public static final String NOACCESS = "hidden"; - - private static final String ROLE_DELIMETER = ","; - - private static final String PERMISSION_DELIMETER = ","; - /** - * 验证用户是否具备某权限,无权限返回hidden用于前端隐藏(如需返回Boolean使用isPermitted) + * 验证用户是否具备某权限 * * @param permission 权限字符串 * @return 用户是否具备某权限 */ - public String hasPermi(String permission) + public boolean hasPermi(String permission) { - return isPermitted(permission) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否不具备某权限,与 hasPermi逻辑相反。无权限返回hidden用于前端隐藏(如需返回Boolean使用isLacksPermitted) - * - * @param permission 权限字符串 - * @return 用户是否不具备某权限 - */ - public String lacksPermi(String permission) - { - return isLacksPermitted(permission) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否具有以下任意一个权限,无权限返回hidden用于隐藏(如需返回Boolean使用hasAnyPermissions) - * - * @param permissions 以 PERMISSION_DELIMETER 为分隔符的权限列表 - * @return 用户是否具有以下任意一个权限 - */ - public String hasAnyPermi(String permissions) - { - return hasAnyPermissions(permissions, PERMISSION_DELIMETER) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否具备某角色,无权限返回hidden用于隐藏(如需返回Boolean使用isRole) - * - * @param role 角色字符串 - * @return 用户是否具备某角色 - */ - public String hasRole(String role) - { - return isRole(role) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否不具备某角色,与hasRole逻辑相反。无权限返回hidden用于隐藏(如需返回Boolean使用isLacksRole) - * - * @param role 角色字符串 - * @return 用户是否不具备某角色 - */ - public String lacksRole(String role) - { - return isLacksRole(role) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否具有以下任意一个角色,无权限返回hidden用于隐藏(如需返回Boolean使用isAnyRoles) - * - * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 - * @return 用户是否具有以下任意一个角色 - */ - public String hasAnyRoles(String roles) - { - return isAnyRoles(roles, ROLE_DELIMETER) ? StringUtils.EMPTY : NOACCESS; - } - - /** - * 验证用户是否认证通过或已记住的用户。 - * - * @return 用户是否认证通过或已记住的用户 - */ - public boolean isUser() - { - Subject subject = SecurityUtils.getSubject(); - return subject != null && subject.getPrincipal() != null; - } - - /** - * 判断用户是否拥有某个权限 - * - * @param permission 权限字符串 - * @return 用户是否具备某权限 - */ - public boolean isPermitted(String permission) - { - return SecurityUtils.getSubject().isPermitted(permission); - } - - /** - * 判断用户是否不具备某权限,与 isPermitted逻辑相反。 - * - * @param permission 权限名称 - * @return 用户是否不具备某权限 - */ - public boolean isLacksPermitted(String permission) - { - return isPermitted(permission) != true; - } - - /** - * 验证用户是否具有以下任意一个权限。 - * - * @param permissions 以 PERMISSION_DELIMETER 为分隔符的权限列表 - * @return 用户是否具有以下任意一个权限 - */ - public boolean hasAnyPermissions(String permissions) - { - return hasAnyPermissions(permissions, PERMISSION_DELIMETER); - } - - /** - * 验证用户是否具有以下任意一个权限。 - * - * @param permissions 以 delimeter 为分隔符的权限列表 - * @param delimeter 权限列表分隔符 - * @return 用户是否具有以下任意一个权限 - */ - public boolean hasAnyPermissions(String permissions, String delimeter) - { - Subject subject = SecurityUtils.getSubject(); - - if (subject != null) + if (StringUtils.isEmpty(permission)) { - if (delimeter == null || delimeter.length() == 0) - { - delimeter = PERMISSION_DELIMETER; - } + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permission); + return hasPermissions(loginUser.getPermissions(), permission); + } - for (String permission : permissions.split(delimeter)) + /** + * 验证用户是否不具备某权限,与 hasPermi逻辑相反 + * + * @param permission 权限字符串 + * @return 用户是否不具备某权限 + */ + public boolean lacksPermi(String permission) + { + return hasPermi(permission) != true; + } + + /** + * 验证用户是否具有以下任意一个权限 + * + * @param permissions 以 PERMISSION_DELIMETER 为分隔符的权限列表 + * @return 用户是否具有以下任意一个权限 + */ + public boolean hasAnyPermi(String permissions) + { + if (StringUtils.isEmpty(permissions)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) + { + return false; + } + PermissionContextHolder.setContext(permissions); + Set authorities = loginUser.getPermissions(); + for (String permission : permissions.split(Constants.PERMISSION_DELIMETER)) + { + if (permission != null && hasPermissions(authorities, permission)) { - if (permission != null && subject.isPermitted(permission.trim()) == true) - { - return true; - } + return true; } } - return false; } @@ -173,9 +85,26 @@ public class PermissionService * @param role 角色字符串 * @return 用户是否具备某角色 */ - public boolean isRole(String role) + public boolean hasRole(String role) { - return SecurityUtils.getSubject().hasRole(role); + if (StringUtils.isEmpty(role)) + { + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (SysRole sysRole : loginUser.getUser().getRoles()) + { + String roleKey = sysRole.getRoleKey(); + if (Constants.SUPER_ADMIN.equals(roleKey) || roleKey.equals(StringUtils.trim(role))) + { + return true; + } + } + return false; } /** @@ -184,79 +113,47 @@ public class PermissionService * @param role 角色名称 * @return 用户是否不具备某角色 */ - public boolean isLacksRole(String role) + public boolean lacksRole(String role) { - return isRole(role) != true; + return hasRole(role) != true; } /** - * 验证用户是否具有以下任意一个角色。 + * 验证用户是否具有以下任意一个角色 * * @param roles 以 ROLE_NAMES_DELIMETER 为分隔符的角色列表 * @return 用户是否具有以下任意一个角色 */ - public boolean isAnyRoles(String roles) + public boolean hasAnyRoles(String roles) { - return isAnyRoles(roles, ROLE_DELIMETER); - } - - /** - * 验证用户是否具有以下任意一个角色。 - * - * @param roles 以 delimeter 为分隔符的角色列表 - * @param delimeter 角色列表分隔符 - * @return 用户是否具有以下任意一个角色 - */ - public boolean isAnyRoles(String roles, String delimeter) - { - Subject subject = SecurityUtils.getSubject(); - if (subject != null) + if (StringUtils.isEmpty(roles)) { - if (delimeter == null || delimeter.length() == 0) + return false; + } + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getUser().getRoles())) + { + return false; + } + for (String role : roles.split(Constants.ROLE_DELIMETER)) + { + if (hasRole(role)) { - delimeter = ROLE_DELIMETER; - } - - for (String role : roles.split(delimeter)) - { - if (subject.hasRole(role.trim()) == true) - { - return true; - } + return true; } } - return false; } /** - * 返回用户属性值 - * - * @param property 属性名称 - * @return 用户属性值 + * 判断是否包含权限 + * + * @param permissions 权限列表 + * @param permission 权限字符串 + * @return 用户是否具备某权限 */ - public Object getPrincipalProperty(String property) + private boolean hasPermissions(Set permissions, String permission) { - Subject subject = SecurityUtils.getSubject(); - if (subject != null) - { - Object principal = subject.getPrincipal(); - try - { - BeanInfo bi = Introspector.getBeanInfo(principal.getClass()); - for (PropertyDescriptor pd : bi.getPropertyDescriptors()) - { - if (pd.getName().equals(property) == true) - { - return pd.getReadMethod().invoke(principal, (Object[]) null); - } - } - } - catch (Exception e) - { - log.error("Error reading property [{}] from principal of type [{}]", property, principal.getClass().getName()); - } - } - return null; + return permissions.contains(Constants.ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission)); } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java new file mode 100644 index 000000000..67267b770 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java @@ -0,0 +1,181 @@ +package com.ruoyi.framework.web.service; + +import javax.annotation.Resource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.exception.user.BlackListException; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.CaptchaExpireException; +import com.ruoyi.common.exception.user.UserNotExistsException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 登录校验方法 + * + * @author ruoyi + */ +@Component +public class SysLoginService +{ + @Autowired + private TokenService tokenService; + + @Resource + private AuthenticationManager authenticationManager; + + @Autowired + private RedisCache redisCache; + + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + /** + * 登录验证 + * + * @param username 用户名 + * @param password 密码 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public String login(String username, String password, String code, String uuid) + { + // 验证码校验 + validateCaptcha(username, code, uuid); + // 登录前置校验 + loginPreCheck(username, password); + // 用户验证 + Authentication authentication = null; + try + { + UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); + AuthenticationContextHolder.setContext(authenticationToken); + // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername + authentication = authenticationManager.authenticate(authenticationToken); + } + catch (Exception e) + { + if (e instanceof BadCredentialsException) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); + throw new ServiceException(e.getMessage()); + } + } + finally + { + AuthenticationContextHolder.clearContext(); + } + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); + LoginUser loginUser = (LoginUser) authentication.getPrincipal(); + recordLoginInfo(loginUser.getUserId()); + // 生成token + return tokenService.createToken(loginUser); + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + boolean captchaEnabled = configService.selectCaptchaEnabled(); + if (captchaEnabled) + { + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); + throw new CaptchaException(); + } + } + } + + /** + * 登录前置校验 + * @param username 用户名 + * @param password 用户密码 + */ + public void loginPreCheck(String username, String password) + { + // 用户名或密码为空 错误 + if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null"))); + throw new UserNotExistsException(); + } + // 密码如果不在指定范围内 错误 + if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + // 用户名不在指定范围内 错误 + if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); + throw new UserPasswordNotMatchException(); + } + // IP黑名单校验 + String blackStr = configService.selectConfigByKey("sys.login.blackIPList"); + if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("login.blocked"))); + throw new BlackListException(); + } + } + + /** + * 记录登录信息 + * + * @param userId 用户ID + */ + public void recordLoginInfo(Long userId) + { + SysUser sysUser = new SysUser(); + sysUser.setUserId(userId); + sysUser.setLoginIp(IpUtils.getIpAddr()); + sysUser.setLoginDate(DateUtils.getNowDate()); + userService.updateUserProfile(sysUser); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java new file mode 100644 index 000000000..6728c7bb3 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPasswordService.java @@ -0,0 +1,86 @@ +package com.ruoyi.framework.web.service; + +import java.util.concurrent.TimeUnit; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.framework.security.context.AuthenticationContextHolder; + +/** + * 登录密码方法 + * + * @author ruoyi + */ +@Component +public class SysPasswordService +{ + @Autowired + private RedisCache redisCache; + + @Value(value = "${user.password.maxRetryCount}") + private int maxRetryCount; + + @Value(value = "${user.password.lockTime}") + private int lockTime; + + /** + * 登录账户密码错误次数缓存键名 + * + * @param username 用户名 + * @return 缓存键key + */ + private String getCacheKey(String username) + { + return CacheConstants.PWD_ERR_CNT_KEY + username; + } + + public void validate(SysUser user) + { + Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext(); + String username = usernamePasswordAuthenticationToken.getName(); + String password = usernamePasswordAuthenticationToken.getCredentials().toString(); + + Integer retryCount = redisCache.getCacheObject(getCacheKey(username)); + + if (retryCount == null) + { + retryCount = 0; + } + + if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) + { + throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime); + } + + if (!matches(user, password)) + { + retryCount = retryCount + 1; + redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); + throw new UserPasswordNotMatchException(); + } + else + { + clearLoginRecordCache(username); + } + } + + public boolean matches(SysUser user, String rawPassword) + { + return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); + } + + public void clearLoginRecordCache(String loginName) + { + if (redisCache.hasKey(getCacheKey(loginName))) + { + redisCache.deleteObject(getCacheKey(loginName)); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java new file mode 100644 index 000000000..d1fb4ed85 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysPermissionService.java @@ -0,0 +1,83 @@ +package com.ruoyi.framework.web.service; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import com.ruoyi.common.core.domain.entity.SysRole; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.service.ISysMenuService; +import com.ruoyi.system.service.ISysRoleService; + +/** + * 用户权限处理 + * + * @author ruoyi + */ +@Component +public class SysPermissionService +{ + @Autowired + private ISysRoleService roleService; + + @Autowired + private ISysMenuService menuService; + + /** + * 获取角色数据权限 + * + * @param user 用户信息 + * @return 角色权限信息 + */ + public Set getRolePermission(SysUser user) + { + Set roles = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + roles.add("admin"); + } + else + { + roles.addAll(roleService.selectRolePermissionByUserId(user.getUserId())); + } + return roles; + } + + /** + * 获取菜单数据权限 + * + * @param user 用户信息 + * @return 菜单权限信息 + */ + public Set getMenuPermission(SysUser user) + { + Set perms = new HashSet(); + // 管理员拥有所有权限 + if (user.isAdmin()) + { + perms.add("*:*:*"); + } + else + { + List roles = user.getRoles(); + if (!CollectionUtils.isEmpty(roles)) + { + // 多角色设置permissions属性,以便数据权限匹配权限 + for (SysRole role : roles) + { + Set rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); + role.setPermissions(rolePerms); + perms.addAll(rolePerms); + } + } + else + { + perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); + } + } + return perms; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java new file mode 100644 index 000000000..f2afe31fe --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysRegisterService.java @@ -0,0 +1,115 @@ +package com.ruoyi.framework.web.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.RegisterBody; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.CaptchaExpireException; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.manager.AsyncManager; +import com.ruoyi.framework.manager.factory.AsyncFactory; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysUserService; + +/** + * 注册校验方法 + * + * @author ruoyi + */ +@Component +public class SysRegisterService +{ + @Autowired + private ISysUserService userService; + + @Autowired + private ISysConfigService configService; + + @Autowired + private RedisCache redisCache; + + /** + * 注册 + */ + public String register(RegisterBody registerBody) + { + String msg = "", username = registerBody.getUsername(), password = registerBody.getPassword(); + SysUser sysUser = new SysUser(); + sysUser.setUserName(username); + + // 验证码开关 + boolean captchaEnabled = configService.selectCaptchaEnabled(); + if (captchaEnabled) + { + validateCaptcha(username, registerBody.getCode(), registerBody.getUuid()); + } + + if (StringUtils.isEmpty(username)) + { + msg = "用户名不能为空"; + } + else if (StringUtils.isEmpty(password)) + { + msg = "用户密码不能为空"; + } + else if (username.length() < UserConstants.USERNAME_MIN_LENGTH + || username.length() > UserConstants.USERNAME_MAX_LENGTH) + { + msg = "账户长度必须在2到20个字符之间"; + } + else if (password.length() < UserConstants.PASSWORD_MIN_LENGTH + || password.length() > UserConstants.PASSWORD_MAX_LENGTH) + { + msg = "密码长度必须在5到20个字符之间"; + } + else if (!userService.checkUserNameUnique(sysUser)) + { + msg = "保存用户'" + username + "'失败,注册账号已存在"; + } + else + { + sysUser.setNickName(username); + sysUser.setPassword(SecurityUtils.encryptPassword(password)); + boolean regFlag = userService.registerUser(sysUser); + if (!regFlag) + { + msg = "注册失败,请联系系统管理人员"; + } + else + { + AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.REGISTER, MessageUtils.message("user.register.success"))); + } + } + return msg; + } + + /** + * 校验验证码 + * + * @param username 用户名 + * @param code 验证码 + * @param uuid 唯一标识 + * @return 结果 + */ + public void validateCaptcha(String username, String code, String uuid) + { + String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); + String captcha = redisCache.getCacheObject(verifyKey); + redisCache.deleteObject(verifyKey); + if (captcha == null) + { + throw new CaptchaExpireException(); + } + if (!code.equalsIgnoreCase(captcha)) + { + throw new CaptchaException(); + } + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java new file mode 100644 index 000000000..aa112dae1 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java @@ -0,0 +1,231 @@ +package com.ruoyi.framework.web.service; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.ruoyi.common.constant.CacheConstants; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.ip.AddressUtils; +import com.ruoyi.common.utils.ip.IpUtils; +import com.ruoyi.common.utils.uuid.IdUtils; +import eu.bitwalker.useragentutils.UserAgent; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +/** + * token验证处理 + * + * @author ruoyi + */ +@Component +public class TokenService +{ + private static final Logger log = LoggerFactory.getLogger(TokenService.class); + + // 令牌自定义标识 + @Value("${token.header}") + private String header; + + // 令牌秘钥 + @Value("${token.secret}") + private String secret; + + // 令牌有效期(默认30分钟) + @Value("${token.expireTime}") + private int expireTime; + + protected static final long MILLIS_SECOND = 1000; + + protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; + + private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; + + @Autowired + private RedisCache redisCache; + + /** + * 获取用户身份信息 + * + * @return 用户信息 + */ + public LoginUser getLoginUser(HttpServletRequest request) + { + // 获取请求携带的令牌 + String token = getToken(request); + if (StringUtils.isNotEmpty(token)) + { + try + { + Claims claims = parseToken(token); + // 解析对应的权限以及用户信息 + String uuid = (String) claims.get(Constants.LOGIN_USER_KEY); + String userKey = getTokenKey(uuid); + LoginUser user = redisCache.getCacheObject(userKey); + return user; + } + catch (Exception e) + { + log.error("获取用户信息异常'{}'", e.getMessage()); + } + } + return null; + } + + /** + * 设置用户身份信息 + */ + public void setLoginUser(LoginUser loginUser) + { + if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) + { + refreshToken(loginUser); + } + } + + /** + * 删除用户身份信息 + */ + public void delLoginUser(String token) + { + if (StringUtils.isNotEmpty(token)) + { + String userKey = getTokenKey(token); + redisCache.deleteObject(userKey); + } + } + + /** + * 创建令牌 + * + * @param loginUser 用户信息 + * @return 令牌 + */ + public String createToken(LoginUser loginUser) + { + String token = IdUtils.fastUUID(); + loginUser.setToken(token); + setUserAgent(loginUser); + refreshToken(loginUser); + + Map claims = new HashMap<>(); + claims.put(Constants.LOGIN_USER_KEY, token); + return createToken(claims); + } + + /** + * 验证令牌有效期,相差不足20分钟,自动刷新缓存 + * + * @param loginUser + * @return 令牌 + */ + public void verifyToken(LoginUser loginUser) + { + long expireTime = loginUser.getExpireTime(); + long currentTime = System.currentTimeMillis(); + if (expireTime - currentTime <= MILLIS_MINUTE_TEN) + { + refreshToken(loginUser); + } + } + + /** + * 刷新令牌有效期 + * + * @param loginUser 登录信息 + */ + public void refreshToken(LoginUser loginUser) + { + loginUser.setLoginTime(System.currentTimeMillis()); + loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); + // 根据uuid将loginUser缓存 + String userKey = getTokenKey(loginUser.getToken()); + redisCache.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); + } + + /** + * 设置用户代理信息 + * + * @param loginUser 登录信息 + */ + public void setUserAgent(LoginUser loginUser) + { + UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); + String ip = IpUtils.getIpAddr(); + loginUser.setIpaddr(ip); + loginUser.setLoginLocation(AddressUtils.getRealAddressByIP(ip)); + loginUser.setBrowser(userAgent.getBrowser().getName()); + loginUser.setOs(userAgent.getOperatingSystem().getName()); + } + + /** + * 从数据声明生成令牌 + * + * @param claims 数据声明 + * @return 令牌 + */ + private String createToken(Map claims) + { + String token = Jwts.builder() + .setClaims(claims) + .signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } + + /** + * 从令牌中获取数据声明 + * + * @param token 令牌 + * @return 数据声明 + */ + private Claims parseToken(String token) + { + return Jwts.parser() + .setSigningKey(secret) + .parseClaimsJws(token) + .getBody(); + } + + /** + * 从令牌中获取用户名 + * + * @param token 令牌 + * @return 用户名 + */ + public String getUsernameFromToken(String token) + { + Claims claims = parseToken(token); + return claims.getSubject(); + } + + /** + * 获取请求token + * + * @param request + * @return token + */ + private String getToken(HttpServletRequest request) + { + String token = request.getHeader(header); + if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) + { + token = token.replace(Constants.TOKEN_PREFIX, ""); + } + return token; + } + + private String getTokenKey(String uuid) + { + return CacheConstants.LOGIN_TOKEN_KEY + uuid; + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java new file mode 100644 index 000000000..5dcdf90ed --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/UserDetailsServiceImpl.java @@ -0,0 +1,66 @@ +package com.ruoyi.framework.web.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.service.ISysUserService; + +/** + * 用户验证处理 + * + * @author ruoyi + */ +@Service +public class UserDetailsServiceImpl implements UserDetailsService +{ + private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class); + + @Autowired + private ISysUserService userService; + + @Autowired + private SysPasswordService passwordService; + + @Autowired + private SysPermissionService permissionService; + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException + { + SysUser user = userService.selectUserByUserName(username); + if (StringUtils.isNull(user)) + { + log.info("登录用户:{} 不存在.", username); + throw new ServiceException(MessageUtils.message("user.not.exists")); + } + else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) + { + log.info("登录用户:{} 已被删除.", username); + throw new ServiceException(MessageUtils.message("user.password.delete")); + } + else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) + { + log.info("登录用户:{} 已被停用.", username); + throw new ServiceException(MessageUtils.message("user.blocked")); + } + + passwordService.validate(user); + + return createLoginUser(user); + } + + public UserDetails createLoginUser(SysUser user) + { + return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user)); + } +} diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index 2bf2b6824..04b679eb0 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 4.7.8 + 3.8.7 4.0.0 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 49b02bae1..b320853e4 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -2,35 +2,33 @@ package com.ruoyi.generator.controller; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.apache.shiro.authz.annotation.RequiresRoles; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.alibaba.druid.DbType; import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlCreateTableStatement; -import com.alibaba.fastjson.JSON; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.domain.CxSelect; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.security.PermissionUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.sql.SqlUtil; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; @@ -42,31 +40,21 @@ import com.ruoyi.generator.service.IGenTableService; * * @author ruoyi */ -@Controller +@RestController @RequestMapping("/tool/gen") public class GenController extends BaseController { - private String prefix = "tool/gen"; - @Autowired private IGenTableService genTableService; @Autowired private IGenTableColumnService genTableColumnService; - @RequiresPermissions("tool:gen:view") - @GetMapping() - public String gen() - { - return prefix + "/gen"; - } - /** * 查询代码生成列表 */ - @RequiresPermissions("tool:gen:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/list") public TableDataInfo genList(GenTable genTable) { startPage(); @@ -74,12 +62,28 @@ public class GenController extends BaseController return getDataTable(list); } + /** + * 修改代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:query')") + @GetMapping(value = "/{tableId}") + public AjaxResult getInfo(@PathVariable Long tableId) + { + GenTable table = genTableService.selectGenTableById(tableId); + List tables = genTableService.selectGenTableAll(); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); + Map map = new HashMap(); + map.put("info", table); + map.put("rows", list); + map.put("tables", tables); + return success(map); + } + /** * 查询数据库列表 */ - @RequiresPermissions("tool:gen:list") - @PostMapping("/db/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping("/db/list") public TableDataInfo dataList(GenTable genTable) { startPage(); @@ -90,112 +94,39 @@ public class GenController extends BaseController /** * 查询数据表字段列表 */ - @RequiresPermissions("tool:gen:list") - @PostMapping("/column/list") - @ResponseBody - public TableDataInfo columnList(GenTableColumn genTableColumn) + @PreAuthorize("@ss.hasPermi('tool:gen:list')") + @GetMapping(value = "/column/{tableId}") + public TableDataInfo columnList(Long tableId) { TableDataInfo dataInfo = new TableDataInfo(); - List list = genTableColumnService.selectGenTableColumnListByTableId(genTableColumn); + List list = genTableColumnService.selectGenTableColumnListByTableId(tableId); dataInfo.setRows(list); dataInfo.setTotal(list.size()); return dataInfo; } - /** - * 导入表结构 - */ - @RequiresPermissions("tool:gen:list") - @GetMapping("/importTable") - public String importTable() - { - return prefix + "/importTable"; - } - - /** - * 创建表结构 - */ - @GetMapping("/createTable") - public String createTable() - { - return prefix + "/createTable"; - } - /** * 导入表结构(保存) */ - @RequiresPermissions("tool:gen:list") + @PreAuthorize("@ss.hasPermi('tool:gen:import')") @Log(title = "代码生成", businessType = BusinessType.IMPORT) @PostMapping("/importTable") - @ResponseBody public AjaxResult importTableSave(String tables) { String[] tableNames = Convert.toStrArray(tables); // 查询表信息 List tableList = genTableService.selectDbTableListByNames(tableNames); - String operName = Convert.toStr(PermissionUtils.getPrincipalProperty("loginName")); - genTableService.importGenTable(tableList, operName); - return AjaxResult.success(); + genTableService.importGenTable(tableList, SecurityUtils.getUsername()); + return success(); } /** - * 修改代码生成业务 + * 创建表结构(保存) */ - @RequiresPermissions("tool:gen:edit") - @GetMapping("/edit/{tableId}") - public String edit(@PathVariable("tableId") Long tableId, ModelMap mmap) - { - GenTable table = genTableService.selectGenTableById(tableId); - List genTables = genTableService.selectGenTableAll(); - List cxSelect = new ArrayList(); - for (GenTable genTable : genTables) - { - if (!StringUtils.equals(table.getTableName(), genTable.getTableName())) - { - CxSelect cxTable = new CxSelect(genTable.getTableName(), genTable.getTableName() + ':' + genTable.getTableComment()); - List cxColumns = new ArrayList(); - for (GenTableColumn tableColumn : genTable.getColumns()) - { - cxColumns.add(new CxSelect(tableColumn.getColumnName(), tableColumn.getColumnName() + ':' + tableColumn.getColumnComment())); - } - cxTable.setS(cxColumns); - cxSelect.add(cxTable); - } - } - mmap.put("table", table); - mmap.put("data", JSON.toJSON(cxSelect)); - return prefix + "/edit"; - } - - /** - * 修改保存代码生成业务 - */ - @RequiresPermissions("tool:gen:edit") - @Log(title = "代码生成", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(@Validated GenTable genTable) - { - genTableService.validateEdit(genTable); - genTableService.updateGenTable(genTable); - return AjaxResult.success(); - } - - @RequiresPermissions("tool:gen:remove") - @Log(title = "代码生成", businessType = BusinessType.DELETE) - @PostMapping("/remove") - @ResponseBody - public AjaxResult remove(String ids) - { - genTableService.deleteGenTableByIds(ids); - return AjaxResult.success(); - } - - @RequiresRoles("admin") + @PreAuthorize("@ss.hasRole('admin')") @Log(title = "创建表", businessType = BusinessType.OTHER) @PostMapping("/createTable") - @ResponseBody - public AjaxResult create(String sql) + public AjaxResult createTableSave(String sql) { try { @@ -215,7 +146,7 @@ public class GenController extends BaseController } } List tableList = genTableService.selectDbTableListByNames(tableNames.toArray(new String[tableNames.size()])); - String operName = Convert.toStr(PermissionUtils.getPrincipalProperty("loginName")); + String operName = SecurityUtils.getUsername(); genTableService.importGenTable(tableList, operName); return AjaxResult.success(); } @@ -226,22 +157,46 @@ public class GenController extends BaseController } } + /** + * 修改保存代码生成业务 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") + @Log(title = "代码生成", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult editSave(@Validated @RequestBody GenTable genTable) + { + genTableService.validateEdit(genTable); + genTableService.updateGenTable(genTable); + return success(); + } + + /** + * 删除代码生成 + */ + @PreAuthorize("@ss.hasPermi('tool:gen:remove')") + @Log(title = "代码生成", businessType = BusinessType.DELETE) + @DeleteMapping("/{tableIds}") + public AjaxResult remove(@PathVariable Long[] tableIds) + { + genTableService.deleteGenTableByIds(tableIds); + return success(); + } + /** * 预览代码 */ - @RequiresPermissions("tool:gen:preview") + @PreAuthorize("@ss.hasPermi('tool:gen:preview')") @GetMapping("/preview/{tableId}") - @ResponseBody public AjaxResult preview(@PathVariable("tableId") Long tableId) throws IOException { Map dataMap = genTableService.previewCode(tableId); - return AjaxResult.success(dataMap); + return success(dataMap); } /** * 生成代码(下载方式) */ - @RequiresPermissions("tool:gen:code") + @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/download/{tableName}") public void download(HttpServletResponse response, @PathVariable("tableName") String tableName) throws IOException @@ -253,36 +208,33 @@ public class GenController extends BaseController /** * 生成代码(自定义路径) */ - @RequiresPermissions("tool:gen:code") + @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/genCode/{tableName}") - @ResponseBody public AjaxResult genCode(@PathVariable("tableName") String tableName) { genTableService.generatorCode(tableName); - return AjaxResult.success(); + return success(); } /** * 同步数据库 */ - @RequiresPermissions("tool:gen:edit") + @PreAuthorize("@ss.hasPermi('tool:gen:edit')") @Log(title = "代码生成", businessType = BusinessType.UPDATE) @GetMapping("/synchDb/{tableName}") - @ResponseBody public AjaxResult synchDb(@PathVariable("tableName") String tableName) { genTableService.synchDb(tableName); - return AjaxResult.success(); + return success(); } /** * 批量生成代码 */ - @RequiresPermissions("tool:gen:code") + @PreAuthorize("@ss.hasPermi('tool:gen:code')") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @GetMapping("/batchGenCode") - @ResponseBody public void batchGenCode(HttpServletResponse response, String tables) throws IOException { String[] tableNames = Convert.toStrArray(tables); @@ -296,6 +248,8 @@ public class GenController extends BaseController private void genCode(HttpServletResponse response, byte[] data) throws IOException { response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); response.addHeader("Content-Length", "" + data.length); response.setContentType("application/octet-stream; charset=UTF-8"); diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 2abb94fa1..c3af38f09 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -41,6 +41,9 @@ public class GenTable extends BaseEntity /** 使用的模板(crud单表操作 tree树表操作 sub主子表操作) */ private String tplCategory; + /** 前端类型(element-ui模版 element-plus模版) */ + private String tplWebType; + /** 生成包路径 */ @NotBlank(message = "生成包路径不能为空") private String packageName; @@ -165,6 +168,16 @@ public class GenTable extends BaseEntity this.tplCategory = tplCategory; } + public String getTplWebType() + { + return tplWebType; + } + + public void setTplWebType(String tplWebType) + { + this.tplWebType = tplWebType; + } + public String getPackageName() { return packageName; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java index 4b1268c75..9140d4dae 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTableColumn.java @@ -59,11 +59,11 @@ public class GenTableColumn extends BaseEntity /** 查询方式(EQ等于、NE不等于、GT大于、LT小于、LIKE模糊、BETWEEN范围) */ private String queryType; - /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、upload上传控件、summernote富文本控件) */ + /** 显示类型(input文本框、textarea文本域、select下拉框、checkbox复选框、radio单选框、datetime日期控件、image图片上传控件、upload文件上传控件、editor富文本控件) */ private String htmlType; /** 字典类型 */ - private String dictType = ""; + private String dictType; /** 排序 */ private Integer sort; @@ -370,4 +370,4 @@ public class GenTableColumn extends BaseEntity return this.columnComment; } } -} \ No newline at end of file +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java index a819c741b..0dc342895 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableColumnMapper.java @@ -21,10 +21,10 @@ public interface GenTableColumnMapper /** * 查询业务字段列表 * - * @param genTableColumn 业务字段信息 + * @param tableId 业务字段编号 * @return 业务字段集合 */ - public List selectGenTableColumnListByTableId(GenTableColumn genTableColumn); + public List selectGenTableColumnListByTableId(Long tableId); /** * 新增业务字段 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java index 7265d423b..937656dc9 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/GenTableMapper.java @@ -84,8 +84,8 @@ public interface GenTableMapper /** * 创建表 * - * @param sql + * @param sql 表结构 * @return 结果 */ public int createTable(String sql); -} \ No newline at end of file +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java new file mode 100644 index 000000000..0679689d2 --- /dev/null +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableColumnServiceImpl.java @@ -0,0 +1,68 @@ +package com.ruoyi.generator.service; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.common.core.text.Convert; +import com.ruoyi.generator.domain.GenTableColumn; +import com.ruoyi.generator.mapper.GenTableColumnMapper; + +/** + * 业务字段 服务层实现 + * + * @author ruoyi + */ +@Service +public class GenTableColumnServiceImpl implements IGenTableColumnService +{ + @Autowired + private GenTableColumnMapper genTableColumnMapper; + + /** + * 查询业务字段列表 + * + * @param tableId 业务字段编号 + * @return 业务字段集合 + */ + @Override + public List selectGenTableColumnListByTableId(Long tableId) + { + return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); + } + + /** + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int insertGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.insertGenTableColumn(genTableColumn); + } + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int updateGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.updateGenTableColumn(genTableColumn); + } + + /** + * 删除业务字段对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deleteGenTableColumnByIds(String ids) + { + return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); + } +} diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java similarity index 92% rename from ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java rename to ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 1f25c534f..3fb6383e6 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -1,4 +1,4 @@ -package com.ruoyi.generator.service.impl; +package com.ruoyi.generator.service; import java.io.ByteArrayOutputStream; import java.io.File; @@ -21,19 +21,17 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.GenConstants; import com.ruoyi.common.core.text.CharsetKit; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; import com.ruoyi.generator.mapper.GenTableColumnMapper; import com.ruoyi.generator.mapper.GenTableMapper; -import com.ruoyi.generator.service.IGenTableService; import com.ruoyi.generator.util.GenUtils; import com.ruoyi.generator.util.VelocityInitializer; import com.ruoyi.generator.util.VelocityUtils; @@ -130,9 +128,9 @@ public class GenTableServiceImpl implements IGenTableService int row = genTableMapper.updateGenTable(genTable); if (row > 0) { - for (GenTableColumn genTableColumn : genTable.getColumns()) + for (GenTableColumn cenTableColumn : genTable.getColumns()) { - genTableColumnMapper.updateGenTableColumn(genTableColumn); + genTableColumnMapper.updateGenTableColumn(cenTableColumn); } } } @@ -140,15 +138,15 @@ public class GenTableServiceImpl implements IGenTableService /** * 删除业务对象 * - * @param ids 需要删除的数据ID + * @param tableIds 需要删除的数据ID * @return 结果 */ @Override @Transactional - public void deleteGenTableByIds(String ids) + public void deleteGenTableByIds(Long[] tableIds) { - genTableMapper.deleteGenTableByIds(Convert.toLongArray(ids)); - genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); + genTableMapper.deleteGenTableByIds(tableIds); + genTableColumnMapper.deleteGenTableColumnByIds(tableIds); } /** @@ -165,9 +163,8 @@ public class GenTableServiceImpl implements IGenTableService /** * 导入表结构 - * + * * @param tableList 导入表列表 - * @param operName 操作人员 */ @Override @Transactional @@ -219,7 +216,7 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { // 渲染模板 @@ -267,10 +264,10 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { - if (!StringUtils.contains(template, "sql.vm")) + if (!StringUtils.containsAny(template, "sql.vm", "api.js.vm", "index.vue.vm", "index-tree.vue.vm")) { // 渲染模板 StringWriter sw = new StringWriter(); @@ -380,7 +377,7 @@ public class GenTableServiceImpl implements IGenTableService VelocityContext context = VelocityUtils.prepareContext(table); // 获取模板列表 - List templates = VelocityUtils.getTemplateList(table.getTplCategory()); + List templates = VelocityUtils.getTemplateList(table.getTplCategory(), table.getTplWebType()); for (String template : templates) { // 渲染模板 @@ -414,7 +411,7 @@ public class GenTableServiceImpl implements IGenTableService if (GenConstants.TPL_TREE.equals(genTable.getTplCategory())) { String options = JSON.toJSONString(genTable.getParams()); - JSONObject paramsObj = JSONObject.parseObject(options); + JSONObject paramsObj = JSON.parseObject(options); if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { throw new ServiceException("树编码字段不能为空"); @@ -427,16 +424,16 @@ public class GenTableServiceImpl implements IGenTableService { throw new ServiceException("树名称字段不能为空"); } - } - else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) - { - if (StringUtils.isEmpty(genTable.getSubTableName())) + else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { - throw new ServiceException("关联子表的表名不能为空"); - } - else if (StringUtils.isEmpty(genTable.getSubTableFkName())) - { - throw new ServiceException("子表关联的外键名不能为空"); + if (StringUtils.isEmpty(genTable.getSubTableName())) + { + throw new ServiceException("关联子表的表名不能为空"); + } + else if (StringUtils.isEmpty(genTable.getSubTableFkName())) + { + throw new ServiceException("子表关联的外键名不能为空"); + } } } } @@ -498,7 +495,7 @@ public class GenTableServiceImpl implements IGenTableService */ public void setTableFromOptions(GenTable genTable) { - JSONObject paramsObj = JSONObject.parseObject(genTable.getOptions()); + JSONObject paramsObj = JSON.parseObject(genTable.getOptions()); if (StringUtils.isNotNull(paramsObj)) { String treeCode = paramsObj.getString(GenConstants.TREE_CODE); diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java index 2ff5f5663..2130d0431 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableColumnService.java @@ -13,10 +13,10 @@ public interface IGenTableColumnService /** * 查询业务字段列表 * - * @param genTableColumn 业务字段信息 + * @param tableId 业务字段编号 * @return 业务字段集合 */ - public List selectGenTableColumnListByTableId(GenTableColumn genTableColumn); + public List selectGenTableColumnListByTableId(Long tableId); /** * 新增业务字段 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java index 4af8fea26..695426e91 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/IGenTableService.java @@ -61,10 +61,10 @@ public interface IGenTableService /** * 删除业务信息 * - * @param ids 需要删除的数据ID + * @param tableIds 需要删除的表数据ID * @return 结果 */ - public void deleteGenTableByIds(String ids); + public void deleteGenTableByIds(Long[] tableIds); /** * 创建表 @@ -102,9 +102,10 @@ public interface IGenTableService * 生成代码(自定义路径) * * @param tableName 表名称 + * @return 数据 */ public void generatorCode(String tableName); - + /** * 同步数据库 * diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableColumnServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableColumnServiceImpl.java deleted file mode 100644 index 45d015af2..000000000 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenTableColumnServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ruoyi.generator.service.impl; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; -import com.ruoyi.generator.domain.GenTableColumn; -import com.ruoyi.generator.mapper.GenTableColumnMapper; -import com.ruoyi.generator.service.IGenTableColumnService; - -/** - * 业务字段 服务层实现 - * - * @author ruoyi - */ -@Service -public class GenTableColumnServiceImpl implements IGenTableColumnService -{ - @Autowired - private GenTableColumnMapper genTableColumnMapper; - - /** - * 查询业务字段列表 - * - * @param genTableColumn 业务字段信息 - * @return 业务字段集合 - */ - @Override - public List selectGenTableColumnListByTableId(GenTableColumn genTableColumn) - { - return genTableColumnMapper.selectGenTableColumnListByTableId(genTableColumn); - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); - } - - /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - public int deleteGenTableColumnByIds(String ids) - { - return genTableColumnMapper.deleteGenTableColumnByIds(Convert.toLongArray(ids)); - } -} \ No newline at end of file diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index 727dd2259..e28c0bb0e 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -113,15 +113,20 @@ public class GenUtils { column.setHtmlType(GenConstants.HTML_SELECT); } - // 文件字段设置上传控件 + // 图片字段设置图片上传控件 + else if (StringUtils.endsWithIgnoreCase(columnName, "image")) + { + column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); + } + // 文件字段设置文件上传控件 else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { - column.setHtmlType(GenConstants.HTML_UPLOAD); + column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); } // 内容字段设置富文本控件 else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { - column.setHtmlType(GenConstants.HTML_SUMMERNOTE); + column.setHtmlType(GenConstants.HTML_EDITOR); } } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 2698e0b9f..1a146819c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -3,15 +3,21 @@ package com.ruoyi.generator.util; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Set; import org.apache.velocity.VelocityContext; -import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; import com.ruoyi.common.constant.GenConstants; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.generator.config.GenConfig; import com.ruoyi.generator.domain.GenTable; import com.ruoyi.generator.domain.GenTableColumn; +/** + * 模板处理工具类 + * + * @author ruoyi + */ public class VelocityUtils { /** 项目空间路径 */ @@ -20,15 +26,12 @@ public class VelocityUtils /** mybatis空间路径 */ private static final String MYBATIS_PATH = "main/resources/mapper"; - /** html空间路径 */ - private static final String TEMPLATES_PATH = "main/resources/templates"; - /** 默认上级菜单,系统工具 */ private static final String DEFAULT_PARENT_MENU_ID = "3"; /** * 设置模板变量信息 - * + * * @return 模板列表 */ public static VelocityContext prepareContext(GenTable genTable) @@ -46,6 +49,7 @@ public class VelocityUtils velocityContext.put("ClassName", genTable.getClassName()); velocityContext.put("className", StringUtils.uncapitalize(genTable.getClassName())); velocityContext.put("moduleName", genTable.getModuleName()); + velocityContext.put("BusinessName", StringUtils.capitalize(genTable.getBusinessName())); velocityContext.put("businessName", genTable.getBusinessName()); velocityContext.put("basePackage", getPackagePrefix(packageName)); velocityContext.put("packageName", packageName); @@ -56,6 +60,7 @@ public class VelocityUtils velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); velocityContext.put("columns", genTable.getColumns()); velocityContext.put("table", genTable); + velocityContext.put("dicts", getDicts(genTable)); setMenuVelocityContext(velocityContext, genTable); if (GenConstants.TPL_TREE.equals(tplCategory)) { @@ -71,7 +76,7 @@ public class VelocityUtils public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); + JSONObject paramsObj = JSON.parseObject(options); String parentMenuId = getParentMenuId(paramsObj); context.put("parentMenuId", parentMenuId); } @@ -79,7 +84,7 @@ public class VelocityUtils public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) { String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); + JSONObject paramsObj = JSON.parseObject(options); String treeCode = getTreecode(paramsObj); String treeParentCode = getTreeParentCode(paramsObj); String treeName = getTreeName(paramsObj); @@ -118,11 +123,17 @@ public class VelocityUtils /** * 获取模板信息 - * + * @param tplCategory 生成的模板 + * @param tplWebType 前端类型 * @return 模板列表 */ - public static List getTemplateList(String tplCategory) + public static List getTemplateList(String tplCategory, String tplWebType) { + String useWebType = "vm/vue"; + if ("element-plus".equals(tplWebType)) + { + useWebType = "vm/vue/v3"; + } List templates = new ArrayList(); templates.add("vm/java/domain.java.vm"); templates.add("vm/java/mapper.java.vm"); @@ -130,23 +141,21 @@ public class VelocityUtils templates.add("vm/java/serviceImpl.java.vm"); templates.add("vm/java/controller.java.vm"); templates.add("vm/xml/mapper.xml.vm"); + templates.add("vm/sql/sql.vm"); + templates.add("vm/js/api.js.vm"); if (GenConstants.TPL_CRUD.equals(tplCategory)) { - templates.add("vm/html/list.html.vm"); + templates.add(useWebType + "/index.vue.vm"); } else if (GenConstants.TPL_TREE.equals(tplCategory)) { - templates.add("vm/html/tree.html.vm"); - templates.add("vm/html/list-tree.html.vm"); + templates.add(useWebType + "/index-tree.vue.vm"); } else if (GenConstants.TPL_SUB.equals(tplCategory)) { - templates.add("vm/html/list.html.vm"); + templates.add(useWebType + "/index.vue.vm"); templates.add("vm/java/sub-domain.java.vm"); } - templates.add("vm/html/add.html.vm"); - templates.add("vm/html/edit.html.vm"); - templates.add("vm/sql/sql.vm"); return templates; } @@ -168,7 +177,7 @@ public class VelocityUtils String javaPath = PROJECT_PATH + "/" + StringUtils.replace(packageName, ".", "/"); String mybatisPath = MYBATIS_PATH + "/" + moduleName; - String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + businessName; + String vuePath = "vue"; if (template.contains("domain.java.vm")) { @@ -198,51 +207,28 @@ public class VelocityUtils { fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className); } - else if (template.contains("list.html.vm")) - { - fileName = StringUtils.format("{}/{}.html", htmlPath, businessName); - } - else if (template.contains("list-tree.html.vm")) - { - fileName = StringUtils.format("{}/{}.html", htmlPath, businessName); - } - else if (template.contains("tree.html.vm")) - { - fileName = StringUtils.format("{}/tree.html", htmlPath); - } - else if (template.contains("add.html.vm")) - { - fileName = StringUtils.format("{}/add.html", htmlPath); - } - else if (template.contains("edit.html.vm")) - { - fileName = StringUtils.format("{}/edit.html", htmlPath); - } else if (template.contains("sql.vm")) { fileName = businessName + "Menu.sql"; } + else if (template.contains("api.js.vm")) + { + fileName = StringUtils.format("{}/api/{}/{}.js", vuePath, moduleName, businessName); + } + else if (template.contains("index.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } + else if (template.contains("index-tree.vue.vm")) + { + fileName = StringUtils.format("{}/views/{}/{}/index.vue", vuePath, moduleName, businessName); + } return fileName; } - /** - * 获取项目文件路径 - * - * @return 路径 - */ - public static String getProjectPath() - { - String packageName = GenConfig.getPackageName(); - StringBuffer projectPath = new StringBuffer(); - projectPath.append("main/java/"); - projectPath.append(packageName.replace(".", "/")); - projectPath.append("/"); - return projectPath.toString(); - } - /** * 获取包前缀 - * + * * @param packageName 包名称 * @return 包前缀名称 */ @@ -283,8 +269,46 @@ public class VelocityUtils } /** - * 获取权限前缀 + * 根据列类型获取字典组 * + * @param genTable 业务表对象 + * @return 返回字典组 + */ + public static String getDicts(GenTable genTable) + { + List columns = genTable.getColumns(); + Set dicts = new HashSet(); + addDicts(dicts, columns); + if (StringUtils.isNotNull(genTable.getSubTable())) + { + List subColumns = genTable.getSubTable().getColumns(); + addDicts(dicts, subColumns); + } + return StringUtils.join(dicts, ", "); + } + + /** + * 添加字典列表 + * + * @param dicts 字典列表 + * @param columns 列集合 + */ + public static void addDicts(Set dicts, List columns) + { + for (GenTableColumn column : columns) + { + if (!column.isSuperColumn() && StringUtils.isNotEmpty(column.getDictType()) && StringUtils.equalsAny( + column.getHtmlType(), + new String[] { GenConstants.HTML_SELECT, GenConstants.HTML_RADIO, GenConstants.HTML_CHECKBOX })) + { + dicts.add("'" + column.getDictType() + "'"); + } + } + } + + /** + * 获取权限前缀 + * * @param moduleName 模块名称 * @param businessName 业务名称 * @return 返回权限前缀 @@ -296,7 +320,7 @@ public class VelocityUtils /** * 获取上级菜单ID字段 - * + * * @param paramsObj 生成其他选项 * @return 上级菜单ID字段 */ @@ -312,7 +336,7 @@ public class VelocityUtils /** * 获取树编码 - * + * * @param paramsObj 生成其他选项 * @return 树编码 */ @@ -327,7 +351,7 @@ public class VelocityUtils /** * 获取树父编码 - * + * * @param paramsObj 生成其他选项 * @return 树父编码 */ @@ -342,7 +366,7 @@ public class VelocityUtils /** * 获取树名称 - * + * * @param paramsObj 生成其他选项 * @return 树名称 */ @@ -357,14 +381,14 @@ public class VelocityUtils /** * 获取需要在哪一列上面显示展开按钮 - * + * * @param genTable 业务表对象 * @return 展开按钮列序号 */ public static int getExpandColumn(GenTable genTable) { String options = genTable.getOptions(); - JSONObject paramsObj = JSONObject.parseObject(options); + JSONObject paramsObj = JSON.parseObject(options); String treeName = paramsObj.getString(GenConstants.TREE_NAME); int num = 0; for (GenTableColumn column : genTable.getColumns()) diff --git a/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-generator/src/main/resources/generator.yml index 29b3dd2b5..1aeec14ef 100644 --- a/ruoyi-generator/src/main/resources/generator.yml +++ b/ruoyi-generator/src/main/resources/generator.yml @@ -1,4 +1,3 @@ - # 代码生成 gen: # 作者 diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml index cab47441a..efd0e70db 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -28,23 +28,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column - - where table_id = #{tableId} order by sort - + - + insert into gen_table_column ( table_id, @@ -88,37 +88,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" sysdate() ) - + update gen_table_column - column_comment = #{columnComment}, - java_type = #{javaType}, - java_field = #{javaField}, - is_insert = #{isInsert}, - is_edit = #{isEdit}, - is_list = #{isList}, - is_query = #{isQuery}, - is_required = #{isRequired}, - query_type = #{queryType}, - html_type = #{htmlType}, - dict_type = #{dictType}, - sort = #{sort}, - update_by = #{updateBy}, + column_comment = #{columnComment}, + java_type = #{javaType}, + java_field = #{javaField}, + is_insert = #{isInsert}, + is_edit = #{isEdit}, + is_list = #{isList}, + is_query = #{isQuery}, + is_required = #{isRequired}, + query_type = #{queryType}, + html_type = #{htmlType}, + dict_type = #{dictType}, + sort = #{sort}, + update_by = #{updateBy}, update_time = sysdate() where column_id = #{columnId} - delete from gen_table_column where table_id in + delete from gen_table_column where table_id in #{tableId} - delete from gen_table_column where column_id in + delete from gen_table_column where column_id in #{item.columnId} diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index bc7cf5277..253212efb 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table + 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 @@ -99,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html b/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html deleted file mode 100644 index fee2b3604..000000000 --- a/ruoyi-generator/src/main/resources/templates/tool/gen/edit.html +++ /dev/null @@ -1,608 +0,0 @@ - - - - - - - - -

    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - diff --git a/ruoyi-generator/src/main/resources/templates/tool/gen/gen.html b/ruoyi-generator/src/main/resources/templates/tool/gen/gen.html deleted file mode 100644 index bf980d9a2..000000000 --- a/ruoyi-generator/src/main/resources/templates/tool/gen/gen.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 表名称: -
    • -
    • - 表描述: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/templates/tool/gen/importTable.html b/ruoyi-generator/src/main/resources/templates/tool/gen/importTable.html deleted file mode 100644 index b432702f1..000000000 --- a/ruoyi-generator/src/main/resources/templates/tool/gen/importTable.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm deleted file mode 100644 index c64ccd9da..000000000 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ /dev/null @@ -1,379 +0,0 @@ - - - - -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote") - -#break -#end -#end - - -
    -
    -#if($table.sub) -

    ${functionName}信息

    -#end -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if("" != $treeParentCode && $column.javaField == $treeParentCode) -
    - -
    -
    -#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)}) -#set($treeId = "${className}?.${treeCode}") - - - -
    -
    -
    -#elseif($column.htmlType == "input") -
    - -
    - -
    -
    -#elseif($column.htmlType == "upload") -
    - -
    - -
    - -
    -
    -
    -#elseif($column.htmlType == "summernote") -
    - -
    - -
    -
    -
    -#elseif($column.htmlType == "select" && "" != $dictType) -
    - -
    - -
    -
    -#elseif($column.htmlType == "select" && $dictType) -
    - -
    - - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "checkbox" && "" != $dictType) -
    - -
    - -
    -
    -#elseif($column.htmlType == "checkbox" && $dictType) -
    - -
    - - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "radio" && "" != $dictType) -
    - -
    -
    - - -
    -
    -
    -#elseif($column.htmlType == "radio" && $dictType) -
    - -
    -
    - - -
    - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "datetime") -
    - -
    -
    - - -
    -
    -
    -#elseif($column.htmlType == "textarea") -
    - -
    - -
    -
    -#end -#end -#end -#end -#if($table.sub) -

    ${subTable.functionName}信息

    -
    -
    - - -
    -
    -
    -
    -
    -#end -
    -
    - -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote") - -#break -#end -#end - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm deleted file mode 100644 index cddfe1d68..000000000 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ /dev/null @@ -1,391 +0,0 @@ - - - - -#foreach($column in $columns) -#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote") - -#break -#end -#end - - -
    -
    -#if($table.sub) -

    ${functionName}信息

    -#end - -#foreach($column in $columns) -#if($column.edit && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($field=$column.javaField) -#set($dictType=$column.dictType) -#if("" != $treeParentCode && $column.javaField == $treeParentCode) -
    - -
    -
    -#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)}) - - - -
    -
    -
    -#elseif($column.htmlType == "input") -
    - -
    - -
    -
    -#elseif($column.htmlType == "upload") -
    - -
    - -
    - -
    -
    -
    -#elseif($column.htmlType == "summernote") -
    - -
    - -
    -
    -
    -#elseif($column.htmlType == "select" && "" != $dictType) -
    - -
    - -
    -
    -#elseif($column.htmlType == "select" && $dictType) -
    - -
    - - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "checkbox" && "" != $dictType) -
    - -
    - -
    -
    -#elseif($column.htmlType == "checkbox" && $dictType) -
    - -
    - - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "radio" && "" != $dictType) -
    - -
    -
    - - -
    -
    -
    -#elseif($column.htmlType == "radio" && $dictType) -
    - -
    -
    - - -
    - 代码生成请选择字典属性 -
    -
    -#elseif($column.htmlType == "datetime") -
    - -
    -
    - - -
    -
    -
    -#elseif($column.htmlType == "textarea") -
    - -
    - -
    -
    -#end -#end -#end -#end -#if($table.sub) -

    ${subTable.functionName}信息

    -
    -
    - - -
    -
    -
    -
    -
    -#end -
    -
    - -#foreach($column in $columns) -#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload") - -#break -#end -#end -#foreach($column in $columns) -#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote") - -#break -#end -#end - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm b/ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm deleted file mode 100644 index dcb91e83c..000000000 --- a/ruoyi-generator/src/main/resources/vm/html/list-tree.html.vm +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") -
    • - - -
    • -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) -
    • - - -
    • -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) -
    • - - -
    • -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") -
    • - - -
    • -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -
    • - - - - - -
    • -#end -#end -#end -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/html/list.html.vm b/ruoyi-generator/src/main/resources/vm/html/list.html.vm deleted file mode 100644 index a7021a371..000000000 --- a/ruoyi-generator/src/main/resources/vm/html/list.html.vm +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") -
    • - - -
    • -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) -
    • - - -
    • -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) -
    • - - -
    • -#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") -
    • - - -
    • -#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") -
    • - - - - - -
    • -#end -#end -#end -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/html/tree.html.vm b/ruoyi-generator/src/main/resources/vm/html/tree.html.vm deleted file mode 100644 index 128dad955..000000000 --- a/ruoyi-generator/src/main/resources/vm/html/tree.html.vm +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - -#set($treeId = "${className}?." + $treeCode) -#set($treeName = "${className}?." + $treeName) - - -
    - - -
    - -
    - 展开 / - 折叠 -
    -
    -
    - - - - - \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm index 8ce683e50..41c72ad71 100644 --- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm @@ -1,27 +1,27 @@ package ${packageName}.controller; import java.util.List; -import org.apache.shiro.authz.annotation.RequiresPermissions; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import ${packageName}.domain.${ClassName}; import ${packageName}.service.I${ClassName}Service; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; #if($table.crud || $table.sub) import com.ruoyi.common.core.page.TableDataInfo; #elseif($table.tree) -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.core.domain.Ztree; #end /** @@ -30,29 +30,19 @@ import com.ruoyi.common.core.domain.Ztree; * @author ${author} * @date ${datetime} */ -@Controller +@RestController @RequestMapping("/${moduleName}/${businessName}") public class ${ClassName}Controller extends BaseController { - private String prefix = "${moduleName}/${businessName}"; - @Autowired private I${ClassName}Service ${className}Service; - @RequiresPermissions("${permissionPrefix}:view") - @GetMapping() - public String ${businessName}() - { - return prefix + "/${businessName}"; - } - -#if($table.crud || $table.sub) /** * 查询${functionName}列表 */ - @RequiresPermissions("${permissionPrefix}:list") - @PostMapping("/list") - @ResponseBody + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") + @GetMapping("/list") +#if($table.crud || $table.sub) public TableDataInfo list(${ClassName} ${className}) { startPage(); @@ -60,65 +50,43 @@ public class ${ClassName}Controller extends BaseController return getDataTable(list); } #elseif($table.tree) - /** - * 查询${functionName}树列表 - */ - @RequiresPermissions("${permissionPrefix}:list") - @PostMapping("/list") - @ResponseBody - public List<${ClassName}> list(${ClassName} ${className}) + public AjaxResult list(${ClassName} ${className}) { List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return list; + return success(list); } #end /** * 导出${functionName}列表 */ - @RequiresPermissions("${permissionPrefix}:export") + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") @Log(title = "${functionName}", businessType = BusinessType.EXPORT) @PostMapping("/export") - @ResponseBody - public AjaxResult export(${ClassName} ${className}) + public void export(HttpServletResponse response, ${ClassName} ${className}) { List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); - return util.exportExcel(list, "${functionName}数据"); + util.exportExcel(response, list, "${functionName}数据"); + } + + /** + * 获取${functionName}详细信息 + */ + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") + @GetMapping(value = "/{${pkColumn.javaField}}") + public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) + { + return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); } -#if($table.crud || $table.sub) /** * 新增${functionName} */ - @GetMapping("/add") - public String add() - { - return prefix + "/add"; - } -#elseif($table.tree) - /** - * 新增${functionName} - */ - @GetMapping(value = { "/add/{${pkColumn.javaField}}", "/add/" }) - public String add(@PathVariable(value = "${pkColumn.javaField}", required = false) Long ${pkColumn.javaField}, ModelMap mmap) - { - if (StringUtils.isNotNull(${pkColumn.javaField})) - { - mmap.put("${className}", ${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); - } - return prefix + "/add"; - } -#end - - /** - * 新增保存${functionName} - */ - @RequiresPermissions("${permissionPrefix}:add") + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") @Log(title = "${functionName}", businessType = BusinessType.INSERT) - @PostMapping("/add") - @ResponseBody - public AjaxResult addSave(${ClassName} ${className}) + @PostMapping + public AjaxResult add(@RequestBody ${ClassName} ${className}) { return toAjax(${className}Service.insert${ClassName}(${className})); } @@ -126,77 +94,22 @@ public class ${ClassName}Controller extends BaseController /** * 修改${functionName} */ - @RequiresPermissions("${permissionPrefix}:edit") - @GetMapping("/edit/{${pkColumn.javaField}}") - public String edit(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}, ModelMap mmap) - { - ${ClassName} ${className} = ${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); - mmap.put("${className}", ${className}); - return prefix + "/edit"; - } - - /** - * 修改保存${functionName} - */ - @RequiresPermissions("${permissionPrefix}:edit") + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") @Log(title = "${functionName}", businessType = BusinessType.UPDATE) - @PostMapping("/edit") - @ResponseBody - public AjaxResult editSave(${ClassName} ${className}) + @PutMapping + public AjaxResult edit(@RequestBody ${ClassName} ${className}) { return toAjax(${className}Service.update${ClassName}(${className})); } -#if($table.crud || $table.sub) /** * 删除${functionName} */ - @RequiresPermissions("${permissionPrefix}:remove") + @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @PostMapping( "/remove") - @ResponseBody - public AjaxResult remove(String ids) + @DeleteMapping("/{${pkColumn.javaField}s}") + public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { - return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(ids)); + return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s)); } -#elseif($table.tree) - /** - * 删除 - */ - @RequiresPermissions("${permissionPrefix}:remove") - @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @GetMapping("/remove/{${pkColumn.javaField}}") - @ResponseBody - public AjaxResult remove(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) - { - return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); - } -#end -#if($table.tree) - - /** - * 选择${functionName}树 - */ -#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)}) - @GetMapping(value = { "/select${BusinessName}Tree/{${pkColumn.javaField}}", "/select${BusinessName}Tree/" }) - public String select${BusinessName}Tree(@PathVariable(value = "${pkColumn.javaField}", required = false) Long ${pkColumn.javaField}, ModelMap mmap) - { - if (StringUtils.isNotNull(${pkColumn.javaField})) - { - mmap.put("${className}", ${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField})); - } - return prefix + "/tree"; - } - - /** - * 加载${functionName}树列表 - */ - @GetMapping("/treeData") - @ResponseBody - public List treeData() - { - List ztrees = ${className}Service.select${ClassName}Tree(); - return ztrees; - } -#end } diff --git a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm index f8e1bf3fa..6f0317905 100644 --- a/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/mapper.java.vm @@ -60,7 +60,7 @@ public interface ${ClassName}Mapper * @param ${pkColumn.javaField}s 需要删除的数据主键集合 * @return 结果 */ - public int delete${ClassName}By${pkColumn.capJavaField}s(String[] ${pkColumn.javaField}s); + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); #if($table.sub) /** @@ -69,7 +69,7 @@ public interface ${ClassName}Mapper * @param ${pkColumn.javaField}s 需要删除的数据主键集合 * @return 结果 */ - public int delete${subClassName}By${subTableFkClassName}s(String[] ${pkColumn.javaField}s); + public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); /** * 批量新增${subTable.functionName} diff --git a/ruoyi-generator/src/main/resources/vm/java/service.java.vm b/ruoyi-generator/src/main/resources/vm/java/service.java.vm index c30ec41ca..250f68c8c 100644 --- a/ruoyi-generator/src/main/resources/vm/java/service.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/service.java.vm @@ -2,9 +2,6 @@ package ${packageName}.service; import java.util.List; import ${packageName}.domain.${ClassName}; -#if($table.tree) -import com.ruoyi.common.core.domain.Ztree; -#end /** * ${functionName}Service接口 @@ -52,7 +49,7 @@ public interface I${ClassName}Service * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合 * @return 结果 */ - public int delete${ClassName}By${pkColumn.capJavaField}s(String ${pkColumn.javaField}s); + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); /** * 删除${functionName}信息 @@ -61,13 +58,4 @@ public interface I${ClassName}Service * @return 结果 */ public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); -#if($table.tree) - - /** - * 查询${functionName}树列表 - * - * @return 所有${functionName}信息 - */ - public List select${ClassName}Tree(); -#end } diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index 53d12d7b6..116f6c544 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -1,10 +1,6 @@ package ${packageName}.service.impl; import java.util.List; -#if($table.tree) -import java.util.ArrayList; -import com.ruoyi.common.core.domain.Ztree; -#end #foreach ($column in $columns) #if($column.javaField == 'createTime' || $column.javaField == 'updateTime') import com.ruoyi.common.utils.DateUtils; @@ -22,7 +18,6 @@ import ${packageName}.domain.${subClassName}; import ${packageName}.mapper.${ClassName}Mapper; import ${packageName}.domain.${ClassName}; import ${packageName}.service.I${ClassName}Service; -import com.ruoyi.common.core.text.Convert; /** * ${functionName}Service业务层处理 @@ -120,12 +115,12 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service @Transactional #end @Override - public int delete${ClassName}By${pkColumn.capJavaField}s(String ${pkColumn.javaField}s) + public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) { #if($table.sub) - ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(Convert.toStrArray(${pkColumn.javaField}s)); + ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); #end - return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(Convert.toStrArray(${pkColumn.javaField}s)); + return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); } /** @@ -145,45 +140,6 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service #end return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); } -#if($table.tree) - - /** - * 查询${functionName}树列表 - * - * @return 所有${functionName}信息 - */ - @Override - public List select${ClassName}Tree() - { - List<${ClassName}> ${className}List = ${className}Mapper.select${ClassName}List(new ${ClassName}()); - List ztrees = new ArrayList(); - for (${ClassName} ${className} : ${className}List) - { - Ztree ztree = new Ztree(); -#if($treeCode.length() > 2 && $treeCode.substring(1,2).matches("[A-Z]")) -#set($TreeCode=$treeCode) -#else -#set($TreeCode=$treeCode.substring(0,1).toUpperCase() + ${treeCode.substring(1)}) -#end -#if($treeParentCode.length() > 2 && $treeParentCode.substring(1,2).matches("[A-Z]")) -#set($TreeParentCode=$treeParentCode) -#else -#set($TreeParentCode=$treeParentCode.substring(0,1).toUpperCase() + ${treeParentCode.substring(1)}) -#end -#if($treeName.length() > 2 && $treeName.substring(1,2).matches("[A-Z]")) -#set($TreeName=$treeName) -#else -#set($TreeName=$treeName.substring(0,1).toUpperCase() + ${treeName.substring(1)}) -#end - ztree.setId(${className}.get${TreeCode}()); - ztree.setpId(${className}.get${TreeParentCode}()); - ztree.setName(${className}.get${TreeName}()); - ztree.setTitle(${className}.get${TreeName}()); - ztrees.add(ztree); - } - return ztrees; - } -#end #if($table.sub) /** diff --git a/ruoyi-generator/src/main/resources/vm/js/api.js.vm b/ruoyi-generator/src/main/resources/vm/js/api.js.vm new file mode 100644 index 000000000..9295524a4 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/js/api.js.vm @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询${functionName}列表 +export function list${BusinessName}(query) { + return request({ + url: '/${moduleName}/${businessName}/list', + method: 'get', + params: query + }) +} + +// 查询${functionName}详细 +export function get${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'get' + }) +} + +// 新增${functionName} +export function add${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'post', + data: data + }) +} + +// 修改${functionName} +export function update${BusinessName}(data) { + return request({ + url: '/${moduleName}/${businessName}', + method: 'put', + data: data + }) +} + +// 删除${functionName} +export function del${BusinessName}(${pkColumn.javaField}) { + return request({ + url: '/${moduleName}/${businessName}/' + ${pkColumn.javaField}, + method: 'delete' + }) +} diff --git a/ruoyi-generator/src/main/resources/vm/sql/sql.vm b/ruoyi-generator/src/main/resources/vm/sql/sql.vm index 8124cd27a..b50ef2155 100644 --- a/ruoyi-generator/src/main/resources/vm/sql/sql.vm +++ b/ruoyi-generator/src/main/resources/vm/sql/sql.vm @@ -1,22 +1,22 @@ -- 菜单 SQL -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}', '${parentMenuId}', '1', '/${moduleName}/${businessName}', 'C', '0', '${permissionPrefix}:view', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}', '${parentMenuId}', '1', '${businessName}', '${moduleName}/${businessName}/index', 1, 0, 'C', '0', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, '${functionName}菜单'); -- 按钮父菜单ID SELECT @parentId := LAST_INSERT_ID(); -- 按钮 SQL -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}查询', @parentId, '1', '#', 'F', '0', '${permissionPrefix}:list', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:query', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}新增', @parentId, '2', '#', 'F', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}修改', @parentId, '3', '#', 'F', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}删除', @parentId, '4', '#', 'F', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark) -values('${functionName}导出', @parentId, '5', '#', 'F', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) +values('${functionName}导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', '${permissionPrefix}:export', '#', 'admin', sysdate(), '', null, ''); \ No newline at end of file diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm new file mode 100644 index 000000000..4819c2a9f --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -0,0 +1,505 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm new file mode 100644 index 000000000..6296014bc --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -0,0 +1,602 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm new file mode 100644 index 000000000..c54d62bf9 --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -0,0 +1,474 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm new file mode 100644 index 000000000..8b25665aa --- /dev/null +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -0,0 +1,590 @@ + + + diff --git a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm index 1366ade0c..5b704e737 100644 --- a/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm +++ b/ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm @@ -7,9 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #foreach ($column in $columns) -#end -#if($table.tree) - #end #if($table.sub) @@ -59,20 +56,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #end #end -#if($table.tree) - order by ${tree_parent_code} -#end -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - Bean调用示例:ryTask.ryParams('ry') - Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry') - 参数说明:支持字符串,布尔类型,长整型,浮点型,整型 -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    - - - - - - diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html deleted file mode 100644 index e15ed941d..000000000 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/cron.html +++ /dev/null @@ -1,1172 +0,0 @@ - - - - - - Cron表达式在线生成 - - - - -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -

    表达式

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    分钟小时星期
    表达式字段
    Cron 表达式
    -
    - - - -
    -
    -
    -
    - - - - - - - - - diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html deleted file mode 100644 index 7fd3f9413..000000000 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    默认策略
    -
    立即执行
    -
    执行一次
    -
    放弃执行
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    - - \ No newline at end of file diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html deleted file mode 100644 index 208cbf678..000000000 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - -
    -
    - - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - Bean调用示例:ryTask.ryParams('ry') - Class类调用示例:com.ruoyi.quartz.task.RyTask.ryParams('ry') - 参数说明:支持字符串,布尔类型,长整型,浮点型,整型 -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - - - diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html deleted file mode 100644 index ca619254e..000000000 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 任务名称: -
    • -
    • - 任务分组: -
    • -
    • - 任务状态: -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html deleted file mode 100644 index 7f953b2b6..000000000 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - -
    -
    -
    -
    -
    -
      -
    • - 任务名称: -
    • -
    • - 任务分组: -
    • -
    • - 执行状态: -
    • -
    • - - - - - -
    • -
    • -  搜索 -  重置 -
    • -
    -
    -
    -
    - - - -
    -
    -
    -
    -
    - - - - \ No newline at end of file diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index a583118a5..2ae39ab53 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -5,7 +5,7 @@ ruoyi com.ruoyi - 4.7.8 + 3.8.7 4.0.0 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java new file mode 100644 index 000000000..83f0703a0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysCache.java @@ -0,0 +1,81 @@ +package com.ruoyi.system.domain; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 缓存信息 + * + * @author ruoyi + */ +public class SysCache +{ + /** 缓存名称 */ + private String cacheName = ""; + + /** 缓存键名 */ + private String cacheKey = ""; + + /** 缓存内容 */ + private String cacheValue = ""; + + /** 备注 */ + private String remark = ""; + + public SysCache() + { + + } + + public SysCache(String cacheName, String remark) + { + this.cacheName = cacheName; + this.remark = remark; + } + + public SysCache(String cacheName, String cacheKey, String cacheValue) + { + this.cacheName = StringUtils.replace(cacheName, ":", ""); + this.cacheKey = StringUtils.replace(cacheKey, cacheName, ""); + this.cacheValue = cacheValue; + } + + public String getCacheName() + { + return cacheName; + } + + public void setCacheName(String cacheName) + { + this.cacheName = cacheName; + } + + public String getCacheKey() + { + return cacheKey; + } + + public void setCacheKey(String cacheKey) + { + this.cacheKey = cacheKey; + } + + public String getCacheValue() + { + return cacheValue; + } + + public void setCacheValue(String cacheValue) + { + this.cacheValue = cacheValue; + } + + public String getRemark() + { + return remark; + } + + public void setRemark(String remark) + { + this.remark = remark; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index da884de81..676a8916b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -1,6 +1,7 @@ package com.ruoyi.system.domain; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -91,7 +92,7 @@ public class SysConfig extends BaseEntity { this.configType = configType; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java index cf79d99d2..02a7fb5c0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java @@ -1,8 +1,7 @@ package com.ruoyi.system.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.core.domain.BaseEntity; @@ -22,7 +21,7 @@ public class SysLogininfor extends BaseEntity /** 用户账号 */ @Excel(name = "用户账号") - private String loginName; + private String userName; /** 登录状态 0成功 1失败 */ @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") @@ -49,6 +48,7 @@ public class SysLogininfor extends BaseEntity private String msg; /** 访问时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date loginTime; @@ -62,14 +62,14 @@ public class SysLogininfor extends BaseEntity this.infoId = infoId; } - public String getLoginName() + public String getUserName() { - return loginName; + return userName; } - public void setLoginName(String loginName) + public void setUserName(String userName) { - this.loginName = loginName; + this.userName = userName; } public String getStatus() @@ -141,19 +141,4 @@ public class SysLogininfor extends BaseEntity { this.loginTime = loginTime; } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("infoId", getInfoId()) - .append("loginName", getLoginName()) - .append("ipaddr", getIpaddr()) - .append("loginLocation", getLoginLocation()) - .append("browser", getBrowser()) - .append("os", getOs()) - .append("status", getStatus()) - .append("msg", getMsg()) - .append("loginTime", getLoginTime()) - .toString(); - } -} \ No newline at end of file +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 7896152cf..7286573e6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -1,8 +1,7 @@ package com.ruoyi.system.domain; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.ColumnType; import com.ruoyi.common.core.domain.BaseEntity; @@ -80,6 +79,7 @@ public class SysOperLog extends BaseEntity private String errorMsg; /** 操作时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date operTime; @@ -266,27 +266,4 @@ public class SysOperLog extends BaseEntity { this.costTime = costTime; } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("operId", getOperId()) - .append("title", getTitle()) - .append("businessType", getBusinessType()) - .append("businessTypes", getBusinessTypes()) - .append("method", getMethod()) - .append("requestMethod", getRequestMethod()) - .append("operatorType", getOperatorType()) - .append("operName", getOperName()) - .append("deptName", getDeptName()) - .append("operUrl", getOperUrl()) - .append("operIp", getOperIp()) - .append("operLocation", getOperLocation()) - .append("operParam", getOperParam()) - .append("status", getStatus()) - .append("errorMsg", getErrorMsg()) - .append("operTime", getOperTime()) - .append("costTime", getCostTime()) - .toString(); - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index 7a2cb2bad..a36ed791d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -1,6 +1,8 @@ package com.ruoyi.system.domain; -import javax.validation.constraints.*; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -29,8 +31,8 @@ public class SysPost extends BaseEntity private String postName; /** 岗位排序 */ - @Excel(name = "岗位排序", cellType = ColumnType.NUMERIC) - private String postSort; + @Excel(name = "岗位排序") + private Integer postSort; /** 状态(0正常 1停用) */ @Excel(name = "状态", readConverterExp = "0=正常,1=停用") @@ -73,13 +75,13 @@ public class SysPost extends BaseEntity this.postName = postName; } - @NotBlank(message = "显示顺序不能为空") - public String getPostSort() + @NotNull(message = "显示顺序不能为空") + public Integer getPostSort() { return postSort; } - public void setPostSort(String postSort) + public void setPostSort(Integer postSort) { this.postSort = postSort; } @@ -103,7 +105,7 @@ public class SysPost extends BaseEntity { this.flag = flag; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java index c5467bb66..e1495aaa7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java @@ -1,28 +1,20 @@ package com.ruoyi.system.domain; -import java.util.Date; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.domain.BaseEntity; -import com.ruoyi.common.enums.OnlineStatus; - /** - * 当前在线会话 sys_user_online + * 当前在线会话 * * @author ruoyi */ -public class SysUserOnline extends BaseEntity +public class SysUserOnline { - private static final long serialVersionUID = 1L; - - /** 用户会话id */ - private String sessionId; + /** 会话编号 */ + private String tokenId; /** 部门名称 */ private String deptName; - /** 登录名称 */ - private String loginName; + /** 用户名称 */ + private String userName; /** 登录IP地址 */ private String ipaddr; @@ -36,26 +28,17 @@ public class SysUserOnline extends BaseEntity /** 操作系统 */ private String os; - /** session创建时间 */ - private Date startTimestamp; + /** 登录时间 */ + private Long loginTime; - /** session最后访问时间 */ - private Date lastAccessTime; - - /** 超时时间,单位为分钟 */ - private Long expireTime; - - /** 在线状态 */ - private OnlineStatus status = OnlineStatus.on_line; - - public String getSessionId() + public String getTokenId() { - return sessionId; + return tokenId; } - public void setSessionId(String sessionId) + public void setTokenId(String tokenId) { - this.sessionId = sessionId; + this.tokenId = tokenId; } public String getDeptName() @@ -68,14 +51,14 @@ public class SysUserOnline extends BaseEntity this.deptName = deptName; } - public String getLoginName() + public String getUserName() { - return loginName; + return userName; } - public void setLoginName(String loginName) + public void setUserName(String userName) { - this.loginName = loginName; + this.userName = userName; } public String getIpaddr() @@ -118,60 +101,13 @@ public class SysUserOnline extends BaseEntity this.os = os; } - public Date getStartTimestamp() + public Long getLoginTime() { - return startTimestamp; + return loginTime; } - public void setStartTimestamp(Date startTimestamp) + public void setLoginTime(Long loginTime) { - this.startTimestamp = startTimestamp; - } - - public Date getLastAccessTime() - { - return lastAccessTime; - } - - public void setLastAccessTime(Date lastAccessTime) - { - this.lastAccessTime = lastAccessTime; - } - - public Long getExpireTime() - { - return expireTime; - } - - public void setExpireTime(Long expireTime) - { - this.expireTime = expireTime; - } - - public OnlineStatus getStatus() - { - return status; - } - - public void setStatus(OnlineStatus status) - { - this.status = status; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("sessionId", getSessionId()) - .append("loginName", getLoginName()) - .append("deptName", getDeptName()) - .append("ipaddr", getIpaddr()) - .append("loginLocation", getLoginLocation()) - .append("browser", getBrowser()) - .append("os", getOs()) - .append("status", getStatus()) - .append("startTimestamp", getStartTimestamp()) - .append("lastAccessTime", getLastAccessTime()) - .append("expireTime", getExpireTime()) - .toString(); + this.loginTime = loginTime; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java new file mode 100644 index 000000000..a5d5fdccb --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java @@ -0,0 +1,106 @@ +package com.ruoyi.system.domain.vo; + +import com.ruoyi.common.utils.StringUtils; + +/** + * 路由显示信息 + * + * @author ruoyi + */ +public class MetaVo +{ + /** + * 设置该路由在侧边栏和面包屑中展示的名字 + */ + private String title; + + /** + * 设置该路由的图标,对应路径src/assets/icons/svg + */ + private String icon; + + /** + * 设置为true,则不会被 缓存 + */ + private boolean noCache; + + /** + * 内链地址(http(s)://开头) + */ + private String link; + + public MetaVo() + { + } + + public MetaVo(String title, String icon) + { + this.title = title; + this.icon = icon; + } + + public MetaVo(String title, String icon, boolean noCache) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + } + + public MetaVo(String title, String icon, String link) + { + this.title = title; + this.icon = icon; + this.link = link; + } + + public MetaVo(String title, String icon, boolean noCache, String link) + { + this.title = title; + this.icon = icon; + this.noCache = noCache; + if (StringUtils.ishttp(link)) + { + this.link = link; + } + } + + public boolean isNoCache() + { + return noCache; + } + + public void setNoCache(boolean noCache) + { + this.noCache = noCache; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public String getLink() + { + return link; + } + + public void setLink(String link) + { + this.link = link; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java new file mode 100644 index 000000000..afff8c9c5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/RouterVo.java @@ -0,0 +1,148 @@ +package com.ruoyi.system.domain.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +/** + * 路由配置信息 + * + * @author ruoyi + */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class RouterVo +{ + /** + * 路由名字 + */ + private String name; + + /** + * 路由地址 + */ + private String path; + + /** + * 是否隐藏路由,当设置 true 的时候该路由不会再侧边栏出现 + */ + private boolean hidden; + + /** + * 重定向地址,当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + */ + private String redirect; + + /** + * 组件地址 + */ + private String component; + + /** + * 路由参数:如 {"id": 1, "name": "ry"} + */ + private String query; + + /** + * 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + */ + private Boolean alwaysShow; + + /** + * 其他元素 + */ + private MetaVo meta; + + /** + * 子路由 + */ + private List children; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getPath() + { + return path; + } + + public void setPath(String path) + { + this.path = path; + } + + public boolean getHidden() + { + return hidden; + } + + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } + + public String getRedirect() + { + return redirect; + } + + public void setRedirect(String redirect) + { + this.redirect = redirect; + } + + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public Boolean getAlwaysShow() + { + return alwaysShow; + } + + public void setAlwaysShow(Boolean alwaysShow) + { + this.alwaysShow = alwaysShow; + } + + public MetaVo getMeta() + { + return meta; + } + + public void setMeta(MetaVo meta) + { + this.meta = meta; + } + + public List getChildren() + { + return children; + } + + public void setChildren(List children) + { + this.children = children; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java index b50c1a3ed..999995d7e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysConfigMapper.java @@ -61,16 +61,16 @@ public interface SysConfigMapper /** * 删除参数配置 * - * @param configId 参数主键 + * @param configId 参数ID * @return 结果 */ public int deleteConfigById(Long configId); /** - * 批量删除参数配置 + * 批量删除参数信息 * - * @param configIds 需要删除的数据ID + * @param configIds 需要删除的参数ID * @return 结果 */ - public int deleteConfigByIds(String[] configIds); -} \ No newline at end of file + public int deleteConfigByIds(Long[] configIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java index 92514f27f..f3b58474e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDeptMapper.java @@ -12,12 +12,53 @@ import com.ruoyi.common.core.domain.entity.SysDept; public interface SysDeptMapper { /** - * 查询下级部门数量 + * 查询部门管理数据 * * @param dept 部门信息 + * @return 部门信息集合 + */ + public List selectDeptList(SysDept dept); + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @param deptCheckStrictly 部门树选择项是否关联显示 + * @return 选中部门列表 + */ + public List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + public SysDept selectDeptById(Long deptId); + + /** + * 根据ID查询所有子部门 + * + * @param deptId 部门ID + * @return 部门列表 + */ + public List selectChildrenDeptById(Long deptId); + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + public int selectNormalChildrenDeptById(Long deptId); + + /** + * 是否存在子节点 + * + * @param deptId 部门ID * @return 结果 */ - public int selectDeptCount(SysDept dept); + public int hasChildByDeptId(Long deptId); /** * 查询部门是否存在用户 @@ -28,20 +69,13 @@ public interface SysDeptMapper public int checkDeptExistUser(Long deptId); /** - * 查询部门管理数据 + * 校验部门名称是否唯一 * - * @param dept 部门信息 - * @return 部门信息集合 - */ - public List selectDeptList(SysDept dept); - - /** - * 删除部门管理信息 - * - * @param deptId 部门ID + * @param deptName 部门名称 + * @param parentId 父部门ID * @return 结果 */ - public int deleteDeptById(Long deptId); + public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); /** * 新增部门信息 @@ -59,6 +93,13 @@ public interface SysDeptMapper */ public int updateDept(SysDept dept); + /** + * 修改所在部门正常状态 + * + * @param deptIds 部门ID组 + */ + public void updateDeptStatusNormal(Long[] deptIds); + /** * 修改子元素关系 * @@ -68,50 +109,10 @@ public interface SysDeptMapper public int updateDeptChildren(@Param("depts") List depts); /** - * 根据部门ID查询信息 + * 删除部门管理信息 * * @param deptId 部门ID - * @return 部门信息 - */ - public SysDept selectDeptById(Long deptId); - - /** - * 校验部门名称是否唯一 - * - * @param deptName 部门名称 - * @param parentId 父部门ID * @return 结果 */ - public SysDept checkDeptNameUnique(@Param("deptName") String deptName, @Param("parentId") Long parentId); - - /** - * 根据角色ID查询部门 - * - * @param roleId 角色ID - * @return 部门列表 - */ - public List selectRoleDeptTree(Long roleId); - - /** - * 修改所在部门正常状态 - * - * @param deptIds 部门ID组 - */ - public void updateDeptStatusNormal(Long[] deptIds); - - /** - * 根据ID查询所有子部门 - * - * @param deptId 部门ID - * @return 部门列表 - */ - public List selectChildrenDeptById(Long deptId); - - /** - * 根据ID查询所有子部门(正常状态) - * - * @param deptId 部门ID - * @return 子部门数 - */ - public int selectNormalChildrenDeptById(Long deptId); + public int deleteDeptById(Long deptId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java index e9653a25c..92f799e55 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictDataMapper.java @@ -61,12 +61,12 @@ public interface SysDictDataMapper public int deleteDictDataById(Long dictCode); /** - * 批量删除字典数据 + * 批量删除字典数据信息 * - * @param ids 需要删除的数据 + * @param dictCodes 需要删除的字典数据ID * @return 结果 */ - public int deleteDictDataByIds(String[] ids); + public int deleteDictDataByIds(Long[] dictCodes); /** * 新增字典数据信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java index f8c07b726..132a72ed6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java @@ -50,12 +50,12 @@ public interface SysDictTypeMapper public int deleteDictTypeById(Long dictId); /** - * 批量删除字典类型 + * 批量删除字典类型信息 * - * @param ids 需要删除的数据 + * @param dictIds 需要删除的字典ID * @return 结果 */ - public int deleteDictTypeByIds(Long[] ids); + public int deleteDictTypeByIds(Long[] dictIds); /** * 新增字典类型信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java index 0efe3d7e8..480dd9ff6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysLogininforMapper.java @@ -28,10 +28,10 @@ public interface SysLogininforMapper /** * 批量删除系统登录日志 * - * @param ids 需要删除的数据 + * @param infoIds 需要删除的登录日志ID * @return 结果 */ - public int deleteLogininforByIds(String[] ids); + public int deleteLogininforByIds(Long[] infoIds); /** * 清空系统登录日志 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java index 1b7d4bff6..f3e2eb9eb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysMenuMapper.java @@ -6,48 +6,33 @@ import com.ruoyi.common.core.domain.entity.SysMenu; /** * 菜单表 数据层 - * + * * @author ruoyi */ public interface SysMenuMapper { /** - * 查询系统所有菜单(含按钮) - * + * 查询系统菜单列表 + * + * @param menu 菜单信息 * @return 菜单列表 */ - public List selectMenuAll(); + public List selectMenuList(SysMenu menu); /** - * 根据用户ID查询菜单 - * - * @param userId 用户ID - * @return 菜单列表 - */ - public List selectMenuAllByUserId(Long userId); - - /** - * 查询系统正常显示菜单(不含按钮) - * - * @return 菜单列表 - */ - public List selectMenuNormalAll(); - - /** - * 根据用户ID查询菜单 - * - * @param userId 用户ID - * @return 菜单列表 - */ - public List selectMenusByUserId(Long userId); - - /** - * 根据用户ID查询权限 - * - * @param userId 用户ID + * 根据用户所有权限 + * * @return 权限列表 */ - public List selectPermsByUserId(Long userId); + public List selectMenuPerms(); + + /** + * 根据用户查询系统菜单列表 + * + * @param menu 菜单信息 + * @return 菜单列表 + */ + public List selectMenuListByUserId(SysMenu menu); /** * 根据角色ID查询权限 @@ -55,59 +40,59 @@ public interface SysMenuMapper * @param roleId 角色ID * @return 权限列表 */ - public List selectPermsByRoleId(Long roleId); + public List selectMenuPermsByRoleId(Long roleId); /** - * 根据角色ID查询菜单 + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + public List selectMenuPermsByUserId(Long userId); + + /** + * 根据用户ID查询菜单 + * + * @return 菜单列表 + */ + public List selectMenuTreeAll(); + + /** + * 根据用户ID查询菜单 + * + * @param userId 用户ID + * @return 菜单列表 + */ + public List selectMenuTreeByUserId(Long userId); + + /** + * 根据角色ID查询菜单树信息 * * @param roleId 角色ID - * @return 菜单列表 + * @param menuCheckStrictly 菜单树选择项是否关联显示 + * @return 选中菜单列表 */ - public List selectMenuTree(Long roleId); - - /** - * 查询系统菜单列表 - * - * @param menu 菜单信息 - * @return 菜单列表 - */ - public List selectMenuList(SysMenu menu); - - /** - * 查询系统菜单列表 - * - * @param menu 菜单信息 - * @return 菜单列表 - */ - public List selectMenuListByUserId(SysMenu menu); - - /** - * 删除菜单管理信息 - * - * @param menuId 菜单ID - * @return 结果 - */ - public int deleteMenuById(Long menuId); + public List selectMenuListByRoleId(@Param("roleId") Long roleId, @Param("menuCheckStrictly") boolean menuCheckStrictly); /** * 根据菜单ID查询信息 - * + * * @param menuId 菜单ID * @return 菜单信息 */ public SysMenu selectMenuById(Long menuId); /** - * 查询菜单数量 - * - * @param parentId 菜单父ID + * 是否存在菜单子节点 + * + * @param menuId 菜单ID * @return 结果 */ - public int selectCountMenuByParentId(Long parentId); + public int hasChildByMenuId(Long menuId); /** * 新增菜单信息 - * + * * @param menu 菜单信息 * @return 结果 */ @@ -115,15 +100,23 @@ public interface SysMenuMapper /** * 修改菜单信息 - * + * * @param menu 菜单信息 * @return 结果 */ public int updateMenu(SysMenu menu); + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + /** * 校验菜单名称是否唯一 - * + * * @param menuName 菜单名称 * @param parentId 父菜单ID * @return 结果 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java index 1ce1d8cde..cc267ac0c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysNoticeMapper.java @@ -4,7 +4,7 @@ import java.util.List; import com.ruoyi.system.domain.SysNotice; /** - * 公告 数据层 + * 通知公告表 数据层 * * @author ruoyi */ @@ -45,8 +45,16 @@ public interface SysNoticeMapper /** * 批量删除公告 * - * @param noticeIds 需要删除的数据ID + * @param noticeId 公告ID * @return 结果 */ - public int deleteNoticeByIds(String[] noticeIds); -} \ No newline at end of file + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java index 98ca5d130..3bf69bb8e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysOperLogMapper.java @@ -24,15 +24,15 @@ public interface SysOperLogMapper * @return 操作日志集合 */ public List selectOperLogList(SysOperLog operLog); - + /** * 批量删除系统操作日志 * - * @param ids 需要删除的数据 + * @param operIds 需要删除的操作日志ID * @return 结果 */ - public int deleteOperLogByIds(String[] ids); - + public int deleteOperLogByIds(Long[] operIds); + /** * 查询操作日志详细 * @@ -40,7 +40,7 @@ public interface SysOperLogMapper * @return 操作日志对象 */ public SysOperLog selectOperLogById(Long operId); - + /** * 清空操作日志 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java index a4aab595b..8603d9aea 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java @@ -25,14 +25,6 @@ public interface SysPostMapper */ public List selectPostAll(); - /** - * 根据用户ID查询岗位 - * - * @param userId 用户ID - * @return 岗位列表 - */ - public List selectPostsByUserId(Long userId); - /** * 通过岗位ID查询岗位信息 * @@ -42,12 +34,36 @@ public interface SysPostMapper public SysPost selectPostById(Long postId); /** - * 批量删除岗位信息 + * 根据用户ID获取岗位选择框列表 * - * @param ids 需要删除的数据ID + * @param userId 用户ID + * @return 选中岗位ID列表 + */ + public List selectPostListByUserId(Long userId); + + /** + * 查询用户所属岗位组 + * + * @param userName 用户名 * @return 结果 */ - public int deletePostByIds(Long[] ids); + public List selectPostsByUserName(String userName); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); /** * 修改岗位信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java index cf7f08614..58ede18e0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMapper.java @@ -24,7 +24,22 @@ public interface SysRoleMapper * @param userId 用户ID * @return 角色列表 */ - public List selectRolesByUserId(Long userId); + public List selectRolePermissionByUserId(Long userId); + + /** + * 查询所有角色 + * + * @return 角色列表 + */ + public List selectRoleAll(); + + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); /** * 通过角色ID查询角色 @@ -35,20 +50,28 @@ public interface SysRoleMapper public SysRole selectRoleById(Long roleId); /** - * 通过角色ID删除角色 + * 根据用户ID查询角色 * - * @param roleId 角色ID - * @return 结果 + * @param userName 用户名 + * @return 角色列表 */ - public int deleteRoleById(Long roleId); + public List selectRolesByUserName(String userName); /** - * 批量角色用户信息 + * 校验角色名称是否唯一 * - * @param ids 需要删除的数据ID - * @return 结果 + * @param roleName 角色名称 + * @return 角色信息 */ - public int deleteRoleByIds(Long[] ids); + public SysRole checkRoleNameUnique(String roleName); + + /** + * 校验角色权限是否唯一 + * + * @param roleKey 角色权限 + * @return 角色信息 + */ + public SysRole checkRoleKeyUnique(String roleKey); /** * 修改角色信息 @@ -67,18 +90,18 @@ public interface SysRoleMapper public int insertRole(SysRole role); /** - * 校验角色名称是否唯一 + * 通过角色ID删除角色 * - * @param roleName 角色名称 - * @return 角色信息 + * @param roleId 角色ID + * @return 结果 */ - public SysRole checkRoleNameUnique(String roleName); - + public int deleteRoleById(Long roleId); + /** - * 校验角色权限是否唯一 + * 批量删除角色信息 * - * @param roleKey 角色权限 - * @return 角色信息 + * @param roleIds 需要删除的角色ID + * @return 结果 */ - public SysRole checkRoleKeyUnique(String roleKey); + public int deleteRoleByIds(Long[] roleIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java index 5ed98f294..23391557d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -10,6 +10,14 @@ import com.ruoyi.system.domain.SysRoleMenu; */ public interface SysRoleMenuMapper { + /** + * 查询菜单使用数量 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int checkMenuExistRole(Long menuId); + /** * 通过角色ID删除角色和菜单关联 * @@ -17,7 +25,7 @@ public interface SysRoleMenuMapper * @return 结果 */ public int deleteRoleMenuByRoleId(Long roleId); - + /** * 批量删除角色菜单关联信息 * @@ -25,15 +33,7 @@ public interface SysRoleMenuMapper * @return 结果 */ public int deleteRoleMenu(Long[] ids); - - /** - * 查询菜单使用数量 - * - * @param menuId 菜单ID - * @return 结果 - */ - public int selectCountRoleMenuByMenuId(Long menuId); - + /** * 批量新增角色菜单信息 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index ed57abb47..c86acea45 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.system.mapper; import java.util.List; +import org.apache.ibatis.annotations.Param; import com.ruoyi.common.core.domain.entity.SysUser; /** @@ -40,23 +41,7 @@ public interface SysUserMapper * @param userName 用户名 * @return 用户对象信息 */ - public SysUser selectUserByLoginName(String userName); - - /** - * 通过手机号码查询用户 - * - * @param phoneNumber 手机号码 - * @return 用户对象信息 - */ - public SysUser selectUserByPhoneNumber(String phoneNumber); - - /** - * 通过邮箱查询用户 - * - * @param email 邮箱 - * @return 用户对象信息 - */ - public SysUser selectUserByEmail(String email); + public SysUser selectUserByUserName(String userName); /** * 通过用户ID查询用户 @@ -66,6 +51,40 @@ public interface SysUserMapper */ public SysUser selectUserById(Long userId); + /** + * 新增用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int insertUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public int updateUserAvatar(@Param("userName") String userName, @Param("avatar") String avatar); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(@Param("userName") String userName, @Param("password") String password); + /** * 通过用户ID删除用户 * @@ -77,34 +96,18 @@ public interface SysUserMapper /** * 批量删除用户信息 * - * @param ids 需要删除的数据ID + * @param userIds 需要删除的用户ID * @return 结果 */ - public int deleteUserByIds(Long[] ids); - - /** - * 修改用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - public int updateUser(SysUser user); - - /** - * 新增用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - public int insertUser(SysUser user); + public int deleteUserByIds(Long[] userIds); /** * 校验用户名称是否唯一 * - * @param loginName 登录名称 + * @param userName 用户名称 * @return 结果 */ - public SysUser checkLoginNameUnique(String loginName); + public SysUser checkUserNameUnique(String userName); /** * 校验手机号码是否唯一 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java deleted file mode 100644 index c6bf94cd2..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserOnlineMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.ruoyi.system.mapper; - -import java.util.List; -import com.ruoyi.system.domain.SysUserOnline; - -/** - * 在线用户 数据层 - * - * @author ruoyi - */ -public interface SysUserOnlineMapper -{ - /** - * 通过会话序号查询信息 - * - * @param sessionId 会话ID - * @return 在线用户信息 - */ - public SysUserOnline selectOnlineById(String sessionId); - - /** - * 通过会话序号删除信息 - * - * @param sessionId 会话ID - * @return 在线用户信息 - */ - public int deleteOnlineById(String sessionId); - - /** - * 保存会话信息 - * - * @param online 会话信息 - * @return 结果 - */ - public int saveOnline(SysUserOnline online); - - /** - * 查询会话集合 - * - * @param userOnline 会话参数 - * @return 会话集合 - */ - public List selectUserOnlineList(SysUserOnline userOnline); - - /** - * 查询过期会话集合 - * - * @param lastAccessTime 过期时间 - * @return 会话集合 - */ - public List selectOnlineByExpired(String lastAccessTime); -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java index 877ddddcd..81d6e719c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserPostMapper.java @@ -17,7 +17,7 @@ public interface SysUserPostMapper * @return 结果 */ public int deleteUserPostByUserId(Long userId); - + /** * 通过岗位ID查询岗位使用数量 * @@ -25,7 +25,7 @@ public interface SysUserPostMapper * @return 结果 */ public int countUserPostById(Long postId); - + /** * 批量删除用户和岗位关联 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java index 17fa5c827..ad3fe62c1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserRoleMapper.java @@ -11,14 +11,6 @@ import com.ruoyi.system.domain.SysUserRole; */ public interface SysUserRoleMapper { - /** - * 通过用户ID查询用户和角色关联 - * - * @param userId 用户ID - * @return 用户和角色关联列表 - */ - public List selectUserRoleByUserId(Long userId); - /** * 通过用户ID删除用户和角色关联 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java index ba9a27075..209613784 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java @@ -26,6 +26,13 @@ public interface ISysConfigService */ public String selectConfigByKey(String configKey); + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + public boolean selectCaptchaEnabled(); + /** * 查询参数配置列表 * @@ -51,11 +58,11 @@ public interface ISysConfigService public int updateConfig(SysConfig config); /** - * 批量删除参数配置信息 + * 批量删除参数信息 * - * @param ids 需要删除的数据ID + * @param configIds 需要删除的参数ID */ - public void deleteConfigByIds(String ids); + public void deleteConfigByIds(Long[] configIds); /** * 加载参数缓存数据 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index 0998732ab..302d7a1f7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -1,9 +1,8 @@ package com.ruoyi.system.service; import java.util.List; -import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; -import com.ruoyi.common.core.domain.entity.SysRole; /** * 部门管理 服务层 @@ -21,68 +20,36 @@ public interface ISysDeptService public List selectDeptList(SysDept dept); /** - * 查询部门管理树 + * 查询部门树结构信息 * * @param dept 部门信息 - * @return 所有部门信息 + * @return 部门树信息集合 */ - public List selectDeptTree(SysDept dept); + public List selectDeptTreeList(SysDept dept); /** - * 查询部门管理树(排除下级) + * 构建前端所需要树结构 * - * @param dept 部门信息 - * @return 所有部门信息 + * @param depts 部门列表 + * @return 树结构列表 */ - public List selectDeptTreeExcludeChild(SysDept dept); + public List buildDeptTree(List depts); /** - * 根据角色ID查询菜单 - * - * @param role 角色对象 - * @return 菜单列表 - */ - public List roleDeptTreeData(SysRole role); - - /** - * 根据父部门ID查询下级部门数量 + * 构建前端所需要下拉树结构 * - * @param parentId 父部门ID - * @return 结果 + * @param depts 部门列表 + * @return 下拉树结构列表 */ - public int selectDeptCount(Long parentId); + public List buildDeptTreeSelect(List depts); /** - * 查询部门是否存在用户 + * 根据角色ID查询部门树信息 * - * @param deptId 部门ID - * @return 结果 true 存在 false 不存在 + * @param roleId 角色ID + * @return 选中部门列表 */ - public boolean checkDeptExistUser(Long deptId); - - /** - * 删除部门管理信息 - * - * @param deptId 部门ID - * @return 结果 - */ - public int deleteDeptById(Long deptId); - - /** - * 新增保存部门信息 - * - * @param dept 部门信息 - * @return 结果 - */ - public int insertDept(SysDept dept); - - /** - * 修改保存部门信息 - * - * @param dept 部门信息 - * @return 结果 - */ - public int updateDept(SysDept dept); + public List selectDeptListByRoleId(Long roleId); /** * 根据部门ID查询信息 @@ -100,6 +67,22 @@ public interface ISysDeptService */ public int selectNormalChildrenDeptById(Long deptId); + /** + * 是否存在部门子节点 + * + * @param deptId 部门ID + * @return 结果 + */ + public boolean hasChildByDeptId(Long deptId); + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkDeptExistUser(Long deptId); + /** * 校验部门名称是否唯一 * @@ -114,4 +97,28 @@ public interface ISysDeptService * @param deptId 部门id */ public void checkDeptDataScope(Long deptId); + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int insertDept(SysDept dept); + + /** + * 修改保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + public int updateDept(SysDept dept); + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + public int deleteDeptById(Long deptId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java index b2575a0c8..9a5cf1909 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictDataService.java @@ -36,11 +36,11 @@ public interface ISysDictDataService public SysDictData selectDictDataById(Long dictCode); /** - * 批量删除字典数据 + * 批量删除字典数据信息 * - * @param ids 需要删除的数据 + * @param dictCodes 需要删除的字典数据ID */ - public void deleteDictDataByIds(String ids); + public void deleteDictDataByIds(Long[] dictCodes); /** * 新增保存字典数据信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java index 50e7e283f..f01a35847 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; import java.util.List; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictType; @@ -52,11 +51,11 @@ public interface ISysDictTypeService public SysDictType selectDictTypeByType(String dictType); /** - * 批量删除字典类型 + * 批量删除字典信息 * - * @param ids 需要删除的数据 + * @param dictIds 需要删除的字典ID */ - public void deleteDictTypeByIds(String ids); + public void deleteDictTypeByIds(Long[] dictIds); /** * 加载字典缓存数据 @@ -96,12 +95,4 @@ public interface ISysDictTypeService * @return 结果 */ public boolean checkDictTypeUnique(SysDictType dictType); - - /** - * 查询字典类型树 - * - * @param dictType 字典类型 - * @return 所有字典类型 - */ - public List selectDictTree(SysDictType dictType); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java index 501551573..0a8320838 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysLogininforService.java @@ -28,10 +28,10 @@ public interface ISysLogininforService /** * 批量删除系统登录日志 * - * @param ids 需要删除的数据 + * @param infoIds 需要删除的登录日志ID * @return 结果 */ - public int deleteLogininforByIds(String ids); + public int deleteLogininforByIds(Long[] infoIds); /** * 清空系统登录日志 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 58dfd689b..134b9ebd4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -1,12 +1,10 @@ package com.ruoyi.system.service; import java.util.List; -import java.util.Map; import java.util.Set; -import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; -import com.ruoyi.common.core.domain.entity.SysRole; -import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.system.domain.vo.RouterVo; /** * 菜单 业务层 @@ -16,15 +14,15 @@ import com.ruoyi.common.core.domain.entity.SysUser; public interface ISysMenuService { /** - * 根据用户ID查询菜单 + * 根据用户查询系统菜单列表 * - * @param user 用户信息 + * @param userId 用户ID * @return 菜单列表 */ - public List selectMenusByUser(SysUser user); + public List selectMenuList(Long userId); /** - * 查询系统菜单列表 + * 根据用户查询系统菜单列表 * * @param menu 菜单信息 * @param userId 用户ID @@ -32,21 +30,13 @@ public interface ISysMenuService */ public List selectMenuList(SysMenu menu, Long userId); - /** - * 查询菜单集合 - * - * @param userId 用户ID - * @return 所有菜单信息 - */ - public List selectMenuAll(Long userId); - /** * 根据用户ID查询权限 * * @param userId 用户ID * @return 权限列表 */ - public Set selectPermsByUserId(Long userId); + public Set selectMenuPermsByUserId(Long userId); /** * 根据角色ID查询权限 @@ -54,40 +44,47 @@ public interface ISysMenuService * @param roleId 角色ID * @return 权限列表 */ - public Set selectPermsByRoleId(Long roleId); + public Set selectMenuPermsByRoleId(Long roleId); /** - * 根据角色ID查询菜单 - * - * @param role 角色对象 - * @param userId 用户ID - * @return 菜单列表 - */ - public List roleMenuTreeData(SysRole role, Long userId); - - /** - * 查询所有菜单信息 + * 根据用户ID查询菜单树信息 * * @param userId 用户ID * @return 菜单列表 */ - public List menuTreeData(Long userId); + public List selectMenuTreeByUserId(Long userId); /** - * 查询系统所有权限 + * 根据角色ID查询菜单树信息 * - * @param userId 用户ID - * @return 权限列表 + * @param roleId 角色ID + * @return 选中菜单列表 */ - public Map selectPermsAll(Long userId); + public List selectMenuListByRoleId(Long roleId); /** - * 删除菜单管理信息 + * 构建前端路由所需要的菜单 * - * @param menuId 菜单ID - * @return 结果 + * @param menus 菜单列表 + * @return 路由列表 */ - public int deleteMenuById(Long menuId); + public List buildMenus(List menus); + + /** + * 构建前端所需要树结构 + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildMenuTree(List menus); + + /** + * 构建前端所需要下拉树结构 + * + * @param menus 菜单列表 + * @return 下拉树结构列表 + */ + public List buildMenuTreeSelect(List menus); /** * 根据菜单ID查询信息 @@ -98,20 +95,20 @@ public interface ISysMenuService public SysMenu selectMenuById(Long menuId); /** - * 查询菜单数量 - * - * @param parentId 菜单父ID - * @return 结果 - */ - public int selectCountMenuByParentId(Long parentId); - - /** - * 查询菜单使用数量 + * 是否存在菜单子节点 * * @param menuId 菜单ID - * @return 结果 + * @return 结果 true 存在 false 不存在 */ - public int selectCountRoleMenuByMenuId(Long menuId); + public boolean hasChildByMenuId(Long menuId); + + /** + * 查询菜单是否存在角色 + * + * @param menuId 菜单ID + * @return 结果 true 存在 false 不存在 + */ + public boolean checkMenuExistRole(Long menuId); /** * 新增保存菜单信息 @@ -129,6 +126,14 @@ public interface ISysMenuService */ public int updateMenu(SysMenu menu); + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + public int deleteMenuById(Long menuId); + /** * 校验菜单名称是否唯一 * diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java index abd6d7afc..fb1e420fd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysNoticeService.java @@ -45,8 +45,16 @@ public interface ISysNoticeService /** * 删除公告信息 * - * @param ids 需要删除的数据ID + * @param noticeId 公告ID * @return 结果 */ - public int deleteNoticeByIds(String ids); + public int deleteNoticeById(Long noticeId); + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + public int deleteNoticeByIds(Long[] noticeIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java index 61efe6020..241f121ae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysOperLogService.java @@ -28,10 +28,10 @@ public interface ISysOperLogService /** * 批量删除系统操作日志 * - * @param ids 需要删除的数据 + * @param operIds 需要删除的操作日志ID * @return 结果 */ - public int deleteOperLogByIds(String ids); + public int deleteOperLogByIds(Long[] operIds); /** * 查询操作日志详细 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java index 5e3dbc8d5..590634b9e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java @@ -14,7 +14,7 @@ public interface ISysPostService * 查询岗位信息集合 * * @param post 岗位信息 - * @return 岗位信息集合 + * @return 岗位列表 */ public List selectPostList(SysPost post); @@ -25,14 +25,6 @@ public interface ISysPostService */ public List selectPostAll(); - /** - * 根据用户ID查询岗位 - * - * @param userId 用户ID - * @return 岗位列表 - */ - public List selectPostsByUserId(Long userId); - /** * 通过岗位ID查询岗位信息 * @@ -42,36 +34,12 @@ public interface ISysPostService public SysPost selectPostById(Long postId); /** - * 批量删除岗位信息 + * 根据用户ID获取岗位选择框列表 * - * @param ids 需要删除的数据ID - * @return 结果 + * @param userId 用户ID + * @return 选中岗位ID列表 */ - public int deletePostByIds(String ids); - - /** - * 新增保存岗位信息 - * - * @param post 岗位信息 - * @return 结果 - */ - public int insertPost(SysPost post); - - /** - * 修改保存岗位信息 - * - * @param post 岗位信息 - * @return 结果 - */ - public int updatePost(SysPost post); - - /** - * 通过岗位ID查询岗位使用数量 - * - * @param postId 岗位ID - * @return 结果 - */ - public int countUserPostById(Long postId); + public List selectPostListByUserId(Long userId); /** * 校验岗位名称 @@ -88,4 +56,44 @@ public interface ISysPostService * @return 结果 */ public boolean checkPostCodeUnique(SysPost post); + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + public int countUserPostById(Long postId); + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + public int deletePostById(Long postId); + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + public int deletePostByIds(Long[] postIds); + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int insertPost(SysPost post); + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + public int updatePost(SysPost post); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java index f7448ee78..ba79ed5d9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysRoleService.java @@ -24,17 +24,17 @@ public interface ISysRoleService * 根据用户ID查询角色列表 * * @param userId 用户ID - * @return 权限列表 + * @return 角色列表 */ - public Set selectRoleKeys(Long userId); + public List selectRolesByUserId(Long userId); /** * 根据用户ID查询角色权限 * * @param userId 用户ID - * @return 角色列表 + * @return 权限列表 */ - public List selectRolesByUserId(Long userId); + public Set selectRolePermissionByUserId(Long userId); /** * 查询所有角色 @@ -43,6 +43,14 @@ public interface ISysRoleService */ public List selectRoleAll(); + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + public List selectRoleListByUserId(Long userId); + /** * 通过角色ID查询角色 * @@ -51,47 +59,6 @@ public interface ISysRoleService */ public SysRole selectRoleById(Long roleId); - /** - * 通过角色ID删除角色 - * - * @param roleId 角色ID - * @return 结果 - */ - public boolean deleteRoleById(Long roleId); - - /** - * 批量删除角色用户信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - * @throws Exception 异常 - */ - public int deleteRoleByIds(String ids); - - /** - * 新增保存角色信息 - * - * @param role 角色信息 - * @return 结果 - */ - public int insertRole(SysRole role); - - /** - * 修改保存角色信息 - * - * @param role 角色信息 - * @return 结果 - */ - public int updateRole(SysRole role); - - /** - * 修改数据权限信息 - * - * @param role 角色信息 - * @return 结果 - */ - public int authDataScope(SysRole role); - /** * 校验角色名称是否唯一 * @@ -131,12 +98,52 @@ public interface ISysRoleService public int countUserRoleByRoleId(Long roleId); /** - * 角色状态修改 + * 新增保存角色信息 * * @param role 角色信息 * @return 结果 */ - public int changeStatus(SysRole role); + public int insertRole(SysRole role); + + /** + * 修改保存角色信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRole(SysRole role); + + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + public int updateRoleStatus(SysRole role); + + /** + * 修改数据权限信息 + * + * @param role 角色信息 + * @return 结果 + */ + public int authDataScope(SysRole role); + + /** + * 通过角色ID删除角色 + * + * @param roleId 角色ID + * @return 结果 + */ + public int deleteRoleById(Long roleId); + + /** + * 批量删除角色信息 + * + * @param roleIds 需要删除的角色ID + * @return 结果 + */ + public int deleteRoleByIds(Long[] roleIds); /** * 取消授权用户角色 @@ -150,10 +157,10 @@ public interface ISysRoleService * 批量取消授权用户角色 * * @param roleId 角色ID - * @param userIds 需要删除的用户数据ID + * @param userIds 需要取消授权的用户数据ID * @return 结果 */ - public int deleteAuthUsers(Long roleId, String userIds); + public int deleteAuthUsers(Long roleId, Long[] userIds); /** * 批量选择授权用户角色 @@ -162,5 +169,5 @@ public interface ISysRoleService * @param userIds 需要删除的用户数据ID * @return 结果 */ - public int insertAuthUsers(Long roleId, String userIds); + public int insertAuthUsers(Long roleId, Long[] userIds); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java index 9c62537f2..12095ff5e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserOnlineService.java @@ -1,7 +1,6 @@ package com.ruoyi.system.service; -import java.util.Date; -import java.util.List; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.system.domain.SysUserOnline; /** @@ -12,64 +11,38 @@ import com.ruoyi.system.domain.SysUserOnline; public interface ISysUserOnlineService { /** - * 通过会话序号查询信息 + * 通过登录地址查询信息 * - * @param sessionId 会话ID + * @param ipaddr 登录地址 + * @param user 用户信息 * @return 在线用户信息 */ - public SysUserOnline selectOnlineById(String sessionId); + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user); /** - * 通过会话序号删除信息 + * 通过用户名称查询信息 * - * @param sessionId 会话ID + * @param userName 用户名称 + * @param user 用户信息 * @return 在线用户信息 */ - public void deleteOnlineById(String sessionId); + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user); /** - * 通过会话序号删除信息 + * 通过登录地址/用户名称查询信息 * - * @param sessions 会话ID集合 + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 * @return 在线用户信息 */ - public void batchDeleteOnline(List sessions); + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user); /** - * 保存会话信息 + * 设置在线用户信息 * - * @param online 会话信息 + * @param user 用户信息 + * @return 在线用户 */ - public void saveOnline(SysUserOnline online); - - /** - * 查询会话集合 - * - * @param userOnline 分页参数 - * @return 会话集合 - */ - public List selectUserOnlineList(SysUserOnline userOnline); - - /** - * 强退用户 - * - * @param sessionId 会话ID - */ - public void forceLogout(String sessionId); - - /** - * 清理用户缓存 - * - * @param loginName 登录名称 - * @param sessionId 会话ID - */ - public void removeUserCache(String loginName, String sessionId); - - /** - * 查询会话集合 - * - * @param expiredDate 有效期 - * @return 会话集合 - */ - public List selectOnlineByExpired(Date expiredDate); + public SysUserOnline loginUserToUserOnline(LoginUser user); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java index 58869cd1a..e438b577e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java @@ -2,7 +2,6 @@ package com.ruoyi.system.service; import java.util.List; import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.system.domain.SysUserRole; /** * 用户 业务层 @@ -41,23 +40,7 @@ public interface ISysUserService * @param userName 用户名 * @return 用户对象信息 */ - public SysUser selectUserByLoginName(String userName); - - /** - * 通过手机号码查询用户 - * - * @param phoneNumber 手机号码 - * @return 用户对象信息 - */ - public SysUser selectUserByPhoneNumber(String phoneNumber); - - /** - * 通过邮箱查询用户 - * - * @param email 邮箱 - * @return 用户对象信息 - */ - public SysUser selectUserByEmail(String email); + public SysUser selectUserByUserName(String userName); /** * 通过用户ID查询用户 @@ -68,77 +51,20 @@ public interface ISysUserService public SysUser selectUserById(Long userId); /** - * 通过用户ID查询用户和角色关联 + * 根据用户ID查询用户所属角色组 * - * @param userId 用户ID - * @return 用户和角色关联列表 - */ - public List selectUserRoleByUserId(Long userId); - - /** - * 通过用户ID删除用户 - * - * @param userId 用户ID + * @param userName 用户名 * @return 结果 */ - public int deleteUserById(Long userId); + public String selectUserRoleGroup(String userName); /** - * 批量删除用户信息 + * 根据用户ID查询用户所属岗位组 * - * @param ids 需要删除的数据ID - * @return 结果 - * @throws Exception 异常 - */ - public int deleteUserByIds(String ids); - - /** - * 保存用户信息 - * - * @param user 用户信息 + * @param userName 用户名 * @return 结果 */ - public int insertUser(SysUser user); - - /** - * 注册用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - public boolean registerUser(SysUser user); - - /** - * 保存用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - public int updateUser(SysUser user); - - /** - * 修改用户详细信息 - * - * @param user 用户信息 - * @return 结果 - */ - public int updateUserInfo(SysUser user); - - /** - * 用户授权角色 - * - * @param userId 用户ID - * @param roleIds 角色组 - */ - public void insertUserAuth(Long userId, Long[] roleIds); - - /** - * 修改用户密码信息 - * - * @param user 用户信息 - * @return 结果 - */ - public int resetUserPwd(SysUser user); + public String selectUserPostGroup(String userName); /** * 校验用户名称是否唯一 @@ -146,7 +72,7 @@ public interface ISysUserService * @param user 用户信息 * @return 结果 */ - public boolean checkLoginNameUnique(SysUser user); + public boolean checkUserNameUnique(SysUser user); /** * 校验手机号码是否唯一 @@ -179,20 +105,94 @@ public interface ISysUserService public void checkUserDataScope(Long userId); /** - * 根据用户ID查询用户所属角色组 + * 新增用户信息 * - * @param userId 用户ID + * @param user 用户信息 * @return 结果 */ - public String selectUserRoleGroup(Long userId); + public int insertUser(SysUser user); /** - * 根据用户ID查询用户所属岗位组 + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public boolean registerUser(SysUser user); + + /** + * 修改用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUser(SysUser user); + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserAuth(Long userId, Long[] roleIds); + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserStatus(SysUser user); + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + public int updateUserProfile(SysUser user); + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + public boolean updateUserAvatar(String userName, String avatar); + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + public int resetPwd(SysUser user); + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + public int resetUserPwd(String userName, String password); + + /** + * 通过用户ID删除用户 * * @param userId 用户ID * @return 结果 */ - public String selectUserPostGroup(Long userId); + public int deleteUserById(Long userId); + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + public int deleteUserByIds(Long[] userIds); /** * 导入用户数据 @@ -203,12 +203,4 @@ public interface ISysUserService * @return 结果 */ public String importUser(List userList, Boolean isUpdateSupport, String operName); - - /** - * 用户状态修改 - * - * @param user 用户信息 - * @return 结果 - */ - public int changeStatus(SysUser user); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 960c5020c..3615b88f5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -1,14 +1,17 @@ package com.ruoyi.system.service.impl; +import java.util.Collection; import java.util.List; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.CacheUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.mapper.SysConfigMapper; @@ -25,6 +28,9 @@ public class SysConfigServiceImpl implements ISysConfigService @Autowired private SysConfigMapper configMapper; + @Autowired + private RedisCache redisCache; + /** * 项目启动时,初始化参数到缓存 */ @@ -41,6 +47,7 @@ public class SysConfigServiceImpl implements ISysConfigService * @return 参数配置信息 */ @Override + @DataSource(DataSourceType.MASTER) public SysConfig selectConfigById(Long configId) { SysConfig config = new SysConfig(); @@ -57,7 +64,7 @@ public class SysConfigServiceImpl implements ISysConfigService @Override public String selectConfigByKey(String configKey) { - String configValue = Convert.toStr(CacheUtils.get(getCacheName(), getCacheKey(configKey))); + String configValue = Convert.toStr(redisCache.getCacheObject(getCacheKey(configKey))); if (StringUtils.isNotEmpty(configValue)) { return configValue; @@ -67,12 +74,28 @@ public class SysConfigServiceImpl implements ISysConfigService SysConfig retConfig = configMapper.selectConfig(config); if (StringUtils.isNotNull(retConfig)) { - CacheUtils.put(getCacheName(), getCacheKey(configKey), retConfig.getConfigValue()); + redisCache.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); return retConfig.getConfigValue(); } return StringUtils.EMPTY; } + /** + * 获取验证码开关 + * + * @return true开启,false关闭 + */ + @Override + public boolean selectCaptchaEnabled() + { + String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); + if (StringUtils.isEmpty(captchaEnabled)) + { + return true; + } + return Convert.toBool(captchaEnabled); + } + /** * 查询参数配置列表 * @@ -97,7 +120,7 @@ public class SysConfigServiceImpl implements ISysConfigService int row = configMapper.insertConfig(config); if (row > 0) { - CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue()); + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); } return row; } @@ -114,26 +137,25 @@ public class SysConfigServiceImpl implements ISysConfigService SysConfig temp = configMapper.selectConfigById(config.getConfigId()); if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) { - CacheUtils.remove(getCacheName(), getCacheKey(temp.getConfigKey())); + redisCache.deleteObject(getCacheKey(temp.getConfigKey())); } int row = configMapper.updateConfig(config); if (row > 0) { - CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue()); + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); } return row; } /** - * 批量删除参数配置对象 + * 批量删除参数信息 * - * @param ids 需要删除的数据ID + * @param configIds 需要删除的参数ID */ @Override - public void deleteConfigByIds(String ids) + public void deleteConfigByIds(Long[] configIds) { - Long[] configIds = Convert.toLongArray(ids); for (Long configId : configIds) { SysConfig config = selectConfigById(configId); @@ -142,7 +164,7 @@ public class SysConfigServiceImpl implements ISysConfigService throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); } configMapper.deleteConfigById(configId); - CacheUtils.remove(getCacheName(), getCacheKey(config.getConfigKey())); + redisCache.deleteObject(getCacheKey(config.getConfigKey())); } } @@ -155,7 +177,7 @@ public class SysConfigServiceImpl implements ISysConfigService List configsList = configMapper.selectConfigList(new SysConfig()); for (SysConfig config : configsList) { - CacheUtils.put(getCacheName(), getCacheKey(config.getConfigKey()), config.getConfigValue()); + redisCache.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); } } @@ -165,7 +187,8 @@ public class SysConfigServiceImpl implements ISysConfigService @Override public void clearConfigCache() { - CacheUtils.removeAll(getCacheName()); + Collection keys = redisCache.keys(CacheConstants.SYS_CONFIG_KEY + "*"); + redisCache.deleteObject(keys); } /** @@ -196,16 +219,6 @@ public class SysConfigServiceImpl implements ISysConfigService return UserConstants.UNIQUE; } - /** - * 获取cache name - * - * @return 缓存名 - */ - private String getCacheName() - { - return Constants.SYS_CONFIG_CACHE; - } - /** * 设置cache key * @@ -214,6 +227,6 @@ public class SysConfigServiceImpl implements ISysConfigService */ private String getCacheKey(String configKey) { - return Constants.SYS_CONFIG_KEY + configKey; + return CacheConstants.SYS_CONFIG_KEY + configKey; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index adca04c6a..c5f3ce6e1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -1,23 +1,24 @@ package com.ruoyi.system.service.impl; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; -import org.apache.commons.lang3.ArrayUtils; +import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.mapper.SysDeptMapper; +import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.service.ISysDeptService; /** @@ -31,6 +32,9 @@ public class SysDeptServiceImpl implements ISysDeptService @Autowired private SysDeptMapper deptMapper; + @Autowired + private SysRoleMapper roleMapper; + /** * 查询部门管理数据 * @@ -45,118 +49,106 @@ public class SysDeptServiceImpl implements ISysDeptService } /** - * 查询部门管理树 + * 查询部门树结构信息 * * @param dept 部门信息 - * @return 所有部门信息 + * @return 部门树信息集合 */ @Override - @DataScope(deptAlias = "d") - public List selectDeptTree(SysDept dept) + public List selectDeptTreeList(SysDept dept) { - List deptList = deptMapper.selectDeptList(dept); - List ztrees = initZtree(deptList); - return ztrees; + List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + return buildDeptTreeSelect(depts); } /** - * 查询部门管理树(排除下级) + * 构建前端所需要树结构 * - * @param deptId 部门ID - * @return 所有部门信息 - */ - @Override - @DataScope(deptAlias = "d") - public List selectDeptTreeExcludeChild(SysDept dept) - { - Long excludeId = dept.getExcludeId(); - List depts = deptMapper.selectDeptList(dept); - if (excludeId.intValue() > 0) - { - depts.removeIf(d -> d.getDeptId().intValue() == excludeId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), excludeId + "")); - } - List ztrees = initZtree(depts); - return ztrees; - } - - /** - * 根据角色ID查询部门(数据权限) - * - * @param role 角色对象 - * @return 部门列表(数据权限) - */ - @Override - public List roleDeptTreeData(SysRole role) - { - Long roleId = role.getRoleId(); - List ztrees = new ArrayList(); - List deptList = SpringUtils.getAopProxy(this).selectDeptList(new SysDept()); - if (StringUtils.isNotNull(roleId)) - { - List roleDeptList = deptMapper.selectRoleDeptTree(roleId); - ztrees = initZtree(deptList, roleDeptList); - } - else - { - ztrees = initZtree(deptList); - } - return ztrees; - } - - /** - * 对象转部门树 - * - * @param deptList 部门列表 + * @param depts 部门列表 * @return 树结构列表 */ - public List initZtree(List deptList) + @Override + public List buildDeptTree(List depts) { - return initZtree(deptList, null); - } - - /** - * 对象转部门树 - * - * @param deptList 部门列表 - * @param roleDeptList 角色已存在菜单列表 - * @return 树结构列表 - */ - public List initZtree(List deptList, List roleDeptList) - { - - List ztrees = new ArrayList(); - boolean isCheck = StringUtils.isNotNull(roleDeptList); - for (SysDept dept : deptList) + List returnList = new ArrayList(); + List tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); + for (SysDept dept : depts) { - if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(dept.getParentId())) { - Ztree ztree = new Ztree(); - ztree.setId(dept.getDeptId()); - ztree.setpId(dept.getParentId()); - ztree.setName(dept.getDeptName()); - ztree.setTitle(dept.getDeptName()); - if (isCheck) - { - ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName())); - } - ztrees.add(ztree); + recursionFn(depts, dept); + returnList.add(dept); } } - return ztrees; + if (returnList.isEmpty()) + { + returnList = depts; + } + return returnList; } /** - * 根据父部门ID查询下级部门数量 + * 构建前端所需要下拉树结构 * - * @param parentId 部门ID + * @param depts 部门列表 + * @return 下拉树结构列表 + */ + @Override + public List buildDeptTreeSelect(List depts) + { + List deptTrees = buildDeptTree(depts); + return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 根据角色ID查询部门树信息 + * + * @param roleId 角色ID + * @return 选中部门列表 + */ + @Override + public List selectDeptListByRoleId(Long roleId) + { + SysRole role = roleMapper.selectRoleById(roleId); + return deptMapper.selectDeptListByRoleId(roleId, role.isDeptCheckStrictly()); + } + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + @Override + public SysDept selectDeptById(Long deptId) + { + return deptMapper.selectDeptById(deptId); + } + + /** + * 根据ID查询所有子部门(正常状态) + * + * @param deptId 部门ID + * @return 子部门数 + */ + @Override + public int selectNormalChildrenDeptById(Long deptId) + { + return deptMapper.selectNormalChildrenDeptById(deptId); + } + + /** + * 是否存在子节点 + * + * @param deptId 部门ID * @return 结果 */ @Override - public int selectDeptCount(Long parentId) + public boolean hasChildByDeptId(Long deptId) { - SysDept dept = new SysDept(); - dept.setParentId(parentId); - return deptMapper.selectDeptCount(dept); + int result = deptMapper.hasChildByDeptId(deptId); + return result > 0; } /** @@ -173,15 +165,41 @@ public class SysDeptServiceImpl implements ISysDeptService } /** - * 删除部门管理信息 + * 校验部门名称是否唯一 * - * @param deptId 部门ID + * @param dept 部门信息 * @return 结果 */ @Override - public int deleteDeptById(Long deptId) + public boolean checkDeptNameUnique(SysDept dept) { - return deptMapper.deleteDeptById(deptId); + Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); + SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); + if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验部门是否有数据权限 + * + * @param deptId 部门id + */ + @Override + public void checkDeptDataScope(Long deptId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysDept dept = new SysDept(); + dept.setDeptId(deptId); + List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); + if (StringUtils.isEmpty(depts)) + { + throw new ServiceException("没有权限访问部门数据!"); + } + } } /** @@ -194,7 +212,7 @@ public class SysDeptServiceImpl implements ISysDeptService public int insertDept(SysDept dept) { SysDept info = deptMapper.selectDeptById(dept.getParentId()); - // 如果父节点不为"正常"状态,则不允许新增子节点 + // 如果父节点不为正常状态,则不允许新增子节点 if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) { throw new ServiceException("部门停用,不允许新增"); @@ -210,11 +228,10 @@ public class SysDeptServiceImpl implements ISysDeptService * @return 结果 */ @Override - @Transactional public int updateDept(SysDept dept) { SysDept newParentDept = deptMapper.selectDeptById(dept.getParentId()); - SysDept oldDept = selectDeptById(dept.getDeptId()); + SysDept oldDept = deptMapper.selectDeptById(dept.getDeptId()); if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) { String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); @@ -265,64 +282,57 @@ public class SysDeptServiceImpl implements ISysDeptService } /** - * 根据部门ID查询信息 + * 删除部门管理信息 * * @param deptId 部门ID - * @return 部门信息 - */ - @Override - public SysDept selectDeptById(Long deptId) - { - return deptMapper.selectDeptById(deptId); - } - - /** - * 根据ID查询所有子部门(正常状态) - * - * @param deptId 部门ID - * @return 子部门数 - */ - @Override - public int selectNormalChildrenDeptById(Long deptId) - { - return deptMapper.selectNormalChildrenDeptById(deptId); - } - - /** - * 校验部门名称是否唯一 - * - * @param dept 部门信息 * @return 结果 */ @Override - public boolean checkDeptNameUnique(SysDept dept) + public int deleteDeptById(Long deptId) { - Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId(); - SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); - if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) - { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; + return deptMapper.deleteDeptById(deptId); } /** - * 校验部门是否有数据权限 - * - * @param deptId 部门id + * 递归列表 */ - @Override - public void checkDeptDataScope(Long deptId) + private void recursionFn(List list, SysDept t) { - if (!SysUser.isAdmin(ShiroUtils.getUserId())) + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (SysDept tChild : childList) { - SysDept dept = new SysDept(); - dept.setDeptId(deptId); - List depts = SpringUtils.getAopProxy(this).selectDeptList(dept); - if (StringUtils.isEmpty(depts)) + if (hasChild(list, tChild)) { - throw new ServiceException("没有权限访问部门数据!"); + recursionFn(list, tChild); } } } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, SysDept t) + { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) + { + SysDept n = (SysDept) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getDeptId().longValue()) + { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, SysDept t) + { + return getChildList(list, t).size() > 0; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java index 9c3325fb7..de244f8b4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.domain.entity.SysDictData; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; @@ -58,14 +57,13 @@ public class SysDictDataServiceImpl implements ISysDictDataService } /** - * 批量删除字典数据 + * 批量删除字典数据信息 * - * @param ids 需要删除的数据 + * @param dictCodes 需要删除的字典数据ID */ @Override - public void deleteDictDataByIds(String ids) + public void deleteDictDataByIds(Long[] dictCodes) { - Long[] dictCodes = Convert.toLongArray(ids); for (Long dictCode : dictCodes) { SysDictData data = selectDictDataById(dictCode); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index b7b2cf10f..b6c4c5650 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -1,6 +1,5 @@ package com.ruoyi.system.service.impl; -import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -10,10 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictType; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.StringUtils; @@ -115,14 +112,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService } /** - * 批量删除字典类型 + * 批量删除字典类型信息 * - * @param ids 需要删除的数据 + * @param dictIds 需要删除的字典ID */ @Override - public void deleteDictTypeByIds(String ids) + public void deleteDictTypeByIds(Long[] dictIds) { - Long[] dictIds = Convert.toLongArray(ids); for (Long dictId : dictIds) { SysDictType dictType = selectDictTypeById(dictId); @@ -224,37 +220,4 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService } return UserConstants.UNIQUE; } - - /** - * 查询字典类型树 - * - * @param dictType 字典类型 - * @return 所有字典类型 - */ - @Override - public List selectDictTree(SysDictType dictType) - { - List ztrees = new ArrayList(); - List dictList = dictTypeMapper.selectDictTypeList(dictType); - for (SysDictType dict : dictList) - { - if (UserConstants.DICT_NORMAL.equals(dict.getStatus())) - { - Ztree ztree = new Ztree(); - ztree.setId(dict.getDictId()); - ztree.setName(transDictName(dict)); - ztree.setTitle(dict.getDictType()); - ztrees.add(ztree); - } - } - return ztrees; - } - - public String transDictName(SysDictType dictType) - { - StringBuffer sb = new StringBuffer(); - sb.append("(" + dictType.getDictName() + ")"); - sb.append("   " + dictType.getDictType()); - return sb.toString(); - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java index 2ffb61355..a5637aee2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.mapper.SysLogininforMapper; import com.ruoyi.system.service.ISysLogininforService; @@ -46,13 +45,13 @@ public class SysLogininforServiceImpl implements ISysLogininforService /** * 批量删除系统登录日志 * - * @param ids 需要删除的数据 + * @param infoIds 需要删除的登录日志ID * @return 结果 */ @Override - public int deleteLogininforByIds(String ids) + public int deleteLogininforByIds(Long[] infoIds) { - return logininforMapper.deleteLogininforByIds(Convert.toStrArray(ids)); + return logininforMapper.deleteLogininforByIds(infoIds); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 26020c2cd..624a379fe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -1,23 +1,27 @@ package com.ruoyi.system.service.impl; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.domain.Ztree; +import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.vo.MetaVo; +import com.ruoyi.system.domain.vo.RouterVo; import com.ruoyi.system.mapper.SysMenuMapper; +import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysRoleMenuMapper; import com.ruoyi.system.service.ISysMenuService; @@ -34,40 +38,35 @@ public class SysMenuServiceImpl implements ISysMenuService @Autowired private SysMenuMapper menuMapper; + @Autowired + private SysRoleMapper roleMapper; + @Autowired private SysRoleMenuMapper roleMenuMapper; /** - * 根据用户查询菜单 + * 根据用户查询系统菜单列表 * - * @param user 用户信息 + * @param userId 用户ID * @return 菜单列表 */ @Override - public List selectMenusByUser(SysUser user) + public List selectMenuList(Long userId) { - List menus = new LinkedList(); - // 管理员显示所有菜单信息 - if (user.isAdmin()) - { - menus = menuMapper.selectMenuNormalAll(); - } - else - { - menus = menuMapper.selectMenusByUserId(user.getUserId()); - } - return getChildPerms(menus, 0); + return selectMenuList(new SysMenu(), userId); } /** - * 查询菜单集合 + * 查询系统菜单列表 * - * @return 所有菜单信息 + * @param menu 菜单信息 + * @return 菜单列表 */ @Override public List selectMenuList(SysMenu menu, Long userId) { List menuList = null; + // 管理员显示所有菜单信息 if (SysUser.isAdmin(userId)) { menuList = menuMapper.selectMenuList(menu); @@ -80,26 +79,6 @@ public class SysMenuServiceImpl implements ISysMenuService return menuList; } - /** - * 查询菜单集合 - * - * @return 所有菜单信息 - */ - @Override - public List selectMenuAll(Long userId) - { - List menuList = null; - if (SysUser.isAdmin(userId)) - { - menuList = menuMapper.selectMenuAll(); - } - else - { - menuList = menuMapper.selectMenuAllByUserId(userId); - } - return menuList; - } - /** * 根据用户ID查询权限 * @@ -107,9 +86,9 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 权限列表 */ @Override - public Set selectPermsByUserId(Long userId) + public Set selectMenuPermsByUserId(Long userId) { - List perms = menuMapper.selectPermsByUserId(userId); + List perms = menuMapper.selectMenuPermsByUserId(userId); Set permsSet = new HashSet<>(); for (String perm : perms) { @@ -128,9 +107,9 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 权限列表 */ @Override - public Set selectPermsByRoleId(Long roleId) + public Set selectMenuPermsByRoleId(Long roleId) { - List perms = menuMapper.selectPermsByRoleId(roleId); + List perms = menuMapper.selectMenuPermsByRoleId(roleId); Set permsSet = new HashSet<>(); for (String perm : perms) { @@ -143,122 +122,136 @@ public class SysMenuServiceImpl implements ISysMenuService } /** - * 根据角色ID查询菜单 + * 根据用户ID查询菜单 * - * @param role 角色对象 + * @param userId 用户名称 * @return 菜单列表 */ @Override - public List roleMenuTreeData(SysRole role, Long userId) + public List selectMenuTreeByUserId(Long userId) { - Long roleId = role.getRoleId(); - List ztrees = new ArrayList(); - List menuList = selectMenuAll(userId); - if (StringUtils.isNotNull(roleId)) + List menus = null; + if (SecurityUtils.isAdmin(userId)) { - List roleMenuList = menuMapper.selectMenuTree(roleId); - ztrees = initZtree(menuList, roleMenuList, true); + menus = menuMapper.selectMenuTreeAll(); } else { - ztrees = initZtree(menuList, null, true); + menus = menuMapper.selectMenuTreeByUserId(userId); } - return ztrees; + return getChildPerms(menus, 0); } /** - * 查询所有菜单 + * 根据角色ID查询菜单树信息 * - * @return 菜单列表 + * @param roleId 角色ID + * @return 选中菜单列表 */ @Override - public List menuTreeData(Long userId) + public List selectMenuListByRoleId(Long roleId) { - List menuList = selectMenuAll(userId); - List ztrees = initZtree(menuList); - return ztrees; + SysRole role = roleMapper.selectRoleById(roleId); + return menuMapper.selectMenuListByRoleId(roleId, role.isMenuCheckStrictly()); } /** - * 查询系统所有权限 + * 构建前端路由所需要的菜单 * - * @return 权限列表 + * @param menus 菜单列表 + * @return 路由列表 */ @Override - public LinkedHashMap selectPermsAll(Long userId) + public List buildMenus(List menus) { - LinkedHashMap section = new LinkedHashMap<>(); - List permissions = selectMenuAll(userId); - if (StringUtils.isNotEmpty(permissions)) + List routers = new LinkedList(); + for (SysMenu menu : menus) { - for (SysMenu menu : permissions) + RouterVo router = new RouterVo(); + router.setHidden("1".equals(menu.getVisible())); + router.setName(getRouteName(menu)); + router.setPath(getRouterPath(menu)); + router.setComponent(getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + List cMenus = menu.getChildren(); + if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType())) { - section.put(menu.getUrl(), MessageFormat.format(PREMISSION_STRING, menu.getPerms())); + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); } + else if (isMenuFrame(menu)) + { + router.setMeta(null); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParentId().intValue() == 0 && isInnerLink(menu)) + { + router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon())); + router.setPath("/"); + List childrenList = new ArrayList(); + RouterVo children = new RouterVo(); + String routerPath = innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(UserConstants.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); } - return section; + return routers; } /** - * 对象转菜单树 + * 构建前端所需要树结构 * - * @param menuList 菜单列表 + * @param menus 菜单列表 * @return 树结构列表 */ - public List initZtree(List menuList) + @Override + public List buildMenuTree(List menus) { - return initZtree(menuList, null, false); - } - - /** - * 对象转菜单树 - * - * @param menuList 菜单列表 - * @param roleMenuList 角色已存在菜单列表 - * @param permsFlag 是否需要显示权限标识 - * @return 树结构列表 - */ - public List initZtree(List menuList, List roleMenuList, boolean permsFlag) - { - List ztrees = new ArrayList(); - boolean isCheck = StringUtils.isNotNull(roleMenuList); - for (SysMenu menu : menuList) + List returnList = new ArrayList(); + List tempList = menus.stream().map(SysMenu::getMenuId).collect(Collectors.toList()); + for (Iterator iterator = menus.iterator(); iterator.hasNext();) { - Ztree ztree = new Ztree(); - ztree.setId(menu.getMenuId()); - ztree.setpId(menu.getParentId()); - ztree.setName(transMenuName(menu, permsFlag)); - ztree.setTitle(menu.getMenuName()); - if (isCheck) + SysMenu menu = (SysMenu) iterator.next(); + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(menu.getParentId())) { - ztree.setChecked(roleMenuList.contains(menu.getMenuId() + menu.getPerms())); + recursionFn(menus, menu); + returnList.add(menu); } - ztrees.add(ztree); } - return ztrees; - } - - public String transMenuName(SysMenu menu, boolean permsFlag) - { - StringBuffer sb = new StringBuffer(); - sb.append(menu.getMenuName()); - if (permsFlag) + if (returnList.isEmpty()) { - sb.append("   " + menu.getPerms() + ""); + returnList = menus; } - return sb.toString(); + return returnList; } /** - * 删除菜单管理信息 + * 构建前端所需要下拉树结构 * - * @param menuId 菜单ID - * @return 结果 + * @param menus 菜单列表 + * @return 下拉树结构列表 */ @Override - public int deleteMenuById(Long menuId) + public List buildMenuTreeSelect(List menus) { - return menuMapper.deleteMenuById(menuId); + List menuTrees = buildMenuTree(menus); + return menuTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); } /** @@ -274,15 +267,16 @@ public class SysMenuServiceImpl implements ISysMenuService } /** - * 查询子菜单数量 + * 是否存在菜单子节点 * - * @param parentId 父级菜单ID + * @param menuId 菜单ID * @return 结果 */ @Override - public int selectCountMenuByParentId(Long parentId) + public boolean hasChildByMenuId(Long menuId) { - return menuMapper.selectCountMenuByParentId(parentId); + int result = menuMapper.hasChildByMenuId(menuId); + return result > 0; } /** @@ -292,9 +286,10 @@ public class SysMenuServiceImpl implements ISysMenuService * @return 结果 */ @Override - public int selectCountRoleMenuByMenuId(Long menuId) + public boolean checkMenuExistRole(Long menuId) { - return roleMenuMapper.selectCountRoleMenuByMenuId(menuId); + int result = roleMenuMapper.checkMenuExistRole(menuId); + return result > 0; } /** @@ -321,6 +316,18 @@ public class SysMenuServiceImpl implements ISysMenuService return menuMapper.updateMenu(menu); } + /** + * 删除菜单管理信息 + * + * @param menuId 菜单ID + * @return 结果 + */ + @Override + public int deleteMenuById(Long menuId) + { + return menuMapper.deleteMenuById(menuId); + } + /** * 校验菜单名称是否唯一 * @@ -339,6 +346,109 @@ public class SysMenuServiceImpl implements ISysMenuService return UserConstants.UNIQUE; } + /** + * 获取路由名称 + * + * @param menu 菜单信息 + * @return 路由名称 + */ + public String getRouteName(SysMenu menu) + { + String routerName = StringUtils.capitalize(menu.getPath()); + // 非外链并且是一级目录(类型为目录) + if (isMenuFrame(menu)) + { + routerName = StringUtils.EMPTY; + } + return routerName; + } + + /** + * 获取路由地址 + * + * @param menu 菜单信息 + * @return 路由地址 + */ + public String getRouterPath(SysMenu menu) + { + String routerPath = menu.getPath(); + // 内链打开外网方式 + if (menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + routerPath = innerLinkReplaceEach(routerPath); + } + // 非外链并且是一级目录(类型为目录) + if (0 == menu.getParentId().intValue() && UserConstants.TYPE_DIR.equals(menu.getMenuType()) + && UserConstants.NO_FRAME.equals(menu.getIsFrame())) + { + routerPath = "/" + menu.getPath(); + } + // 非外链并且是一级目录(类型为菜单) + else if (isMenuFrame(menu)) + { + routerPath = "/"; + } + return routerPath; + } + + /** + * 获取组件信息 + * + * @param menu 菜单信息 + * @return 组件信息 + */ + public String getComponent(SysMenu menu) + { + String component = UserConstants.LAYOUT; + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) + { + component = menu.getComponent(); + } + else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParentId().intValue() != 0 && isInnerLink(menu)) + { + component = UserConstants.INNER_LINK; + } + else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) + { + component = UserConstants.PARENT_VIEW; + } + return component; + } + + /** + * 是否为菜单内部跳转 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isMenuFrame(SysMenu menu) + { + return menu.getParentId().intValue() == 0 && UserConstants.TYPE_MENU.equals(menu.getMenuType()) + && menu.getIsFrame().equals(UserConstants.NO_FRAME); + } + + /** + * 是否为内链组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isInnerLink(SysMenu menu) + { + return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath()); + } + + /** + * 是否为parent_view组件 + * + * @param menu 菜单信息 + * @return 结果 + */ + public boolean isParentView(SysMenu menu) + { + return menu.getParentId().intValue() != 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()); + } + /** * 根据父节点的ID获取所有子节点 * @@ -365,8 +475,8 @@ public class SysMenuServiceImpl implements ISysMenuService /** * 递归列表 * - * @param list - * @param t + * @param list 分类表 + * @param t 子节点 */ private void recursionFn(List list, SysMenu t) { @@ -407,4 +517,15 @@ public class SysMenuServiceImpl implements ISysMenuService { return getChildList(list, t).size() > 0; } + + /** + * 内链域名特殊字符替换 + * + * @return 替换后的内链域名 + */ + public String innerLinkReplaceEach(String path) + { + return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", ":" }, + new String[] { "", "", "", "/", "/" }); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index 0f4814d0a..8bebd9c69 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.service.ISysNoticeService; @@ -12,7 +11,6 @@ import com.ruoyi.system.service.ISysNoticeService; * 公告 服务层实现 * * @author ruoyi - * @date 2018-06-25 */ @Service public class SysNoticeServiceImpl implements ISysNoticeService @@ -71,12 +69,24 @@ public class SysNoticeServiceImpl implements ISysNoticeService /** * 删除公告对象 * - * @param ids 需要删除的数据ID + * @param noticeId 公告ID * @return 结果 */ @Override - public int deleteNoticeByIds(String ids) + public int deleteNoticeById(Long noticeId) { - return noticeMapper.deleteNoticeByIds(Convert.toStrArray(ids)); + return noticeMapper.deleteNoticeById(noticeId); + } + + /** + * 批量删除公告信息 + * + * @param noticeIds 需要删除的公告ID + * @return 结果 + */ + @Override + public int deleteNoticeByIds(Long[] noticeIds) + { + return noticeMapper.deleteNoticeByIds(noticeIds); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java index c79668b2e..785ee1ed7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -3,7 +3,6 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.mapper.SysOperLogMapper; import com.ruoyi.system.service.ISysOperLogService; @@ -45,13 +44,13 @@ public class SysOperLogServiceImpl implements ISysOperLogService /** * 批量删除系统操作日志 * - * @param ids 需要删除的数据 - * @return + * @param operIds 需要删除的操作日志ID + * @return 结果 */ @Override - public int deleteOperLogByIds(String ids) + public int deleteOperLogByIds(Long[] operIds) { - return operLogMapper.deleteOperLogByIds(Convert.toStrArray(ids)); + return operLogMapper.deleteOperLogByIds(operIds); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index b005f29f7..57995eb0a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysPost; @@ -49,31 +48,6 @@ public class SysPostServiceImpl implements ISysPostService return postMapper.selectPostAll(); } - /** - * 根据用户ID查询岗位 - * - * @param userId 用户ID - * @return 岗位列表 - */ - @Override - public List selectPostsByUserId(Long userId) - { - List userPosts = postMapper.selectPostsByUserId(userId); - List posts = postMapper.selectPostAll(); - for (SysPost post : posts) - { - for (SysPost userRole : userPosts) - { - if (post.getPostId().longValue() == userRole.getPostId().longValue()) - { - post.setFlag(true); - break; - } - } - } - return posts; - } - /** * 通过岗位ID查询岗位信息 * @@ -87,60 +61,15 @@ public class SysPostServiceImpl implements ISysPostService } /** - * 批量删除岗位信息 + * 根据用户ID获取岗位选择框列表 * - * @param ids 需要删除的数据ID - * @return 结果 + * @param userId 用户ID + * @return 选中岗位ID列表 */ @Override - public int deletePostByIds(String ids) + public List selectPostListByUserId(Long userId) { - Long[] postIds = Convert.toLongArray(ids); - for (Long postId : postIds) - { - SysPost post = selectPostById(postId); - if (countUserPostById(postId) > 0) - { - throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName())); - } - } - return postMapper.deletePostByIds(postIds); - } - - /** - * 新增保存岗位信息 - * - * @param post 岗位信息 - * @return 结果 - */ - @Override - public int insertPost(SysPost post) - { - return postMapper.insertPost(post); - } - - /** - * 修改保存岗位信息 - * - * @param post 岗位信息 - * @return 结果 - */ - @Override - public int updatePost(SysPost post) - { - return postMapper.updatePost(post); - } - - /** - * 通过岗位ID查询岗位使用数量 - * - * @param postId 岗位ID - * @return 结果 - */ - @Override - public int countUserPostById(Long postId) - { - return userPostMapper.countUserPostById(postId); + return postMapper.selectPostListByUserId(userId); } /** @@ -178,4 +107,72 @@ public class SysPostServiceImpl implements ISysPostService } return UserConstants.UNIQUE; } + + /** + * 通过岗位ID查询岗位使用数量 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int countUserPostById(Long postId) + { + return userPostMapper.countUserPostById(postId); + } + + /** + * 删除岗位信息 + * + * @param postId 岗位ID + * @return 结果 + */ + @Override + public int deletePostById(Long postId) + { + return postMapper.deletePostById(postId); + } + + /** + * 批量删除岗位信息 + * + * @param postIds 需要删除的岗位ID + * @return 结果 + */ + @Override + public int deletePostByIds(Long[] postIds) + { + for (Long postId : postIds) + { + SysPost post = selectPostById(postId); + if (countUserPostById(postId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName())); + } + } + return postMapper.deletePostByIds(postIds); + } + + /** + * 新增保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int insertPost(SysPost post) + { + return postMapper.insertPost(post); + } + + /** + * 修改保存岗位信息 + * + * @param post 岗位信息 + * @return 结果 + */ + @Override + public int updatePost(SysPost post) + { + return postMapper.updatePost(post); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 5c55b93d4..5e0a02dad 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -12,9 +12,8 @@ import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.SysRoleDept; @@ -59,27 +58,6 @@ public class SysRoleServiceImpl implements ISysRoleService return roleMapper.selectRoleList(role); } - /** - * 根据用户ID查询权限 - * - * @param userId 用户ID - * @return 权限列表 - */ - @Override - public Set selectRoleKeys(Long userId) - { - List perms = roleMapper.selectRolesByUserId(userId); - Set permsSet = new HashSet<>(); - for (SysRole perm : perms) - { - if (StringUtils.isNotNull(perm)) - { - permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); - } - } - return permsSet; - } - /** * 根据用户ID查询角色 * @@ -89,7 +67,7 @@ public class SysRoleServiceImpl implements ISysRoleService @Override public List selectRolesByUserId(Long userId) { - List userRoles = roleMapper.selectRolesByUserId(userId); + List userRoles = roleMapper.selectRolePermissionByUserId(userId); List roles = selectRoleAll(); for (SysRole role : roles) { @@ -105,6 +83,27 @@ public class SysRoleServiceImpl implements ISysRoleService return roles; } + /** + * 根据用户ID查询权限 + * + * @param userId 用户ID + * @return 权限列表 + */ + @Override + public Set selectRolePermissionByUserId(Long userId) + { + List perms = roleMapper.selectRolePermissionByUserId(userId); + Set permsSet = new HashSet<>(); + for (SysRole perm : perms) + { + if (StringUtils.isNotNull(perm)) + { + permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); + } + } + return permsSet; + } + /** * 查询所有角色 * @@ -116,6 +115,18 @@ public class SysRoleServiceImpl implements ISysRoleService return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); } + /** + * 根据用户ID获取角色选择框列表 + * + * @param userId 用户ID + * @return 选中角色ID列表 + */ + @Override + public List selectRoleListByUserId(Long userId) + { + return roleMapper.selectRoleListByUserId(userId); + } + /** * 通过角色ID查询角色 * @@ -129,48 +140,85 @@ public class SysRoleServiceImpl implements ISysRoleService } /** - * 通过角色ID删除角色 + * 校验角色名称是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public boolean checkRoleNameUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色权限是否唯一 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public boolean checkRoleKeyUnique(SysRole role) + { + Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); + SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); + if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) + { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验角色是否允许操作 + * + * @param role 角色信息 + */ + @Override + public void checkRoleAllowed(SysRole role) + { + if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) + { + throw new ServiceException("不允许操作超级管理员角色"); + } + } + + /** + * 校验角色是否有数据权限 + * + * @param roleId 角色id + */ + @Override + public void checkRoleDataScope(Long roleId) + { + if (!SysUser.isAdmin(SecurityUtils.getUserId())) + { + SysRole role = new SysRole(); + role.setRoleId(roleId); + List roles = SpringUtils.getAopProxy(this).selectRoleList(role); + if (StringUtils.isEmpty(roles)) + { + throw new ServiceException("没有权限访问角色数据!"); + } + } + } + + /** + * 通过角色ID查询角色使用数量 * * @param roleId 角色ID * @return 结果 */ @Override - @Transactional - public boolean deleteRoleById(Long roleId) + public int countUserRoleByRoleId(Long roleId) { - // 删除角色与菜单关联 - roleMenuMapper.deleteRoleMenuByRoleId(roleId); - // 删除角色与部门关联 - roleDeptMapper.deleteRoleDeptByRoleId(roleId); - return roleMapper.deleteRoleById(roleId) > 0 ? true : false; - } - - /** - * 批量删除角色信息 - * - * @param ids 需要删除的数据ID - * @throws Exception - */ - @Override - @Transactional - public int deleteRoleByIds(String ids) - { - Long[] roleIds = Convert.toLongArray(ids); - for (Long roleId : roleIds) - { - checkRoleAllowed(new SysRole(roleId)); - checkRoleDataScope(roleId); - SysRole role = selectRoleById(roleId); - if (countUserRoleByRoleId(roleId) > 0) - { - throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); - } - } - // 删除角色与菜单关联 - roleMenuMapper.deleteRoleMenu(roleIds); - // 删除角色与部门关联 - roleDeptMapper.deleteRoleDept(roleIds); - return roleMapper.deleteRoleByIds(roleIds); + return userRoleMapper.countUserRoleByRoleId(roleId); } /** @@ -205,6 +253,18 @@ public class SysRoleServiceImpl implements ISysRoleService return insertRoleMenu(role); } + /** + * 修改角色状态 + * + * @param role 角色信息 + * @return 结果 + */ + @Override + public int updateRoleStatus(SysRole role) + { + return roleMapper.updateRole(role); + } + /** * 修改数据权限信息 * @@ -272,97 +332,47 @@ public class SysRoleServiceImpl implements ISysRoleService } /** - * 校验角色名称是否唯一 - * - * @param role 角色信息 - * @return 结果 - */ - @Override - public boolean checkRoleNameUnique(SysRole role) - { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); - SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) - { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } - - /** - * 校验角色权限是否唯一 - * - * @param role 角色信息 - * @return 结果 - */ - @Override - public boolean checkRoleKeyUnique(SysRole role) - { - Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); - SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) - { - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } - - /** - * 校验角色是否允许操作 - * - * @param role 角色信息 - */ - @Override - public void checkRoleAllowed(SysRole role) - { - if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) - { - throw new ServiceException("不允许操作超级管理员角色"); - } - } - - /** - * 校验角色是否有数据权限 - * - * @param roleId 角色id - */ - @Override - public void checkRoleDataScope(Long roleId) - { - if (!SysUser.isAdmin(ShiroUtils.getUserId())) - { - SysRole role = new SysRole(); - role.setRoleId(roleId); - List roles = SpringUtils.getAopProxy(this).selectRoleList(role); - if (StringUtils.isEmpty(roles)) - { - throw new ServiceException("没有权限访问角色数据!"); - } - } - } - - /** - * 通过角色ID查询角色使用数量 + * 通过角色ID删除角色 * * @param roleId 角色ID * @return 结果 */ @Override - public int countUserRoleByRoleId(Long roleId) + @Transactional + public int deleteRoleById(Long roleId) { - return userRoleMapper.countUserRoleByRoleId(roleId); + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenuByRoleId(roleId); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDeptByRoleId(roleId); + return roleMapper.deleteRoleById(roleId); } /** - * 角色状态修改 + * 批量删除角色信息 * - * @param role 角色信息 + * @param roleIds 需要删除的角色ID * @return 结果 */ @Override - public int changeStatus(SysRole role) + @Transactional + public int deleteRoleByIds(Long[] roleIds) { - return roleMapper.updateRole(role); + for (Long roleId : roleIds) + { + checkRoleAllowed(new SysRole(roleId)); + checkRoleDataScope(roleId); + SysRole role = selectRoleById(roleId); + if (countUserRoleByRoleId(roleId) > 0) + { + throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); + } + } + // 删除角色与菜单关联 + roleMenuMapper.deleteRoleMenu(roleIds); + // 删除角色与部门关联 + roleDeptMapper.deleteRoleDept(roleIds); + return roleMapper.deleteRoleByIds(roleIds); } /** @@ -381,13 +391,13 @@ public class SysRoleServiceImpl implements ISysRoleService * 批量取消授权用户角色 * * @param roleId 角色ID - * @param userIds 需要删除的用户数据ID + * @param userIds 需要取消授权的用户数据ID * @return 结果 */ @Override - public int deleteAuthUsers(Long roleId, String userIds) + public int deleteAuthUsers(Long roleId, Long[] userIds) { - return userRoleMapper.deleteUserRoleInfos(roleId, Convert.toLongArray(userIds)); + return userRoleMapper.deleteUserRoleInfos(roleId, userIds); } /** @@ -398,12 +408,11 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override - public int insertAuthUsers(Long roleId, String userIds) + public int insertAuthUsers(Long roleId, Long[] userIds) { - Long[] users = Convert.toLongArray(userIds); // 新增用户与角色管理 List list = new ArrayList(); - for (Long userId : users) + for (Long userId : userIds) { SysUserRole ur = new SysUserRole(); ur.setUserId(userId); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java index a71dc17ad..347837bc5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserOnlineServiceImpl.java @@ -1,19 +1,9 @@ package com.ruoyi.system.service.impl; -import java.io.Serializable; -import java.util.Date; -import java.util.Deque; -import java.util.List; -import com.ruoyi.common.utils.spring.SpringUtils; -import org.apache.shiro.cache.Cache; -import org.apache.shiro.cache.ehcache.EhCacheManager; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.constant.ShiroConstants; -import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysUserOnline; -import com.ruoyi.system.mapper.SysUserOnlineMapper; import com.ruoyi.system.service.ISysUserOnlineService; /** @@ -24,117 +14,83 @@ import com.ruoyi.system.service.ISysUserOnlineService; @Service public class SysUserOnlineServiceImpl implements ISysUserOnlineService { - @Autowired - private SysUserOnlineMapper userOnlineDao; - /** - * 通过会话序号查询信息 + * 通过登录地址查询信息 * - * @param sessionId 会话ID + * @param ipaddr 登录地址 + * @param user 用户信息 * @return 在线用户信息 */ @Override - public SysUserOnline selectOnlineById(String sessionId) + public SysUserOnline selectOnlineByIpaddr(String ipaddr, LoginUser user) { - return userOnlineDao.selectOnlineById(sessionId); + if (StringUtils.equals(ipaddr, user.getIpaddr())) + { + return loginUserToUserOnline(user); + } + return null; } /** - * 通过会话序号删除信息 + * 通过用户名称查询信息 * - * @param sessionId 会话ID + * @param userName 用户名称 + * @param user 用户信息 * @return 在线用户信息 */ @Override - public void deleteOnlineById(String sessionId) + public SysUserOnline selectOnlineByUserName(String userName, LoginUser user) { - SysUserOnline userOnline = selectOnlineById(sessionId); - if (StringUtils.isNotNull(userOnline)) + if (StringUtils.equals(userName, user.getUsername())) { - userOnlineDao.deleteOnlineById(sessionId); + return loginUserToUserOnline(user); } + return null; } /** - * 通过会话序号删除信息 + * 通过登录地址/用户名称查询信息 * - * @param sessions 会话ID集合 + * @param ipaddr 登录地址 + * @param userName 用户名称 + * @param user 用户信息 * @return 在线用户信息 */ @Override - public void batchDeleteOnline(List sessions) + public SysUserOnline selectOnlineByInfo(String ipaddr, String userName, LoginUser user) { - for (String sessionId : sessions) + if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername())) { - SysUserOnline userOnline = selectOnlineById(sessionId); - if (StringUtils.isNotNull(userOnline)) - { - userOnlineDao.deleteOnlineById(sessionId); - } + return loginUserToUserOnline(user); } + return null; } /** - * 保存会话信息 + * 设置在线用户信息 * - * @param online 会话信息 + * @param user 用户信息 + * @return 在线用户 */ @Override - public void saveOnline(SysUserOnline online) + public SysUserOnline loginUserToUserOnline(LoginUser user) { - userOnlineDao.saveOnline(online); - } - - /** - * 查询会话集合 - * - * @param userOnline 在线用户 - */ - @Override - public List selectUserOnlineList(SysUserOnline userOnline) - { - return userOnlineDao.selectUserOnlineList(userOnline); - } - - /** - * 强退用户 - * - * @param sessionId 会话ID - */ - @Override - public void forceLogout(String sessionId) - { - userOnlineDao.deleteOnlineById(sessionId); - } - - /** - * 清理用户缓存 - * - * @param loginName 登录名称 - * @param sessionId 会话ID - */ - @Override - public void removeUserCache(String loginName, String sessionId) - { - EhCacheManager ehCacheManager = SpringUtils.getBean(EhCacheManager.class); - Cache> cache = ehCacheManager.getCache(ShiroConstants.SYS_USERCACHE); - Deque deque = cache.get(loginName); - if (StringUtils.isEmpty(deque) || deque.size() == 0) + if (StringUtils.isNull(user) || StringUtils.isNull(user.getUser())) { - return; + return null; } - deque.remove(sessionId); - } - - /** - * 查询会话集合 - * - * @param expiredDate 失效日期 - */ - @Override - public List selectOnlineByExpired(Date expiredDate) - { - String lastAccessTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, expiredDate); - return userOnlineDao.selectOnlineByExpired(lastAccessTime); + SysUserOnline sysUserOnline = new SysUserOnline(); + sysUserOnline.setTokenId(user.getToken()); + sysUserOnline.setUserName(user.getUsername()); + sysUserOnline.setIpaddr(user.getIpaddr()); + sysUserOnline.setLoginLocation(user.getLoginLocation()); + sysUserOnline.setBrowser(user.getBrowser()); + sysUserOnline.setOs(user.getOs()); + sysUserOnline.setLoginTime(user.getLoginTime()); + if (StringUtils.isNotNull(user.getUser().getDept())) + { + sysUserOnline.setDeptName(user.getUser().getDept().getDeptName()); + } + return sysUserOnline; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 3c7970c85..09f3fb934 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -14,12 +14,10 @@ import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysUser; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanValidators; -import com.ruoyi.common.utils.security.Md5Utils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysUserPost; @@ -52,10 +50,10 @@ public class SysUserServiceImpl implements ISysUserService private SysPostMapper postMapper; @Autowired - private SysUserPostMapper userPostMapper; + private SysUserRoleMapper userRoleMapper; @Autowired - private SysUserRoleMapper userRoleMapper; + private SysUserPostMapper userPostMapper; @Autowired private ISysConfigService configService; @@ -109,33 +107,9 @@ public class SysUserServiceImpl implements ISysUserService * @return 用户对象信息 */ @Override - public SysUser selectUserByLoginName(String userName) + public SysUser selectUserByUserName(String userName) { - return userMapper.selectUserByLoginName(userName); - } - - /** - * 通过手机号码查询用户 - * - * @param phoneNumber 手机号码 - * @return 用户对象信息 - */ - @Override - public SysUser selectUserByPhoneNumber(String phoneNumber) - { - return userMapper.selectUserByPhoneNumber(phoneNumber); - } - - /** - * 通过邮箱查询用户 - * - * @param email 邮箱 - * @return 用户对象信息 - */ - @Override - public SysUser selectUserByEmail(String email) - { - return userMapper.selectUserByEmail(email); + return userMapper.selectUserByUserName(userName); } /** @@ -151,199 +125,37 @@ public class SysUserServiceImpl implements ISysUserService } /** - * 通过用户ID查询用户和角色关联 + * 查询用户所属角色组 * - * @param userId 用户ID - * @return 用户和角色关联列表 - */ - @Override - public List selectUserRoleByUserId(Long userId) - { - return userRoleMapper.selectUserRoleByUserId(userId); - } - - /** - * 通过用户ID删除用户 - * - * @param userId 用户ID + * @param userName 用户名 * @return 结果 */ @Override - @Transactional - public int deleteUserById(Long userId) + public String selectUserRoleGroup(String userName) { - // 删除用户与角色关联 - userRoleMapper.deleteUserRoleByUserId(userId); - // 删除用户与岗位表 - userPostMapper.deleteUserPostByUserId(userId); - return userMapper.deleteUserById(userId); - } - - /** - * 批量删除用户信息 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ - @Override - @Transactional - public int deleteUserByIds(String ids) - { - Long[] userIds = Convert.toLongArray(ids); - for (Long userId : userIds) + List list = roleMapper.selectRolesByUserName(userName); + if (CollectionUtils.isEmpty(list)) { - checkUserAllowed(new SysUser(userId)); - checkUserDataScope(userId); + return StringUtils.EMPTY; } - // 删除用户与角色关联 - userRoleMapper.deleteUserRole(userIds); - // 删除用户与岗位关联 - userPostMapper.deleteUserPost(userIds); - return userMapper.deleteUserByIds(userIds); + return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); } /** - * 新增保存用户信息 + * 查询用户所属岗位组 * - * @param user 用户信息 + * @param userName 用户名 * @return 结果 */ @Override - @Transactional - public int insertUser(SysUser user) + public String selectUserPostGroup(String userName) { - // 新增用户信息 - int rows = userMapper.insertUser(user); - // 新增用户岗位关联 - insertUserPost(user); - // 新增用户与角色管理 - insertUserRole(user.getUserId(), user.getRoleIds()); - return rows; - } - - /** - * 注册用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - @Override - public boolean registerUser(SysUser user) - { - user.setUserType(UserConstants.REGISTER_USER_TYPE); - return userMapper.insertUser(user) > 0; - } - - /** - * 修改保存用户信息 - * - * @param user 用户信息 - * @return 结果 - */ - @Override - @Transactional - public int updateUser(SysUser user) - { - Long userId = user.getUserId(); - // 删除用户与角色关联 - userRoleMapper.deleteUserRoleByUserId(userId); - // 新增用户与角色管理 - insertUserRole(user.getUserId(), user.getRoleIds()); - // 删除用户与岗位关联 - userPostMapper.deleteUserPostByUserId(userId); - // 新增用户与岗位管理 - insertUserPost(user); - return userMapper.updateUser(user); - } - - /** - * 修改用户个人详细信息 - * - * @param user 用户信息 - * @return 结果 - */ - @Override - public int updateUserInfo(SysUser user) - { - return userMapper.updateUser(user); - } - - /** - * 用户授权角色 - * - * @param userId 用户ID - * @param roleIds 角色组 - */ - @Override - @Transactional - public void insertUserAuth(Long userId, Long[] roleIds) - { - userRoleMapper.deleteUserRoleByUserId(userId); - insertUserRole(userId, roleIds); - } - - /** - * 修改用户密码 - * - * @param user 用户信息 - * @return 结果 - */ - @Override - public int resetUserPwd(SysUser user) - { - return updateUserInfo(user); - } - - /** - * 新增用户角色信息 - * - * @param userId 用户ID - * @param roleIds 角色组 - */ - public void insertUserRole(Long userId, Long[] roleIds) - { - if (StringUtils.isNotNull(roleIds)) + List list = postMapper.selectPostsByUserName(userName); + if (CollectionUtils.isEmpty(list)) { - // 新增用户与角色管理 - List list = new ArrayList(); - for (Long roleId : roleIds) - { - SysUserRole ur = new SysUserRole(); - ur.setUserId(userId); - ur.setRoleId(roleId); - list.add(ur); - } - if (list.size() > 0) - { - userRoleMapper.batchUserRole(list); - } - } - } - - /** - * 新增用户岗位信息 - * - * @param user 用户对象 - */ - public void insertUserPost(SysUser user) - { - Long[] posts = user.getPostIds(); - if (StringUtils.isNotNull(posts)) - { - // 新增用户与岗位管理 - List list = new ArrayList(); - for (Long postId : posts) - { - SysUserPost up = new SysUserPost(); - up.setUserId(user.getUserId()); - up.setPostId(postId); - list.add(up); - } - if (list.size() > 0) - { - userPostMapper.batchUserPost(list); - } + return StringUtils.EMPTY; } + return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); } /** @@ -353,10 +165,10 @@ public class SysUserServiceImpl implements ISysUserService * @return 结果 */ @Override - public boolean checkLoginNameUnique(SysUser user) + public boolean checkUserNameUnique(SysUser user) { Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId(); - SysUser info = userMapper.checkLoginNameUnique(user.getLoginName()); + SysUser info = userMapper.checkUserNameUnique(user.getUserName()); if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { return UserConstants.NOT_UNIQUE; @@ -422,7 +234,7 @@ public class SysUserServiceImpl implements ISysUserService @Override public void checkUserDataScope(Long userId) { - if (!SysUser.isAdmin(ShiroUtils.getUserId())) + if (!SysUser.isAdmin(SecurityUtils.getUserId())) { SysUser user = new SysUser(); user.setUserId(userId); @@ -435,37 +247,227 @@ public class SysUserServiceImpl implements ISysUserService } /** - * 查询用户所属角色组 + * 新增保存用户信息 * - * @param userId 用户ID + * @param user 用户信息 * @return 结果 */ @Override - public String selectUserRoleGroup(Long userId) + @Transactional + public int insertUser(SysUser user) { - List list = roleMapper.selectRolesByUserId(userId); - if (CollectionUtils.isEmpty(list)) - { - return StringUtils.EMPTY; - } - return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(",")); + // 新增用户信息 + int rows = userMapper.insertUser(user); + // 新增用户岗位关联 + insertUserPost(user); + // 新增用户与角色管理 + insertUserRole(user); + return rows; } /** - * 查询用户所属岗位组 + * 注册用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public boolean registerUser(SysUser user) + { + return userMapper.insertUser(user) > 0; + } + + /** + * 修改保存用户信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + @Transactional + public int updateUser(SysUser user) + { + Long userId = user.getUserId(); + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 新增用户与角色管理 + insertUserRole(user); + // 删除用户与岗位关联 + userPostMapper.deleteUserPostByUserId(userId); + // 新增用户与岗位管理 + insertUserPost(user); + return userMapper.updateUser(user); + } + + /** + * 用户授权角色 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + @Override + @Transactional + public void insertUserAuth(Long userId, Long[] roleIds) + { + userRoleMapper.deleteUserRoleByUserId(userId); + insertUserRole(userId, roleIds); + } + + /** + * 修改用户状态 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserStatus(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 修改用户基本信息 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int updateUserProfile(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 修改用户头像 + * + * @param userName 用户名 + * @param avatar 头像地址 + * @return 结果 + */ + @Override + public boolean updateUserAvatar(String userName, String avatar) + { + return userMapper.updateUserAvatar(userName, avatar) > 0; + } + + /** + * 重置用户密码 + * + * @param user 用户信息 + * @return 结果 + */ + @Override + public int resetPwd(SysUser user) + { + return userMapper.updateUser(user); + } + + /** + * 重置用户密码 + * + * @param userName 用户名 + * @param password 密码 + * @return 结果 + */ + @Override + public int resetUserPwd(String userName, String password) + { + return userMapper.resetUserPwd(userName, password); + } + + /** + * 新增用户角色信息 + * + * @param user 用户对象 + */ + public void insertUserRole(SysUser user) + { + this.insertUserRole(user.getUserId(), user.getRoleIds()); + } + + /** + * 新增用户岗位信息 + * + * @param user 用户对象 + */ + public void insertUserPost(SysUser user) + { + Long[] posts = user.getPostIds(); + if (StringUtils.isNotEmpty(posts)) + { + // 新增用户与岗位管理 + List list = new ArrayList(posts.length); + for (Long postId : posts) + { + SysUserPost up = new SysUserPost(); + up.setUserId(user.getUserId()); + up.setPostId(postId); + list.add(up); + } + userPostMapper.batchUserPost(list); + } + } + + /** + * 新增用户角色信息 + * + * @param userId 用户ID + * @param roleIds 角色组 + */ + public void insertUserRole(Long userId, Long[] roleIds) + { + if (StringUtils.isNotEmpty(roleIds)) + { + // 新增用户与角色管理 + List list = new ArrayList(roleIds.length); + for (Long roleId : roleIds) + { + SysUserRole ur = new SysUserRole(); + ur.setUserId(userId); + ur.setRoleId(roleId); + list.add(ur); + } + userRoleMapper.batchUserRole(list); + } + } + + /** + * 通过用户ID删除用户 * * @param userId 用户ID * @return 结果 */ @Override - public String selectUserPostGroup(Long userId) + @Transactional + public int deleteUserById(Long userId) { - List list = postMapper.selectPostsByUserId(userId); - if (CollectionUtils.isEmpty(list)) + // 删除用户与角色关联 + userRoleMapper.deleteUserRoleByUserId(userId); + // 删除用户与岗位表 + userPostMapper.deleteUserPostByUserId(userId); + return userMapper.deleteUserById(userId); + } + + /** + * 批量删除用户信息 + * + * @param userIds 需要删除的用户ID + * @return 结果 + */ + @Override + @Transactional + public int deleteUserByIds(Long[] userIds) + { + for (Long userId : userIds) { - return StringUtils.EMPTY; + checkUserAllowed(new SysUser(userId)); + checkUserDataScope(userId); } - return list.stream().map(SysPost::getPostName).collect(Collectors.joining(",")); + // 删除用户与角色关联 + userRoleMapper.deleteUserRole(userIds); + // 删除用户与岗位关联 + userPostMapper.deleteUserPost(userIds); + return userMapper.deleteUserByIds(userIds); } /** @@ -493,15 +495,15 @@ public class SysUserServiceImpl implements ISysUserService try { // 验证是否存在这个用户 - SysUser u = userMapper.selectUserByLoginName(user.getLoginName()); + SysUser u = userMapper.selectUserByUserName(user.getUserName()); if (StringUtils.isNull(u)) { BeanValidators.validateWithException(validator, user); - user.setPassword(Md5Utils.hash(user.getLoginName() + password)); + user.setPassword(SecurityUtils.encryptPassword(password)); user.setCreateBy(operName); userMapper.insertUser(user); successNum++; - successMsg.append("
    " + successNum + "、账号 " + user.getLoginName() + " 导入成功"); + successMsg.append("
    " + successNum + "、账号 " + user.getUserName() + " 导入成功"); } else if (isUpdateSupport) { @@ -512,18 +514,18 @@ public class SysUserServiceImpl implements ISysUserService user.setUpdateBy(operName); userMapper.updateUser(user); successNum++; - successMsg.append("
    " + successNum + "、账号 " + user.getLoginName() + " 更新成功"); + successMsg.append("
    " + successNum + "、账号 " + user.getUserName() + " 更新成功"); } else { failureNum++; - failureMsg.append("
    " + failureNum + "、账号 " + user.getLoginName() + " 已存在"); + failureMsg.append("
    " + failureNum + "、账号 " + user.getUserName() + " 已存在"); } } catch (Exception e) { failureNum++; - String msg = "
    " + failureNum + "、账号 " + user.getLoginName() + " 导入失败:"; + String msg = "
    " + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; failureMsg.append(msg + e.getMessage()); log.error(msg, e); } @@ -539,16 +541,4 @@ public class SysUserServiceImpl implements ISysUserService } return successMsg.toString(); } - - /** - * 用户状态修改 - * - * @param user 用户信息 - * @return 结果 - */ - @Override - public int changeStatus(SysUser user) - { - return userMapper.updateUser(user); - } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml index 5ea755a69..c21169278 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml @@ -60,10 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + where config_id = #{configId} + + - select concat(d.dept_id, d.dept_name) as dept_name - from sys_dept d - left join sys_role_dept rd on d.dept_id = rd.dept_id - where d.del_flag = '0' and rd.role_id = #{roleId} - order by d.parent_id, d.order_num - - - - + select d.dept_id + from sys_dept d + left join sys_role_dept rd on d.dept_id = rd.dept_id + where rd.role_id = #{roleId} + + and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) + + order by d.parent_id, d.order_num - - - - - - select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, (select dept_name from sys_dept where dept_id = d.parent_id) parent_name from sys_dept d where d.dept_id = #{deptId} - + + + + + @@ -86,7 +82,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors) - + + + insert into sys_dept( dept_id, parent_id, @@ -142,17 +143,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" separator="," open="(" close=")"> #{item.deptId} - - - - update sys_dept set del_flag = '2' where dept_id = #{deptId} - - + + update sys_dept set status = '0' where dept_id in #{deptId} + + + update sys_dept set del_flag = '2' where dept_id = #{deptId} + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml index aebd9b4f6..75d80a157 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND status = #{status} + order by dict_sort asc - select info_id,login_name,ipaddr,login_location,browser,os,status,msg,login_time from sys_logininfor + select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time from sys_logininfor AND ipaddr like concat('%', #{ipaddr}, '%') @@ -30,8 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND status = #{status} - - AND login_name like concat('%', #{loginName}, '%') + + AND user_name like concat('%', #{userName}, '%') AND login_time >= #{params.beginTime} @@ -40,9 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND login_time <= #{params.endTime} + order by info_id desc - + delete from sys_logininfor where info_id in #{infoId} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index be4ef1a43..e90f6baf0 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -10,11 +10,14 @@ - - + + + + + - + @@ -25,67 +28,11 @@ - select menu_id, menu_name, parent_id, order_num, url, target, menu_type, visible, is_refresh, ifnull(perms,'') as perms, icon, create_by, create_time + select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time from sys_menu - - - - - - - - - - - - - - - - @@ -94,60 +41,114 @@ AND visible = #{visible} + + AND status = #{status} + order by parent_id, order_num - + + + + + + + + + - - delete from sys_menu where menu_id = #{menuId} or parent_id = #{menuId} - - + + + + - - + select count(1) from sys_menu where parent_id = #{menuId} - + - + update sys_menu menu_name = #{menuName}, - parent_id = #{parentId}, + parent_id = #{parentId}, order_num = #{orderNum}, - url = #{url}, - target = #{target}, + path = #{path}, + component = #{component}, + `query` = #{query}, + is_frame = #{isFrame}, + is_cache = #{isCache}, menu_type = #{menuType}, visible = #{visible}, - is_refresh = #{isRefresh}, + status = #{status}, perms = #{perms}, icon = #{icon}, - remark = #{remark}, + remark = #{remark}, update_by = #{updateBy}, update_time = sysdate() @@ -160,11 +161,14 @@ parent_id, menu_name, order_num, - url, - target, + path, + component, + `query`, + is_frame, + is_cache, menu_type, visible, - is_refresh, + status, perms, icon, remark, @@ -175,11 +179,14 @@ #{parentId}, #{menuName}, #{orderNum}, - #{url}, - #{target}, + #{path}, + #{component}, + #{query}, + #{isFrame}, + #{isCache}, #{menuType}, #{visible}, - #{isRefresh}, + #{status}, #{perms}, #{icon}, #{remark}, @@ -187,5 +194,9 @@ sysdate() ) + + + delete from sys_menu where menu_id = #{menuId} + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml index c2037c9ee..6915a1482 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -75,7 +75,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where notice_id = #{noticeId} - + + delete from sys_notice where notice_id = #{noticeId} + + + delete from sys_notice where notice_id in #{noticeId} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml index ed050e86c..0c3fb691f 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -65,9 +65,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND oper_time <= #{params.endTime} + order by oper_id desc - + delete from sys_oper_log where oper_id in #{operId} diff --git a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml index 7aaa5a6a0..faefb2f07 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml @@ -41,19 +41,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + + + + - - delete from sys_post where post_id in - - #{postId} - - - - + update sys_post post_code = #{postCode}, post_name = #{postName}, - post_sort = #{postSort}, + post_sort = #{postSort}, status = #{status}, remark = #{remark}, update_by = #{updateBy}, @@ -90,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" post_id, post_code, post_name, - post_sort, + post_sort, status, remark, create_by, @@ -99,12 +100,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{postId}, #{postCode}, #{postName}, - #{postSort}, + #{postSort}, #{status}, #{remark}, #{createBy}, sysdate() ) + + + delete from sys_post where post_id = #{postId} + + + + delete from sys_post where post_id in + + #{postId} + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml index 7d2565042..ab601e4b5 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -5,22 +5,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - - - + + + + + + + + + + + + + + - - select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, + + select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, r.status, r.del_flag, r.create_time, r.remark from sys_role r left join sys_user_role ur on ur.role_id = r.role_id @@ -28,13 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sys_dept d on u.dept_id = d.dept_id - - select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, r.del_flag, r.create_time, r.remark - from sys_role r - - - + where r.del_flag = '0' AND r.role_id = #{roleId} @@ -48,9 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND r.role_key like concat('%', #{roleKey}, '%') - - AND r.data_scope = #{dataScope} - and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') @@ -59,16 +53,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} + order by r.role_sort - - + WHERE r.del_flag = '0' and ur.user_id = #{userId} + + + + + + + + insert into sys_role( + role_id, + role_name, + role_key, + role_sort, + data_scope, + menu_check_strictly, + dept_check_strictly, + status, + remark, + create_by, + create_time + )values( + #{roleId}, + #{roleName}, + #{roleKey}, + #{roleSort}, + #{dataScope}, + #{menuCheckStrictly}, + #{deptCheckStrictly}, + #{status}, + #{remark}, + #{createBy}, + sysdate() + ) + + + + update sys_role + + role_name = #{roleName}, + role_key = #{roleKey}, + role_sort = #{roleSort}, + data_scope = #{dataScope}, + menu_check_strictly = #{menuCheckStrictly}, + dept_check_strictly = #{deptCheckStrictly}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = sysdate() + + where role_id = #{roleId} + + update sys_role set del_flag = '2' where role_id = #{roleId} @@ -92,43 +149,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - update sys_role - - role_name = #{roleName}, - role_key = #{roleKey}, - role_sort = #{roleSort}, - data_scope = #{dataScope}, - status = #{status}, - remark = #{remark}, - update_by = #{updateBy}, - update_time = sysdate() - - where role_id = #{roleId} - - - - insert into sys_role( - role_id, - role_name, - role_key, - role_sort, - data_scope, - status, - remark, - create_by, - create_time - )values( - #{roleId}, - #{roleName}, - #{roleKey}, - #{roleSort}, - #{dataScope}, - #{status}, - #{remark}, - #{createBy}, - sysdate() - ) - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml index f509d207e..e75bb1744 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -8,15 +8,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + delete from sys_role_menu where role_id=#{roleId} - - delete from sys_role_menu where role_id in diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index c7bfaf69f..eda0be227 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -4,70 +4,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - select u.user_id, u.dept_id, u.login_name, u.user_name, u.user_type, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt, 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 - left join sys_dept d on u.dept_id = d.dept_id - left join sys_user_role ur on u.user_id = ur.user_id - left join sys_role r on r.role_id = ur.role_id + 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.create_by, u.create_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 + left join sys_dept d on u.dept_id = d.dept_id + left join sys_user_role ur on u.user_id = ur.user_id + left join sys_role r on r.role_id = ur.role_id - - + select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u left join sys_dept d on u.dept_id = d.dept_id where u.del_flag = '0' AND u.user_id = #{userId} - - AND u.login_name like concat('%', #{loginName}, '%') + + AND u.user_name like concat('%', #{userName}, '%') AND u.status = #{status} @@ -82,21 +79,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') - AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) )) + AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) )) ${params.dataScope} - - where u.login_name = #{userName} and u.del_flag = '0' - - - - - - - - - - - + + + + + + + + insert into sys_user( + user_id, + dept_id, + user_name, + nick_name, + email, + avatar, + phonenumber, + sex, + password, + status, + create_by, + remark, + create_time + )values( + #{userId}, + #{deptId}, + #{userName}, + #{nickName}, + #{email}, + #{avatar}, + #{phonenumber}, + #{sex}, + #{password}, + #{status}, + #{createBy}, + #{remark}, + sysdate() + ) + + + + update sys_user + + dept_id = #{deptId}, + user_name = #{userName}, + nick_name = #{nickName}, + email = #{email}, + phonenumber = #{phonenumber}, + sex = #{sex}, + avatar = #{avatar}, + password = #{password}, + status = #{status}, + login_ip = #{loginIp}, + login_date = #{loginDate}, + update_by = #{updateBy}, + remark = #{remark}, + update_time = sysdate() + + where user_id = #{userId} + + + + update sys_user set status = #{status} where user_id = #{userId} + + + + update sys_user set avatar = #{avatar} where user_name = #{userName} + + + + update sys_user set password = #{password} where user_name = #{userName} + + update sys_user set del_flag = '2' where user_id = #{userId} @@ -165,67 +217,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{userId} - - - update sys_user - - dept_id = #{deptId}, - login_name = #{loginName}, - user_name = #{userName}, - user_type = #{userType}, - email = #{email}, - phonenumber = #{phonenumber}, - sex = #{sex}, - avatar = #{avatar}, - password = #{password}, - salt = #{salt}, - status = #{status}, - login_ip = #{loginIp}, - login_date = #{loginDate}, - pwd_update_date = #{pwdUpdateDate}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where user_id = #{userId} - - - - insert into sys_user( - user_id, - dept_id, - login_name, - user_name, - user_type, - email, - avatar, - phonenumber, - sex, - password, - salt, - status, - pwd_update_date, - create_by, - remark, - create_time - )values( - #{userId}, - #{deptId}, - #{loginName}, - #{userName}, - #{userType}, - #{email}, - #{avatar}, - #{phonenumber}, - #{sex}, - #{password}, - #{salt}, - #{status}, - #{pwdUpdateDate}, - #{createBy}, - #{remark}, - sysdate() - ) - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml deleted file mode 100644 index 92f684358..000000000 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserOnlineMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - select sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time - from sys_user_online - - - - - - replace into sys_user_online(sessionId, login_name, dept_name, ipaddr, login_location, browser, os, status, start_timestamp, last_access_time, expire_time) - values (#{sessionId}, #{loginName}, #{deptName}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{status}, #{startTimestamp}, #{lastAccessTime}, #{expireTime}) - - - - delete from sys_user_online where sessionId = #{sessionId} - - - - - - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml index b091ba757..95e07adb1 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -8,17 +8,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - delete from sys_user_role where user_id = #{userId} + delete from sys_user_role where user_id=#{userId} diff --git a/ruoyi-ui/.editorconfig b/ruoyi-ui/.editorconfig new file mode 100644 index 000000000..7034f9bf3 --- /dev/null +++ b/ruoyi-ui/.editorconfig @@ -0,0 +1,22 @@ +# 告诉EditorConfig插件,这是根文件,不用继续往上查找 +root = true + +# 匹配全部文件 +[*] +# 设置字符集 +charset = utf-8 +# 缩进风格,可选space、tab +indent_style = space +# 缩进的空格数 +indent_size = 2 +# 结尾换行符,可选lf、cr、crlf +end_of_line = lf +# 在文件结尾插入新行 +insert_final_newline = true +# 删除一行中的前后空格 +trim_trailing_whitespace = true + +# 匹配md结尾的文件 +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development new file mode 100644 index 000000000..302ecd1ab --- /dev/null +++ b/ruoyi-ui/.env.development @@ -0,0 +1,11 @@ +# 页面标题 +VUE_APP_TITLE = 若依管理系统 + +# 开发环境配置 +ENV = 'development' + +# 若依管理系统/开发环境 +VUE_APP_BASE_API = '/dev-api' + +# 路由懒加载 +VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production new file mode 100644 index 000000000..b4893b0d9 --- /dev/null +++ b/ruoyi-ui/.env.production @@ -0,0 +1,8 @@ +# 页面标题 +VUE_APP_TITLE = 若依管理系统 + +# 生产环境配置 +ENV = 'production' + +# 若依管理系统/生产环境 +VUE_APP_BASE_API = '/prod-api' diff --git a/ruoyi-ui/.env.staging b/ruoyi-ui/.env.staging new file mode 100644 index 000000000..361859f63 --- /dev/null +++ b/ruoyi-ui/.env.staging @@ -0,0 +1,10 @@ +# 页面标题 +VUE_APP_TITLE = 若依管理系统 + +NODE_ENV = production + +# 测试环境配置 +ENV = 'staging' + +# 若依管理系统/测试环境 +VUE_APP_BASE_API = '/stage-api' diff --git a/ruoyi-ui/.eslintignore b/ruoyi-ui/.eslintignore new file mode 100644 index 000000000..89be6f659 --- /dev/null +++ b/ruoyi-ui/.eslintignore @@ -0,0 +1,10 @@ +# 忽略build目录下类型为js的文件的语法检查 +build/*.js +# 忽略src/assets目录下文件的语法检查 +src/assets +# 忽略public目录下文件的语法检查 +public +# 忽略当前目录下为js的文件的语法检查 +*.js +# 忽略当前目录下为vue的文件的语法检查 +*.vue \ No newline at end of file diff --git a/ruoyi-ui/.eslintrc.js b/ruoyi-ui/.eslintrc.js new file mode 100644 index 000000000..82bbdeea6 --- /dev/null +++ b/ruoyi-ui/.eslintrc.js @@ -0,0 +1,199 @@ +// ESlint 检查配置 +module.exports = { + root: true, + parserOptions: { + parser: 'babel-eslint', + sourceType: 'module' + }, + env: { + browser: true, + node: true, + es6: true, + }, + extends: ['plugin:vue/recommended', 'eslint:recommended'], + + // add your custom rules here + //it is base on https://github.com/vuejs/eslint-config-vue + rules: { + "vue/max-attributes-per-line": [2, { + "singleline": 10, + "multiline": { + "max": 1, + "allowFirstLine": false + } + }], + "vue/singleline-html-element-content-newline": "off", + "vue/multiline-html-element-content-newline":"off", + "vue/name-property-casing": ["error", "PascalCase"], + "vue/no-v-html": "off", + 'accessor-pairs': 2, + 'arrow-spacing': [2, { + 'before': true, + 'after': true + }], + 'block-spacing': [2, 'always'], + 'brace-style': [2, '1tbs', { + 'allowSingleLine': true + }], + 'camelcase': [0, { + 'properties': 'always' + }], + 'comma-dangle': [2, 'never'], + 'comma-spacing': [2, { + 'before': false, + 'after': true + }], + 'comma-style': [2, 'last'], + 'constructor-super': 2, + 'curly': [2, 'multi-line'], + 'dot-location': [2, 'property'], + 'eol-last': 2, + 'eqeqeq': ["error", "always", {"null": "ignore"}], + 'generator-star-spacing': [2, { + 'before': true, + 'after': true + }], + 'handle-callback-err': [2, '^(err|error)$'], + 'indent': [2, 2, { + 'SwitchCase': 1 + }], + 'jsx-quotes': [2, 'prefer-single'], + 'key-spacing': [2, { + 'beforeColon': false, + 'afterColon': true + }], + 'keyword-spacing': [2, { + 'before': true, + 'after': true + }], + 'new-cap': [2, { + 'newIsCap': true, + 'capIsNew': false + }], + 'new-parens': 2, + 'no-array-constructor': 2, + 'no-caller': 2, + 'no-console': 'off', + 'no-class-assign': 2, + 'no-cond-assign': 2, + 'no-const-assign': 2, + 'no-control-regex': 0, + 'no-delete-var': 2, + 'no-dupe-args': 2, + 'no-dupe-class-members': 2, + 'no-dupe-keys': 2, + 'no-duplicate-case': 2, + 'no-empty-character-class': 2, + 'no-empty-pattern': 2, + 'no-eval': 2, + 'no-ex-assign': 2, + 'no-extend-native': 2, + 'no-extra-bind': 2, + 'no-extra-boolean-cast': 2, + 'no-extra-parens': [2, 'functions'], + 'no-fallthrough': 2, + 'no-floating-decimal': 2, + 'no-func-assign': 2, + 'no-implied-eval': 2, + 'no-inner-declarations': [2, 'functions'], + 'no-invalid-regexp': 2, + 'no-irregular-whitespace': 2, + 'no-iterator': 2, + 'no-label-var': 2, + 'no-labels': [2, { + 'allowLoop': false, + 'allowSwitch': false + }], + 'no-lone-blocks': 2, + 'no-mixed-spaces-and-tabs': 2, + 'no-multi-spaces': 2, + 'no-multi-str': 2, + 'no-multiple-empty-lines': [2, { + 'max': 1 + }], + 'no-native-reassign': 2, + 'no-negated-in-lhs': 2, + 'no-new-object': 2, + 'no-new-require': 2, + 'no-new-symbol': 2, + 'no-new-wrappers': 2, + 'no-obj-calls': 2, + 'no-octal': 2, + 'no-octal-escape': 2, + 'no-path-concat': 2, + 'no-proto': 2, + 'no-redeclare': 2, + 'no-regex-spaces': 2, + 'no-return-assign': [2, 'except-parens'], + 'no-self-assign': 2, + 'no-self-compare': 2, + 'no-sequences': 2, + 'no-shadow-restricted-names': 2, + 'no-spaced-func': 2, + 'no-sparse-arrays': 2, + 'no-this-before-super': 2, + 'no-throw-literal': 2, + 'no-trailing-spaces': 2, + 'no-undef': 2, + 'no-undef-init': 2, + 'no-unexpected-multiline': 2, + 'no-unmodified-loop-condition': 2, + 'no-unneeded-ternary': [2, { + 'defaultAssignment': false + }], + 'no-unreachable': 2, + 'no-unsafe-finally': 2, + 'no-unused-vars': [2, { + 'vars': 'all', + 'args': 'none' + }], + 'no-useless-call': 2, + 'no-useless-computed-key': 2, + 'no-useless-constructor': 2, + 'no-useless-escape': 0, + 'no-whitespace-before-property': 2, + 'no-with': 2, + 'one-var': [2, { + 'initialized': 'never' + }], + 'operator-linebreak': [2, 'after', { + 'overrides': { + '?': 'before', + ':': 'before' + } + }], + 'padded-blocks': [2, 'never'], + 'quotes': [2, 'single', { + 'avoidEscape': true, + 'allowTemplateLiterals': true + }], + 'semi': [2, 'never'], + 'semi-spacing': [2, { + 'before': false, + 'after': true + }], + 'space-before-blocks': [2, 'always'], + 'space-before-function-paren': [2, 'never'], + 'space-in-parens': [2, 'never'], + 'space-infix-ops': 2, + 'space-unary-ops': [2, { + 'words': true, + 'nonwords': false + }], + 'spaced-comment': [2, 'always', { + 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] + }], + 'template-curly-spacing': [2, 'never'], + 'use-isnan': 2, + 'valid-typeof': 2, + 'wrap-iife': [2, 'any'], + 'yield-star-spacing': [2, 'both'], + 'yoda': [2, 'never'], + 'prefer-const': 2, + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, + 'object-curly-spacing': [2, 'always', { + objectsInObjects: false + }], + 'array-bracket-spacing': [2, 'never'] + } +} diff --git a/ruoyi-ui/README.md b/ruoyi-ui/README.md new file mode 100644 index 000000000..00c0ab84f --- /dev/null +++ b/ruoyi-ui/README.md @@ -0,0 +1,30 @@ +## 开发 + +```bash +# 克隆项目 +git clone https://gitee.com/y_project/RuoYi-Vue + +# 进入项目目录 +cd ruoyi-ui + +# 安装依赖 +npm install + +# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 +npm install --registry=https://registry.npmmirror.com + +# 启动服务 +npm run dev +``` + +浏览器访问 http://localhost:80 + +## 发布 + +```bash +# 构建测试环境 +npm run build:stage + +# 构建生产环境 +npm run build:prod +``` \ No newline at end of file diff --git a/ruoyi-ui/babel.config.js b/ruoyi-ui/babel.config.js new file mode 100644 index 000000000..c8267b2dd --- /dev/null +++ b/ruoyi-ui/babel.config.js @@ -0,0 +1,13 @@ +module.exports = { + presets: [ + // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app + '@vue/cli-plugin-babel/preset' + ], + 'env': { + 'development': { + // babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). + // This plugin can significantly increase the speed of hot updates, when you have a large number of pages. + 'plugins': ['dynamic-import-node'] + } + } +} \ No newline at end of file diff --git a/ruoyi-ui/bin/build.bat b/ruoyi-ui/bin/build.bat new file mode 100644 index 000000000..dda590d22 --- /dev/null +++ b/ruoyi-ui/bin/build.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] Weḅdistļ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm run build:prod + +pause \ No newline at end of file diff --git a/ruoyi-ui/bin/package.bat b/ruoyi-ui/bin/package.bat new file mode 100644 index 000000000..0e5bc0fb5 --- /dev/null +++ b/ruoyi-ui/bin/package.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] װWeḅnode_modulesļ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm install --registry=https://registry.npmmirror.com + +pause \ No newline at end of file diff --git a/ruoyi-ui/bin/run-web.bat b/ruoyi-ui/bin/run-web.bat new file mode 100644 index 000000000..d30deae79 --- /dev/null +++ b/ruoyi-ui/bin/run-web.bat @@ -0,0 +1,12 @@ +@echo off +echo. +echo [Ϣ] ʹ Vue CLI Web ̡ +echo. + +%~d0 +cd %~dp0 + +cd .. +npm run dev + +pause \ No newline at end of file diff --git a/ruoyi-ui/build/index.js b/ruoyi-ui/build/index.js new file mode 100644 index 000000000..0c57de2aa --- /dev/null +++ b/ruoyi-ui/build/index.js @@ -0,0 +1,35 @@ +const { run } = require('runjs') +const chalk = require('chalk') +const config = require('../vue.config.js') +const rawArgv = process.argv.slice(2) +const args = rawArgv.join(' ') + +if (process.env.npm_config_preview || rawArgv.includes('--preview')) { + const report = rawArgv.includes('--report') + + run(`vue-cli-service build ${args}`) + + const port = 9526 + const publicPath = config.publicPath + + var connect = require('connect') + var serveStatic = require('serve-static') + const app = connect() + + app.use( + publicPath, + serveStatic('./dist', { + index: ['index.html', '/'] + }) + ) + + app.listen(port, function () { + console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) + if (report) { + console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) + } + + }) +} else { + run(`vue-cli-service build ${args}`) +} diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json new file mode 100644 index 000000000..2e4b91e9d --- /dev/null +++ b/ruoyi-ui/package.json @@ -0,0 +1,90 @@ +{ + "name": "ruoyi", + "version": "3.8.7", + "description": "若依管理系统", + "author": "若依", + "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" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "src/**/*.{js,vue}": [ + "eslint --fix", + "git add" + ] + }, + "keywords": [ + "vue", + "admin", + "dashboard", + "element-ui", + "boilerplate", + "admin-template", + "management-system" + ], + "repository": { + "type": "git", + "url": "https://gitee.com/y_project/RuoYi-Vue.git" + }, + "dependencies": { + "@riophae/vue-treeselect": "0.4.0", + "axios": "0.24.0", + "clipboard": "2.0.8", + "core-js": "3.25.3", + "echarts": "5.4.0", + "element-ui": "2.15.14", + "file-saver": "2.0.5", + "fuse.js": "6.4.3", + "highlight.js": "9.18.5", + "js-beautify": "1.13.0", + "js-cookie": "3.0.1", + "jsencrypt": "3.0.0-rc.1", + "nprogress": "0.2.0", + "quill": "1.3.7", + "screenfull": "5.0.2", + "sortablejs": "1.10.2", + "vue": "2.6.12", + "vue-count-to": "1.0.13", + "vue-cropper": "0.5.5", + "vue-meta": "2.4.0", + "vue-router": "3.4.9", + "vuedraggable": "2.24.3", + "vuex": "3.6.0" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "4.4.6", + "@vue/cli-plugin-eslint": "4.4.6", + "@vue/cli-service": "4.4.6", + "babel-eslint": "10.1.0", + "babel-plugin-dynamic-import-node": "2.3.3", + "chalk": "4.1.0", + "compression-webpack-plugin": "6.1.2", + "connect": "3.6.6", + "eslint": "7.15.0", + "eslint-plugin-vue": "7.2.0", + "lint-staged": "10.5.3", + "runjs": "4.4.2", + "sass": "1.32.13", + "sass-loader": "10.1.1", + "script-ext-html-webpack-plugin": "2.1.5", + "svg-sprite-loader": "5.1.1", + "vue-template-compiler": "2.6.12" + }, + "engines": { + "node": ">=8.9", + "npm": ">= 3.0.0" + }, + "browserslist": [ + "> 1%", + "last 2 versions" + ] +} diff --git a/ruoyi-ui/public/favicon.ico b/ruoyi-ui/public/favicon.ico new file mode 100644 index 000000000..e26376026 Binary files /dev/null and b/ruoyi-ui/public/favicon.ico differ diff --git a/ruoyi-admin/src/main/resources/static/html/ie.html b/ruoyi-ui/public/html/ie.html similarity index 99% rename from ruoyi-admin/src/main/resources/static/html/ie.html rename to ruoyi-ui/public/html/ie.html index 97836937a..052ffcd64 100644 --- a/ruoyi-admin/src/main/resources/static/html/ie.html +++ b/ruoyi-ui/public/html/ie.html @@ -1,46 +1,46 @@ - - - - - - 请升级您的浏览器 - - - - - - -

    请升级您的浏览器,以便我们更好的为您提供服务!

    -

    您正在使用 Internet Explorer 的早期版本(IE9以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

    -
    -

    请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

    -

    自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

    -
    -

    您可以选择更先进的浏览器

    -

    推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

    - -
    - + + + + + + 请升级您的浏览器 + + + + + + +

    请升级您的浏览器,以便我们更好的为您提供服务!

    +

    您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

    +
    +

    请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

    +

    自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

    +
    +

    您可以选择更先进的浏览器

    +

    推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

    + +
    + \ No newline at end of file diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html new file mode 100644 index 000000000..925455caf --- /dev/null +++ b/ruoyi-ui/public/index.html @@ -0,0 +1,208 @@ + + + + + + + + + <%= webpackConfig.name %> + + + + +
    +
    +
    +
    +
    +
    正在加载系统资源,请耐心等待
    +
    +
    + + diff --git a/ruoyi-ui/public/robots.txt b/ruoyi-ui/public/robots.txt new file mode 100644 index 000000000..77470cb39 --- /dev/null +++ b/ruoyi-ui/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/ruoyi-ui/src/App.vue b/ruoyi-ui/src/App.vue new file mode 100644 index 000000000..b92ea3792 --- /dev/null +++ b/ruoyi-ui/src/App.vue @@ -0,0 +1,28 @@ + + + + diff --git a/ruoyi-ui/src/api/login.js b/ruoyi-ui/src/api/login.js new file mode 100644 index 000000000..7b7388fde --- /dev/null +++ b/ruoyi-ui/src/api/login.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 登录方法 +export function login(username, password, code, uuid) { + const data = { + username, + password, + code, + uuid + } + return request({ + url: '/login', + headers: { + isToken: false, + repeatSubmit: false + }, + method: 'post', + data: data + }) +} + +// 注册方法 +export function register(data) { + return request({ + url: '/register', + headers: { + isToken: false + }, + method: 'post', + data: data + }) +} + +// 获取用户详细信息 +export function getInfo() { + return request({ + url: '/getInfo', + method: 'get' + }) +} + +// 退出方法 +export function logout() { + return request({ + url: '/logout', + method: 'post' + }) +} + +// 获取验证码 +export function getCodeImg() { + return request({ + url: '/captchaImage', + headers: { + isToken: false + }, + method: 'get', + timeout: 20000 + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/menu.js b/ruoyi-ui/src/api/menu.js new file mode 100644 index 000000000..faef101c4 --- /dev/null +++ b/ruoyi-ui/src/api/menu.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 获取路由 +export const getRouters = () => { + return request({ + url: '/getRouters', + method: 'get' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/monitor/cache.js b/ruoyi-ui/src/api/monitor/cache.js new file mode 100644 index 000000000..72c5f6a3e --- /dev/null +++ b/ruoyi-ui/src/api/monitor/cache.js @@ -0,0 +1,57 @@ +import request from '@/utils/request' + +// 查询缓存详细 +export function getCache() { + return request({ + url: '/monitor/cache', + 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(cacheKey) { + return request({ + url: '/monitor/cache/clearCacheKey/' + cacheKey, + method: 'delete' + }) +} + +// 清理全部缓存 +export function clearCacheAll() { + return request({ + url: '/monitor/cache/clearCacheAll', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/job.js b/ruoyi-ui/src/api/monitor/job.js new file mode 100644 index 000000000..38155693a --- /dev/null +++ b/ruoyi-ui/src/api/monitor/job.js @@ -0,0 +1,71 @@ +import request from '@/utils/request' + +// 查询定时任务调度列表 +export function listJob(query) { + return request({ + url: '/monitor/job/list', + method: 'get', + params: query + }) +} + +// 查询定时任务调度详细 +export function getJob(jobId) { + return request({ + url: '/monitor/job/' + jobId, + method: 'get' + }) +} + +// 新增定时任务调度 +export function addJob(data) { + return request({ + url: '/monitor/job', + method: 'post', + data: data + }) +} + +// 修改定时任务调度 +export function updateJob(data) { + return request({ + url: '/monitor/job', + method: 'put', + data: data + }) +} + +// 删除定时任务调度 +export function delJob(jobId) { + return request({ + url: '/monitor/job/' + jobId, + method: 'delete' + }) +} + +// 任务状态修改 +export function changeJobStatus(jobId, status) { + const data = { + jobId, + status + } + return request({ + url: '/monitor/job/changeStatus', + method: 'put', + data: data + }) +} + + +// 定时任务立即执行一次 +export function runJob(jobId, jobGroup) { + const data = { + jobId, + jobGroup + } + return request({ + url: '/monitor/job/run', + method: 'put', + data: data + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/monitor/jobLog.js b/ruoyi-ui/src/api/monitor/jobLog.js new file mode 100644 index 000000000..6e0be6166 --- /dev/null +++ b/ruoyi-ui/src/api/monitor/jobLog.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 查询调度日志列表 +export function listJobLog(query) { + return request({ + url: '/monitor/jobLog/list', + method: 'get', + params: query + }) +} + +// 删除调度日志 +export function delJobLog(jobLogId) { + return request({ + url: '/monitor/jobLog/' + jobLogId, + method: 'delete' + }) +} + +// 清空调度日志 +export function cleanJobLog() { + return request({ + url: '/monitor/jobLog/clean', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/logininfor.js b/ruoyi-ui/src/api/monitor/logininfor.js new file mode 100644 index 000000000..4d112b78a --- /dev/null +++ b/ruoyi-ui/src/api/monitor/logininfor.js @@ -0,0 +1,34 @@ +import request from '@/utils/request' + +// 查询登录日志列表 +export function list(query) { + return request({ + url: '/monitor/logininfor/list', + method: 'get', + params: query + }) +} + +// 删除登录日志 +export function delLogininfor(infoId) { + return request({ + url: '/monitor/logininfor/' + infoId, + method: 'delete' + }) +} + +// 解锁用户登录状态 +export function unlockLogininfor(userName) { + return request({ + url: '/monitor/logininfor/unlock/' + userName, + method: 'get' + }) +} + +// 清空登录日志 +export function cleanLogininfor() { + return request({ + url: '/monitor/logininfor/clean', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/online.js b/ruoyi-ui/src/api/monitor/online.js new file mode 100644 index 000000000..bd2213780 --- /dev/null +++ b/ruoyi-ui/src/api/monitor/online.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 查询在线用户列表 +export function list(query) { + return request({ + url: '/monitor/online/list', + method: 'get', + params: query + }) +} + +// 强退用户 +export function forceLogout(tokenId) { + return request({ + url: '/monitor/online/' + tokenId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/operlog.js b/ruoyi-ui/src/api/monitor/operlog.js new file mode 100644 index 000000000..a04bca840 --- /dev/null +++ b/ruoyi-ui/src/api/monitor/operlog.js @@ -0,0 +1,26 @@ +import request from '@/utils/request' + +// 查询操作日志列表 +export function list(query) { + return request({ + url: '/monitor/operlog/list', + method: 'get', + params: query + }) +} + +// 删除操作日志 +export function delOperlog(operId) { + return request({ + url: '/monitor/operlog/' + operId, + method: 'delete' + }) +} + +// 清空操作日志 +export function cleanOperlog() { + return request({ + url: '/monitor/operlog/clean', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/monitor/server.js b/ruoyi-ui/src/api/monitor/server.js new file mode 100644 index 000000000..e1f9ca214 --- /dev/null +++ b/ruoyi-ui/src/api/monitor/server.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 获取服务信息 +export function getServer() { + return request({ + url: '/monitor/server', + method: 'get' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/config.js b/ruoyi-ui/src/api/system/config.js new file mode 100644 index 000000000..a404d8254 --- /dev/null +++ b/ruoyi-ui/src/api/system/config.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询参数列表 +export function listConfig(query) { + return request({ + url: '/system/config/list', + method: 'get', + params: query + }) +} + +// 查询参数详细 +export function getConfig(configId) { + return request({ + url: '/system/config/' + configId, + method: 'get' + }) +} + +// 根据参数键名查询参数值 +export function getConfigKey(configKey) { + return request({ + url: '/system/config/configKey/' + configKey, + method: 'get' + }) +} + +// 新增参数配置 +export function addConfig(data) { + return request({ + url: '/system/config', + method: 'post', + data: data + }) +} + +// 修改参数配置 +export function updateConfig(data) { + return request({ + url: '/system/config', + method: 'put', + data: data + }) +} + +// 删除参数配置 +export function delConfig(configId) { + return request({ + url: '/system/config/' + configId, + method: 'delete' + }) +} + +// 刷新参数缓存 +export function refreshCache() { + return request({ + url: '/system/config/refreshCache', + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/system/dept.js b/ruoyi-ui/src/api/system/dept.js new file mode 100644 index 000000000..fc943cd41 --- /dev/null +++ b/ruoyi-ui/src/api/system/dept.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询部门列表 +export function listDept(query) { + return request({ + url: '/system/dept/list', + method: 'get', + params: query + }) +} + +// 查询部门列表(排除节点) +export function listDeptExcludeChild(deptId) { + return request({ + url: '/system/dept/list/exclude/' + deptId, + method: 'get' + }) +} + +// 查询部门详细 +export function getDept(deptId) { + return request({ + url: '/system/dept/' + deptId, + method: 'get' + }) +} + +// 新增部门 +export function addDept(data) { + return request({ + url: '/system/dept', + method: 'post', + data: data + }) +} + +// 修改部门 +export function updateDept(data) { + return request({ + url: '/system/dept', + method: 'put', + data: data + }) +} + +// 删除部门 +export function delDept(deptId) { + return request({ + url: '/system/dept/' + deptId, + method: 'delete' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/dict/data.js b/ruoyi-ui/src/api/system/dict/data.js new file mode 100644 index 000000000..6c9eb79b4 --- /dev/null +++ b/ruoyi-ui/src/api/system/dict/data.js @@ -0,0 +1,52 @@ +import request from '@/utils/request' + +// 查询字典数据列表 +export function listData(query) { + return request({ + url: '/system/dict/data/list', + method: 'get', + params: query + }) +} + +// 查询字典数据详细 +export function getData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'get' + }) +} + +// 根据字典类型查询字典数据信息 +export function getDicts(dictType) { + return request({ + url: '/system/dict/data/type/' + dictType, + method: 'get' + }) +} + +// 新增字典数据 +export function addData(data) { + return request({ + url: '/system/dict/data', + method: 'post', + data: data + }) +} + +// 修改字典数据 +export function updateData(data) { + return request({ + url: '/system/dict/data', + method: 'put', + data: data + }) +} + +// 删除字典数据 +export function delData(dictCode) { + return request({ + url: '/system/dict/data/' + dictCode, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/system/dict/type.js b/ruoyi-ui/src/api/system/dict/type.js new file mode 100644 index 000000000..a7a6e01fc --- /dev/null +++ b/ruoyi-ui/src/api/system/dict/type.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询字典类型列表 +export function listType(query) { + return request({ + url: '/system/dict/type/list', + method: 'get', + params: query + }) +} + +// 查询字典类型详细 +export function getType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'get' + }) +} + +// 新增字典类型 +export function addType(data) { + return request({ + url: '/system/dict/type', + method: 'post', + data: data + }) +} + +// 修改字典类型 +export function updateType(data) { + return request({ + url: '/system/dict/type', + method: 'put', + data: data + }) +} + +// 删除字典类型 +export function delType(dictId) { + return request({ + url: '/system/dict/type/' + dictId, + method: 'delete' + }) +} + +// 刷新字典缓存 +export function refreshCache() { + return request({ + url: '/system/dict/type/refreshCache', + method: 'delete' + }) +} + +// 获取字典选择框列表 +export function optionselect() { + return request({ + url: '/system/dict/type/optionselect', + method: 'get' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/menu.js b/ruoyi-ui/src/api/system/menu.js new file mode 100644 index 000000000..f6415c656 --- /dev/null +++ b/ruoyi-ui/src/api/system/menu.js @@ -0,0 +1,60 @@ +import request from '@/utils/request' + +// 查询菜单列表 +export function listMenu(query) { + return request({ + url: '/system/menu/list', + method: 'get', + params: query + }) +} + +// 查询菜单详细 +export function getMenu(menuId) { + return request({ + url: '/system/menu/' + menuId, + method: 'get' + }) +} + +// 查询菜单下拉树结构 +export function treeselect() { + return request({ + url: '/system/menu/treeselect', + method: 'get' + }) +} + +// 根据角色ID查询菜单下拉树结构 +export function roleMenuTreeselect(roleId) { + return request({ + url: '/system/menu/roleMenuTreeselect/' + roleId, + method: 'get' + }) +} + +// 新增菜单 +export function addMenu(data) { + return request({ + url: '/system/menu', + method: 'post', + data: data + }) +} + +// 修改菜单 +export function updateMenu(data) { + return request({ + url: '/system/menu', + method: 'put', + data: data + }) +} + +// 删除菜单 +export function delMenu(menuId) { + return request({ + url: '/system/menu/' + menuId, + method: 'delete' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/notice.js b/ruoyi-ui/src/api/system/notice.js new file mode 100644 index 000000000..c274ea5ba --- /dev/null +++ b/ruoyi-ui/src/api/system/notice.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询公告列表 +export function listNotice(query) { + return request({ + url: '/system/notice/list', + method: 'get', + params: query + }) +} + +// 查询公告详细 +export function getNotice(noticeId) { + return request({ + url: '/system/notice/' + noticeId, + method: 'get' + }) +} + +// 新增公告 +export function addNotice(data) { + return request({ + url: '/system/notice', + method: 'post', + data: data + }) +} + +// 修改公告 +export function updateNotice(data) { + return request({ + url: '/system/notice', + method: 'put', + data: data + }) +} + +// 删除公告 +export function delNotice(noticeId) { + return request({ + url: '/system/notice/' + noticeId, + method: 'delete' + }) +} \ No newline at end of file diff --git a/ruoyi-ui/src/api/system/post.js b/ruoyi-ui/src/api/system/post.js new file mode 100644 index 000000000..1a8e9ca04 --- /dev/null +++ b/ruoyi-ui/src/api/system/post.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询岗位列表 +export function listPost(query) { + return request({ + url: '/system/post/list', + method: 'get', + params: query + }) +} + +// 查询岗位详细 +export function getPost(postId) { + return request({ + url: '/system/post/' + postId, + method: 'get' + }) +} + +// 新增岗位 +export function addPost(data) { + return request({ + url: '/system/post', + method: 'post', + data: data + }) +} + +// 修改岗位 +export function updatePost(data) { + return request({ + url: '/system/post', + method: 'put', + data: data + }) +} + +// 删除岗位 +export function delPost(postId) { + return request({ + url: '/system/post/' + postId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/system/role.js b/ruoyi-ui/src/api/system/role.js new file mode 100644 index 000000000..f13e6f404 --- /dev/null +++ b/ruoyi-ui/src/api/system/role.js @@ -0,0 +1,119 @@ +import request from '@/utils/request' + +// 查询角色列表 +export function listRole(query) { + return request({ + url: '/system/role/list', + method: 'get', + params: query + }) +} + +// 查询角色详细 +export function getRole(roleId) { + return request({ + url: '/system/role/' + roleId, + method: 'get' + }) +} + +// 新增角色 +export function addRole(data) { + return request({ + url: '/system/role', + method: 'post', + data: data + }) +} + +// 修改角色 +export function updateRole(data) { + return request({ + url: '/system/role', + method: 'put', + data: data + }) +} + +// 角色数据权限 +export function dataScope(data) { + return request({ + url: '/system/role/dataScope', + method: 'put', + data: data + }) +} + +// 角色状态修改 +export function changeRoleStatus(roleId, status) { + const data = { + roleId, + status + } + return request({ + url: '/system/role/changeStatus', + method: 'put', + data: data + }) +} + +// 删除角色 +export function delRole(roleId) { + return request({ + url: '/system/role/' + roleId, + method: 'delete' + }) +} + +// 查询角色已授权用户列表 +export function allocatedUserList(query) { + return request({ + url: '/system/role/authUser/allocatedList', + method: 'get', + params: query + }) +} + +// 查询角色未授权用户列表 +export function unallocatedUserList(query) { + return request({ + url: '/system/role/authUser/unallocatedList', + method: 'get', + params: query + }) +} + +// 取消用户授权角色 +export function authUserCancel(data) { + return request({ + url: '/system/role/authUser/cancel', + method: 'put', + data: data + }) +} + +// 批量取消用户授权角色 +export function authUserCancelAll(data) { + return request({ + url: '/system/role/authUser/cancelAll', + method: 'put', + params: data + }) +} + +// 授权用户选择 +export function authUserSelectAll(data) { + return request({ + url: '/system/role/authUser/selectAll', + method: 'put', + 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 new file mode 100644 index 000000000..f2f76ef9f --- /dev/null +++ b/ruoyi-ui/src/api/system/user.js @@ -0,0 +1,135 @@ +import request from '@/utils/request' +import { parseStrEmpty } from "@/utils/ruoyi"; + +// 查询用户列表 +export function listUser(query) { + return request({ + url: '/system/user/list', + method: 'get', + params: query + }) +} + +// 查询用户详细 +export function getUser(userId) { + return request({ + url: '/system/user/' + parseStrEmpty(userId), + method: 'get' + }) +} + +// 新增用户 +export function addUser(data) { + return request({ + url: '/system/user', + method: 'post', + data: data + }) +} + +// 修改用户 +export function updateUser(data) { + return request({ + url: '/system/user', + method: 'put', + data: data + }) +} + +// 删除用户 +export function delUser(userId) { + return request({ + url: '/system/user/' + userId, + method: 'delete' + }) +} + +// 用户密码重置 +export function resetUserPwd(userId, password) { + const data = { + userId, + password + } + return request({ + url: '/system/user/resetPwd', + method: 'put', + data: data + }) +} + +// 用户状态修改 +export function changeUserStatus(userId, status) { + const data = { + userId, + status + } + return request({ + url: '/system/user/changeStatus', + method: 'put', + data: data + }) +} + +// 查询用户个人信息 +export function getUserProfile() { + return request({ + url: '/system/user/profile', + method: 'get' + }) +} + +// 修改用户个人信息 +export function updateUserProfile(data) { + return request({ + url: '/system/user/profile', + method: 'put', + data: data + }) +} + +// 用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + const data = { + oldPassword, + newPassword + } + return request({ + url: '/system/user/profile/updatePwd', + method: 'put', + params: data + }) +} + +// 用户头像上传 +export function uploadAvatar(data) { + return request({ + url: '/system/user/profile/avatar', + method: 'post', + data: data + }) +} + +// 查询授权角色 +export function getAuthRole(userId) { + return request({ + url: '/system/user/authRole/' + userId, + method: 'get' + }) +} + +// 保存授权角色 +export function updateAuthRole(data) { + return request({ + url: '/system/user/authRole', + method: 'put', + params: data + }) +} + +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/user/deptTree', + method: 'get' + }) +} diff --git a/ruoyi-ui/src/api/tool/gen.js b/ruoyi-ui/src/api/tool/gen.js new file mode 100644 index 000000000..207567727 --- /dev/null +++ b/ruoyi-ui/src/api/tool/gen.js @@ -0,0 +1,85 @@ +import request from '@/utils/request' + +// 查询生成表数据 +export function listTable(query) { + return request({ + url: '/tool/gen/list', + method: 'get', + params: query + }) +} +// 查询db数据库列表 +export function listDbTable(query) { + return request({ + url: '/tool/gen/db/list', + method: 'get', + params: query + }) +} + +// 查询表详细信息 +export function getGenTable(tableId) { + return request({ + url: '/tool/gen/' + tableId, + method: 'get' + }) +} + +// 修改代码生成信息 +export function updateGenTable(data) { + return request({ + url: '/tool/gen', + method: 'put', + data: data + }) +} + +// 导入表 +export function importTable(data) { + return request({ + url: '/tool/gen/importTable', + method: 'post', + params: data + }) +} + +// 创建表 +export function createTable(data) { + return request({ + url: '/tool/gen/createTable', + method: 'post', + params: data + }) +} + +// 预览生成代码 +export function previewTable(tableId) { + return request({ + url: '/tool/gen/preview/' + tableId, + method: 'get' + }) +} + +// 删除表数据 +export function delTable(tableId) { + return request({ + url: '/tool/gen/' + tableId, + method: 'delete' + }) +} + +// 生成代码(自定义路径) +export function genCode(tableName) { + return request({ + url: '/tool/gen/genCode/' + tableName, + method: 'get' + }) +} + +// 同步数据库 +export function synchDb(tableName) { + return request({ + url: '/tool/gen/synchDb/' + tableName, + method: 'get' + }) +} diff --git a/ruoyi-ui/src/assets/401_images/401.gif b/ruoyi-ui/src/assets/401_images/401.gif new file mode 100644 index 000000000..cd6e0d943 Binary files /dev/null and b/ruoyi-ui/src/assets/401_images/401.gif differ diff --git a/ruoyi-ui/src/assets/404_images/404.png b/ruoyi-ui/src/assets/404_images/404.png new file mode 100644 index 000000000..3d8e2305c Binary files /dev/null and b/ruoyi-ui/src/assets/404_images/404.png differ diff --git a/ruoyi-ui/src/assets/404_images/404_cloud.png b/ruoyi-ui/src/assets/404_images/404_cloud.png new file mode 100644 index 000000000..c6281d090 Binary files /dev/null and b/ruoyi-ui/src/assets/404_images/404_cloud.png differ diff --git a/ruoyi-ui/src/assets/icons/index.js b/ruoyi-ui/src/assets/icons/index.js new file mode 100644 index 000000000..2c6b309c9 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/index.js @@ -0,0 +1,9 @@ +import Vue from 'vue' +import SvgIcon from '@/components/SvgIcon'// svg component + +// register globally +Vue.component('svg-icon', SvgIcon) + +const req = require.context('./svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys().map(requireContext) +requireAll(req) diff --git a/ruoyi-ui/src/assets/icons/svg/404.svg b/ruoyi-ui/src/assets/icons/svg/404.svg new file mode 100644 index 000000000..6df50190a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/404.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/bug.svg b/ruoyi-ui/src/assets/icons/svg/bug.svg new file mode 100644 index 000000000..05a150dc3 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/bug.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/build.svg b/ruoyi-ui/src/assets/icons/svg/build.svg new file mode 100644 index 000000000..97c468863 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/build.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/button.svg b/ruoyi-ui/src/assets/icons/svg/button.svg new file mode 100644 index 000000000..904fddc85 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/button.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/cascader.svg b/ruoyi-ui/src/assets/icons/svg/cascader.svg new file mode 100644 index 000000000..e256024f9 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/cascader.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/chart.svg b/ruoyi-ui/src/assets/icons/svg/chart.svg new file mode 100644 index 000000000..27728fb0b --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/chart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/checkbox.svg b/ruoyi-ui/src/assets/icons/svg/checkbox.svg new file mode 100644 index 000000000..013fd3a27 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/checkbox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/clipboard.svg b/ruoyi-ui/src/assets/icons/svg/clipboard.svg new file mode 100644 index 000000000..90923ff62 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/clipboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/code.svg b/ruoyi-ui/src/assets/icons/svg/code.svg new file mode 100644 index 000000000..5f9c5abd5 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/code.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/color.svg b/ruoyi-ui/src/assets/icons/svg/color.svg new file mode 100644 index 000000000..44a81aab1 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/color.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/component.svg b/ruoyi-ui/src/assets/icons/svg/component.svg new file mode 100644 index 000000000..29c345809 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/component.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/dashboard.svg b/ruoyi-ui/src/assets/icons/svg/dashboard.svg new file mode 100644 index 000000000..5317d3702 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/dashboard.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/date-range.svg b/ruoyi-ui/src/assets/icons/svg/date-range.svg new file mode 100644 index 000000000..fda571e70 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/date-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/date.svg b/ruoyi-ui/src/assets/icons/svg/date.svg new file mode 100644 index 000000000..52dc73eec --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/dict.svg b/ruoyi-ui/src/assets/icons/svg/dict.svg new file mode 100644 index 000000000..484937730 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/dict.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/documentation.svg b/ruoyi-ui/src/assets/icons/svg/documentation.svg new file mode 100644 index 000000000..704312289 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/documentation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/download.svg b/ruoyi-ui/src/assets/icons/svg/download.svg new file mode 100644 index 000000000..c89695134 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/download.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/drag.svg b/ruoyi-ui/src/assets/icons/svg/drag.svg new file mode 100644 index 000000000..4185d3cee --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/drag.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/druid.svg b/ruoyi-ui/src/assets/icons/svg/druid.svg new file mode 100644 index 000000000..a2b4b4ed2 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/druid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/edit.svg b/ruoyi-ui/src/assets/icons/svg/edit.svg new file mode 100644 index 000000000..d26101f29 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/edit.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/education.svg b/ruoyi-ui/src/assets/icons/svg/education.svg new file mode 100644 index 000000000..7bfb01d18 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/education.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/email.svg b/ruoyi-ui/src/assets/icons/svg/email.svg new file mode 100644 index 000000000..74d25e21a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/email.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/example.svg b/ruoyi-ui/src/assets/icons/svg/example.svg new file mode 100644 index 000000000..46f42b532 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/example.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/excel.svg b/ruoyi-ui/src/assets/icons/svg/excel.svg new file mode 100644 index 000000000..74d97b802 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/excel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/exit-fullscreen.svg b/ruoyi-ui/src/assets/icons/svg/exit-fullscreen.svg new file mode 100644 index 000000000..485c128b6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/exit-fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/eye-open.svg b/ruoyi-ui/src/assets/icons/svg/eye-open.svg new file mode 100644 index 000000000..88dcc98e6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/eye-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/eye.svg b/ruoyi-ui/src/assets/icons/svg/eye.svg new file mode 100644 index 000000000..16ed2d872 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/eye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/form.svg b/ruoyi-ui/src/assets/icons/svg/form.svg new file mode 100644 index 000000000..dcbaa185a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/form.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/fullscreen.svg b/ruoyi-ui/src/assets/icons/svg/fullscreen.svg new file mode 100644 index 000000000..0e86b6fa8 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/fullscreen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/github.svg b/ruoyi-ui/src/assets/icons/svg/github.svg new file mode 100644 index 000000000..db0a0d430 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/guide.svg b/ruoyi-ui/src/assets/icons/svg/guide.svg new file mode 100644 index 000000000..b27100179 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/guide.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/icon.svg b/ruoyi-ui/src/assets/icons/svg/icon.svg new file mode 100644 index 000000000..82be8eeed --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/input.svg b/ruoyi-ui/src/assets/icons/svg/input.svg new file mode 100644 index 000000000..ab91381e6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/input.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/international.svg b/ruoyi-ui/src/assets/icons/svg/international.svg new file mode 100644 index 000000000..e9b56eee2 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/international.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/job.svg b/ruoyi-ui/src/assets/icons/svg/job.svg new file mode 100644 index 000000000..2a93a2519 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/job.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/language.svg b/ruoyi-ui/src/assets/icons/svg/language.svg new file mode 100644 index 000000000..0082b577a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/language.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/link.svg b/ruoyi-ui/src/assets/icons/svg/link.svg new file mode 100644 index 000000000..48197ba4d --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/list.svg b/ruoyi-ui/src/assets/icons/svg/list.svg new file mode 100644 index 000000000..20259eddb --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/list.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/lock.svg b/ruoyi-ui/src/assets/icons/svg/lock.svg new file mode 100644 index 000000000..74fee543d --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/lock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/log.svg b/ruoyi-ui/src/assets/icons/svg/log.svg new file mode 100644 index 000000000..d879d33b6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/log.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/logininfor.svg b/ruoyi-ui/src/assets/icons/svg/logininfor.svg new file mode 100644 index 000000000..267f84474 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/logininfor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/message.svg b/ruoyi-ui/src/assets/icons/svg/message.svg new file mode 100644 index 000000000..14ca81728 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/money.svg b/ruoyi-ui/src/assets/icons/svg/money.svg new file mode 100644 index 000000000..c1580de10 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/money.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/monitor.svg b/ruoyi-ui/src/assets/icons/svg/monitor.svg new file mode 100644 index 000000000..bc308cb0f --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/monitor.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/nested.svg b/ruoyi-ui/src/assets/icons/svg/nested.svg new file mode 100644 index 000000000..06713a86c --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/nested.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/number.svg b/ruoyi-ui/src/assets/icons/svg/number.svg new file mode 100644 index 000000000..ad5ce9af2 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/number.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/online.svg b/ruoyi-ui/src/assets/icons/svg/online.svg new file mode 100644 index 000000000..330a20293 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/online.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/password.svg b/ruoyi-ui/src/assets/icons/svg/password.svg new file mode 100644 index 000000000..6c64defe3 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/pdf.svg b/ruoyi-ui/src/assets/icons/svg/pdf.svg new file mode 100644 index 000000000..957aa0cc3 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/pdf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/people.svg b/ruoyi-ui/src/assets/icons/svg/people.svg new file mode 100644 index 000000000..2bd54aeb7 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/people.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/peoples.svg b/ruoyi-ui/src/assets/icons/svg/peoples.svg new file mode 100644 index 000000000..aab852e52 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/peoples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/phone.svg b/ruoyi-ui/src/assets/icons/svg/phone.svg new file mode 100644 index 000000000..ab8e8c4e5 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/phone.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/post.svg b/ruoyi-ui/src/assets/icons/svg/post.svg new file mode 100644 index 000000000..2922c613b --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/post.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/qq.svg b/ruoyi-ui/src/assets/icons/svg/qq.svg new file mode 100644 index 000000000..ee13d4ec2 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/qq.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/question.svg b/ruoyi-ui/src/assets/icons/svg/question.svg new file mode 100644 index 000000000..cf75bd4be --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/question.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/radio.svg b/ruoyi-ui/src/assets/icons/svg/radio.svg new file mode 100644 index 000000000..0cde34521 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/radio.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/rate.svg b/ruoyi-ui/src/assets/icons/svg/rate.svg new file mode 100644 index 000000000..aa3b14d7d --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/rate.svg @@ -0,0 +1 @@ + \ No newline at end of file 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/icons/svg/redis.svg b/ruoyi-ui/src/assets/icons/svg/redis.svg new file mode 100644 index 000000000..2f1d62dfc --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/redis.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/row.svg b/ruoyi-ui/src/assets/icons/svg/row.svg new file mode 100644 index 000000000..078099222 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/row.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/search.svg b/ruoyi-ui/src/assets/icons/svg/search.svg new file mode 100644 index 000000000..84233ddaa --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/select.svg b/ruoyi-ui/src/assets/icons/svg/select.svg new file mode 100644 index 000000000..d6283828b --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/select.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/server.svg b/ruoyi-ui/src/assets/icons/svg/server.svg new file mode 100644 index 000000000..eb287e36c --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/server.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/shopping.svg b/ruoyi-ui/src/assets/icons/svg/shopping.svg new file mode 100644 index 000000000..87513e7c5 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/shopping.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/size.svg b/ruoyi-ui/src/assets/icons/svg/size.svg new file mode 100644 index 000000000..ddb25b8d5 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/size.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/skill.svg b/ruoyi-ui/src/assets/icons/svg/skill.svg new file mode 100644 index 000000000..a3b731218 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/skill.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/slider.svg b/ruoyi-ui/src/assets/icons/svg/slider.svg new file mode 100644 index 000000000..fbe4f39f0 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/slider.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/star.svg b/ruoyi-ui/src/assets/icons/svg/star.svg new file mode 100644 index 000000000..6cf86e66a --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/star.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/swagger.svg b/ruoyi-ui/src/assets/icons/svg/swagger.svg new file mode 100644 index 000000000..05d4e7bce --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/swagger.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/switch.svg b/ruoyi-ui/src/assets/icons/svg/switch.svg new file mode 100644 index 000000000..0ba61e38d --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/switch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/system.svg b/ruoyi-ui/src/assets/icons/svg/system.svg new file mode 100644 index 000000000..5992593e0 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/system.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/tab.svg b/ruoyi-ui/src/assets/icons/svg/tab.svg new file mode 100644 index 000000000..b4b48e480 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/table.svg b/ruoyi-ui/src/assets/icons/svg/table.svg new file mode 100644 index 000000000..0e3dc9dea --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/textarea.svg b/ruoyi-ui/src/assets/icons/svg/textarea.svg new file mode 100644 index 000000000..2709f292e --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/textarea.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/theme.svg b/ruoyi-ui/src/assets/icons/svg/theme.svg new file mode 100644 index 000000000..5982a2f78 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/theme.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/time-range.svg b/ruoyi-ui/src/assets/icons/svg/time-range.svg new file mode 100644 index 000000000..13c1202bd --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/time-range.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/time.svg b/ruoyi-ui/src/assets/icons/svg/time.svg new file mode 100644 index 000000000..b376e32a6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/time.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/tool.svg b/ruoyi-ui/src/assets/icons/svg/tool.svg new file mode 100644 index 000000000..48e0e3573 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/tool.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/tree-table.svg b/ruoyi-ui/src/assets/icons/svg/tree-table.svg new file mode 100644 index 000000000..8aafdb829 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/tree-table.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/tree.svg b/ruoyi-ui/src/assets/icons/svg/tree.svg new file mode 100644 index 000000000..dd4b7dd22 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/tree.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/upload.svg b/ruoyi-ui/src/assets/icons/svg/upload.svg new file mode 100644 index 000000000..bae49c0a5 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/upload.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/user.svg b/ruoyi-ui/src/assets/icons/svg/user.svg new file mode 100644 index 000000000..0ba0716a6 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/user.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/validCode.svg b/ruoyi-ui/src/assets/icons/svg/validCode.svg new file mode 100644 index 000000000..cfb10214c --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/validCode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/wechat.svg b/ruoyi-ui/src/assets/icons/svg/wechat.svg new file mode 100644 index 000000000..c586e5511 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/wechat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svg/zip.svg b/ruoyi-ui/src/assets/icons/svg/zip.svg new file mode 100644 index 000000000..f806fc482 --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svg/zip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/icons/svgo.yml b/ruoyi-ui/src/assets/icons/svgo.yml new file mode 100644 index 000000000..d11906aec --- /dev/null +++ b/ruoyi-ui/src/assets/icons/svgo.yml @@ -0,0 +1,22 @@ +# replace default config + +# multipass: true +# full: true + +plugins: + + # - name + # + # or: + # - name: false + # - name: true + # + # or: + # - name: + # param1: 1 + # param2: 2 + +- removeAttrs: + attrs: + - 'fill' + - 'fill-rule' diff --git a/ruoyi-ui/src/assets/images/dark.svg b/ruoyi-ui/src/assets/images/dark.svg new file mode 100644 index 000000000..f646bd7ea --- /dev/null +++ b/ruoyi-ui/src/assets/images/dark.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/images/light.svg b/ruoyi-ui/src/assets/images/light.svg new file mode 100644 index 000000000..ab7cc088f --- /dev/null +++ b/ruoyi-ui/src/assets/images/light.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/assets/images/login-background.jpg b/ruoyi-ui/src/assets/images/login-background.jpg new file mode 100644 index 000000000..8a89eb829 Binary files /dev/null and b/ruoyi-ui/src/assets/images/login-background.jpg differ diff --git a/ruoyi-admin/src/main/resources/static/img/pay.png b/ruoyi-ui/src/assets/images/pay.png similarity index 100% rename from ruoyi-admin/src/main/resources/static/img/pay.png rename to ruoyi-ui/src/assets/images/pay.png diff --git a/ruoyi-admin/src/main/resources/static/img/profile.jpg b/ruoyi-ui/src/assets/images/profile.jpg similarity index 100% rename from ruoyi-admin/src/main/resources/static/img/profile.jpg rename to ruoyi-ui/src/assets/images/profile.jpg diff --git a/ruoyi-ui/src/assets/logo/logo.png b/ruoyi-ui/src/assets/logo/logo.png new file mode 100644 index 000000000..e26376026 Binary files /dev/null and b/ruoyi-ui/src/assets/logo/logo.png differ diff --git a/ruoyi-ui/src/assets/styles/btn.scss b/ruoyi-ui/src/assets/styles/btn.scss new file mode 100644 index 000000000..e6ba1a8e1 --- /dev/null +++ b/ruoyi-ui/src/assets/styles/btn.scss @@ -0,0 +1,99 @@ +@import './variables.scss'; + +@mixin colorBtn($color) { + background: $color; + + &:hover { + color: $color; + + &:before, + &:after { + background: $color; + } + } +} + +.blue-btn { + @include colorBtn($blue) +} + +.light-blue-btn { + @include colorBtn($light-blue) +} + +.red-btn { + @include colorBtn($red) +} + +.pink-btn { + @include colorBtn($pink) +} + +.green-btn { + @include colorBtn($green) +} + +.tiffany-btn { + @include colorBtn($tiffany) +} + +.yellow-btn { + @include colorBtn($yellow) +} + +.pan-btn { + font-size: 14px; + color: #fff; + padding: 14px 36px; + border-radius: 8px; + border: none; + outline: none; + transition: 600ms ease all; + position: relative; + display: inline-block; + + &:hover { + background: #fff; + + &:before, + &:after { + width: 100%; + transition: 600ms ease all; + } + } + + &:before, + &:after { + content: ''; + position: absolute; + top: 0; + right: 0; + height: 2px; + width: 0; + transition: 400ms ease all; + } + + &::after { + right: inherit; + top: inherit; + left: 0; + bottom: 0; + } +} + +.custom-button { + display: inline-block; + line-height: 1; + white-space: nowrap; + cursor: pointer; + background: #fff; + color: #fff; + -webkit-appearance: none; + text-align: center; + box-sizing: border-box; + outline: 0; + margin: 0; + padding: 10px 15px; + font-size: 14px; + border-radius: 4px; +} diff --git a/ruoyi-ui/src/assets/styles/element-ui.scss b/ruoyi-ui/src/assets/styles/element-ui.scss new file mode 100644 index 000000000..363092a63 --- /dev/null +++ b/ruoyi-ui/src/assets/styles/element-ui.scss @@ -0,0 +1,92 @@ +// cover some element-ui styles + +.el-breadcrumb__inner, +.el-breadcrumb__inner a { + font-weight: 400 !important; +} + +.el-upload { + input[type="file"] { + display: none !important; + } +} + +.el-upload__input { + display: none; +} + +.cell { + .el-tag { + margin-right: 0px; + } +} + +.small-padding { + .cell { + padding-left: 5px; + padding-right: 5px; + } +} + +.fixed-width { + .el-button--mini { + padding: 7px 10px; + width: 60px; + } +} + +.status-col { + .cell { + padding: 0 10px; + text-align: center; + + .el-tag { + margin-right: 0px; + } + } +} + +// to fixed https://github.com/ElemeFE/element/issues/2461 +.el-dialog { + transform: none; + left: 0; + position: relative; + margin: 0 auto; +} + +// refine element ui upload +.upload-container { + .el-upload { + width: 100%; + + .el-upload-dragger { + width: 100%; + height: 200px; + } + } +} + +// dropdown +.el-dropdown-menu { + a { + display: block + } +} + +// fix date-picker ui bug in filter-item +.el-range-editor.el-input__inner { + display: inline-flex !important; +} + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} + +.el-menu--collapse + > div + > .el-submenu + > .el-submenu__title + .el-submenu__icon-arrow { + display: none; +} \ No newline at end of file diff --git a/ruoyi-ui/src/assets/styles/element-variables.scss b/ruoyi-ui/src/assets/styles/element-variables.scss new file mode 100644 index 000000000..1615ff289 --- /dev/null +++ b/ruoyi-ui/src/assets/styles/element-variables.scss @@ -0,0 +1,31 @@ +/** +* I think element-ui's default theme color is too light for long-term use. +* So I modified the default color and you can modify it to your liking. +**/ + +/* theme color */ +$--color-primary: #1890ff; +$--color-success: #13ce66; +$--color-warning: #ffba00; +$--color-danger: #ff4949; +// $--color-info: #1E1E1E; + +$--button-font-weight: 400; + +// $--color-text-regular: #1f2d3d; + +$--border-color-light: #dfe4ed; +$--border-color-lighter: #e6ebf5; + +$--table-border: 1px solid #dfe6ec; + +/* icon font path, required */ +$--font-path: '~element-ui/lib/theme-chalk/fonts'; + +@import "~element-ui/packages/theme-chalk/src/index"; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + theme: $--color-primary; +} diff --git a/ruoyi-ui/src/assets/styles/index.scss b/ruoyi-ui/src/assets/styles/index.scss new file mode 100644 index 000000000..2f3b9ef9c --- /dev/null +++ b/ruoyi-ui/src/assets/styles/index.scss @@ -0,0 +1,182 @@ +@import './variables.scss'; +@import './mixin.scss'; +@import './transition.scss'; +@import './element-ui.scss'; +@import './sidebar.scss'; +@import './btn.scss'; + +body { + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; +} + +label { + font-weight: 700; +} + +html { + height: 100%; + box-sizing: border-box; +} + +#app { + height: 100%; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +.no-padding { + padding: 0px !important; +} + +.padding-content { + padding: 4px 0; +} + +a:focus, +a:active { + outline: none; +} + +a, +a:focus, +a:hover { + cursor: pointer; + color: inherit; + text-decoration: none; +} + +div:focus { + outline: none; +} + +.fr { + float: right; +} + +.fl { + float: left; +} + +.pr-5 { + padding-right: 5px; +} + +.pl-5 { + padding-left: 5px; +} + +.block { + display: block; +} + +.pointer { + cursor: pointer; +} + +.inlineBlock { + display: block; +} + +.clearfix { + &:after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; + } +} + +aside { + background: #eef1f6; + padding: 8px 24px; + margin-bottom: 20px; + border-radius: 2px; + display: block; + line-height: 32px; + font-size: 16px; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + color: #2c3e50; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + + a { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } + } +} + +//main-container全局样式 +.app-container { + padding: 20px; +} + +.components-container { + margin: 30px 50px; + position: relative; +} + +.pagination-container { + margin-top: 30px; +} + +.text-center { + text-align: center +} + +.sub-navbar { + height: 50px; + line-height: 50px; + position: relative; + width: 100%; + text-align: right; + padding-right: 20px; + transition: 600ms ease position; + background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%); + + .subtitle { + font-size: 20px; + color: #fff; + } + + &.draft { + background: #d0d0d0; + } + + &.deleted { + background: #d0d0d0; + } +} + +.link-type, +.link-type:focus { + color: #337ab7; + cursor: pointer; + + &:hover { + color: rgb(32, 160, 255); + } +} + +.filter-container { + padding-bottom: 10px; + + .filter-item { + display: inline-block; + vertical-align: middle; + margin-bottom: 10px; + } +} diff --git a/ruoyi-ui/src/assets/styles/mixin.scss b/ruoyi-ui/src/assets/styles/mixin.scss new file mode 100644 index 000000000..06fa06125 --- /dev/null +++ b/ruoyi-ui/src/assets/styles/mixin.scss @@ -0,0 +1,66 @@ +@mixin clearfix { + &:after { + content: ""; + display: table; + clear: both; + } +} + +@mixin scrollBar { + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } +} + +@mixin relative { + position: relative; + width: 100%; + height: 100%; +} + +@mixin pct($pct) { + width: #{$pct}; + position: relative; + margin: 0 auto; +} + +@mixin triangle($width, $height, $color, $direction) { + $width: $width/2; + $color-border-style: $height solid $color; + $transparent-border-style: $width solid transparent; + height: 0; + width: 0; + + @if $direction==up { + border-bottom: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==right { + border-left: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } + + @else if $direction==down { + border-top: $color-border-style; + border-left: $transparent-border-style; + border-right: $transparent-border-style; + } + + @else if $direction==left { + border-right: $color-border-style; + border-top: $transparent-border-style; + border-bottom: $transparent-border-style; + } +} diff --git a/ruoyi-ui/src/assets/styles/ruoyi.scss b/ruoyi-ui/src/assets/styles/ruoyi.scss new file mode 100644 index 000000000..4e298744c --- /dev/null +++ b/ruoyi-ui/src/assets/styles/ruoyi.scss @@ -0,0 +1,291 @@ +/** +* 通用css样式布局处理 +* Copyright (c) 2019 ruoyi +*/ + +/** 基础通用 **/ +.pt5 { + padding-top: 5px; +} + +.pr5 { + padding-right: 5px; +} + +.pb5 { + padding-bottom: 5px; +} + +.mt5 { + margin-top: 5px; +} + +.mr5 { + margin-right: 5px; +} + +.mb5 { + margin-bottom: 5px; +} + +.mb8 { + margin-bottom: 8px; +} + +.ml5 { + margin-left: 5px; +} + +.mt10 { + margin-top: 10px; +} + +.mr10 { + margin-right: 10px; +} + +.mb10 { + margin-bottom: 10px; +} +.ml10 { + margin-left: 10px; +} + +.mt20 { + margin-top: 20px; +} + +.mr20 { + margin-right: 20px; +} + +.mb20 { + margin-bottom: 20px; +} +.ml20 { + margin-left: 20px; +} + +.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; +} + +.el-message-box__status + .el-message-box__message{ + word-break: break-word; +} + +.el-dialog:not(.is-fullscreen) { + margin-top: 6vh !important; +} + +.el-dialog__wrapper.scrollbar .el-dialog .el-dialog__body { + overflow: auto; + overflow-x: hidden; + max-height: 70vh; + padding: 10px 20px 0; +} + +.el-table { + .el-table__header-wrapper, .el-table__fixed-header-wrapper { + th { + word-break: break-word; + background-color: #f8f8f9; + color: #515a6e; + height: 40px; + font-size: 13px; + } + } + + .el-table__body-wrapper { + .el-button [class*="el-icon-"] + span { + margin-left: 1px; + } + } +} + +/** 表单布局 **/ +.form-header { + font-size: 15px; + color: #6379bb; + border-bottom: 1px solid #ddd; + margin: 8px 10px 25px 10px; + padding-bottom: 5px +} + +/** 表格布局 **/ +.pagination-container { + position: relative; + height: 25px; + margin-bottom: 10px; + margin-top: 15px; + padding: 10px 20px !important; +} + +/* tree border */ +.tree-border { + margin-top: 5px; + border: 1px solid #e5e6e7; + background: #FFFFFF none; + border-radius: 4px; +} + +.pagination-container .el-pagination { + right: 0; + position: absolute; +} + +@media (max-width: 768px) { + .pagination-container .el-pagination > .el-pagination__jump { + display: none !important; + } + .pagination-container .el-pagination > .el-pagination__sizes { + display: none !important; + } +} + +.el-table .fixed-width .el-button--mini { + padding-left: 0; + padding-right: 0; + width: inherit; +} + +/** 表格更多操作下拉样式 */ +.el-table .el-dropdown-link,.el-table .el-dropdown-selfdefine { + cursor: pointer; + margin-left: 5px; +} + +.el-table .el-dropdown, .el-icon-arrow-down { + font-size: 12px; +} + +.el-tree-node__content > .el-checkbox { + margin-right: 8px; +} + +.list-group-striped > .list-group-item { + border-left: 0; + border-right: 0; + border-radius: 0; + padding-left: 0; + padding-right: 0; +} + +.list-group { + padding-left: 0px; + list-style: none; +} + +.list-group-item { + border-bottom: 1px solid #e7eaec; + border-top: 1px solid #e7eaec; + margin-bottom: -1px; + padding: 11px 0px; + font-size: 13px; +} + +.pull-right { + float: right !important; +} + +.el-card__header { + padding: 14px 15px 7px; + min-height: 40px; +} + +.el-card__body { + padding: 15px 20px 20px 20px; +} + +.card-box { + padding-right: 15px; + padding-left: 15px; + margin-bottom: 10px; +} + +/* button color */ +.el-button--cyan.is-active, +.el-button--cyan:active { + background: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +.el-button--cyan:focus, +.el-button--cyan:hover { + background: #48D1CC; + border-color: #48D1CC; + color: #FFFFFF; +} + +.el-button--cyan { + background-color: #20B2AA; + border-color: #20B2AA; + color: #FFFFFF; +} + +/* text color */ +.text-navy { + color: #1ab394; +} + +.text-primary { + color: inherit; +} + +.text-success { + color: #1c84c6; +} + +.text-info { + color: #23c6c8; +} + +.text-warning { + color: #f8ac59; +} + +.text-danger { + color: #ed5565; +} + +.text-muted { + color: #888888; +} + +/* image */ +.img-circle { + border-radius: 50%; +} + +.img-lg { + width: 120px; + height: 120px; +} + +.avatar-upload-preview { + position: relative; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 200px; + height: 200px; + border-radius: 50%; + box-shadow: 0 0 4px #ccc; + overflow: hidden; +} + +/* 拖拽列样式 */ +.sortable-ghost { + opacity: .8; + color: #fff !important; + background: #42b983 !important; +} + +.top-right-btn { + position: relative; + float: right; +} diff --git a/ruoyi-ui/src/assets/styles/sidebar.scss b/ruoyi-ui/src/assets/styles/sidebar.scss new file mode 100644 index 000000000..abe5b6317 --- /dev/null +++ b/ruoyi-ui/src/assets/styles/sidebar.scss @@ -0,0 +1,227 @@ +#app { + + .main-container { + height: 100%; + transition: margin-left .28s; + margin-left: $base-sidebar-width; + position: relative; + } + + .sidebarHide { + margin-left: 0!important; + } + + .sidebar-container { + -webkit-transition: width .28s; + transition: width 0.28s; + width: $base-sidebar-width !important; + background-color: $base-menu-background; + height: 100%; + position: fixed; + font-size: 0px; + top: 0; + bottom: 0; + left: 0; + z-index: 1001; + overflow: hidden; + -webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35); + box-shadow: 2px 0 6px rgba(0,21,41,.35); + + // reset element-ui css + .horizontal-collapse-transition { + transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; + } + + .scrollbar-wrapper { + overflow-x: hidden !important; + } + + .el-scrollbar__bar.is-vertical { + right: 0px; + } + + .el-scrollbar { + height: 100%; + } + + &.has-logo { + .el-scrollbar { + height: calc(100% - 50px); + } + } + + .is-horizontal { + display: none; + } + + a { + display: inline-block; + width: 100%; + overflow: hidden; + } + + .svg-icon { + margin-right: 16px; + } + + .el-menu { + border: none; + height: 100%; + width: 100% !important; + } + + .el-menu-item, .el-submenu__title { + overflow: hidden !important; + text-overflow: ellipsis !important; + white-space: nowrap !important; + } + + // menu hover + .submenu-title-noDropdown, + .el-submenu__title { + &:hover { + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + & .theme-dark .is-active > .el-submenu__title { + color: $base-menu-color-active !important; + } + + & .nest-menu .el-submenu>.el-submenu__title, + & .el-submenu .el-menu-item { + min-width: $base-sidebar-width !important; + + &:hover { + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + & .theme-dark .nest-menu .el-submenu>.el-submenu__title, + & .theme-dark .el-submenu .el-menu-item { + background-color: $base-sub-menu-background !important; + + &:hover { + background-color: $base-sub-menu-hover !important; + } + } + } + + .hideSidebar { + .sidebar-container { + width: 54px !important; + } + + .main-container { + margin-left: 54px; + } + + .submenu-title-noDropdown { + padding: 0 !important; + position: relative; + + .el-tooltip { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + } + } + + .el-submenu { + overflow: hidden; + + &>.el-submenu__title { + padding: 0 !important; + + .svg-icon { + margin-left: 20px; + } + + } + } + + .el-menu--collapse { + .el-submenu { + &>.el-submenu__title { + &>span { + height: 0; + width: 0; + overflow: hidden; + visibility: hidden; + display: inline-block; + } + } + } + } + } + + .el-menu--collapse .el-menu .el-submenu { + min-width: $base-sidebar-width !important; + } + + // mobile responsive + .mobile { + .main-container { + margin-left: 0px; + } + + .sidebar-container { + transition: transform .28s; + width: $base-sidebar-width !important; + } + + &.hideSidebar { + .sidebar-container { + pointer-events: none; + transition-duration: 0.3s; + transform: translate3d(-$base-sidebar-width, 0, 0); + } + } + } + + .withoutAnimation { + + .main-container, + .sidebar-container { + transition: none; + } + } +} + +// when menu collapsed +.el-menu--vertical { + &>.el-menu { + .svg-icon { + margin-right: 16px; + } + } + + .nest-menu .el-submenu>.el-submenu__title, + .el-menu-item { + &:hover { + // you can use $subMenuHover + background-color: rgba(0, 0, 0, 0.06) !important; + } + } + + // the scroll bar appears when the subMenu is too long + >.el-menu--popup { + max-height: 100vh; + overflow-y: auto; + + &::-webkit-scrollbar-track-piece { + background: #d3dce6; + } + + &::-webkit-scrollbar { + width: 6px; + } + + &::-webkit-scrollbar-thumb { + background: #99a9bf; + border-radius: 20px; + } + } +} diff --git a/ruoyi-ui/src/assets/styles/transition.scss b/ruoyi-ui/src/assets/styles/transition.scss new file mode 100644 index 000000000..073f8c6ce --- /dev/null +++ b/ruoyi-ui/src/assets/styles/transition.scss @@ -0,0 +1,49 @@ +// global transition css + +/* fade */ +.fade-enter-active, +.fade-leave-active { + transition: opacity 0.28s; +} + +.fade-enter, +.fade-leave-active { + opacity: 0; +} + +/* fade-transform */ +.fade-transform--move, +.fade-transform-leave-active, +.fade-transform-enter-active { + transition: all .5s; +} + +.fade-transform-enter { + opacity: 0; + transform: translateX(-30px); +} + +.fade-transform-leave-to { + opacity: 0; + transform: translateX(30px); +} + +/* breadcrumb transition */ +.breadcrumb-enter-active, +.breadcrumb-leave-active { + transition: all .5s; +} + +.breadcrumb-enter, +.breadcrumb-leave-active { + opacity: 0; + transform: translateX(20px); +} + +.breadcrumb-move { + transition: all .5s; +} + +.breadcrumb-leave-active { + position: absolute; +} diff --git a/ruoyi-ui/src/assets/styles/variables.scss b/ruoyi-ui/src/assets/styles/variables.scss new file mode 100644 index 000000000..34484d47e --- /dev/null +++ b/ruoyi-ui/src/assets/styles/variables.scss @@ -0,0 +1,54 @@ +// base color +$blue:#324157; +$light-blue:#3A71A8; +$red:#C03639; +$pink: #E65D6E; +$green: #30B08F; +$tiffany: #4AB7BD; +$yellow:#FEC171; +$panGreen: #30B08F; + +// 默认菜单主题风格 +$base-menu-color:#bfcbd9; +$base-menu-color-active:#f4f4f5; +$base-menu-background:#304156; +$base-logo-title-color: #ffffff; + +$base-menu-light-color:rgba(0,0,0,.70); +$base-menu-light-background:#ffffff; +$base-logo-light-title-color: #001529; + +$base-sub-menu-background:#1f2d3d; +$base-sub-menu-hover:#001528; + +// 自定义暗色菜单风格 +/** +$base-menu-color:hsla(0,0%,100%,.65); +$base-menu-color-active:#fff; +$base-menu-background:#001529; +$base-logo-title-color: #ffffff; + +$base-menu-light-color:rgba(0,0,0,.70); +$base-menu-light-background:#ffffff; +$base-logo-light-title-color: #001529; + +$base-sub-menu-background:#000c17; +$base-sub-menu-hover:#001528; +*/ + +$base-sidebar-width: 200px; + +// the :export directive is the magic sauce for webpack +// https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass +:export { + menuColor: $base-menu-color; + menuLightColor: $base-menu-light-color; + menuColorActive: $base-menu-color-active; + menuBackground: $base-menu-background; + menuLightBackground: $base-menu-light-background; + subMenuBackground: $base-sub-menu-background; + subMenuHover: $base-sub-menu-hover; + sideBarWidth: $base-sidebar-width; + logoTitleColor: $base-logo-title-color; + logoLightTitleColor: $base-logo-light-title-color +} diff --git a/ruoyi-ui/src/components/Breadcrumb/index.vue b/ruoyi-ui/src/components/Breadcrumb/index.vue new file mode 100644 index 000000000..1696f5471 --- /dev/null +++ b/ruoyi-ui/src/components/Breadcrumb/index.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/ruoyi-ui/src/components/Crontab/day.vue b/ruoyi-ui/src/components/Crontab/day.vue new file mode 100644 index 000000000..fe3eaf0c4 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/day.vue @@ -0,0 +1,161 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue new file mode 100644 index 000000000..4b1f1fcdb --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -0,0 +1,114 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/index.vue b/ruoyi-ui/src/components/Crontab/index.vue new file mode 100644 index 000000000..3963df28e --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/index.vue @@ -0,0 +1,430 @@ + + + + diff --git a/ruoyi-ui/src/components/Crontab/min.vue b/ruoyi-ui/src/components/Crontab/min.vue new file mode 100644 index 000000000..43cab900d --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/min.vue @@ -0,0 +1,116 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/components/Crontab/month.vue b/ruoyi-ui/src/components/Crontab/month.vue new file mode 100644 index 000000000..fd0ac384f --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/month.vue @@ -0,0 +1,114 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/result.vue b/ruoyi-ui/src/components/Crontab/result.vue new file mode 100644 index 000000000..aea6e0e46 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/result.vue @@ -0,0 +1,559 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/second.vue b/ruoyi-ui/src/components/Crontab/second.vue new file mode 100644 index 000000000..e7b776171 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/second.vue @@ -0,0 +1,117 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue new file mode 100644 index 000000000..1cec700e8 --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -0,0 +1,202 @@ + + + diff --git a/ruoyi-ui/src/components/Crontab/year.vue b/ruoyi-ui/src/components/Crontab/year.vue new file mode 100644 index 000000000..5487a6c7f --- /dev/null +++ b/ruoyi-ui/src/components/Crontab/year.vue @@ -0,0 +1,131 @@ + + + diff --git a/ruoyi-ui/src/components/DictData/index.js b/ruoyi-ui/src/components/DictData/index.js new file mode 100644 index 000000000..7b85d4aaa --- /dev/null +++ b/ruoyi-ui/src/components/DictData/index.js @@ -0,0 +1,49 @@ +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: { + '*': { + labelField: 'dictLabel', + valueField: 'dictValue', + request(dictMeta) { + 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) + }) + }) + } + }, + }, + }, + }) +} + +export default { + install, +} \ No newline at end of file diff --git a/ruoyi-ui/src/components/DictTag/index.vue b/ruoyi-ui/src/components/DictTag/index.vue new file mode 100644 index 000000000..6b5b230f5 --- /dev/null +++ b/ruoyi-ui/src/components/DictTag/index.vue @@ -0,0 +1,89 @@ + + + + diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue new file mode 100644 index 000000000..8981d7635 --- /dev/null +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -0,0 +1,274 @@ + + + + + diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue new file mode 100644 index 000000000..c7f6b0af0 --- /dev/null +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/ruoyi-ui/src/components/Hamburger/index.vue b/ruoyi-ui/src/components/Hamburger/index.vue new file mode 100644 index 000000000..368b00215 --- /dev/null +++ b/ruoyi-ui/src/components/Hamburger/index.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/ruoyi-ui/src/components/HeaderSearch/index.vue b/ruoyi-ui/src/components/HeaderSearch/index.vue new file mode 100644 index 000000000..7d6780be9 --- /dev/null +++ b/ruoyi-ui/src/components/HeaderSearch/index.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/ruoyi-ui/src/components/IconSelect/index.vue b/ruoyi-ui/src/components/IconSelect/index.vue new file mode 100644 index 000000000..8dadc028a --- /dev/null +++ b/ruoyi-ui/src/components/IconSelect/index.vue @@ -0,0 +1,104 @@ + + + + + + diff --git a/ruoyi-ui/src/components/IconSelect/requireIcons.js b/ruoyi-ui/src/components/IconSelect/requireIcons.js new file mode 100644 index 000000000..99e5c54cc --- /dev/null +++ b/ruoyi-ui/src/components/IconSelect/requireIcons.js @@ -0,0 +1,11 @@ + +const req = require.context('../../assets/icons/svg', false, /\.svg$/) +const requireAll = requireContext => requireContext.keys() + +const re = /\.\/(.*)\.svg/ + +const icons = requireAll(req).map(i => { + return i.match(re)[1] +}) + +export default icons diff --git a/ruoyi-ui/src/components/ImagePreview/index.vue b/ruoyi-ui/src/components/ImagePreview/index.vue new file mode 100644 index 000000000..3c770c703 --- /dev/null +++ b/ruoyi-ui/src/components/ImagePreview/index.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue new file mode 100644 index 000000000..2e64c9b8f --- /dev/null +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -0,0 +1,226 @@ + + + + + diff --git a/ruoyi-ui/src/components/Pagination/index.vue b/ruoyi-ui/src/components/Pagination/index.vue new file mode 100644 index 000000000..56f5a6b9d --- /dev/null +++ b/ruoyi-ui/src/components/Pagination/index.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/ruoyi-ui/src/components/PanThumb/index.vue b/ruoyi-ui/src/components/PanThumb/index.vue new file mode 100644 index 000000000..1bcf41709 --- /dev/null +++ b/ruoyi-ui/src/components/PanThumb/index.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/ruoyi-ui/src/components/ParentView/index.vue b/ruoyi-ui/src/components/ParentView/index.vue new file mode 100644 index 000000000..7bf614897 --- /dev/null +++ b/ruoyi-ui/src/components/ParentView/index.vue @@ -0,0 +1,3 @@ + diff --git a/ruoyi-ui/src/components/RightPanel/index.vue b/ruoyi-ui/src/components/RightPanel/index.vue new file mode 100644 index 000000000..5abeecb00 --- /dev/null +++ b/ruoyi-ui/src/components/RightPanel/index.vue @@ -0,0 +1,106 @@ + + + + + diff --git a/ruoyi-ui/src/components/RightToolbar/index.vue b/ruoyi-ui/src/components/RightToolbar/index.vue new file mode 100644 index 000000000..67da29300 --- /dev/null +++ b/ruoyi-ui/src/components/RightToolbar/index.vue @@ -0,0 +1,129 @@ + + + diff --git a/ruoyi-ui/src/components/RuoYi/Doc/index.vue b/ruoyi-ui/src/components/RuoYi/Doc/index.vue new file mode 100644 index 000000000..75fa86410 --- /dev/null +++ b/ruoyi-ui/src/components/RuoYi/Doc/index.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/components/RuoYi/Git/index.vue b/ruoyi-ui/src/components/RuoYi/Git/index.vue new file mode 100644 index 000000000..bdafbaefa --- /dev/null +++ b/ruoyi-ui/src/components/RuoYi/Git/index.vue @@ -0,0 +1,21 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/components/Screenfull/index.vue b/ruoyi-ui/src/components/Screenfull/index.vue new file mode 100644 index 000000000..d4e539c26 --- /dev/null +++ b/ruoyi-ui/src/components/Screenfull/index.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/ruoyi-ui/src/components/SizeSelect/index.vue b/ruoyi-ui/src/components/SizeSelect/index.vue new file mode 100644 index 000000000..069b5de9b --- /dev/null +++ b/ruoyi-ui/src/components/SizeSelect/index.vue @@ -0,0 +1,56 @@ + + + diff --git a/ruoyi-ui/src/components/SvgIcon/index.vue b/ruoyi-ui/src/components/SvgIcon/index.vue new file mode 100644 index 000000000..e4bf5ade1 --- /dev/null +++ b/ruoyi-ui/src/components/SvgIcon/index.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/ruoyi-ui/src/components/ThemePicker/index.vue b/ruoyi-ui/src/components/ThemePicker/index.vue new file mode 100644 index 000000000..1714e1f39 --- /dev/null +++ b/ruoyi-ui/src/components/ThemePicker/index.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue new file mode 100644 index 000000000..86a91c4cf --- /dev/null +++ b/ruoyi-ui/src/components/TopNav/index.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/ruoyi-ui/src/components/iFrame/index.vue b/ruoyi-ui/src/components/iFrame/index.vue new file mode 100644 index 000000000..426857fb1 --- /dev/null +++ b/ruoyi-ui/src/components/iFrame/index.vue @@ -0,0 +1,36 @@ + + + diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue new file mode 100644 index 000000000..466cd981e --- /dev/null +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue new file mode 100644 index 000000000..bb3c9ce90 --- /dev/null +++ b/ruoyi-ui/src/layout/components/Settings/index.vue @@ -0,0 +1,260 @@ + + + + + diff --git a/ruoyi-ui/src/layout/components/Sidebar/FixiOSBug.js b/ruoyi-ui/src/layout/components/Sidebar/FixiOSBug.js new file mode 100644 index 000000000..682372699 --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/FixiOSBug.js @@ -0,0 +1,25 @@ +export default { + computed: { + device() { + return this.$store.state.app.device + } + }, + mounted() { + // In order to fix the click on menu on the ios device will trigger the mouseleave bug + this.fixBugIniOS() + }, + methods: { + fixBugIniOS() { + const $subMenu = this.$refs.subMenu + if ($subMenu) { + const handleMouseleave = $subMenu.handleMouseleave + $subMenu.handleMouseleave = (e) => { + if (this.device === 'mobile') { + return + } + handleMouseleave(e) + } + } + } + } +} diff --git a/ruoyi-ui/src/layout/components/Sidebar/Item.vue b/ruoyi-ui/src/layout/components/Sidebar/Item.vue new file mode 100644 index 000000000..be3285dfb --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/Item.vue @@ -0,0 +1,33 @@ + diff --git a/ruoyi-ui/src/layout/components/Sidebar/Link.vue b/ruoyi-ui/src/layout/components/Sidebar/Link.vue new file mode 100644 index 000000000..8b0bc93bd --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/Link.vue @@ -0,0 +1,43 @@ + + + diff --git a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue new file mode 100644 index 000000000..2774cc836 --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue b/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue new file mode 100644 index 000000000..82ba40786 --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/SidebarItem.vue @@ -0,0 +1,100 @@ + + + diff --git a/ruoyi-ui/src/layout/components/Sidebar/index.vue b/ruoyi-ui/src/layout/components/Sidebar/index.vue new file mode 100644 index 000000000..51d0839f3 --- /dev/null +++ b/ruoyi-ui/src/layout/components/Sidebar/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue new file mode 100644 index 000000000..bb753a124 --- /dev/null +++ b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue new file mode 100644 index 000000000..96585a5b1 --- /dev/null +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -0,0 +1,332 @@ + + + + + + + diff --git a/ruoyi-ui/src/layout/components/index.js b/ruoyi-ui/src/layout/components/index.js new file mode 100644 index 000000000..104bd3ac6 --- /dev/null +++ b/ruoyi-ui/src/layout/components/index.js @@ -0,0 +1,5 @@ +export { default as AppMain } from './AppMain' +export { default as Navbar } from './Navbar' +export { default as Settings } from './Settings' +export { default as Sidebar } from './Sidebar/index.vue' +export { default as TagsView } from './TagsView/index.vue' diff --git a/ruoyi-ui/src/layout/index.vue b/ruoyi-ui/src/layout/index.vue new file mode 100644 index 000000000..dba4393da --- /dev/null +++ b/ruoyi-ui/src/layout/index.vue @@ -0,0 +1,111 @@ + + + + + diff --git a/ruoyi-ui/src/layout/mixin/ResizeHandler.js b/ruoyi-ui/src/layout/mixin/ResizeHandler.js new file mode 100644 index 000000000..e8d0df8c2 --- /dev/null +++ b/ruoyi-ui/src/layout/mixin/ResizeHandler.js @@ -0,0 +1,45 @@ +import store from '@/store' + +const { body } = document +const WIDTH = 992 // refer to Bootstrap's responsive design + +export default { + watch: { + $route(route) { + if (this.device === 'mobile' && this.sidebar.opened) { + store.dispatch('app/closeSideBar', { withoutAnimation: false }) + } + } + }, + beforeMount() { + window.addEventListener('resize', this.$_resizeHandler) + }, + beforeDestroy() { + window.removeEventListener('resize', this.$_resizeHandler) + }, + mounted() { + const isMobile = this.$_isMobile() + if (isMobile) { + store.dispatch('app/toggleDevice', 'mobile') + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_isMobile() { + const rect = body.getBoundingClientRect() + return rect.width - 1 < WIDTH + }, + $_resizeHandler() { + if (!document.hidden) { + const isMobile = this.$_isMobile() + store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop') + + if (isMobile) { + store.dispatch('app/closeSideBar', { withoutAnimation: true }) + } + } + } + } +} diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js new file mode 100644 index 000000000..13c6cf290 --- /dev/null +++ b/ruoyi-ui/src/main.js @@ -0,0 +1,86 @@ +import Vue from 'vue' + +import Cookies from 'js-cookie' + +import Element from 'element-ui' +import './assets/styles/element-variables.scss' + +import '@/assets/styles/index.scss' // global css +import '@/assets/styles/ruoyi.scss' // ruoyi css +import App from './App' +import store from './store' +import router from './router' +import directive from './directive' // directive +import plugins from './plugins' // plugins +import { download } from '@/utils/request' + +import './assets/icons' // icon +import './permission' // permission control +import { getDicts } from "@/api/system/dict/data"; +import { getConfigKey } from "@/api/system/config"; +import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"; +// 分页组件 +import Pagination from "@/components/Pagination"; +// 自定义表格工具组件 +import RightToolbar from "@/components/RightToolbar" +// 富文本组件 +import Editor from "@/components/Editor" +// 文件上传组件 +import FileUpload from "@/components/FileUpload" +// 图片上传组件 +import ImageUpload from "@/components/ImageUpload" +// 图片预览组件 +import ImagePreview from "@/components/ImagePreview" +// 字典标签组件 +import DictTag from '@/components/DictTag' +// 头部标签组件 +import VueMeta from 'vue-meta' +// 字典数据组件 +import DictData from '@/components/DictData' + +// 全局方法挂载 +Vue.prototype.getDicts = getDicts +Vue.prototype.getConfigKey = getConfigKey +Vue.prototype.parseTime = parseTime +Vue.prototype.resetForm = resetForm +Vue.prototype.addDateRange = addDateRange +Vue.prototype.selectDictLabel = selectDictLabel +Vue.prototype.selectDictLabels = selectDictLabels +Vue.prototype.download = download +Vue.prototype.handleTree = handleTree + +// 全局组件挂载 +Vue.component('DictTag', DictTag) +Vue.component('Pagination', Pagination) +Vue.component('RightToolbar', RightToolbar) +Vue.component('Editor', Editor) +Vue.component('FileUpload', FileUpload) +Vue.component('ImageUpload', ImageUpload) +Vue.component('ImagePreview', ImagePreview) + +Vue.use(directive) +Vue.use(plugins) +Vue.use(VueMeta) +DictData.install() + +/** + * If you don't want to use mock-server + * you want to use MockJs for mock api + * you can execute: mockXHR() + * + * Currently MockJs will be used in the production environment, + * please remove it before going online! ! ! + */ + +Vue.use(Element, { + size: Cookies.get('size') || 'medium' // set element-ui default size +}) + +Vue.config.productionTip = false + +new Vue({ + el: '#app', + router, + store, + render: h => h(App) +}) diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js new file mode 100644 index 000000000..c56897902 --- /dev/null +++ b/ruoyi-ui/src/permission.js @@ -0,0 +1,58 @@ +import router from './router' +import store from './store' +import { Message } from 'element-ui' +import NProgress from 'nprogress' +import 'nprogress/nprogress.css' +import { getToken } from '@/utils/auth' +import { isRelogin } from '@/utils/request' + +NProgress.configure({ showSpinner: false }) + +const whiteList = ['/login', '/register'] + +router.beforeEach((to, from, next) => { + NProgress.start() + if (getToken()) { + to.meta.title && store.dispatch('settings/setTitle', to.meta.title) + /* has token*/ + if (to.path === '/login') { + next({ path: '/' }) + NProgress.done() + } else if (whiteList.indexOf(to.path) !== -1) { + next() + } else { + if (store.getters.roles.length === 0) { + isRelogin.show = true + // 判断当前用户是否已拉取完user_info信息 + store.dispatch('GetInfo').then(() => { + isRelogin.show = false + store.dispatch('GenerateRoutes').then(accessRoutes => { + // 根据roles权限生成可访问的路由表 + router.addRoutes(accessRoutes) // 动态添加可访问路由表 + next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + }) + }).catch(err => { + store.dispatch('LogOut').then(() => { + Message.error(err) + next({ path: '/' }) + }) + }) + } else { + next() + } + } + } else { + // 没有token + if (whiteList.indexOf(to.path) !== -1) { + // 在免登录白名单,直接进入 + next() + } else { + next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 否则全部重定向到登录页 + NProgress.done() + } + } +}) + +router.afterEach(() => { + NProgress.done() +}) diff --git a/ruoyi-ui/src/plugins/auth.js b/ruoyi-ui/src/plugins/auth.js new file mode 100644 index 000000000..6c6bc2428 --- /dev/null +++ b/ruoyi-ui/src/plugins/auth.js @@ -0,0 +1,60 @@ +import store from '@/store' + +function authPermission(permission) { + const all_permission = "*:*:*"; + const permissions = store.getters && store.getters.permissions + if (permission && permission.length > 0) { + return permissions.some(v => { + return all_permission === v || v === permission + }) + } else { + return false + } +} + +function authRole(role) { + const super_admin = "admin"; + const roles = store.getters && store.getters.roles + if (role && role.length > 0) { + return roles.some(v => { + return super_admin === v || v === role + }) + } else { + return false + } +} + +export default { + // 验证用户是否具备某权限 + hasPermi(permission) { + return authPermission(permission); + }, + // 验证用户是否含有指定权限,只需包含其中一个 + hasPermiOr(permissions) { + return permissions.some(item => { + return authPermission(item) + }) + }, + // 验证用户是否含有指定权限,必须全部拥有 + hasPermiAnd(permissions) { + return permissions.every(item => { + return authPermission(item) + }) + }, + // 验证用户是否具备某角色 + hasRole(role) { + return authRole(role); + }, + // 验证用户是否含有指定角色,只需包含其中一个 + hasRoleOr(roles) { + return roles.some(item => { + return authRole(item) + }) + }, + // 验证用户是否含有指定角色,必须全部拥有 + hasRoleAnd(roles) { + return roles.every(item => { + return authRole(item) + }) + } +} diff --git a/ruoyi-ui/src/plugins/cache.js b/ruoyi-ui/src/plugins/cache.js new file mode 100644 index 000000000..6b5c00b9e --- /dev/null +++ b/ruoyi-ui/src/plugins/cache.js @@ -0,0 +1,77 @@ +const sessionCache = { + set (key, value) { + if (!sessionStorage) { + return + } + if (key != null && value != null) { + sessionStorage.setItem(key, value) + } + }, + get (key) { + if (!sessionStorage) { + return null + } + if (key == null) { + return null + } + return sessionStorage.getItem(key) + }, + setJSON (key, jsonValue) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)) + } + }, + getJSON (key) { + const value = this.get(key) + if (value != null) { + return JSON.parse(value) + } + }, + remove (key) { + sessionStorage.removeItem(key); + } +} +const localCache = { + set (key, value) { + if (!localStorage) { + return + } + if (key != null && value != null) { + localStorage.setItem(key, value) + } + }, + get (key) { + if (!localStorage) { + return null + } + if (key == null) { + return null + } + return localStorage.getItem(key) + }, + setJSON (key, jsonValue) { + if (jsonValue != null) { + this.set(key, JSON.stringify(jsonValue)) + } + }, + getJSON (key) { + const value = this.get(key) + if (value != null) { + return JSON.parse(value) + } + }, + remove (key) { + localStorage.removeItem(key); + } +} + +export default { + /** + * 会话级缓存 + */ + session: sessionCache, + /** + * 本地缓存 + */ + local: localCache +} diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js new file mode 100644 index 000000000..42acd006f --- /dev/null +++ b/ruoyi-ui/src/plugins/download.js @@ -0,0 +1,79 @@ +import axios from 'axios' +import {Loading, Message} from 'element-ui' +import { saveAs } from 'file-saver' +import { getToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { blobValidate } from "@/utils/ruoyi"; + +const baseURL = process.env.VUE_APP_BASE_API +let downloadLoadingInstance; + +export default { + name(name, isDelete = true) { + var url = baseURL + "/common/download?fileName=" + encodeURIComponent(name) + "&delete=" + isDelete + axios({ + method: 'get', + url: url, + responseType: 'blob', + headers: { 'Authorization': 'Bearer ' + getToken() } + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { + const blob = new Blob([res.data]) + this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) + } else { + this.printErrMsg(res.data); + } + }) + }, + resource(resource) { + var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource); + axios({ + method: 'get', + url: url, + responseType: 'blob', + headers: { 'Authorization': 'Bearer ' + getToken() } + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { + const blob = new Blob([res.data]) + this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) + } else { + this.printErrMsg(res.data); + } + }) + }, + zip(url, name) { + var url = baseURL + url + downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) + axios({ + method: 'get', + url: url, + responseType: 'blob', + headers: { 'Authorization': 'Bearer ' + getToken() } + }).then((res) => { + const isBlob = blobValidate(res.data); + if (isBlob) { + const blob = new Blob([res.data], { type: 'application/zip' }) + this.saveAs(blob, name) + } else { + this.printErrMsg(res.data); + } + downloadLoadingInstance.close(); + }).catch((r) => { + console.error(r) + Message.error('下载文件出现错误,请联系管理员!') + downloadLoadingInstance.close(); + }) + }, + saveAs(text, name, opts) { + saveAs(text, name, opts); + }, + async printErrMsg(data) { + const resText = await data.text(); + const rspObj = JSON.parse(resText); + const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] + Message.error(errMsg); + } +} + diff --git a/ruoyi-ui/src/plugins/index.js b/ruoyi-ui/src/plugins/index.js new file mode 100644 index 000000000..d000f2dfa --- /dev/null +++ b/ruoyi-ui/src/plugins/index.js @@ -0,0 +1,20 @@ +import tab from './tab' +import auth from './auth' +import cache from './cache' +import modal from './modal' +import download from './download' + +export default { + install(Vue) { + // 页签操作 + Vue.prototype.$tab = tab + // 认证对象 + Vue.prototype.$auth = auth + // 缓存对象 + Vue.prototype.$cache = cache + // 模态框对象 + Vue.prototype.$modal = modal + // 下载文件 + Vue.prototype.$download = download + } +} diff --git a/ruoyi-ui/src/plugins/modal.js b/ruoyi-ui/src/plugins/modal.js new file mode 100644 index 000000000..b37ca1457 --- /dev/null +++ b/ruoyi-ui/src/plugins/modal.js @@ -0,0 +1,83 @@ +import { Message, MessageBox, Notification, Loading } from 'element-ui' + +let loadingInstance; + +export default { + // 消息提示 + msg(content) { + Message.info(content) + }, + // 错误消息 + msgError(content) { + Message.error(content) + }, + // 成功消息 + msgSuccess(content) { + Message.success(content) + }, + // 警告消息 + msgWarning(content) { + Message.warning(content) + }, + // 弹出提示 + alert(content) { + MessageBox.alert(content, "系统提示") + }, + // 错误提示 + alertError(content) { + MessageBox.alert(content, "系统提示", { type: 'error' }) + }, + // 成功提示 + alertSuccess(content) { + MessageBox.alert(content, "系统提示", { type: 'success' }) + }, + // 警告提示 + alertWarning(content) { + MessageBox.alert(content, "系统提示", { type: 'warning' }) + }, + // 通知提示 + notify(content) { + Notification.info(content) + }, + // 错误通知 + notifyError(content) { + Notification.error(content); + }, + // 成功通知 + notifySuccess(content) { + Notification.success(content) + }, + // 警告通知 + notifyWarning(content) { + Notification.warning(content) + }, + // 确认窗体 + confirm(content) { + return MessageBox.confirm(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, + // 提交内容 + prompt(content) { + return MessageBox.prompt(content, "系统提示", { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: "warning", + }) + }, + // 打开遮罩层 + loading(content) { + loadingInstance = Loading.service({ + lock: true, + text: content, + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }) + }, + // 关闭遮罩层 + closeLoading() { + loadingInstance.close(); + } +} diff --git a/ruoyi-ui/src/plugins/tab.js b/ruoyi-ui/src/plugins/tab.js new file mode 100644 index 000000000..fcde4197f --- /dev/null +++ b/ruoyi-ui/src/plugins/tab.js @@ -0,0 +1,71 @@ +import store from '@/store' +import router from '@/router'; + +export default { + // 刷新当前tab页签 + refreshPage(obj) { + const { path, query, matched } = router.currentRoute; + if (obj === undefined) { + matched.forEach((m) => { + if (m.components && m.components.default && m.components.default.name) { + if (!['Layout', 'ParentView'].includes(m.components.default.name)) { + obj = { name: m.components.default.name, path: path, query: query }; + } + } + }); + } + return store.dispatch('tagsView/delCachedView', obj).then(() => { + const { path, query } = obj + router.replace({ + path: '/redirect' + path, + query: query + }) + }) + }, + // 关闭当前tab页签,打开新页签 + closeOpenPage(obj) { + store.dispatch("tagsView/delView", router.currentRoute); + if (obj !== undefined) { + return router.push(obj); + } + }, + // 关闭指定tab页签 + closePage(obj) { + if (obj === undefined) { + return store.dispatch('tagsView/delView', router.currentRoute).then(({ visitedViews }) => { + const latestView = visitedViews.slice(-1)[0] + if (latestView) { + return router.push(latestView.fullPath) + } + return router.push('/'); + }); + } + return store.dispatch('tagsView/delView', obj); + }, + // 关闭所有tab页签 + closeAllPage() { + return store.dispatch('tagsView/delAllViews'); + }, + // 关闭左侧tab页签 + closeLeftPage(obj) { + return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute); + }, + // 关闭右侧tab页签 + closeRightPage(obj) { + return store.dispatch('tagsView/delRightTags', obj || router.currentRoute); + }, + // 关闭其他tab页签 + closeOtherPage(obj) { + return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute); + }, + // 添加tab页签 + openPage(title, url, params) { + const obj = { path: url, meta: { title: title } } + store.dispatch('tagsView/addView', obj); + return router.push({ path: url, query: params }); + }, + // 修改tab页签 + updatePage(obj) { + return store.dispatch('tagsView/updateVisitedView', obj); + } +} diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js new file mode 100644 index 000000000..71907b696 --- /dev/null +++ b/ruoyi-ui/src/router/index.js @@ -0,0 +1,183 @@ +import Vue from 'vue' +import Router from 'vue-router' + +Vue.use(Router) + +/* Layout */ +import Layout from '@/layout' + +/** + * Note: 路由配置项 + * + * hidden: true // 当设置 true 的时候该路由不会再侧边栏出现 如401,login等页面,或者如一些编辑页面/edit/1 + * alwaysShow: true // 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式--如组件页面 + * // 只有一个时,会将那个子路由当做根路由显示在侧边栏--如引导页面 + * // 若你想不管路由下面的 children 声明的个数都显示你的根路由 + * // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由 + * redirect: noRedirect // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击 + * name:'router-name' // 设定路由的名字,一定要填写不然使用时会出现各种问题 + * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数 + * roles: ['admin', 'common'] // 访问路由的角色权限 + * permissions: ['a:a:a', 'b:b:b'] // 访问路由的菜单权限 + * meta : { + noCache: true // 如果设置为true,则不会被 缓存(默认 false) + title: 'title' // 设置该路由在侧边栏和面包屑中展示的名字 + icon: 'svg-name' // 设置该路由的图标,对应路径src/assets/icons/svg + breadcrumb: false // 如果设置为false,则不会在breadcrumb面包屑中显示 + activeMenu: '/system/user' // 当路由设置了该属性,则会高亮相对应的侧边栏。 + } + */ + +// 公共路由 +export const constantRoutes = [ + { + path: '/redirect', + component: Layout, + hidden: true, + children: [ + { + path: '/redirect/:path(.*)', + component: () => import('@/views/redirect') + } + ] + }, + { + path: '/login', + component: () => import('@/views/login'), + hidden: true + }, + { + path: '/register', + component: () => import('@/views/register'), + hidden: true + }, + { + path: '/404', + component: () => import('@/views/error/404'), + hidden: true + }, + { + path: '/401', + component: () => import('@/views/error/401'), + hidden: true + }, + { + path: '', + component: Layout, + redirect: 'index', + children: [ + { + path: 'index', + component: () => import('@/views/index'), + name: 'Index', + meta: { title: '首页', icon: 'dashboard', affix: true } + } + ] + }, + { + path: '/user', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'profile', + component: () => import('@/views/system/user/profile/index'), + name: 'Profile', + meta: { title: '个人中心', icon: 'user' } + } + ] + } +] + +// 动态路由,基于用户权限动态去加载 +export const dynamicRoutes = [ + { + path: '/system/user-auth', + component: Layout, + hidden: true, + permissions: ['system:user:edit'], + children: [ + { + path: 'role/:userId(\\d+)', + component: () => import('@/views/system/user/authRole'), + name: 'AuthRole', + meta: { title: '分配角色', activeMenu: '/system/user' } + } + ] + }, + { + path: '/system/role-auth', + component: Layout, + hidden: true, + permissions: ['system:role:edit'], + children: [ + { + path: 'user/:roleId(\\d+)', + component: () => import('@/views/system/role/authUser'), + name: 'AuthUser', + meta: { title: '分配用户', activeMenu: '/system/role' } + } + ] + }, + { + path: '/system/dict-data', + component: Layout, + hidden: true, + permissions: ['system:dict:list'], + children: [ + { + path: 'index/:dictId(\\d+)', + component: () => import('@/views/system/dict/data'), + name: 'Data', + meta: { title: '字典数据', activeMenu: '/system/dict' } + } + ] + }, + { + path: '/monitor/job-log', + component: Layout, + hidden: true, + permissions: ['monitor:job:list'], + children: [ + { + path: 'index/:jobId(\\d+)', + component: () => import('@/views/monitor/job/log'), + name: 'JobLog', + meta: { title: '调度日志', activeMenu: '/monitor/job' } + } + ] + }, + { + path: '/tool/gen-edit', + component: Layout, + hidden: true, + permissions: ['tool:gen:edit'], + children: [ + { + path: 'index/:tableId(\\d+)', + component: () => import('@/views/tool/gen/editTable'), + name: 'GenEdit', + meta: { title: '修改生成配置', activeMenu: '/tool/gen' } + } + ] + } +] + +// 防止连续点击多次路由报错 +let routerPush = Router.prototype.push; +let routerReplace = Router.prototype.replace; +// push +Router.prototype.push = function push(location) { + return routerPush.call(this, location).catch(err => err) +} +// replace +Router.prototype.replace = function push(location) { + return routerReplace.call(this, location).catch(err => err) +} + +export default new Router({ + mode: 'history', // 去掉url中的# + scrollBehavior: () => ({ y: 0 }), + routes: constantRoutes +}) diff --git a/ruoyi-ui/src/settings.js b/ruoyi-ui/src/settings.js new file mode 100644 index 000000000..6a0b09f45 --- /dev/null +++ b/ruoyi-ui/src/settings.js @@ -0,0 +1,44 @@ +module.exports = { + /** + * 侧边栏主题 深色主题theme-dark,浅色主题theme-light + */ + sideTheme: 'theme-dark', + + /** + * 是否系统布局配置 + */ + showSettings: false, + + /** + * 是否显示顶部导航 + */ + topNav: false, + + /** + * 是否显示 tagsView + */ + tagsView: true, + + /** + * 是否固定头部 + */ + fixedHeader: false, + + /** + * 是否显示logo + */ + sidebarLogo: true, + + /** + * 是否显示动态标题 + */ + dynamicTitle: false, + + /** + * @type {string | array} 'production' | ['production', 'development'] + * @description Need show err logs component. + * The default is only used in the production env + * If you want to also use it in dev, you can pass ['production', 'development'] + */ + errorLog: 'production' +} diff --git a/ruoyi-ui/src/store/getters.js b/ruoyi-ui/src/store/getters.js new file mode 100644 index 000000000..8adb1b653 --- /dev/null +++ b/ruoyi-ui/src/store/getters.js @@ -0,0 +1,19 @@ +const getters = { + sidebar: state => state.app.sidebar, + size: state => state.app.size, + device: state => state.app.device, + dict: state => state.dict.dict, + visitedViews: state => state.tagsView.visitedViews, + cachedViews: state => state.tagsView.cachedViews, + token: state => state.user.token, + avatar: state => state.user.avatar, + name: state => state.user.name, + introduction: state => state.user.introduction, + roles: state => state.user.roles, + permissions: state => state.user.permissions, + permission_routes: state => state.permission.routes, + topbarRouters:state => state.permission.topbarRouters, + defaultRoutes:state => state.permission.defaultRoutes, + sidebarRouters:state => state.permission.sidebarRouters, +} +export default getters diff --git a/ruoyi-ui/src/store/index.js b/ruoyi-ui/src/store/index.js new file mode 100644 index 000000000..97aaef80e --- /dev/null +++ b/ruoyi-ui/src/store/index.js @@ -0,0 +1,25 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import app from './modules/app' +import dict from './modules/dict' +import user from './modules/user' +import tagsView from './modules/tagsView' +import permission from './modules/permission' +import settings from './modules/settings' +import getters from './getters' + +Vue.use(Vuex) + +const store = new Vuex.Store({ + modules: { + app, + dict, + user, + tagsView, + permission, + settings + }, + getters +}) + +export default store diff --git a/ruoyi-ui/src/store/modules/app.js b/ruoyi-ui/src/store/modules/app.js new file mode 100644 index 000000000..3e22d1c16 --- /dev/null +++ b/ruoyi-ui/src/store/modules/app.js @@ -0,0 +1,66 @@ +import Cookies from 'js-cookie' + +const state = { + sidebar: { + opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, + withoutAnimation: false, + hide: false + }, + device: 'desktop', + size: Cookies.get('size') || 'medium' +} + +const mutations = { + TOGGLE_SIDEBAR: state => { + if (state.sidebar.hide) { + return false; + } + state.sidebar.opened = !state.sidebar.opened + state.sidebar.withoutAnimation = false + if (state.sidebar.opened) { + Cookies.set('sidebarStatus', 1) + } else { + Cookies.set('sidebarStatus', 0) + } + }, + CLOSE_SIDEBAR: (state, withoutAnimation) => { + Cookies.set('sidebarStatus', 0) + state.sidebar.opened = false + state.sidebar.withoutAnimation = withoutAnimation + }, + TOGGLE_DEVICE: (state, device) => { + state.device = device + }, + SET_SIZE: (state, size) => { + state.size = size + Cookies.set('size', size) + }, + SET_SIDEBAR_HIDE: (state, status) => { + state.sidebar.hide = status + } +} + +const actions = { + toggleSideBar({ commit }) { + commit('TOGGLE_SIDEBAR') + }, + closeSideBar({ commit }, { withoutAnimation }) { + commit('CLOSE_SIDEBAR', withoutAnimation) + }, + toggleDevice({ commit }, device) { + commit('TOGGLE_DEVICE', device) + }, + setSize({ commit }, size) { + commit('SET_SIZE', size) + }, + toggleSideBarHide({ commit }, status) { + commit('SET_SIDEBAR_HIDE', status) + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/ruoyi-ui/src/store/modules/dict.js b/ruoyi-ui/src/store/modules/dict.js new file mode 100644 index 000000000..7a1b2f02b --- /dev/null +++ b/ruoyi-ui/src/store/modules/dict.js @@ -0,0 +1,50 @@ +const state = { + dict: new Array() +} +const mutations = { + SET_DICT: (state, { key, value }) => { + if (key !== null && key !== "") { + state.dict.push({ + key: key, + value: value + }) + } + }, + REMOVE_DICT: (state, key) => { + try { + for (let i = 0; i < state.dict.length; i++) { + if (state.dict[i].key == key) { + state.dict.splice(i, 1) + return true + } + } + } catch (e) { + } + }, + CLEAN_DICT: (state) => { + state.dict = new Array() + } +} + +const actions = { + // 设置字典 + setDict({ commit }, data) { + commit('SET_DICT', data) + }, + // 删除字典 + removeDict({ commit }, key) { + commit('REMOVE_DICT', key) + }, + // 清空字典 + cleanDict({ commit }) { + commit('CLEAN_DICT') + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/ruoyi-ui/src/store/modules/permission.js b/ruoyi-ui/src/store/modules/permission.js new file mode 100644 index 000000000..b3c216a83 --- /dev/null +++ b/ruoyi-ui/src/store/modules/permission.js @@ -0,0 +1,137 @@ +import auth from '@/plugins/auth' +import router, { constantRoutes, dynamicRoutes } from '@/router' +import { getRouters } from '@/api/menu' +import Layout from '@/layout/index' +import ParentView from '@/components/ParentView' +import InnerLink from '@/layout/components/InnerLink' + +const permission = { + state: { + routes: [], + addRoutes: [], + defaultRoutes: [], + topbarRouters: [], + sidebarRouters: [] + }, + mutations: { + SET_ROUTES: (state, routes) => { + state.addRoutes = routes + state.routes = constantRoutes.concat(routes) + }, + SET_DEFAULT_ROUTES: (state, routes) => { + state.defaultRoutes = constantRoutes.concat(routes) + }, + SET_TOPBAR_ROUTES: (state, routes) => { + state.topbarRouters = routes + }, + SET_SIDEBAR_ROUTERS: (state, routes) => { + state.sidebarRouters = routes + }, + }, + actions: { + // 生成路由 + GenerateRoutes({ commit }) { + return new Promise(resolve => { + // 向后端请求路由数据 + getRouters().then(res => { + const sdata = JSON.parse(JSON.stringify(res.data)) + const rdata = JSON.parse(JSON.stringify(res.data)) + const sidebarRoutes = filterAsyncRouter(sdata) + const rewriteRoutes = filterAsyncRouter(rdata, false, true) + const asyncRoutes = filterDynamicRoutes(dynamicRoutes); + rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) + router.addRoutes(asyncRoutes); + commit('SET_ROUTES', rewriteRoutes) + commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) + commit('SET_DEFAULT_ROUTES', sidebarRoutes) + commit('SET_TOPBAR_ROUTES', sidebarRoutes) + resolve(rewriteRoutes) + }) + }) + } + } +} + +// 遍历后台传来的路由字符串,转换为组件对象 +function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { + return asyncRouterMap.filter(route => { + if (type && route.children) { + route.children = filterChildren(route.children) + } + if (route.component) { + // Layout ParentView 组件特殊处理 + if (route.component === 'Layout') { + route.component = Layout + } else if (route.component === 'ParentView') { + route.component = ParentView + } else if (route.component === 'InnerLink') { + route.component = InnerLink + } else { + route.component = loadView(route.component) + } + } + if (route.children != null && route.children && route.children.length) { + route.children = filterAsyncRouter(route.children, route, type) + } else { + delete route['children'] + delete route['redirect'] + } + return true + }) +} + +function filterChildren(childrenMap, lastRouter = false) { + var children = [] + childrenMap.forEach((el, index) => { + if (el.children && el.children.length) { + if (el.component === 'ParentView' && !lastRouter) { + el.children.forEach(c => { + c.path = el.path + '/' + c.path + if (c.children && c.children.length) { + children = children.concat(filterChildren(c.children, c)) + return + } + children.push(c) + }) + return + } + } + if (lastRouter) { + el.path = lastRouter.path + '/' + el.path + if (el.children && el.children.length) { + children = children.concat(filterChildren(el.children, el)) + return + } + } + children = children.concat(el) + }) + return children +} + +// 动态路由遍历,验证是否具备权限 +export function filterDynamicRoutes(routes) { + const res = [] + routes.forEach(route => { + if (route.permissions) { + if (auth.hasPermiOr(route.permissions)) { + res.push(route) + } + } else if (route.roles) { + if (auth.hasRoleOr(route.roles)) { + res.push(route) + } + } + }) + return res +} + +export const loadView = (view) => { + if (process.env.NODE_ENV === 'development') { + return (resolve) => require([`@/views/${view}`], resolve) + } else { + // 使用 import 实现生产环境的路由懒加载 + return () => import(`@/views/${view}`) + } +} + +export default permission diff --git a/ruoyi-ui/src/store/modules/settings.js b/ruoyi-ui/src/store/modules/settings.js new file mode 100644 index 000000000..2455a1e27 --- /dev/null +++ b/ruoyi-ui/src/store/modules/settings.js @@ -0,0 +1,42 @@ +import defaultSettings from '@/settings' + +const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings + +const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '' +const state = { + title: '', + theme: storageSetting.theme || '#409EFF', + sideTheme: storageSetting.sideTheme || sideTheme, + showSettings: showSettings, + topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav, + tagsView: storageSetting.tagsView === undefined ? tagsView : storageSetting.tagsView, + fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader, + sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo, + dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle +} +const mutations = { + CHANGE_SETTING: (state, { key, value }) => { + if (state.hasOwnProperty(key)) { + state[key] = value + } + } +} + +const actions = { + // 修改布局设置 + changeSetting({ commit }, data) { + commit('CHANGE_SETTING', data) + }, + // 设置网页标题 + setTitle({ commit }, title) { + state.title = title + } +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/ruoyi-ui/src/store/modules/tagsView.js b/ruoyi-ui/src/store/modules/tagsView.js new file mode 100644 index 000000000..5fc011ca8 --- /dev/null +++ b/ruoyi-ui/src/store/modules/tagsView.js @@ -0,0 +1,228 @@ +const state = { + visitedViews: [], + cachedViews: [], + iframeViews: [] +} + +const mutations = { + ADD_IFRAME_VIEW: (state, view) => { + if (state.iframeViews.some(v => v.path === view.path)) return + state.iframeViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) + }, + ADD_VISITED_VIEW: (state, view) => { + if (state.visitedViews.some(v => v.path === view.path)) return + state.visitedViews.push( + Object.assign({}, view, { + title: view.meta.title || 'no-name' + }) + ) + }, + ADD_CACHED_VIEW: (state, view) => { + if (state.cachedViews.includes(view.name)) return + if (view.meta && !view.meta.noCache) { + state.cachedViews.push(view.name) + } + }, + DEL_VISITED_VIEW: (state, view) => { + for (const [i, v] of state.visitedViews.entries()) { + if (v.path === view.path) { + state.visitedViews.splice(i, 1) + break + } + } + state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) + }, + DEL_IFRAME_VIEW: (state, view) => { + state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) + }, + DEL_CACHED_VIEW: (state, view) => { + const index = state.cachedViews.indexOf(view.name) + index > -1 && state.cachedViews.splice(index, 1) + }, + + DEL_OTHERS_VISITED_VIEWS: (state, view) => { + state.visitedViews = state.visitedViews.filter(v => { + return v.meta.affix || v.path === view.path + }) + state.iframeViews = state.iframeViews.filter(item => item.path === view.path) + }, + DEL_OTHERS_CACHED_VIEWS: (state, view) => { + const index = state.cachedViews.indexOf(view.name) + if (index > -1) { + state.cachedViews = state.cachedViews.slice(index, index + 1) + } else { + state.cachedViews = [] + } + }, + DEL_ALL_VISITED_VIEWS: state => { + // keep affix tags + const affixTags = state.visitedViews.filter(tag => tag.meta.affix) + state.visitedViews = affixTags + state.iframeViews = [] + }, + DEL_ALL_CACHED_VIEWS: state => { + state.cachedViews = [] + }, + UPDATE_VISITED_VIEW: (state, view) => { + for (let v of state.visitedViews) { + if (v.path === view.path) { + v = Object.assign(v, view) + break + } + } + }, + DEL_RIGHT_VIEWS: (state, view) => { + const index = state.visitedViews.findIndex(v => v.path === view.path) + if (index === -1) { + return + } + state.visitedViews = state.visitedViews.filter((item, idx) => { + if (idx <= index || (item.meta && item.meta.affix)) { + return true + } + const i = state.cachedViews.indexOf(item.name) + if (i > -1) { + state.cachedViews.splice(i, 1) + } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } + return false + }) + }, + DEL_LEFT_VIEWS: (state, view) => { + const index = state.visitedViews.findIndex(v => v.path === view.path) + if (index === -1) { + return + } + state.visitedViews = state.visitedViews.filter((item, idx) => { + if (idx >= index || (item.meta && item.meta.affix)) { + return true + } + const i = state.cachedViews.indexOf(item.name) + if (i > -1) { + state.cachedViews.splice(i, 1) + } + if(item.meta.link) { + const fi = state.iframeViews.findIndex(v => v.path === item.path) + state.iframeViews.splice(fi, 1) + } + return false + }) + } +} + +const actions = { + addView({ dispatch }, view) { + dispatch('addVisitedView', view) + dispatch('addCachedView', view) + }, + addIframeView({ commit }, view) { + commit('ADD_IFRAME_VIEW', view) + }, + addVisitedView({ commit }, view) { + commit('ADD_VISITED_VIEW', view) + }, + addCachedView({ commit }, view) { + commit('ADD_CACHED_VIEW', view) + }, + delView({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delVisitedView', view) + dispatch('delCachedView', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delVisitedView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_VISITED_VIEW', view) + resolve([...state.visitedViews]) + }) + }, + delIframeView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_IFRAME_VIEW', view) + resolve([...state.iframeViews]) + }) + }, + delCachedView({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_CACHED_VIEW', view) + resolve([...state.cachedViews]) + }) + }, + delOthersViews({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delOthersVisitedViews', view) + dispatch('delOthersCachedViews', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delOthersVisitedViews({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_OTHERS_VISITED_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, + delOthersCachedViews({ commit, state }, view) { + return new Promise(resolve => { + commit('DEL_OTHERS_CACHED_VIEWS', view) + resolve([...state.cachedViews]) + }) + }, + delAllViews({ dispatch, state }, view) { + return new Promise(resolve => { + dispatch('delAllVisitedViews', view) + dispatch('delAllCachedViews', view) + resolve({ + visitedViews: [...state.visitedViews], + cachedViews: [...state.cachedViews] + }) + }) + }, + delAllVisitedViews({ commit, state }) { + return new Promise(resolve => { + commit('DEL_ALL_VISITED_VIEWS') + resolve([...state.visitedViews]) + }) + }, + delAllCachedViews({ commit, state }) { + return new Promise(resolve => { + commit('DEL_ALL_CACHED_VIEWS') + resolve([...state.cachedViews]) + }) + }, + updateVisitedView({ commit }, view) { + commit('UPDATE_VISITED_VIEW', view) + }, + delRightTags({ commit }, view) { + return new Promise(resolve => { + commit('DEL_RIGHT_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, + delLeftTags({ commit }, view) { + return new Promise(resolve => { + commit('DEL_LEFT_VIEWS', view) + resolve([...state.visitedViews]) + }) + }, +} + +export default { + namespaced: true, + state, + mutations, + actions +} diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js new file mode 100644 index 000000000..cdbab1e9d --- /dev/null +++ b/ruoyi-ui/src/store/modules/user.js @@ -0,0 +1,101 @@ +import { login, logout, getInfo } from '@/api/login' +import { getToken, setToken, removeToken } from '@/utils/auth' + +const user = { + state: { + token: getToken(), + id: '', + name: '', + avatar: '', + roles: [], + permissions: [] + }, + + mutations: { + SET_TOKEN: (state, token) => { + state.token = token + }, + SET_ID: (state, id) => { + state.id = id + }, + SET_NAME: (state, name) => { + state.name = name + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + }, + SET_ROLES: (state, roles) => { + state.roles = roles + }, + SET_PERMISSIONS: (state, permissions) => { + state.permissions = permissions + } + }, + + actions: { + // 登录 + Login({ commit }, userInfo) { + const username = userInfo.username.trim() + const password = userInfo.password + const code = userInfo.code + const uuid = userInfo.uuid + return new Promise((resolve, reject) => { + login(username, password, code, uuid).then(res => { + setToken(res.token) + commit('SET_TOKEN', res.token) + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 获取用户信息 + GetInfo({ commit, state }) { + return new Promise((resolve, reject) => { + getInfo().then(res => { + const user = res.user + const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; + if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLES', res.roles) + commit('SET_PERMISSIONS', res.permissions) + } else { + commit('SET_ROLES', ['ROLE_DEFAULT']) + } + commit('SET_ID', user.userId) + commit('SET_NAME', user.userName) + commit('SET_AVATAR', avatar) + resolve(res) + }).catch(error => { + reject(error) + }) + }) + }, + + // 退出系统 + LogOut({ commit, state }) { + return new Promise((resolve, reject) => { + logout(state.token).then(() => { + commit('SET_TOKEN', '') + commit('SET_ROLES', []) + commit('SET_PERMISSIONS', []) + removeToken() + resolve() + }).catch(error => { + reject(error) + }) + }) + }, + + // 前端 登出 + FedLogOut({ commit }) { + return new Promise(resolve => { + commit('SET_TOKEN', '') + removeToken() + resolve() + }) + } + } +} + +export default user diff --git a/ruoyi-ui/src/utils/auth.js b/ruoyi-ui/src/utils/auth.js new file mode 100644 index 000000000..08a43d6e2 --- /dev/null +++ b/ruoyi-ui/src/utils/auth.js @@ -0,0 +1,15 @@ +import Cookies from 'js-cookie' + +const TokenKey = 'Admin-Token' + +export function getToken() { + return Cookies.get(TokenKey) +} + +export function setToken(token) { + return Cookies.set(TokenKey, token) +} + +export function removeToken() { + return Cookies.remove(TokenKey) +} diff --git a/ruoyi-ui/src/utils/dict/Dict.js b/ruoyi-ui/src/utils/dict/Dict.js new file mode 100644 index 000000000..104bd6e72 --- /dev/null +++ b/ruoyi-ui/src/utils/dict/Dict.js @@ -0,0 +1,82 @@ +import Vue from 'vue' +import { mergeRecursive } from "@/utils/ruoyi"; +import DictMeta from './DictMeta' +import DictData from './DictData' + +const DEFAULT_DICT_OPTIONS = { + types: [], +} + +/** + * @classdesc 字典 + * @property {Object} label 标签对象,内部属性名为字典类型名称 + * @property {Object} dict 字段数组,内部属性名为字典类型名称 + * @property {Array.} _dictMetas 字典元数据数组 + */ +export default class Dict { + constructor() { + this.owner = null + this.label = {} + this.type = {} + } + + init(options) { + if (options instanceof Array) { + options = { types: options } + } + const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options) + if (opts.types === undefined) { + throw new Error('need dict types') + } + const ps = [] + this._dictMetas = opts.types.map(t => DictMeta.parse(t)) + this._dictMetas.forEach(dictMeta => { + const type = dictMeta.type + Vue.set(this.label, type, {}) + Vue.set(this.type, type, []) + if (dictMeta.lazy) { + return + } + ps.push(loadDict(this, dictMeta)) + }) + return Promise.all(ps) + } + + /** + * 重新加载字典 + * @param {String} type 字典类型 + */ + reloadDict(type) { + const dictMeta = this._dictMetas.find(e => e.type === type) + if (dictMeta === undefined) { + return Promise.reject(`the dict meta of ${type} was not found`) + } + return loadDict(this, dictMeta) + } +} + +/** + * 加载字典 + * @param {Dict} dict 字典 + * @param {DictMeta} dictMeta 字典元数据 + * @returns {Promise} + */ +function loadDict(dict, dictMeta) { + return dictMeta.request(dictMeta) + .then(response => { + const type = dictMeta.type + let dicts = dictMeta.responseConverter(response, dictMeta) + if (!(dicts instanceof Array)) { + console.error('the return of responseConverter must be Array.') + dicts = [] + } else if (dicts.filter(d => d instanceof DictData).length !== dicts.length) { + console.error('the type of elements in dicts must be DictData') + dicts = [] + } + dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts) + dicts.forEach(d => { + Vue.set(dict.label[type], d.value, d.label) + }) + return dicts + }) +} diff --git a/ruoyi-ui/src/utils/dict/DictConverter.js b/ruoyi-ui/src/utils/dict/DictConverter.js new file mode 100644 index 000000000..0cf5df863 --- /dev/null +++ b/ruoyi-ui/src/utils/dict/DictConverter.js @@ -0,0 +1,17 @@ +import DictOptions from './DictOptions' +import DictData from './DictData' + +export default function(dict, dictMeta) { + const label = determineDictField(dict, dictMeta.labelField, ...DictOptions.DEFAULT_LABEL_FIELDS) + const value = determineDictField(dict, dictMeta.valueField, ...DictOptions.DEFAULT_VALUE_FIELDS) + return new DictData(dict[label], dict[value], dict) +} + +/** + * 确定字典字段 + * @param {DictData} dict + * @param {...String} fields + */ +function determineDictField(dict, ...fields) { + return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f)) +} diff --git a/ruoyi-ui/src/utils/dict/DictData.js b/ruoyi-ui/src/utils/dict/DictData.js new file mode 100644 index 000000000..afc763e80 --- /dev/null +++ b/ruoyi-ui/src/utils/dict/DictData.js @@ -0,0 +1,13 @@ +/** + * @classdesc 字典数据 + * @property {String} label 标签 + * @property {*} value 标签 + * @property {Object} raw 原始数据 + */ +export default class DictData { + constructor(label, value, raw) { + this.label = label + this.value = value + this.raw = raw + } +} diff --git a/ruoyi-ui/src/utils/dict/DictMeta.js b/ruoyi-ui/src/utils/dict/DictMeta.js new file mode 100644 index 000000000..9779daa43 --- /dev/null +++ b/ruoyi-ui/src/utils/dict/DictMeta.js @@ -0,0 +1,38 @@ +import { mergeRecursive } from "@/utils/ruoyi"; +import DictOptions from './DictOptions' + +/** + * @classdesc 字典元数据 + * @property {String} type 类型 + * @property {Function} request 请求 + * @property {String} label 标签字段 + * @property {String} value 值字段 + */ +export default class DictMeta { + constructor(options) { + this.type = options.type + this.request = options.request + this.responseConverter = options.responseConverter + this.labelField = options.labelField + this.valueField = options.valueField + this.lazy = options.lazy === true + } +} + + +/** + * 解析字典元数据 + * @param {Object} options + * @returns {DictMeta} + */ +DictMeta.parse= function(options) { + let opts = null + if (typeof options === 'string') { + opts = DictOptions.metas[options] || {} + opts.type = options + } else if (typeof options === 'object') { + opts = options + } + opts = mergeRecursive(DictOptions.metas['*'], opts) + return new DictMeta(opts) +} diff --git a/ruoyi-ui/src/utils/dict/DictOptions.js b/ruoyi-ui/src/utils/dict/DictOptions.js new file mode 100644 index 000000000..338a94e1a --- /dev/null +++ b/ruoyi-ui/src/utils/dict/DictOptions.js @@ -0,0 +1,51 @@ +import { mergeRecursive } from "@/utils/ruoyi"; +import dictConverter from './DictConverter' + +export const options = { + metas: { + '*': { + /** + * 字典请求,方法签名为function(dictMeta: DictMeta): Promise + */ + request: (dictMeta) => { + console.log(`load dict ${dictMeta.type}`) + return Promise.resolve([]) + }, + /** + * 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData + */ + responseConverter, + labelField: 'label', + valueField: 'value', + }, + }, + /** + * 默认标签字段 + */ + DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'], + /** + * 默认值字段 + */ + DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'], +} + +/** + * 映射字典 + * @param {Object} response 字典数据 + * @param {DictMeta} dictMeta 字典元数据 + * @returns {DictData} + */ +function responseConverter(response, dictMeta) { + const dicts = response.content instanceof Array ? response.content : response + if (dicts === undefined) { + console.warn(`no dict data of "${dictMeta.type}" found in the response`) + return [] + } + return dicts.map(d => dictConverter(d, dictMeta)) +} + +export function mergeOptions(src) { + mergeRecursive(options, src) +} + +export default options diff --git a/ruoyi-ui/src/utils/dict/index.js b/ruoyi-ui/src/utils/dict/index.js new file mode 100644 index 000000000..215eb9e05 --- /dev/null +++ b/ruoyi-ui/src/utils/dict/index.js @@ -0,0 +1,33 @@ +import Dict from './Dict' +import { mergeOptions } from './DictOptions' + +export default function(Vue, options) { + mergeOptions(options) + Vue.mixin({ + data() { + if (this.$options === undefined || this.$options.dicts === undefined || this.$options.dicts === null) { + return {} + } + const dict = new Dict() + dict.owner = this + return { + dict + } + }, + created() { + if (!(this.dict instanceof Dict)) { + return + } + options.onCreated && options.onCreated(this.dict) + this.dict.init(this.$options.dicts).then(() => { + options.onReady && options.onReady(this.dict) + this.$nextTick(() => { + this.$emit('dictReady', this.dict) + if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) { + this.$options.methods.onDictReady.call(this, this.dict) + } + }) + }) + }, + }) +} diff --git a/ruoyi-ui/src/utils/errorCode.js b/ruoyi-ui/src/utils/errorCode.js new file mode 100644 index 000000000..d2111ee10 --- /dev/null +++ b/ruoyi-ui/src/utils/errorCode.js @@ -0,0 +1,6 @@ +export default { + '401': '认证失败,无法访问系统资源', + '403': '当前操作没有权限', + '404': '访问资源不存在', + 'default': '系统未知错误,请反馈给管理员' +} diff --git a/ruoyi-ui/src/utils/generator/config.js b/ruoyi-ui/src/utils/generator/config.js new file mode 100644 index 000000000..7abf227d5 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/config.js @@ -0,0 +1,438 @@ +export const formConf = { + formRef: 'elForm', + formModel: 'formData', + size: 'medium', + labelPosition: 'right', + labelWidth: 100, + formRules: 'rules', + gutter: 15, + disabled: false, + span: 24, + formBtns: true +} + +export const inputComponents = [ + { + label: '单行文本', + tag: 'el-input', + tagIcon: 'input', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': '', + 'suffix-icon': '', + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '多行文本', + tag: 'el-input', + tagIcon: 'textarea', + type: 'textarea', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + labelWidth: null, + autosize: { + minRows: 4, + maxRows: 4 + }, + style: { width: '100%' }, + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '密码', + tag: 'el-input', + tagIcon: 'password', + placeholder: '请输入', + defaultValue: undefined, + span: 24, + 'show-password': true, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': '', + 'suffix-icon': '', + maxlength: null, + 'show-word-limit': false, + readonly: false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input' + }, + { + label: '计数器', + tag: 'el-input-number', + tagIcon: 'number', + placeholder: '', + defaultValue: undefined, + span: 24, + labelWidth: null, + min: undefined, + max: undefined, + step: undefined, + 'step-strictly': false, + precision: undefined, + 'controls-position': '', + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/input-number' + } +] + +export const selectComponents = [ + { + label: '下拉选择', + tag: 'el-select', + tagIcon: 'select', + placeholder: '请选择', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: { width: '100%' }, + clearable: true, + disabled: false, + required: true, + filterable: false, + multiple: false, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/select' + }, + { + label: '级联选择', + tag: 'el-cascader', + tagIcon: 'cascader', + placeholder: '请选择', + defaultValue: [], + span: 24, + labelWidth: null, + style: { width: '100%' }, + props: { + props: { + multiple: false + } + }, + 'show-all-levels': true, + disabled: false, + clearable: true, + filterable: false, + required: true, + options: [{ + id: 1, + value: 1, + label: '选项1', + children: [{ + id: 2, + value: 2, + label: '选项1-1' + }] + }], + dataType: 'dynamic', + labelKey: 'label', + valueKey: 'value', + childrenKey: 'children', + separator: '/', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/cascader' + }, + { + label: '单选框组', + tag: 'el-radio-group', + tagIcon: 'radio', + defaultValue: undefined, + span: 24, + labelWidth: null, + style: {}, + optionType: 'default', + border: false, + size: 'medium', + disabled: false, + required: true, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/radio' + }, + { + label: '多选框组', + tag: 'el-checkbox-group', + tagIcon: 'checkbox', + defaultValue: [], + span: 24, + labelWidth: null, + style: {}, + optionType: 'default', + border: false, + size: 'medium', + disabled: false, + required: true, + options: [{ + label: '选项一', + value: 1 + }, { + label: '选项二', + value: 2 + }], + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/checkbox' + }, + { + label: '开关', + tag: 'el-switch', + tagIcon: 'switch', + defaultValue: false, + span: 24, + labelWidth: null, + style: {}, + disabled: false, + required: true, + 'active-text': '', + 'inactive-text': '', + 'active-color': null, + 'inactive-color': null, + 'active-value': true, + 'inactive-value': false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/switch' + }, + { + label: '滑块', + tag: 'el-slider', + tagIcon: 'slider', + defaultValue: null, + span: 24, + labelWidth: null, + disabled: false, + required: true, + min: 0, + max: 100, + step: 1, + 'show-stops': false, + range: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/slider' + }, + { + label: '时间选择', + tag: 'el-time-picker', + tagIcon: 'time', + placeholder: '请选择', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + 'picker-options': { + selectableRange: '00:00:00-23:59:59' + }, + format: 'HH:mm:ss', + 'value-format': 'HH:mm:ss', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/time-picker' + }, + { + label: '时间范围', + tag: 'el-time-picker', + tagIcon: 'time-range', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + 'is-range': true, + 'range-separator': '至', + 'start-placeholder': '开始时间', + 'end-placeholder': '结束时间', + format: 'HH:mm:ss', + 'value-format': 'HH:mm:ss', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/time-picker' + }, + { + label: '日期选择', + tag: 'el-date-picker', + tagIcon: 'date', + placeholder: '请选择', + defaultValue: null, + type: 'date', + span: 24, + labelWidth: null, + style: { width: '100%' }, + disabled: false, + clearable: true, + required: true, + format: 'yyyy-MM-dd', + 'value-format': 'yyyy-MM-dd', + readonly: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/date-picker' + }, + { + label: '日期范围', + tag: 'el-date-picker', + tagIcon: 'date-range', + defaultValue: null, + span: 24, + labelWidth: null, + style: { width: '100%' }, + type: 'daterange', + 'range-separator': '至', + 'start-placeholder': '开始日期', + 'end-placeholder': '结束日期', + disabled: false, + clearable: true, + required: true, + format: 'yyyy-MM-dd', + 'value-format': 'yyyy-MM-dd', + readonly: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/date-picker' + }, + { + label: '评分', + tag: 'el-rate', + tagIcon: 'rate', + defaultValue: 0, + span: 24, + labelWidth: null, + style: {}, + max: 5, + 'allow-half': false, + 'show-text': false, + 'show-score': false, + disabled: false, + required: true, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/rate' + }, + { + label: '颜色选择', + tag: 'el-color-picker', + tagIcon: 'color', + defaultValue: null, + labelWidth: null, + 'show-alpha': false, + 'color-format': '', + disabled: false, + required: true, + size: 'medium', + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/color-picker' + }, + { + label: '上传', + tag: 'el-upload', + tagIcon: 'upload', + action: 'https://jsonplaceholder.typicode.com/posts/', + defaultValue: null, + labelWidth: null, + disabled: false, + required: true, + accept: '', + name: 'file', + 'auto-upload': true, + showTip: false, + buttonText: '点击上传', + fileSize: 2, + sizeUnit: 'MB', + 'list-type': 'text', + multiple: false, + regList: [], + changeTag: true, + document: 'https://element.eleme.cn/#/zh-CN/component/upload' + } +] + +export const layoutComponents = [ + { + layout: 'rowFormItem', + tagIcon: 'row', + type: 'default', + justify: 'start', + align: 'top', + label: '行容器', + layoutTree: true, + children: [], + document: 'https://element.eleme.cn/#/zh-CN/component/layout' + }, + { + layout: 'colFormItem', + label: '按钮', + changeTag: true, + labelWidth: null, + tag: 'el-button', + tagIcon: 'button', + span: 24, + default: '主要按钮', + type: 'primary', + icon: 'el-icon-search', + size: 'medium', + disabled: false, + document: 'https://element.eleme.cn/#/zh-CN/component/button' + } +] + +// 组件rule的触发方式,无触发方式的组件不生成rule +export const trigger = { + 'el-input': 'blur', + 'el-input-number': 'blur', + 'el-select': 'change', + 'el-radio-group': 'change', + 'el-checkbox-group': 'change', + 'el-cascader': 'change', + 'el-time-picker': 'change', + 'el-date-picker': 'change', + 'el-rate': 'change' +} diff --git a/ruoyi-ui/src/utils/generator/css.js b/ruoyi-ui/src/utils/generator/css.js new file mode 100644 index 000000000..c1c62e607 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/css.js @@ -0,0 +1,18 @@ +const styles = { + 'el-rate': '.el-rate{display: inline-block; vertical-align: text-top;}', + 'el-upload': '.el-upload__tip{line-height: 1.2;}' +} + +function addCss(cssList, el) { + const css = styles[el.tag] + css && cssList.indexOf(css) === -1 && cssList.push(css) + if (el.children) { + el.children.forEach(el2 => addCss(cssList, el2)) + } +} + +export function makeUpCss(conf) { + const cssList = [] + conf.fields.forEach(el => addCss(cssList, el)) + return cssList.join('\n') +} diff --git a/ruoyi-ui/src/utils/generator/drawingDefault.js b/ruoyi-ui/src/utils/generator/drawingDefault.js new file mode 100644 index 000000000..09f133ca1 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/drawingDefault.js @@ -0,0 +1,29 @@ +export default [ + { + layout: 'colFormItem', + tagIcon: 'input', + label: '手机号', + vModel: 'mobile', + formId: 6, + tag: 'el-input', + placeholder: '请输入手机号', + defaultValue: '', + span: 24, + style: { width: '100%' }, + clearable: true, + prepend: '', + append: '', + 'prefix-icon': 'el-icon-mobile', + 'suffix-icon': '', + maxlength: 11, + 'show-word-limit': true, + readonly: false, + disabled: false, + required: true, + changeTag: true, + regList: [{ + pattern: '/^1(3|4|5|7|8|9)\\d{9}$/', + message: '手机号格式错误' + }] + } +] diff --git a/ruoyi-ui/src/utils/generator/html.js b/ruoyi-ui/src/utils/generator/html.js new file mode 100644 index 000000000..9bcc5361d --- /dev/null +++ b/ruoyi-ui/src/utils/generator/html.js @@ -0,0 +1,359 @@ +/* eslint-disable max-len */ +import { trigger } from './config' + +let confGlobal +let someSpanIsNot24 + +export function dialogWrapper(str) { + return ` + ${str} +
    + 取消 + 确定 +
    +
    ` +} + +export function vueTemplate(str) { + return `` +} + +export function vueScript(str) { + return `` +} + +export function cssStyle(cssStr) { + return `` +} + +function buildFormTemplate(conf, child, type) { + let labelPosition = '' + if (conf.labelPosition !== 'right') { + labelPosition = `label-position="${conf.labelPosition}"` + } + const disabled = conf.disabled ? `:disabled="${conf.disabled}"` : '' + let str = ` + ${child} + ${buildFromBtns(conf, type)} + ` + if (someSpanIsNot24) { + str = ` + ${str} + ` + } + return str +} + +function buildFromBtns(conf, type) { + let str = '' + if (conf.formBtns && type === 'file') { + str = ` + 提交 + 重置 + ` + if (someSpanIsNot24) { + str = ` + ${str} + ` + } + } + return str +} + +// span不为24的用el-col包裹 +function colWrapper(element, str) { + if (someSpanIsNot24 || element.span !== 24) { + return ` + ${str} + ` + } + return str +} + +const layouts = { + colFormItem(element) { + let labelWidth = '' + if (element.labelWidth && element.labelWidth !== confGlobal.labelWidth) { + labelWidth = `label-width="${element.labelWidth}px"` + } + const required = !trigger[element.tag] && element.required ? 'required' : '' + const tagDom = tags[element.tag] ? tags[element.tag](element) : null + let str = ` + ${tagDom} + ` + str = colWrapper(element, str) + return str + }, + rowFormItem(element) { + const type = element.type === 'default' ? '' : `type="${element.type}"` + const justify = element.type === 'default' ? '' : `justify="${element.justify}"` + const align = element.type === 'default' ? '' : `align="${element.align}"` + const gutter = element.gutter ? `gutter="${element.gutter}"` : '' + const children = element.children.map(el => layouts[el.layout](el)) + let str = ` + ${children.join('\n')} + ` + str = colWrapper(element, str) + return str + } +} + +const tags = { + 'el-button': el => { + const { + tag, disabled + } = attrBuilder(el) + const type = el.type ? `type="${el.type}"` : '' + const icon = el.icon ? `icon="${el.icon}"` : '' + const size = el.size ? `size="${el.size}"` : '' + let child = buildElButtonChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${type} ${icon} ${size} ${disabled}>${child}` + }, + 'el-input': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const maxlength = el.maxlength ? `:maxlength="${el.maxlength}"` : '' + const showWordLimit = el['show-word-limit'] ? 'show-word-limit' : '' + const readonly = el.readonly ? 'readonly' : '' + const prefixIcon = el['prefix-icon'] ? `prefix-icon='${el['prefix-icon']}'` : '' + const suffixIcon = el['suffix-icon'] ? `suffix-icon='${el['suffix-icon']}'` : '' + const showPassword = el['show-password'] ? 'show-password' : '' + const type = el.type ? `type="${el.type}"` : '' + const autosize = el.autosize && el.autosize.minRows + ? `:autosize="{minRows: ${el.autosize.minRows}, maxRows: ${el.autosize.maxRows}}"` + : '' + let child = buildElInputChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${type} ${placeholder} ${maxlength} ${showWordLimit} ${readonly} ${disabled} ${clearable} ${prefixIcon} ${suffixIcon} ${showPassword} ${autosize} ${width}>${child}` + }, + 'el-input-number': el => { + const { disabled, vModel, placeholder } = attrBuilder(el) + const controlsPosition = el['controls-position'] ? `controls-position=${el['controls-position']}` : '' + const min = el.min ? `:min='${el.min}'` : '' + const max = el.max ? `:max='${el.max}'` : '' + const step = el.step ? `:step='${el.step}'` : '' + const stepStrictly = el['step-strictly'] ? 'step-strictly' : '' + const precision = el.precision ? `:precision='${el.precision}'` : '' + + return `<${el.tag} ${vModel} ${placeholder} ${step} ${stepStrictly} ${precision} ${controlsPosition} ${min} ${max} ${disabled}>` + }, + 'el-select': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const filterable = el.filterable ? 'filterable' : '' + const multiple = el.multiple ? 'multiple' : '' + let child = buildElSelectChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${placeholder} ${disabled} ${multiple} ${filterable} ${clearable} ${width}>${child}` + }, + 'el-radio-group': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + let child = buildElRadioGroupChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${size} ${disabled}>${child}` + }, + 'el-checkbox-group': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + const min = el.min ? `:min="${el.min}"` : '' + const max = el.max ? `:max="${el.max}"` : '' + let child = buildElCheckboxGroupChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${vModel} ${min} ${max} ${size} ${disabled}>${child}` + }, + 'el-switch': el => { + const { disabled, vModel } = attrBuilder(el) + const activeText = el['active-text'] ? `active-text="${el['active-text']}"` : '' + const inactiveText = el['inactive-text'] ? `inactive-text="${el['inactive-text']}"` : '' + const activeColor = el['active-color'] ? `active-color="${el['active-color']}"` : '' + const inactiveColor = el['inactive-color'] ? `inactive-color="${el['inactive-color']}"` : '' + const activeValue = el['active-value'] !== true ? `:active-value='${JSON.stringify(el['active-value'])}'` : '' + const inactiveValue = el['inactive-value'] !== false ? `:inactive-value='${JSON.stringify(el['inactive-value'])}'` : '' + + return `<${el.tag} ${vModel} ${activeText} ${inactiveText} ${activeColor} ${inactiveColor} ${activeValue} ${inactiveValue} ${disabled}>` + }, + 'el-cascader': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const options = el.options ? `:options="${el.vModel}Options"` : '' + const props = el.props ? `:props="${el.vModel}Props"` : '' + const showAllLevels = el['show-all-levels'] ? '' : ':show-all-levels="false"' + const filterable = el.filterable ? 'filterable' : '' + const separator = el.separator === '/' ? '' : `separator="${el.separator}"` + + return `<${el.tag} ${vModel} ${options} ${props} ${width} ${showAllLevels} ${placeholder} ${separator} ${filterable} ${clearable} ${disabled}>` + }, + 'el-slider': el => { + const { disabled, vModel } = attrBuilder(el) + const min = el.min ? `:min='${el.min}'` : '' + const max = el.max ? `:max='${el.max}'` : '' + const step = el.step ? `:step='${el.step}'` : '' + const range = el.range ? 'range' : '' + const showStops = el['show-stops'] ? `:show-stops="${el['show-stops']}"` : '' + + return `<${el.tag} ${min} ${max} ${step} ${vModel} ${range} ${showStops} ${disabled}>` + }, + 'el-time-picker': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : '' + const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : '' + const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : '' + const isRange = el['is-range'] ? 'is-range' : '' + const format = el.format ? `format="${el.format}"` : '' + const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : '' + const pickerOptions = el['picker-options'] ? `:picker-options='${JSON.stringify(el['picker-options'])}'` : '' + + return `<${el.tag} ${vModel} ${isRange} ${format} ${valueFormat} ${pickerOptions} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${disabled}>` + }, + 'el-date-picker': el => { + const { + disabled, vModel, clearable, placeholder, width + } = attrBuilder(el) + const startPlaceholder = el['start-placeholder'] ? `start-placeholder="${el['start-placeholder']}"` : '' + const endPlaceholder = el['end-placeholder'] ? `end-placeholder="${el['end-placeholder']}"` : '' + const rangeSeparator = el['range-separator'] ? `range-separator="${el['range-separator']}"` : '' + const format = el.format ? `format="${el.format}"` : '' + const valueFormat = el['value-format'] ? `value-format="${el['value-format']}"` : '' + const type = el.type === 'date' ? '' : `type="${el.type}"` + const readonly = el.readonly ? 'readonly' : '' + + return `<${el.tag} ${type} ${vModel} ${format} ${valueFormat} ${width} ${placeholder} ${startPlaceholder} ${endPlaceholder} ${rangeSeparator} ${clearable} ${readonly} ${disabled}>` + }, + 'el-rate': el => { + const { disabled, vModel } = attrBuilder(el) + const max = el.max ? `:max='${el.max}'` : '' + const allowHalf = el['allow-half'] ? 'allow-half' : '' + const showText = el['show-text'] ? 'show-text' : '' + const showScore = el['show-score'] ? 'show-score' : '' + + return `<${el.tag} ${vModel} ${allowHalf} ${showText} ${showScore} ${disabled}>` + }, + 'el-color-picker': el => { + const { disabled, vModel } = attrBuilder(el) + const size = `size="${el.size}"` + const showAlpha = el['show-alpha'] ? 'show-alpha' : '' + const colorFormat = el['color-format'] ? `color-format="${el['color-format']}"` : '' + + return `<${el.tag} ${vModel} ${size} ${showAlpha} ${colorFormat} ${disabled}>` + }, + 'el-upload': el => { + const disabled = el.disabled ? ':disabled=\'true\'' : '' + const action = el.action ? `:action="${el.vModel}Action"` : '' + const multiple = el.multiple ? 'multiple' : '' + const listType = el['list-type'] !== 'text' ? `list-type="${el['list-type']}"` : '' + const accept = el.accept ? `accept="${el.accept}"` : '' + const name = el.name !== 'file' ? `name="${el.name}"` : '' + const autoUpload = el['auto-upload'] === false ? ':auto-upload="false"' : '' + const beforeUpload = `:before-upload="${el.vModel}BeforeUpload"` + const fileList = `:file-list="${el.vModel}fileList"` + const ref = `ref="${el.vModel}"` + let child = buildElUploadChild(el) + + if (child) child = `\n${child}\n` // 换行 + return `<${el.tag} ${ref} ${fileList} ${action} ${autoUpload} ${multiple} ${beforeUpload} ${listType} ${accept} ${name} ${disabled}>${child}` + } +} + +function attrBuilder(el) { + return { + vModel: `v-model="${confGlobal.formModel}.${el.vModel}"`, + clearable: el.clearable ? 'clearable' : '', + placeholder: el.placeholder ? `placeholder="${el.placeholder}"` : '', + width: el.style && el.style.width ? ':style="{width: \'100%\'}"' : '', + disabled: el.disabled ? ':disabled=\'true\'' : '' + } +} + +// el-buttin 子级 +function buildElButtonChild(conf) { + const children = [] + if (conf.default) { + children.push(conf.default) + } + return children.join('\n') +} + +// el-input innerHTML +function buildElInputChild(conf) { + const children = [] + if (conf.prepend) { + children.push(``) + } + if (conf.append) { + children.push(``) + } + return children.join('\n') +} + +function buildElSelectChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + children.push(``) + } + return children.join('\n') +} + +function buildElRadioGroupChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + const tag = conf.optionType === 'button' ? 'el-radio-button' : 'el-radio' + const border = conf.border ? 'border' : '' + children.push(`<${tag} v-for="(item, index) in ${conf.vModel}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}`) + } + return children.join('\n') +} + +function buildElCheckboxGroupChild(conf) { + const children = [] + if (conf.options && conf.options.length) { + const tag = conf.optionType === 'button' ? 'el-checkbox-button' : 'el-checkbox' + const border = conf.border ? 'border' : '' + children.push(`<${tag} v-for="(item, index) in ${conf.vModel}Options" :key="index" :label="item.value" :disabled="item.disabled" ${border}>{{item.label}}`) + } + return children.join('\n') +} + +function buildElUploadChild(conf) { + const list = [] + if (conf['list-type'] === 'picture-card') list.push('') + else list.push(`${conf.buttonText}`) + if (conf.showTip) list.push(`
    只能上传不超过 ${conf.fileSize}${conf.sizeUnit} 的${conf.accept}文件
    `) + return list.join('\n') +} + +export function makeUpHtml(conf, type) { + const htmlList = [] + confGlobal = conf + someSpanIsNot24 = conf.fields.some(item => item.span !== 24) + conf.fields.forEach(el => { + htmlList.push(layouts[el.layout](el)) + }) + const htmlStr = htmlList.join('\n') + + let temp = buildFormTemplate(conf, htmlStr, type) + if (type === 'dialog') { + temp = dialogWrapper(temp) + } + confGlobal = null + return temp +} diff --git a/ruoyi-ui/src/utils/generator/icon.json b/ruoyi-ui/src/utils/generator/icon.json new file mode 100644 index 000000000..2d9999a31 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/icon.json @@ -0,0 +1 @@ +["platform-eleme","eleme","delete-solid","delete","s-tools","setting","user-solid","user","phone","phone-outline","more","more-outline","star-on","star-off","s-goods","goods","warning","warning-outline","question","info","remove","circle-plus","success","error","zoom-in","zoom-out","remove-outline","circle-plus-outline","circle-check","circle-close","s-help","help","minus","plus","check","close","picture","picture-outline","picture-outline-round","upload","upload2","download","camera-solid","camera","video-camera-solid","video-camera","message-solid","bell","s-cooperation","s-order","s-platform","s-fold","s-unfold","s-operation","s-promotion","s-home","s-release","s-ticket","s-management","s-open","s-shop","s-marketing","s-flag","s-comment","s-finance","s-claim","s-custom","s-opportunity","s-data","s-check","s-grid","menu","share","d-caret","caret-left","caret-right","caret-bottom","caret-top","bottom-left","bottom-right","back","right","bottom","top","top-left","top-right","arrow-left","arrow-right","arrow-down","arrow-up","d-arrow-left","d-arrow-right","video-pause","video-play","refresh","refresh-right","refresh-left","finished","sort","sort-up","sort-down","rank","loading","view","c-scale-to-original","date","edit","edit-outline","folder","folder-opened","folder-add","folder-remove","folder-delete","folder-checked","tickets","document-remove","document-delete","document-copy","document-checked","document","document-add","printer","paperclip","takeaway-box","search","monitor","attract","mobile","scissors","umbrella","headset","brush","mouse","coordinate","magic-stick","reading","data-line","data-board","pie-chart","data-analysis","collection-tag","film","suitcase","suitcase-1","receiving","collection","files","notebook-1","notebook-2","toilet-paper","office-building","school","table-lamp","house","no-smoking","smoking","shopping-cart-full","shopping-cart-1","shopping-cart-2","shopping-bag-1","shopping-bag-2","sold-out","sell","present","box","bank-card","money","coin","wallet","discount","price-tag","news","guide","male","female","thumb","cpu","link","connection","open","turn-off","set-up","chat-round","chat-line-round","chat-square","chat-dot-round","chat-dot-square","chat-line-square","message","postcard","position","turn-off-microphone","microphone","close-notification","bangzhu","time","odometer","crop","aim","switch-button","full-screen","copy-document","mic","stopwatch","medal-1","medal","trophy","trophy-1","first-aid-kit","discover","place","location","location-outline","location-information","add-location","delete-location","map-location","alarm-clock","timer","watch-1","watch","lock","unlock","key","service","mobile-phone","bicycle","truck","ship","basketball","football","soccer","baseball","wind-power","light-rain","lightning","heavy-rain","sunrise","sunrise-1","sunset","sunny","cloudy","partly-cloudy","cloudy-and-sunny","moon","moon-night","dish","dish-1","food","chicken","fork-spoon","knife-fork","burger","tableware","sugar","dessert","ice-cream","hot-water","water-cup","coffee-cup","cold-drink","goblet","goblet-full","goblet-square","goblet-square-full","refrigerator","grape","watermelon","cherry","apple","pear","orange","coffee","ice-tea","ice-drink","milk-tea","potato-strips","lollipop","ice-cream-square","ice-cream-round"] \ No newline at end of file diff --git a/ruoyi-ui/src/utils/generator/js.js b/ruoyi-ui/src/utils/generator/js.js new file mode 100644 index 000000000..ee8668dc6 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/js.js @@ -0,0 +1,235 @@ +import { exportDefault, titleCase } from '@/utils/index' +import { trigger } from './config' + +const units = { + KB: '1024', + MB: '1024 / 1024', + GB: '1024 / 1024 / 1024' +} +let confGlobal +const inheritAttrs = { + file: '', + dialog: 'inheritAttrs: false,' +} + + +export function makeUpJs(conf, type) { + confGlobal = conf = JSON.parse(JSON.stringify(conf)) + const dataList = [] + const ruleList = [] + const optionsList = [] + const propsList = [] + const methodList = mixinMethod(type) + const uploadVarList = [] + + conf.fields.forEach(el => { + buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) + }) + + const script = buildexport( + conf, + type, + dataList.join('\n'), + ruleList.join('\n'), + optionsList.join('\n'), + uploadVarList.join('\n'), + propsList.join('\n'), + methodList.join('\n') + ) + confGlobal = null + return script +} + +function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) { + buildData(el, dataList) + buildRules(el, ruleList) + + if (el.options && el.options.length) { + buildOptions(el, optionsList) + if (el.dataType === 'dynamic') { + const model = `${el.vModel}Options` + const options = titleCase(model) + buildOptionMethod(`get${options}`, model, methodList) + } + } + + if (el.props && el.props.props) { + buildProps(el, propsList) + } + + if (el.action && el.tag === 'el-upload') { + uploadVarList.push( + `${el.vModel}Action: '${el.action}', + ${el.vModel}fileList: [],` + ) + methodList.push(buildBeforeUpload(el)) + if (!el['auto-upload']) { + methodList.push(buildSubmitUpload(el)) + } + } + + if (el.children) { + el.children.forEach(el2 => { + buildAttributes(el2, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) + }) + } +} + +function mixinMethod(type) { + const list = []; const + minxins = { + file: confGlobal.formBtns ? { + submitForm: `submitForm() { + this.$refs['${confGlobal.formRef}'].validate(valid => { + if(!valid) return + // TODO 提交表单 + }) + },`, + resetForm: `resetForm() { + this.$refs['${confGlobal.formRef}'].resetFields() + },` + } : null, + dialog: { + onOpen: 'onOpen() {},', + onClose: `onClose() { + this.$refs['${confGlobal.formRef}'].resetFields() + },`, + close: `close() { + this.$emit('update:visible', false) + },`, + handleConfirm: `handleConfirm() { + this.$refs['${confGlobal.formRef}'].validate(valid => { + if(!valid) return + this.close() + }) + },` + } + } + + const methods = minxins[type] + if (methods) { + Object.keys(methods).forEach(key => { + list.push(methods[key]) + }) + } + + return list +} + +function buildData(conf, dataList) { + if (conf.vModel === undefined) return + let defaultValue + if (typeof (conf.defaultValue) === 'string' && !conf.multiple) { + defaultValue = `'${conf.defaultValue}'` + } else { + defaultValue = `${JSON.stringify(conf.defaultValue)}` + } + dataList.push(`${conf.vModel}: ${defaultValue},`) +} + +function buildRules(conf, ruleList) { + if (conf.vModel === undefined) return + const rules = [] + if (trigger[conf.tag]) { + if (conf.required) { + const type = Array.isArray(conf.defaultValue) ? 'type: \'array\',' : '' + let message = Array.isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder + if (message === undefined) message = `${conf.label}不能为空` + rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`) + } + if (conf.regList && Array.isArray(conf.regList)) { + conf.regList.forEach(item => { + if (item.pattern) { + rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`) + } + }) + } + ruleList.push(`${conf.vModel}: [${rules.join(',')}],`) + } +} + +function buildOptions(conf, optionsList) { + if (conf.vModel === undefined) return + if (conf.dataType === 'dynamic') { conf.options = [] } + const str = `${conf.vModel}Options: ${JSON.stringify(conf.options)},` + optionsList.push(str) +} + +function buildProps(conf, propsList) { + if (conf.dataType === 'dynamic') { + conf.valueKey !== 'value' && (conf.props.props.value = conf.valueKey) + conf.labelKey !== 'label' && (conf.props.props.label = conf.labelKey) + conf.childrenKey !== 'children' && (conf.props.props.children = conf.childrenKey) + } + const str = `${conf.vModel}Props: ${JSON.stringify(conf.props.props)},` + propsList.push(str) +} + +function buildBeforeUpload(conf) { + const unitNum = units[conf.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const + returnList = [] + if (conf.fileSize) { + rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize} + if(!isRightSize){ + this.$message.error('文件大小超过 ${conf.fileSize}${conf.sizeUnit}') + }` + returnList.push('isRightSize') + } + if (conf.accept) { + acceptCode = `let isAccept = new RegExp('${conf.accept}').test(file.type) + if(!isAccept){ + this.$message.error('应该选择${conf.accept}类型的文件') + }` + returnList.push('isAccept') + } + const str = `${conf.vModel}BeforeUpload(file) { + ${rightSizeCode} + ${acceptCode} + return ${returnList.join('&&')} + },` + return returnList.length ? str : '' +} + +function buildSubmitUpload(conf) { + const str = `submitUpload() { + this.$refs['${conf.vModel}'].submit() + },` + return str +} + +function buildOptionMethod(methodName, model, methodList) { + const str = `${methodName}() { + // TODO 发起请求获取数据 + this.${model} + },` + methodList.push(str) +} + +function buildexport(conf, type, data, rules, selectOptions, uploadVar, props, methods) { + const str = `${exportDefault}{ + ${inheritAttrs[type]} + components: {}, + props: [], + data () { + return { + ${conf.formModel}: { + ${data} + }, + ${conf.formRules}: { + ${rules} + }, + ${uploadVar} + ${selectOptions} + ${props} + } + }, + computed: {}, + watch: {}, + created () {}, + mounted () {}, + methods: { + ${methods} + } +}` + return str +} diff --git a/ruoyi-ui/src/utils/generator/render.js b/ruoyi-ui/src/utils/generator/render.js new file mode 100644 index 000000000..e8640f0a2 --- /dev/null +++ b/ruoyi-ui/src/utils/generator/render.js @@ -0,0 +1,126 @@ +import { makeMap } from '@/utils/index' + +// 参考https://github.com/vuejs/vue/blob/v2.6.10/src/platforms/web/server/util.js +const isAttr = makeMap( + 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' + + 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' + + 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' + + 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' + + 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' + + 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' + + 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' + + 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' + + 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' + + 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' + + 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' + + 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' + + 'target,title,type,usemap,value,width,wrap' +) + +function vModel(self, dataObject, defaultValue) { + dataObject.props.value = defaultValue + + dataObject.on.input = val => { + self.$emit('input', val) + } +} + +const componentChild = { + 'el-button': { + default(h, conf, key) { + return conf[key] + }, + }, + 'el-input': { + prepend(h, conf, key) { + return + }, + append(h, conf, key) { + return + } + }, + 'el-select': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + list.push() + }) + return list + } + }, + 'el-radio-group': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + if (conf.optionType === 'button') list.push({item.label}) + else list.push({item.label}) + }) + return list + } + }, + 'el-checkbox-group': { + options(h, conf, key) { + const list = [] + conf.options.forEach(item => { + if (conf.optionType === 'button') { + list.push({item.label}) + } else { + list.push({item.label}) + } + }) + return list + } + }, + 'el-upload': { + 'list-type': (h, conf, key) => { + const list = [] + if (conf['list-type'] === 'picture-card') { + list.push() + } else { + list.push({conf.buttonText}) + } + if (conf.showTip) { + list.push(
    只能上传不超过 {conf.fileSize}{conf.sizeUnit} 的{conf.accept}文件
    ) + } + return list + } + } +} + +export default { + render(h) { + const dataObject = { + attrs: {}, + props: {}, + on: {}, + style: {} + } + const confClone = JSON.parse(JSON.stringify(this.conf)) + const children = [] + + const childObjs = componentChild[confClone.tag] + if (childObjs) { + Object.keys(childObjs).forEach(key => { + const childFunc = childObjs[key] + if (confClone[key]) { + children.push(childFunc(h, confClone, key)) + } + }) + } + + Object.keys(confClone).forEach(key => { + const val = confClone[key] + if (key === 'vModel') { + vModel(this, dataObject, confClone.defaultValue) + } else if (dataObject[key]) { + dataObject[key] = val + } else if (!isAttr(key)) { + dataObject.props[key] = val + } else { + dataObject.attrs[key] = val + } + }) + return h(this.conf.tag, dataObject, children) + }, + props: ['conf'] +} diff --git a/ruoyi-ui/src/utils/index.js b/ruoyi-ui/src/utils/index.js new file mode 100644 index 000000000..df5db12b0 --- /dev/null +++ b/ruoyi-ui/src/utils/index.js @@ -0,0 +1,390 @@ +import { parseTime } from './ruoyi' + +/** + * 表格时间格式化 + */ +export function formatDate(cellValue) { + if (cellValue == null || cellValue == "") return ""; + var date = new Date(cellValue) + var year = date.getFullYear() + var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 + var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() + var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() + var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() + return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds +} + +/** + * @param {number} time + * @param {string} option + * @returns {string} + */ +export function formatTime(time, option) { + if (('' + time).length === 10) { + time = parseInt(time) * 1000 + } else { + time = +time + } + const d = new Date(time) + const now = Date.now() + + const diff = (now - d) / 1000 + + if (diff < 30) { + return '刚刚' + } else if (diff < 3600) { + // less 1 hour + return Math.ceil(diff / 60) + '分钟前' + } else if (diff < 3600 * 24) { + return Math.ceil(diff / 3600) + '小时前' + } else if (diff < 3600 * 24 * 2) { + return '1天前' + } + if (option) { + return parseTime(time, option) + } else { + return ( + d.getMonth() + + 1 + + '月' + + d.getDate() + + '日' + + d.getHours() + + '时' + + d.getMinutes() + + '分' + ) + } +} + +/** + * @param {string} url + * @returns {Object} + */ +export function getQueryObject(url) { + url = url == null ? window.location.href : url + const search = url.substring(url.lastIndexOf('?') + 1) + const obj = {} + const reg = /([^?&=]+)=([^?&=]*)/g + search.replace(reg, (rs, $1, $2) => { + const name = decodeURIComponent($1) + let val = decodeURIComponent($2) + val = String(val) + obj[name] = val + return rs + }) + return obj +} + +/** + * @param {string} input value + * @returns {number} output value + */ +export function byteLength(str) { + // returns the byte length of an utf8 string + let s = str.length + for (var i = str.length - 1; i >= 0; i--) { + const code = str.charCodeAt(i) + if (code > 0x7f && code <= 0x7ff) s++ + else if (code > 0x7ff && code <= 0xffff) s += 2 + if (code >= 0xDC00 && code <= 0xDFFF) i-- + } + return s +} + +/** + * @param {Array} actual + * @returns {Array} + */ +export function cleanArray(actual) { + const newArray = [] + for (let i = 0; i < actual.length; i++) { + if (actual[i]) { + newArray.push(actual[i]) + } + } + return newArray +} + +/** + * @param {Object} json + * @returns {Array} + */ +export function param(json) { + if (!json) return '' + return cleanArray( + Object.keys(json).map(key => { + if (json[key] === undefined) return '' + return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) + }) + ).join('&') +} + +/** + * @param {string} url + * @returns {Object} + */ +export function param2Obj(url) { + const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') + if (!search) { + return {} + } + const obj = {} + const searchArr = search.split('&') + searchArr.forEach(v => { + const index = v.indexOf('=') + if (index !== -1) { + const name = v.substring(0, index) + const val = v.substring(index + 1, v.length) + obj[name] = val + } + }) + return obj +} + +/** + * @param {string} val + * @returns {string} + */ +export function html2Text(val) { + const div = document.createElement('div') + div.innerHTML = val + return div.textContent || div.innerText +} + +/** + * Merges two objects, giving the last one precedence + * @param {Object} target + * @param {(Object|Array)} source + * @returns {Object} + */ +export function objectMerge(target, source) { + if (typeof target !== 'object') { + target = {} + } + if (Array.isArray(source)) { + return source.slice() + } + Object.keys(source).forEach(property => { + const sourceProperty = source[property] + if (typeof sourceProperty === 'object') { + target[property] = objectMerge(target[property], sourceProperty) + } else { + target[property] = sourceProperty + } + }) + return target +} + +/** + * @param {HTMLElement} element + * @param {string} className + */ +export function toggleClass(element, className) { + if (!element || !className) { + return + } + let classString = element.className + const nameIndex = classString.indexOf(className) + if (nameIndex === -1) { + classString += '' + className + } else { + classString = + classString.substr(0, nameIndex) + + classString.substr(nameIndex + className.length) + } + element.className = classString +} + +/** + * @param {string} type + * @returns {Date} + */ +export function getTime(type) { + if (type === 'start') { + return new Date().getTime() - 3600 * 1000 * 24 * 90 + } else { + return new Date(new Date().toDateString()) + } +} + +/** + * @param {Function} func + * @param {number} wait + * @param {boolean} immediate + * @return {*} + */ +export function debounce(func, wait, immediate) { + let timeout, args, context, timestamp, result + + const later = function() { + // 据上一次触发时间间隔 + const last = +new Date() - timestamp + + // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait + if (last < wait && last > 0) { + timeout = setTimeout(later, wait - last) + } else { + timeout = null + // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 + if (!immediate) { + result = func.apply(context, args) + if (!timeout) context = args = null + } + } + } + + return function(...args) { + context = this + timestamp = +new Date() + const callNow = immediate && !timeout + // 如果延时不存在,重新设定延时 + if (!timeout) timeout = setTimeout(later, wait) + if (callNow) { + result = func.apply(context, args) + context = args = null + } + + return result + } +} + +/** + * This is just a simple version of deep copy + * Has a lot of edge cases bug + * If you want to use a perfect deep copy, use lodash's _.cloneDeep + * @param {Object} source + * @returns {Object} + */ +export function deepClone(source) { + if (!source && typeof source !== 'object') { + throw new Error('error arguments', 'deepClone') + } + const targetObj = source.constructor === Array ? [] : {} + Object.keys(source).forEach(keys => { + if (source[keys] && typeof source[keys] === 'object') { + targetObj[keys] = deepClone(source[keys]) + } else { + targetObj[keys] = source[keys] + } + }) + return targetObj +} + +/** + * @param {Array} arr + * @returns {Array} + */ +export function uniqueArr(arr) { + return Array.from(new Set(arr)) +} + +/** + * @returns {string} + */ +export function createUniqueString() { + const timestamp = +new Date() + '' + const randomNum = parseInt((1 + Math.random()) * 65536) + '' + return (+(randomNum + timestamp)).toString(32) +} + +/** + * Check if an element has a class + * @param {HTMLElement} elm + * @param {string} cls + * @returns {boolean} + */ +export function hasClass(ele, cls) { + return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) +} + +/** + * Add class to element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function addClass(ele, cls) { + if (!hasClass(ele, cls)) ele.className += ' ' + cls +} + +/** + * Remove class from element + * @param {HTMLElement} elm + * @param {string} cls + */ +export function removeClass(ele, cls) { + if (hasClass(ele, cls)) { + const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') + ele.className = ele.className.replace(reg, ' ') + } +} + +export function makeMap(str, expectsLowerCase) { + const map = Object.create(null) + const list = str.split(',') + for (let i = 0; i < list.length; i++) { + map[list[i]] = true + } + return expectsLowerCase + ? val => map[val.toLowerCase()] + : val => map[val] +} + +export const exportDefault = 'export default ' + +export const beautifierConf = { + html: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'separate', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: false, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + }, + js: { + indent_size: '2', + indent_char: ' ', + max_preserve_newlines: '-1', + preserve_newlines: false, + keep_array_indentation: false, + break_chained_methods: false, + indent_scripts: 'normal', + brace_style: 'end-expand', + space_before_conditional: true, + unescape_strings: false, + jslint_happy: true, + end_with_newline: true, + wrap_line_length: '110', + indent_inner_html: true, + comma_first: false, + e4x: true, + indent_empty_lines: true + } +} + +// 首字母大小 +export function titleCase(str) { + return str.replace(/( |^)[a-z]/g, L => L.toUpperCase()) +} + +// 下划转驼峰 +export function camelCase(str) { + return str.replace(/_[a-z]/g, str1 => str1.substr(-1).toUpperCase()) +} + +export function isNumberStr(str) { + return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) +} + diff --git a/ruoyi-ui/src/utils/jsencrypt.js b/ruoyi-ui/src/utils/jsencrypt.js new file mode 100644 index 000000000..78d95234a --- /dev/null +++ b/ruoyi-ui/src/utils/jsencrypt.js @@ -0,0 +1,30 @@ +import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' + +// 密钥对生成 http://web.chacuo.net/netrsakeypair + +const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' + + 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==' + +const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' + + '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' + + 'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' + + 'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' + + 'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' + + 'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' + + 'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' + + 'UP8iWi1Qw0Y=' + +// 加密 +export function encrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPublicKey(publicKey) // 设置公钥 + return encryptor.encrypt(txt) // 对数据进行加密 +} + +// 解密 +export function decrypt(txt) { + const encryptor = new JSEncrypt() + encryptor.setPrivateKey(privateKey) // 设置私钥 + return encryptor.decrypt(txt) // 对数据进行解密 +} + diff --git a/ruoyi-ui/src/utils/permission.js b/ruoyi-ui/src/utils/permission.js new file mode 100644 index 000000000..189a71629 --- /dev/null +++ b/ruoyi-ui/src/utils/permission.js @@ -0,0 +1,47 @@ +import store from '@/store' + +/** + * 字符权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkPermi(value) { + if (value && value instanceof Array && value.length > 0) { + const permissions = store.getters && store.getters.permissions + const permissionDatas = value + const all_permission = "*:*:*"; + + const hasPermission = permissions.some(permission => { + return all_permission === permission || permissionDatas.includes(permission) + }) + + return hasPermission; + + } else { + console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`) + return false + } +} + +/** + * 角色权限校验 + * @param {Array} value 校验值 + * @returns {Boolean} + */ +export function checkRole(value) { + if (value && value instanceof Array && value.length > 0) { + const roles = store.getters && store.getters.roles + const permissionRoles = value + const super_admin = "admin"; + + const hasRole = roles.some(role => { + return super_admin === role || permissionRoles.includes(role) + }) + + return hasRole; + + } else { + console.error(`need roles! Like checkRole="['admin','editor']"`) + return false + } +} \ No newline at end of file diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js new file mode 100644 index 000000000..ffb0d219e --- /dev/null +++ b/ruoyi-ui/src/utils/request.js @@ -0,0 +1,152 @@ +import axios from 'axios' +import { Notification, MessageBox, Message, Loading } from 'element-ui' +import store from '@/store' +import { getToken } from '@/utils/auth' +import errorCode from '@/utils/errorCode' +import { tansParams, blobValidate } from "@/utils/ruoyi"; +import cache from '@/plugins/cache' +import { saveAs } from 'file-saver' + +let downloadLoadingInstance; +// 是否显示重新登录 +export let isRelogin = { show: false }; + +axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' +// 创建axios实例 +const service = axios.create({ + // axios中请求配置有baseURL选项,表示请求URL公共部分 + baseURL: process.env.VUE_APP_BASE_API, + // 超时 + timeout: 10000 +}) + +// request拦截器 +service.interceptors.request.use(config => { + // 是否需要设置 token + const isToken = (config.headers || {}).isToken === false + // 是否需要防止数据重复提交 + const isRepeatSubmit = (config.headers || {}).repeatSubmit === false + if (getToken() && !isToken) { + config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改 + } + // get请求映射params参数 + if (config.method === 'get' && config.params) { + let url = config.url + '?' + tansParams(config.params); + url = url.slice(0, -1); + config.params = {}; + config.url = url; + } + if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { + const requestObj = { + url: config.url, + data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, + time: new Date().getTime() + } + const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 请求数据大小 + const limitSize = 5 * 1024 * 1024; // 限制存放数据5M + if (requestSize >= limitSize) { + console.warn(`[${config.url}]: ` + '请求数据大小超出允许的5M限制,无法进行防重复提交验证。') + return config; + } + const sessionObj = cache.session.getJSON('sessionObj') + if (sessionObj === undefined || sessionObj === null || sessionObj === '') { + cache.session.setJSON('sessionObj', requestObj) + } else { + const s_url = sessionObj.url; // 请求地址 + const s_data = sessionObj.data; // 请求数据 + const s_time = sessionObj.time; // 请求时间 + const interval = 1000; // 间隔时间(ms),小于此时间视为重复提交 + if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { + const message = '数据正在处理,请勿重复提交'; + console.warn(`[${s_url}]: ` + message) + return Promise.reject(new Error(message)) + } else { + cache.session.setJSON('sessionObj', requestObj) + } + } + } + return config +}, error => { + console.log(error) + Promise.reject(error) +}) + +// 响应拦截器 +service.interceptors.response.use(res => { + // 未设置状态码则默认成功状态 + const code = res.data.code || 200; + // 获取错误信息 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + // 二进制数据则直接返回 + if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { + return res.data + } + if (code === 401) { + if (!isRelogin.show) { + isRelogin.show = true; + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { + isRelogin.show = false; + store.dispatch('LogOut').then(() => { + location.href = '/index'; + }) + }).catch(() => { + isRelogin.show = false; + }); + } + return Promise.reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + Message({ message: msg, type: 'error' }) + return Promise.reject(new Error(msg)) + } else if (code === 601) { + Message({ message: msg, type: 'warning' }) + return Promise.reject('error') + } else if (code !== 200) { + Notification.error({ title: msg }) + return Promise.reject('error') + } else { + return res.data + } + }, + error => { + console.log('err' + error) + let { message } = error; + if (message == "Network Error") { + message = "后端接口连接异常"; + } else if (message.includes("timeout")) { + message = "系统接口请求超时"; + } else if (message.includes("Request failed with status code")) { + message = "系统接口" + message.substr(message.length - 3) + "异常"; + } + Message({ message: message, type: 'error', duration: 5 * 1000 }) + return Promise.reject(error) + } +) + +// 通用下载方法 +export function download(url, params, filename, config) { + downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) + return service.post(url, params, { + transformRequest: [(params) => { return tansParams(params) }], + headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, + responseType: 'blob', + ...config + }).then(async (data) => { + const isBlob = blobValidate(data); + if (isBlob) { + const blob = new Blob([data]) + saveAs(blob, filename) + } else { + const resText = await data.text(); + const rspObj = JSON.parse(resText); + const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] + Message.error(errMsg); + } + downloadLoadingInstance.close(); + }).catch((r) => { + console.error(r) + Message.error('下载文件出现错误,请联系管理员!') + downloadLoadingInstance.close(); + }) +} + +export default service diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js new file mode 100644 index 000000000..44bf9c403 --- /dev/null +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -0,0 +1,233 @@ + + +/** + * 通用js方法封装处理 + * Copyright (c) 2019 ruoyi + */ + +// 日期格式化 +export function parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), ''); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str +} + +// 表单重置 +export function resetForm(refName) { + if (this.$refs[refName]) { + this.$refs[refName].resetFields(); + } +} + +// 添加日期范围 +export function addDateRange(params, dateRange, propName) { + let search = params; + search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; + dateRange = Array.isArray(dateRange) ? dateRange : []; + if (typeof (propName) === 'undefined') { + search.params['beginTime'] = dateRange[0]; + search.params['endTime'] = dateRange[1]; + } else { + search.params['begin' + propName] = dateRange[0]; + search.params['end' + propName] = dateRange[1]; + } + return search; +} + +// 回显数据字典 +export function selectDictLabel(datas, value) { + if (value === undefined) { + return ""; + } + var actions = []; + Object.keys(datas).some((key) => { + if (datas[key].value == ('' + value)) { + actions.push(datas[key].label); + return true; + } + }) + if (actions.length === 0) { + actions.push(value); + } + return actions.join(''); +} + +// 回显数据字典(字符串、数组) +export function selectDictLabels(datas, value, separator) { + if (value === undefined || value.length ===0) { + return ""; + } + if (Array.isArray(value)) { + value = value.join(","); + } + var actions = []; + var currentSeparator = undefined === separator ? "," : separator; + var temp = value.split(currentSeparator); + Object.keys(value.split(currentSeparator)).some((val) => { + var match = false; + Object.keys(datas).some((key) => { + if (datas[key].value == ('' + temp[val])) { + actions.push(datas[key].label + currentSeparator); + match = true; + } + }) + if (!match) { + actions.push(temp[val] + currentSeparator); + } + }) + return actions.join('').substring(0, actions.join('').length - 1); +} + +// 字符串格式化(%s ) +export function sprintf(str) { + var args = arguments, flag = true, i = 1; + str = str.replace(/%s/g, function () { + var arg = args[i++]; + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + return arg; + }); + return flag ? str : ''; +} + +// 转换字符串,undefined,null等转化为"" +export function parseStrEmpty(str) { + if (!str || str == "undefined" || str == "null") { + return ""; + } + return str; +} + +// 数据合并 +export function mergeRecursive(source, target) { + for (var p in target) { + try { + if (target[p].constructor == Object) { + source[p] = mergeRecursive(source[p], target[p]); + } else { + source[p] = target[p]; + } + } catch (e) { + source[p] = target[p]; + } + } + return source; +}; + +/** + * 构造树型结构数据 + * @param {*} data 数据源 + * @param {*} id id字段 默认 'id' + * @param {*} parentId 父节点字段 默认 'parentId' + * @param {*} children 孩子节点字段 默认 'children' + */ +export function handleTree(data, id, parentId, children) { + let config = { + id: id || 'id', + parentId: parentId || 'parentId', + childrenList: children || 'children' + }; + + var childrenListMap = {}; + var nodeIds = {}; + var tree = []; + + for (let d of data) { + let parentId = d[config.parentId]; + if (childrenListMap[parentId] == null) { + childrenListMap[parentId] = []; + } + nodeIds[d[config.id]] = d; + childrenListMap[parentId].push(d); + } + + for (let d of data) { + let parentId = d[config.parentId]; + if (nodeIds[parentId] == null) { + tree.push(d); + } + } + + for (let t of tree) { + adaptToChildrenList(t); + } + + function adaptToChildrenList(o) { + if (childrenListMap[o[config.id]] !== null) { + o[config.childrenList] = childrenListMap[o[config.id]]; + } + if (o[config.childrenList]) { + for (let c of o[config.childrenList]) { + adaptToChildrenList(c); + } + } + } + return tree; +} + +/** +* 参数处理 +* @param {*} params 参数 +*/ +export function tansParams(params) { + let result = '' + for (const propName of Object.keys(params)) { + const value = params[propName]; + var part = encodeURIComponent(propName) + "="; + if (value !== null && value !== "" && typeof (value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { + let params = propName + '[' + key + ']'; + var subPart = encodeURIComponent(params) + "="; + result += subPart + encodeURIComponent(value[key]) + "&"; + } + } + } else { + result += part + encodeURIComponent(value) + "&"; + } + } + } + return result +} + +// 验证是否为blob格式 +export function blobValidate(data) { + return data.type !== 'application/json' +} diff --git a/ruoyi-ui/src/utils/scroll-to.js b/ruoyi-ui/src/utils/scroll-to.js new file mode 100644 index 000000000..c5d8e04e0 --- /dev/null +++ b/ruoyi-ui/src/utils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/ruoyi-ui/src/utils/validate.js b/ruoyi-ui/src/utils/validate.js new file mode 100644 index 000000000..57a568e9f --- /dev/null +++ b/ruoyi-ui/src/utils/validate.js @@ -0,0 +1,80 @@ +/** + * @param {string} path + * @returns {Boolean} + */ +export function isExternal(path) { + return /^(https?:|mailto:|tel:)/.test(path) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUsername(str) { + const valid_map = ['admin', 'editor'] + return valid_map.indexOf(str.trim()) >= 0 +} + +/** + * @param {string} url + * @returns {Boolean} + */ +export function validURL(url) { + const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/ + return reg.test(url) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validLowerCase(str) { + const reg = /^[a-z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validUpperCase(str) { + const reg = /^[A-Z]+$/ + return reg.test(str) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function validAlphabets(str) { + const reg = /^[A-Za-z]+$/ + return reg.test(str) +} + +/** + * @param {string} email + * @returns {Boolean} + */ +export function validEmail(email) { + const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ + return reg.test(email) +} + +/** + * @param {string} str + * @returns {Boolean} + */ +export function isString(str) { + return typeof str === 'string' || str instanceof String; +} + +/** + * @param {Array} arg + * @returns {Boolean} + */ +export function isArray(arg) { + if (typeof Array.isArray === 'undefined') { + return Object.prototype.toString.call(arg) === '[object Array]' + } + return Array.isArray(arg) +} diff --git a/ruoyi-ui/src/views/dashboard/BarChart.vue b/ruoyi-ui/src/views/dashboard/BarChart.vue new file mode 100644 index 000000000..88e7ef64c --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/BarChart.vue @@ -0,0 +1,102 @@ + + + diff --git a/ruoyi-ui/src/views/dashboard/LineChart.vue b/ruoyi-ui/src/views/dashboard/LineChart.vue new file mode 100644 index 000000000..702ff73fe --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/LineChart.vue @@ -0,0 +1,135 @@ + + + diff --git a/ruoyi-ui/src/views/dashboard/PanelGroup.vue b/ruoyi-ui/src/views/dashboard/PanelGroup.vue new file mode 100644 index 000000000..1a1081fcb --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/PanelGroup.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/ruoyi-ui/src/views/dashboard/PieChart.vue b/ruoyi-ui/src/views/dashboard/PieChart.vue new file mode 100644 index 000000000..63f0d849b --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/PieChart.vue @@ -0,0 +1,79 @@ + + + diff --git a/ruoyi-ui/src/views/dashboard/RaddarChart.vue b/ruoyi-ui/src/views/dashboard/RaddarChart.vue new file mode 100644 index 000000000..312e018a5 --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/RaddarChart.vue @@ -0,0 +1,116 @@ + + + diff --git a/ruoyi-ui/src/views/dashboard/mixins/resize.js b/ruoyi-ui/src/views/dashboard/mixins/resize.js new file mode 100644 index 000000000..b1e76e947 --- /dev/null +++ b/ruoyi-ui/src/views/dashboard/mixins/resize.js @@ -0,0 +1,56 @@ +import { debounce } from '@/utils' + +export default { + data() { + return { + $_sidebarElm: null, + $_resizeHandler: null + } + }, + mounted() { + this.initListener() + }, + activated() { + if (!this.$_resizeHandler) { + // avoid duplication init + this.initListener() + } + + // when keep-alive chart activated, auto resize + this.resize() + }, + beforeDestroy() { + this.destroyListener() + }, + deactivated() { + this.destroyListener() + }, + methods: { + // use $_ for mixins properties + // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential + $_sidebarResizeHandler(e) { + if (e.propertyName === 'width') { + this.$_resizeHandler() + } + }, + initListener() { + this.$_resizeHandler = debounce(() => { + this.resize() + }, 100) + window.addEventListener('resize', this.$_resizeHandler) + + this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0] + this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler) + }, + destroyListener() { + window.removeEventListener('resize', this.$_resizeHandler) + this.$_resizeHandler = null + + this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler) + }, + resize() { + const { chart } = this + chart && chart.resize() + } + } +} diff --git a/ruoyi-ui/src/views/error/401.vue b/ruoyi-ui/src/views/error/401.vue new file mode 100644 index 000000000..448b6ecd6 --- /dev/null +++ b/ruoyi-ui/src/views/error/401.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/ruoyi-ui/src/views/error/404.vue b/ruoyi-ui/src/views/error/404.vue new file mode 100644 index 000000000..96f075c17 --- /dev/null +++ b/ruoyi-ui/src/views/error/404.vue @@ -0,0 +1,233 @@ + + + + + diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue new file mode 100644 index 000000000..1a7310a51 --- /dev/null +++ b/ruoyi-ui/src/views/index.vue @@ -0,0 +1,1067 @@ + + + + + + diff --git a/ruoyi-ui/src/views/index_v1.vue b/ruoyi-ui/src/views/index_v1.vue new file mode 100644 index 000000000..d2d2ec633 --- /dev/null +++ b/ruoyi-ui/src/views/index_v1.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue new file mode 100644 index 000000000..06c09d287 --- /dev/null +++ b/ruoyi-ui/src/views/login.vue @@ -0,0 +1,219 @@ + + + + + diff --git a/ruoyi-ui/src/views/monitor/cache/index.vue b/ruoyi-ui/src/views/monitor/cache/index.vue new file mode 100644 index 000000000..8d2f37840 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/cache/index.vue @@ -0,0 +1,148 @@ + + + diff --git a/ruoyi-ui/src/views/monitor/cache/list.vue b/ruoyi-ui/src/views/monitor/cache/list.vue new file mode 100644 index 000000000..29a7c741d --- /dev/null +++ b/ruoyi-ui/src/views/monitor/cache/list.vue @@ -0,0 +1,241 @@ + + + diff --git a/ruoyi-ui/src/views/monitor/druid/index.vue b/ruoyi-ui/src/views/monitor/druid/index.vue new file mode 100644 index 000000000..c6ad585c1 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/druid/index.vue @@ -0,0 +1,15 @@ + + diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue new file mode 100644 index 000000000..892c72750 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/job/index.vue @@ -0,0 +1,513 @@ + + + diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue new file mode 100644 index 000000000..60bee1def --- /dev/null +++ b/ruoyi-ui/src/views/monitor/job/log.vue @@ -0,0 +1,295 @@ + + + diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue new file mode 100644 index 000000000..d6af834c3 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue @@ -0,0 +1,246 @@ + + + + diff --git a/ruoyi-ui/src/views/monitor/online/index.vue b/ruoyi-ui/src/views/monitor/online/index.vue new file mode 100644 index 000000000..ad613c969 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/online/index.vue @@ -0,0 +1,122 @@ + + + + diff --git a/ruoyi-ui/src/views/monitor/operlog/index.vue b/ruoyi-ui/src/views/monitor/operlog/index.vue new file mode 100644 index 000000000..4a1828f39 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/operlog/index.vue @@ -0,0 +1,323 @@ + + + + diff --git a/ruoyi-ui/src/views/monitor/server/index.vue b/ruoyi-ui/src/views/monitor/server/index.vue new file mode 100644 index 000000000..15ffc9a69 --- /dev/null +++ b/ruoyi-ui/src/views/monitor/server/index.vue @@ -0,0 +1,207 @@ + + + diff --git a/ruoyi-ui/src/views/redirect.vue b/ruoyi-ui/src/views/redirect.vue new file mode 100644 index 000000000..db4c1d66d --- /dev/null +++ b/ruoyi-ui/src/views/redirect.vue @@ -0,0 +1,12 @@ + diff --git a/ruoyi-ui/src/views/register.vue b/ruoyi-ui/src/views/register.vue new file mode 100644 index 000000000..7bf6f43f7 --- /dev/null +++ b/ruoyi-ui/src/views/register.vue @@ -0,0 +1,210 @@ + + + + + diff --git a/ruoyi-ui/src/views/system/config/index.vue b/ruoyi-ui/src/views/system/config/index.vue new file mode 100644 index 000000000..3ab81fc20 --- /dev/null +++ b/ruoyi-ui/src/views/system/config/index.vue @@ -0,0 +1,343 @@ + + + diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue new file mode 100644 index 000000000..e502b4ea7 --- /dev/null +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -0,0 +1,340 @@ + + + diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue new file mode 100644 index 000000000..3befe4a62 --- /dev/null +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -0,0 +1,402 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/dict/index.vue b/ruoyi-ui/src/views/system/dict/index.vue new file mode 100644 index 000000000..6ca54571e --- /dev/null +++ b/ruoyi-ui/src/views/system/dict/index.vue @@ -0,0 +1,347 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue new file mode 100644 index 000000000..c703fa0aa --- /dev/null +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -0,0 +1,452 @@ + + + diff --git a/ruoyi-ui/src/views/system/notice/index.vue b/ruoyi-ui/src/views/system/notice/index.vue new file mode 100644 index 000000000..7982b545e --- /dev/null +++ b/ruoyi-ui/src/views/system/notice/index.vue @@ -0,0 +1,312 @@ + + + diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue new file mode 100644 index 000000000..444bf6344 --- /dev/null +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -0,0 +1,309 @@ + + + diff --git a/ruoyi-ui/src/views/system/role/authUser.vue b/ruoyi-ui/src/views/system/role/authUser.vue new file mode 100644 index 000000000..147aa33e4 --- /dev/null +++ b/ruoyi-ui/src/views/system/role/authUser.vue @@ -0,0 +1,199 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue new file mode 100644 index 000000000..fb3b5ef04 --- /dev/null +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -0,0 +1,605 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/role/selectUser.vue b/ruoyi-ui/src/views/system/role/selectUser.vue new file mode 100644 index 000000000..b2b072f9c --- /dev/null +++ b/ruoyi-ui/src/views/system/role/selectUser.vue @@ -0,0 +1,138 @@ + + + diff --git a/ruoyi-ui/src/views/system/user/authRole.vue b/ruoyi-ui/src/views/system/user/authRole.vue new file mode 100644 index 000000000..943710e52 --- /dev/null +++ b/ruoyi-ui/src/views/system/user/authRole.vue @@ -0,0 +1,117 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue new file mode 100644 index 000000000..6b2a0aaf3 --- /dev/null +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -0,0 +1,676 @@ + + + \ No newline at end of file diff --git a/ruoyi-ui/src/views/system/user/profile/index.vue b/ruoyi-ui/src/views/system/user/profile/index.vue new file mode 100644 index 000000000..529c56445 --- /dev/null +++ b/ruoyi-ui/src/views/system/user/profile/index.vue @@ -0,0 +1,91 @@ + + + diff --git a/ruoyi-ui/src/views/system/user/profile/resetPwd.vue b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue new file mode 100644 index 000000000..f329e6e87 --- /dev/null +++ b/ruoyi-ui/src/views/system/user/profile/resetPwd.vue @@ -0,0 +1,69 @@ + + + diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue new file mode 100644 index 000000000..cbf3ca197 --- /dev/null +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -0,0 +1,184 @@ + + + + diff --git a/ruoyi-ui/src/views/system/user/profile/userInfo.vue b/ruoyi-ui/src/views/system/user/profile/userInfo.vue new file mode 100644 index 000000000..c970dc98e --- /dev/null +++ b/ruoyi-ui/src/views/system/user/profile/userInfo.vue @@ -0,0 +1,88 @@ + + + diff --git a/ruoyi-ui/src/views/tool/build/CodeTypeDialog.vue b/ruoyi-ui/src/views/tool/build/CodeTypeDialog.vue new file mode 100644 index 000000000..b5c2e2e49 --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/CodeTypeDialog.vue @@ -0,0 +1,106 @@ + + diff --git a/ruoyi-ui/src/views/tool/build/DraggableItem.vue b/ruoyi-ui/src/views/tool/build/DraggableItem.vue new file mode 100644 index 000000000..e881778f0 --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/DraggableItem.vue @@ -0,0 +1,100 @@ + diff --git a/ruoyi-ui/src/views/tool/build/IconsDialog.vue b/ruoyi-ui/src/views/tool/build/IconsDialog.vue new file mode 100644 index 000000000..958be50c5 --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/IconsDialog.vue @@ -0,0 +1,123 @@ + + + diff --git a/ruoyi-ui/src/views/tool/build/RightPanel.vue b/ruoyi-ui/src/views/tool/build/RightPanel.vue new file mode 100644 index 000000000..c2760eb5e --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/RightPanel.vue @@ -0,0 +1,946 @@ + + + + + diff --git a/ruoyi-ui/src/views/tool/build/TreeNodeDialog.vue b/ruoyi-ui/src/views/tool/build/TreeNodeDialog.vue new file mode 100644 index 000000000..fa7f0b285 --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/TreeNodeDialog.vue @@ -0,0 +1,149 @@ + + diff --git a/ruoyi-ui/src/views/tool/build/index.vue b/ruoyi-ui/src/views/tool/build/index.vue new file mode 100644 index 000000000..2bd298b8f --- /dev/null +++ b/ruoyi-ui/src/views/tool/build/index.vue @@ -0,0 +1,768 @@ + + + + + diff --git a/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue new file mode 100644 index 000000000..70295298e --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/basicInfoForm.vue @@ -0,0 +1,60 @@ + + + diff --git a/ruoyi-ui/src/views/tool/gen/createTable.vue b/ruoyi-ui/src/views/tool/gen/createTable.vue new file mode 100644 index 000000000..f914b5d39 --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/createTable.vue @@ -0,0 +1,45 @@ + + + diff --git a/ruoyi-ui/src/views/tool/gen/editTable.vue b/ruoyi-ui/src/views/tool/gen/editTable.vue new file mode 100644 index 000000000..951497a71 --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/editTable.vue @@ -0,0 +1,234 @@ + + + diff --git a/ruoyi-ui/src/views/tool/gen/genInfoForm.vue b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue new file mode 100644 index 000000000..98daf6d52 --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/genInfoForm.vue @@ -0,0 +1,312 @@ + + + diff --git a/ruoyi-ui/src/views/tool/gen/importTable.vue b/ruoyi-ui/src/views/tool/gen/importTable.vue new file mode 100644 index 000000000..3ea9532bf --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/importTable.vue @@ -0,0 +1,120 @@ + + + diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue new file mode 100644 index 000000000..9237c3028 --- /dev/null +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -0,0 +1,354 @@ + + + diff --git a/ruoyi-ui/src/views/tool/swagger/index.vue b/ruoyi-ui/src/views/tool/swagger/index.vue new file mode 100644 index 000000000..b8becc67c --- /dev/null +++ b/ruoyi-ui/src/views/tool/swagger/index.vue @@ -0,0 +1,15 @@ + + diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js new file mode 100644 index 000000000..85f3133bc --- /dev/null +++ b/ruoyi-ui/vue.config.js @@ -0,0 +1,130 @@ +'use strict' +const path = require('path') + +function resolve(dir) { + return path.join(__dirname, dir) +} + +const CompressionPlugin = require('compression-webpack-plugin') + +const name = process.env.VUE_APP_TITLE || '若依管理系统' // 网页标题 + +const port = process.env.port || process.env.npm_config_port || 80 // 端口 + +// vue.config.js 配置说明 +//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions +// 这里只列一部分,具体配置参考文档 +module.exports = { + // 部署生产环境和开发环境下的URL。 + // 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上 + // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 + publicPath: process.env.NODE_ENV === "production" ? "/" : "/", + // 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist) + outputDir: 'dist', + // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) + assetsDir: 'static', + // 是否开启eslint保存检测,有效值:ture | false | 'error' + lintOnSave: process.env.NODE_ENV === 'development', + // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。 + productionSourceMap: false, + // webpack-dev-server 相关配置 + devServer: { + host: '0.0.0.0', + port: port, + open: true, + proxy: { + // detail: https://cli.vuejs.org/config/#devserver-proxy + [process.env.VUE_APP_BASE_API]: { + target: `http://localhost:8080`, + changeOrigin: true, + pathRewrite: { + ['^' + process.env.VUE_APP_BASE_API]: '' + } + } + }, + disableHostCheck: true + }, + css: { + loaderOptions: { + sass: { + sassOptions: { outputStyle: "expanded" } + } + } + }, + configureWebpack: { + name: name, + resolve: { + alias: { + '@': resolve('src') + } + }, + plugins: [ + // http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件 + new CompressionPlugin({ + cache: false, // 不启用文件缓存 + test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式 + filename: '[path][base].gz[query]', // 压缩后的文件名 + algorithm: 'gzip', // 使用gzip压缩 + minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩 + deleteOriginalAssets: false // 压缩后删除原文件 + }) + ], + }, + chainWebpack(config) { + config.plugins.delete('preload') // TODO: need test + config.plugins.delete('prefetch') // TODO: need test + + // set svg-sprite-loader + config.module + .rule('svg') + .exclude.add(resolve('src/assets/icons')) + .end() + config.module + .rule('icons') + .test(/\.svg$/) + .include.add(resolve('src/assets/icons')) + .end() + .use('svg-sprite-loader') + .loader('svg-sprite-loader') + .options({ + symbolId: 'icon-[name]' + }) + .end() + + config.when(process.env.NODE_ENV !== 'development', config => { + config + .plugin('ScriptExtHtmlWebpackPlugin') + .after('html') + .use('script-ext-html-webpack-plugin', [{ + // `runtime` must same as runtimeChunk name. default is `runtime` + inline: /runtime\..*\.js$/ + }]) + .end() + + config.optimization.splitChunks({ + chunks: 'all', + cacheGroups: { + libs: { + name: 'chunk-libs', + test: /[\\/]node_modules[\\/]/, + priority: 10, + chunks: 'initial' // only package third parties that are initially dependent + }, + elementUI: { + name: 'chunk-elementUI', // split elementUI into a single package + test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm + priority: 20 // the weight needs to be larger than libs and app or it will be packaged into libs or app + }, + commons: { + name: 'chunk-commons', + test: resolve('src/components'), // can customize your rules + minChunks: 3, // minimum common number + priority: 5, + reuseExistingChunk: true + } + } + }) + config.optimization.runtimeChunk('single') + }) + } +} diff --git a/sql/ruoyi.html b/sql/ruoyi.html deleted file mode 100644 index 915fa1fbc..000000000 --- a/sql/ruoyi.html +++ /dev/null @@ -1,2890 +0,0 @@ - - - - -RuoYi - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RuoYi - Move the mouse over tables & columns to read the comments. - - - - - - - Fk qrtz_blob_triggers_ibfk_1 -qrtz_blob_triggers ref qrtz_triggers ( sched_name, trigger_name, trigger_group ) - - -sched_name,trigger_name,trigger_group - - - Fk qrtz_cron_triggers_ibfk_1 -qrtz_cron_triggers ref qrtz_triggers ( sched_name, trigger_name, trigger_group ) - - -sched_name,trigger_name,trigger_group - - - Fk qrtz_simple_triggers_ibfk_1 -qrtz_simple_triggers ref qrtz_triggers ( sched_name, trigger_name, trigger_group ) - - -sched_name,trigger_name,trigger_group - - - Fk qrtz_simprop_triggers_ibfk_1 -qrtz_simprop_triggers ref qrtz_triggers ( sched_name, trigger_name, trigger_group ) - - -sched_name,trigger_name,trigger_group - - - Fk qrtz_triggers_ibfk_1 -qrtz_triggers ref qrtz_job_details ( sched_name, job_name, job_group ) - - -sched_name,job_name,job_group - - - - - - - -qrtz_blob_triggersTable ry.qrtz_blob_triggers - Pk pk_qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -sched_namesched_name -* varchar(120) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -trigger_nametrigger_name -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - blob_datablob_data -blob -~ - - - - - - - -qrtz_calendarsTable ry.qrtz_calendars - Pk pk_qrtz_calendars ( sched_name, calendar_name ) -sched_namesched_name -* varchar(120) -t Pk pk_qrtz_calendars ( sched_name, calendar_name ) -calendar_namecalendar_name -* varchar(200) -t calendarcalendar -* blob -~ - - - - - - - -qrtz_cron_triggersTable ry.qrtz_cron_triggers - Pk pk_qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -sched_namesched_name -* varchar(120) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -trigger_nametrigger_name -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - cron_expressioncron_expression -* varchar(200) -t time_zone_idtime_zone_id -varchar(80) -t - - - - - - - -qrtz_job_detailsTable ry.qrtz_job_details - Pk pk_qrtz_job_details ( sched_name, job_name, job_group ) -sched_namesched_name -* varchar(120) -Referred by qrtz_triggers ( sched_name, job_name, job_group ) - Pk pk_qrtz_job_details ( sched_name, job_name, job_group ) -job_namejob_name -* varchar(200) -Referred by qrtz_triggers ( sched_name, job_name, job_group ) - Pk pk_qrtz_job_details ( sched_name, job_name, job_group ) -job_groupjob_group -* varchar(200) -Referred by qrtz_triggers ( sched_name, job_name, job_group ) - descriptiondescription -varchar(250) -t job_class_namejob_class_name -* varchar(250) -t is_durableis_durable -* varchar(1) -t is_nonconcurrentis_nonconcurrent -* varchar(1) -t is_update_datais_update_data -* varchar(1) -t requests_recoveryrequests_recovery -* varchar(1) -t job_datajob_data -blob -~ - - - - - - - -qrtz_locksTable ry.qrtz_locks - Pk pk_qrtz_locks ( sched_name, lock_name ) -sched_namesched_name -* varchar(120) -t Pk pk_qrtz_locks ( sched_name, lock_name ) -lock_namelock_name -* varchar(40) -t - - - - - - - -qrtz_scheduler_stateTable ry.qrtz_scheduler_state - Pk pk_qrtz_scheduler_state ( sched_name, instance_name ) -sched_namesched_name -* varchar(120) -t Pk pk_qrtz_scheduler_state ( sched_name, instance_name ) -instance_nameinstance_name -* varchar(200) -t last_checkin_timelast_checkin_time -* bigint -# checkin_intervalcheckin_interval -* bigint -# - - - - - - - -qrtz_simple_triggersTable ry.qrtz_simple_triggers - Pk pk_qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -sched_namesched_name -* varchar(120) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -trigger_nametrigger_name -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - repeat_countrepeat_count -* bigint -# repeat_intervalrepeat_interval -* bigint -# times_triggeredtimes_triggered -* bigint -# - - - - - - - -qrtz_simprop_triggersTable ry.qrtz_simprop_triggers - Pk pk_qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) -sched_namesched_name -* varchar(120) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) -trigger_nametrigger_name -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -References qrtz_triggers ( sched_name, trigger_name, trigger_group ) - str_prop_1str_prop_1 -varchar(512) -t str_prop_2str_prop_2 -varchar(512) -t str_prop_3str_prop_3 -varchar(512) -t int_prop_1int_prop_1 -int -# int_prop_2int_prop_2 -int -# long_prop_1long_prop_1 -bigint -# long_prop_2long_prop_2 -bigint -# dec_prop_1dec_prop_1 -decimal(13,4) -# dec_prop_2dec_prop_2 -decimal(13,4) -# bool_prop_1bool_prop_1 -varchar(1) -t bool_prop_2bool_prop_2 -varchar(1) -t - - - - - - - -qrtz_triggersTable ry.qrtz_triggers - Pk pk_qrtz_triggers ( sched_name, trigger_name, trigger_group ) sched_name ( sched_name, job_name, job_group ) -sched_namesched_name -* varchar(120) -References qrtz_job_details ( sched_name, job_name, job_group ) -Referred by qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_triggers ( sched_name, trigger_name, trigger_group ) -trigger_nametrigger_name -* varchar(200) -Referred by qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) - Pk pk_qrtz_triggers ( sched_name, trigger_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -Referred by qrtz_blob_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_cron_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simple_triggers ( sched_name, trigger_name, trigger_group ) -Referred by qrtz_simprop_triggers ( sched_name, trigger_name, trigger_group ) - sched_name ( sched_name, job_name, job_group ) -job_namejob_name -* varchar(200) -References qrtz_job_details ( sched_name, job_name, job_group ) - sched_name ( sched_name, job_name, job_group ) -job_groupjob_group -* varchar(200) -References qrtz_job_details ( sched_name, job_name, job_group ) - descriptiondescription -varchar(250) -t next_fire_timenext_fire_time -bigint -# prev_fire_timeprev_fire_time -bigint -# prioritypriority -int -# trigger_statetrigger_state -* varchar(16) -t trigger_typetrigger_type -* varchar(8) -t start_timestart_time -* bigint -# end_timeend_time -bigint -# calendar_namecalendar_name -varchar(200) -t misfire_instrmisfire_instr -smallint -# job_datajob_data -blob -~ - - - - - - - -sys_dict_dataTable ry.sys_dict_data - Pk pk_sys_dict_data ( dict_code ) -dict_codedict_code -* int -字典编码 -# dict_sortdict_sort -int default 0 -字典排序 -# dict_labeldict_label -varchar(100) default '' -字典标签 -t dict_valuedict_value -varchar(100) default '' -字典键值 -t dict_typedict_type -varchar(100) default '' -字典类型 -t statusstatus -int default 0 -状态(0正常 1禁用) -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注 -t - - - - - - - -sys_dict_typeTable ry.sys_dict_type - Pk pk_sys_dict_type ( dict_id ) -dict_iddict_id -* int -字典主键 -# dict_namedict_name -varchar(100) default '' -字典名称 -t Unq dict_type ( dict_type ) -dict_typedict_type -varchar(100) default '' -字典类型 -t statusstatus -int default 0 -状态(0正常 1禁用) -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注 -t - - - - - - - -sys_jobTable ry.sys_job - Pk pk_sys_job ( job_id, job_name, job_group ) -job_idjob_id -* int -任务ID -# Pk pk_sys_job ( job_id, job_name, job_group ) -job_namejob_name -* varchar(64) default '' -任务名称 -t Pk pk_sys_job ( job_id, job_name, job_group ) -job_groupjob_group -* varchar(64) default '' -任务组名 -t method_namemethod_name -varchar(500) default '' -任务方法 -t paramsparams -varchar(200) default '' -方法参数 -t cron_expressioncron_expression -varchar(255) default '' -cron执行表达式 -t statusstatus -int default 0 -状态(0正常 1暂停) -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注信息 -t - - - - - - - -sys_job_logTable ry.sys_job_log - Pk pk_sys_job_log ( job_log_id ) -job_log_idjob_log_id -* int -任务日志ID -# job_namejob_name -* varchar(64) -任务名称 -t job_groupjob_group -* varchar(64) -任务组名 -t method_namemethod_name -varchar(500) -任务方法 -t paramsparams -varchar(200) default '' -方法参数 -t job_messagejob_message -varchar(500) -日志信息 -t is_exceptionis_exception -int default 0 -是否异常 -# exception_infoexception_info -text -异常信息 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d - - - - - - - -sys_logininforTable ry.sys_logininfor - Pk pk_sys_logininfor ( info_id ) -info_idinfo_id -* int -访问ID -# login_namelogin_name -varchar(50) default '' -登录账号 -t ipaddripaddr -varchar(50) default '' -登录IP地址 -t browserbrowser -varchar(50) default '' -浏览器类型 -t osos -varchar(50) default '' -操作系统 -t statusstatus -int default 0 -登录状态 0成功 1失败 -# msgmsg -varchar(255) default '' -提示消息 -t login_timelogin_time -* timestamp default CURRENT_TIMESTAMP -访问时间 -d - - - - - - - -sys_menuTable ry.sys_menu - Pk pk_sys_menu ( menu_id ) -menu_idmenu_id -* int -菜单ID -# menu_namemenu_name -* varchar(50) -菜单名称 -t parent_idparent_id -int default 0 -父菜单ID -# order_numorder_num -int -显示顺序 -# urlurl -varchar(200) default '' -请求地址 -t menu_typemenu_type -char(1) default '' -类型:M目录,C菜单,F按钮 -c visiblevisible -int default 0 -菜单状态:0显示,1隐藏 -# permsperms -varchar(100) default '' -权限标识 -t iconicon -varchar(100) default '' -菜单图标 -t create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注 -t - - - - - - - -sys_oper_logTable ry.sys_oper_log - Pk pk_sys_oper_log ( oper_id ) -oper_idoper_id -* int -日志主键 -# titletitle -varchar(50) default '' -模块标题 -t actionaction -varchar(100) default '' -功能请求 -t methodmethod -varchar(100) default '' -方法名称 -t channelchannel -varchar(20) default '' -来源渠道 -t login_namelogin_name -varchar(50) default '' -登录账号 -t dept_namedept_name -varchar(50) default '' -部门名称 -t oper_urloper_url -varchar(255) default '' -请求URL -t oper_ipoper_ip -varchar(30) default '' -主机地址 -t oper_paramoper_param -varchar(255) default '' -请求参数 -t statusstatus -int default 0 -操作状态 0正常 1异常 -# error_msgerror_msg -varchar(2000) default '' -错误消息 -t oper_timeoper_time -* timestamp default CURRENT_TIMESTAMP -操作时间 -d - - - - - - - -sys_postTable ry.sys_post - Pk pk_sys_post ( post_id ) -post_idpost_id -* int -岗位ID -# post_codepost_code -* varchar(64) -岗位编码 -t post_namepost_name -* varchar(100) -岗位名称 -t post_sortpost_sort -* int -显示顺序 -# statusstatus -* int -状态(0正常 1停用) -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注 -t - - - - - - - -sys_roleTable ry.sys_role - Pk pk_sys_role ( role_id ) -role_idrole_id -* int -角色ID -# role_namerole_name -* varchar(30) -角色名称 -t role_keyrole_key -* varchar(100) -角色权限字符串 -t role_sortrole_sort -* int -显示顺序 -# statusstatus -int default 0 -角色状态:0正常,1禁用 -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d remarkremark -varchar(500) default '' -备注 -t - - - - - - - -sys_role_menuTable ry.sys_role_menu - Pk pk_sys_role_menu ( role_id, menu_id ) -role_idrole_id -* int -角色ID -# Pk pk_sys_role_menu ( role_id, menu_id ) -menu_idmenu_id -* int -菜单ID -# - - - - - - - -sys_userTable ry.sys_user - Pk pk_sys_user ( user_id ) -user_iduser_id -* int -用户ID -# dept_iddept_id -int -部门ID -# login_namelogin_name -varchar(30) default '' -登录账号 -t user_nameuser_name -varchar(30) default '' -用户昵称 -t emailemail -varchar(100) default '' -用户邮箱 -t phonenumberphonenumber -varchar(20) default '' -手机号码 -t passwordpassword -varchar(100) default '' -密码 -t saltsalt -varchar(100) default '' -盐加密 -t user_typeuser_type -char(1) default 'N' -类型:Y默认用户,N非默认用户 -c statusstatus -int default 0 -帐号状态:0正常,1禁用 -# refuse_desrefuse_des -varchar(500) default '' -拒绝登录描述 -t create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d - - - - - - - -sys_user_onlineTable ry.sys_user_online - Pk pk_sys_user_online ( sessionId ) -sessionIdsessionId -* varchar(50) default '' -用户会话id -t login_namelogin_name -varchar(50) default '' -登录账号 -t dept_namedept_name -varchar(50) default '' -部门名称 -t ipaddripaddr -varchar(50) default '' -登录IP地址 -t browserbrowser -varchar(50) default '' -浏览器类型 -t osos -varchar(50) default '' -操作系统 -t statusstatus -varchar(10) default '' -在线状态on_line在线off_line离线 -t start_timestampstart_timestamp -* timestamp default CURRENT_TIMESTAMP -session创建时间 -d last_access_timelast_access_time -* timestamp default '0000-00-00 00:00:00' -session最后访问时间 -d expire_timeexpire_time -int default 0 -超时时间,单位为分钟 -# - - - - - - - -sys_user_postTable ry.sys_user_post - Pk pk_sys_user_post ( user_id, post_id ) -user_iduser_id -* varchar(64) -用户ID -t Pk pk_sys_user_post ( user_id, post_id ) -post_idpost_id -* varchar(64) -岗位ID -t - - - - - - - -sys_user_roleTable ry.sys_user_role - Pk pk_sys_user_role ( user_id, role_id ) -user_iduser_id -* int -用户ID -# Pk pk_sys_user_role ( user_id, role_id ) -role_idrole_id -* int -角色ID -# - - - - - - - -sys_deptTable ry.sys_dept - Pk pk_sys_dept ( dept_id ) -dept_iddept_id -* int -部门id -# parent_idparent_id -int default 0 -父部门id -# dept_namedept_name -varchar(30) default '' -部门名称 -t order_numorder_num -int default 0 -显示顺序 -# leaderleader -varchar(20) default '' -负责人 -t phonephone -varchar(20) default '' -联系电话 -t emailemail -varchar(20) default '' -邮箱 -t statusstatus -int default 0 -部门状态:0正常,1停用 -# create_bycreate_by -varchar(64) default '' -创建者 -t create_timecreate_time -* timestamp default CURRENT_TIMESTAMP -创建时间 -d update_byupdate_by -varchar(64) default '' -更新者 -t update_timeupdate_time -* timestamp default '0000-00-00 00:00:00' -更新时间 -d - - - - - - - -qrtz_paused_trigger_grpsTable ry.qrtz_paused_trigger_grps - Pk pk_qrtz_paused_trigger_grps ( sched_name, trigger_group ) -sched_namesched_name -* varchar(120) -t Pk pk_qrtz_paused_trigger_grps ( sched_name, trigger_group ) -trigger_grouptrigger_group -* varchar(200) -t - - - - - - - -qrtz_fired_triggersTable ry.qrtz_fired_triggers - Pk pk_qrtz_fired_triggers ( sched_name, entry_id ) -sched_namesched_name -* varchar(120) -t Pk pk_qrtz_fired_triggers ( sched_name, entry_id ) -entry_identry_id -* varchar(95) -t trigger_nametrigger_name -* varchar(200) -t trigger_grouptrigger_group -* varchar(200) -t instance_nameinstance_name -* varchar(200) -t fired_timefired_time -* bigint -# sched_timesched_time -* bigint -# prioritypriority -* int -# statestate -* varchar(16) -t job_namejob_name -varchar(200) -t job_groupjob_group -varchar(200) -t is_nonconcurrentis_nonconcurrent -varchar(1) -t requests_recoveryrequests_recovery -varchar(1) -t -
    - - -

    -

    Table qrtz_blob_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
     blob_data blob
    Indexes
    pk_qrtz_blob_triggers ON sched_name, trigger_name, trigger_group
    Foreign Keys
    qrtz_blob_triggers_ibfk_1 ( sched_name, trigger_name, trigger_group ) ref qrtz_triggers (sched_name, trigger_name, trigger_group)
    - -

    -

    Table qrtz_calendars

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *calendar_name varchar( 200 )
    *calendar blob
    Indexes
    pk_qrtz_calendars ON sched_name, calendar_name
    - -

    -

    Table qrtz_cron_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
    *cron_expression varchar( 200 )
     time_zone_id varchar( 80 )
    Indexes
    pk_qrtz_cron_triggers ON sched_name, trigger_name, trigger_group
    Foreign Keys
    qrtz_cron_triggers_ibfk_1 ( sched_name, trigger_name, trigger_group ) ref qrtz_triggers (sched_name, trigger_name, trigger_group)
    - -

    -

    Table qrtz_fired_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *entry_id varchar( 95 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
    *instance_name varchar( 200 )
    *fired_time bigint
    *sched_time bigint
    *priority int
    *state varchar( 16 )
     job_name varchar( 200 )
     job_group varchar( 200 )
     is_nonconcurrent varchar( 1 )
     requests_recovery varchar( 1 )
    Indexes
    pk_qrtz_fired_triggers ON sched_name, entry_id
    - -

    -

    Table qrtz_job_details

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *job_name varchar( 200 )
    *job_group varchar( 200 )
     description varchar( 250 )
    *job_class_name varchar( 250 )
    *is_durable varchar( 1 )
    *is_nonconcurrent varchar( 1 )
    *is_update_data varchar( 1 )
    *requests_recovery varchar( 1 )
     job_data blob
    Indexes
    pk_qrtz_job_details ON sched_name, job_name, job_group
    - -

    -

    Table qrtz_locks

    - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *lock_name varchar( 40 )
    Indexes
    pk_qrtz_locks ON sched_name, lock_name
    - -

    -

    Table qrtz_paused_trigger_grps

    - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_group varchar( 200 )
    Indexes
    pk_qrtz_paused_trigger_grps ON sched_name, trigger_group
    - -

    -

    Table qrtz_scheduler_state

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *instance_name varchar( 200 )
    *last_checkin_time bigint
    *checkin_interval bigint
    Indexes
    pk_qrtz_scheduler_state ON sched_name, instance_name
    - -

    -

    Table qrtz_simple_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
    *repeat_count bigint
    *repeat_interval bigint
    *times_triggered bigint
    Indexes
    pk_qrtz_simple_triggers ON sched_name, trigger_name, trigger_group
    Foreign Keys
    qrtz_simple_triggers_ibfk_1 ( sched_name, trigger_name, trigger_group ) ref qrtz_triggers (sched_name, trigger_name, trigger_group)
    - -

    -

    Table qrtz_simprop_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
     str_prop_1 varchar( 512 )
     str_prop_2 varchar( 512 )
     str_prop_3 varchar( 512 )
     int_prop_1 int
     int_prop_2 int
     long_prop_1 bigint
     long_prop_2 bigint
     dec_prop_1 decimal( 13, 4 )
     dec_prop_2 decimal( 13, 4 )
     bool_prop_1 varchar( 1 )
     bool_prop_2 varchar( 1 )
    Indexes
    pk_qrtz_simprop_triggers ON sched_name, trigger_name, trigger_group
    Foreign Keys
    qrtz_simprop_triggers_ibfk_1 ( sched_name, trigger_name, trigger_group ) ref qrtz_triggers (sched_name, trigger_name, trigger_group)
    - -

    -

    Table qrtz_triggers

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sched_name varchar( 120 )
    *trigger_name varchar( 200 )
    *trigger_group varchar( 200 )
    *job_name varchar( 200 )
    *job_group varchar( 200 )
     description varchar( 250 )
     next_fire_time bigint
     prev_fire_time bigint
     priority int
    *trigger_state varchar( 16 )
    *trigger_type varchar( 8 )
    *start_time bigint
     end_time bigint
     calendar_name varchar( 200 )
     misfire_instr smallint
     job_data blob
    Indexes
    pk_qrtz_triggers ON sched_name, trigger_name, trigger_group
    sched_name ON sched_name, job_name, job_group
    Foreign Keys
    qrtz_triggers_ibfk_1 ( sched_name, job_name, job_group ) ref qrtz_job_details (sched_name, job_name, job_group)
    - -

    -

    Table sys_dept

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *dept_id int AUTOINCREMENT 部门id
     parent_id int DEFAULT 0 父部门id
     dept_name varchar( 30 ) DEFAULT '' 部门名称
     order_num int DEFAULT 0 显示顺序
     leader varchar( 20 ) DEFAULT '' 负责人
     phone varchar( 20 ) DEFAULT '' 联系电话
     email varchar( 20 ) DEFAULT '' 邮箱
     status int DEFAULT 0 部门状态:0正常,1停用
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
    Indexes
    pk_sys_dept ON dept_id
    - -

    -

    Table sys_dict_data

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *dict_code int AUTOINCREMENT 字典编码
     dict_sort int DEFAULT 0 字典排序
     dict_label varchar( 100 ) DEFAULT '' 字典标签
     dict_value varchar( 100 ) DEFAULT '' 字典键值
     dict_type varchar( 100 ) DEFAULT '' 字典类型
     status int DEFAULT 0 状态(0正常 1禁用)
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注
    Indexes
    pk_sys_dict_data ON dict_code
    - -

    -

    Table sys_dict_type

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *dict_id int AUTOINCREMENT 字典主键
     dict_name varchar( 100 ) DEFAULT '' 字典名称
    dict_type varchar( 100 ) DEFAULT '' 字典类型
     status int DEFAULT 0 状态(0正常 1禁用)
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注
    Indexes
    pk_sys_dict_type ON dict_id
    dict_type ON dict_type
    - -

    -

    Table sys_job

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *job_id int AUTOINCREMENT 任务ID
    *job_name varchar( 64 ) DEFAULT '' 任务名称
    *job_group varchar( 64 ) DEFAULT '' 任务组名
     method_name varchar( 500 ) DEFAULT '' 任务方法
     params varchar( 200 ) DEFAULT '' 方法参数
     cron_expression varchar( 255 ) DEFAULT '' cron执行表达式
     status int DEFAULT 0 状态(0正常 1暂停)
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注信息
    Indexes
    pk_sys_job ON job_id, job_name, job_group
    - -

    -

    Table sys_job_log

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *job_log_id int AUTOINCREMENT 任务日志ID
    *job_name varchar( 64 ) 任务名称
    *job_group varchar( 64 ) 任务组名
     method_name varchar( 500 ) 任务方法
     params varchar( 200 ) DEFAULT '' 方法参数
     job_message varchar( 500 ) 日志信息
     is_exception int DEFAULT 0 是否异常
     exception_info text 异常信息
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
    Indexes
    pk_sys_job_log ON job_log_id
    - -

    -

    Table sys_logininfor

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *info_id int AUTOINCREMENT 访问ID
     login_name varchar( 50 ) DEFAULT '' 登录账号
     ipaddr varchar( 50 ) DEFAULT '' 登录IP地址
     browser varchar( 50 ) DEFAULT '' 浏览器类型
     os varchar( 50 ) DEFAULT '' 操作系统
     status int DEFAULT 0 登录状态 0成功 1失败
     msg varchar( 255 ) DEFAULT '' 提示消息
    *login_time timestamp DEFAULT CURRENT_TIMESTAMP 访问时间
    Indexes
    pk_sys_logininfor ON info_id
    - -

    -

    Table sys_menu

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *menu_id int AUTOINCREMENT 菜单ID
    *menu_name varchar( 50 ) 菜单名称
     parent_id int DEFAULT 0 父菜单ID
     order_num int 显示顺序
     url varchar( 200 ) DEFAULT '' 请求地址
     menu_type char( 1 ) DEFAULT '' 类型:M目录,C菜单,F按钮
     visible int DEFAULT 0 菜单状态:0显示,1隐藏
     perms varchar( 100 ) DEFAULT '' 权限标识
     icon varchar( 100 ) DEFAULT '' 菜单图标
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注
    Indexes
    pk_sys_menu ON menu_id
    - -

    -

    Table sys_oper_log

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *oper_id int AUTOINCREMENT 日志主键
     title varchar( 50 ) DEFAULT '' 模块标题
     action varchar( 100 ) DEFAULT '' 功能请求
     method varchar( 100 ) DEFAULT '' 方法名称
     channel varchar( 20 ) DEFAULT '' 来源渠道
     login_name varchar( 50 ) DEFAULT '' 登录账号
     dept_name varchar( 50 ) DEFAULT '' 部门名称
     oper_url varchar( 255 ) DEFAULT '' 请求URL
     oper_ip varchar( 30 ) DEFAULT '' 主机地址
     oper_param varchar( 255 ) DEFAULT '' 请求参数
     status int DEFAULT 0 操作状态 0正常 1异常
     error_msg varchar( 2000 ) DEFAULT '' 错误消息
    *oper_time timestamp DEFAULT CURRENT_TIMESTAMP 操作时间
    Indexes
    pk_sys_oper_log ON oper_id
    - -

    -

    Table sys_post

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *post_id int AUTOINCREMENT 岗位ID
    *post_code varchar( 64 ) 岗位编码
    *post_name varchar( 100 ) 岗位名称
    *post_sort int 显示顺序
    *status int 状态(0正常 1停用)
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注
    Indexes
    pk_sys_post ON post_id
    - -

    -

    Table sys_role

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *role_id int AUTOINCREMENT 角色ID
    *role_name varchar( 30 ) 角色名称
    *role_key varchar( 100 ) 角色权限字符串
    *role_sort int 显示顺序
     status int DEFAULT 0 角色状态:0正常,1禁用
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
     remark varchar( 500 ) DEFAULT '' 备注
    Indexes
    pk_sys_role ON role_id
    - -

    -

    Table sys_role_menu

    - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *role_id int 角色ID
    *menu_id int 菜单ID
    Indexes
    pk_sys_role_menu ON role_id, menu_id
    - -

    -

    Table sys_user

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *user_id int AUTOINCREMENT 用户ID
     dept_id int 部门ID
     login_name varchar( 30 ) DEFAULT '' 登录账号
     user_name varchar( 30 ) DEFAULT '' 用户昵称
     email varchar( 100 ) DEFAULT '' 用户邮箱
     phonenumber varchar( 20 ) DEFAULT '' 手机号码
     password varchar( 100 ) DEFAULT '' 密码
     salt varchar( 100 ) DEFAULT '' 盐加密
     user_type char( 1 ) DEFAULT 'N' 类型:Y默认用户,N非默认用户
     status int DEFAULT 0 帐号状态:0正常,1禁用
     refuse_des varchar( 500 ) DEFAULT '' 拒绝登录描述
     create_by varchar( 64 ) DEFAULT '' 创建者
    *create_time timestamp DEFAULT CURRENT_TIMESTAMP 创建时间
     update_by varchar( 64 ) DEFAULT '' 更新者
    *update_time timestamp DEFAULT '0000-00-00 00:00:00' 更新时间
    Indexes
    pk_sys_user ON user_id
    - -

    -

    Table sys_user_online

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *sessionId varchar( 50 ) DEFAULT '' 用户会话id
     login_name varchar( 50 ) DEFAULT '' 登录账号
     dept_name varchar( 50 ) DEFAULT '' 部门名称
     ipaddr varchar( 50 ) DEFAULT '' 登录IP地址
     browser varchar( 50 ) DEFAULT '' 浏览器类型
     os varchar( 50 ) DEFAULT '' 操作系统
     status varchar( 10 ) DEFAULT '' 在线状态on_line在线off_line离线
    *start_timestsamp timestamp DEFAULT CURRENT_TIMESTAMP session创建时间
    *last_access_time timestamp DEFAULT '0000-00-00 00:00:00' session最后访问时间
     expire_time int DEFAULT 0 超时时间,单位为分钟
    Indexes
    pk_sys_user_online ON sessionId
    - -

    -

    Table sys_user_post

    - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *user_id varchar( 64 ) 用户ID
    *post_id varchar( 64 ) 岗位ID
    Indexes
    pk_sys_user_post ON user_id, post_id
    - -

    -

    Table sys_user_role

    - - - - - - - - - - - - - - - - - - - - - - -
    IndexesField NameData TypeDescription
    *user_id int 用户ID
    *role_id int 角色ID
    Indexes
    pk_sys_user_role ON user_id, role_id
    - -

    Powered by DbSchema

    \ No newline at end of file diff --git a/sql/ruoyi.pdm b/sql/ruoyi.pdm deleted file mode 100644 index 9dbddc69d..000000000 --- a/sql/ruoyi.pdm +++ /dev/null @@ -1,4851 +0,0 @@ - - - - - - - - - -21C20947-ED50-4632-B638-DC1A02BD948A -ruoyi -ruoyi -1524449337 -Administrator -1538297587 -admin -[FolderOptions] - -[FolderOptions\Physical Objects] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= -RevPkey=Yes -RevFkey=Yes -RevAkey=Yes -RevCheck=Yes -RevIndx=Yes -RevOpts=Yes -RevViewAsTabl=No -RevViewOpts=Yes -RevSystAsTabl=Yes -RevTablPerm=No -RevViewPerm=No -RevProcPerm=No -RevDbpkPerm=No -RevSqncPerm=No -RevAdtPerm=No -RevUserPriv=No -RevUserOpts=No -RevGrpePriv=No -RevRolePriv=No -RevDtbsOpts=Yes -RevDtbsPerm=No -RevViewIndx=Yes -RevJidxOpts=Yes -RevStats=No -RevTspcPerm=No -RevCaseSensitive=No -GenTrgrStdMsg=Yes -GenTrgrMsgTab= -GenTrgrMsgNo= -GenTrgrMsgTxt= -TrgrPreserve=No -TrgrIns=Yes -TrgrUpd=Yes -TrgrDel=Yes -TrgrC2Ins=Yes -TrgrC2Upd=Yes -TrgrC3=Yes -TrgrC4=Yes -TrgrC5=Yes -TrgrC6=Yes -TrgrC7=Yes -TrgrC8=Yes -TrgrC9=Yes -TrgrC10=Yes -TrgrC11=Yes -TrgrC1=Yes -TrgrC12Ins=Yes -TrgrC12Upd=Yes -TrgrC13=Yes -UpdateTableStatistics=Yes -UpdateColumnStatistics=Yes - -[FolderOptions\Physical Objects\Database Generation] -GenScriptName=orders.sql -GenScriptName0=orders.sql -GenScriptName1=studentsystem.sql -GenScriptName2=NetCTOSS.sql -GenScriptName3=product.sql -GenScriptName4=voteSystem.sql -GenScriptName5=.sql -GenScriptName6=enterpriseManagement.sql -GenScriptName7=crebas.sql -GenScriptName8= -GenScriptName9= -GenPathName=C:\Users\Administrator\Desktop\ -GenSingleFile=Yes -GenODBC=No -GenCheckModel=Yes -GenScriptPrev=Yes -GenArchiveModel=No -GenUseSync=No -GenSyncChoice=0 -GenSyncArch= -GenSyncRmg=0 - -[FolderOptions\Physical Objects\Database Generation\Format] -GenScriptTitle=Yes -GenScriptNamLabl=No -GenScriptQDtbs=No -GenScriptQOwnr=Yes -GenScriptCase=0 -GenScriptEncoding=ANSI -GenScriptNAcct=No -IdentifierDelimiter=" - -[FolderOptions\Physical Objects\Database Generation\Database] -Create=Yes -Open=Yes -Close=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Database\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Tablespace] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Tablespace\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Storage] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\User] -Create=Yes -Grant=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\User\Create] -Physical Options=No - -[FolderOptions\Physical Objects\Database Generation\Group] -Create=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\Role] -Create=Yes -Drop=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType\Create] -Default value=Yes -Check=Yes - -[FolderOptions\Physical Objects\Database Generation\AbstractDataType] -Create=Yes -Header=Yes -Footer=Yes -Drop=Yes -Comment=Yes -Install JAVA class=Yes -Remove JAVA class=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Rule] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Default] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Sequence] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create] -Check=Yes -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column] -User datatype=No -Default value=Yes -Check=Yes -Physical Options=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key\Create] -Constraint declaration=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Create] -Constraint declaration=Yes -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Filter] -Primary key=No -Foreign key=No -Alternate key=No -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\View] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\View\Create] -Force Column list=No -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewColumn] -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Create] -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Filter] -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\DBMSTrigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym\Filter] -Table=Yes -View=Yes -Proc=Yes -Synonym=Yes -Database Package=Yes -Sequence=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Procedure] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Procedure\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\DatabasePackage] -Create=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\WebService] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Dimension] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synchronization] -GenBackupTabl=1 -GenKeepBackTabl=1 -GenTmpTablDrop=No -GenKeepTablOpts=No - -[FolderOptions\Physical Objects\Test Data] -GenDataPathName= -GenDataSinglefile=Yes -GenDataScriptName=testdata -GenDataScriptName0= -GenDataScriptName1= -GenDataScriptName2= -GenDataScriptName3= -GenDataScriptName4= -GenDataScriptName5= -GenDataScriptName6= -GenDataScriptName7= -GenDataScriptName8= -GenDataScriptName9= -GenDataOdbc=0 -GenDataDelOld=No -GenDataTitle=No -GenDataDefNumRows=20 -GenDataCommit=0 -GenDataPacket=0 -GenDataOwner=No -GenDataProfNumb= -GenDataProfChar= -GenDataProfDate= -GenDataCSVSeparator=, -GenDataFileFormat=CSV -GenDataUseWizard=No - -[FolderOptions\Pdm] -IndxIQName=%COLUMN%_%INDEXTYPE% -IndxPK=Yes -IndxFK=Yes -IndxAK=Yes -IndxPKName=%TABLE%_PK -IndxFKName=%REFR%_FK -IndxAKName=%AKEY%_AK -IndxPreserve=No -IndxThreshold=0 -IndxStats=No -RefrPreserve=No -JidxPreserve=No -RbldMultiFact=Yes -RbldMultiDim=Yes -RbldMultiJidx=Yes -CubePreserve=No -TablStProcPreserve=No -ProcDepPreserve=Yes -TrgrDepPreserve=Yes -CubeScriptPath= -CubeScriptCase=0 -CubeScriptEncoding=ANSI -CubeScriptNacct=No -CubeScriptHeader=No -CubeScriptExt=csv -CubeScriptExt0=txt -CubeScriptExt1= -CubeScriptExt2= -CubeScriptSep=, -CubeScriptDeli=" -DfltDomnName=D_%.U:VALUE% -DfltColnName=D_%.U:VALUE% -DfltReuse=Yes -DfltDrop=Yes -[ModelOptions] - -[ModelOptions\Physical Objects] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -EnableRequirements=No -DefaultDttp= -IgnoreOwner=No -RebuildTrigger=Yes -RefrUnique=No -RefrAutoMigrate=Yes -RefrMigrateReuse=Yes -RefrMigrateDomain=Yes -RefrMigrateCheck=Yes -RefrMigrateRule=Yes -RefrMigrateExtd=No -RefrMigrDefaultLink=No -RefrDfltImpl=D -RefrPrgtColn=No -RefrMigrateToEnd=No -RebuildTriggerDep=No -ColnFKName=%.3:PARENT%_%COLUMN% -ColnFKNameUse=No -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyMand=No -DomnCopyExtd=No -DomnCopyProf=No -Notation=0 -DomnDefaultMandatory=No -ColnDefaultMandatory=No -TablDefaultOwner= -ViewDefaultOwner= -TrgrDefaultOwnerTabl= -TrgrDefaultOwnerView= -IdxDefaultOwnerTabl= -IdxDefaultOwnerView= -JdxDefaultOwner= -DBPackDefaultOwner= -SeqDefaultOwner= -ProcDefaultOwner= -DBMSTrgrDefaultOwner= -Currency=USD -RefrDeleteConstraint=1 -RefrUpdateConstraint=1 -RefrParentMandatory=No -RefrParentChangeAllow=Yes -RefrCheckOnCommit=No - -[ModelOptions\Physical Objects\NamingOptionsTemplates] - -[ModelOptions\Physical Objects\ClssNamingOptions] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL] - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Code] -Template= -MaxLen=64 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN] - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Code] -Template= -MaxLen=64 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX] - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR] - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF] - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Code] -Template= -MaxLen=64 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM] - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT] - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\CUBE] - -[ModelOptions\Physical Objects\ClssNamingOptions\CUBE\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\CUBE\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS] - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR] - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO] - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass] - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Connection] - -[ModelOptions\Pdm] - -[ModelOptions\Generate] - -[ModelOptions\Generate\Pdm] -RRMapping=No - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -Notation=2 - -[ModelOptions\Generate\Oom] -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=Yes -ClassPrefix= - -[ModelOptions\Generate\Xsm] -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=No - -[ModelOptions\Generate\Ldm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Default Opts] - -[ModelOptions\Default Opts\TABL] -PhysOpts= - -[ModelOptions\Default Opts\COLN] -PhysOpts= - -[ModelOptions\Default Opts\INDX] -PhysOpts= - -[ModelOptions\Default Opts\AKEY] -PhysOpts= - -[ModelOptions\Default Opts\PKEY] -PhysOpts= - -[ModelOptions\Default Opts\STOR] -PhysOpts= - -[ModelOptions\Default Opts\TSPC] -PhysOpts= - -[ModelOptions\Default Opts\SQNC] -PhysOpts= - -[ModelOptions\Default Opts\DTBS] -PhysOpts= - -[ModelOptions\Default Opts\USER] -PhysOpts= - -[ModelOptions\Default Opts\JIDX] -PhysOpts= - - -AFAD9ECF-F417-4FCE-BEA4-884857D4C1A9 -MySQL 5.0 -MYSQL50 -1524449337 -Administrator -1524449337 -Administrator - -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B - - - - -B6C2C4A4-6A8A-41F3-909D-C7B514E1EAE2 -PhysicalDiagram_1 -PhysicalDiagram_1 -1524449325 -Administrator -1538297386 -admin -[DisplayPreferences] - -[DisplayPreferences\PDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=Yes -Grid size=0 -Graphic unit=2 -Window color=255, 255, 255 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255, 255, 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Mode=0 -Trunc Length=80 -Word Length=80 -Word Text=!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -PckgShowStrn=Yes -Package.Comment=No -Package.IconPicture=No -Package_SymbolLayout= -Display Model Version=Yes -Table.Stereotype=Yes -Table.DisplayName=Yes -Table.OwnerDisplayName=No -Table.Columns=Yes -Table.Columns._Filter=""PDMCOLNALL -Table.Columns._Columns=Stereotype DataType KeyIndicator -Table.Columns._Limit=-5 -Table.Keys=No -Table.Keys._Columns=Stereotype Indicator -Table.Indexes=No -Table.Indexes._Columns=Stereotype -Table.Triggers=No -Table.Triggers._Columns=Stereotype -Table.Comment=No -Table.IconPicture=No -Table_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nKeyIndicator No\r\nIndexIndicator No\r\nNullStatus No" Filters="&quot;All Columns&quot; PDMCOLNALL &quot;&quot;\r\n&quot;PK Columns&quot; PDMCOLNPK &quot;PRIM \&quot;TRUE\&quot; TRUE&quot;\r\n&quot;Key Columns&quot; PDMCOLNKEY &quot;KEYS \&quot;TRUE\&quot; TRUE&quot;" HasLimit="Yes" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Keys" Collection="Keys" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Triggers" Collection="Triggers" Columns="Stereotype No\r\nDisplayName Yes" HasLimit="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -View.Stereotype=Yes -View.DisplayName=Yes -View.OwnerDisplayName=No -View.Columns=Yes -View.Columns._Columns=DisplayName -View.Columns._Limit=-5 -View.TemporaryVTables=Yes -View.Indexes=No -View.Comment=No -View.IconPicture=No -View_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="DisplayName No\r\nExpression No\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nIndexIndicator No" HasLimit="Yes" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Tables" Collection="TemporaryVTables" Columns="Name Yes" HasLimit="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="DisplayName Yes" HasLimit="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Procedure.Stereotype=No -Procedure.DisplayName=Yes -Procedure.OwnerDisplayName=No -Procedure.Comment=No -Procedure.IconPicture=No -Procedure_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Reference.Cardinality=No -Reference.ImplementationType=No -Reference.ChildRole=Yes -Reference.Stereotype=Yes -Reference.DisplayName=No -Reference.ForeignKeyConstraintName=Yes -Reference.JoinExpression=No -Reference.Integrity=No -Reference.ParentRole=Yes -Reference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="Cardinality" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Implementation" Attribute="ImplementationType" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Cons&amp;traint Name" Attribute="ForeignKeyConstraintName" Prefix="" Suffix="" Caption="Cons&amp;traint Name" Mandatory="No" />[CRLF] <StandardAttribute Name="Join" Attribute="JoinExpression" Prefix="" Suffix="" Caption="Join" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Referential integrity" Attribute="Integrity" Prefix="" Suffix="" Caption="Referential integrity" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -ViewReference.ChildRole=Yes -ViewReference.Stereotype=Yes -ViewReference.DisplayName=No -ViewReference.JoinExpression=No -ViewReference.ParentRole=Yes -ViewReference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Join Expression" Attribute="JoinExpression" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -File Location=No -PckgStrn=Yes -ColnMode=0 -ColnMax=5 -TablOwnr=No -ColnDttp=Yes -ColnDomn=No -ColnShowDomn=No -ColnKey=Yes -ColnIndx=No -ColnMand=No -ColnStrn=Yes -VColName=Yes -VColExpr=No -VColDttp=No -VColIndx=No -VColCMod=0 -VColCMax=5 -ProcOwnr=No -KeyStrn=Yes -IndxStrn=Yes -TrgrStrn=Yes - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LCNMFont=新宋体,8,N -LCNMFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=Yes -Keep center=Yes -Keep size=No -Width=2400 -Height=2400 -Brush color=255 255 255 -Fill Color=No -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\TABL] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -KeysFont=新宋体,8,N -KeysFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -TriggersFont=新宋体,8,N -TriggersFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=178 214 252 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VIEW] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -TemporaryVTablesFont=新宋体,8,N -TemporaryVTablesFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PROC] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4000 -Height=1000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 108 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\REFR] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VREF] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 -(8268, 11693) -((315,354), (433,354)) -1 -15 - - -1524449375 -1538296407 --1 -((-38123,15297), (-26435,28269)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1524449886 --1 -((-23935,12010), (-11861,28282)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296409 --1 -((-9361,18172), (2713,27845)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1524449886 --1 -((5214,16547), (17288,27869)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296412 --1 -((19788,14872), (31862,27845)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296204 --1 -((-37598,8498), (-29000,12497)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296205 --1 -((-37674,3548), (-29076,7547)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296308 --1 -((-37528,-6452), (-28929,-2453)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296401 --1 -((-24280,-1775), (-11048,10373)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296599 --1 -((-9182,625), (2892,10298)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538296612 --1 -((5017,-2538), (17091,10434)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538297772 --1 -((-39520,-17440), (-26288,-8592)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538297770 --1 -((-24744,-19106), (-10738,-8608)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538297380 --1 -((-9749,-20696), (3870,-8548)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1524449375 -1538297383 --1 -((5261,-17623), (18494,-8774)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1538296083 -1538296211 --1 -((-37675,-1349), (-29076,2650)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1538296587 -1538296608 --1 -((19570,-987), (32030,8687)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -config_id -1538296632 -1538297253 -((-13950,-17175), (73200,19575)) -4130 -1 -0 -7 -16777215 -16777215 -新宋体,8,N - - -1538297386 -1538297498 --1 -((19859,-18262), (33092,-8589)) -12615680 -16570034 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -BB11FFF9-9DBB-4648-87AA-9A50E1214549 -sys_dept -sys_dept -1524449375 -Administrator -1538297518 -admin -部门表 - - - -00C66282-419A-4915-8509-DFFFE6352DE8 -dept_id -dept_id -1524449375 -Administrator -1524449375 -Administrator -部门id -int(11) -11 -1 -1 - - -5B6FB0B1-5B1E-4E86-AF2A-72C49EBB315E -parent_id -parent_id -1524449375 -Administrator -1524449375 -Administrator -父部门id -0 -int(11) -11 - - -065E33A5-6AB5-44F1-8FEC-A72311EECD66 -ancestors -ancestors -1538295690 -admin -1538295792 -admin -varchar(50) -50 - - -EBB59EC8-AFD4-40E3-B811-DD5040728D91 -dept_name -dept_name -1524449375 -Administrator -1524449375 -Administrator -部门名称 -'' -varchar(30) -30 - - -2F26C025-82B0-4AC5-AEE0-32BA07B7B529 -order_num -order_num -1524449375 -Administrator -1524449375 -Administrator -显示顺序 -0 -int(4) -4 - - -CA504E09-528C-482E-A0C7-F86C559AA3A6 -leader -leader -1524449375 -Administrator -1524449375 -Administrator -负责人 -'' -varchar(20) -20 - - -9CFC55C4-DF2B-4A90-A789-C3839FAA43A8 -phone -phone -1524449375 -Administrator -1524449375 -Administrator -联系电话 -'' -varchar(20) -20 - - -1A9407E5-D74E-4CE9-9078-C4EC25393F7B -email -email -1524449375 -Administrator -1524449375 -Administrator -邮箱 -'' -varchar(20) -20 - - -B6772812-4B69-4248-871D-FA1B4BA0E5F7 -status -status -1524449375 -Administrator -1538295792 -admin -部门状态:0正常,1停用 -0 -char(1) -1 - - -6EBD2BFF-861E-4247-BAAB-B37CCBAF6F8D -del_flag -del_flag -1538295690 -admin -1538295792 -admin -char(1) -1 - - -2504A090-F6D6-493F-855E-5154E01AF0CA -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -D866AE9E-E7FF-47B2-BF3D-9BC1605A2F39 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -7C6C9836-FC23-4492-8CF1-A4439E01B57C -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -FCED770D-005C-4531-A9D7-D1FD0A054719 -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - - - -15C1774B-9F17-48B6-A61F-728A25220B30 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -AA56FD91-4450-4282-8F31-AE302DF6AFEC -sys_user -sys_user -1524449375 -Administrator -1538297540 -admin -用户信息表 - - - -4A920BCE-4040-4F12-89D2-7DF345B90321 -user_id -user_id -1524449375 -Administrator -1524449375 -Administrator -用户ID -int(11) -11 -1 -1 - - -174E10B2-4A4D-40FF-80B8-B4D285561E42 -dept_id -dept_id -1524449375 -Administrator -1538297552 -admin -部门ID -NULL -int(11) -11 - - -1D4908A9-5416-4252-BA09-FA122D0194C3 -login_name -login_name -1524449375 -Administrator -1524449375 -Administrator -登录账号 -'' -varchar(30) -30 - - -2EF63346-9E82-4746-81B7-AB67D727446D -user_name -user_name -1524449375 -Administrator -1524449375 -Administrator -用户昵称 -'' -varchar(30) -30 - - -477EA57C-0E0B-4596-9A85-EC91E72F5160 -user_type -user_type -1524449375 -Administrator -1524449375 -Administrator -类型:Y默认用户,N非默认用户 -N -char(1) -1 - - -CD16FFF4-F214-473B-A9A8-FA30A3E357D1 -email -email -1524449375 -Administrator -1524449375 -Administrator -用户邮箱 -'' -varchar(100) -100 - - -61603FA5-3EBC-4389-AED7-1B54D238A563 -phonenumber -phonenumber -1524449375 -Administrator -1524449375 -Administrator -手机号码 -'' -varchar(20) -20 - - -65E9DE55-ED58-4BD9-B96C-7C081D1119B2 -sex -sex -1538295815 -admin -1538295948 -admin -char(1) -1 - - -E5E35061-221A-4BB9-AA22-3CF20F1FCCF6 -avatar -avatar -1538295815 -admin -1538295948 -admin -varchar(100) -100 - - -4ED1C2BF-B826-4A82-9464-EEBF271F4054 -password -password -1524449375 -Administrator -1524449375 -Administrator -密码 -'' -varchar(100) -100 - - -53E6BB49-3435-46E0-832F-BCAFE1A021CB -salt -salt -1524449375 -Administrator -1524449375 -Administrator -盐加密 -'' -varchar(100) -100 - - -245CAD53-B33B-4EED-8CFA-7AA10ED943B8 -status -status -1524449375 -Administrator -1538297540 -admin -帐号状态:0正常,1禁用 -0 -char(1) -1 - - -7F851464-6CC5-445B-9413-2A89B9CE90CB -del_flag -del_flag -1524449375 -Administrator -1538295948 -admin -拒绝登录描述 -'' -char(1) -1 - - -3DC8EC79-D75A-4BF8-8FBC-152E938AC14F -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -48C8C936-7A34-4A97-AACA-A6F07751FFAD -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -6050B4F3-9B26-4B40-AB4C-BA483F179958 -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -CD1E7E11-8EB6-4C9C-A69C-39CBCF10573E -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -F9F55D4C-13E6-49A0-BFDB-E0AFE0FA5501 -remark -remark -1538295815 -admin -1538295948 -admin -varchar(500) -500 - - - - -2E35FD67-A7A7-4B10-85E4-85115AD0E143 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -2711A520-532C-4F14-A034-BFF047C9CD6B -sys_post -sys_post -1524449375 -Administrator -1538297571 -admin -岗位信息表 - - - -FB04D29E-41F0-49A3-BFDB-58E222843F21 -post_id -post_id -1524449375 -Administrator -1524449375 -Administrator -岗位ID -int(11) -11 -1 -1 - - -50010C4E-4F59-47B9-8F08-05E8E071E8B1 -post_code -post_code -1524449375 -Administrator -1524449375 -Administrator -岗位编码 -varchar(64) -64 -1 - - -0F929250-051E-4344-B22A-C30E071A543B -post_name -post_name -1524449375 -Administrator -1524449375 -Administrator -岗位名称 -varchar(100) -100 -1 - - -2BC9005E-350F-46BE-98D6-9B13060F1B20 -post_sort -post_sort -1524449375 -Administrator -1524449375 -Administrator -显示顺序 -int(4) -4 -1 - - -F6D7AD3E-5EA0-4759-B6BF-6334B7105B78 -status -status -1524449375 -Administrator -1538297565 -admin -状态(0正常 1停用) -char(1) -1 -1 - - -CED01369-5063-479D-A444-32936369A486 -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -A29528FF-A2B9-4149-B997-1B0204D42E40 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -6026A05D-0C1E-497E-8EAF-FDB704BE6A52 -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -DF516F5F-CD82-4347-AC57-BDCB4E5DD75E -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -539CEC34-49F0-49A0-9B7C-B84655FD2233 -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注 -'' -varchar(500) -500 - - - - -14E893B1-D0BA-46A7-A905-F0FFA089B65A -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -11337551-BA45-43CD-9148-92BE60E2F8F5 -sys_role -sys_role -1524449375 -Administrator -1538297608 -admin -角色信息表 - - - -A420E2C9-8FE3-452A-9047-C7BEACE8490C -role_id -role_id -1524449375 -Administrator -1524449375 -Administrator -角色ID -int(10) -10 -1 -1 - - -9342763D-5B89-4440-965B-2B55DB4ACD86 -role_name -role_name -1524449375 -Administrator -1524449375 -Administrator -角色名称 -varchar(30) -30 -1 - - -54480009-0C7E-40F2-AA76-CD914A6D66C5 -role_key -role_key -1524449375 -Administrator -1524449375 -Administrator -角色权限字符串 -varchar(100) -100 -1 - - -E73F4D0E-12A0-42B5-B3CE-B573D499DD6C -role_sort -role_sort -1524449375 -Administrator -1538296031 -admin -显示顺序 -int(10) -10 - - -5F836F54-9EBD-4768-AA3C-F268F5FAFE8D -data_scope -data_scope -1538295973 -admin -1538296031 -admin -char(1) -1 - - -424ED799-E4C1-44AD-A172-C2B3C405E9C5 -status -status -1524449375 -Administrator -1538297608 -admin -角色状态:0正常,1禁用 -0 -char(1) -1 - - -8E034C76-5966-4246-B81B-7B12F37D96A7 -del_flag -del_flag -1538295973 -admin -1538296031 -admin -char(1) -1 - - -214F6E1F-28B1-454B-ABF0-D1C43220129D -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -1A6D5791-0353-4ABC-8BC2-921BB87A2E5A -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -D6394880-A49C-4B83-B43A-5FDBAA918AA3 -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -34285DF5-8E36-452B-A3AA-9F4290C20F7E -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -2FAB98F7-68A2-460B-8A20-5D5DA73F5103 -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注 -'' -varchar(500) -500 - - - - -4342E67F-D33C-435F-9865-973E053B6075 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -FBC2A590-443B-43C9-82D5-687B850C8B3D -sys_menu -sys_menu -1524449375 -Administrator -1538297627 -admin -菜单权限表 - - - -BB061292-3B99-432E-9B96-5362AAD918B9 -menu_id -menu_id -1524449375 -Administrator -1524449375 -Administrator -菜单ID -int(11) -11 -1 -1 - - -EA8422AB-37B1-4D60-A3C9-A4BF9039A9D4 -menu_name -menu_name -1524449375 -Administrator -1524449375 -Administrator -菜单名称 -varchar(50) -50 -1 - - -E56E04A8-63F6-4271-92E3-974DC84DD536 -parent_id -parent_id -1524449375 -Administrator -1524449375 -Administrator -父菜单ID -0 -int(11) -11 - - -1809914E-6B09-4CD2-8916-E603D6717557 -order_num -order_num -1524449375 -Administrator -1524449375 -Administrator -显示顺序 -NULL -int(4) -4 - - -FCB44D46-3C21-40CB-B942-57823E52E5B1 -url -url -1524449375 -Administrator -1524449375 -Administrator -请求地址 -'' -varchar(200) -200 - - -667EE044-6805-4668-BAF4-E78B3052051F -menu_type -menu_type -1524449375 -Administrator -1524449375 -Administrator -类型:M目录,C菜单,F按钮 -'' -char(1) -1 - - -F7658083-BCAB-46F7-AF31-8A4B1D8749EF -visible -visible -1524449375 -Administrator -1538297627 -admin -菜单状态:0显示,1隐藏 -0 -char(1) -1 - - -528611C8-C319-430F-8F00-68FBA60F310B -perms -perms -1524449375 -Administrator -1524449375 -Administrator -权限标识 -'' -varchar(100) -100 - - -38004CD7-8DD0-43F1-9E59-B50132CB6F1A -icon -icon -1524449375 -Administrator -1524449375 -Administrator -菜单图标 -'' -varchar(100) -100 - - -6927665F-EC42-4E1F-A275-4B27F442B6B8 -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -1A6A4D0F-0B0B-4522-B4DA-3F1D592CB889 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -605D7776-4820-4BA9-91E8-AD837B73AEFB -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -4CFF26BB-8736-4864-855E-C7C1B133370B -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -67C6E46C-DF06-480A-BC74-E927406E5D26 -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注 -'' -varchar(500) -500 - - - - -08EBE713-9E4D-4312-AA7D-2E4E439734E5 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -F8CB66D1-3632-4509-97C4-17016BE261FC -sys_user_role -sys_user_role -1524449375 -Administrator -1538297676 -admin -用户和角色关联表 - - - -73701F72-C45B-4CA0-8A62-632890E3DEF0 -user_id -user_id -1524449375 -Administrator -1524449375 -Administrator -用户ID -int(11) -11 -1 - - -CABD458B-DA59-46A8-99C3-088AD8D34097 -role_id -role_id -1524449375 -Administrator -1524449375 -Administrator -角色ID -int(11) -11 -1 - - - - -37C3213B-EF22-4CD4-A91F-9A9A2503FB2A -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - - -9F8C6A9F-3221-410E-AEA4-D1A80026397E -sys_role_menu -sys_role_menu -1524449375 -Administrator -1538297683 -admin -角色和菜单关联表 - - - -D2E151A5-6156-46EF-844E-0ADC3070293B -role_id -role_id -1524449375 -Administrator -1524449375 -Administrator -角色ID -int(11) -11 -1 - - -6B8C1E62-FD8B-4504-8FA0-F69917722FBD -menu_id -menu_id -1524449375 -Administrator -1524449375 -Administrator -菜单ID -int(11) -11 -1 - - - - -2E72304F-91F0-4392-BAE8-BBF7A4346B7D -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - - -726CB18E-7D5B-4E2E-9CF8-047AD5AF89E3 -sys_user_post -sys_user_post -1524449375 -Administrator -1538297694 -admin -用户与岗位关联表 - - - -E4A1CAB6-0F63-4917-ACEF-418DE7F894BA -user_id -user_id -1524449375 -Administrator -1538296306 -admin -用户ID -int(11) -11 -1 - - -8E7188D5-B3A5-4F1D-B6CB-D77D652414DE -post_id -post_id -1524449375 -Administrator -1538296306 -admin -岗位ID -int(11) -11 -1 - - - - -4091B7D3-2404-4C20-BBCD-B63E22A5E960 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - - -FE347A45-D8EC-423B-9B38-4D315A3ABE42 -sys_oper_log -sys_oper_log -1524449375 -Administrator -1538297699 -admin -操作日志记录 - - - -F5FC8AC1-7415-4A57-BA2C-EE2E7B9E1EFC -oper_id -oper_id -1524449375 -Administrator -1524449375 -Administrator -日志主键 -int(11) -11 -1 -1 - - -2103BC5C-E28D-4369-8369-E898B218587A -title -title -1524449375 -Administrator -1524449375 -Administrator -模块标题 -'' -varchar(50) -50 - - -6816377B-3DB6-424A-99ED-1D20FEB30ED4 -business_type -business_type -1524449375 -Administrator -1538296397 -admin -功能请求 -'' -int(2) -2 - - -9CA3B7C3-F52C-4E2E-893F-8E6EBA7B2667 -method -method -1524449375 -Administrator -1524449375 -Administrator -方法名称 -'' -varchar(100) -100 - - -A5744803-C050-4108-9D15-7A0B95F03642 -operator_type -operator_type -1524449375 -Administrator -1538296397 -admin -来源渠道 -'' -int(1) -1 - - -B0DF8235-6BC1-452C-8B30-A56F0430E4F5 -oper_name -oper_name -1524449375 -Administrator -1538296397 -admin -登录账号 -'' -varchar(50) -50 - - -25315A12-4EB9-4B67-9E2C-9F40F8EF7FAB -dept_name -dept_name -1524449375 -Administrator -1524449375 -Administrator -部门名称 -'' -varchar(50) -50 - - -7AF8602B-A1DA-4EA3-BFB2-7638F96A86C0 -oper_url -oper_url -1524449375 -Administrator -1524449375 -Administrator -请求URL -'' -varchar(255) -255 - - -F2A56B63-7A56-43FA-8099-411F3578B30D -oper_ip -oper_ip -1524449375 -Administrator -1524449375 -Administrator -主机地址 -'' -varchar(30) -30 - - -1EF1BAF6-F5C1-496C-98E0-8B10C37279A1 -oper_param -oper_param -1524449375 -Administrator -1524449375 -Administrator -请求参数 -'' -varchar(255) -255 - - -AA3F3A4E-D375-4232-B152-01DCFB8F6B6D -status -status -1524449375 -Administrator -1524449375 -Administrator -操作状态 0正常 1异常 -0 -int(1) -1 - - -29E44D4A-6AC7-4220-A502-4BFC8746397A -error_msg -error_msg -1524449375 -Administrator -1524449375 -Administrator -错误消息 -'' -varchar(2000) -2000 - - -22343C35-D913-485B-862E-2CEF579AAF22 -oper_time -oper_time -1524449375 -Administrator -1524449375 -Administrator -操作时间 -timestamp - - - - -C0561C20-CC22-471B-A764-414C0D378FD6 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -AA2CFBA5-FA97-4AF1-92FE-645370B5848D -sys_dict_type -sys_dict_type -1524449375 -Administrator -1538297703 -admin -字典类型表 - - - -79CB7D43-B999-4D92-9477-D3AFEBD94248 -dict_id -dict_id -1524449375 -Administrator -1524449375 -Administrator -字典主键 -int(11) -11 -1 -1 - - -2490B755-3E0A-4935-97F0-2EFDF9A72D05 -dict_name -dict_name -1524449375 -Administrator -1524449375 -Administrator -字典名称 -'' -varchar(100) -100 - - -7421238A-82DB-4992-AA28-41726AB6A5D6 -dict_type -dict_type -1524449375 -Administrator -1524449375 -Administrator -字典类型 -'' -varchar(100) -100 - - -971D2FBD-1A24-4EE4-B943-9367609C7472 -status -status -1524449375 -Administrator -1538296458 -admin -状态(0正常 1禁用) -0 -char(1) -1 - - -B8876246-5BBA-4A03-86D7-98CA4EBEE342 -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -5237CED2-0853-41DE-ACF4-BE442BC9E112 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -2CACFBC0-8349-4B3A-9183-208B18C9F56F -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -ABEE7806-4F61-4B97-980C-CA081F61CA7C -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -3966B558-B911-45DE-86C6-57F3DB9267BA -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注 -'' -varchar(500) -500 - - -AFC0A0ED-A469-40B2-A6C4-4616444830AA -unique -unique -1524449375 -Administrator -1524449375 -Administrator -(dict_type) - - - - -BAD40D8E-BC11-44F5-918E-B27CABBCB051 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -493D6B25-21D0-45B1-BBA0-764B9C09B57D -sys_dict_data -sys_dict_data -1524449375 -Administrator -1538297709 -admin -字典数据表 - - - -CFDB23A8-AE38-4051-973A-2DABAC8283F9 -dict_code -dict_code -1524449375 -Administrator -1524449375 -Administrator -字典编码 -int(11) -11 -1 -1 - - -EAA405BD-12A8-472F-A42D-CDA6A82E291A -dict_sort -dict_sort -1524449375 -Administrator -1524449375 -Administrator -字典排序 -0 -int(4) -4 - - -F13017F5-2AA0-4DE9-9DC2-A9A3D73A98E6 -dict_label -dict_label -1524449375 -Administrator -1524449375 -Administrator -字典标签 -'' -varchar(100) -100 - - -EEEC4136-823D-4892-9BB9-BB0B4ADD83E3 -dict_value -dict_value -1524449375 -Administrator -1524449375 -Administrator -字典键值 -'' -varchar(100) -100 - - -ADF5A383-D055-40BE-BBFC-06E2B93D4E6A -dict_type -dict_type -1524449375 -Administrator -1524449375 -Administrator -字典类型 -'' -varchar(100) -100 - - -A0B2DDF2-251D-4701-9B00-6893C74CC449 -css_class -css_class -1538296497 -admin -1538296556 -admin -varchar(100) -100 - - -3CBFBA8E-7609-458D-9E53-A825C3F307A2 -list_class -list_class -1538296497 -admin -1538296556 -admin -varchar(100) -100 - - -BA974839-DEE0-4684-BBEF-6D7776C34354 -is_default -is_default -1538296497 -admin -1538296556 -admin -char(1) -1 - - -1676CDF5-01CA-4749-BA1D-6E5399257BD0 -status -status -1524449375 -Administrator -1524449375 -Administrator -状态(0正常 1禁用) -0 -int(1) -1 - - -8798B094-1AAF-4A23-B2F1-4C19DACF1AA3 -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -D1CB9293-D762-403C-85CB-4B974ACF7328 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -5A34AF87-B25E-4349-9713-69DC50F6F5F2 -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -3204FBAC-1F61-4571-ADC4-BF1BE9CED85A -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -B7DE1842-809C-4401-9C80-C9A37DF9B053 -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注 -'' -varchar(500) -500 - - - - -2809F417-7FA5-48DA-B613-662C7C28061E -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -0A7C2F56-6E3B-4E70-A549-0EC60779D180 -sys_logininfor -sys_logininfor -1524449375 -Administrator -1538297756 -admin -系统访问记录 - - - -5CB5D942-D52B-487D-BC86-476481B0FB8D -info_id -info_id -1524449375 -Administrator -1524449375 -Administrator -访问ID -int(11) -11 -1 -1 - - -A1C66DBC-9DB7-428B-9275-3D014B6CE388 -login_name -login_name -1524449375 -Administrator -1524449375 -Administrator -登录账号 -'' -varchar(50) -50 - - -8E0F50A6-F98D-48B0-8D9D-78F3A76ED171 -ipaddr -ipaddr -1524449375 -Administrator -1524449375 -Administrator -登录IP地址 -'' -varchar(50) -50 - - -91B70723-1A7E-4277-A100-63B775A504B3 -login_location -login_location -1538297350 -admin -1538297369 -admin -varchar(255) -255 - - -AA04F533-A044-428B-80F8-515B6BB1A302 -browser -browser -1524449375 -Administrator -1524449375 -Administrator -浏览器类型 -'' -varchar(50) -50 - - -D37570E9-9EEE-4349-B875-494A5415C736 -os -os -1524449375 -Administrator -1524449375 -Administrator -操作系统 -'' -varchar(50) -50 - - -CF10A80C-123E-42F3-A2DD-1B770E5F9D86 -status -status -1524449375 -Administrator -1524449375 -Administrator -登录状态 0成功 1失败 -0 -int(1) -1 - - -9113784E-932A-4FAF-82CB-A75B8C827309 -msg -msg -1524449375 -Administrator -1524449375 -Administrator -提示消息 -'' -varchar(255) -255 - - -BCA519C6-19C9-45DF-A0B5-F88E9E6D3557 -login_time -login_time -1524449375 -Administrator -1524449375 -Administrator -访问时间 -timestamp - - - - -C14E656C-0645-49EB-8B42-AD82232E0416 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -4DCA223F-E98B-4D8B-A71C-CFB438C15488 -sys_user_online -sys_user_online -1524449375 -Administrator -1538297754 -admin -在线用户记录 - - - -7FCC57CE-47DD-4948-B949-10401B2FC7B1 -sessionId -sessionId -1524449375 -Administrator -1524449375 -Administrator -用户会话id -'' -varchar(50) -50 -1 - - -FDE5B59D-8CF7-4AAE-987F-3FF2AEBE22CB -login_name -login_name -1524449375 -Administrator -1524449375 -Administrator -登录账号 -'' -varchar(50) -50 - - -AB65FF92-33A0-42C8-8B3F-454A1FAD5615 -dept_name -dept_name -1524449375 -Administrator -1524449375 -Administrator -部门名称 -'' -varchar(50) -50 - - -C4DAF2D0-9CDC-476B-A011-FF5D302371EB -ipaddr -ipaddr -1524449375 -Administrator -1524449375 -Administrator -登录IP地址 -'' -varchar(50) -50 - - -C8243FB0-425B-4A74-9ADA-C93B15E713EA -login_location -login_location -1538297178 -admin -1538297216 -admin -varchar(255) -255 - - -89EC40B0-0C22-4811-90BB-BEA385ACDF20 -browser -browser -1524449375 -Administrator -1524449375 -Administrator -浏览器类型 -'' -varchar(50) -50 - - -AC455631-CFE0-45BB-A0C5-788D695E4B6C -os -os -1524449375 -Administrator -1524449375 -Administrator -操作系统 -'' -varchar(50) -50 - - -5C56E3C9-4591-4762-89E1-C9BBFECB5F11 -status -status -1524449375 -Administrator -1524449375 -Administrator -在线状态on_line在线off_line离线 -'' -varchar(10) -10 - - -0CAF2F1F-459F-4F78-9075-D95F924A4FF7 -start_timestamp -start_timestamp -1524449375 -Administrator -1524449375 -Administrator -session创建时间 -timestamp - - -6AE6BDED-823E-4455-9A9F-338EC6F7BDB9 -last_access_time -last_access_time -1524449375 -Administrator -1524449375 -Administrator -session最后访问时间 -timestamp - - -CE390924-4628-421C-979F-002C2952E99E -expire_time -expire_time -1524449375 -Administrator -1524449375 -Administrator -超时时间,单位为分钟 -0 -int(5) -5 - - - - -365CC94D-6124-42C7-96BD-376B84B709F7 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -AFCBF4DB-07EC-42D1-ACA7-56B5038F5AC5 -sys_job -sys_job -1524449375 -Administrator -1538297732 -admin -定时任务调度表 - - - -1658CED4-3885-4094-AB70-F35408EBCD5E -job_id -job_id -1524449375 -Administrator -1524449375 -Administrator -任务ID -int(11) -11 -1 -1 - - -731E7147-E3A4-4D93-8C7C-BB1C6D94DB9E -job_name -job_name -1524449375 -Administrator -1524449375 -Administrator -任务名称 -'' -varchar(64) -64 -1 - - -C64B3655-C240-44F0-83B4-F42FB76C8BEA -job_group -job_group -1524449375 -Administrator -1524449375 -Administrator -任务组名 -'' -varchar(64) -64 -1 - - -9F7E735D-B823-4ADA-BA3D-8FFFFEC92F5C -method_name -method_name -1524449375 -Administrator -1524449375 -Administrator -任务方法 -'' -varchar(500) -500 - - -28EEE4F4-E8E7-4052-8F10-88D6C74C595D -method_params -method_params -1524449375 -Administrator -1538297298 -admin -方法参数 -'' -varchar(200) -200 - - -C8986FAD-E2E7-4364-9E8B-B75366B9A4ED -cron_expression -cron_expression -1524449375 -Administrator -1524449375 -Administrator -cron执行表达式 -'' -varchar(255) -255 - - -FD188167-AC02-4161-BE89-D63E61412313 -misfire_policy -misfire_policy -1538297273 -admin -1538297298 -admin -varchar(20) -20 - - -2D4B6C8F-EEE8-4474-9D20-8206A7E80362 -status -status -1524449375 -Administrator -1524449375 -Administrator -状态(0正常 1暂停) -0 -int(1) -1 - - -CA78AC7F-19E7-47BC-BF7B-9F31EFB02702 -create_by -create_by -1524449375 -Administrator -1524449375 -Administrator -创建者 -'' -varchar(64) -64 - - -B8F807AE-9F19-4FCA-BA98-7BF71DD0CA02 -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - -3FBB42FA-ED0F-4D7C-99D0-5F7AF7B0F1DD -update_by -update_by -1524449375 -Administrator -1524449375 -Administrator -更新者 -'' -varchar(64) -64 - - -1C5863D2-A8B9-43DB-AA06-F8BE3E01093B -update_time -update_time -1524449375 -Administrator -1524449375 -Administrator -更新时间 -timestamp - - -889C3FF9-BB1E-4EB1-AFE9-1D1155984915 -remark -remark -1524449375 -Administrator -1524449375 -Administrator -备注信息 -'' -varchar(500) -500 - - - - -38106F1A-4FFB-4EC0-B979-55BD6C6C6FF7 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - - - -CF7C8958-5494-48C6-BE05-83F2CF8C7513 -sys_job_log -sys_job_log -1524449375 -Administrator -1538297742 -admin -定时任务调度日志表 - - - -308F32A1-A8EC-4002-9993-DF9234A303B7 -job_log_id -job_log_id -1524449375 -Administrator -1524449375 -Administrator -任务日志ID -int(11) -11 -1 -1 - - -F4D55B65-BB6B-4182-A6D6-F9CAABC19110 -job_name -job_name -1524449375 -Administrator -1524449375 -Administrator -任务名称 -varchar(64) -64 -1 - - -8AF383A0-01C0-4947-8384-FF0F13AC00AE -job_group -job_group -1524449375 -Administrator -1524449375 -Administrator -任务组名 -varchar(64) -64 -1 - - -96582B76-F1E9-4473-BA51-01B87B5F459E -method_name -method_name -1524449375 -Administrator -1524449375 -Administrator -任务方法 -varchar(500) -500 - - -2AB02ABA-02E3-4F72-95BA-4261A7F5729A -method_params -method_params -1524449375 -Administrator -1538297325 -admin -方法参数 -'' -varchar(200) -200 - - -8EB39444-CBFF-43AA-AA37-49217EF545B6 -job_message -job_message -1524449375 -Administrator -1524449375 -Administrator -日志信息 -varchar(500) -500 - - -18CD263C-0F57-4EDF-999E-1B5A7EE2BFF9 -is_exception -is_exception -1524449375 -Administrator -1538297325 -admin -是否异常 -0 -char(1) -1 - - -634ECD78-2251-43EB-B6CF-DF7FA9DA4354 -exception_info -exception_info -1524449375 -Administrator -1524449375 -Administrator -异常信息 -text - - -4EC075CC-507B-43D7-860F-34DAAEB1DBBF -create_time -create_time -1524449375 -Administrator -1524449375 -Administrator -创建时间 -timestamp - - - - -A87DCE10-894A-4CF7-B39C-AF18202C7F86 -Key_1 -Key_1 -1524449375 -Administrator -1524449375 -Administrator - - - - - - - - - - -FD6284E8-B6D4-43AF-A038-9C97DCD403DC -sys_role_dept -sys_role_dept -1538296083 -admin -1538297689 -admin -角色和部门关联表 - - - -2BC66204-4193-42E6-BB7B-7AD57C9E5BEF -role_id -role_id -1538296083 -admin -1538296150 -admin -用户ID -int(11) -11 -1 - - -A32BC025-6437-41AB-BAA4-3A150E406781 -dept_id -dept_id -1538296083 -admin -1538296150 -admin -岗位ID -int(11) -11 -1 - - - - -315FFED5-B0A0-4649-8255-2283896340C9 -Key_1 -Key_1 -1538296083 -admin -1538296083 -admin - - - - - - - - - - - -45EB995C-F5F6-4818-AEB1-2038DEBA9CEE -sys_config -sys_config -1538296587 -admin -1538297714 -admin -参数配置表 - - - -667C4616-146B-475C-8111-4720375D762C -config_id -config_id -1538296587 -admin -1538296691 -admin -字典编码 -int(5) -5 -1 -1 - - -EA798E0B-0CBE-4897-B0AF-1F2D3CD6DEF4 -config_name -config_name -1538296587 -admin -1538296691 -admin -字典排序 -0 -varchar(100) -100 - - -A9A2A6E0-C914-4516-AE4C-F33CE71B92E8 -config_key -config_key -1538296587 -admin -1538296691 -admin -字典标签 -'' -varchar(100) -100 - - -24CCA897-8671-402E-8229-9ED0C80C176A -config_value -config_value -1538296587 -admin -1538296691 -admin -字典键值 -'' -varchar(100) -100 - - -B4E76B1D-BFAF-42F3-8CCA-8B5A8CC7CBFF -config_type -config_type -1538296587 -admin -1538296691 -admin -字典类型 -'' -char(1) -1 - - -A6AC1891-F5C4-45B3-8CAB-8F4CE8B8BF08 -create_by -create_by -1538296587 -admin -1538296587 -admin -创建者 -'' -varchar(64) -64 - - -CC1E0367-A079-49A0-8F0A-FE5F7B3EB6EA -create_time -create_time -1538296587 -admin -1538296587 -admin -创建时间 -timestamp - - -081CD54E-AE38-4696-A326-F829B8EA5737 -update_by -update_by -1538296587 -admin -1538296587 -admin -更新者 -'' -varchar(64) -64 - - -E2118ECE-8F52-4FBA-B18A-F30FFB2BDD20 -update_time -update_time -1538296587 -admin -1538296587 -admin -更新时间 -timestamp - - -55A16121-8932-465E-8427-EBDA39B2B900 -remark -remark -1538296587 -admin -1538296587 -admin -备注 -'' -varchar(500) -500 - - - - -0F331278-2804-496A-A87B-B0944C80FB82 -Key_1 -Key_1 -1538296587 -admin -1538296587 -admin - - - - - - - - - - -F33DE1D6-C12D-43DB-A502-83BD1615F081 -sys_notice -sys_notice -1538297386 -admin -1538297746 -admin -通知公告表 - - - -FF4A9744-D7CA-450E-8AD7-B3E7E90075CE -notice_id -notice_id -1538297386 -admin -1538297496 -admin -任务日志ID -int(4) -4 -1 -1 - - -E2B08825-4C94-4209-80B2-21A7AD8CBF2D -notice_title -notice_title -1538297386 -admin -1538297496 -admin -任务名称 -varchar(50) -50 -1 - - -04414862-9ABC-4431-B1B7-B44ECC08CB6E -notice_type -notice_type -1538297386 -admin -1538297496 -admin -任务组名 -char(2) -2 -1 - - -E829DAD1-E3F9-4AED-A3DE-59CE4340333E -notice_content -notice_content -1538297386 -admin -1538297496 -admin -任务方法 -varchar(500) -500 - - -2EABC8DB-6700-4717-89A3-31461C4CB2D5 -status -status -1538297386 -admin -1538297496 -admin -方法参数 -'' -char(1) -1 - - -448D3EB6-DE24-4BE3-9C29-1FC3C71B0E8D -create_by -create_by -1538297386 -admin -1538297496 -admin -日志信息 -varchar(64) -64 - - -770ED87D-D4D7-499C-A266-7A54051B1A84 -create_time1 -create_time1 -1538297386 -admin -1538297496 -admin -是否异常 -0 -datetime - - -12DDF399-7CCB-4117-8B05-6AA9BEE845E5 -update_by -update_by -1538297386 -admin -1538297496 -admin -异常信息 -varchar(64) -64 - - -FE101CE4-9B66-4097-944D-36B01A9E2219 -update_time1 -update_time1 -1538297400 -admin -1538297496 -admin -datetime - - -D5F1728C-01D0-4C00-9AD6-AAA14228104B -remark -remark -1538297386 -admin -1538297496 -admin -创建时间 -varchar(255) -255 - - - - -43C7AC1D-CE7A-4B55-A474-8CB2376D446F -Key_1 -Key_1 -1538297386 -admin -1538297386 -admin - - - - - - - - - - - - -F2EBEA5B-F352-45CB-B349-39158064CEE8 -PUBLIC -PUBLIC -1524449325 -Administrator -1524449325 -Administrator - - - - -41740AEF-D7FB-4738-ABDF-47C3287A6AF6 -MySQL 5.0 -MYSQL50 -1524449337 -Administrator -1538295558 -admin -file:///%_DBMS%/mysql50.xdb -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B - - - - - - - - - - \ No newline at end of file diff --git a/sql/ry_20240112.sql b/sql/ry_20231130.sql similarity index 62% rename from sql/ry_20240112.sql rename to sql/ry_20231130.sql index eab64b0b9..452c2fcf1 100644 --- a/sql/ry_20240112.sql +++ b/sql/ry_20231130.sql @@ -42,20 +42,18 @@ drop table if exists sys_user; create table sys_user ( user_id bigint(20) not null auto_increment comment '用户ID', dept_id bigint(20) default null comment '部门ID', - login_name varchar(30) not null comment '登录账号', - user_name varchar(30) default '' comment '用户昵称', - user_type varchar(2) default '00' comment '用户类型(00系统用户 01注册用户)', + user_name varchar(30) not null comment '用户账号', + nick_name varchar(30) not null comment '用户昵称', + user_type varchar(2) default '00' comment '用户类型(00系统用户)', email varchar(50) default '' comment '用户邮箱', phonenumber varchar(11) default '' comment '手机号码', sex char(1) default '0' comment '用户性别(0男 1女 2未知)', - avatar varchar(100) default '' comment '头像路径', - password varchar(50) default '' comment '密码', - salt varchar(20) default '' comment '盐加密', + avatar varchar(100) default '' comment '头像地址', + password varchar(100) default '' comment '密码', status char(1) default '0' comment '帐号状态(0正常 1停用)', del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', login_ip varchar(128) default '' comment '最后登录IP', login_date datetime comment '最后登录时间', - pwd_update_date datetime comment '密码最后更新时间', create_by varchar(64) default '' comment '创建者', create_time datetime comment '创建时间', update_by varchar(64) default '' comment '更新者', @@ -67,8 +65,8 @@ create table sys_user ( -- ---------------------------- -- 初始化-用户信息表数据 -- ---------------------------- -insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '29c67a30398638269fe600f73a054934', '111111', '0', '0', '127.0.0.1', null, null, 'admin', sysdate(), '', null, '管理员'); -insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '8e6d98b90472783cc73c17047ddccf36', '222222', '0', '0', '127.0.0.1', null, null, 'admin', sysdate(), '', null, '测试员'); +insert into sys_user values(1, 103, 'admin', '若依', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '管理员'); +insert into sys_user values(2, 105, 'ry', '若依', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null, '测试员'); -- ---------------------------- @@ -104,26 +102,28 @@ insert into sys_post values(4, 'user', '普通员工', 4, '0', 'admin', sysdate -- ---------------------------- drop table if exists sys_role; create table sys_role ( - role_id bigint(20) not null auto_increment comment '角色ID', - role_name varchar(30) not null comment '角色名称', - role_key varchar(100) not null comment '角色权限字符串', - role_sort int(4) not null comment '显示顺序', - data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', - status char(1) not null comment '角色状态(0正常 1停用)', - del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', + role_id bigint(20) not null auto_increment comment '角色ID', + role_name varchar(30) not null comment '角色名称', + role_key varchar(100) not null comment '角色权限字符串', + role_sort int(4) not null comment '显示顺序', + data_scope char(1) default '1' comment '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)', + menu_check_strictly tinyint(1) default 1 comment '菜单树选择项是否关联显示', + dept_check_strictly tinyint(1) default 1 comment '部门树选择项是否关联显示', + status char(1) not null comment '角色状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', primary key (role_id) ) engine=innodb auto_increment=100 comment = '角色信息表'; -- ---------------------------- -- 初始化-角色信息表数据 -- ---------------------------- -insert into sys_role values('1', '超级管理员', 'admin', 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员'); -insert into sys_role values('2', '普通角色', 'common', 2, 2, '0', '0', 'admin', sysdate(), '', null, '普通角色'); +insert into sys_role values('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(), '', null, '超级管理员'); +insert into sys_role values('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色'); -- ---------------------------- @@ -135,11 +135,14 @@ create table sys_menu ( menu_name varchar(50) not null comment '菜单名称', parent_id bigint(20) default 0 comment '父菜单ID', order_num int(4) default 0 comment '显示顺序', - url varchar(200) default '#' comment '请求地址', - target varchar(20) default '' comment '打开方式(menuItem页签 menuBlank新窗口)', + path varchar(200) default '' comment '路由地址', + component varchar(255) default null comment '组件路径', + query varchar(255) default null comment '路由参数', + is_frame int(1) default 1 comment '是否为外链(0是 1否)', + is_cache int(1) default 0 comment '是否缓存(0缓存 1不缓存)', menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', - is_refresh char(1) default 1 comment '是否刷新(0刷新 1不刷新)', + status char(1) default 0 comment '菜单状态(0正常 1停用)', perms varchar(100) default null comment '权限标识', icon varchar(100) default '#' comment '菜单图标', create_by varchar(64) default '' comment '创建者', @@ -154,106 +157,106 @@ create table sys_menu ( -- 初始化-菜单信息表数据 -- ---------------------------- -- 一级菜单 -insert into sys_menu values('1', '系统管理', '0', '1', '#', '', 'M', '0', '1', '', 'fa fa-gear', 'admin', sysdate(), '', null, '系统管理目录'); -insert into sys_menu values('2', '系统监控', '0', '2', '#', '', 'M', '0', '1', '', 'fa fa-video-camera', 'admin', sysdate(), '', null, '系统监控目录'); -insert into sys_menu values('3', '系统工具', '0', '3', '#', '', 'M', '0', '1', '', 'fa fa-bars', 'admin', sysdate(), '', null, '系统工具目录'); -insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', 'menuBlank', 'C', '0', '1', '', 'fa fa-location-arrow', 'admin', sysdate(), '', null, '若依官网地址'); +insert into sys_menu values('1', '系统管理', '0', '1', 'system', null, '', 1, 0, 'M', '0', '0', '', 'system', 'admin', sysdate(), '', null, '系统管理目录'); +insert into sys_menu values('2', '系统监控', '0', '2', 'monitor', null, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', sysdate(), '', null, '系统监控目录'); +insert into sys_menu values('3', '系统工具', '0', '3', 'tool', null, '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', sysdate(), '', null, '系统工具目录'); +insert into sys_menu values('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', sysdate(), '', null, '若依官网地址'); -- 二级菜单 -insert into sys_menu values('100', '用户管理', '1', '1', '/system/user', '', 'C', '0', '1', 'system:user:view', 'fa fa-user-o', 'admin', sysdate(), '', null, '用户管理菜单'); -insert into sys_menu values('101', '角色管理', '1', '2', '/system/role', '', 'C', '0', '1', 'system:role:view', 'fa fa-user-secret', 'admin', sysdate(), '', null, '角色管理菜单'); -insert into sys_menu values('102', '菜单管理', '1', '3', '/system/menu', '', 'C', '0', '1', 'system:menu:view', 'fa fa-th-list', 'admin', sysdate(), '', null, '菜单管理菜单'); -insert into sys_menu values('103', '部门管理', '1', '4', '/system/dept', '', 'C', '0', '1', 'system:dept:view', 'fa fa-outdent', 'admin', sysdate(), '', null, '部门管理菜单'); -insert into sys_menu values('104', '岗位管理', '1', '5', '/system/post', '', 'C', '0', '1', 'system:post:view', 'fa fa-address-card-o', 'admin', sysdate(), '', null, '岗位管理菜单'); -insert into sys_menu values('105', '字典管理', '1', '6', '/system/dict', '', 'C', '0', '1', 'system:dict:view', 'fa fa-bookmark-o', 'admin', sysdate(), '', null, '字典管理菜单'); -insert into sys_menu values('106', '参数设置', '1', '7', '/system/config', '', 'C', '0', '1', 'system:config:view', 'fa fa-sun-o', 'admin', sysdate(), '', null, '参数设置菜单'); -insert into sys_menu values('107', '通知公告', '1', '8', '/system/notice', '', 'C', '0', '1', 'system:notice:view', 'fa fa-bullhorn', 'admin', sysdate(), '', null, '通知公告菜单'); -insert into sys_menu values('108', '日志管理', '1', '9', '#', '', 'M', '0', '1', '', 'fa fa-pencil-square-o', 'admin', sysdate(), '', null, '日志管理菜单'); -insert into sys_menu values('109', '在线用户', '2', '1', '/monitor/online', '', 'C', '0', '1', 'monitor:online:view', 'fa fa-user-circle', 'admin', sysdate(), '', null, '在线用户菜单'); -insert into sys_menu values('110', '定时任务', '2', '2', '/monitor/job', '', 'C', '0', '1', 'monitor:job:view', 'fa fa-tasks', 'admin', sysdate(), '', null, '定时任务菜单'); -insert into sys_menu values('111', '数据监控', '2', '3', '/monitor/data', '', 'C', '0', '1', 'monitor:data:view', 'fa fa-bug', 'admin', sysdate(), '', null, '数据监控菜单'); -insert into sys_menu values('112', '服务监控', '2', '4', '/monitor/server', '', 'C', '0', '1', 'monitor:server:view', 'fa fa-server', 'admin', sysdate(), '', null, '服务监控菜单'); -insert into sys_menu values('113', '缓存监控', '2', '5', '/monitor/cache', '', 'C', '0', '1', 'monitor:cache:view', 'fa fa-cube', 'admin', sysdate(), '', null, '缓存监控菜单'); -insert into sys_menu values('114', '表单构建', '3', '1', '/tool/build', '', 'C', '0', '1', 'tool:build:view', 'fa fa-wpforms', 'admin', sysdate(), '', null, '表单构建菜单'); -insert into sys_menu values('115', '代码生成', '3', '2', '/tool/gen', '', 'C', '0', '1', 'tool:gen:view', 'fa fa-code', 'admin', sysdate(), '', null, '代码生成菜单'); -insert into sys_menu values('116', '系统接口', '3', '3', '/tool/swagger', '', 'C', '0', '1', 'tool:swagger:view', 'fa fa-gg', 'admin', sysdate(), '', null, '系统接口菜单'); +insert into sys_menu values('100', '用户管理', '1', '1', 'user', 'system/user/index', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', sysdate(), '', null, '用户管理菜单'); +insert into sys_menu values('101', '角色管理', '1', '2', 'role', 'system/role/index', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', sysdate(), '', null, '角色管理菜单'); +insert into sys_menu values('102', '菜单管理', '1', '3', 'menu', 'system/menu/index', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', sysdate(), '', null, '菜单管理菜单'); +insert into sys_menu values('103', '部门管理', '1', '4', 'dept', 'system/dept/index', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', sysdate(), '', null, '部门管理菜单'); +insert into sys_menu values('104', '岗位管理', '1', '5', 'post', 'system/post/index', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', sysdate(), '', null, '岗位管理菜单'); +insert into sys_menu values('105', '字典管理', '1', '6', 'dict', 'system/dict/index', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', sysdate(), '', null, '字典管理菜单'); +insert into sys_menu values('106', '参数设置', '1', '7', 'config', 'system/config/index', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', sysdate(), '', null, '参数设置菜单'); +insert into sys_menu values('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', sysdate(), '', null, '通知公告菜单'); +insert into sys_menu values('108', '日志管理', '1', '9', 'log', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', sysdate(), '', null, '日志管理菜单'); +insert into sys_menu values('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', sysdate(), '', null, '在线用户菜单'); +insert into sys_menu values('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', sysdate(), '', null, '定时任务菜单'); +insert into sys_menu values('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', sysdate(), '', null, '数据监控菜单'); +insert into sys_menu values('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); +insert into sys_menu values('113', '缓存监控', '2', '5', 'cache', 'monitor/cache/index', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', sysdate(), '', null, '缓存监控菜单'); +insert into sys_menu values('114', '缓存列表', '2', '6', 'cacheList', 'monitor/cache/list', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', sysdate(), '', null, '缓存列表菜单'); +insert into sys_menu values('115', '表单构建', '3', '1', 'build', 'tool/build/index', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); +insert into sys_menu values('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); +insert into sys_menu values('117', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); -- 三级菜单 -insert into sys_menu values('500', '操作日志', '108', '1', '/monitor/operlog', '', 'C', '0', '1', 'monitor:operlog:view', 'fa fa-address-book', 'admin', sysdate(), '', null, '操作日志菜单'); -insert into sys_menu values('501', '登录日志', '108', '2', '/monitor/logininfor', '', 'C', '0', '1', 'monitor:logininfor:view', 'fa fa-file-image-o', 'admin', sysdate(), '', null, '登录日志菜单'); +insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单'); +insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单'); -- 用户管理按钮 -insert into sys_menu values('1000', '用户查询', '100', '1', '#', '', 'F', '0', '1', 'system:user:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1001', '用户新增', '100', '2', '#', '', 'F', '0', '1', 'system:user:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1002', '用户修改', '100', '3', '#', '', 'F', '0', '1', 'system:user:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1003', '用户删除', '100', '4', '#', '', 'F', '0', '1', 'system:user:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1004', '用户导出', '100', '5', '#', '', 'F', '0', '1', 'system:user:export', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1005', '用户导入', '100', '6', '#', '', 'F', '0', '1', 'system:user:import', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1006', '重置密码', '100', '7', '#', '', 'F', '0', '1', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1000', '用户查询', '100', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1001', '用户新增', '100', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1002', '用户修改', '100', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1003', '用户删除', '100', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1004', '用户导出', '100', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1005', '用户导入', '100', '6', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1006', '重置密码', '100', '7', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', sysdate(), '', null, ''); -- 角色管理按钮 -insert into sys_menu values('1007', '角色查询', '101', '1', '#', '', 'F', '0', '1', 'system:role:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1008', '角色新增', '101', '2', '#', '', 'F', '0', '1', 'system:role:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1009', '角色修改', '101', '3', '#', '', 'F', '0', '1', 'system:role:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1010', '角色删除', '101', '4', '#', '', 'F', '0', '1', 'system:role:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1011', '角色导出', '101', '5', '#', '', 'F', '0', '1', 'system:role:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1007', '角色查询', '101', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1008', '角色新增', '101', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1009', '角色修改', '101', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1010', '角色删除', '101', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1011', '角色导出', '101', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', sysdate(), '', null, ''); -- 菜单管理按钮 -insert into sys_menu values('1012', '菜单查询', '102', '1', '#', '', 'F', '0', '1', 'system:menu:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1013', '菜单新增', '102', '2', '#', '', 'F', '0', '1', 'system:menu:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1014', '菜单修改', '102', '3', '#', '', 'F', '0', '1', 'system:menu:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1015', '菜单删除', '102', '4', '#', '', 'F', '0', '1', 'system:menu:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1012', '菜单查询', '102', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1013', '菜单新增', '102', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1014', '菜单修改', '102', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1015', '菜单删除', '102', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', sysdate(), '', null, ''); -- 部门管理按钮 -insert into sys_menu values('1016', '部门查询', '103', '1', '#', '', 'F', '0', '1', 'system:dept:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1017', '部门新增', '103', '2', '#', '', 'F', '0', '1', 'system:dept:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1018', '部门修改', '103', '3', '#', '', 'F', '0', '1', 'system:dept:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1019', '部门删除', '103', '4', '#', '', 'F', '0', '1', 'system:dept:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1016', '部门查询', '103', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1017', '部门新增', '103', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1018', '部门修改', '103', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1019', '部门删除', '103', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', sysdate(), '', null, ''); -- 岗位管理按钮 -insert into sys_menu values('1020', '岗位查询', '104', '1', '#', '', 'F', '0', '1', 'system:post:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1021', '岗位新增', '104', '2', '#', '', 'F', '0', '1', 'system:post:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1022', '岗位修改', '104', '3', '#', '', 'F', '0', '1', 'system:post:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1023', '岗位删除', '104', '4', '#', '', 'F', '0', '1', 'system:post:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1024', '岗位导出', '104', '5', '#', '', 'F', '0', '1', 'system:post:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1020', '岗位查询', '104', '1', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1021', '岗位新增', '104', '2', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1022', '岗位修改', '104', '3', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1023', '岗位删除', '104', '4', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1024', '岗位导出', '104', '5', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', sysdate(), '', null, ''); -- 字典管理按钮 -insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', 'F', '0', '1', 'system:dict:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', 'F', '0', '1', 'system:dict:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', 'F', '0', '1', 'system:dict:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', 'F', '0', '1', 'system:dict:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', 'F', '0', '1', 'system:dict:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1025', '字典查询', '105', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1026', '字典新增', '105', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1027', '字典修改', '105', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1028', '字典删除', '105', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1029', '字典导出', '105', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', sysdate(), '', null, ''); -- 参数设置按钮 -insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', 'F', '0', '1', 'system:config:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', 'F', '0', '1', 'system:config:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', 'F', '0', '1', 'system:config:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', 'F', '0', '1', 'system:config:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', 'F', '0', '1', 'system:config:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1030', '参数查询', '106', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1031', '参数新增', '106', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1032', '参数修改', '106', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1033', '参数删除', '106', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1034', '参数导出', '106', '5', '#', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', sysdate(), '', null, ''); -- 通知公告按钮 -insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', 'F', '0', '1', 'system:notice:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', 'F', '0', '1', 'system:notice:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', 'F', '0', '1', 'system:notice:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', 'F', '0', '1', 'system:notice:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1035', '公告查询', '107', '1', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1036', '公告新增', '107', '2', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1037', '公告修改', '107', '3', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1038', '公告删除', '107', '4', '#', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', sysdate(), '', null, ''); -- 操作日志按钮 -insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', 'F', '0', '1', 'monitor:operlog:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', 'F', '0', '1', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1041', '详细信息', '500', '3', '#', '', 'F', '0', '1', 'monitor:operlog:detail', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1042', '日志导出', '500', '4', '#', '', 'F', '0', '1', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1039', '操作查询', '500', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1040', '操作删除', '500', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1041', '日志导出', '500', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', sysdate(), '', null, ''); -- 登录日志按钮 -insert into sys_menu values('1043', '登录查询', '501', '1', '#', '', 'F', '0', '1', 'monitor:logininfor:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1044', '登录删除', '501', '2', '#', '', 'F', '0', '1', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1045', '日志导出', '501', '3', '#', '', 'F', '0', '1', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1046', '账户解锁', '501', '4', '#', '', 'F', '0', '1', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1042', '登录查询', '501', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1043', '登录删除', '501', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1044', '日志导出', '501', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1045', '账户解锁', '501', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', sysdate(), '', null, ''); -- 在线用户按钮 -insert into sys_menu values('1047', '在线查询', '109', '1', '#', '', 'F', '0', '1', 'monitor:online:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1048', '批量强退', '109', '2', '#', '', 'F', '0', '1', 'monitor:online:batchForceLogout', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1049', '单条强退', '109', '3', '#', '', 'F', '0', '1', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1046', '在线查询', '109', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1047', '批量强退', '109', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', sysdate(), '', null, ''); -- 定时任务按钮 -insert into sys_menu values('1050', '任务查询', '110', '1', '#', '', 'F', '0', '1', 'monitor:job:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1051', '任务新增', '110', '2', '#', '', 'F', '0', '1', 'monitor:job:add', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1052', '任务修改', '110', '3', '#', '', 'F', '0', '1', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1053', '任务删除', '110', '4', '#', '', 'F', '0', '1', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1054', '状态修改', '110', '5', '#', '', 'F', '0', '1', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1055', '任务详细', '110', '6', '#', '', 'F', '0', '1', 'monitor:job:detail', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1056', '任务导出', '110', '7', '#', '', 'F', '0', '1', 'monitor:job:export', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1049', '任务查询', '110', '1', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1050', '任务新增', '110', '2', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1051', '任务修改', '110', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1052', '任务删除', '110', '4', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1053', '状态修改', '110', '5', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1054', '任务导出', '110', '6', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', sysdate(), '', null, ''); -- 代码生成按钮 -insert into sys_menu values('1057', '生成查询', '115', '1', '#', '', 'F', '0', '1', 'tool:gen:list', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1058', '生成修改', '115', '2', '#', '', 'F', '0', '1', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1059', '生成删除', '115', '3', '#', '', 'F', '0', '1', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1060', '预览代码', '115', '4', '#', '', 'F', '0', '1', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, ''); -insert into sys_menu values('1061', '生成代码', '115', '5', '#', '', 'F', '0', '1', 'tool:gen:code', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1055', '生成查询', '116', '1', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1056', '生成修改', '116', '2', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1057', '生成删除', '116', '3', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1058', '导入代码', '116', '4', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1059', '预览代码', '116', '5', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', sysdate(), '', null, ''); +insert into sys_menu values('1060', '生成代码', '116', '6', '#', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', sysdate(), '', null, ''); -- ---------------------------- @@ -307,6 +310,7 @@ insert into sys_role_menu values ('2', '113'); insert into sys_role_menu values ('2', '114'); insert into sys_role_menu values ('2', '115'); insert into sys_role_menu values ('2', '116'); +insert into sys_role_menu values ('2', '117'); insert into sys_role_menu values ('2', '500'); insert into sys_role_menu values ('2', '501'); insert into sys_role_menu values ('2', '1000'); @@ -370,7 +374,6 @@ insert into sys_role_menu values ('2', '1057'); insert into sys_role_menu values ('2', '1058'); insert into sys_role_menu values ('2', '1059'); insert into sys_role_menu values ('2', '1060'); -insert into sys_role_menu values ('2', '1061'); -- ---------------------------- -- 8、角色和部门关联表 角色1-N部门 @@ -389,6 +392,7 @@ insert into sys_role_dept values ('2', '100'); insert into sys_role_dept values ('2', '101'); insert into sys_role_dept values ('2', '105'); + -- ---------------------------- -- 9、用户与岗位关联表 用户1-N岗位 -- ---------------------------- @@ -539,17 +543,12 @@ create table sys_config ( primary key (config_id) ) engine=innodb auto_increment=100 comment = '参数配置表'; -insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'); -insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456'); -insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深黑主题theme-dark,浅色主题theme-light,深蓝主题theme-blue'); -insert into sys_config values(4, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)'); -insert into sys_config values(5, '用户管理-密码字符范围', 'sys.account.chrtype', '0', 'Y', 'admin', sysdate(), '', null, '默认任意字符范围,0任意(密码可以输入任意字符),1数字(密码只能为0-9数字),2英文字母(密码只能为a-z和A-Z字母),3字母和数字(密码必须包含字母,数字),4字母数字和特殊字符(目前支持的特殊字符包括:~!@#$%^&*()-=_+)'); -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.index.menuStyle', 'default', 'Y', 'admin', sysdate(), '', null, '菜单导航显示风格(default为左侧导航菜单,topnav为顶部导航菜单)'); -insert into sys_config values(9, '主框架页-是否开启页脚', 'sys.index.footer', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启底部页脚显示(true显示,false隐藏)'); -insert into sys_config values(10, '主框架页-是否开启页签', 'sys.index.tagsView', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启菜单多页签显示(true显示,false隐藏)'); -insert into sys_config values(11, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)'); +insert into sys_config values(1, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow' ); +insert into sys_config values(2, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, '初始化密码 123456' ); +insert into sys_config values(3, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, '深色主题theme-dark,浅色主题theme-light' ); +insert into sys_config values(4, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'true', 'Y', 'admin', sysdate(), '', null, '是否开启验证码功能(true开启,false关闭)'); +insert into sys_config values(5, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, '是否开启注册用户功能(true开启,false关闭)'); +insert into sys_config values(6, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置登录IP黑名单限制,多个匹配项以;分隔,支持匹配(*通配、网段)'); -- ---------------------------- @@ -558,7 +557,7 @@ insert into sys_config values(11, '用户登录-黑名单列表', 'sys drop table if exists sys_logininfor; create table sys_logininfor ( info_id bigint(20) not null auto_increment comment '访问ID', - login_name varchar(50) default '' comment '登录账号', + user_name varchar(50) default '' comment '用户账号', ipaddr varchar(128) default '' comment '登录IP地址', login_location varchar(255) default '' comment '登录地点', browser varchar(50) default '' comment '浏览器类型', @@ -573,27 +572,7 @@ create table sys_logininfor ( -- ---------------------------- --- 15、在线用户记录 --- ---------------------------- -drop table if exists sys_user_online; -create table sys_user_online ( - sessionId varchar(50) default '' comment '用户会话id', - login_name varchar(50) default '' comment '登录账号', - dept_name varchar(50) default '' comment '部门名称', - ipaddr varchar(128) default '' comment '登录IP地址', - login_location varchar(255) default '' comment '登录地点', - browser varchar(50) default '' comment '浏览器类型', - os varchar(50) default '' comment '操作系统', - status varchar(10) default '' comment '在线状态on_line在线off_line离线', - start_timestamp datetime comment 'session创建时间', - last_access_time datetime comment 'session最后访问时间', - expire_time int(5) default 0 comment '超时时间,单位为分钟', - primary key (sessionId) -) engine=innodb comment = '在线用户记录'; - - --- ---------------------------- --- 16、定时任务调度表 +-- 15、定时任务调度表 -- ---------------------------- drop table if exists sys_job; create table sys_job ( @@ -619,7 +598,7 @@ insert into sys_job values(3, '系统默认(多参)', 'DEFAULT', 'ryTask.ryM -- ---------------------------- --- 17、定时任务调度日志表 +-- 16、定时任务调度日志表 -- ---------------------------- drop table if exists sys_job_log; create table sys_job_log ( @@ -636,7 +615,7 @@ create table sys_job_log ( -- ---------------------------- --- 18、通知公告表 +-- 17、通知公告表 -- ---------------------------- drop table if exists sys_notice; create table sys_notice ( @@ -658,40 +637,40 @@ create table sys_notice ( -- ---------------------------- insert into sys_notice values('1', '温馨提醒:2018-07-01 若依新版本发布啦', '2', '新版本内容', '0', 'admin', sysdate(), '', null, '管理员'); insert into sys_notice values('2', '维护通知:2018-07-01 若依系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员'); -insert into sys_notice values('3', '若依开源框架介绍', '1', '

    项目介绍

    RuoYi开源项目是为企业用户定制的后台脚手架框架,为企业打造的一站式解决方案,降低企业开发成本,提升开发效率。主要包括用户管理、角色管理、部门管理、菜单管理、参数管理、字典管理、岗位管理、定时任务服务监控、登录日志、操作日志、代码生成等功能。其中,还支持多数据源、数据权限、国际化、Redis缓存、Docker部署、滑动验证码、第三方认证登录、分布式事务、分布式文件存储、分库分表处理等技术特点。


    官网及演示

    若依官网地址: http://ruoyi.vip

    若依文档地址: http://doc.ruoyi.vip

    演示地址【不分离版】: http://demo.ruoyi.vip

    演示地址【分离版本】: http://vue.ruoyi.vip

    演示地址【微服务版】: http://cloud.ruoyi.vip

    演示地址【移动端版】: http://h5.ruoyi.vip


    ', '0', 'admin', sysdate(), '', null, '管理员'); -- ---------------------------- --- 19、代码生成业务表 +-- 18、代码生成业务表 -- ---------------------------- drop table if exists gen_table; create table gen_table ( - table_id bigint(20) not null auto_increment comment '编号', - table_name varchar(200) default '' comment '表名称', - table_comment varchar(500) default '' comment '表描述', - sub_table_name varchar(64) default null comment '关联子表的表名', - sub_table_fk_name varchar(64) default null comment '子表关联的外键名', - class_name varchar(100) default '' comment '实体类名称', - tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作 sub主子表操作)', - package_name varchar(100) comment '生成包路径', - module_name varchar(30) comment '生成模块名', - business_name varchar(30) comment '生成业务名', - function_name varchar(50) comment '生成功能名', - function_author varchar(50) comment '生成功能作者', - gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)', - gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)', - options varchar(1000) comment '其它生成选项', - create_by varchar(64) default '' comment '创建者', - create_time datetime comment '创建时间', - update_by varchar(64) default '' comment '更新者', - update_time datetime comment '更新时间', - remark varchar(500) default null comment '备注', + table_id bigint(20) not null auto_increment comment '编号', + table_name varchar(200) default '' comment '表名称', + table_comment varchar(500) default '' comment '表描述', + sub_table_name varchar(64) default null comment '关联子表的表名', + sub_table_fk_name varchar(64) default null comment '子表关联的外键名', + class_name varchar(100) default '' comment '实体类名称', + tpl_category varchar(200) default 'crud' comment '使用的模板(crud单表操作 tree树表操作)', + tpl_web_type varchar(30) default '' comment '前端模板类型(element-ui模版 element-plus模版)', + package_name varchar(100) comment '生成包路径', + module_name varchar(30) comment '生成模块名', + business_name varchar(30) comment '生成业务名', + function_name varchar(50) comment '生成功能名', + function_author varchar(50) comment '生成功能作者', + gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)', + gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)', + options varchar(1000) comment '其它生成选项', + create_by varchar(64) default '' comment '创建者', + create_time datetime comment '创建时间', + update_by varchar(64) default '' comment '更新者', + update_time datetime comment '更新时间', + remark varchar(500) default null comment '备注', primary key (table_id) ) engine=innodb auto_increment=1 comment = '代码生成业务表'; -- ---------------------------- --- 20、代码生成业务表字段 +-- 19、代码生成业务表字段 -- ---------------------------- drop table if exists gen_table_column; create table gen_table_column (