Merge pull request !31 from Bo/bo_dev
This commit is contained in:
Bo 2021-08-18 02:31:47 +00:00 committed by Gitee
commit 8196b445ec
483 changed files with 108968 additions and 109049 deletions

3
.gitignore vendored
View File

@ -41,4 +41,5 @@ nbdist/
!*/build/*.java !*/build/*.java
!*/build/*.html !*/build/*.html
!*/build/*.xml !*/build/*.xml
/ruoyi-admin/src/main/resources/application-druid.yml
application-druid.yml

38
LICENSE
View File

@ -1,20 +1,20 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2018 RuoYi Copyright (c) 2018 RuoYi
Permission is hereby granted, free of charge, to any person obtaining a copy of 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 this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 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, the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 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 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 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. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

180
README.md
View File

@ -1,91 +1,91 @@
## 平台简介 ## 平台简介
一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序如网站管理后台网站会员中心CMSCRMOA。所有前端后台代码封装过后十分精简易上手出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。 一直想做一款后台管理系统看了很多优秀的开源项目但是发现没有合适的。于是利用空闲休息时间开始自己写了一套后台系统。如此有了若依。她可以用于所有的Web应用程序如网站管理后台网站会员中心CMSCRMOA。所有前端后台代码封装过后十分精简易上手出错概率低。同时支持移动客户端访问。系统会陆续更新一些实用功能。
性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依) 性别男,若依是给女儿取的名字(寓意:你若不离不弃,我必生死相依)
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。 若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前后端分离版本,请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) * 前后端分离版本,请移步[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 框架。 * 感谢 [hplus](https://gitee.com/hplus_admin/hplus) 后台主题 UI 框架。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   * 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  
## 内置功能 ## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。 1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。 2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。 3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。 4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。 5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。 6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。 7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。 8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。 9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。 10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。 11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。 12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。 13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。 14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。 15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存查询,删除、清空等操作。 16. 缓存监控:对系统的缓存查询,删除、清空等操作。
17. 在线构建器拖动表单元素生成相应的HTML代码。 17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。 18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验 ## 在线体验
- admin/admin123 - admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 - 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://ruoyi.vip 演示地址http://ruoyi.vip
文档地址http://doc.ruoyi.vip 文档地址http://doc.ruoyi.vip
## 演示图 ## 演示图
<table> <table>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-42e518aa72a24d228427a1261cb3679f395.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-42e518aa72a24d228427a1261cb3679f395.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-7f20dd0edba25e5187c5c4dd3ec7d3d9797.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-7f20dd0edba25e5187c5c4dd3ec7d3d9797.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-2dae3d87f6a8ca05057db059cd9a411d51d.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-2dae3d87f6a8ca05057db059cd9a411d51d.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-ea4d98423471e55fba784694e45d12bd4bb.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-ea4d98423471e55fba784694e45d12bd4bb.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-7f6c6e9f5873efca09bd2870ee8468b8fce.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-7f6c6e9f5873efca09bd2870ee8468b8fce.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c708b65f2c382a03f69fe1efa8d341e6cff.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-c708b65f2c382a03f69fe1efa8d341e6cff.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-9ab586c47dd5c7b92bca0d727962c90e3b8.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-9ab586c47dd5c7b92bca0d727962c90e3b8.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-ef954122a2080e02013112db21754b955c6.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-ef954122a2080e02013112db21754b955c6.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-088edb4d531e122415a1e2342bccb1a9691.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-088edb4d531e122415a1e2342bccb1a9691.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-f886fe19bd820c0efae82f680223cac196c.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-f886fe19bd820c0efae82f680223cac196c.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-c7a2eb71fa65d6e660294b4bccca613d638.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-c7a2eb71fa65d6e660294b4bccca613d638.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-e60137fb0787defe613bd83331dc4755a70.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-e60137fb0787defe613bd83331dc4755a70.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-7c51c1b5758f0a0f92ed3c60469b7526f9f.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-7c51c1b5758f0a0f92ed3c60469b7526f9f.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-15181aed45bb2461aa97b594cbf2f86ea5f.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-15181aed45bb2461aa97b594cbf2f86ea5f.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-83326ad52ea63f67233d126226738054d98.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-83326ad52ea63f67233d126226738054d98.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-3bd6d31e913b70df00107db51d64ef81df7.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-3bd6d31e913b70df00107db51d64ef81df7.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-70a2225836bc82042a6785edf6299e2586a.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-70a2225836bc82042a6785edf6299e2586a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-0184d6ab01fdc6667a14327fcaf8b46345d.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-0184d6ab01fdc6667a14327fcaf8b46345d.png"/></td>
</tr> </tr>
<tr> <tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-64d8086dc2c02c8f71170290482f7640098.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-64d8086dc2c02c8f71170290482f7640098.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td> <td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr> </tr>
</table> </table>
## 若依交流群 ## 若依交流群
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群 [![加入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)

View File

@ -158,7 +158,10 @@
</configuration> </configuration>
</plugin> --> </plugin> -->
</plugins> </plugins>
<!--
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
-->
<finalName>it_war</finalName>
</build> </build>
</project> </project>

View File

@ -1,30 +1,30 @@
package com.ruoyi; package com.ruoyi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/** /**
* 启动程序 * 启动程序
* *
* @author ruoyi * @author ruoyi
*/ */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication public class RuoYiApplication
{ {
public static void main(String[] args) public static void main(String[] args)
{ {
// System.setProperty("spring.devtools.restart.enabled", "false"); // System.setProperty("spring.devtools.restart.enabled", "false");
SpringApplication.run(RuoYiApplication.class, args); SpringApplication.run(RuoYiApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 若依启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" + " | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" + " | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" + " |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" + " | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" + " | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" + " | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" + " | | \\ / \\ / \n" +
" ''-' `'-' `-..-' "); " ''-' `'-' `-..-' ");
} }
} }

View File

@ -1,18 +1,18 @@
package com.ruoyi; package com.ruoyi;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/** /**
* web容器中进行部署 * web容器中进行部署
* *
* @author ruoyi * @author ruoyi
*/ */
public class RuoYiServletInitializer extends SpringBootServletInitializer public class RuoYiServletInitializer extends SpringBootServletInitializer
{ {
@Override @Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
{ {
return application.sources(RuoYiApplication.class); return application.sources(RuoYiApplication.class);
} }
} }

View File

@ -1,156 +1,156 @@
package com.ruoyi.web.controller.common; package com.ruoyi.web.controller.common;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.config.ServerConfig; import com.ruoyi.common.config.ServerConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.file.FileUtils;
/** /**
* 通用请求处理 * 通用请求处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
public class CommonController public class CommonController
{ {
private static final Logger log = LoggerFactory.getLogger(CommonController.class); private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Autowired @Autowired
private ServerConfig serverConfig; private ServerConfig serverConfig;
private static final String FILE_DELIMETER = ","; private static final String FILE_DELIMETER = ",";
/** /**
* 通用下载请求 * 通用下载请求
* *
* @param fileName 文件名称 * @param fileName 文件名称
* @param delete 是否删除 * @param delete 是否删除
*/ */
@GetMapping("common/download") @GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{ {
try try
{ {
if (!FileUtils.checkAllowDownload(fileName)) if (!FileUtils.checkAllowDownload(fileName))
{ {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
} }
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = RuoYiConfig.getDownloadPath() + fileName; String filePath = RuoYiConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName); FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream()); FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) if (delete)
{ {
FileUtils.deleteFile(filePath); FileUtils.deleteFile(filePath);
} }
} }
catch (Exception e) catch (Exception e)
{ {
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
/** /**
* 通用上传请求单个 * 通用上传请求单个
*/ */
@PostMapping("/common/upload") @PostMapping("/common/upload")
@ResponseBody @ResponseBody
public AjaxResult uploadFile(MultipartFile file) throws Exception public AjaxResult uploadFile(MultipartFile file) throws Exception
{ {
try try
{ {
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
// 上传并返回新文件名称 // 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("fileName", fileName); ajax.put("fileName", fileName);
ajax.put("url", url); ajax.put("url", url);
return ajax; return ajax;
} }
catch (Exception e) catch (Exception e)
{ {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
/** /**
* 通用上传请求多个 * 通用上传请求多个
*/ */
@PostMapping("/common/uploads") @PostMapping("/common/uploads")
@ResponseBody @ResponseBody
public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception public AjaxResult uploadFiles(List<MultipartFile> files) throws Exception
{ {
try try
{ {
// 上传文件路径 // 上传文件路径
String filePath = RuoYiConfig.getUploadPath(); String filePath = RuoYiConfig.getUploadPath();
List<String> fileNames = new ArrayList<String>(); List<String> fileNames = new ArrayList<String>();
List<String> urls = new ArrayList<String>(); List<String> urls = new ArrayList<String>();
for (MultipartFile file : files) for (MultipartFile file : files)
{ {
// 上传并返回新文件名称 // 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file); String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName; String url = serverConfig.getUrl() + fileName;
fileNames.add(fileName); fileNames.add(fileName);
urls.add(url); urls.add(url);
} }
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER)); ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER)); ajax.put("urls", StringUtils.join(urls, FILE_DELIMETER));
return ajax; return ajax;
} }
catch (Exception e) catch (Exception e)
{ {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());
} }
} }
/** /**
* 本地资源通用下载 * 本地资源通用下载
*/ */
@GetMapping("/common/download/resource") @GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response) public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception throws Exception
{ {
try try
{ {
if (!FileUtils.checkAllowDownload(resource)) if (!FileUtils.checkAllowDownload(resource))
{ {
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource)); throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
} }
// 本地资源路径 // 本地资源路径
String localPath = RuoYiConfig.getProfile(); String localPath = RuoYiConfig.getProfile();
// 数据库资源地址 // 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX); String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称 // 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/"); String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE); response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName); FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream()); FileUtils.writeBytes(downloadPath, response.getOutputStream());
} }
catch (Exception e) catch (Exception e)
{ {
log.error("下载文件失败", e); log.error("下载文件失败", e);
} }
} }
} }

View File

@ -1,80 +1,80 @@
package com.ruoyi.web.controller.demo.controller; package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* 模态窗口 * 模态窗口
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/demo/modal") @RequestMapping("/demo/modal")
public class DemoDialogController public class DemoDialogController
{ {
private String prefix = "demo/modal"; private String prefix = "demo/modal";
/** /**
* 模态窗口 * 模态窗口
*/ */
@GetMapping("/dialog") @GetMapping("/dialog")
public String dialog() public String dialog()
{ {
return prefix + "/dialog"; return prefix + "/dialog";
} }
/** /**
* 弹层组件 * 弹层组件
*/ */
@GetMapping("/layer") @GetMapping("/layer")
public String layer() public String layer()
{ {
return prefix + "/layer"; return prefix + "/layer";
} }
/** /**
* 表单 * 表单
*/ */
@GetMapping("/form") @GetMapping("/form")
public String form() public String form()
{ {
return prefix + "/form"; return prefix + "/form";
} }
/** /**
* 表格 * 表格
*/ */
@GetMapping("/table") @GetMapping("/table")
public String table() public String table()
{ {
return prefix + "/table"; return prefix + "/table";
} }
/** /**
* 表格check * 表格check
*/ */
@GetMapping("/check") @GetMapping("/check")
public String check() public String check()
{ {
return prefix + "/table/check"; return prefix + "/table/check";
} }
/** /**
* 表格radio * 表格radio
*/ */
@GetMapping("/radio") @GetMapping("/radio")
public String radio() public String radio()
{ {
return prefix + "/table/radio"; return prefix + "/table/radio";
} }
/** /**
* 表格回传父窗体 * 表格回传父窗体
*/ */
@GetMapping("/parent") @GetMapping("/parent")
public String parent() public String parent()
{ {
return prefix + "/table/parent"; return prefix + "/table/parent";
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -1,35 +1,35 @@
package com.ruoyi.web.controller.demo.controller; package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* 图标相关 * 图标相关
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/demo/icon") @RequestMapping("/demo/icon")
public class DemoIconController public class DemoIconController
{ {
private String prefix = "demo/icon"; private String prefix = "demo/icon";
/** /**
* FontAwesome图标 * FontAwesome图标
*/ */
@GetMapping("/fontawesome") @GetMapping("/fontawesome")
public String fontAwesome() public String fontAwesome()
{ {
return prefix + "/fontawesome"; return prefix + "/fontawesome";
} }
/** /**
* Glyphicons图标 * Glyphicons图标
*/ */
@GetMapping("/glyphicons") @GetMapping("/glyphicons")
public String glyphicons() public String glyphicons()
{ {
return prefix + "/glyphicons"; return prefix + "/glyphicons";
} }
} }

View File

@ -1,326 +1,326 @@
package com.ruoyi.web.controller.demo.controller; package com.ruoyi.web.controller.demo.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.controller.demo.domain.CustomerModel; import com.ruoyi.web.controller.demo.domain.CustomerModel;
import com.ruoyi.web.controller.demo.domain.UserOperateModel; import com.ruoyi.web.controller.demo.domain.UserOperateModel;
/** /**
* 操作控制 * 操作控制
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/demo/operate") @RequestMapping("/demo/operate")
public class DemoOperateController extends BaseController public class DemoOperateController extends BaseController
{ {
private String prefix = "demo/operate"; private String prefix = "demo/operate";
private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>(); private final static Map<Integer, UserOperateModel> users = new LinkedHashMap<Integer, UserOperateModel>();
{ {
users.put(1, new UserOperateModel(1, "1000001", "测试1", "0", "15888888888", "ry@qq.com", 150.0, "0")); 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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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")); users.put(26, new UserOperateModel(26, "1000026", "测试26", "1", "15666666666", "ry@qq.com", 250.0, "1"));
} }
/** /**
* 表格 * 表格
*/ */
@GetMapping("/table") @GetMapping("/table")
public String table() public String table()
{ {
return prefix + "/table"; return prefix + "/table";
} }
/** /**
* 其他 * 其他
*/ */
@GetMapping("/other") @GetMapping("/other")
public String other() public String other()
{ {
return prefix + "/other"; return prefix + "/other";
} }
/** /**
* 查询数据 * 查询数据
*/ */
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(UserOperateModel userModel) public TableDataInfo list(UserOperateModel userModel)
{ {
TableDataInfo rspData = new TableDataInfo(); TableDataInfo rspData = new TableDataInfo();
List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values()); List<UserOperateModel> userList = new ArrayList<UserOperateModel>(users.values());
// 查询条件过滤 // 查询条件过滤
if (StringUtils.isNotEmpty(userModel.getSearchValue())) if (StringUtils.isNotEmpty(userModel.getSearchValue()))
{ {
userList.clear(); userList.clear();
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{ {
if (entry.getValue().getUserName().equals(userModel.getSearchValue())) if (entry.getValue().getUserName().equals(userModel.getSearchValue()))
{ {
userList.add(entry.getValue()); userList.add(entry.getValue());
} }
} }
} }
else if (StringUtils.isNotEmpty(userModel.getUserName())) else if (StringUtils.isNotEmpty(userModel.getUserName()))
{ {
userList.clear(); userList.clear();
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{ {
if (entry.getValue().getUserName().equals(userModel.getUserName())) if (entry.getValue().getUserName().equals(userModel.getUserName()))
{ {
userList.add(entry.getValue()); userList.add(entry.getValue());
} }
} }
} }
PageDomain pageDomain = TableSupport.buildPageRequest(); PageDomain pageDomain = TableSupport.buildPageRequest();
if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize()) if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
{ {
rspData.setRows(userList); rspData.setRows(userList);
rspData.setTotal(userList.size()); rspData.setTotal(userList.size());
return rspData; return rspData;
} }
Integer pageNum = (pageDomain.getPageNum() - 1) * 10; Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
Integer pageSize = pageDomain.getPageNum() * 10; Integer pageSize = pageDomain.getPageNum() * 10;
if (pageSize > userList.size()) if (pageSize > userList.size())
{ {
pageSize = userList.size(); pageSize = userList.size();
} }
rspData.setRows(userList.subList(pageNum, pageSize)); rspData.setRows(userList.subList(pageNum, pageSize));
rspData.setTotal(userList.size()); rspData.setTotal(userList.size());
return rspData; return rspData;
} }
/** /**
* 新增用户 * 新增用户
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add(ModelMap mmap) public String add(ModelMap mmap)
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存用户 * 新增保存用户
*/ */
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(UserOperateModel user) public AjaxResult addSave(UserOperateModel user)
{ {
Integer userId = users.size() + 1; Integer userId = users.size() + 1;
user.setUserId(userId); user.setUserId(userId);
return AjaxResult.success(users.put(userId, user)); return AjaxResult.success(users.put(userId, user));
} }
/** /**
* 新增保存主子表信息 * 新增保存主子表信息
*/ */
@PostMapping("/customer/add") @PostMapping("/customer/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(CustomerModel customerModel) public AjaxResult addSave(CustomerModel customerModel)
{ {
System.out.println(customerModel.toString()); System.out.println(customerModel.toString());
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 修改用户 * 修改用户
*/ */
@GetMapping("/edit/{userId}") @GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Integer userId, ModelMap mmap) public String edit(@PathVariable("userId") Integer userId, ModelMap mmap)
{ {
mmap.put("user", users.get(userId)); mmap.put("user", users.get(userId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存用户 * 修改保存用户
*/ */
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(UserOperateModel user) public AjaxResult editSave(UserOperateModel user)
{ {
return AjaxResult.success(users.put(user.getUserId(), user)); return AjaxResult.success(users.put(user.getUserId(), user));
} }
/** /**
* 导出 * 导出
*/ */
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(UserOperateModel user) public AjaxResult export(UserOperateModel user)
{ {
List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values()); List<UserOperateModel> list = new ArrayList<UserOperateModel>(users.values());
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
return util.exportExcel(list, "用户数据"); return util.exportExcel(list, "用户数据");
} }
/** /**
* 下载模板 * 下载模板
*/ */
@GetMapping("/importTemplate") @GetMapping("/importTemplate")
@ResponseBody @ResponseBody
public AjaxResult importTemplate() public AjaxResult importTemplate()
{ {
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
return util.importTemplateExcel("用户数据"); return util.importTemplateExcel("用户数据");
} }
/** /**
* 导入数据 * 导入数据
*/ */
@PostMapping("/importData") @PostMapping("/importData")
@ResponseBody @ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{ {
ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class); ExcelUtil<UserOperateModel> util = new ExcelUtil<UserOperateModel>(UserOperateModel.class);
List<UserOperateModel> userList = util.importExcel(file.getInputStream()); List<UserOperateModel> userList = util.importExcel(file.getInputStream());
String message = importUser(userList, updateSupport); String message = importUser(userList, updateSupport);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
/** /**
* 删除用户 * 删除用户
*/ */
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
Integer[] userIds = Convert.toIntArray(ids); Integer[] userIds = Convert.toIntArray(ids);
for (Integer userId : userIds) for (Integer userId : userIds)
{ {
users.remove(userId); users.remove(userId);
} }
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 查看详细 * 查看详细
*/ */
@GetMapping("/detail/{userId}") @GetMapping("/detail/{userId}")
public String detail(@PathVariable("userId") Integer userId, ModelMap mmap) public String detail(@PathVariable("userId") Integer userId, ModelMap mmap)
{ {
mmap.put("user", users.get(userId)); mmap.put("user", users.get(userId));
return prefix + "/detail"; return prefix + "/detail";
} }
@PostMapping("/clean") @PostMapping("/clean")
@ResponseBody @ResponseBody
public AjaxResult clean() public AjaxResult clean()
{ {
users.clear(); users.clear();
return success(); return success();
} }
/** /**
* 导入用户数据 * 导入用户数据
* *
* @param userList 用户数据列表 * @param userList 用户数据列表
* @param isUpdateSupport 是否更新支持如果已存在则进行更新数据 * @param isUpdateSupport 是否更新支持如果已存在则进行更新数据
* @return 结果 * @return 结果
*/ */
public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport) public String importUser(List<UserOperateModel> userList, Boolean isUpdateSupport)
{ {
if (StringUtils.isNull(userList) || userList.size() == 0) if (StringUtils.isNull(userList) || userList.size() == 0)
{ {
throw new ServiceException("导入用户数据不能为空!"); throw new ServiceException("导入用户数据不能为空!");
} }
int successNum = 0; int successNum = 0;
int failureNum = 0; int failureNum = 0;
StringBuilder successMsg = new StringBuilder(); StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder(); StringBuilder failureMsg = new StringBuilder();
for (UserOperateModel user : userList) for (UserOperateModel user : userList)
{ {
try try
{ {
// 验证是否存在这个用户 // 验证是否存在这个用户
boolean userFlag = false; boolean userFlag = false;
for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet()) for (Map.Entry<Integer, UserOperateModel> entry : users.entrySet())
{ {
if (entry.getValue().getUserName().equals(user.getUserName())) if (entry.getValue().getUserName().equals(user.getUserName()))
{ {
userFlag = true; userFlag = true;
break; break;
} }
} }
if (!userFlag) if (!userFlag)
{ {
Integer userId = users.size() + 1; Integer userId = users.size() + 1;
user.setUserId(userId); user.setUserId(userId);
users.put(userId, user); users.put(userId, user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功"); successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 导入成功");
} }
else if (isUpdateSupport) else if (isUpdateSupport)
{ {
users.put(user.getUserId(), user); users.put(user.getUserId(), user);
successNum++; successNum++;
successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功"); successMsg.append("<br/>" + successNum + "、用户 " + user.getUserName() + " 更新成功");
} }
else else
{ {
failureNum++; failureNum++;
failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在"); failureMsg.append("<br/>" + failureNum + "、用户 " + user.getUserName() + " 已存在");
} }
} }
catch (Exception e) catch (Exception e)
{ {
failureNum++; failureNum++;
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:"; String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
failureMsg.append(msg + e.getMessage()); failureMsg.append(msg + e.getMessage());
} }
} }
if (failureNum > 0) if (failureNum > 0)
{ {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString()); throw new ServiceException(failureMsg.toString());
} }
else else
{ {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
} }
return successMsg.toString(); return successMsg.toString();
} }
} }

View File

@ -1,53 +1,53 @@
package com.ruoyi.web.controller.demo.controller; package com.ruoyi.web.controller.demo.controller;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* 报表 * 报表
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/demo/report") @RequestMapping("/demo/report")
public class DemoReportController public class DemoReportController
{ {
private String prefix = "demo/report"; private String prefix = "demo/report";
/** /**
* 百度ECharts * 百度ECharts
*/ */
@GetMapping("/echarts") @GetMapping("/echarts")
public String echarts() public String echarts()
{ {
return prefix + "/echarts"; return prefix + "/echarts";
} }
/** /**
* 图表插件 * 图表插件
*/ */
@GetMapping("/peity") @GetMapping("/peity")
public String peity() public String peity()
{ {
return prefix + "/peity"; return prefix + "/peity";
} }
/** /**
* 线状图插件 * 线状图插件
*/ */
@GetMapping("/sparkline") @GetMapping("/sparkline")
public String sparkline() public String sparkline()
{ {
return prefix + "/sparkline"; return prefix + "/sparkline";
} }
/** /**
* 图表组合 * 图表组合
*/ */
@GetMapping("/metrics") @GetMapping("/metrics")
public String metrics() public String metrics()
{ {
return prefix + "/metrics"; return prefix + "/metrics";
} }
} }

View File

@ -1,116 +1,116 @@
package com.ruoyi.web.controller.demo.domain; package com.ruoyi.web.controller.demo.domain;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* 客户测试信息 * 客户测试信息
* *
* @author ruoyi * @author ruoyi
*/ */
public class CustomerModel public class CustomerModel
{ {
/** /**
* 客户姓名 * 客户姓名
*/ */
private String name; private String name;
/** /**
* 客户手机 * 客户手机
*/ */
private String phonenumber; private String phonenumber;
/** /**
* 客户性别 * 客户性别
*/ */
private String sex; private String sex;
/** /**
* 客户生日 * 客户生日
*/ */
private String birthday; private String birthday;
/** /**
* 客户描述 * 客户描述
*/ */
private String remark; private String remark;
/** /**
* 商品信息 * 商品信息
*/ */
private List<GoodsModel> goods; private List<GoodsModel> goods;
public String getName() public String getName()
{ {
return name; return name;
} }
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
public String getPhonenumber() public String getPhonenumber()
{ {
return phonenumber; return phonenumber;
} }
public void setPhonenumber(String phonenumber) public void setPhonenumber(String phonenumber)
{ {
this.phonenumber = phonenumber; this.phonenumber = phonenumber;
} }
public String getSex() public String getSex()
{ {
return sex; return sex;
} }
public void setSex(String sex) public void setSex(String sex)
{ {
this.sex = sex; this.sex = sex;
} }
public String getBirthday() public String getBirthday()
{ {
return birthday; return birthday;
} }
public void setBirthday(String birthday) public void setBirthday(String birthday)
{ {
this.birthday = birthday; this.birthday = birthday;
} }
public String getRemark() public String getRemark()
{ {
return remark; return remark;
} }
public void setRemark(String remark) public void setRemark(String remark)
{ {
this.remark = remark; this.remark = remark;
} }
public List<GoodsModel> getGoods() public List<GoodsModel> getGoods()
{ {
return goods; return goods;
} }
public void setGoods(List<GoodsModel> goods) public void setGoods(List<GoodsModel> goods)
{ {
this.goods = goods; this.goods = goods;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName()) .append("name", getName())
.append("phonenumber", getPhonenumber()) .append("phonenumber", getPhonenumber())
.append("sex", getSex()) .append("sex", getSex())
.append("birthday", getBirthday()) .append("birthday", getBirthday())
.append("goods", getGoods()) .append("goods", getGoods())
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -1,99 +1,99 @@
package com.ruoyi.web.controller.demo.domain; package com.ruoyi.web.controller.demo.domain;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
/** /**
* 商品测试信息 * 商品测试信息
* *
* @author ruoyi * @author ruoyi
*/ */
public class GoodsModel public class GoodsModel
{ {
/** /**
* 商品名称 * 商品名称
*/ */
private String name; private String name;
/** /**
* 商品重量 * 商品重量
*/ */
private Integer weight; private Integer weight;
/** /**
* 商品价格 * 商品价格
*/ */
private Double price; private Double price;
/** /**
* 商品日期 * 商品日期
*/ */
private Date date; private Date date;
/** /**
* 商品种类 * 商品种类
*/ */
private String type; private String type;
public String getName() public String getName()
{ {
return name; return name;
} }
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
public Integer getWeight() public Integer getWeight()
{ {
return weight; return weight;
} }
public void setWeight(Integer weight) public void setWeight(Integer weight)
{ {
this.weight = weight; this.weight = weight;
} }
public Double getPrice() public Double getPrice()
{ {
return price; return price;
} }
public void setPrice(Double price) public void setPrice(Double price)
{ {
this.price = price; this.price = price;
} }
public Date getDate() public Date getDate()
{ {
return date; return date;
} }
public void setDate(Date date) public void setDate(Date date)
{ {
this.date = date; this.date = date;
} }
public String getType() public String getType()
{ {
return type; return type;
} }
public void setType(String type) public void setType(String type)
{ {
this.type = type; this.type = type;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("name", getName()) .append("name", getName())
.append("weight", getWeight()) .append("weight", getWeight())
.append("price", getPrice()) .append("price", getPrice())
.append("date", getDate()) .append("date", getDate())
.append("type", getType()) .append("type", getType())
.toString(); .toString();
} }
} }

View File

@ -1,149 +1,149 @@
package com.ruoyi.web.controller.demo.domain; package com.ruoyi.web.controller.demo.domain;
import java.util.Date; import java.util.Date;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.Type; import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
public class UserOperateModel extends BaseEntity public class UserOperateModel extends BaseEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private int userId; private int userId;
@Excel(name = "用户编号") @Excel(name = "用户编号")
private String userCode; private String userCode;
@Excel(name = "用户姓名") @Excel(name = "用户姓名")
private String userName; private String userName;
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String userSex; private String userSex;
@Excel(name = "用户手机") @Excel(name = "用户手机")
private String userPhone; private String userPhone;
@Excel(name = "用户邮箱") @Excel(name = "用户邮箱")
private String userEmail; private String userEmail;
@Excel(name = "用户余额") @Excel(name = "用户余额")
private double userBalance; private double userBalance;
@Excel(name = "用户状态", readConverterExp = "0=正常,1=停用") @Excel(name = "用户状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
private Date createTime; private Date createTime;
public UserOperateModel() public UserOperateModel()
{ {
} }
public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone, public UserOperateModel(int userId, String userCode, String userName, String userSex, String userPhone,
String userEmail, double userBalance, String status) String userEmail, double userBalance, String status)
{ {
this.userId = userId; this.userId = userId;
this.userCode = userCode; this.userCode = userCode;
this.userName = userName; this.userName = userName;
this.userSex = userSex; this.userSex = userSex;
this.userPhone = userPhone; this.userPhone = userPhone;
this.userEmail = userEmail; this.userEmail = userEmail;
this.userBalance = userBalance; this.userBalance = userBalance;
this.status = status; this.status = status;
this.createTime = DateUtils.getNowDate(); this.createTime = DateUtils.getNowDate();
} }
public int getUserId() public int getUserId()
{ {
return userId; return userId;
} }
public void setUserId(int userId) public void setUserId(int userId)
{ {
this.userId = userId; this.userId = userId;
} }
public String getUserCode() public String getUserCode()
{ {
return userCode; return userCode;
} }
public void setUserCode(String userCode) public void setUserCode(String userCode)
{ {
this.userCode = userCode; this.userCode = userCode;
} }
public String getUserName() public String getUserName()
{ {
return userName; return userName;
} }
public void setUserName(String userName) public void setUserName(String userName)
{ {
this.userName = userName; this.userName = userName;
} }
public String getUserSex() public String getUserSex()
{ {
return userSex; return userSex;
} }
public void setUserSex(String userSex) public void setUserSex(String userSex)
{ {
this.userSex = userSex; this.userSex = userSex;
} }
public String getUserPhone() public String getUserPhone()
{ {
return userPhone; return userPhone;
} }
public void setUserPhone(String userPhone) public void setUserPhone(String userPhone)
{ {
this.userPhone = userPhone; this.userPhone = userPhone;
} }
public String getUserEmail() public String getUserEmail()
{ {
return userEmail; return userEmail;
} }
public void setUserEmail(String userEmail) public void setUserEmail(String userEmail)
{ {
this.userEmail = userEmail; this.userEmail = userEmail;
} }
public double getUserBalance() public double getUserBalance()
{ {
return userBalance; return userBalance;
} }
public void setUserBalance(double userBalance) public void setUserBalance(double userBalance)
{ {
this.userBalance = userBalance; this.userBalance = userBalance;
} }
public String getStatus() public String getStatus()
{ {
return status; return status;
} }
public void setStatus(String status) public void setStatus(String status)
{ {
this.status = status; this.status = status;
} }
@Override @Override
public Date getCreateTime() public Date getCreateTime()
{ {
return createTime; return createTime;
} }
@Override @Override
public void setCreateTime(Date createTime) public void setCreateTime(Date createTime)
{ {
this.createTime = createTime; this.createTime = createTime;
} }
} }

View File

@ -1,82 +1,82 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.framework.web.service.CacheService; import com.ruoyi.framework.web.service.CacheService;
/** /**
* 缓存监控 * 缓存监控
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/cache") @RequestMapping("/monitor/cache")
public class CacheController extends BaseController public class CacheController extends BaseController
{ {
private String prefix = "monitor/cache"; private String prefix = "monitor/cache";
@Autowired @Autowired
private CacheService cacheService; private CacheService cacheService;
@GetMapping() @GetMapping()
public String cache(ModelMap mmap) public String cache(ModelMap mmap)
{ {
mmap.put("cacheNames", cacheService.getCacheNames()); mmap.put("cacheNames", cacheService.getCacheNames());
return prefix + "/cache"; return prefix + "/cache";
} }
@PostMapping("/getNames") @PostMapping("/getNames")
public String getCacheNames(String fragment, ModelMap mmap) public String getCacheNames(String fragment, ModelMap mmap)
{ {
mmap.put("cacheNames", cacheService.getCacheNames()); mmap.put("cacheNames", cacheService.getCacheNames());
return prefix + "/cache::" + fragment; return prefix + "/cache::" + fragment;
} }
@PostMapping("/getKeys") @PostMapping("/getKeys")
public String getCacheKeys(String fragment, String cacheName, ModelMap mmap) public String getCacheKeys(String fragment, String cacheName, ModelMap mmap)
{ {
mmap.put("cacheName", cacheName); mmap.put("cacheName", cacheName);
mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName)); mmap.put("cacheKyes", cacheService.getCacheKeys(cacheName));
return prefix + "/cache::" + fragment; return prefix + "/cache::" + fragment;
} }
@PostMapping("/getValue") @PostMapping("/getValue")
public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap) public String getCacheValue(String fragment, String cacheName, String cacheKey, ModelMap mmap)
{ {
mmap.put("cacheName", cacheName); mmap.put("cacheName", cacheName);
mmap.put("cacheKey", cacheKey); mmap.put("cacheKey", cacheKey);
mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey)); mmap.put("cacheValue", cacheService.getCacheValue(cacheName, cacheKey));
return prefix + "/cache::" + fragment; return prefix + "/cache::" + fragment;
} }
@PostMapping("/clearCacheName") @PostMapping("/clearCacheName")
@ResponseBody @ResponseBody
public AjaxResult clearCacheName(String cacheName, ModelMap mmap) public AjaxResult clearCacheName(String cacheName, ModelMap mmap)
{ {
cacheService.clearCacheName(cacheName); cacheService.clearCacheName(cacheName);
return AjaxResult.success(); return AjaxResult.success();
} }
@PostMapping("/clearCacheKey") @PostMapping("/clearCacheKey")
@ResponseBody @ResponseBody
public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap) public AjaxResult clearCacheKey(String cacheName, String cacheKey, ModelMap mmap)
{ {
cacheService.clearCacheKey(cacheName, cacheKey); cacheService.clearCacheKey(cacheName, cacheKey);
return AjaxResult.success(); return AjaxResult.success();
} }
@GetMapping("/clearAll") @GetMapping("/clearAll")
@ResponseBody @ResponseBody
public AjaxResult clearAll(ModelMap mmap) public AjaxResult clearAll(ModelMap mmap)
{ {
cacheService.clearAll(); cacheService.clearAll();
return AjaxResult.success(); return AjaxResult.success();
} }
} }

View File

@ -1,26 +1,26 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
/** /**
* druid 监控 * druid 监控
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/data") @RequestMapping("/monitor/data")
public class DruidController extends BaseController public class DruidController extends BaseController
{ {
private String prefix = "/druid"; private String prefix = "/druid";
@RequiresPermissions("monitor:data:view") @RequiresPermissions("monitor:data:view")
@GetMapping() @GetMapping()
public String index() public String index()
{ {
return redirect(prefix + "/index.html"); return redirect(prefix + "/index.html");
} }
} }

View File

@ -1,31 +1,31 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.framework.web.domain.Server; import com.ruoyi.framework.web.domain.Server;
/** /**
* 服务器监控 * 服务器监控
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/server") @RequestMapping("/monitor/server")
public class ServerController extends BaseController public class ServerController extends BaseController
{ {
private String prefix = "monitor/server"; private String prefix = "monitor/server";
@RequiresPermissions("monitor:server:view") @RequiresPermissions("monitor:server:view")
@GetMapping() @GetMapping()
public String server(ModelMap mmap) throws Exception public String server(ModelMap mmap) throws Exception
{ {
Server server = new Server(); Server server = new Server();
server.copyTo(); server.copyTo();
mmap.put("server", server); mmap.put("server", server);
return prefix + "/server"; return prefix + "/server";
} }
} }

View File

@ -1,94 +1,94 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.shiro.service.SysPasswordService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService; import com.ruoyi.system.service.ISysLogininforService;
/** /**
* 系统访问记录 * 系统访问记录
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/logininfor") @RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController public class SysLogininforController extends BaseController
{ {
private String prefix = "monitor/logininfor"; private String prefix = "monitor/logininfor";
@Autowired @Autowired
private ISysLogininforService logininforService; private ISysLogininforService logininforService;
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
@RequiresPermissions("monitor:logininfor:view") @RequiresPermissions("monitor:logininfor:view")
@GetMapping() @GetMapping()
public String logininfor() public String logininfor()
{ {
return prefix + "/logininfor"; return prefix + "/logininfor";
} }
@RequiresPermissions("monitor:logininfor:list") @RequiresPermissions("monitor:logininfor:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysLogininfor logininfor) public TableDataInfo list(SysLogininfor logininfor)
{ {
startPage(); startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "登录日志", businessType = BusinessType.EXPORT) @Log(title = "登录日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:logininfor:export") @RequiresPermissions("monitor:logininfor:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysLogininfor logininfor) public AjaxResult export(SysLogininfor logininfor)
{ {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class); ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志"); return util.exportExcel(list, "登录日志");
} }
@RequiresPermissions("monitor:logininfor:remove") @RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.DELETE) @Log(title = "登录日志", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
return toAjax(logininforService.deleteLogininforByIds(ids)); return toAjax(logininforService.deleteLogininforByIds(ids));
} }
@RequiresPermissions("monitor:logininfor:remove") @RequiresPermissions("monitor:logininfor:remove")
@Log(title = "登录日志", businessType = BusinessType.CLEAN) @Log(title = "登录日志", businessType = BusinessType.CLEAN)
@PostMapping("/clean") @PostMapping("/clean")
@ResponseBody @ResponseBody
public AjaxResult clean() public AjaxResult clean()
{ {
logininforService.cleanLogininfor(); logininforService.cleanLogininfor();
return success(); return success();
} }
@RequiresPermissions("monitor:logininfor:unlock") @RequiresPermissions("monitor:logininfor:unlock")
@Log(title = "账户解锁", businessType = BusinessType.OTHER) @Log(title = "账户解锁", businessType = BusinessType.OTHER)
@PostMapping("/unlock") @PostMapping("/unlock")
@ResponseBody @ResponseBody
public AjaxResult unlock(String loginName) public AjaxResult unlock(String loginName)
{ {
passwordService.clearLoginRecordCache(loginName); passwordService.clearLoginRecordCache(loginName);
return success(); return success();
} }
} }

View File

@ -1,90 +1,90 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.domain.SysOperLog;
import com.ruoyi.system.service.ISysOperLogService; import com.ruoyi.system.service.ISysOperLogService;
/** /**
* 操作日志记录 * 操作日志记录
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/operlog") @RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController public class SysOperlogController extends BaseController
{ {
private String prefix = "monitor/operlog"; private String prefix = "monitor/operlog";
@Autowired @Autowired
private ISysOperLogService operLogService; private ISysOperLogService operLogService;
@RequiresPermissions("monitor:operlog:view") @RequiresPermissions("monitor:operlog:view")
@GetMapping() @GetMapping()
public String operlog() public String operlog()
{ {
return prefix + "/operlog"; return prefix + "/operlog";
} }
@RequiresPermissions("monitor:operlog:list") @RequiresPermissions("monitor:operlog:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysOperLog operLog) public TableDataInfo list(SysOperLog operLog)
{ {
startPage(); startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "操作日志", businessType = BusinessType.EXPORT) @Log(title = "操作日志", businessType = BusinessType.EXPORT)
@RequiresPermissions("monitor:operlog:export") @RequiresPermissions("monitor:operlog:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysOperLog operLog) public AjaxResult export(SysOperLog operLog)
{ {
List<SysOperLog> list = operLogService.selectOperLogList(operLog); List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class); ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志"); return util.exportExcel(list, "操作日志");
} }
@Log(title = "操作日志", businessType = BusinessType.DELETE) @Log(title = "操作日志", businessType = BusinessType.DELETE)
@RequiresPermissions("monitor:operlog:remove") @RequiresPermissions("monitor:operlog:remove")
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
return toAjax(operLogService.deleteOperLogByIds(ids)); return toAjax(operLogService.deleteOperLogByIds(ids));
} }
@RequiresPermissions("monitor:operlog:detail") @RequiresPermissions("monitor:operlog:detail")
@GetMapping("/detail/{operId}") @GetMapping("/detail/{operId}")
public String detail(@PathVariable("operId") Long operId, ModelMap mmap) public String detail(@PathVariable("operId") Long operId, ModelMap mmap)
{ {
mmap.put("operLog", operLogService.selectOperLogById(operId)); mmap.put("operLog", operLogService.selectOperLogById(operId));
return prefix + "/detail"; return prefix + "/detail";
} }
@Log(title = "操作日志", businessType = BusinessType.CLEAN) @Log(title = "操作日志", businessType = BusinessType.CLEAN)
@RequiresPermissions("monitor:operlog:remove") @RequiresPermissions("monitor:operlog:remove")
@PostMapping("/clean") @PostMapping("/clean")
@ResponseBody @ResponseBody
public AjaxResult clean() public AjaxResult clean()
{ {
operLogService.cleanOperLog(); operLogService.cleanOperLog();
return success(); return success();
} }
} }

View File

@ -1,88 +1,88 @@
package com.ruoyi.web.controller.monitor; package com.ruoyi.web.controller.monitor;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.OnlineStatus; import com.ruoyi.common.enums.OnlineStatus;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.shiro.session.OnlineSession; import com.ruoyi.framework.shiro.session.OnlineSession;
import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.shiro.session.OnlineSessionDAO;
import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.domain.SysUserOnline;
import com.ruoyi.system.service.ISysUserOnlineService; import com.ruoyi.system.service.ISysUserOnlineService;
/** /**
* 在线用户监控 * 在线用户监控
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/monitor/online") @RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController public class SysUserOnlineController extends BaseController
{ {
private String prefix = "monitor/online"; private String prefix = "monitor/online";
@Autowired @Autowired
private ISysUserOnlineService userOnlineService; private ISysUserOnlineService userOnlineService;
@Autowired @Autowired
private OnlineSessionDAO onlineSessionDAO; private OnlineSessionDAO onlineSessionDAO;
@RequiresPermissions("monitor:online:view") @RequiresPermissions("monitor:online:view")
@GetMapping() @GetMapping()
public String online() public String online()
{ {
return prefix + "/online"; return prefix + "/online";
} }
@RequiresPermissions("monitor:online:list") @RequiresPermissions("monitor:online:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysUserOnline userOnline) public TableDataInfo list(SysUserOnline userOnline)
{ {
startPage(); startPage();
List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline); List<SysUserOnline> list = userOnlineService.selectUserOnlineList(userOnline);
return getDataTable(list); return getDataTable(list);
} }
@RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR) @RequiresPermissions(value = { "monitor:online:batchForceLogout", "monitor:online:forceLogout" }, logical = Logical.OR)
@Log(title = "在线用户", businessType = BusinessType.FORCE) @Log(title = "在线用户", businessType = BusinessType.FORCE)
@PostMapping("/batchForceLogout") @PostMapping("/batchForceLogout")
@ResponseBody @ResponseBody
public AjaxResult batchForceLogout(String ids) public AjaxResult batchForceLogout(String ids)
{ {
for (String sessionId : Convert.toStrArray(ids)) for (String sessionId : Convert.toStrArray(ids))
{ {
SysUserOnline online = userOnlineService.selectOnlineById(sessionId); SysUserOnline online = userOnlineService.selectOnlineById(sessionId);
if (online == null) if (online == null)
{ {
return error("用户已下线"); return error("用户已下线");
} }
OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId()); OnlineSession onlineSession = (OnlineSession) onlineSessionDAO.readSession(online.getSessionId());
if (onlineSession == null) if (onlineSession == null)
{ {
return error("用户已下线"); return error("用户已下线");
} }
if (sessionId.equals(ShiroUtils.getSessionId())) if (sessionId.equals(ShiroUtils.getSessionId()))
{ {
return error("当前登录用户无法强退"); return error("当前登录用户无法强退");
} }
onlineSessionDAO.delete(onlineSession); onlineSessionDAO.delete(onlineSession);
online.setStatus(OnlineStatus.off_line); online.setStatus(OnlineStatus.off_line);
userOnlineService.saveOnline(online); userOnlineService.saveOnline(online);
userOnlineService.removeUserCache(online.getLoginName(), sessionId); userOnlineService.removeUserCache(online.getLoginName(), sessionId);
} }
return success(); return success();
} }
} }

View File

@ -1,92 +1,92 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer; import com.google.code.kaptcha.Producer;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
/** /**
* 图片验证码支持算术形式 * 图片验证码支持算术形式
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/captcha") @RequestMapping("/captcha")
public class SysCaptchaController extends BaseController public class SysCaptchaController extends BaseController
{ {
@Resource(name = "captchaProducer") @Resource(name = "captchaProducer")
private Producer captchaProducer; private Producer captchaProducer;
@Resource(name = "captchaProducerMath") @Resource(name = "captchaProducerMath")
private Producer captchaProducerMath; private Producer captchaProducerMath;
/** /**
* 验证码生成 * 验证码生成
*/ */
@GetMapping(value = "/captchaImage") @GetMapping(value = "/captchaImage")
public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response) public ModelAndView getKaptchaImage(HttpServletRequest request, HttpServletResponse response)
{ {
ServletOutputStream out = null; ServletOutputStream out = null;
try try
{ {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
response.setDateHeader("Expires", 0); response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate"); response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.addHeader("Cache-Control", "post-check=0, pre-check=0"); response.addHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache"); response.setHeader("Pragma", "no-cache");
response.setContentType("image/jpeg"); response.setContentType("image/jpeg");
String type = request.getParameter("type"); String type = request.getParameter("type");
String capStr = null; String capStr = null;
String code = null; String code = null;
BufferedImage bi = null; BufferedImage bi = null;
if ("math".equals(type)) if ("math".equals(type))
{ {
String capText = captchaProducerMath.createText(); String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@")); capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1); code = capText.substring(capText.lastIndexOf("@") + 1);
bi = captchaProducerMath.createImage(capStr); bi = captchaProducerMath.createImage(capStr);
} }
else if ("char".equals(type)) else if ("char".equals(type))
{ {
capStr = code = captchaProducer.createText(); capStr = code = captchaProducer.createText();
bi = captchaProducer.createImage(capStr); bi = captchaProducer.createImage(capStr);
} }
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code); session.setAttribute(Constants.KAPTCHA_SESSION_KEY, code);
out = response.getOutputStream(); out = response.getOutputStream();
ImageIO.write(bi, "jpg", out); ImageIO.write(bi, "jpg", out);
out.flush(); out.flush();
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
finally finally
{ {
try try
{ {
if (out != null) if (out != null)
{ {
out.close(); out.close();
} }
} }
catch (IOException e) catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
return null; return null;
} }
} }

View File

@ -1,157 +1,157 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
/** /**
* 参数配置 信息操作处理 * 参数配置 信息操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/config") @RequestMapping("/system/config")
public class SysConfigController extends BaseController public class SysConfigController extends BaseController
{ {
private String prefix = "system/config"; private String prefix = "system/config";
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@RequiresPermissions("system:config:view") @RequiresPermissions("system:config:view")
@GetMapping() @GetMapping()
public String config() public String config()
{ {
return prefix + "/config"; return prefix + "/config";
} }
/** /**
* 查询参数配置列表 * 查询参数配置列表
*/ */
@RequiresPermissions("system:config:list") @RequiresPermissions("system:config:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysConfig config) public TableDataInfo list(SysConfig config)
{ {
startPage(); startPage();
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "参数管理", businessType = BusinessType.EXPORT) @Log(title = "参数管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:config:export") @RequiresPermissions("system:config:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysConfig config) public AjaxResult export(SysConfig config)
{ {
List<SysConfig> list = configService.selectConfigList(config); List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据"); return util.exportExcel(list, "参数数据");
} }
/** /**
* 新增参数配置 * 新增参数配置
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add()
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存参数配置 * 新增保存参数配置
*/ */
@RequiresPermissions("system:config:add") @RequiresPermissions("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT) @Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysConfig config) public AjaxResult addSave(@Validated SysConfig config)
{ {
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{ {
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setCreateBy(getLoginName()); config.setCreateBy(getLoginName());
return toAjax(configService.insertConfig(config)); return toAjax(configService.insertConfig(config));
} }
/** /**
* 修改参数配置 * 修改参数配置
*/ */
@GetMapping("/edit/{configId}") @GetMapping("/edit/{configId}")
public String edit(@PathVariable("configId") Long configId, ModelMap mmap) public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
{ {
mmap.put("config", configService.selectConfigById(configId)); mmap.put("config", configService.selectConfigById(configId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存参数配置 * 修改保存参数配置
*/ */
@RequiresPermissions("system:config:edit") @RequiresPermissions("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE) @Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysConfig config) public AjaxResult editSave(@Validated SysConfig config)
{ {
if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) if (UserConstants.CONFIG_KEY_NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
{ {
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
} }
config.setUpdateBy(getLoginName()); config.setUpdateBy(getLoginName());
return toAjax(configService.updateConfig(config)); return toAjax(configService.updateConfig(config));
} }
/** /**
* 删除参数配置 * 删除参数配置
*/ */
@RequiresPermissions("system:config:remove") @RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE) @Log(title = "参数管理", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
configService.deleteConfigByIds(ids); configService.deleteConfigByIds(ids);
return success(); return success();
} }
/** /**
* 刷新参数缓存 * 刷新参数缓存
*/ */
@RequiresPermissions("system:config:remove") @RequiresPermissions("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN) @Log(title = "参数管理", businessType = BusinessType.CLEAN)
@GetMapping("/refreshCache") @GetMapping("/refreshCache")
@ResponseBody @ResponseBody
public AjaxResult refreshCache() public AjaxResult refreshCache()
{ {
configService.resetConfigCache(); configService.resetConfigCache();
return success(); return success();
} }
/** /**
* 校验参数键名 * 校验参数键名
*/ */
@PostMapping("/checkConfigKeyUnique") @PostMapping("/checkConfigKeyUnique")
@ResponseBody @ResponseBody
public String checkConfigKeyUnique(SysConfig config) public String checkConfigKeyUnique(SysConfig config)
{ {
return configService.checkConfigKeyUnique(config); return configService.checkConfigKeyUnique(config);
} }
} }

View File

@ -1,224 +1,224 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysDeptService;
/** /**
* 部门信息 * 部门信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/dept") @RequestMapping("/system/dept")
public class SysDeptController extends BaseController public class SysDeptController extends BaseController
{ {
private String prefix = "system/dept"; private String prefix = "system/dept";
@Autowired @Autowired
private ISysDeptService deptService; private ISysDeptService deptService;
@Autowired @Autowired
ISysConfigService configService; ISysConfigService configService;
@RequiresPermissions("system:dept:view") @RequiresPermissions("system:dept:view")
@GetMapping() @GetMapping()
public String dept() public String dept()
{ {
return prefix + "/dept"; return prefix + "/dept";
} }
@RequiresPermissions("system:dept:list") @RequiresPermissions("system:dept:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public List<SysDept> list(SysDept dept) public List<SysDept> list(SysDept dept)
{ {
List<SysDept> deptList = deptService.selectDeptList(dept); List<SysDept> deptList = deptService.selectDeptList(dept);
return deptList; return deptList;
} }
/** /**
* 新增部门 * 新增部门
*/ */
@GetMapping("/add/{parentId}") @GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{ {
if (!getSysUser().isAdmin()) if (!getSysUser().isAdmin())
{ {
parentId = getSysUser().getDeptId(); parentId = getSysUser().getDeptId();
} }
mmap.put("dept", deptService.selectDeptById(parentId)); mmap.put("dept", deptService.selectDeptById(parentId));
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存部门 * 新增保存部门
*/ */
@Log(title = "部门管理", businessType = BusinessType.INSERT) @Log(title = "部门管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dept:add") @RequiresPermissions("system:dept:add")
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysDept dept) public AjaxResult addSave(@Validated SysDept dept)
{ {
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{ {
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
dept.setCreateBy(getLoginName()); dept.setCreateBy(getLoginName());
return toAjax(deptService.insertDept(dept)); return toAjax(deptService.insertDept(dept));
} }
/** /**
* 修改 * 修改
*/ */
@GetMapping("/edit/{deptId}") @GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap) public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
{ {
SysDept dept = deptService.selectDeptById(deptId); SysDept dept = deptService.selectDeptById(deptId);
if (StringUtils.isNotNull(dept) && 100L == deptId) if (StringUtils.isNotNull(dept) && 100L == deptId)
{ {
dept.setParentName(""); dept.setParentName("");
} }
mmap.put("dept", dept); mmap.put("dept", dept);
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 保存 * 保存
*/ */
@Log(title = "部门管理", businessType = BusinessType.UPDATE) @Log(title = "部门管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit") @RequiresPermissions("system:dept:edit")
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysDept dept) public AjaxResult editSave(@Validated SysDept dept)
{ {
if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) if (UserConstants.DEPT_NAME_NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
{ {
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} }
else if (dept.getParentId().equals(dept.getDeptId())) else if (dept.getParentId().equals(dept.getDeptId()))
{ {
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} }
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) && deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
{ {
return AjaxResult.error("该部门包含未停用的子部门!"); return AjaxResult.error("该部门包含未停用的子部门!");
} }
dept.setUpdateBy(getLoginName()); dept.setUpdateBy(getLoginName());
return toAjax(deptService.updateDept(dept)); return toAjax(deptService.updateDept(dept));
} }
/** /**
* 删除 * 删除
*/ */
@Log(title = "部门管理", businessType = BusinessType.DELETE) @Log(title = "部门管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dept:remove") @RequiresPermissions("system:dept:remove")
@GetMapping("/remove/{deptId}") @GetMapping("/remove/{deptId}")
@ResponseBody @ResponseBody
public AjaxResult remove(@PathVariable("deptId") Long deptId) public AjaxResult remove(@PathVariable("deptId") Long deptId)
{ {
if (deptService.selectDeptCount(deptId) > 0) if (deptService.selectDeptCount(deptId) > 0)
{ {
return AjaxResult.warn("存在下级部门,不允许删除"); return AjaxResult.warn("存在下级部门,不允许删除");
} }
if (deptService.checkDeptExistUser(deptId)) if (deptService.checkDeptExistUser(deptId))
{ {
return AjaxResult.warn("部门存在用户,不允许删除"); return AjaxResult.warn("部门存在用户,不允许删除");
} }
return toAjax(deptService.deleteDeptById(deptId)); return toAjax(deptService.deleteDeptById(deptId));
} }
/** /**
* 校验部门名称 * 校验部门名称
*/ */
@PostMapping("/checkDeptNameUnique") @PostMapping("/checkDeptNameUnique")
@ResponseBody @ResponseBody
public String checkDeptNameUnique(SysDept dept) public String checkDeptNameUnique(SysDept dept)
{ {
return deptService.checkDeptNameUnique(dept); return deptService.checkDeptNameUnique(dept);
} }
/** /**
* 选择部门树 * 选择部门树
* *
* @param deptId 部门ID * @param deptId 部门ID
* @param excludeId 排除ID * @param excludeId 排除ID
*/ */
@GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" }) @GetMapping(value = { "/selectDeptTree/{deptId}", "/selectDeptTree/{deptId}/{excludeId}" })
public String selectDeptTree(@PathVariable("deptId") Long deptId, public String selectDeptTree(@PathVariable("deptId") Long deptId,
@PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap) @PathVariable(value = "excludeId", required = false) String excludeId, ModelMap mmap)
{ {
mmap.put("dept", deptService.selectDeptById(deptId)); mmap.put("dept", deptService.selectDeptById(deptId));
mmap.put("excludeId", excludeId); mmap.put("excludeId", excludeId);
return prefix + "/tree"; return prefix + "/tree";
} }
/** /**
* 加载部门列表树 * 加载部门列表树
*/ */
@GetMapping("/treeData") @GetMapping("/treeData")
@ResponseBody @ResponseBody
public List<Ztree> treeData() public List<Ztree> treeData()
{ {
List<Ztree> ztrees = deptService.selectDeptTree(new SysDept()); List<Ztree> ztrees = deptService.selectDeptTree(new SysDept());
return ztrees; return ztrees;
} }
/** /**
* 加载部门列表树排除下级 * 加载部门列表树排除下级
*/ */
@GetMapping("/treeData/{excludeId}") @GetMapping("/treeData/{excludeId}")
@ResponseBody @ResponseBody
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId) public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
{ {
SysDept dept = new SysDept(); SysDept dept = new SysDept();
dept.setDeptId(excludeId); dept.setDeptId(excludeId);
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept); List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
return ztrees; return ztrees;
} }
/** /**
* 加载角色部门数据权限列表树 * 加载角色部门数据权限列表树
*/ */
@GetMapping("/roleDeptTreeData") @GetMapping("/roleDeptTreeData")
@ResponseBody @ResponseBody
public List<Ztree> deptTreeData(SysRole role) public List<Ztree> deptTreeData(SysRole role)
{ {
List<Ztree> ztrees = deptService.roleDeptTreeData(role); List<Ztree> ztrees = deptService.roleDeptTreeData(role);
return ztrees; return ztrees;
} }
/** /**
* Ecology部门信息同步 * Ecology部门信息同步
*/ */
@Log(title = "部门同步", businessType = BusinessType.UPDATE) @Log(title = "部门同步", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dept:sync") @RequiresPermissions("system:dept:sync")
@PostMapping("/syncDept") @PostMapping("/syncDept")
@ResponseBody @ResponseBody
public AjaxResult syncDept() { public AjaxResult syncDept() {
String url = "http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage"; String url = "http://192.168.2.85:90/api/hrm/resful/getHrmdepartmentWithPage";
String params = "{\"params\":{\"pagesize\":999999}}"; String params = "{\"params\":{\"pagesize\":999999}}";
return deptService.syncEcologyDept(url, params); return deptService.syncEcologyDept(url, params);
} }
} }

View File

@ -1,120 +1,120 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictDataService;
/** /**
* 数据字典信息 * 数据字典信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/dict/data") @RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController public class SysDictDataController extends BaseController
{ {
private String prefix = "system/dict/data"; private String prefix = "system/dict/data";
@Autowired @Autowired
private ISysDictDataService dictDataService; private ISysDictDataService dictDataService;
@RequiresPermissions("system:dict:view") @RequiresPermissions("system:dict:view")
@GetMapping() @GetMapping()
public String dictData() public String dictData()
{ {
return prefix + "/data"; return prefix + "/data";
} }
@PostMapping("/list") @PostMapping("/list")
@RequiresPermissions("system:dict:list") @RequiresPermissions("system:dict:list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysDictData dictData) public TableDataInfo list(SysDictData dictData)
{ {
startPage(); startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "字典数据", businessType = BusinessType.EXPORT) @Log(title = "字典数据", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export") @RequiresPermissions("system:dict:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysDictData dictData) public AjaxResult export(SysDictData dictData)
{ {
List<SysDictData> list = dictDataService.selectDictDataList(dictData); List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据"); return util.exportExcel(list, "字典数据");
} }
/** /**
* 新增字典类型 * 新增字典类型
*/ */
@GetMapping("/add/{dictType}") @GetMapping("/add/{dictType}")
public String add(@PathVariable("dictType") String dictType, ModelMap mmap) public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
{ {
mmap.put("dictType", dictType); mmap.put("dictType", dictType);
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存字典类型 * 新增保存字典类型
*/ */
@Log(title = "字典数据", businessType = BusinessType.INSERT) @Log(title = "字典数据", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add") @RequiresPermissions("system:dict:add")
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysDictData dict) public AjaxResult addSave(@Validated SysDictData dict)
{ {
dict.setCreateBy(getLoginName()); dict.setCreateBy(getLoginName());
return toAjax(dictDataService.insertDictData(dict)); return toAjax(dictDataService.insertDictData(dict));
} }
/** /**
* 修改字典类型 * 修改字典类型
*/ */
@GetMapping("/edit/{dictCode}") @GetMapping("/edit/{dictCode}")
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
{ {
mmap.put("dict", dictDataService.selectDictDataById(dictCode)); mmap.put("dict", dictDataService.selectDictDataById(dictCode));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存字典类型 * 修改保存字典类型
*/ */
@Log(title = "字典数据", businessType = BusinessType.UPDATE) @Log(title = "字典数据", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit") @RequiresPermissions("system:dict:edit")
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysDictData dict) public AjaxResult editSave(@Validated SysDictData dict)
{ {
dict.setUpdateBy(getLoginName()); dict.setUpdateBy(getLoginName());
return toAjax(dictDataService.updateDictData(dict)); return toAjax(dictDataService.updateDictData(dict));
} }
@Log(title = "字典数据", businessType = BusinessType.DELETE) @Log(title = "字典数据", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove") @RequiresPermissions("system:dict:remove")
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
dictDataService.deleteDictDataByIds(ids); dictDataService.deleteDictDataByIds(ids);
return success(); return success();
} }
} }

View File

@ -1,188 +1,188 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysDictType; import com.ruoyi.common.core.domain.entity.SysDictType;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.ISysDictTypeService;
/** /**
* 数据字典信息 * 数据字典信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/dict") @RequestMapping("/system/dict")
public class SysDictTypeController extends BaseController public class SysDictTypeController extends BaseController
{ {
private String prefix = "system/dict/type"; private String prefix = "system/dict/type";
@Autowired @Autowired
private ISysDictTypeService dictTypeService; private ISysDictTypeService dictTypeService;
@RequiresPermissions("system:dict:view") @RequiresPermissions("system:dict:view")
@GetMapping() @GetMapping()
public String dictType() public String dictType()
{ {
return prefix + "/type"; return prefix + "/type";
} }
@PostMapping("/list") @PostMapping("/list")
@RequiresPermissions("system:dict:list") @RequiresPermissions("system:dict:list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysDictType dictType) public TableDataInfo list(SysDictType dictType)
{ {
startPage(); startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "字典类型", businessType = BusinessType.EXPORT) @Log(title = "字典类型", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:dict:export") @RequiresPermissions("system:dict:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysDictType dictType) public AjaxResult export(SysDictType dictType)
{ {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class); ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型"); return util.exportExcel(list, "字典类型");
} }
/** /**
* 新增字典类型 * 新增字典类型
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add()
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存字典类型 * 新增保存字典类型
*/ */
@Log(title = "字典类型", businessType = BusinessType.INSERT) @Log(title = "字典类型", businessType = BusinessType.INSERT)
@RequiresPermissions("system:dict:add") @RequiresPermissions("system:dict:add")
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysDictType dict) public AjaxResult addSave(@Validated SysDictType dict)
{ {
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{ {
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setCreateBy(getLoginName()); dict.setCreateBy(getLoginName());
return toAjax(dictTypeService.insertDictType(dict)); return toAjax(dictTypeService.insertDictType(dict));
} }
/** /**
* 修改字典类型 * 修改字典类型
*/ */
@GetMapping("/edit/{dictId}") @GetMapping("/edit/{dictId}")
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap) public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
{ {
mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存字典类型 * 修改保存字典类型
*/ */
@Log(title = "字典类型", businessType = BusinessType.UPDATE) @Log(title = "字典类型", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit") @RequiresPermissions("system:dict:edit")
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysDictType dict) public AjaxResult editSave(@Validated SysDictType dict)
{ {
if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) if (UserConstants.DICT_TYPE_NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
{ {
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
} }
dict.setUpdateBy(getLoginName()); dict.setUpdateBy(getLoginName());
return toAjax(dictTypeService.updateDictType(dict)); return toAjax(dictTypeService.updateDictType(dict));
} }
@Log(title = "字典类型", businessType = BusinessType.DELETE) @Log(title = "字典类型", businessType = BusinessType.DELETE)
@RequiresPermissions("system:dict:remove") @RequiresPermissions("system:dict:remove")
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
dictTypeService.deleteDictTypeByIds(ids); dictTypeService.deleteDictTypeByIds(ids);
return success(); return success();
} }
/** /**
* 刷新字典缓存 * 刷新字典缓存
*/ */
@RequiresPermissions("system:dict:remove") @RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN) @Log(title = "字典类型", businessType = BusinessType.CLEAN)
@GetMapping("/refreshCache") @GetMapping("/refreshCache")
@ResponseBody @ResponseBody
public AjaxResult refreshCache() public AjaxResult refreshCache()
{ {
dictTypeService.resetDictCache(); dictTypeService.resetDictCache();
return success(); return success();
} }
/** /**
* 查询字典详细 * 查询字典详细
*/ */
@RequiresPermissions("system:dict:list") @RequiresPermissions("system:dict:list")
@GetMapping("/detail/{dictId}") @GetMapping("/detail/{dictId}")
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap) public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
{ {
mmap.put("dict", dictTypeService.selectDictTypeById(dictId)); mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
mmap.put("dictList", dictTypeService.selectDictTypeAll()); mmap.put("dictList", dictTypeService.selectDictTypeAll());
return "system/dict/data/data"; return "system/dict/data/data";
} }
/** /**
* 校验字典类型 * 校验字典类型
*/ */
@PostMapping("/checkDictTypeUnique") @PostMapping("/checkDictTypeUnique")
@ResponseBody @ResponseBody
public String checkDictTypeUnique(SysDictType dictType) public String checkDictTypeUnique(SysDictType dictType)
{ {
return dictTypeService.checkDictTypeUnique(dictType); return dictTypeService.checkDictTypeUnique(dictType);
} }
/** /**
* 选择字典树 * 选择字典树
*/ */
@GetMapping("/selectDictTree/{columnId}/{dictType}") @GetMapping("/selectDictTree/{columnId}/{dictType}")
public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType, public String selectDeptTree(@PathVariable("columnId") Long columnId, @PathVariable("dictType") String dictType,
ModelMap mmap) ModelMap mmap)
{ {
mmap.put("columnId", columnId); mmap.put("columnId", columnId);
mmap.put("dict", dictTypeService.selectDictTypeByType(dictType)); mmap.put("dict", dictTypeService.selectDictTypeByType(dictType));
return prefix + "/tree"; return prefix + "/tree";
} }
/** /**
* 加载字典列表树 * 加载字典列表树
*/ */
@GetMapping("/treeData") @GetMapping("/treeData")
@ResponseBody @ResponseBody
public List<Ztree> treeData() public List<Ztree> treeData()
{ {
List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType()); List<Ztree> ztrees = dictTypeService.selectDictTree(new SysDictType());
return ztrees; return ztrees;
} }
} }

View File

@ -1,167 +1,167 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.http.HttpUtils; import com.ruoyi.common.utils.http.HttpUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.ShiroConstants; import com.ruoyi.common.constant.ShiroConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.CookieUtils; import com.ruoyi.common.utils.CookieUtils;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
/** /**
* 首页 业务处理 * 首页 业务处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
public class SysIndexController extends BaseController public class SysIndexController extends BaseController
{ {
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
// 系统首页 // 系统首页
@GetMapping("/index") @GetMapping("/index")
public String index(ModelMap mmap) public String index(ModelMap mmap)
{ {
// 取身份信息 // 取身份信息
SysUser user = getSysUser(); SysUser user = getSysUser();
// 根据用户id取出菜单 // 根据用户id取出菜单
List<SysMenu> menus = menuService.selectMenusByUser(user); List<SysMenu> menus = menuService.selectMenusByUser(user);
mmap.put("menus", menus); mmap.put("menus", menus);
mmap.put("user", user); mmap.put("user", user);
mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme")); mmap.put("sideTheme", configService.selectConfigByKey("sys.index.sideTheme"));
mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName")); mmap.put("skinName", configService.selectConfigByKey("sys.index.skinName"));
mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter")); mmap.put("ignoreFooter", configService.selectConfigByKey("sys.index.ignoreFooter"));
mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear()); mmap.put("copyrightYear", RuoYiConfig.getCopyrightYear());
mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled()); mmap.put("demoEnabled", RuoYiConfig.isDemoEnabled());
mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate())); mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate())); mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent"))); mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")));
// 菜单导航显示风格 // 菜单导航显示风格
String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); String menuStyle = configService.selectConfigByKey("sys.index.menuStyle");
// 移动端默认使左侧导航菜单否则取默认配置 // 移动端默认使左侧导航菜单否则取默认配置
String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle; String indexStyle = ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent")) ? "index" : menuStyle;
// 优先Cookie配置导航菜单 // 优先Cookie配置导航菜单
Cookie[] cookies = ServletUtils.getRequest().getCookies(); Cookie[] cookies = ServletUtils.getRequest().getCookies();
for (Cookie cookie : cookies) for (Cookie cookie : cookies)
{ {
if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName())) if (StringUtils.isNotEmpty(cookie.getName()) && "nav-style".equalsIgnoreCase(cookie.getName()))
{ {
indexStyle = cookie.getValue(); indexStyle = cookie.getValue();
break; break;
} }
} }
String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index"; String webIndex = "topnav".equalsIgnoreCase(indexStyle) ? "index-topnav" : "index";
return webIndex; return webIndex;
} }
// 锁定屏幕 // 锁定屏幕
@GetMapping("/lockscreen") @GetMapping("/lockscreen")
public String lockscreen(ModelMap mmap) public String lockscreen(ModelMap mmap)
{ {
mmap.put("user", getSysUser()); mmap.put("user", getSysUser());
ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true); ServletUtils.getSession().setAttribute(ShiroConstants.LOCK_SCREEN, true);
return "lock"; return "lock";
} }
// 解锁屏幕 // 解锁屏幕
@PostMapping("/unlockscreen") @PostMapping("/unlockscreen")
@ResponseBody @ResponseBody
public AjaxResult unlockscreen(String password) public AjaxResult unlockscreen(String password)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
if (StringUtils.isNull(user)) if (StringUtils.isNull(user))
{ {
return AjaxResult.error("服务器超时,请重新登陆"); return AjaxResult.error("服务器超时,请重新登陆");
} }
if (passwordService.matches(user, password)) if (passwordService.matches(user, password))
{ {
ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN); ServletUtils.getSession().removeAttribute(ShiroConstants.LOCK_SCREEN);
return AjaxResult.success(); return AjaxResult.success();
} }
return AjaxResult.error("密码不正确,请重新输入。"); return AjaxResult.error("密码不正确,请重新输入。");
} }
// 切换主题 // 切换主题
@GetMapping("/system/switchSkin") @GetMapping("/system/switchSkin")
public String switchSkin() public String switchSkin()
{ {
return "skin"; return "skin";
} }
// 切换菜单 // 切换菜单
@GetMapping("/system/menuStyle/{style}") @GetMapping("/system/menuStyle/{style}")
public void menuStyle(@PathVariable String style, HttpServletResponse response) public void menuStyle(@PathVariable String style, HttpServletResponse response)
{ {
CookieUtils.setCookie(response, "nav-style", style); CookieUtils.setCookie(response, "nav-style", style);
} }
// 系统介绍 // 系统介绍
@GetMapping("/system/main") @GetMapping("/system/main")
public String main(ModelMap mmap) public String main(ModelMap mmap)
{ {
JSONObject wordsJson = JSONObject.parseObject(HttpUtils.sendGet("https://v1.jinrishici.com/all.json","")); JSONObject wordsJson = JSONObject.parseObject(HttpUtils.sendGet("https://v1.jinrishici.com/all.json",""));
JSONObject oneWordJson = JSONObject.parseObject(HttpUtils.sendGet("https://api.xygeng.cn/one","")); JSONObject oneWordJson = JSONObject.parseObject(HttpUtils.sendGet("https://api.xygeng.cn/one",""));
JSONObject oneWordDataJson = JSONObject.parseObject(oneWordJson.getString("data")); JSONObject oneWordDataJson = JSONObject.parseObject(oneWordJson.getString("data"));
mmap.put("wordsContent",wordsJson.get("content")); mmap.put("wordsContent",wordsJson.get("content"));
mmap.put("wordsAuthor",wordsJson.get("author")); mmap.put("wordsAuthor",wordsJson.get("author"));
mmap.put("wordsOrigin",wordsJson.getString("origin")); mmap.put("wordsOrigin",wordsJson.getString("origin"));
mmap.put("oneWordOrigin",oneWordDataJson.get("origin")); mmap.put("oneWordOrigin",oneWordDataJson.get("origin"));
mmap.put("oneWordContent",oneWordDataJson.get("content")); mmap.put("oneWordContent",oneWordDataJson.get("content"));
mmap.put("version", RuoYiConfig.getVersion()); mmap.put("version", RuoYiConfig.getVersion());
return "main"; return "main";
} }
// 检查初始密码是否提醒修改 // 检查初始密码是否提醒修改
public boolean initPasswordIsModify(Date pwdUpdateDate) public boolean initPasswordIsModify(Date pwdUpdateDate)
{ {
Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify")); Integer initPasswordModify = Convert.toInt(configService.selectConfigByKey("sys.account.initPasswordModify"));
return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null; return initPasswordModify != null && initPasswordModify == 1 && pwdUpdateDate == null;
} }
// 检查密码是否过期 // 检查密码是否过期
public boolean passwordIsExpiration(Date pwdUpdateDate) public boolean passwordIsExpiration(Date pwdUpdateDate)
{ {
Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays")); Integer passwordValidateDays = Convert.toInt(configService.selectConfigByKey("sys.account.passwordValidateDays"));
if (passwordValidateDays != null && passwordValidateDays > 0) if (passwordValidateDays != null && passwordValidateDays > 0)
{ {
if (StringUtils.isNull(pwdUpdateDate)) if (StringUtils.isNull(pwdUpdateDate))
{ {
// 如果从未修改过初始密码直接提醒过期 // 如果从未修改过初始密码直接提醒过期
return true; return true;
} }
Date nowDate = DateUtils.getNowDate(); Date nowDate = DateUtils.getNowDate();
return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays; return DateUtils.differentDaysByMillisecond(nowDate, pwdUpdateDate) > passwordValidateDays;
} }
return false; return false;
} }
} }

View File

@ -1,197 +1,197 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.framework.shiro.util.AuthorizationUtils; import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysMenuService;
/** /**
* 菜单信息 * 菜单信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/menu") @RequestMapping("/system/menu")
public class SysMenuController extends BaseController public class SysMenuController extends BaseController
{ {
private String prefix = "system/menu"; private String prefix = "system/menu";
@Autowired @Autowired
private ISysMenuService menuService; private ISysMenuService menuService;
@RequiresPermissions("system:menu:view") @RequiresPermissions("system:menu:view")
@GetMapping() @GetMapping()
public String menu() public String menu()
{ {
return prefix + "/menu"; return prefix + "/menu";
} }
@RequiresPermissions("system:menu:list") @RequiresPermissions("system:menu:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public List<SysMenu> list(SysMenu menu) public List<SysMenu> list(SysMenu menu)
{ {
Long userId = ShiroUtils.getUserId(); Long userId = ShiroUtils.getUserId();
List<SysMenu> menuList = menuService.selectMenuList(menu, userId); List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
return menuList; return menuList;
} }
/** /**
* 删除菜单 * 删除菜单
*/ */
@Log(title = "菜单管理", businessType = BusinessType.DELETE) @Log(title = "菜单管理", businessType = BusinessType.DELETE)
@RequiresPermissions("system:menu:remove") @RequiresPermissions("system:menu:remove")
@GetMapping("/remove/{menuId}") @GetMapping("/remove/{menuId}")
@ResponseBody @ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId) public AjaxResult remove(@PathVariable("menuId") Long menuId)
{ {
if (menuService.selectCountMenuByParentId(menuId) > 0) if (menuService.selectCountMenuByParentId(menuId) > 0)
{ {
return AjaxResult.warn("存在子菜单,不允许删除"); return AjaxResult.warn("存在子菜单,不允许删除");
} }
if (menuService.selectCountRoleMenuByMenuId(menuId) > 0) if (menuService.selectCountRoleMenuByMenuId(menuId) > 0)
{ {
return AjaxResult.warn("菜单已分配,不允许删除"); return AjaxResult.warn("菜单已分配,不允许删除");
} }
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.deleteMenuById(menuId)); return toAjax(menuService.deleteMenuById(menuId));
} }
/** /**
* 新增 * 新增
*/ */
@GetMapping("/add/{parentId}") @GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{ {
SysMenu menu = null; SysMenu menu = null;
if (0L != parentId) if (0L != parentId)
{ {
menu = menuService.selectMenuById(parentId); menu = menuService.selectMenuById(parentId);
} }
else else
{ {
menu = new SysMenu(); menu = new SysMenu();
menu.setMenuId(0L); menu.setMenuId(0L);
menu.setMenuName("主目录"); menu.setMenuName("主目录");
} }
mmap.put("menu", menu); mmap.put("menu", menu);
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存菜单 * 新增保存菜单
*/ */
@Log(title = "菜单管理", businessType = BusinessType.INSERT) @Log(title = "菜单管理", businessType = BusinessType.INSERT)
@RequiresPermissions("system:menu:add") @RequiresPermissions("system:menu:add")
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysMenu menu) public AjaxResult addSave(@Validated SysMenu menu)
{ {
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{ {
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} }
menu.setCreateBy(getLoginName()); menu.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.insertMenu(menu)); return toAjax(menuService.insertMenu(menu));
} }
/** /**
* 修改菜单 * 修改菜单
*/ */
@GetMapping("/edit/{menuId}") @GetMapping("/edit/{menuId}")
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap) public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
{ {
mmap.put("menu", menuService.selectMenuById(menuId)); mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存菜单 * 修改保存菜单
*/ */
@Log(title = "菜单管理", businessType = BusinessType.UPDATE) @Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit") @RequiresPermissions("system:menu:edit")
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysMenu menu) public AjaxResult editSave(@Validated SysMenu menu)
{ {
if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) if (UserConstants.MENU_NAME_NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
{ {
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在"); return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} }
menu.setUpdateBy(getLoginName()); menu.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(menuService.updateMenu(menu)); return toAjax(menuService.updateMenu(menu));
} }
/** /**
* 选择菜单图标 * 选择菜单图标
*/ */
@GetMapping("/icon") @GetMapping("/icon")
public String icon() public String icon()
{ {
return prefix + "/icon"; return prefix + "/icon";
} }
/** /**
* 校验菜单名称 * 校验菜单名称
*/ */
@PostMapping("/checkMenuNameUnique") @PostMapping("/checkMenuNameUnique")
@ResponseBody @ResponseBody
public String checkMenuNameUnique(SysMenu menu) public String checkMenuNameUnique(SysMenu menu)
{ {
return menuService.checkMenuNameUnique(menu); return menuService.checkMenuNameUnique(menu);
} }
/** /**
* 加载角色菜单列表树 * 加载角色菜单列表树
*/ */
@GetMapping("/roleMenuTreeData") @GetMapping("/roleMenuTreeData")
@ResponseBody @ResponseBody
public List<Ztree> roleMenuTreeData(SysRole role) public List<Ztree> roleMenuTreeData(SysRole role)
{ {
Long userId = ShiroUtils.getUserId(); Long userId = ShiroUtils.getUserId();
List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId); List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
return ztrees; return ztrees;
} }
/** /**
* 加载所有菜单列表树 * 加载所有菜单列表树
*/ */
@GetMapping("/menuTreeData") @GetMapping("/menuTreeData")
@ResponseBody @ResponseBody
public List<Ztree> menuTreeData() public List<Ztree> menuTreeData()
{ {
Long userId = ShiroUtils.getUserId(); Long userId = ShiroUtils.getUserId();
List<Ztree> ztrees = menuService.menuTreeData(userId); List<Ztree> ztrees = menuService.menuTreeData(userId);
return ztrees; return ztrees;
} }
/** /**
* 选择菜单树 * 选择菜单树
*/ */
@GetMapping("/selectMenuTree/{menuId}") @GetMapping("/selectMenuTree/{menuId}")
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap) public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
{ {
mmap.put("menu", menuService.selectMenuById(menuId)); mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/tree"; return prefix + "/tree";
} }
} }

View File

@ -1,111 +1,111 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService; import com.ruoyi.system.service.ISysNoticeService;
/** /**
* 公告 信息操作处理 * 公告 信息操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/notice") @RequestMapping("/system/notice")
public class SysNoticeController extends BaseController public class SysNoticeController extends BaseController
{ {
private String prefix = "system/notice"; private String prefix = "system/notice";
@Autowired @Autowired
private ISysNoticeService noticeService; private ISysNoticeService noticeService;
@RequiresPermissions("system:notice:view") @RequiresPermissions("system:notice:view")
@GetMapping() @GetMapping()
public String notice() public String notice()
{ {
return prefix + "/notice"; return prefix + "/notice";
} }
/** /**
* 查询公告列表 * 查询公告列表
*/ */
@RequiresPermissions("system:notice:list") @RequiresPermissions("system:notice:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysNotice notice) public TableDataInfo list(SysNotice notice)
{ {
startPage(); startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice); List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 新增公告 * 新增公告
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add()
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存公告 * 新增保存公告
*/ */
@RequiresPermissions("system:notice:add") @RequiresPermissions("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT) @Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(SysNotice notice) public AjaxResult addSave(SysNotice notice)
{ {
notice.setCreateBy(getLoginName()); notice.setCreateBy(getLoginName());
return toAjax(noticeService.insertNotice(notice)); return toAjax(noticeService.insertNotice(notice));
} }
/** /**
* 修改公告 * 修改公告
*/ */
@GetMapping("/edit/{noticeId}") @GetMapping("/edit/{noticeId}")
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap) public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
{ {
mmap.put("notice", noticeService.selectNoticeById(noticeId)); mmap.put("notice", noticeService.selectNoticeById(noticeId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存公告 * 修改保存公告
*/ */
@RequiresPermissions("system:notice:edit") @RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE) @Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(SysNotice notice) public AjaxResult editSave(SysNotice notice)
{ {
notice.setUpdateBy(getLoginName()); notice.setUpdateBy(getLoginName());
return toAjax(noticeService.updateNotice(notice)); return toAjax(noticeService.updateNotice(notice));
} }
/** /**
* 删除公告 * 删除公告
*/ */
@RequiresPermissions("system:notice:remove") @RequiresPermissions("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE) @Log(title = "通知公告", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
return toAjax(noticeService.deleteNoticeByIds(ids)); return toAjax(noticeService.deleteNoticeByIds(ids));
} }
} }

View File

@ -1,162 +1,162 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
/** /**
* 岗位信息操作处理 * 岗位信息操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/post") @RequestMapping("/system/post")
public class SysPostController extends BaseController public class SysPostController extends BaseController
{ {
private String prefix = "system/post"; private String prefix = "system/post";
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@RequiresPermissions("system:post:view") @RequiresPermissions("system:post:view")
@GetMapping() @GetMapping()
public String operlog() public String operlog()
{ {
return prefix + "/post"; return prefix + "/post";
} }
@RequiresPermissions("system:post:list") @RequiresPermissions("system:post:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysPost post) public TableDataInfo list(SysPost post)
{ {
startPage(); startPage();
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "岗位管理", businessType = BusinessType.EXPORT) @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:post:export") @RequiresPermissions("system:post:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysPost post) public AjaxResult export(SysPost post)
{ {
List<SysPost> list = postService.selectPostList(post); List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据"); return util.exportExcel(list, "岗位数据");
} }
@RequiresPermissions("system:post:remove") @RequiresPermissions("system:post:remove")
@Log(title = "岗位管理", businessType = BusinessType.DELETE) @Log(title = "岗位管理", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
try try
{ {
return toAjax(postService.deletePostByIds(ids)); return toAjax(postService.deletePostByIds(ids));
} }
catch (Exception e) catch (Exception e)
{ {
return error(e.getMessage()); return error(e.getMessage());
} }
} }
/** /**
* 新增岗位 * 新增岗位
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add()
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存岗位 * 新增保存岗位
*/ */
@RequiresPermissions("system:post:add") @RequiresPermissions("system:post:add")
@Log(title = "岗位管理", businessType = BusinessType.INSERT) @Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysPost post) public AjaxResult addSave(@Validated SysPost post)
{ {
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{ {
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} }
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{ {
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setCreateBy(getLoginName()); post.setCreateBy(getLoginName());
return toAjax(postService.insertPost(post)); return toAjax(postService.insertPost(post));
} }
/** /**
* 修改岗位 * 修改岗位
*/ */
@GetMapping("/edit/{postId}") @GetMapping("/edit/{postId}")
public String edit(@PathVariable("postId") Long postId, ModelMap mmap) public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
{ {
mmap.put("post", postService.selectPostById(postId)); mmap.put("post", postService.selectPostById(postId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存岗位 * 修改保存岗位
*/ */
@RequiresPermissions("system:post:edit") @RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", businessType = BusinessType.UPDATE) @Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysPost post) public AjaxResult editSave(@Validated SysPost post)
{ {
if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) if (UserConstants.POST_NAME_NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
{ {
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} }
else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) else if (UserConstants.POST_CODE_NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
{ {
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
} }
post.setUpdateBy(getLoginName()); post.setUpdateBy(getLoginName());
return toAjax(postService.updatePost(post)); return toAjax(postService.updatePost(post));
} }
/** /**
* 校验岗位名称 * 校验岗位名称
*/ */
@PostMapping("/checkPostNameUnique") @PostMapping("/checkPostNameUnique")
@ResponseBody @ResponseBody
public String checkPostNameUnique(SysPost post) public String checkPostNameUnique(SysPost post)
{ {
return postService.checkPostNameUnique(post); return postService.checkPostNameUnique(post);
} }
/** /**
* 校验岗位编码 * 校验岗位编码
*/ */
@PostMapping("/checkPostCodeUnique") @PostMapping("/checkPostCodeUnique")
@ResponseBody @ResponseBody
public String checkPostCodeUnique(SysPost post) public String checkPostCodeUnique(SysPost post)
{ {
return postService.checkPostCodeUnique(post); return postService.checkPostCodeUnique(post);
} }
} }

View File

@ -1,187 +1,187 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
/** /**
* 个人信息 业务处理 * 个人信息 业务处理
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/user/profile") @RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController public class SysProfileController extends BaseController
{ {
private static final Logger log = LoggerFactory.getLogger(SysProfileController.class); private static final Logger log = LoggerFactory.getLogger(SysProfileController.class);
private String prefix = "system/user/profile"; private String prefix = "system/user/profile";
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
/** /**
* 个人信息 * 个人信息
*/ */
@GetMapping() @GetMapping()
public String profile(ModelMap mmap) public String profile(ModelMap mmap)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
mmap.put("user", user); mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId())); mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
return prefix + "/profile"; return prefix + "/profile";
} }
@GetMapping("/checkPassword") @GetMapping("/checkPassword")
@ResponseBody @ResponseBody
public boolean checkPassword(String password) public boolean checkPassword(String password)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
if (passwordService.matches(user, password)) if (passwordService.matches(user, password))
{ {
return true; return true;
} }
return false; return false;
} }
@GetMapping("/resetPwd") @GetMapping("/resetPwd")
public String resetPwd(ModelMap mmap) public String resetPwd(ModelMap mmap)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId())); mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/resetPwd"; return prefix + "/resetPwd";
} }
@Log(title = "重置密码", businessType = BusinessType.UPDATE) @Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd") @PostMapping("/resetPwd")
@ResponseBody @ResponseBody
public AjaxResult resetPwd(String oldPassword, String newPassword) public AjaxResult resetPwd(String oldPassword, String newPassword)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
if (!passwordService.matches(user, oldPassword)) if (!passwordService.matches(user, oldPassword))
{ {
return error("修改密码失败,旧密码错误"); return error("修改密码失败,旧密码错误");
} }
if (passwordService.matches(user, newPassword)) if (passwordService.matches(user, newPassword))
{ {
return error("新密码不能与旧密码相同"); return error("新密码不能与旧密码相同");
} }
user.setSalt(ShiroUtils.randomSalt()); user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
user.setPwdUpdateDate(DateUtils.getNowDate()); user.setPwdUpdateDate(DateUtils.getNowDate());
if (userService.resetUserPwd(user) > 0) if (userService.resetUserPwd(user) > 0)
{ {
setSysUser(userService.selectUserById(user.getUserId())); setSysUser(userService.selectUserById(user.getUserId()));
return success(); return success();
} }
return error("修改密码异常,请联系管理员"); return error("修改密码异常,请联系管理员");
} }
/** /**
* 修改用户 * 修改用户
*/ */
@GetMapping("/edit") @GetMapping("/edit")
public String edit(ModelMap mmap) public String edit(ModelMap mmap)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId())); mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改头像 * 修改头像
*/ */
@GetMapping("/avatar") @GetMapping("/avatar")
public String avatar(ModelMap mmap) public String avatar(ModelMap mmap)
{ {
SysUser user = getSysUser(); SysUser user = getSysUser();
mmap.put("user", userService.selectUserById(user.getUserId())); mmap.put("user", userService.selectUserById(user.getUserId()));
return prefix + "/avatar"; return prefix + "/avatar";
} }
/** /**
* 修改用户 * 修改用户
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/update") @PostMapping("/update")
@ResponseBody @ResponseBody
public AjaxResult update(SysUser user) public AjaxResult update(SysUser user)
{ {
SysUser currentUser = getSysUser(); SysUser currentUser = getSysUser();
currentUser.setUserName(user.getUserName()); currentUser.setUserName(user.getUserName());
currentUser.setEmail(user.getEmail()); currentUser.setEmail(user.getEmail());
currentUser.setPhonenumber(user.getPhonenumber()); currentUser.setPhonenumber(user.getPhonenumber());
currentUser.setSex(user.getSex()); currentUser.setSex(user.getSex());
if (StringUtils.isNotEmpty(user.getPhonenumber()) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser))) && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(currentUser)))
{ {
return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在"); return error("修改用户'" + currentUser.getLoginName() + "'失败,手机号码已存在");
} }
else if (StringUtils.isNotEmpty(user.getEmail()) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser))) && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(currentUser)))
{ {
return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在"); return error("修改用户'" + currentUser.getLoginName() + "'失败,邮箱账号已存在");
} }
if (userService.updateUserInfo(currentUser) > 0) if (userService.updateUserInfo(currentUser) > 0)
{ {
setSysUser(userService.selectUserById(currentUser.getUserId())); setSysUser(userService.selectUserById(currentUser.getUserId()));
return success(); return success();
} }
return error(); return error();
} }
/** /**
* 保存头像 * 保存头像
*/ */
@Log(title = "个人信息", businessType = BusinessType.UPDATE) @Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PostMapping("/updateAvatar") @PostMapping("/updateAvatar")
@ResponseBody @ResponseBody
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
{ {
SysUser currentUser = getSysUser(); SysUser currentUser = getSysUser();
try try
{ {
if (!file.isEmpty()) if (!file.isEmpty())
{ {
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file);
currentUser.setAvatar(avatar); currentUser.setAvatar(avatar);
if (userService.updateUserInfo(currentUser) > 0) if (userService.updateUserInfo(currentUser) > 0)
{ {
setSysUser(userService.selectUserById(currentUser.getUserId())); setSysUser(userService.selectUserById(currentUser.getUserId()));
return success(); return success();
} }
} }
return error(); return error();
} }
catch (Exception e) catch (Exception e)
{ {
log.error("修改头像失败!", e); log.error("修改头像失败!", e);
return error(e.getMessage()); return error(e.getMessage());
} }
} }
} }

View File

@ -1,46 +1,46 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.framework.shiro.service.SysRegisterService; import com.ruoyi.framework.shiro.service.SysRegisterService;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
/** /**
* 注册验证 * 注册验证
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
public class SysRegisterController extends BaseController public class SysRegisterController extends BaseController
{ {
@Autowired @Autowired
private SysRegisterService registerService; private SysRegisterService registerService;
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@GetMapping("/register") @GetMapping("/register")
public String register() public String register()
{ {
return "register"; return "register";
} }
@PostMapping("/register") @PostMapping("/register")
@ResponseBody @ResponseBody
public AjaxResult ajaxRegister(SysUser user) public AjaxResult ajaxRegister(SysUser user)
{ {
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
{ {
return error("当前系统没有开启注册功能!"); return error("当前系统没有开启注册功能!");
} }
String msg = registerService.register(user); String msg = registerService.register(user);
return StringUtils.isEmpty(msg) ? success() : error(msg); return StringUtils.isEmpty(msg) ? success() : error(msg);
} }
} }

View File

@ -1,300 +1,300 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.util.AuthorizationUtils; import com.ruoyi.framework.shiro.util.AuthorizationUtils;
import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
/** /**
* 角色信息 * 角色信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/role") @RequestMapping("/system/role")
public class SysRoleController extends BaseController public class SysRoleController extends BaseController
{ {
private String prefix = "system/role"; private String prefix = "system/role";
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@RequiresPermissions("system:role:view") @RequiresPermissions("system:role:view")
@GetMapping() @GetMapping()
public String role() public String role()
{ {
return prefix + "/role"; return prefix + "/role";
} }
@RequiresPermissions("system:role:list") @RequiresPermissions("system:role:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysRole role) public TableDataInfo list(SysRole role)
{ {
startPage(); startPage();
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "角色管理", businessType = BusinessType.EXPORT) @Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:role:export") @RequiresPermissions("system:role:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysRole role) public AjaxResult export(SysRole role)
{ {
List<SysRole> list = roleService.selectRoleList(role); List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
return util.exportExcel(list, "角色数据"); return util.exportExcel(list, "角色数据");
} }
/** /**
* 新增角色 * 新增角色
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() public String add()
{ {
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存角色 * 新增保存角色
*/ */
@RequiresPermissions("system:role:add") @RequiresPermissions("system:role:add")
@Log(title = "角色管理", businessType = BusinessType.INSERT) @Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysRole role) public AjaxResult addSave(@Validated SysRole role)
{ {
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{ {
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} }
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{ {
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setCreateBy(getLoginName()); role.setCreateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.insertRole(role)); return toAjax(roleService.insertRole(role));
} }
/** /**
* 修改角色 * 修改角色
*/ */
@GetMapping("/edit/{roleId}") @GetMapping("/edit/{roleId}")
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap) public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
{ {
mmap.put("role", roleService.selectRoleById(roleId)); mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存角色 * 修改保存角色
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysRole role) public AjaxResult editSave(@Validated SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) if (UserConstants.ROLE_NAME_NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
{ {
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
} }
else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) else if (UserConstants.ROLE_KEY_NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
{ {
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
} }
role.setUpdateBy(getLoginName()); role.setUpdateBy(getLoginName());
AuthorizationUtils.clearAllCachedAuthorizationInfo(); AuthorizationUtils.clearAllCachedAuthorizationInfo();
return toAjax(roleService.updateRole(role)); return toAjax(roleService.updateRole(role));
} }
/** /**
* 角色分配数据权限 * 角色分配数据权限
*/ */
@GetMapping("/authDataScope/{roleId}") @GetMapping("/authDataScope/{roleId}")
public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap) public String authDataScope(@PathVariable("roleId") Long roleId, ModelMap mmap)
{ {
mmap.put("role", roleService.selectRoleById(roleId)); mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/dataScope"; return prefix + "/dataScope";
} }
/** /**
* 保存角色分配数据权限 * 保存角色分配数据权限
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PostMapping("/authDataScope") @PostMapping("/authDataScope")
@ResponseBody @ResponseBody
public AjaxResult authDataScopeSave(SysRole role) public AjaxResult authDataScopeSave(SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
role.setUpdateBy(getLoginName()); role.setUpdateBy(getLoginName());
if (roleService.authDataScope(role) > 0) if (roleService.authDataScope(role) > 0)
{ {
setSysUser(userService.selectUserById(getUserId())); setSysUser(userService.selectUserById(getUserId()));
return success(); return success();
} }
return error(); return error();
} }
@RequiresPermissions("system:role:remove") @RequiresPermissions("system:role:remove")
@Log(title = "角色管理", businessType = BusinessType.DELETE) @Log(title = "角色管理", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
return toAjax(roleService.deleteRoleByIds(ids)); return toAjax(roleService.deleteRoleByIds(ids));
} }
/** /**
* 校验角色名称 * 校验角色名称
*/ */
@PostMapping("/checkRoleNameUnique") @PostMapping("/checkRoleNameUnique")
@ResponseBody @ResponseBody
public String checkRoleNameUnique(SysRole role) public String checkRoleNameUnique(SysRole role)
{ {
return roleService.checkRoleNameUnique(role); return roleService.checkRoleNameUnique(role);
} }
/** /**
* 校验角色权限 * 校验角色权限
*/ */
@PostMapping("/checkRoleKeyUnique") @PostMapping("/checkRoleKeyUnique")
@ResponseBody @ResponseBody
public String checkRoleKeyUnique(SysRole role) public String checkRoleKeyUnique(SysRole role)
{ {
return roleService.checkRoleKeyUnique(role); return roleService.checkRoleKeyUnique(role);
} }
/** /**
* 选择菜单树 * 选择菜单树
*/ */
@GetMapping("/selectMenuTree") @GetMapping("/selectMenuTree")
public String selectMenuTree() public String selectMenuTree()
{ {
return prefix + "/tree"; return prefix + "/tree";
} }
/** /**
* 角色状态修改 * 角色状态修改
*/ */
@Log(title = "角色管理", businessType = BusinessType.UPDATE) @Log(title = "角色管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@PostMapping("/changeStatus") @PostMapping("/changeStatus")
@ResponseBody @ResponseBody
public AjaxResult changeStatus(SysRole role) public AjaxResult changeStatus(SysRole role)
{ {
roleService.checkRoleAllowed(role); roleService.checkRoleAllowed(role);
return toAjax(roleService.changeStatus(role)); return toAjax(roleService.changeStatus(role));
} }
/** /**
* 分配用户 * 分配用户
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@GetMapping("/authUser/{roleId}") @GetMapping("/authUser/{roleId}")
public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap) public String authUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
{ {
mmap.put("role", roleService.selectRoleById(roleId)); mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/authUser"; return prefix + "/authUser";
} }
/** /**
* 查询已分配用户角色列表 * 查询已分配用户角色列表
*/ */
@RequiresPermissions("system:role:list") @RequiresPermissions("system:role:list")
@PostMapping("/authUser/allocatedList") @PostMapping("/authUser/allocatedList")
@ResponseBody @ResponseBody
public TableDataInfo allocatedList(SysUser user) public TableDataInfo allocatedList(SysUser user)
{ {
startPage(); startPage();
List<SysUser> list = userService.selectAllocatedList(user); List<SysUser> list = userService.selectAllocatedList(user);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 取消授权 * 取消授权
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/cancel") @PostMapping("/authUser/cancel")
@ResponseBody @ResponseBody
public AjaxResult cancelAuthUser(SysUserRole userRole) public AjaxResult cancelAuthUser(SysUserRole userRole)
{ {
return toAjax(roleService.deleteAuthUser(userRole)); return toAjax(roleService.deleteAuthUser(userRole));
} }
/** /**
* 批量取消授权 * 批量取消授权
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/cancelAll") @PostMapping("/authUser/cancelAll")
@ResponseBody @ResponseBody
public AjaxResult cancelAuthUserAll(Long roleId, String userIds) public AjaxResult cancelAuthUserAll(Long roleId, String userIds)
{ {
return toAjax(roleService.deleteAuthUsers(roleId, userIds)); return toAjax(roleService.deleteAuthUsers(roleId, userIds));
} }
/** /**
* 选择用户 * 选择用户
*/ */
@GetMapping("/authUser/selectUser/{roleId}") @GetMapping("/authUser/selectUser/{roleId}")
public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap) public String selectUser(@PathVariable("roleId") Long roleId, ModelMap mmap)
{ {
mmap.put("role", roleService.selectRoleById(roleId)); mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/selectUser"; return prefix + "/selectUser";
} }
/** /**
* 查询未分配用户角色列表 * 查询未分配用户角色列表
*/ */
@RequiresPermissions("system:role:list") @RequiresPermissions("system:role:list")
@PostMapping("/authUser/unallocatedList") @PostMapping("/authUser/unallocatedList")
@ResponseBody @ResponseBody
public TableDataInfo unallocatedList(SysUser user) public TableDataInfo unallocatedList(SysUser user)
{ {
startPage(); startPage();
List<SysUser> list = userService.selectUnallocatedList(user); List<SysUser> list = userService.selectUnallocatedList(user);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 批量选择用户授权 * 批量选择用户授权
*/ */
@RequiresPermissions("system:role:edit") @RequiresPermissions("system:role:edit")
@Log(title = "角色管理", businessType = BusinessType.GRANT) @Log(title = "角色管理", businessType = BusinessType.GRANT)
@PostMapping("/authUser/selectAll") @PostMapping("/authUser/selectAll")
@ResponseBody @ResponseBody
public AjaxResult selectAuthUserAll(Long roleId, String userIds) public AjaxResult selectAuthUserAll(Long roleId, String userIds)
{ {
return toAjax(roleService.insertAuthUsers(roleId, userIds)); return toAjax(roleService.insertAuthUsers(roleId, userIds));
} }
} }

View File

@ -1,312 +1,312 @@
package com.ruoyi.web.controller.system; package com.ruoyi.web.controller.system;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole; import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.shiro.service.SysPasswordService;
import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
/** /**
* 用户信息 * 用户信息
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/system/user") @RequestMapping("/system/user")
public class SysUserController extends BaseController public class SysUserController extends BaseController
{ {
private String prefix = "system/user"; private String prefix = "system/user";
@Autowired @Autowired
private ISysUserService userService; private ISysUserService userService;
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@Autowired @Autowired
private SysPasswordService passwordService; private SysPasswordService passwordService;
@Autowired @Autowired
private ISysConfigService configService; private ISysConfigService configService;
@RequiresPermissions("system:user:view") @RequiresPermissions("system:user:view")
@GetMapping() @GetMapping()
public String user() public String user()
{ {
return prefix + "/user"; return prefix + "/user";
} }
@RequiresPermissions("system:user:list") @RequiresPermissions("system:user:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(SysUser user) public TableDataInfo list(SysUser user)
{ {
startPage(); startPage();
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
return getDataTable(list); return getDataTable(list);
} }
@Log(title = "用户管理", businessType = BusinessType.EXPORT) @Log(title = "用户管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("system:user:export") @RequiresPermissions("system:user:export")
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(SysUser user) public AjaxResult export(SysUser user)
{ {
List<SysUser> list = userService.selectUserList(user); List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.exportExcel(list, "用户数据"); return util.exportExcel(list, "用户数据");
} }
@Log(title = "用户管理", businessType = BusinessType.IMPORT) @Log(title = "用户管理", businessType = BusinessType.IMPORT)
@RequiresPermissions("system:user:import") @RequiresPermissions("system:user:import")
@PostMapping("/importData") @PostMapping("/importData")
@ResponseBody @ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream()); List<SysUser> userList = util.importExcel(file.getInputStream());
String message = userService.importUser(userList, updateSupport, getLoginName()); String message = userService.importUser(userList, updateSupport, getLoginName());
return AjaxResult.success(message); return AjaxResult.success(message);
} }
@RequiresPermissions("system:user:view") @RequiresPermissions("system:user:view")
@GetMapping("/importTemplate") @GetMapping("/importTemplate")
@ResponseBody @ResponseBody
public AjaxResult importTemplate() public AjaxResult importTemplate()
{ {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class); ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.importTemplateExcel("用户数据"); return util.importTemplateExcel("用户数据");
} }
/** /**
* 新增用户 * 新增用户
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add(ModelMap mmap) public String add(ModelMap mmap)
{ {
mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); mmap.put("roles", roleService.selectRoleAll().stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
mmap.put("posts", postService.selectPostAll()); mmap.put("posts", postService.selectPostAll());
return prefix + "/add"; return prefix + "/add";
} }
/** /**
* 新增保存用户 * 新增保存用户
*/ */
@RequiresPermissions("system:user:add") @RequiresPermissions("system:user:add")
@Log(title = "用户管理", businessType = BusinessType.INSERT) @Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(@Validated SysUser user) public AjaxResult addSave(@Validated SysUser user)
{ {
if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName()))) if (UserConstants.USER_NAME_NOT_UNIQUE.equals(userService.checkLoginNameUnique(user.getLoginName())))
{ {
return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在"); return error("新增用户'" + user.getLoginName() + "'失败,登录账号已存在");
} }
else if (StringUtils.isNotEmpty(user.getPhonenumber()) else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在"); return error("新增用户'" + user.getLoginName() + "'失败,手机号码已存在");
} }
else if (StringUtils.isNotEmpty(user.getEmail()) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); return error("新增用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
} }
user.setSalt(ShiroUtils.randomSalt()); user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
user.setCreateBy(getLoginName()); user.setCreateBy(getLoginName());
return toAjax(userService.insertUser(user)); return toAjax(userService.insertUser(user));
} }
/** /**
* 修改用户 * 修改用户
*/ */
@GetMapping("/edit/{userId}") @GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Long userId, ModelMap mmap) public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
{ {
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId);
mmap.put("user", userService.selectUserById(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("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
mmap.put("posts", postService.selectPostsByUserId(userId)); mmap.put("posts", postService.selectPostsByUserId(userId));
return prefix + "/edit"; return prefix + "/edit";
} }
/** /**
* 修改保存用户 * 修改保存用户
*/ */
@RequiresPermissions("system:user:edit") @RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
public AjaxResult editSave(@Validated SysUser user) public AjaxResult editSave(@Validated SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
if (StringUtils.isNotEmpty(user.getPhonenumber()) if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) && UserConstants.USER_PHONE_NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
{ {
return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在"); return error("修改用户'" + user.getLoginName() + "'失败,手机号码已存在");
} }
else if (StringUtils.isNotEmpty(user.getEmail()) else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user))) && UserConstants.USER_EMAIL_NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
{ {
return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在"); return error("修改用户'" + user.getLoginName() + "'失败,邮箱账号已存在");
} }
user.setUpdateBy(getLoginName()); user.setUpdateBy(getLoginName());
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
} }
@RequiresPermissions("system:user:resetPwd") @RequiresPermissions("system:user:resetPwd")
@GetMapping("/resetPwd/{userId}") @GetMapping("/resetPwd/{userId}")
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
{ {
mmap.put("user", userService.selectUserById(userId)); mmap.put("user", userService.selectUserById(userId));
return prefix + "/resetPwd"; return prefix + "/resetPwd";
} }
@RequiresPermissions("system:user:resetPwd") @RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", businessType = BusinessType.UPDATE) @Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd") @PostMapping("/resetPwd")
@ResponseBody @ResponseBody
public AjaxResult resetPwdSave(SysUser user) public AjaxResult resetPwdSave(SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
user.setSalt(ShiroUtils.randomSalt()); user.setSalt(ShiroUtils.randomSalt());
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt())); user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
if (userService.resetUserPwd(user) > 0) if (userService.resetUserPwd(user) > 0)
{ {
if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue()) if (ShiroUtils.getUserId().longValue() == user.getUserId().longValue())
{ {
setSysUser(userService.selectUserById(user.getUserId())); setSysUser(userService.selectUserById(user.getUserId()));
} }
return success(); return success();
} }
return error(); return error();
} }
/** /**
* 进入授权角色页 * 进入授权角色页
*/ */
@GetMapping("/authRole/{userId}") @GetMapping("/authRole/{userId}")
public String authRole(@PathVariable("userId") Long userId, ModelMap mmap) public String authRole(@PathVariable("userId") Long userId, ModelMap mmap)
{ {
SysUser user = userService.selectUserById(userId); SysUser user = userService.selectUserById(userId);
// 获取用户所属的角色列表 // 获取用户所属的角色列表
List<SysRole> roles = roleService.selectRolesByUserId(userId); List<SysRole> roles = roleService.selectRolesByUserId(userId);
mmap.put("user", user); mmap.put("user", user);
mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); mmap.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
return prefix + "/authRole"; return prefix + "/authRole";
} }
/** /**
* 用户授权角色 * 用户授权角色
*/ */
@RequiresPermissions("system:user:edit") @RequiresPermissions("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.GRANT) @Log(title = "用户管理", businessType = BusinessType.GRANT)
@PostMapping("/authRole/insertAuthRole") @PostMapping("/authRole/insertAuthRole")
@ResponseBody @ResponseBody
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) public AjaxResult insertAuthRole(Long userId, Long[] roleIds)
{ {
userService.insertUserAuth(userId, roleIds); userService.insertUserAuth(userId, roleIds);
return success(); return success();
} }
@RequiresPermissions("system:user:remove") @RequiresPermissions("system:user:remove")
@Log(title = "用户管理", businessType = BusinessType.DELETE) @Log(title = "用户管理", businessType = BusinessType.DELETE)
@PostMapping("/remove") @PostMapping("/remove")
@ResponseBody @ResponseBody
public AjaxResult remove(String ids) public AjaxResult remove(String ids)
{ {
if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId())) if (ArrayUtils.contains(Convert.toLongArray(ids), getUserId()))
{ {
return error("当前用户不能删除"); return error("当前用户不能删除");
} }
return toAjax(userService.deleteUserByIds(ids)); return toAjax(userService.deleteUserByIds(ids));
} }
/** /**
* 校验用户名 * 校验用户名
*/ */
@PostMapping("/checkLoginNameUnique") @PostMapping("/checkLoginNameUnique")
@ResponseBody @ResponseBody
public String checkLoginNameUnique(SysUser user) public String checkLoginNameUnique(SysUser user)
{ {
return userService.checkLoginNameUnique(user.getLoginName()); return userService.checkLoginNameUnique(user.getLoginName());
} }
/** /**
* 校验手机号码 * 校验手机号码
*/ */
@PostMapping("/checkPhoneUnique") @PostMapping("/checkPhoneUnique")
@ResponseBody @ResponseBody
public String checkPhoneUnique(SysUser user) public String checkPhoneUnique(SysUser user)
{ {
return userService.checkPhoneUnique(user); return userService.checkPhoneUnique(user);
} }
/** /**
* 校验email邮箱 * 校验email邮箱
*/ */
@PostMapping("/checkEmailUnique") @PostMapping("/checkEmailUnique")
@ResponseBody @ResponseBody
public String checkEmailUnique(SysUser user) public String checkEmailUnique(SysUser user)
{ {
return userService.checkEmailUnique(user); return userService.checkEmailUnique(user);
} }
/** /**
* 用户状态修改 * 用户状态修改
*/ */
@Log(title = "用户管理", businessType = BusinessType.UPDATE) @Log(title = "用户管理", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:user:edit") @RequiresPermissions("system:user:edit")
@PostMapping("/changeStatus") @PostMapping("/changeStatus")
@ResponseBody @ResponseBody
public AjaxResult changeStatus(SysUser user) public AjaxResult changeStatus(SysUser user)
{ {
userService.checkUserAllowed(user); userService.checkUserAllowed(user);
return toAjax(userService.changeStatus(user)); return toAjax(userService.changeStatus(user));
} }
/** /**
* Ecology人员信息同步 * Ecology人员信息同步
*/ */
@Log(title = "人员同步", businessType = BusinessType.UPDATE) @Log(title = "人员同步", businessType = BusinessType.UPDATE)
@RequiresPermissions("system:user:sync") @RequiresPermissions("system:user:sync")
@PostMapping("/syncUser") @PostMapping("/syncUser")
@ResponseBody @ResponseBody
public AjaxResult syncUser() { public AjaxResult syncUser() {
String url = "http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage"; String url = "http://192.168.2.85:90/api/hrm/resful/getHrmUserInfoWithPage";
String params = "{\"params\":{\"pagesize\":999999}}"; String params = "{\"params\":{\"pagesize\":999999}}";
return userService.syncEcologyUser(url, params); return userService.syncEcologyUser(url, params);
} }
} }

View File

@ -1,26 +1,26 @@
package com.ruoyi.web.controller.tool; package com.ruoyi.web.controller.tool;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
/** /**
* build 表单构建 * build 表单构建
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/tool/build") @RequestMapping("/tool/build")
public class BuildController extends BaseController public class BuildController extends BaseController
{ {
private String prefix = "tool/build"; private String prefix = "tool/build";
@RequiresPermissions("tool:build:view") @RequiresPermissions("tool:build:view")
@GetMapping() @GetMapping()
public String build() public String build()
{ {
return prefix + "/build"; return prefix + "/build";
} }
} }

View File

@ -1,24 +1,24 @@
package com.ruoyi.web.controller.tool; package com.ruoyi.web.controller.tool;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
/** /**
* swagger 接口 * swagger 接口
* *
* @author ruoyi * @author ruoyi
*/ */
@Controller @Controller
@RequestMapping("/tool/swagger") @RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController public class SwaggerController extends BaseController
{ {
@RequiresPermissions("tool:swagger:view") @RequiresPermissions("tool:swagger:view")
@GetMapping() @GetMapping()
public String index() public String index()
{ {
return redirect("/swagger-ui/index.html"); return redirect("/swagger-ui/index.html");
} }
} }

View File

@ -1,181 +1,181 @@
package com.ruoyi.web.controller.tool; package com.ruoyi.web.controller.tool;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
/** /**
* swagger 用户测试方法 * swagger 用户测试方法
* *
* @author ruoyi * @author ruoyi
*/ */
@Api("用户信息管理") @Api("用户信息管理")
@RestController @RestController
@RequestMapping("/test/user") @RequestMapping("/test/user")
public class TestController extends BaseController public class TestController extends BaseController
{ {
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>(); private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{ {
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888")); users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666")); users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
} }
@ApiOperation("获取用户列表") @ApiOperation("获取用户列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult userList() public AjaxResult userList()
{ {
List<UserEntity> userList = new ArrayList<UserEntity>(users.values()); List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList); return AjaxResult.success(userList);
} }
@ApiOperation("获取用户详细") @ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path",dataTypeClass = Integer.class ) @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path",dataTypeClass = Integer.class )
@GetMapping("/{userId}") @GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId) public AjaxResult getUser(@PathVariable Integer userId)
{ {
if (!users.isEmpty() && users.containsKey(userId)) if (!users.isEmpty() && users.containsKey(userId))
{ {
return AjaxResult.success(users.get(userId)); return AjaxResult.success(users.get(userId));
} }
else else
{ {
return error("用户不存在"); return error("用户不存在");
} }
} }
@ApiOperation("新增用户") @ApiOperation("新增用户")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
@ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class) @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
}) })
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(UserEntity user) public AjaxResult save(UserEntity user)
{ {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{ {
return error("用户ID不能为空"); return error("用户ID不能为空");
} }
return AjaxResult.success(users.put(user.getUserId(), user)); return AjaxResult.success(users.put(user.getUserId(), user));
} }
@ApiOperation("更新用户") @ApiOperation("更新用户")
@PutMapping("/update") @PutMapping("/update")
public AjaxResult update(@RequestBody UserEntity user) public AjaxResult update(@RequestBody UserEntity user)
{ {
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{ {
return error("用户ID不能为空"); return error("用户ID不能为空");
} }
if (users.isEmpty() || !users.containsKey(user.getUserId())) if (users.isEmpty() || !users.containsKey(user.getUserId()))
{ {
return error("用户不存在"); return error("用户不存在");
} }
users.remove(user.getUserId()); users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user)); return AjaxResult.success(users.put(user.getUserId(), user));
} }
@ApiOperation("删除用户信息") @ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
@DeleteMapping("/{userId}") @DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId) public AjaxResult delete(@PathVariable Integer userId)
{ {
if (!users.isEmpty() && users.containsKey(userId)) if (!users.isEmpty() && users.containsKey(userId))
{ {
users.remove(userId); users.remove(userId);
return success(); return success();
} }
else else
{ {
return error("用户不存在"); return error("用户不存在");
} }
} }
} }
@ApiModel(value = "UserEntity", description = "用户实体") @ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity class UserEntity
{ {
@ApiModelProperty("用户ID") @ApiModelProperty("用户ID")
private Integer userId; private Integer userId;
@ApiModelProperty("用户名称") @ApiModelProperty("用户名称")
private String username; private String username;
@ApiModelProperty("用户密码") @ApiModelProperty("用户密码")
private String password; private String password;
@ApiModelProperty("用户手机") @ApiModelProperty("用户手机")
private String mobile; private String mobile;
public UserEntity() public UserEntity()
{ {
} }
public UserEntity(Integer userId, String username, String password, String mobile) public UserEntity(Integer userId, String username, String password, String mobile)
{ {
this.userId = userId; this.userId = userId;
this.username = username; this.username = username;
this.password = password; this.password = password;
this.mobile = mobile; this.mobile = mobile;
} }
public Integer getUserId() public Integer getUserId()
{ {
return userId; return userId;
} }
public void setUserId(Integer userId) public void setUserId(Integer userId)
{ {
this.userId = userId; this.userId = userId;
} }
public String getUsername() public String getUsername()
{ {
return username; return username;
} }
public void setUsername(String username) public void setUsername(String username)
{ {
this.username = username; this.username = username;
} }
public String getPassword() public String getPassword()
{ {
return password; return password;
} }
public void setPassword(String password) public void setPassword(String password)
{ {
this.password = password; this.password = password;
} }
public String getMobile() public String getMobile()
{ {
return mobile; return mobile;
} }
public void setMobile(String mobile) public void setMobile(String mobile)
{ {
this.mobile = mobile; this.mobile = mobile;
} }
} }

View File

@ -1,67 +1,67 @@
package com.ruoyi.web.core.config; package com.ruoyi.web.core.config;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact; import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
/** /**
* Swagger2的接口配置 * Swagger2的接口配置
* *
* @author ruoyi * @author ruoyi
*/ */
@Configuration @Configuration
public class SwaggerConfig public class SwaggerConfig
{ {
/** 是否开启swagger */ /** 是否开启swagger */
@Value("${swagger.enabled}") @Value("${swagger.enabled}")
private boolean enabled; private boolean enabled;
/** /**
* 创建API * 创建API
*/ */
@Bean @Bean
public Docket createRestApi() public Docket createRestApi()
{ {
return new Docket(DocumentationType.OAS_30) return new Docket(DocumentationType.OAS_30)
// 是否启用Swagger // 是否启用Swagger
.enable(enabled) .enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息 // 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo()) .apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示 // 设置哪些接口暴露给Swagger展示
.select() .select()
// 扫描所有有注解的api用这种方式更灵活 // 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解 // 扫描指定包中的swagger注解
//.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger")) //.apis(RequestHandlerSelectors.basePackage("com.ruoyi.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any()) // 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build(); .build();
} }
/** /**
* 添加摘要信息 * 添加摘要信息
*/ */
private ApiInfo apiInfo() private ApiInfo apiInfo()
{ {
// 用ApiInfoBuilder进行定制 // 用ApiInfoBuilder进行定制
return new ApiInfoBuilder() return new ApiInfoBuilder()
// 设置标题 // 设置标题
.title("BPS管理系统_接口文档") .title("BPS管理系统_接口文档")
// 描述 // 描述
.description("描述:用于管理系统的各类接口的文档说明。") .description("描述:用于管理系统的各类接口的文档说明。")
// 作者信息 // 作者信息
.contact(new Contact(RuoYiConfig.getName(), null, null)) .contact(new Contact(RuoYiConfig.getName(), null, null))
// 版本 // 版本
.version("版本号:" + RuoYiConfig.getVersion()) .version("版本号:" + RuoYiConfig.getVersion())
.build(); .build();
} }
} }

View File

@ -1,85 +0,0 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
#driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.2.18:3306/bps?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: abc.123
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:oracle:thin:@192.168.2.91:1521/toptest
username: ds7
password: ds7
driverClassName: oracle.jdbc.OracleDriver
#SQlServer数据源
sqlsvr:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:sqlserver://192.168.2.84:1433;SelectMethod=cursor;DatabaseName=ITDemo
username: sa
password: abc.123
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# Topprod_ds_report
topproddsreport:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:oracle:thin:@192.168.2.91:1521/topprod
username: ds_report
password: ds_report
driverClassName: oracle.jdbc.OracleDriver
# Toptest_ds_report
toptestdsreport:
# 从数据源开关/默认关闭
enabled: true
url: jdbc:oracle:thin:@192.168.2.91:1521/toptest
username: ds_report
password: ds_report
driverClassName: oracle.jdbc.OracleDriver
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: admin
login-password: bps2019
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -1,197 +1,197 @@
# 项目相关配置 # 项目相关配置
ruoyi: ruoyi:
# 名称 # 名称
name: RuoYi name: RuoYi
# 版本 # 版本
version: 4.6.2 version: 4.6.2
# 版权年份 # 版权年份
copyrightYear: 2021 copyrightYear: 2021
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: C:/bps-it/uploadPath profile: C:/bps-it/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为80 # 服务器的HTTP端口默认为80
port: 80 port: 80
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: /it_war context-path: /it_war
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8
# tomcat最大线程数默认为200 # tomcat最大线程数默认为200
max-threads: 800 max-threads: 800
# Tomcat启动初始化的线程数默认值25 # Tomcat启动初始化的线程数默认值25
min-spare-threads: 30 min-spare-threads: 30
# 日志配置 # 日志配置
logging: logging:
level: level:
com.ruoyi: debug com.ruoyi: debug
org.springframework: warn org.springframework: warn
# 用户配置 # 用户配置
user: user:
password: password:
# 密码错误{maxRetryCount}次锁定10分钟 # 密码错误{maxRetryCount}次锁定10分钟
maxRetryCount: 5 maxRetryCount: 5
# Spring配置 # Spring配置
spring: spring:
# 模板引擎 # 模板引擎
thymeleaf: thymeleaf:
mode: HTML mode: HTML
encoding: utf-8 encoding: utf-8
# 禁用缓存 # 禁用缓存
cache: false cache: false
# 资源信息 # 资源信息
messages: messages:
# 国际化资源文件路径 # 国际化资源文件路径
basename: static/i18n/messages basename: static/i18n/messages
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
profiles: profiles:
active: druid active: druid
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 10MB max-file-size: 10MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 20MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
# 热部署开关 # 热部署开关
enabled: true enabled: true
#ldap #ldap
ldap: ldap:
urls: ldap://192.168.2.10:389 urls: ldap://192.168.2.10:389
base: OU=bp,DC=bpsemi,DC=com base: OU=bp,DC=bpsemi,DC=com
username: administrator@bpsemi.com username: administrator@bpsemi.com
password: Bps@2831! password: Bps@2831!
redis: redis:
host: 192.168.2.88 host: 192.168.2.88
port: 6379 port: 6379
password: "bpsemi2021" password: "bpsemi2021"
timeout: 30000 timeout: 30000
database: 2 database: 2
lettuce: lettuce:
pool: pool:
max-active: 100 max-active: 100
max-idle: 10 max-idle: 10
min-idle: 0 min-idle: 0
max-wait: 30000 max-wait: 30000
cluster: cluster:
refresh: refresh:
adaptive: true adaptive: true
#20秒自动刷新一次 #20秒自动刷新一次
period: 20 period: 20
# MyBatis # MyBatis
mybatis: mybatis:
# 搜索指定包别名 # 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件 # 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件 # 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件 # PageHelper分页插件
pagehelper: pagehelper:
helperDialect: mysql helperDialect: mysql
supportMethodsArguments: true supportMethodsArguments: true
params: count=countSql params: count=countSql
# Shiro # Shiro
shiro: shiro:
user: user:
# 登录地址 # 登录地址
loginUrl: /login loginUrl: /login
# 权限认证失败地址 # 权限认证失败地址
unauthorizedUrl: /unauth unauthorizedUrl: /unauth
# 首页地址 # 首页地址
indexUrl: /index indexUrl: /index
# 验证码开关 # 验证码开关
captchaEnabled: false captchaEnabled: false
# 验证码类型 math 数组计算 char 字符 # 验证码类型 math 数组计算 char 字符
captchaType: math captchaType: math
cookie: cookie:
# 设置Cookie的域名 默认空,即当前访问的域名 # 设置Cookie的域名 默认空,即当前访问的域名
domain: domain:
# 设置cookie的有效访问路径 # 设置cookie的有效访问路径
path: / path: /
# 设置HttpOnly属性 # 设置HttpOnly属性
httpOnly: true httpOnly: true
# 设置Cookie的过期时间天为单位 # 设置Cookie的过期时间天为单位
maxAge: 30 maxAge: 30
# 设置密钥务必保持唯一性生成方式直接拷贝到main运行即可Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) 默认启动生成随机秘钥随机秘钥会导致之前客户端RememberMe Cookie无效如设置固定秘钥RememberMe Cookie则有效 # 设置密钥务必保持唯一性生成方式直接拷贝到main运行即可Base64.encodeToString(CipherUtils.generateNewKey(128, "AES").getEncoded()) 默认启动生成随机秘钥随机秘钥会导致之前客户端RememberMe Cookie无效如设置固定秘钥RememberMe Cookie则有效
cipherKey: cipherKey:
session: session:
# Session超时时间-1代表永不过期默认30分钟 # Session超时时间-1代表永不过期默认30分钟
expireTime: 30 expireTime: 30
# 同步session到数据库的周期默认1分钟 # 同步session到数据库的周期默认1分钟
dbSyncPeriod: 1 dbSyncPeriod: 1
# 相隔多久检查一次session的有效性默认就是10分钟 # 相隔多久检查一次session的有效性默认就是10分钟
validationInterval: 10 validationInterval: 10
# 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制 # 同一个用户最大会话数比如2的意思是同一个账号允许最多同时两个人登录默认-1不限制
maxSession: -1 maxSession: -1
# 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户 # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
kickoutAfter: false kickoutAfter: false
rememberMe: rememberMe:
# 是否开启记住我 # 是否开启记住我
enabled: true enabled: true
# 防止XSS攻击 # 防止XSS攻击
xss: xss:
# 过滤开关 # 过滤开关
enabled: true enabled: true
# 排除链接(多个用逗号分隔) # 排除链接(多个用逗号分隔)
excludes: /system/notice/* excludes: /system/notice/*
# 匹配链接 # 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/* urlPatterns: /system/*,/monitor/*,/tool/*
# Swagger配置 # Swagger配置
swagger: swagger:
# 是否开启swagger # 是否开启swagger
enabled: true enabled: true
#企业微信 #企业微信
wechat: wechat:
corpId: ww4ed3771457e5f463 corpId: ww4ed3771457e5f463
agentId: 1000082 agentId: 1000082
secret: PqTYlveYQc54T13QS-cDyuAesDaGgyMSgpZLXBNJ-Uc secret: PqTYlveYQc54T13QS-cDyuAesDaGgyMSgpZLXBNJ-Uc
token: 111 token: 111
aesKey: 111 aesKey: 111
#快递100 #快递100
express: express:
#快递100的基础账号信息可以在这里获取 #快递100的基础账号信息可以在这里获取
# https://poll.kuaidi100.com/manager/page/myinfo/enterprise # https://poll.kuaidi100.com/manager/page/myinfo/enterprise
key: kzuyKyAE3985 key: kzuyKyAE3985
customer: 6774D6F41D773B17027EEBE5CC902C9E customer: 6774D6F41D773B17027EEBE5CC902C9E
secret: 4fc7633a027c4fe1a68b68237c236d6e secret: 4fc7633a027c4fe1a68b68237c236d6e
userid: bfc0389a986f45c4b36e27d9b18b7bd3 userid: bfc0389a986f45c4b36e27d9b18b7bd3
#电子面单快递公司账号信息(非必填) #电子面单快递公司账号信息(非必填)
partnerId: partnerId:
partnerKey: partnerKey:
net: net:
siid: siid:
#短信模板id非必填 #短信模板id非必填
tid: tid:
#云平台相关(非必填) #云平台相关(非必填)
#登录云平台 https://cloud.kuaidi100.com/buyer/user/info #登录云平台 https://cloud.kuaidi100.com/buyer/user/info
secret_key: secret_key:
secret_secret: secret_secret:
#TOPGP Webservice #TOPGP Webservice
topgp: topgp:
webservice: webservice:
topprod: http://192.168.2.81:85/web/ws/r/aws_ttsrv2 topprod: http://192.168.2.81:85/web/ws/r/aws_ttsrv2
toptest: http://192.168.2.81:85/web/ws/r/aws_ttsrv2_toptest toptest: http://192.168.2.81:85/web/ws/r/aws_ttsrv2_toptest

View File

@ -1,24 +1,24 @@
Application Version: ${ruoyi.version} Application Version: ${ruoyi.version}
Spring Boot Version: ${spring-boot.version} Spring Boot Version: ${spring-boot.version}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// _ooOoo_ // // _ooOoo_ //
// o8888888o // // o8888888o //
// 88" . "88 // // 88" . "88 //
// (| ^_^ |) // // (| ^_^ |) //
// O\ = /O // // O\ = /O //
// ____/`---'\____ // // ____/`---'\____ //
// .' \\| |// `. // // .' \\| |// `. //
// / \\||| : |||// \ // // / \\||| : |||// \ //
// / _||||| -:- |||||- \ // // / _||||| -:- |||||- \ //
// | | \\\ - /// | | // // | | \\\ - /// | | //
// | \_| ''\---/'' | | // // | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / // // \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ // // ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". // // ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | // // | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / // // \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== // // ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' // // `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG // // 佛祖保佑 永不宕机 永无BUG //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

View File

@ -1,91 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ehcache name="ruoyi" updateCheck="false"> <ehcache name="ruoyi" updateCheck="false">
<!-- 磁盘缓存位置 --> <!-- 磁盘缓存位置 -->
<diskStore path="java.io.tmpdir"/> <diskStore path="java.io.tmpdir"/>
<!-- maxEntriesLocalHeap:堆内存中最大缓存对象数0没有限制 --> <!-- maxEntriesLocalHeap:堆内存中最大缓存对象数0没有限制 -->
<!-- maxElementsInMemory 在内存中缓存的element的最大数目。--> <!-- maxElementsInMemory 在内存中缓存的element的最大数目。-->
<!-- eternal:elements是否永久有效如果为truetimeouts将被忽略element将永不过期 --> <!-- eternal:elements是否永久有效如果为truetimeouts将被忽略element将永不过期 -->
<!-- timeToIdleSeconds:失效前的空闲秒数当eternal为false时这个属性才有效0为不限制 --> <!-- timeToIdleSeconds:失效前的空闲秒数当eternal为false时这个属性才有效0为不限制 -->
<!-- timeToLiveSeconds:失效前的存活秒数创建时间到失效时间的间隔为存活时间当eternal为false时这个属性才有效0为不限制 --> <!-- timeToLiveSeconds:失效前的存活秒数创建时间到失效时间的间隔为存活时间当eternal为false时这个属性才有效0为不限制 -->
<!-- overflowToDisk 如果内存中数据超过内存限制,是否要缓存到磁盘上 --> <!-- overflowToDisk 如果内存中数据超过内存限制,是否要缓存到磁盘上 -->
<!-- statistics是否收集统计信息。如果需要监控缓存使用情况应该打开这个选项。默认为关闭统计会影响性能。设置statistics="true"开启统计 --> <!-- statistics是否收集统计信息。如果需要监控缓存使用情况应该打开这个选项。默认为关闭统计会影响性能。设置statistics="true"开启统计 -->
<!-- 默认缓存 --> <!-- 默认缓存 -->
<defaultCache <defaultCache
maxEntriesLocalHeap="1000" maxEntriesLocalHeap="1000"
eternal="false" eternal="false"
timeToIdleSeconds="3600" timeToIdleSeconds="3600"
timeToLiveSeconds="3600" timeToLiveSeconds="3600"
overflowToDisk="false"> overflowToDisk="false">
</defaultCache> </defaultCache>
<!-- 登录记录缓存 锁定10分钟 --> <!-- 登录记录缓存 锁定10分钟 -->
<cache name="loginRecordCache" <cache name="loginRecordCache"
maxEntriesLocalHeap="2000" maxEntriesLocalHeap="2000"
eternal="false" eternal="false"
timeToIdleSeconds="600" timeToIdleSeconds="600"
timeToLiveSeconds="0" timeToLiveSeconds="0"
overflowToDisk="false" overflowToDisk="false"
statistics="false"> statistics="false">
</cache> </cache>
<!-- 系统活跃用户缓存 --> <!-- 系统活跃用户缓存 -->
<cache name="sys-userCache" <cache name="sys-userCache"
maxEntriesLocalHeap="10000" maxEntriesLocalHeap="10000"
overflowToDisk="false" overflowToDisk="false"
eternal="false" eternal="false"
diskPersistent="false" diskPersistent="false"
timeToLiveSeconds="0" timeToLiveSeconds="0"
timeToIdleSeconds="0" timeToIdleSeconds="0"
statistics="false"> statistics="false">
</cache> </cache>
<!-- 系统用户授权缓存 没必要过期 --> <!-- 系统用户授权缓存 没必要过期 -->
<cache name="sys-authCache" <cache name="sys-authCache"
maxEntriesLocalHeap="10000" maxEntriesLocalHeap="10000"
overflowToDisk="false" overflowToDisk="false"
eternal="false" eternal="false"
diskPersistent="false" diskPersistent="false"
timeToLiveSeconds="0" timeToLiveSeconds="0"
timeToIdleSeconds="0" timeToIdleSeconds="0"
memoryStoreEvictionPolicy="LRU" memoryStoreEvictionPolicy="LRU"
statistics="false"/> statistics="false"/>
<!-- 系统缓存 --> <!-- 系统缓存 -->
<cache name="sys-cache" <cache name="sys-cache"
maxEntriesLocalHeap="1000" maxEntriesLocalHeap="1000"
eternal="true" eternal="true"
overflowToDisk="true" overflowToDisk="true"
statistics="false"> statistics="false">
</cache> </cache>
<!-- 系统参数缓存 --> <!-- 系统参数缓存 -->
<cache name="sys-config" <cache name="sys-config"
maxEntriesLocalHeap="1000" maxEntriesLocalHeap="1000"
eternal="true" eternal="true"
overflowToDisk="true" overflowToDisk="true"
statistics="false"> statistics="false">
</cache> </cache>
<!-- 系统字典缓存 --> <!-- 系统字典缓存 -->
<cache name="sys-dict" <cache name="sys-dict"
maxEntriesLocalHeap="1000" maxEntriesLocalHeap="1000"
eternal="true" eternal="true"
overflowToDisk="true" overflowToDisk="true"
statistics="false"> statistics="false">
</cache> </cache>
<!-- 系统会话缓存 --> <!-- 系统会话缓存 -->
<cache name="shiro-activeSessionCache" <cache name="shiro-activeSessionCache"
maxEntriesLocalHeap="10000" maxEntriesLocalHeap="10000"
overflowToDisk="false" overflowToDisk="false"
eternal="false" eternal="false"
diskPersistent="false" diskPersistent="false"
timeToLiveSeconds="0" timeToLiveSeconds="0"
timeToIdleSeconds="0" timeToIdleSeconds="0"
statistics="false"/> statistics="false"/>
</ehcache> </ehcache>

View File

@ -1,93 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration> <configuration>
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="C:/it_war_log/logs" /> <property name="log.path" value="C:/it_war_log/logs" />
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" /> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 --> <!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统日志输出 --> <!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file> <file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>INFO</level> <level>INFO</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file> <file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 --> <!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>ERROR</level> <level>ERROR</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
</filter> </filter>
</appender> </appender>
<!-- 用户访问日志输出 --> <!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file> <file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily --> <!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern> <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 --> <!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory> <maxHistory>60</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern>${log.pattern}</pattern> <pattern>${log.pattern}</pattern>
</encoder> </encoder>
</appender> </appender>
<!-- 系统模块日志级别控制 --> <!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" /> <logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 --> <!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" /> <logger name="org.springframework" level="warn" />
<root level="info"> <root level="info">
<appender-ref ref="console" /> <appender-ref ref="console" />
</root> </root>
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info" /> <appender-ref ref="file_info" />
<appender-ref ref="file_error" /> <appender-ref ref="file_error" />
</root> </root>
<!--系统用户操作日志--> <!--系统用户操作日志-->
<logger name="sys-user" level="info"> <logger name="sys-user" level="info">
<appender-ref ref="sys-user"/> <appender-ref ref="sys-user"/>
</logger> </logger>
</configuration> </configuration>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,10 @@
/*! /*!
* Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select) * Bootstrap-select v1.13.10 (https://developer.snapappointments.com/bootstrap-select)
* *
* Copyright 2012-2019 SnapAppointments, LLC * Copyright 2012-2019 SnapAppointments, LLC
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE) * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
*/ */
select.bs-select-hidden, select.bs-select-hidden,
.bootstrap-select > select.bs-select-hidden, .bootstrap-select > select.bs-select-hidden,
select.selectpicker { select.selectpicker {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,93 +1,93 @@
/** /**
* @author: Alec Fenichel * @author: Alec Fenichel
* @webSite: https://fenichelar.com * @webSite: https://fenichelar.com
* @update: zhixin wen <wenzhixin2010@gmail.com> * @update: zhixin wen <wenzhixin2010@gmail.com>
*/ */
const Utils = $.fn.bootstrapTable.utils const Utils = $.fn.bootstrapTable.utils
$.extend($.fn.bootstrapTable.defaults, { $.extend($.fn.bootstrapTable.defaults, {
autoRefresh: false, autoRefresh: false,
autoRefreshInterval: 60, autoRefreshInterval: 60,
autoRefreshSilent: true, autoRefreshSilent: true,
autoRefreshStatus: true, autoRefreshStatus: true,
autoRefreshFunction: null autoRefreshFunction: null
}) })
$.extend($.fn.bootstrapTable.defaults.icons, { $.extend($.fn.bootstrapTable.defaults.icons, {
autoRefresh: { autoRefresh: {
bootstrap3: 'glyphicon-time icon-time', bootstrap3: 'glyphicon-time icon-time',
materialize: 'access_time', materialize: 'access_time',
'bootstrap-table': 'icon-clock' 'bootstrap-table': 'icon-clock'
}[$.fn.bootstrapTable.theme] || 'fa-clock' }[$.fn.bootstrapTable.theme] || 'fa-clock'
}) })
$.extend($.fn.bootstrapTable.locales, { $.extend($.fn.bootstrapTable.locales, {
formatAutoRefresh () { formatAutoRefresh () {
return 'Auto Refresh' return 'Auto Refresh'
} }
}) })
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales) $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
$.BootstrapTable = class extends $.BootstrapTable { $.BootstrapTable = class extends $.BootstrapTable {
init (...args) { init (...args) {
super.init(...args) super.init(...args)
if (this.options.autoRefresh && this.options.autoRefreshStatus) { if (this.options.autoRefresh && this.options.autoRefreshStatus) {
this.setupRefreshInterval() this.setupRefreshInterval()
} }
} }
initToolbar (...args) { initToolbar (...args) {
if (this.options.autoRefresh) { if (this.options.autoRefresh) {
this.buttons = Object.assign(this.buttons, { this.buttons = Object.assign(this.buttons, {
autoRefresh: { autoRefresh: {
html: ` html: `
<button class="auto-refresh ${this.constants.buttonsClass} <button class="auto-refresh ${this.constants.buttonsClass}
${this.options.autoRefreshStatus ? ` ${this.constants.classes.buttonActive}` : ''}" ${this.options.autoRefreshStatus ? ` ${this.constants.classes.buttonActive}` : ''}"
type="button" name="autoRefresh" title="${this.options.formatAutoRefresh()}"> type="button" name="autoRefresh" title="${this.options.formatAutoRefresh()}">
${ this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''} ${ this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''}
${ this.options.showButtonText ? this.options.formatAutoRefresh() : ''} ${ this.options.showButtonText ? this.options.formatAutoRefresh() : ''}
</button> </button>
`, `,
event: this.toggleAutoRefresh event: this.toggleAutoRefresh
} }
}) })
} }
super.initToolbar(...args) super.initToolbar(...args)
} }
toggleAutoRefresh () { toggleAutoRefresh () {
if (this.options.autoRefresh) { if (this.options.autoRefresh) {
if (this.options.autoRefreshStatus) { if (this.options.autoRefreshStatus) {
clearInterval(this.options.autoRefreshFunction) clearInterval(this.options.autoRefreshFunction)
this.$toolbar.find('>.columns .auto-refresh') this.$toolbar.find('>.columns .auto-refresh')
.removeClass(this.constants.classes.buttonActive) .removeClass(this.constants.classes.buttonActive)
} else { } else {
this.setupRefreshInterval() this.setupRefreshInterval()
this.$toolbar.find('>.columns .auto-refresh') this.$toolbar.find('>.columns .auto-refresh')
.addClass(this.constants.classes.buttonActive) .addClass(this.constants.classes.buttonActive)
} }
this.options.autoRefreshStatus = !this.options.autoRefreshStatus this.options.autoRefreshStatus = !this.options.autoRefreshStatus
} }
} }
destroy () { destroy () {
if (this.options.autoRefresh && this.options.autoRefreshStatus) { if (this.options.autoRefresh && this.options.autoRefreshStatus) {
clearInterval(this.options.autoRefreshFunction) clearInterval(this.options.autoRefreshFunction)
} }
super.destroy() super.destroy()
} }
setupRefreshInterval () { setupRefreshInterval () {
this.options.autoRefreshFunction = setInterval(() => { this.options.autoRefreshFunction = setInterval(() => {
if (!this.options.autoRefresh || !this.options.autoRefreshStatus) { if (!this.options.autoRefresh || !this.options.autoRefreshStatus) {
return return
} }
this.refresh({ silent: this.options.autoRefreshSilent }) this.refresh({ silent: this.options.autoRefreshSilent })
}, this.options.autoRefreshInterval * 1000) }, this.options.autoRefreshInterval * 1000)
} }
} }

View File

@ -1,213 +1,213 @@
/** /**
* @author: Dennis Hernández * @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog * @webSite: http://djhvscf.github.io/Blog
* @update: https://github.com/wenzhixin * @update: https://github.com/wenzhixin
* @version: v1.2.0 * @version: v1.2.0
*/ */
$.akottr.dragtable.prototype._restoreState = function (persistObj) { $.akottr.dragtable.prototype._restoreState = function (persistObj) {
let i = 0 let i = 0
for (const [field, value] of Object.entries(persistObj)) { for (const [field, value] of Object.entries(persistObj)) {
const $th = this.originalTable.el.find(`th[data-field="${field}"]`) const $th = this.originalTable.el.find(`th[data-field="${field}"]`)
if (!$th.length) { if (!$th.length) {
i++ i++
continue continue
} }
this.originalTable.startIndex = $th.prevAll().length + 1 this.originalTable.startIndex = $th.prevAll().length + 1
this.originalTable.endIndex = parseInt(value, 10) + 1 - i this.originalTable.endIndex = parseInt(value, 10) + 1 - i
this._bubbleCols() this._bubbleCols()
} }
} }
// From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter // From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
const filterFn = () => { const filterFn = () => {
if (!Array.prototype.filter) { if (!Array.prototype.filter) {
Array.prototype.filter = function (fun/* , thisArg*/) { Array.prototype.filter = function (fun/* , thisArg*/) {
if (this === undefined || this === null) { if (this === undefined || this === null) {
throw new TypeError() throw new TypeError()
} }
const t = Object(this) const t = Object(this)
const len = t.length >>> 0 const len = t.length >>> 0
if (typeof fun !== 'function') { if (typeof fun !== 'function') {
throw new TypeError() throw new TypeError()
} }
const res = [] const res = []
const thisArg = arguments.length >= 2 ? arguments[1] : undefined const thisArg = arguments.length >= 2 ? arguments[1] : undefined
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
if (i in t) { if (i in t) {
const val = t[i] const val = t[i]
// NOTE: Technically this should Object.defineProperty at // NOTE: Technically this should Object.defineProperty at
// the next index, as push can be affected by // the next index, as push can be affected by
// properties on Object.prototype and Array.prototype. // properties on Object.prototype and Array.prototype.
// But this method's new, and collisions should be // But this method's new, and collisions should be
// rare, so use the more-compatible alternative. // rare, so use the more-compatible alternative.
if (fun.call(thisArg, val, i, t)) { if (fun.call(thisArg, val, i, t)) {
res.push(val) res.push(val)
} }
} }
} }
return res return res
} }
} }
} }
$.extend($.fn.bootstrapTable.defaults, { $.extend($.fn.bootstrapTable.defaults, {
reorderableColumns: false, reorderableColumns: false,
maxMovingRows: 10, maxMovingRows: 10,
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
onReorderColumn (headerFields) { onReorderColumn (headerFields) {
return false return false
}, },
dragaccept: null dragaccept: null
}) })
$.extend($.fn.bootstrapTable.Constructor.EVENTS, { $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'reorder-column.bs.table': 'onReorderColumn' 'reorder-column.bs.table': 'onReorderColumn'
}) })
$.fn.bootstrapTable.methods.push('orderColumns') $.fn.bootstrapTable.methods.push('orderColumns')
$.BootstrapTable = class extends $.BootstrapTable { $.BootstrapTable = class extends $.BootstrapTable {
initHeader (...args) { initHeader (...args) {
super.initHeader(...args) super.initHeader(...args)
if (!this.options.reorderableColumns) { if (!this.options.reorderableColumns) {
return return
} }
this.makeRowsReorderable() this.makeRowsReorderable()
} }
_toggleColumn (...args) { _toggleColumn (...args) {
super._toggleColumn(...args) super._toggleColumn(...args)
if (!this.options.reorderableColumns) { if (!this.options.reorderableColumns) {
return return
} }
this.makeRowsReorderable() this.makeRowsReorderable()
} }
toggleView (...args) { toggleView (...args) {
super.toggleView(...args) super.toggleView(...args)
if (!this.options.reorderableColumns) { if (!this.options.reorderableColumns) {
return return
} }
if (this.options.cardView) { if (this.options.cardView) {
return return
} }
this.makeRowsReorderable() this.makeRowsReorderable()
} }
resetView (...args) { resetView (...args) {
super.resetView(...args) super.resetView(...args)
if (!this.options.reorderableColumns) { if (!this.options.reorderableColumns) {
return return
} }
this.makeRowsReorderable() this.makeRowsReorderable()
} }
makeRowsReorderable (order = null) { makeRowsReorderable (order = null) {
try { try {
$(this.$el).dragtable('destroy') $(this.$el).dragtable('destroy')
} catch (e) { } catch (e) {
// do nothing // do nothing
} }
$(this.$el).dragtable({ $(this.$el).dragtable({
maxMovingRows: this.options.maxMovingRows, maxMovingRows: this.options.maxMovingRows,
dragaccept: this.options.dragaccept, dragaccept: this.options.dragaccept,
clickDelay: 200, clickDelay: 200,
dragHandle: '.th-inner', dragHandle: '.th-inner',
restoreState: order ? order : this.columnsSortOrder, restoreState: order ? order : this.columnsSortOrder,
beforeStop: table => { beforeStop: table => {
const sortOrder = {} const sortOrder = {}
table.el.find('th').each((i, el) => { table.el.find('th').each((i, el) => {
sortOrder[$(el).data('field')] = i sortOrder[$(el).data('field')] = i
}) })
this.columnsSortOrder = sortOrder this.columnsSortOrder = sortOrder
if (this.options.cookie) { if (this.options.cookie) {
this.persistReorderColumnsState(this) this.persistReorderColumnsState(this)
} }
const ths = [] const ths = []
const formatters = [] const formatters = []
const columns = [] const columns = []
let columnsHidden = [] let columnsHidden = []
let columnIndex = -1 let columnIndex = -1
const optionsColumns = [] const optionsColumns = []
this.$header.find('th:not(.detail)').each((i, el) => { this.$header.find('th:not(.detail)').each((i, el) => {
ths.push($(el).data('field')) ths.push($(el).data('field'))
formatters.push($(el).data('formatter')) formatters.push($(el).data('formatter'))
}) })
// Exist columns not shown // Exist columns not shown
if (ths.length < this.columns.length) { if (ths.length < this.columns.length) {
columnsHidden = this.columns.filter(column => !column.visible) columnsHidden = this.columns.filter(column => !column.visible)
for (let i = 0; i < columnsHidden.length; i++) { for (let i = 0; i < columnsHidden.length; i++) {
ths.push(columnsHidden[i].field) ths.push(columnsHidden[i].field)
formatters.push(columnsHidden[i].formatter) formatters.push(columnsHidden[i].formatter)
} }
} }
for (let i = 0; i < ths.length; i++) { for (let i = 0; i < ths.length; i++) {
columnIndex = this.fieldsColumnsIndex[ths[i]] columnIndex = this.fieldsColumnsIndex[ths[i]]
if (columnIndex !== -1) { if (columnIndex !== -1) {
this.fieldsColumnsIndex[ths[i]] = i this.fieldsColumnsIndex[ths[i]] = i
this.columns[columnIndex].fieldIndex = i this.columns[columnIndex].fieldIndex = i
columns.push(this.columns[columnIndex]) columns.push(this.columns[columnIndex])
} }
} }
this.columns = columns this.columns = columns
filterFn() // Support <IE9 filterFn() // Support <IE9
$.each(this.columns, (i, column) => { $.each(this.columns, (i, column) => {
let found = false let found = false
const field = column.field const field = column.field
this.options.columns[0].filter(item => { this.options.columns[0].filter(item => {
if (!found && item['field'] === field) { if (!found && item['field'] === field) {
optionsColumns.push(item) optionsColumns.push(item)
found = true found = true
return false return false
} }
return true return true
}) })
}) })
this.options.columns[0] = optionsColumns this.options.columns[0] = optionsColumns
this.header.fields = ths this.header.fields = ths
this.header.formatters = formatters this.header.formatters = formatters
this.initHeader() this.initHeader()
this.initToolbar() this.initToolbar()
this.initSearchText() this.initSearchText()
this.initBody() this.initBody()
this.resetView() this.resetView()
this.trigger('reorder-column', ths) this.trigger('reorder-column', ths)
} }
}) })
} }
orderColumns (order) { orderColumns (order) {
this.columnsSortOrder = order this.columnsSortOrder = order
this.makeRowsReorderable() this.makeRowsReorderable()
} }
} }

View File

@ -1,67 +1,67 @@
/** /**
* @author: Dennis Hernández * @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog * @webSite: http://djhvscf.github.io/Blog
* @version: v2.0.0 * @version: v2.0.0
*/ */
const isInit = that => that.$el.data('resizableColumns') !== undefined const isInit = that => that.$el.data('resizableColumns') !== undefined
const initResizable = that => { const initResizable = that => {
if ( if (
that.options.resizable && that.options.resizable &&
!that.options.cardView && !that.options.cardView &&
!isInit(that) && !isInit(that) &&
that.$el.is(':visible') that.$el.is(':visible')
) { ) {
that.$el.resizableColumns({ that.$el.resizableColumns({
store: window.store store: window.store
}) })
} }
} }
const destroy = that => { const destroy = that => {
if (isInit(that)) { if (isInit(that)) {
that.$el.data('resizableColumns').destroy() that.$el.data('resizableColumns').destroy()
} }
} }
const reInitResizable = that => { const reInitResizable = that => {
destroy(that) destroy(that)
initResizable(that) initResizable(that)
} }
$.extend($.fn.bootstrapTable.defaults, { $.extend($.fn.bootstrapTable.defaults, {
resizable: false resizable: false
}) })
$.BootstrapTable = class extends $.BootstrapTable { $.BootstrapTable = class extends $.BootstrapTable {
initBody (...args) { initBody (...args) {
super.initBody(...args) super.initBody(...args)
this.$el.off('column-switch.bs.table page-change.bs.table') this.$el.off('column-switch.bs.table page-change.bs.table')
.on('column-switch.bs.table page-change.bs.table', () => { .on('column-switch.bs.table page-change.bs.table', () => {
reInitResizable(this) reInitResizable(this)
}) })
} }
toggleView (...args) { toggleView (...args) {
super.toggleView(...args) super.toggleView(...args)
if (this.options.resizable && this.options.cardView) { if (this.options.resizable && this.options.cardView) {
// Destroy the plugin // Destroy the plugin
destroy(this) destroy(this)
} }
} }
resetView (...args) { resetView (...args) {
super.resetView(...args) super.resetView(...args)
if (this.options.resizable) { if (this.options.resizable) {
// because in fitHeader function, we use setTimeout(func, 100); // because in fitHeader function, we use setTimeout(func, 100);
setTimeout(() => { setTimeout(() => {
initResizable(this) initResizable(this)
}, 100) }, 100)
} }
} }
} }

View File

@ -1,109 +1,109 @@
/** /**
* Bootstrap Table Chinese translation * Bootstrap Table Chinese translation
* Author: Zhixin Wen<wenzhixin2010@gmail.com> * Author: Zhixin Wen<wenzhixin2010@gmail.com>
*/ */
$.fn.bootstrapTable.locales['zh-CN'] = { $.fn.bootstrapTable.locales['zh-CN'] = {
formatShowSearch: function formatShowSearch() { formatShowSearch: function formatShowSearch() {
return '隐藏/显示搜索'; return '隐藏/显示搜索';
}, },
formatPageGo: function formatPageGo() { formatPageGo: function formatPageGo() {
return '跳转'; return '跳转';
}, },
formatCopyRows: function formatCopyRows() { formatCopyRows: function formatCopyRows() {
return '复制行'; return '复制行';
}, },
formatPrint: function formatPrint() { formatPrint: function formatPrint() {
return '打印'; return '打印';
}, },
formatLoadingMessage: function formatLoadingMessage() { formatLoadingMessage: function formatLoadingMessage() {
return '正在努力地加载数据中,请稍候'; return '正在努力地加载数据中,请稍候';
}, },
formatRecordsPerPage: function formatRecordsPerPage(pageNumber) { formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
return "每页显示 ".concat(pageNumber, " 条记录"); return "每页显示 ".concat(pageNumber, " 条记录");
}, },
formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) { formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) { if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录(从 ").concat(totalNotFiltered, " 总记录中过滤)"); return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录(从 ").concat(totalNotFiltered, " 总记录中过滤)");
} }
return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录"); return "显示第 ".concat(pageFrom, " 到第 ").concat(pageTo, " 条记录,总共 ").concat(totalRows, " 条记录");
}, },
formatSRPaginationPreText: function formatSRPaginationPreText() { formatSRPaginationPreText: function formatSRPaginationPreText() {
return '上一页'; return '上一页';
}, },
formatSRPaginationPageText: function formatSRPaginationPageText(page) { formatSRPaginationPageText: function formatSRPaginationPageText(page) {
return "第".concat(page, "页"); return "第".concat(page, "页");
}, },
formatSRPaginationNextText: function formatSRPaginationNextText() { formatSRPaginationNextText: function formatSRPaginationNextText() {
return '下一页'; return '下一页';
}, },
formatDetailPagination: function formatDetailPagination(totalRows) { formatDetailPagination: function formatDetailPagination(totalRows) {
return "总共 ".concat(totalRows, " 条记录"); return "总共 ".concat(totalRows, " 条记录");
}, },
formatClearSearch: function formatClearSearch() { formatClearSearch: function formatClearSearch() {
return '清空过滤'; return '清空过滤';
}, },
formatSearch: function formatSearch() { formatSearch: function formatSearch() {
return '搜索'; return '搜索';
}, },
formatNoMatches: function formatNoMatches() { formatNoMatches: function formatNoMatches() {
return '没有找到匹配的记录'; return '没有找到匹配的记录';
}, },
formatPaginationSwitch: function formatPaginationSwitch() { formatPaginationSwitch: function formatPaginationSwitch() {
return '隐藏/显示分页'; return '隐藏/显示分页';
}, },
formatPaginationSwitchDown: function formatPaginationSwitchDown() { formatPaginationSwitchDown: function formatPaginationSwitchDown() {
return '显示分页'; return '显示分页';
}, },
formatPaginationSwitchUp: function formatPaginationSwitchUp() { formatPaginationSwitchUp: function formatPaginationSwitchUp() {
return '隐藏分页'; return '隐藏分页';
}, },
formatRefresh: function formatRefresh() { formatRefresh: function formatRefresh() {
return '刷新'; return '刷新';
}, },
formatToggle: function formatToggle() { formatToggle: function formatToggle() {
return '切换'; return '切换';
}, },
formatToggleOn: function formatToggleOn() { formatToggleOn: function formatToggleOn() {
return '显示卡片视图'; return '显示卡片视图';
}, },
formatToggleOff: function formatToggleOff() { formatToggleOff: function formatToggleOff() {
return '隐藏卡片视图'; return '隐藏卡片视图';
}, },
formatColumns: function formatColumns() { formatColumns: function formatColumns() {
return '列'; return '列';
}, },
formatColumnsToggleAll: function formatColumnsToggleAll() { formatColumnsToggleAll: function formatColumnsToggleAll() {
return '切换所有'; return '切换所有';
}, },
formatFullscreen: function formatFullscreen() { formatFullscreen: function formatFullscreen() {
return '全屏'; return '全屏';
}, },
formatAllRows: function formatAllRows() { formatAllRows: function formatAllRows() {
return '所有'; return '所有';
}, },
formatAutoRefresh: function formatAutoRefresh() { formatAutoRefresh: function formatAutoRefresh() {
return '自动刷新'; return '自动刷新';
}, },
formatExport: function formatExport() { formatExport: function formatExport() {
return '导出数据'; return '导出数据';
}, },
formatJumpTo: function formatJumpTo() { formatJumpTo: function formatJumpTo() {
return '跳转'; return '跳转';
}, },
formatAdvancedSearch: function formatAdvancedSearch() { formatAdvancedSearch: function formatAdvancedSearch() {
return '高级搜索'; return '高级搜索';
}, },
formatAdvancedCloseButton: function formatAdvancedCloseButton() { formatAdvancedCloseButton: function formatAdvancedCloseButton() {
return '关闭'; return '关闭';
}, },
formatFilterControlSwitch: function formatFilterControlSwitch() { formatFilterControlSwitch: function formatFilterControlSwitch() {
return '隐藏/显示过滤控制'; return '隐藏/显示过滤控制';
}, },
formatFilterControlSwitchHide: function formatFilterControlSwitchHide() { formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
return '隐藏过滤控制'; return '隐藏过滤控制';
}, },
formatFilterControlSwitchShow: function formatFilterControlSwitchShow() { formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
return '显示过滤控制'; return '显示过滤控制';
} }
}; };
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']); $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);

View File

@ -1,406 +1,406 @@
/*! /*!
* jQuery cxSelect * jQuery cxSelect
* @name jquery.cxselect.js * @name jquery.cxselect.js
* @version 1.4.2 * @version 1.4.2
* @date 2017-09-26 * @date 2017-09-26
* @author ciaoca * @author ciaoca
* @email ciaoca@gmail.com * @email ciaoca@gmail.com
* @site https://github.com/ciaoca/cxSelect * @site https://github.com/ciaoca/cxSelect
* @license Released under the MIT license * @license Released under the MIT license
*/ */
(function(factory) { (function(factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(['jquery'], factory); define(['jquery'], factory);
} else { } else {
factory(window.jQuery || window.Zepto || window.$); factory(window.jQuery || window.Zepto || window.$);
}; };
}(function($) { }(function($) {
var cxSelect = function() { var cxSelect = function() {
var self = this; var self = this;
var dom, settings, callback; var dom, settings, callback;
// 分配参数 // 分配参数
for (var i = 0, l = arguments.length; i < l; i++) { for (var i = 0, l = arguments.length; i < l; i++) {
if (cxSelect.isJquery(arguments[i]) || cxSelect.isZepto(arguments[i])) { if (cxSelect.isJquery(arguments[i]) || cxSelect.isZepto(arguments[i])) {
dom = arguments[i]; dom = arguments[i];
} else if (cxSelect.isElement(arguments[i])) { } else if (cxSelect.isElement(arguments[i])) {
dom = $(arguments[i]); dom = $(arguments[i]);
} else if (typeof arguments[i] === 'function') { } else if (typeof arguments[i] === 'function') {
callback = arguments[i]; callback = arguments[i];
} else if (typeof arguments[i] === 'object') { } else if (typeof arguments[i] === 'object') {
settings = arguments[i]; settings = arguments[i];
}; };
}; };
var api = new cxSelect.init(dom, settings); var api = new cxSelect.init(dom, settings);
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(api); callback(api);
}; };
return api; return api;
}; };
cxSelect.isElement = function(o){ cxSelect.isElement = function(o){
if (o && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object') && o instanceof HTMLElement) { if (o && (typeof HTMLElement === 'function' || typeof HTMLElement === 'object') && o instanceof HTMLElement) {
return true; return true;
} else { } else {
return (o && o.nodeType && o.nodeType === 1) ? true : false; return (o && o.nodeType && o.nodeType === 1) ? true : false;
}; };
}; };
cxSelect.isJquery = function(o){ cxSelect.isJquery = function(o){
return (o && o.length && (typeof jQuery === 'function' || typeof jQuery === 'object') && o instanceof jQuery) ? true : false; return (o && o.length && (typeof jQuery === 'function' || typeof jQuery === 'object') && o instanceof jQuery) ? true : false;
}; };
cxSelect.isZepto = function(o){ cxSelect.isZepto = function(o){
return (o && o.length && (typeof Zepto === 'function' || typeof Zepto === 'object') && Zepto.zepto.isZ(o)) ? true : false; return (o && o.length && (typeof Zepto === 'function' || typeof Zepto === 'object') && Zepto.zepto.isZ(o)) ? true : false;
}; };
cxSelect.getIndex = function(n, required) { cxSelect.getIndex = function(n, required) {
return required ? n : n - 1; return required ? n : n - 1;
}; };
cxSelect.getData = function(data, space) { cxSelect.getData = function(data, space) {
if (typeof space === 'string' && space.length) { if (typeof space === 'string' && space.length) {
space = space.split('.'); space = space.split('.');
for (var i = 0, l = space.length; i < l; i++) { for (var i = 0, l = space.length; i < l; i++) {
data = data[space[i]]; data = data[space[i]];
}; };
}; };
return data; return data;
}; };
cxSelect.init = function(dom, settings) { cxSelect.init = function(dom, settings) {
var self = this; var self = this;
if (!cxSelect.isJquery(dom) && !cxSelect.isZepto(dom)) {return}; if (!cxSelect.isJquery(dom) && !cxSelect.isZepto(dom)) {return};
var theSelect = { var theSelect = {
dom: { dom: {
box: dom box: dom
} }
}; };
self.attach = cxSelect.attach.bind(theSelect); self.attach = cxSelect.attach.bind(theSelect);
self.detach = cxSelect.detach.bind(theSelect); self.detach = cxSelect.detach.bind(theSelect);
self.setOptions = cxSelect.setOptions.bind(theSelect); self.setOptions = cxSelect.setOptions.bind(theSelect);
self.clear = cxSelect.clear.bind(theSelect); self.clear = cxSelect.clear.bind(theSelect);
theSelect.changeEvent = function() { theSelect.changeEvent = function() {
cxSelect.selectChange.call(theSelect, this.className); cxSelect.selectChange.call(theSelect, this.className);
}; };
theSelect.settings = $.extend({}, $.cxSelect.defaults, settings, { theSelect.settings = $.extend({}, $.cxSelect.defaults, settings, {
url: theSelect.dom.box.data('url'), url: theSelect.dom.box.data('url'),
emptyStyle: theSelect.dom.box.data('emptyStyle'), emptyStyle: theSelect.dom.box.data('emptyStyle'),
required: theSelect.dom.box.data('required'), required: theSelect.dom.box.data('required'),
firstTitle: theSelect.dom.box.data('firstTitle'), firstTitle: theSelect.dom.box.data('firstTitle'),
firstValue: theSelect.dom.box.data('firstValue'), firstValue: theSelect.dom.box.data('firstValue'),
jsonSpace: theSelect.dom.box.data('jsonSpace'), jsonSpace: theSelect.dom.box.data('jsonSpace'),
jsonName: theSelect.dom.box.data('jsonName'), jsonName: theSelect.dom.box.data('jsonName'),
jsonValue: theSelect.dom.box.data('jsonValue'), jsonValue: theSelect.dom.box.data('jsonValue'),
jsonSub: theSelect.dom.box.data('jsonSub') jsonSub: theSelect.dom.box.data('jsonSub')
}); });
var _dataSelects = theSelect.dom.box.data('selects'); var _dataSelects = theSelect.dom.box.data('selects');
if (typeof _dataSelects === 'string' && _dataSelects.length) { if (typeof _dataSelects === 'string' && _dataSelects.length) {
theSelect.settings.selects = _dataSelects.split(','); theSelect.settings.selects = _dataSelects.split(',');
}; };
self.setOptions(); self.setOptions();
self.attach(); self.attach();
// 使用独立接口获取数据 // 使用独立接口获取数据
if (!theSelect.settings.url && !theSelect.settings.data) { if (!theSelect.settings.url && !theSelect.settings.data) {
cxSelect.start.apply(theSelect); cxSelect.start.apply(theSelect);
// 设置自定义数据 // 设置自定义数据
} else if ($.isArray(theSelect.settings.data)) { } else if ($.isArray(theSelect.settings.data)) {
cxSelect.start.call(theSelect, theSelect.settings.data); cxSelect.start.call(theSelect, theSelect.settings.data);
// 设置 URL通过 Ajax 获取数据 // 设置 URL通过 Ajax 获取数据
} else if (typeof theSelect.settings.url === 'string' && theSelect.settings.url.length) { } else if (typeof theSelect.settings.url === 'string' && theSelect.settings.url.length) {
$.getJSON(theSelect.settings.url, function(json) { $.getJSON(theSelect.settings.url, function(json) {
cxSelect.start.call(theSelect, json); cxSelect.start.call(theSelect, json);
}); });
}; };
}; };
// 设置参数 // 设置参数
cxSelect.setOptions = function(opts) { cxSelect.setOptions = function(opts) {
var self = this; var self = this;
if (opts) { if (opts) {
$.extend(self.settings, opts); $.extend(self.settings, opts);
}; };
// 初次或重设选择器组 // 初次或重设选择器组
if (!$.isArray(self.selectArray) || !self.selectArray.length || (opts && opts.selects)) { if (!$.isArray(self.selectArray) || !self.selectArray.length || (opts && opts.selects)) {
self.selectArray = []; self.selectArray = [];
if ($.isArray(self.settings.selects) && self.settings.selects.length) { if ($.isArray(self.settings.selects) && self.settings.selects.length) {
var _tempSelect; var _tempSelect;
for (var i = 0, l = self.settings.selects.length; i < l; i++) { for (var i = 0, l = self.settings.selects.length; i < l; i++) {
_tempSelect = self.dom.box.find('select.' + self.settings.selects[i]); _tempSelect = self.dom.box.find('select.' + self.settings.selects[i]);
if (!_tempSelect || !_tempSelect.length) {break}; if (!_tempSelect || !_tempSelect.length) {break};
self.selectArray.push(_tempSelect); self.selectArray.push(_tempSelect);
}; };
}; };
}; };
if (opts) { if (opts) {
if (!$.isArray(opts.data) && typeof opts.url === 'string' && opts.url.length) { if (!$.isArray(opts.data) && typeof opts.url === 'string' && opts.url.length) {
$.getJSON(self.settings.url, function(json) { $.getJSON(self.settings.url, function(json) {
cxSelect.start.call(self, json); cxSelect.start.call(self, json);
}); });
} else { } else {
cxSelect.start.call(self, opts.data); cxSelect.start.call(self, opts.data);
}; };
}; };
}; };
// 绑定 // 绑定
cxSelect.attach = function() { cxSelect.attach = function() {
var self = this; var self = this;
if (!self.attachStatus) { if (!self.attachStatus) {
self.dom.box.on('change', 'select', self.changeEvent); self.dom.box.on('change', 'select', self.changeEvent);
}; };
if (typeof self.attachStatus === 'boolean') { if (typeof self.attachStatus === 'boolean') {
cxSelect.start.call(self); cxSelect.start.call(self);
}; };
self.attachStatus = true; self.attachStatus = true;
}; };
// 移除绑定 // 移除绑定
cxSelect.detach = function() { cxSelect.detach = function() {
var self = this; var self = this;
self.dom.box.off('change', 'select', self.changeEvent); self.dom.box.off('change', 'select', self.changeEvent);
self.attachStatus = false; self.attachStatus = false;
}; };
// 清空选项 // 清空选项
cxSelect.clear = function(index) { cxSelect.clear = function(index) {
var self = this; var self = this;
var _style = { var _style = {
display: '', display: '',
visibility: '' visibility: ''
}; };
index = isNaN(index) ? 0 : index; index = isNaN(index) ? 0 : index;
// 清空后面的 select // 清空后面的 select
for (var i = index, l = self.selectArray.length; i < l; i++) { for (var i = index, l = self.selectArray.length; i < l; i++) {
self.selectArray[i].empty().prop('disabled', true); self.selectArray[i].empty().prop('disabled', true);
if (self.settings.emptyStyle === 'none') { if (self.settings.emptyStyle === 'none') {
_style.display = 'none'; _style.display = 'none';
} else if (self.settings.emptyStyle === 'hidden') { } else if (self.settings.emptyStyle === 'hidden') {
_style.visibility = 'hidden'; _style.visibility = 'hidden';
}; };
self.selectArray[i].css(_style); self.selectArray[i].css(_style);
}; };
}; };
cxSelect.start = function(data) { cxSelect.start = function(data) {
var self = this; var self = this;
if ($.isArray(data)) { if ($.isArray(data)) {
self.settings.data = cxSelect.getData(data, self.settings.jsonSpace); self.settings.data = cxSelect.getData(data, self.settings.jsonSpace);
}; };
if (!self.selectArray.length) {return}; if (!self.selectArray.length) {return};
// 保存默认值 // 保存默认值
for (var i = 0, l = self.selectArray.length; i < l; i++) { for (var i = 0, l = self.selectArray.length; i < l; i++) {
if (typeof self.selectArray[i].attr('data-value') !== 'string' && self.selectArray[i][0].options.length) { if (typeof self.selectArray[i].attr('data-value') !== 'string' && self.selectArray[i][0].options.length) {
self.selectArray[i].attr('data-value', self.selectArray[i].val()); self.selectArray[i].attr('data-value', self.selectArray[i].val());
}; };
}; };
if (self.settings.data || (typeof self.selectArray[0].data('url') === 'string' && self.selectArray[0].data('url').length)) { if (self.settings.data || (typeof self.selectArray[0].data('url') === 'string' && self.selectArray[0].data('url').length)) {
cxSelect.getOptionData.call(self, 0); cxSelect.getOptionData.call(self, 0);
} else if (self.selectArray[0][0].options.length && typeof self.selectArray[0].attr('data-value') === 'string' && self.selectArray[0].attr('data-value').length) { } else if (self.selectArray[0][0].options.length && typeof self.selectArray[0].attr('data-value') === 'string' && self.selectArray[0].attr('data-value').length) {
self.selectArray[0].val(self.selectArray[0].attr('data-value')); self.selectArray[0].val(self.selectArray[0].attr('data-value'));
cxSelect.getOptionData.call(self, 1); cxSelect.getOptionData.call(self, 1);
} else { } else {
self.selectArray[0].prop('disabled', false).css({ self.selectArray[0].prop('disabled', false).css({
'display': '', 'display': '',
'visibility': '' 'visibility': ''
}); });
}; };
}; };
// 获取选项数据 // 获取选项数据
cxSelect.getOptionData = function(index) { cxSelect.getOptionData = function(index) {
var self = this; var self = this;
if (typeof index !== 'number' || isNaN(index) || index < 0 || index >= self.selectArray.length) {return}; if (typeof index !== 'number' || isNaN(index) || index < 0 || index >= self.selectArray.length) {return};
var _indexPrev = index - 1; var _indexPrev = index - 1;
var _select = self.selectArray[index]; var _select = self.selectArray[index];
var _selectData; var _selectData;
var _valueIndex; var _valueIndex;
var _dataUrl = _select.data('url'); var _dataUrl = _select.data('url');
var _jsonSpace = typeof _select.data('jsonSpace') === 'undefined' ? self.settings.jsonSpace : _select.data('jsonSpace'); var _jsonSpace = typeof _select.data('jsonSpace') === 'undefined' ? self.settings.jsonSpace : _select.data('jsonSpace');
var _query = {}; var _query = {};
var _queryName; var _queryName;
var _selectName; var _selectName;
var _selectValue; var _selectValue;
cxSelect.clear.call(self, index); cxSelect.clear.call(self, index);
// 使用独立接口 // 使用独立接口
if (typeof _dataUrl === 'string' && _dataUrl.length) { if (typeof _dataUrl === 'string' && _dataUrl.length) {
if (index > 0) { if (index > 0) {
for (var i = 0, j = 1; i < index; i++, j++) { for (var i = 0, j = 1; i < index; i++, j++) {
_queryName = self.selectArray[j].data('queryName'); _queryName = self.selectArray[j].data('queryName');
_selectName = self.selectArray[i].attr('name'); _selectName = self.selectArray[i].attr('name');
_selectValue = self.selectArray[i].val(); _selectValue = self.selectArray[i].val();
if (typeof _queryName === 'string' && _queryName.length) { if (typeof _queryName === 'string' && _queryName.length) {
_query[_queryName] = _selectValue; _query[_queryName] = _selectValue;
} else if (typeof _selectName === 'string' && _selectName.length) { } else if (typeof _selectName === 'string' && _selectName.length) {
_query[_selectName] = _selectValue; _query[_selectName] = _selectValue;
}; };
}; };
}; };
$.getJSON(_dataUrl, _query, function(json) { $.getJSON(_dataUrl, _query, function(json) {
_selectData = cxSelect.getData(json, _jsonSpace); _selectData = cxSelect.getData(json, _jsonSpace);
cxSelect.buildOption.call(self, index, _selectData); cxSelect.buildOption.call(self, index, _selectData);
}); });
// 使用整合数据 // 使用整合数据
} else if (self.settings.data && typeof self.settings.data === 'object') { } else if (self.settings.data && typeof self.settings.data === 'object') {
_selectData = self.settings.data; _selectData = self.settings.data;
for (var i = 0; i < index; i++) { for (var i = 0; i < index; i++) {
_valueIndex = cxSelect.getIndex(self.selectArray[i][0].selectedIndex, typeof self.selectArray[i].data('required') === 'boolean' ? self.selectArray[i].data('required') : self.settings.required); _valueIndex = cxSelect.getIndex(self.selectArray[i][0].selectedIndex, typeof self.selectArray[i].data('required') === 'boolean' ? self.selectArray[i].data('required') : self.settings.required);
if (typeof _selectData[_valueIndex] === 'object' && $.isArray(_selectData[_valueIndex][self.settings.jsonSub]) && _selectData[_valueIndex][self.settings.jsonSub].length) { if (typeof _selectData[_valueIndex] === 'object' && $.isArray(_selectData[_valueIndex][self.settings.jsonSub]) && _selectData[_valueIndex][self.settings.jsonSub].length) {
_selectData = _selectData[_valueIndex][self.settings.jsonSub]; _selectData = _selectData[_valueIndex][self.settings.jsonSub];
} else { } else {
_selectData = null; _selectData = null;
break; break;
}; };
}; };
cxSelect.buildOption.call(self, index, _selectData); cxSelect.buildOption.call(self, index, _selectData);
}; };
}; };
// 构建选项列表 // 构建选项列表
cxSelect.buildOption = function(index, data) { cxSelect.buildOption = function(index, data) {
var self = this; var self = this;
var _select = self.selectArray[index]; var _select = self.selectArray[index];
var _required = typeof _select.data('required') === 'boolean' ? _select.data('required') : self.settings.required; var _required = typeof _select.data('required') === 'boolean' ? _select.data('required') : self.settings.required;
var _firstTitle = typeof _select.data('firstTitle') === 'undefined' ? self.settings.firstTitle : _select.data('firstTitle'); var _firstTitle = typeof _select.data('firstTitle') === 'undefined' ? self.settings.firstTitle : _select.data('firstTitle');
var _firstValue = typeof _select.data('firstValue') === 'undefined' ? self.settings.firstValue : _select.data('firstValue'); var _firstValue = typeof _select.data('firstValue') === 'undefined' ? self.settings.firstValue : _select.data('firstValue');
var _jsonName = typeof _select.data('jsonName') === 'undefined' ? self.settings.jsonName : _select.data('jsonName'); var _jsonName = typeof _select.data('jsonName') === 'undefined' ? self.settings.jsonName : _select.data('jsonName');
var _jsonValue = typeof _select.data('jsonValue') === 'undefined' ? self.settings.jsonValue : _select.data('jsonValue'); var _jsonValue = typeof _select.data('jsonValue') === 'undefined' ? self.settings.jsonValue : _select.data('jsonValue');
if (!$.isArray(data)) {return}; if (!$.isArray(data)) {return};
var _html = !_required ? '<option value="' + String(_firstValue) + '">' + String(_firstTitle) + '</option>' : ''; var _html = !_required ? '<option value="' + String(_firstValue) + '">' + String(_firstTitle) + '</option>' : '';
// 区分标题、值的数据 // 区分标题、值的数据
if (typeof _jsonName === 'string' && _jsonName.length) { if (typeof _jsonName === 'string' && _jsonName.length) {
// 无值字段时使用标题作为值 // 无值字段时使用标题作为值
if (typeof _jsonValue !== 'string' || !_jsonValue.length) { if (typeof _jsonValue !== 'string' || !_jsonValue.length) {
_jsonValue = _jsonName; _jsonValue = _jsonName;
}; };
for (var i = 0, l = data.length; i < l; i++) { for (var i = 0, l = data.length; i < l; i++) {
_html += '<option value="' + String(data[i][_jsonValue]) + '">' + String(data[i][_jsonName]) + '</option>'; _html += '<option value="' + String(data[i][_jsonValue]) + '">' + String(data[i][_jsonName]) + '</option>';
}; };
// 数组即为值的数据 // 数组即为值的数据
} else { } else {
for (var i = 0, l = data.length; i < l; i++) { for (var i = 0, l = data.length; i < l; i++) {
_html += '<option value="' + String(data[i]) + '">' + String(data[i]) + '</option>'; _html += '<option value="' + String(data[i]) + '">' + String(data[i]) + '</option>';
}; };
}; };
_select.html(_html).prop('disabled', false).css({ _select.html(_html).prop('disabled', false).css({
'display': '', 'display': '',
'visibility': '' 'visibility': ''
}); });
// 初次加载设置默认值 // 初次加载设置默认值
if (typeof _select.attr('data-value') === 'string') { if (typeof _select.attr('data-value') === 'string') {
_select.val(String(_select.attr('data-value'))).removeAttr('data-value'); _select.val(String(_select.attr('data-value'))).removeAttr('data-value');
if (_select[0].selectedIndex < 0) { if (_select[0].selectedIndex < 0) {
_select[0].options[0].selected = true; _select[0].options[0].selected = true;
}; };
}; };
if (_required || _select[0].selectedIndex > 0) { if (_required || _select[0].selectedIndex > 0) {
_select.trigger('change'); _select.trigger('change');
}; };
}; };
// 改变选择时的处理 // 改变选择时的处理
cxSelect.selectChange = function(name) { cxSelect.selectChange = function(name) {
var self = this; var self = this;
if (typeof name !== 'string' || !name.length) {return}; if (typeof name !== 'string' || !name.length) {return};
var index; var index;
name = name.replace(/\s+/g, ','); name = name.replace(/\s+/g, ',');
name = ',' + name + ','; name = ',' + name + ',';
// 获取当前 select 位置 // 获取当前 select 位置
for (var i = 0, l = self.selectArray.length; i < l; i++) { for (var i = 0, l = self.selectArray.length; i < l; i++) {
if (name.indexOf(',' + self.settings.selects[i] + ',') > -1) { if (name.indexOf(',' + self.settings.selects[i] + ',') > -1) {
index = i; index = i;
break; break;
}; };
}; };
if (typeof index === 'number' && index > -1) { if (typeof index === 'number' && index > -1) {
index += 1; index += 1;
cxSelect.getOptionData.call(self, index); cxSelect.getOptionData.call(self, index);
}; };
}; };
$.cxSelect = function() { $.cxSelect = function() {
return cxSelect.apply(this, arguments); return cxSelect.apply(this, arguments);
}; };
// 默认值 // 默认值
$.cxSelect.defaults = { $.cxSelect.defaults = {
selects: [], // 下拉选框组 selects: [], // 下拉选框组
url: null, // 列表数据文件路径URL或数组数据 url: null, // 列表数据文件路径URL或数组数据
data: null, // 自定义数据 data: null, // 自定义数据
emptyStyle: null, // 无数据状态显示方式 emptyStyle: null, // 无数据状态显示方式
required: false, // 是否为必选 required: false, // 是否为必选
firstTitle: '请选择', // 第一个选项的标题 firstTitle: '请选择', // 第一个选项的标题
firstValue: '', // 第一个选项的值 firstValue: '', // 第一个选项的值
jsonSpace: '', // 数据命名空间 jsonSpace: '', // 数据命名空间
jsonName: 'n', // 数据标题字段名称 jsonName: 'n', // 数据标题字段名称
jsonValue: '', // 数据值字段名称 jsonValue: '', // 数据值字段名称
jsonSub: 's' // 子集数据字段名称 jsonSub: 's' // 子集数据字段名称
}; };
$.fn.cxSelect = function(settings, callback) { $.fn.cxSelect = function(settings, callback) {
this.each(function(i) { this.each(function(i) {
$.cxSelect(this, settings, callback); $.cxSelect(this, settings, callback);
}); });
return this; return this;
}; };
})); }));

File diff suppressed because one or more lines are too long

View File

@ -1,86 +1,86 @@
/* /*
* Bootstrap Duallistbox - v3.0.7 * Bootstrap Duallistbox - v3.0.7
* A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices. * A responsive dual listbox widget optimized for Twitter Bootstrap. It works on all modern browsers and on touch devices.
* https://www.virtuosoft.eu/code/bootstrap-duallistbox/ * https://www.virtuosoft.eu/code/bootstrap-duallistbox/
* *
* Made by István Ujj-Mészáros * Made by István Ujj-Mészáros
* Under Apache License v2.0 License * Under Apache License v2.0 License
*/ */
.bootstrap-duallistbox-container .buttons { .bootstrap-duallistbox-container .buttons {
width: 100%; width: 100%;
margin-bottom: -1px; margin-bottom: -1px;
} }
.bootstrap-duallistbox-container label { .bootstrap-duallistbox-container label {
display: block; display: block;
} }
.bootstrap-duallistbox-container .info { .bootstrap-duallistbox-container .info {
display: inline-block; display: inline-block;
margin-bottom: 5px; margin-bottom: 5px;
font-size: 11px; font-size: 11px;
} }
.bootstrap-duallistbox-container .clear1, .bootstrap-duallistbox-container .clear1,
.bootstrap-duallistbox-container .clear2 { .bootstrap-duallistbox-container .clear2 {
display: none; display: none;
font-size: 10px; font-size: 10px;
} }
.bootstrap-duallistbox-container .box1.filtered .clear1, .bootstrap-duallistbox-container .box1.filtered .clear1,
.bootstrap-duallistbox-container .box2.filtered .clear2 { .bootstrap-duallistbox-container .box2.filtered .clear2 {
display: inline-block; display: inline-block;
} }
.bootstrap-duallistbox-container .move, .bootstrap-duallistbox-container .move,
.bootstrap-duallistbox-container .remove { .bootstrap-duallistbox-container .remove {
width: 60%; width: 60%;
} }
.bootstrap-duallistbox-container .btn-group .btn { .bootstrap-duallistbox-container .btn-group .btn {
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
} }
.bootstrap-duallistbox-container select { .bootstrap-duallistbox-container select {
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
} }
.bootstrap-duallistbox-container .moveall, .bootstrap-duallistbox-container .moveall,
.bootstrap-duallistbox-container .removeall { .bootstrap-duallistbox-container .removeall {
width: 40%; width: 40%;
} }
.bootstrap-duallistbox-container.bs2compatible .btn-group > .btn + .btn { .bootstrap-duallistbox-container.bs2compatible .btn-group > .btn + .btn {
margin-left: 0; margin-left: 0;
} }
.bootstrap-duallistbox-container select { .bootstrap-duallistbox-container select {
width: 100%; width: 100%;
height: 300px; height: 300px;
padding: 0; padding: 0;
} }
.bootstrap-duallistbox-container .filter { .bootstrap-duallistbox-container .filter {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
height: 31px; height: 31px;
margin: 0 0 5px 0; margin: 0 0 5px 0;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
} }
.bootstrap-duallistbox-container .filter.placeholder { .bootstrap-duallistbox-container .filter.placeholder {
color: #aaa; color: #aaa;
} }
.bootstrap-duallistbox-container.moveonselect .move, .bootstrap-duallistbox-container.moveonselect .move,
.bootstrap-duallistbox-container.moveonselect .remove { .bootstrap-duallistbox-container.moveonselect .remove {
display:none; display:none;
} }
.bootstrap-duallistbox-container.moveonselect .moveall, .bootstrap-duallistbox-container.moveonselect .moveall,
.bootstrap-duallistbox-container.moveonselect .removeall { .bootstrap-duallistbox-container.moveonselect .removeall {
width: 100%; width: 100%;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,182 +1,182 @@
/** /**
* 基于jQuery FullScreen修改 * 基于jQuery FullScreen修改
* 新增支持IE全屏显示 * 新增支持IE全屏显示
* Copyright (c) 2019 ruoyi * Copyright (c) 2019 ruoyi
*/ */
(function(jQuery) { (function(jQuery) {
/** /**
* Sets or gets the fullscreen state. * Sets or gets the fullscreen state.
* *
* @param {boolean=} state * @param {boolean=} state
* True to enable fullscreen mode, false to disable it. If not * True to enable fullscreen mode, false to disable it. If not
* specified then the current fullscreen state is returned. * specified then the current fullscreen state is returned.
* @return {boolean|Element|jQuery|null} * @return {boolean|Element|jQuery|null}
* When querying the fullscreen state then the current fullscreen * When querying the fullscreen state then the current fullscreen
* element (or true if browser doesn't support it) is returned * element (or true if browser doesn't support it) is returned
* when browser is currently in full screen mode. False is returned * when browser is currently in full screen mode. False is returned
* if browser is not in full screen mode. Null is returned if * if browser is not in full screen mode. Null is returned if
* browser doesn't support fullscreen mode at all. When setting * browser doesn't support fullscreen mode at all. When setting
* the fullscreen state then the current jQuery selection is * the fullscreen state then the current jQuery selection is
* returned for chaining. * returned for chaining.
* @this {jQuery} * @this {jQuery}
*/ */
function fullScreen(state) function fullScreen(state)
{ {
var e, func, doc; var e, func, doc;
// Do nothing when nothing was selected // Do nothing when nothing was selected
if (!this.length) return this; if (!this.length) return this;
// We only use the first selected element because it doesn't make sense // We only use the first selected element because it doesn't make sense
// to fullscreen multiple elements. // to fullscreen multiple elements.
e = (/** @type {Element} */ this[0]); e = (/** @type {Element} */ this[0]);
// Find the real element and the document (Depends on whether the // Find the real element and the document (Depends on whether the
// document itself or a HTML element was selected) // document itself or a HTML element was selected)
if (e.ownerDocument) if (e.ownerDocument)
{ {
doc = e.ownerDocument; doc = e.ownerDocument;
} }
else else
{ {
doc = e; doc = e;
e = doc.documentElement; e = doc.documentElement;
} }
// When no state was specified then return the current state. // When no state was specified then return the current state.
if (state == null) if (state == null)
{ {
// When fullscreen mode is not supported then return null // When fullscreen mode is not supported then return null
if (!((/** @type {?Function} */ doc["exitFullscreen"]) if (!((/** @type {?Function} */ doc["exitFullscreen"])
|| (/** @type {?Function} */ doc["webkitExitFullscreen"]) || (/** @type {?Function} */ doc["webkitExitFullscreen"])
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"]) || (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|| (/** @type {?Function} */ doc["msExitFullscreen"]) || (/** @type {?Function} */ doc["msExitFullscreen"])
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]))) || (/** @type {?Function} */ doc["mozCancelFullScreen"])))
{ {
return null; return null;
} }
// Check fullscreen state // Check fullscreen state
state = !!doc["fullscreenElement"] state = !!doc["fullscreenElement"]
|| !!doc["msFullscreenElement"] || !!doc["msFullscreenElement"]
|| !!doc["webkitIsFullScreen"] || !!doc["webkitIsFullScreen"]
|| !!doc["mozFullScreen"]; || !!doc["mozFullScreen"];
if (!state) return state; if (!state) return state;
// Return current fullscreen element or "true" if browser doesn't // Return current fullscreen element or "true" if browser doesn't
// support this // support this
return (/** @type {?Element} */ doc["fullscreenElement"]) return (/** @type {?Element} */ doc["fullscreenElement"])
|| (/** @type {?Element} */ doc["webkitFullscreenElement"]) || (/** @type {?Element} */ doc["webkitFullscreenElement"])
|| (/** @type {?Element} */ doc["webkitCurrentFullScreenElement"]) || (/** @type {?Element} */ doc["webkitCurrentFullScreenElement"])
|| (/** @type {?Element} */ doc["msFullscreenElement"]) || (/** @type {?Element} */ doc["msFullscreenElement"])
|| (/** @type {?Element} */ doc["mozFullScreenElement"]) || (/** @type {?Element} */ doc["mozFullScreenElement"])
|| state; || state;
} }
// When state was specified then enter or exit fullscreen mode. // When state was specified then enter or exit fullscreen mode.
if (state) if (state)
{ {
// Enter fullscreen // Enter fullscreen
func = (/** @type {?Function} */ e["requestFullscreen"]) func = (/** @type {?Function} */ e["requestFullscreen"])
|| (/** @type {?Function} */ e["webkitRequestFullscreen"]) || (/** @type {?Function} */ e["webkitRequestFullscreen"])
|| (/** @type {?Function} */ e["webkitRequestFullScreen"]) || (/** @type {?Function} */ e["webkitRequestFullScreen"])
|| (/** @type {?Function} */ e["msRequestFullscreen"]) || (/** @type {?Function} */ e["msRequestFullscreen"])
|| (/** @type {?Function} */ e["mozRequestFullScreen"]); || (/** @type {?Function} */ e["mozRequestFullScreen"]);
if (func) if (func)
{ {
func.call(e); func.call(e);
} }
return this; return this;
} }
else else
{ {
// Exit fullscreen // Exit fullscreen
func = (/** @type {?Function} */ doc["exitFullscreen"]) func = (/** @type {?Function} */ doc["exitFullscreen"])
|| (/** @type {?Function} */ doc["webkitExitFullscreen"]) || (/** @type {?Function} */ doc["webkitExitFullscreen"])
|| (/** @type {?Function} */ doc["webkitCancelFullScreen"]) || (/** @type {?Function} */ doc["webkitCancelFullScreen"])
|| (/** @type {?Function} */ doc["msExitFullscreen"]) || (/** @type {?Function} */ doc["msExitFullscreen"])
|| (/** @type {?Function} */ doc["mozCancelFullScreen"]); || (/** @type {?Function} */ doc["mozCancelFullScreen"]);
if (func) func.call(doc); if (func) func.call(doc);
return this; return this;
} }
} }
/** /**
* Toggles the fullscreen mode. * Toggles the fullscreen mode.
* *
* @return {!jQuery} * @return {!jQuery}
* The jQuery selection for chaining. * The jQuery selection for chaining.
* @this {jQuery} * @this {jQuery}
*/ */
function toggleFullScreen() function toggleFullScreen()
{ {
return (/** @type {!jQuery} */ fullScreen.call(this, return (/** @type {!jQuery} */ fullScreen.call(this,
!fullScreen.call(this))); !fullScreen.call(this)));
} }
/** /**
* Handles the browser-specific fullscreenchange event and triggers * Handles the browser-specific fullscreenchange event and triggers
* a jquery event for it. * a jquery event for it.
* *
* @param {?Event} event * @param {?Event} event
* The fullscreenchange event. * The fullscreenchange event.
*/ */
function fullScreenChangeHandler(event) function fullScreenChangeHandler(event)
{ {
jQuery(document).trigger(new jQuery.Event("fullscreenchange")); jQuery(document).trigger(new jQuery.Event("fullscreenchange"));
} }
/** /**
* Handles the browser-specific fullscreenerror event and triggers * Handles the browser-specific fullscreenerror event and triggers
* a jquery event for it. * a jquery event for it.
* *
* @param {?Event} event * @param {?Event} event
* The fullscreenerror event. * The fullscreenerror event.
*/ */
function fullScreenErrorHandler(event) function fullScreenErrorHandler(event)
{ {
jQuery(document).trigger(new jQuery.Event("fullscreenerror")); jQuery(document).trigger(new jQuery.Event("fullscreenerror"));
} }
/** /**
* Installs the fullscreenchange event handler. * Installs the fullscreenchange event handler.
*/ */
function installFullScreenHandlers() function installFullScreenHandlers()
{ {
var e, change, error; var e, change, error;
// Determine event name // Determine event name
e = document; e = document;
if (e["webkitCancelFullScreen"]) if (e["webkitCancelFullScreen"])
{ {
change = "webkitfullscreenchange"; change = "webkitfullscreenchange";
error = "webkitfullscreenerror"; error = "webkitfullscreenerror";
} }
else if (e["msExitFullscreen"]) else if (e["msExitFullscreen"])
{ {
change = "MSFullscreenChange"; change = "MSFullscreenChange";
error = "MSFullscreenError"; error = "MSFullscreenError";
} }
else if (e["mozCancelFullScreen"]) else if (e["mozCancelFullScreen"])
{ {
change = "mozfullscreenchange"; change = "mozfullscreenchange";
error = "mozfullscreenerror"; error = "mozfullscreenerror";
} }
else else
{ {
change = "fullscreenchange"; change = "fullscreenchange";
error = "fullscreenerror"; error = "fullscreenerror";
} }
// Install the event handlers // Install the event handlers
jQuery(document).bind(change, fullScreenChangeHandler); jQuery(document).bind(change, fullScreenChangeHandler);
jQuery(document).bind(error, fullScreenErrorHandler); jQuery(document).bind(error, fullScreenErrorHandler);
} }
jQuery.fn["fullScreen"] = fullScreen; jQuery.fn["fullScreen"] = fullScreen;
jQuery.fn["toggleFullScreen"] = toggleFullScreen; jQuery.fn["toggleFullScreen"] = toggleFullScreen;
installFullScreenHandlers(); installFullScreenHandlers();
})(jQuery); })(jQuery);

View File

@ -1,79 +1,79 @@
/** /**
* GitHub Gist Theme * GitHub Gist Theme
* Author : Anthony Attard - https://github.com/AnthonyAttard * Author : Anthony Attard - https://github.com/AnthonyAttard
* Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro
*/ */
.hljs { .hljs {
display: block; display: block;
background: white; background: white;
padding: 0.5em; padding: 0.5em;
color: #333333; color: #333333;
overflow-x: auto; overflow-x: auto;
} }
.hljs-comment, .hljs-comment,
.hljs-meta { .hljs-meta {
color: #969896; color: #969896;
} }
.hljs-variable, .hljs-variable,
.hljs-template-variable, .hljs-template-variable,
.hljs-strong, .hljs-strong,
.hljs-emphasis, .hljs-emphasis,
.hljs-quote { .hljs-quote {
color: #df5000; color: #df5000;
} }
.hljs-keyword, .hljs-keyword,
.hljs-selector-tag, .hljs-selector-tag,
.hljs-type { .hljs-type {
color: #d73a49; color: #d73a49;
} }
.hljs-literal, .hljs-literal,
.hljs-symbol, .hljs-symbol,
.hljs-bullet, .hljs-bullet,
.hljs-attribute { .hljs-attribute {
color: #0086b3; color: #0086b3;
} }
.hljs-section, .hljs-section,
.hljs-name { .hljs-name {
color: #63a35c; color: #63a35c;
} }
.hljs-tag { .hljs-tag {
color: #333333; color: #333333;
} }
.hljs-title, .hljs-title,
.hljs-attr, .hljs-attr,
.hljs-selector-id, .hljs-selector-id,
.hljs-selector-class, .hljs-selector-class,
.hljs-selector-attr, .hljs-selector-attr,
.hljs-selector-pseudo { .hljs-selector-pseudo {
color: #6f42c1; color: #6f42c1;
} }
.hljs-addition { .hljs-addition {
color: #55a532; color: #55a532;
background-color: #eaffea; background-color: #eaffea;
} }
.hljs-deletion { .hljs-deletion {
color: #bd2c00; color: #bd2c00;
background-color: #ffecec; background-color: #ffecec;
} }
.hljs-link { .hljs-link {
text-decoration: underline; text-decoration: underline;
} }
.hljs-number { .hljs-number {
color: #005cc5; color: #005cc5;
} }
.hljs-string { .hljs-string {
color: #032f62; color: #032f62;
} }

File diff suppressed because one or more lines are too long

View File

@ -1,72 +1,72 @@
/* iCheck plugin Square skin, green /* iCheck plugin Square skin, green
----------------------------------- */ ----------------------------------- */
.icheckbox_square-green, .icheckbox_square-green,
.iradio_square-green { .iradio_square-green {
display: inline-block; display: inline-block;
*display: inline; *display: inline;
vertical-align: middle; vertical-align: middle;
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 22px; width: 22px;
height: 22px; height: 22px;
background: url(green.png) no-repeat; background: url(green.png) no-repeat;
border: none; border: none;
cursor: pointer; cursor: pointer;
} }
.icheckbox_square-green-login{ .icheckbox_square-green-login{
display: inline-block; display: inline-block;
*display: inline; *display: inline;
vertical-align: middle; vertical-align: middle;
margin: 0; margin: 0;
padding: 0; padding: 0;
width: 22px; width: 22px;
height: 22px; height: 22px;
background: url(green-login.png) no-repeat; background: url(green-login.png) no-repeat;
border: none; border: none;
cursor: pointer; cursor: pointer;
} }
.icheckbox_square-green,.icheckbox_square-green-login { .icheckbox_square-green,.icheckbox_square-green-login {
background-position: 0 0; background-position: 0 0;
} }
.icheckbox_square-green.hover,.icheckbox_square-green-login.hover { .icheckbox_square-green.hover,.icheckbox_square-green-login.hover {
background-position: -24px 0; background-position: -24px 0;
} }
.icheckbox_square-green.checked,.icheckbox_square-green-login.checked { .icheckbox_square-green.checked,.icheckbox_square-green-login.checked {
background-position: -48px 0; background-position: -48px 0;
} }
.icheckbox_square-green.disabled,.icheckbox_square-green.disabled-login { .icheckbox_square-green.disabled,.icheckbox_square-green.disabled-login {
background-position: -72px 0; background-position: -72px 0;
cursor: default; cursor: default;
} }
.icheckbox_square-green.checked.disabled,.icheckbox_square-green-login.checked.disabled { .icheckbox_square-green.checked.disabled,.icheckbox_square-green-login.checked.disabled {
background-position: -96px 0; background-position: -96px 0;
} }
.iradio_square-green { .iradio_square-green {
background-position: -120px 0; background-position: -120px 0;
} }
.iradio_square-green.hover { .iradio_square-green.hover {
background-position: -144px 0; background-position: -144px 0;
} }
.iradio_square-green.checked { .iradio_square-green.checked {
background-position: -168px 0; background-position: -168px 0;
} }
.iradio_square-green.disabled { .iradio_square-green.disabled {
background-position: -192px 0; background-position: -192px 0;
cursor: default; cursor: default;
} }
.iradio_square-green.checked.disabled { .iradio_square-green.checked.disabled {
background-position: -216px 0; background-position: -216px 0;
} }
/* HiDPI support */ /* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { @media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_square-green,.icheckbox_square-green-login, .icheckbox_square-green,.icheckbox_square-green-login,
.iradio_square-green { .iradio_square-green {
background-image: url(green%402x.png); background-image: url(green%402x.png);
-webkit-background-size: 240px 24px; -webkit-background-size: 240px 24px;
background-size: 240px 24px; background-size: 240px 24px;
} }
} }

View File

@ -1,11 +1,11 @@
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */ /*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate, (function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true"); v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap(); g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i"; f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c= _add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this, f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+= b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return; 'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d= A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto); b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);

File diff suppressed because one or more lines are too long

View File

@ -1,102 +1,102 @@
/*------------------------------------- /*-------------------------------------
zTree Style zTree Style
version: 3.4 version: 3.4
author: Hunter.z author: Hunter.z
email: hunter.z@263.net email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
.ztree * {padding:0; margin:0; font-size:12px;} .ztree * {padding:0; margin:0; font-size:12px;}
.ztree {margin:0; padding:2px; color:#333} .ztree {margin:0; padding:2px; color:#333}
.ztree li{padding:0; margin:0; list-style:none; line-height:18px; text-align:left; white-space:nowrap; outline:0} .ztree li{padding:0; margin:0; list-style:none; line-height:18px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px} .ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;} .ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;}
.ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; /* height:17px; */ color:#333; background-color: transparent; .ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; /* height:17px; */ color:#333; background-color: transparent;
text-decoration:none; vertical-align:top; display: inline-block} text-decoration:none; vertical-align:top; display: inline-block}
.ztree li a:hover {text-decoration:underline} .ztree li a:hover {text-decoration:underline}
/*.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}*/ /*.ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}*/
.ztree li a.curSelectedNode {padding-top:0px; background-color:#F6F6F6; color:#0663A2; border:1px #DDDDDD solid; opacity:0.8;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .ztree li a.curSelectedNode {padding-top:0px; background-color:#F6F6F6; color:#0663A2; border:1px #DDDDDD solid; opacity:0.8;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
/*.ztree li a.curSelectedNode {padding-top:0px; color:#0663a2; font-weight:bold; height:16px; opacity:0.8;}*/ /*.ztree li a.curSelectedNode {padding-top:0px; color:#0663a2; font-weight:bold; height:16px; opacity:0.8;}*/
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;} .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid; .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid;
opacity:0.8; filter:alpha(opacity=80)} opacity:0.8; filter:alpha(opacity=80)}
.ztree li a.tmpTargetNode_prev {} .ztree li a.tmpTargetNode_prev {}
.ztree li a.tmpTargetNode_next {} .ztree li a.tmpTargetNode_next {}
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0; .ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
font-size:12px; border:1px #7EC4CC solid; *border:0px} font-size:12px; border:1px #7EC4CC solid; *border:0px}
.ztree li span {line-height:16px; margin-right:2px} .ztree li span {line-height:16px; margin-right:2px}
.ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle; .ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
border:0 none; cursor: pointer;outline:none; border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")} background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
/* IE7 fix */ /* IE7 fix */
.ztree li span.button.level0 {*margin-left:-15px;} .ztree li span.button.level0 {*margin-left:-15px;}
.ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto} .ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
.ztree li span.button.chk.checkbox_false_full {background-position:0 0} .ztree li span.button.chk.checkbox_false_full {background-position:0 0}
.ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px} .ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
.ztree li span.button.chk.checkbox_false_part {background-position:0 -28px} .ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
.ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px} .ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
.ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px} .ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
.ztree li span.button.chk.checkbox_true_full {background-position:-14px 0} .ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
.ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px} .ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
.ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px} .ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
.ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px} .ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
.ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px} .ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
.ztree li span.button.chk.radio_false_full {background-position:-28px 0} .ztree li span.button.chk.radio_false_full {background-position:-28px 0}
.ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px} .ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
.ztree li span.button.chk.radio_false_part {background-position:-28px -28px} .ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
.ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px} .ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
.ztree li span.button.chk.radio_false_disable {background-position:-28px -56px} .ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
.ztree li span.button.chk.radio_true_full {background-position:-42px 0} .ztree li span.button.chk.radio_true_full {background-position:-42px 0}
.ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px} .ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
.ztree li span.button.chk.radio_true_part {background-position:-42px -28px} .ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
.ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px} .ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
.ztree li span.button.chk.radio_true_disable {background-position:-42px -56px} .ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
.ztree li span.button.switch {width:18px; height:18px} .ztree li span.button.switch {width:18px; height:18px}
.ztree li span.button.root_open{background-position:-92px -54px} .ztree li span.button.root_open{background-position:-92px -54px}
.ztree li span.button.root_close{background-position:-74px -54px} .ztree li span.button.root_close{background-position:-74px -54px}
.ztree li span.button.roots_open{background-position:-92px 0} .ztree li span.button.roots_open{background-position:-92px 0}
.ztree li span.button.roots_close{background-position:-74px 0} .ztree li span.button.roots_close{background-position:-74px 0}
.ztree li span.button.center_open{background-position:-92px -18px} .ztree li span.button.center_open{background-position:-92px -18px}
.ztree li span.button.center_close{background-position:-74px -18px} .ztree li span.button.center_close{background-position:-74px -18px}
.ztree li span.button.bottom_open{background-position:-92px -36px} .ztree li span.button.bottom_open{background-position:-92px -36px}
.ztree li span.button.bottom_close{background-position:-74px -36px} .ztree li span.button.bottom_close{background-position:-74px -36px}
.ztree li span.button.noline_open{background-position:-92px -72px} .ztree li span.button.noline_open{background-position:-92px -72px}
.ztree li span.button.noline_close{background-position:-74px -72px} .ztree li span.button.noline_close{background-position:-74px -72px}
.ztree li span.button.root_docu{ background:none;} .ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{background-position:-56px 0} .ztree li span.button.roots_docu{background-position:-56px 0}
.ztree li span.button.center_docu{background-position:-56px -18px} .ztree li span.button.center_docu{background-position:-56px -18px}
.ztree li span.button.bottom_docu{background-position:-56px -36px} .ztree li span.button.bottom_docu{background-position:-56px -36px}
.ztree li span.button.noline_docu{ background:none;} .ztree li span.button.noline_docu{ background:none;}
.ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; /* vertical-align:top; * */vertical-align:middle} .ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; /* vertical-align:top; * */vertical-align:middle}
.ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle} .ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle} .ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")} background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
/* level style*/ /* level style*/
/*.ztree li span.button.level0 { /*.ztree li span.button.level0 {
display:none; display:none;
} }
.ztree li ul.level0 { .ztree li ul.level0 {
padding:0; padding:0;
background:none; background:none;
}*/ }*/

View File

@ -1,107 +1,107 @@
/*------------------------------------- /*-------------------------------------
zTree Style zTree Style
version: 3.4 version: 3.4
author: Hunter.z author: Hunter.z
email: hunter.z@263.net email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif} .ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
.ztree {margin:0; padding:5px; color:#333} .ztree {margin:0; padding:5px; color:#333}
.ztree li{padding:0; margin:0; list-style:none; line-height:21px; text-align:left; white-space:nowrap; outline:0} .ztree li{padding:0; margin:0; list-style:none; line-height:21px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px} .ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;} .ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
.ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; display: inline-block} .ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; display: inline-block}
.ztree li a:hover {text-decoration:underline} .ztree li a:hover {text-decoration:underline}
.ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:22px; -webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:22px; -webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:22px; border:1px #666 solid; -webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:22px; border:1px #666 solid; -webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid; .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid;
opacity:0.8; filter:alpha(opacity=80)} opacity:0.8; filter:alpha(opacity=80)}
.ztree li a.tmpTargetNode_prev {} .ztree li a.tmpTargetNode_prev {}
.ztree li a.tmpTargetNode_next {} .ztree li a.tmpTargetNode_next {}
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0; .ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
font-size:12px; border:1px #7EC4CC solid; *border:0px} font-size:12px; border:1px #7EC4CC solid; *border:0px}
.ztree li span {line-height:21px; margin-right:2px} .ztree li span {line-height:21px; margin-right:2px}
.ztree li span.button {line-height:0; margin:0; width:21px; height:21px; display: inline-block; vertical-align:middle; .ztree li span.button {line-height:0; margin:0; width:21px; height:21px; display: inline-block; vertical-align:middle;
border:0 none; cursor: pointer;outline:none; border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
.ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto} .ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto}
.ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;} .ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;}
.ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;} .ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;}
.ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;} .ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;}
.ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;} .ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;}
.ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;} .ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;}
.ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;} .ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;}
.ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;} .ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;}
.ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;} .ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;}
.ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;} .ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;}
.ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;} .ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;}
.ztree li span.button.chk.radio_false_full {background-position: -47px -5px;} .ztree li span.button.chk.radio_false_full {background-position: -47px -5px;}
.ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;} .ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;}
.ztree li span.button.chk.radio_false_part {background-position: -47px -47px;} .ztree li span.button.chk.radio_false_part {background-position: -47px -47px;}
.ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;} .ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;}
.ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;} .ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;}
.ztree li span.button.chk.radio_true_full {background-position: -68px -5px;} .ztree li span.button.chk.radio_true_full {background-position: -68px -5px;}
.ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;} .ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;}
.ztree li span.button.chk.radio_true_part {background-position: -68px -47px;} .ztree li span.button.chk.radio_true_part {background-position: -68px -47px;}
.ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;} .ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;}
.ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;} .ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;}
.ztree li span.button.switch {width:21px; height:21px} .ztree li span.button.switch {width:21px; height:21px}
.ztree li span.button.root_open{background-position:-105px -85px} .ztree li span.button.root_open{background-position:-105px -85px}
.ztree li span.button.root_close{background-position:-126px -85px} .ztree li span.button.root_close{background-position:-126px -85px}
.ztree li span.button.roots_open{background-position: -105px 0;} .ztree li span.button.roots_open{background-position: -105px 0;}
.ztree li span.button.roots_close{background-position: -126px 0;} .ztree li span.button.roots_close{background-position: -126px 0;}
.ztree li span.button.center_open{background-position: -105px -21px;} .ztree li span.button.center_open{background-position: -105px -21px;}
.ztree li span.button.center_close{background-position: -126px -21px;} .ztree li span.button.center_close{background-position: -126px -21px;}
.ztree li span.button.bottom_open{background-position: -105px -42px;} .ztree li span.button.bottom_open{background-position: -105px -42px;}
.ztree li span.button.bottom_close{background-position: -126px -42px;} .ztree li span.button.bottom_close{background-position: -126px -42px;}
.ztree li span.button.noline_open{background-position: -126px -84px;} .ztree li span.button.noline_open{background-position: -126px -84px;}
.ztree li span.button.noline_close{background-position: -105px -84px;} .ztree li span.button.noline_close{background-position: -105px -84px;}
.ztree li span.button.root_docu{ background:none;} .ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{background-position: -84px 0;} .ztree li span.button.roots_docu{background-position: -84px 0;}
.ztree li span.button.center_docu{background-position: -84px -21px;} .ztree li span.button.center_docu{background-position: -84px -21px;}
.ztree li span.button.bottom_docu{background-position: -84px -42px;} .ztree li span.button.bottom_docu{background-position: -84px -42px;}
.ztree li span.button.noline_docu{ background:none;} .ztree li span.button.noline_docu{ background:none;}
.ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle} .ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.edit:hover { .ztree li span.button.edit:hover {
background-position: -168px -21px; background-position: -168px -21px;
} }
.ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle} .ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.remove:hover { .ztree li span.button.remove:hover {
background-position: -168px -42px; background-position: -168px -42px;
} }
.ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle} .ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.add:hover { .ztree li span.button.add:hover {
background-position: -168px 0; background-position: -168px 0;
} }
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
/* 树搜索相关 */ /* 树搜索相关 */
.treeSearchInput {padding:13px 0 0 20px;} .treeSearchInput {padding:13px 0 0 20px;}
.treeSearchInput label {padding:5px 0 3px 0;font-size:13px;font-weight:normal;vertical-align:middle;} .treeSearchInput label {padding:5px 0 3px 0;font-size:13px;font-weight:normal;vertical-align:middle;}
.treeSearchInput input {width:145px;vertical-align:middle;line-height:24px;height:26px;border:1px solid #bbb;padding:0 4px;} .treeSearchInput input {width:145px;vertical-align:middle;line-height:24px;height:26px;border:1px solid #bbb;padding:0 4px;}
.treeSearchInput button {border:1px solid #bbb;vertical-align:middle;height:26px;height:26px\9;font-size:13px;background:#efefef;padding:0 8px;} .treeSearchInput button {border:1px solid #bbb;vertical-align:middle;height:26px;height:26px\9;font-size:13px;background:#efefef;padding:0 8px;}
.treeShowHideButton {position:absolute;right:8px;top:2px;font-size:12px;color:#333;z-index:3;} .treeShowHideButton {position:absolute;right:8px;top:2px;font-size:12px;color:#333;z-index:3;}
.treeShowHideButton label {cursor:pointer;} .treeShowHideButton label {cursor:pointer;}
.treeExpandCollapse {float:right;margin:6px 5px;padding:5px;font-size:12px;color:#333;position:relative;z-index:2;background:#fff;} .treeExpandCollapse {float:right;margin:6px 5px;padding:5px;font-size:12px;color:#333;position:relative;z-index:2;background:#fff;}
.treeExpandCollapse a {text-decoration:none;color:#333} .treeExpandCollapse a {text-decoration:none;color:#333}
.treeselect.ztree {padding:10px 20px;} .treeselect.ztree {padding:10px 20px;}

View File

@ -1,118 +1,118 @@
/*------------------------------------- /*-------------------------------------
zTree Style zTree Style
version: 3.4 version: 3.4
author: Hunter.z author: Hunter.z
email: hunter.z@263.net email: hunter.z@263.net
website: http://code.google.com/p/jquerytree/ website: http://code.google.com/p/jquerytree/
-------------------------------------*/ -------------------------------------*/
.ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif} .ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
.ztree {margin:0; padding:5px; color:#333} .ztree {margin:0; padding:5px; color:#333}
.ztree li{padding:0; margin:0; list-style:none; line-height:21px; text-align:left; white-space:nowrap; outline:0} .ztree li{padding:0; margin:0; list-style:none; line-height:21px; text-align:left; white-space:nowrap; outline:0}
.ztree li ul{ margin:0; padding:0 0 0 18px} .ztree li ul{ margin:0; padding:0 0 0 18px}
.ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;} .ztree li ul.line{ background:url(./img/line_conn.png) 0 0 repeat-y;}
.ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; display: inline-block} .ztree li a {padding-right:3px; margin:0; cursor:pointer; height:21px; color:#333; background-color: transparent; text-decoration:none; display: inline-block}
.ztree li a:hover {text-decoration:underline} .ztree li a:hover {text-decoration:underline}
.ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;} .ztree li a.curSelectedNode {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; opacity:0.8;}
.ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;} .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#e5e5e5; color:black; height:21px; border:1px #666 solid; opacity:0.8;}
.ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid; .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#aaa; color:white; height:21px; border:1px #666 solid;
opacity:0.8; filter:alpha(opacity=80)} opacity:0.8; filter:alpha(opacity=80)}
.ztree li a.tmpTargetNode_prev {} .ztree li a.tmpTargetNode_prev {}
.ztree li a.tmpTargetNode_next {} .ztree li a.tmpTargetNode_next {}
.ztree li a input.rename {height:14px; width:80px; padding:0; margin:0; .ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
font-size:12px; border:1px #7EC4CC solid; *border:0px} font-size:12px; border:1px #7EC4CC solid; *border:0px}
.ztree li span {line-height:21px; margin-right:2px} .ztree li span {line-height:21px; margin-right:2px}
.ztree li span.button {line-height:0; margin:0; width:21px; height:21px; display: inline-block; vertical-align:middle; .ztree li span.button {line-height:0; margin:0; width:21px; height:21px; display: inline-block; vertical-align:middle;
border:0 none; cursor: pointer;outline:none; border:0 none; cursor: pointer;outline:none;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
.ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto} .ztree li span.button.chk {width:13px; height:13px; margin:0 2px; cursor: auto}
.ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;} .ztree li span.button.chk.checkbox_false_full {background-position: -5px -5px;}
.ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;} .ztree li span.button.chk.checkbox_false_full_focus {background-position: -5px -26px;}
.ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;} .ztree li span.button.chk.checkbox_false_part {background-position: -5px -48px;}
.ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;} .ztree li span.button.chk.checkbox_false_part_focus {background-position: -5px -68px;}
.ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;} .ztree li span.button.chk.checkbox_false_disable {background-position: -5px -89px;}
.ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;} .ztree li span.button.chk.checkbox_true_full {background-position: -26px -5px;}
.ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;} .ztree li span.button.chk.checkbox_true_full_focus {background-position: -26px -26px;}
.ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;} .ztree li span.button.chk.checkbox_true_part {background-position: -26px -48px;}
.ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;} .ztree li span.button.chk.checkbox_true_part_focus {background-position: -26px -68px;}
.ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;} .ztree li span.button.chk.checkbox_true_disable {background-position: -26px -89px;}
.ztree li span.button.chk.radio_false_full {background-position: -47px -5px;} .ztree li span.button.chk.radio_false_full {background-position: -47px -5px;}
.ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;} .ztree li span.button.chk.radio_false_full_focus {background-position: -47px -26px;}
.ztree li span.button.chk.radio_false_part {background-position: -47px -47px;} .ztree li span.button.chk.radio_false_part {background-position: -47px -47px;}
.ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;} .ztree li span.button.chk.radio_false_part_focus {background-position: -47px -68px;}
.ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;} .ztree li span.button.chk.radio_false_disable {background-position: -47px -89px;}
.ztree li span.button.chk.radio_true_full {background-position: -68px -5px;} .ztree li span.button.chk.radio_true_full {background-position: -68px -5px;}
.ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;} .ztree li span.button.chk.radio_true_full_focus {background-position: -68px -26px;}
.ztree li span.button.chk.radio_true_part {background-position: -68px -47px;} .ztree li span.button.chk.radio_true_part {background-position: -68px -47px;}
.ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;} .ztree li span.button.chk.radio_true_part_focus {background-position: -68px -68px;}
.ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;} .ztree li span.button.chk.radio_true_disable {background-position: -68px -89px;}
.ztree li span.button.switch {width:21px; height:21px} .ztree li span.button.switch {width:21px; height:21px}
.ztree li span.button.root_open{background-position:-92px -54px} .ztree li span.button.root_open{background-position:-92px -54px}
.ztree li span.button.root_close{background-position:-74px -54px} .ztree li span.button.root_close{background-position:-74px -54px}
.ztree li span.button.roots_open{background-position: -105px 0;} .ztree li span.button.roots_open{background-position: -105px 0;}
.ztree li span.button.roots_close{background-position: -126px 0;} .ztree li span.button.roots_close{background-position: -126px 0;}
.ztree li span.button.center_open{background-position: -105px -21px;} .ztree li span.button.center_open{background-position: -105px -21px;}
.ztree li span.button.center_close{background-position: -126px -21px;} .ztree li span.button.center_close{background-position: -126px -21px;}
.ztree li span.button.bottom_open{background-position: -105px -42px;} .ztree li span.button.bottom_open{background-position: -105px -42px;}
.ztree li span.button.bottom_close{background-position: -126px -42px;} .ztree li span.button.bottom_close{background-position: -126px -42px;}
.ztree li span.button.noline_open{background-position: -126px -84px;} .ztree li span.button.noline_open{background-position: -126px -84px;}
.ztree li span.button.noline_close{background-position: -105px -84px;} .ztree li span.button.noline_close{background-position: -105px -84px;}
.ztree li span.button.root_docu{ background:none;} .ztree li span.button.root_docu{ background:none;}
.ztree li span.button.roots_docu{background-position: -84px 0;} .ztree li span.button.roots_docu{background-position: -84px 0;}
.ztree li span.button.center_docu{background-position: -84px -21px;} .ztree li span.button.center_docu{background-position: -84px -21px;}
.ztree li span.button.bottom_docu{background-position: -84px -42px;} .ztree li span.button.bottom_docu{background-position: -84px -42px;}
.ztree li span.button.noline_docu{ background:none;} .ztree li span.button.noline_docu{ background:none;}
.ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_open{margin-right:2px; background-position: -147px -21px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_close{margin-right:2px; margin-right:2px; background-position: -147px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_docu{margin-right:2px; background-position: -147px -42px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle} .ztree li span.button.edit {margin-left:2px; margin-right: -1px; background-position: -189px -21px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.edit:hover { .ztree li span.button.edit:hover {
background-position: -168px -21px; background-position: -168px -21px;
} }
.ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle} .ztree li span.button.remove {margin-left:2px; margin-right: -1px; background-position: -189px -42px; vertical-align:top; *vertical-align:middle}
.ztree li span.button.remove:hover { .ztree li span.button.remove:hover {
background-position: -168px -42px; background-position: -168px -42px;
} }
.ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle} .ztree li span.button.add {margin-left:2px; margin-right: -1px; background-position: -189px 0; vertical-align:top; *vertical-align:middle}
.ztree li span.button.add:hover { .ztree li span.button.add:hover {
background-position: -168px 0; background-position: -168px 0;
} }
.ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle} .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)} ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute; span.tmpzTreeMove_arrow {width:16px; height:21px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
background-color:transparent; background-repeat:no-repeat; background-attachment: scroll; background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")} background-position:-168px -84px; background-image:url("./img/metro.png"); *background-image:url("./img/metro.gif")}
ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)} ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
.zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute} .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
/* simple */ /* simple */
.ztree * {font-size:14px;font-family:"Microsoft Yahei",Verdana,Simsun,"Segoe UI Web Light","Segoe UI Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","Helvetica Neue",Arial;} .ztree * {font-size:14px;font-family:"Microsoft Yahei",Verdana,Simsun,"Segoe UI Web Light","Segoe UI Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","Helvetica Neue",Arial;}
.ztree li ul{ margin:0; padding:0} .ztree li ul{ margin:0; padding:0}
.ztree li {line-height:28px;} .ztree li {line-height:28px;}
.ztree li a {width:100%;height:28px;padding-top: 0px;} .ztree li a {width:100%;height:28px;padding-top: 0px;}
.ztree li a:hover {text-decoration:none; background-color: #E7E7E7;} .ztree li a:hover {text-decoration:none; background-color: #E7E7E7;}
.ztree11 li a span.button.switch {visibility:hidden} .ztree11 li a span.button.switch {visibility:hidden}
.ztree11.showIcon li a span.button.switch {visibility:visible} .ztree11.showIcon li a span.button.switch {visibility:visible}
.ztree li a.curSelectedNode {background-color:#D4D4D4;border:0;height:28px;} .ztree li a.curSelectedNode {background-color:#D4D4D4;border:0;height:28px;}
.ztree li span {line-height:26px;margin-right:0px;} .ztree li span {line-height:26px;margin-right:0px;}
.ztree li span.button {margin-top: -7px;} .ztree li span.button {margin-top: -7px;}
.ztree li span.button.switch {width:16px;height: 16px;} .ztree li span.button.switch {width:16px;height: 16px;}
.ztree li a.level0 span {font-size:15px;font-weight:bold;} .ztree li a.level0 span {font-size:15px;font-weight:bold;}
.ztree li span.button {background-image:url("img/left_menu.png"); *background-image:url("./left_menu.gif")} .ztree li span.button {background-image:url("img/left_menu.png"); *background-image:url("./left_menu.gif")}
.ztree li span.button.switch.level0 {width: 20px; height:20px} .ztree li span.button.switch.level0 {width: 20px; height:20px}
.ztree li span.button.switch.level1 {width: 20px; height:20px} .ztree li span.button.switch.level1 {width: 20px; height:20px}
.ztree li span.button.noline_open {background-position: 0 0;} .ztree li span.button.noline_open {background-position: 0 0;}
.ztree li span.button.noline_close {background-position: -18px 0;} .ztree li span.button.noline_close {background-position: -18px 0;}
.ztree li span.button.noline_open.level0 {background-position: 0 -17px;} .ztree li span.button.noline_open.level0 {background-position: 0 -17px;}
.ztree li span.button.noline_close.level0 {background-position: -18px -17px;} .ztree li span.button.noline_close.level0 {background-position: -18px -17px;}

View File

@ -1,366 +1,366 @@
/* /*
* JQuery zTree exHideNodes 3.5.12 * JQuery zTree exHideNodes 3.5.12
* http://zTree.me/ * http://zTree.me/
* *
* Copyright (c) 2010 Hunter.z * Copyright (c) 2010 Hunter.z
* *
* Licensed same as jquery - MIT License * Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* *
* email: hunter.z@263.net * email: hunter.z@263.net
* Date: 2013-03-11 * Date: 2013-03-11
*/ */
(function($){ (function($){
//default init node of exLib //default init node of exLib
var _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { var _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) {
if (typeof n.isHidden == "string") n.isHidden = tools.eqs(n.isHidden, "true"); if (typeof n.isHidden == "string") n.isHidden = tools.eqs(n.isHidden, "true");
n.isHidden = !!n.isHidden; n.isHidden = !!n.isHidden;
data.initHideForExCheck(setting, n); data.initHideForExCheck(setting, n);
}, },
//add dom for check //add dom for check
_beforeA = function(setting, node, html) {}, _beforeA = function(setting, node, html) {},
//update zTreeObj, add method of exLib //update zTreeObj, add method of exLib
_zTreeTools = function(setting, zTreeTools) { _zTreeTools = function(setting, zTreeTools) {
zTreeTools.showNodes = function(nodes, options) { zTreeTools.showNodes = function(nodes, options) {
view.showNodes(setting, nodes, options); view.showNodes(setting, nodes, options);
} }
zTreeTools.showNode = function(node, options) { zTreeTools.showNode = function(node, options) {
if (!node) { if (!node) {
return; return;
} }
view.showNodes(setting, [node], options); view.showNodes(setting, [node], options);
} }
zTreeTools.hideNodes = function(nodes, options) { zTreeTools.hideNodes = function(nodes, options) {
view.hideNodes(setting, nodes, options); view.hideNodes(setting, nodes, options);
} }
zTreeTools.hideNode = function(node, options) { zTreeTools.hideNode = function(node, options) {
if (!node) { if (!node) {
return; return;
} }
view.hideNodes(setting, [node], options); view.hideNodes(setting, [node], options);
} }
var _checkNode = zTreeTools.checkNode; var _checkNode = zTreeTools.checkNode;
if (_checkNode) { if (_checkNode) {
zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) { zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) {
if (!!node && !!node.isHidden) { if (!!node && !!node.isHidden) {
return; return;
} }
_checkNode.apply(zTreeTools, arguments); _checkNode.apply(zTreeTools, arguments);
} }
} }
}, },
//method of operate data //method of operate data
_data = { _data = {
initHideForExCheck: function(setting, n) { initHideForExCheck: function(setting, n) {
if (n.isHidden && setting.check && setting.check.enable) { if (n.isHidden && setting.check && setting.check.enable) {
if(typeof n._nocheck == "undefined") { if(typeof n._nocheck == "undefined") {
n._nocheck = !!n.nocheck n._nocheck = !!n.nocheck
n.nocheck = true; n.nocheck = true;
} }
n.check_Child_State = -1; n.check_Child_State = -1;
if (view.repairParentChkClassWithSelf) { if (view.repairParentChkClassWithSelf) {
view.repairParentChkClassWithSelf(setting, n); view.repairParentChkClassWithSelf(setting, n);
} }
} }
}, },
initShowForExCheck: function(setting, n) { initShowForExCheck: function(setting, n) {
if (!n.isHidden && setting.check && setting.check.enable) { if (!n.isHidden && setting.check && setting.check.enable) {
if(typeof n._nocheck != "undefined") { if(typeof n._nocheck != "undefined") {
n.nocheck = n._nocheck; n.nocheck = n._nocheck;
delete n._nocheck; delete n._nocheck;
} }
if (view.setChkClass) { if (view.setChkClass) {
var checkObj = $("#" + n.tId + consts.id.CHECK); var checkObj = $("#" + n.tId + consts.id.CHECK);
view.setChkClass(setting, checkObj, n); view.setChkClass(setting, checkObj, n);
} }
if (view.repairParentChkClassWithSelf) { if (view.repairParentChkClassWithSelf) {
view.repairParentChkClassWithSelf(setting, n); view.repairParentChkClassWithSelf(setting, n);
} }
} }
} }
}, },
//method of operate ztree dom //method of operate ztree dom
_view = { _view = {
clearOldFirstNode: function(setting, node) { clearOldFirstNode: function(setting, node) {
var n = node.getNextNode(); var n = node.getNextNode();
while(!!n){ while(!!n){
if (n.isFirstNode) { if (n.isFirstNode) {
n.isFirstNode = false; n.isFirstNode = false;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} }
if (n.isLastNode) { if (n.isLastNode) {
break; break;
} }
n = n.getNextNode(); n = n.getNextNode();
} }
}, },
clearOldLastNode: function(setting, node) { clearOldLastNode: function(setting, node) {
var n = node.getPreNode(); var n = node.getPreNode();
while(!!n){ while(!!n){
if (n.isLastNode) { if (n.isLastNode) {
n.isLastNode = false; n.isLastNode = false;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} }
if (n.isFirstNode) { if (n.isFirstNode) {
break; break;
} }
n = n.getPreNode(); n = n.getPreNode();
} }
}, },
makeDOMNodeMainBefore: function(html, setting, node) { makeDOMNodeMainBefore: function(html, setting, node) {
html.push("<li ", (node.isHidden ? "style='display:none;' " : ""), "id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>"); html.push("<li ", (node.isHidden ? "style='display:none;' " : ""), "id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>");
}, },
showNode: function(setting, node, options) { showNode: function(setting, node, options) {
node.isHidden = false; node.isHidden = false;
data.initShowForExCheck(setting, node); data.initShowForExCheck(setting, node);
$("#" + node.tId).show(); $("#" + node.tId).show();
}, },
showNodes: function(setting, nodes, options) { showNodes: function(setting, nodes, options) {
if (!nodes || nodes.length == 0) { if (!nodes || nodes.length == 0) {
return; return;
} }
var pList = {}, i, j; var pList = {}, i, j;
for (i=0, j=nodes.length; i<j; i++) { for (i=0, j=nodes.length; i<j; i++) {
var n = nodes[i]; var n = nodes[i];
if (!pList[n.parentTId]) { if (!pList[n.parentTId]) {
var pn = n.getParentNode(); var pn = n.getParentNode();
pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode(); pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
} }
view.showNode(setting, n, options); view.showNode(setting, n, options);
} }
for (var tId in pList) { for (var tId in pList) {
var children = pList[tId][setting.data.key.children]; var children = pList[tId][setting.data.key.children];
view.setFirstNodeForShow(setting, children); view.setFirstNodeForShow(setting, children);
view.setLastNodeForShow(setting, children); view.setLastNodeForShow(setting, children);
} }
}, },
hideNode: function(setting, node, options) { hideNode: function(setting, node, options) {
node.isHidden = true; node.isHidden = true;
node.isFirstNode = false; node.isFirstNode = false;
node.isLastNode = false; node.isLastNode = false;
data.initHideForExCheck(setting, node); data.initHideForExCheck(setting, node);
view.cancelPreSelectedNode(setting, node); view.cancelPreSelectedNode(setting, node);
$("#" + node.tId).hide(); $("#" + node.tId).hide();
}, },
hideNodes: function(setting, nodes, options) { hideNodes: function(setting, nodes, options) {
if (!nodes || nodes.length == 0) { if (!nodes || nodes.length == 0) {
return; return;
} }
var pList = {}, i, j; var pList = {}, i, j;
for (i=0, j=nodes.length; i<j; i++) { for (i=0, j=nodes.length; i<j; i++) {
var n = nodes[i]; var n = nodes[i];
if ((n.isFirstNode || n.isLastNode) && !pList[n.parentTId]) { if ((n.isFirstNode || n.isLastNode) && !pList[n.parentTId]) {
var pn = n.getParentNode(); var pn = n.getParentNode();
pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode(); pList[n.parentTId] = (pn === null) ? data.getRoot(setting) : n.getParentNode();
} }
view.hideNode(setting, n, options); view.hideNode(setting, n, options);
} }
for (var tId in pList) { for (var tId in pList) {
var children = pList[tId][setting.data.key.children]; var children = pList[tId][setting.data.key.children];
view.setFirstNodeForHide(setting, children); view.setFirstNodeForHide(setting, children);
view.setLastNodeForHide(setting, children); view.setLastNodeForHide(setting, children);
} }
}, },
setFirstNode: function(setting, parentNode) { setFirstNode: function(setting, parentNode) {
var childKey = setting.data.key.children, childLength = parentNode[childKey].length; var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
if (childLength > 0 && !parentNode[childKey][0].isHidden) { if (childLength > 0 && !parentNode[childKey][0].isHidden) {
parentNode[childKey][0].isFirstNode = true; parentNode[childKey][0].isFirstNode = true;
} else if (childLength > 0) { } else if (childLength > 0) {
view.setFirstNodeForHide(setting, parentNode[childKey]); view.setFirstNodeForHide(setting, parentNode[childKey]);
} }
}, },
setLastNode: function(setting, parentNode) { setLastNode: function(setting, parentNode) {
var childKey = setting.data.key.children, childLength = parentNode[childKey].length; var childKey = setting.data.key.children, childLength = parentNode[childKey].length;
if (childLength > 0 && !parentNode[childKey][0].isHidden) { if (childLength > 0 && !parentNode[childKey][0].isHidden) {
parentNode[childKey][childLength - 1].isLastNode = true; parentNode[childKey][childLength - 1].isLastNode = true;
} else if (childLength > 0) { } else if (childLength > 0) {
view.setLastNodeForHide(setting, parentNode[childKey]); view.setLastNodeForHide(setting, parentNode[childKey]);
} }
}, },
setFirstNodeForHide: function(setting, nodes) { setFirstNodeForHide: function(setting, nodes) {
var n,i,j; var n,i,j;
for (i=0, j=nodes.length; i<j; i++) { for (i=0, j=nodes.length; i<j; i++) {
n = nodes[i]; n = nodes[i];
if (n.isFirstNode) { if (n.isFirstNode) {
break; break;
} }
if (!n.isHidden && !n.isFirstNode) { if (!n.isHidden && !n.isFirstNode) {
n.isFirstNode = true; n.isFirstNode = true;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} else { } else {
n = null; n = null;
} }
} }
return n; return n;
}, },
setFirstNodeForShow: function(setting, nodes) { setFirstNodeForShow: function(setting, nodes) {
var n,i,j, first, old; var n,i,j, first, old;
for(i=0, j=nodes.length; i<j; i++) { for(i=0, j=nodes.length; i<j; i++) {
n = nodes[i]; n = nodes[i];
if (!first && !n.isHidden && n.isFirstNode) { if (!first && !n.isHidden && n.isFirstNode) {
first = n; first = n;
break; break;
} else if (!first && !n.isHidden && !n.isFirstNode) { } else if (!first && !n.isHidden && !n.isFirstNode) {
n.isFirstNode = true; n.isFirstNode = true;
first = n; first = n;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
} else if (first && n.isFirstNode) { } else if (first && n.isFirstNode) {
n.isFirstNode = false; n.isFirstNode = false;
old = n; old = n;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} else { } else {
n = null; n = null;
} }
} }
return {"new":first, "old":old}; return {"new":first, "old":old};
}, },
setLastNodeForHide: function(setting, nodes) { setLastNodeForHide: function(setting, nodes) {
var n,i; var n,i;
for (i=nodes.length-1; i>=0; i--) { for (i=nodes.length-1; i>=0; i--) {
n = nodes[i]; n = nodes[i];
if (n.isLastNode) { if (n.isLastNode) {
break; break;
} }
if (!n.isHidden && !n.isLastNode) { if (!n.isHidden && !n.isLastNode) {
n.isLastNode = true; n.isLastNode = true;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} else { } else {
n = null; n = null;
} }
} }
return n; return n;
}, },
setLastNodeForShow: function(setting, nodes) { setLastNodeForShow: function(setting, nodes) {
var n,i,j, last, old; var n,i,j, last, old;
for (i=nodes.length-1; i>=0; i--) { for (i=nodes.length-1; i>=0; i--) {
n = nodes[i]; n = nodes[i];
if (!last && !n.isHidden && n.isLastNode) { if (!last && !n.isHidden && n.isLastNode) {
last = n; last = n;
break; break;
} else if (!last && !n.isHidden && !n.isLastNode) { } else if (!last && !n.isHidden && !n.isLastNode) {
n.isLastNode = true; n.isLastNode = true;
last = n; last = n;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
} else if (last && n.isLastNode) { } else if (last && n.isLastNode) {
n.isLastNode = false; n.isLastNode = false;
old = n; old = n;
view.setNodeLineIcos(setting, n); view.setNodeLineIcos(setting, n);
break; break;
} else { } else {
n = null; n = null;
} }
} }
return {"new":last, "old":old}; return {"new":last, "old":old};
} }
}, },
_z = { _z = {
view: _view, view: _view,
data: _data data: _data
}; };
$.extend(true, $.fn.zTree._z, _z); $.extend(true, $.fn.zTree._z, _z);
var zt = $.fn.zTree, var zt = $.fn.zTree,
tools = zt._z.tools, tools = zt._z.tools,
consts = zt.consts, consts = zt.consts,
view = zt._z.view, view = zt._z.view,
data = zt._z.data, data = zt._z.data,
event = zt._z.event; event = zt._z.event;
data.addInitNode(_initNode); data.addInitNode(_initNode);
data.addBeforeA(_beforeA); data.addBeforeA(_beforeA);
data.addZTreeTools(_zTreeTools); data.addZTreeTools(_zTreeTools);
// Override method in core // Override method in core
var _dInitNode = data.initNode; var _dInitNode = data.initNode;
data.tmpHideParent = -1; data.tmpHideParent = -1;
data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) { data.initNode = function(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag) {
if (data.tmpHideParent !== parentNode) { if (data.tmpHideParent !== parentNode) {
data.tmpHideParent = parentNode; data.tmpHideParent = parentNode;
var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting), var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting),
children = tmpPNode[setting.data.key.children]; children = tmpPNode[setting.data.key.children];
data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children); data.tmpHideFirstNode = view.setFirstNodeForHide(setting, children);
data.tmpHideLastNode = view.setLastNodeForHide(setting, children); data.tmpHideLastNode = view.setLastNodeForHide(setting, children);
view.setNodeLineIcos(setting, data.tmpHideFirstNode); view.setNodeLineIcos(setting, data.tmpHideFirstNode);
view.setNodeLineIcos(setting, data.tmpHideLastNode); view.setNodeLineIcos(setting, data.tmpHideLastNode);
} }
isFirstNode = (data.tmpHideFirstNode === node); isFirstNode = (data.tmpHideFirstNode === node);
isLastNode = (data.tmpHideLastNode === node); isLastNode = (data.tmpHideLastNode === node);
if (_dInitNode) _dInitNode.apply(data, arguments); if (_dInitNode) _dInitNode.apply(data, arguments);
if (isLastNode) { if (isLastNode) {
view.clearOldLastNode(setting, node); view.clearOldLastNode(setting, node);
} }
} }
var _makeChkFlag = data.makeChkFlag; var _makeChkFlag = data.makeChkFlag;
if (!!_makeChkFlag) { if (!!_makeChkFlag) {
data.makeChkFlag = function(setting, node) { data.makeChkFlag = function(setting, node) {
if (!!node && !!node.isHidden) { if (!!node && !!node.isHidden) {
return; return;
} }
_makeChkFlag.apply(data, arguments); _makeChkFlag.apply(data, arguments);
} }
} }
var _getTreeCheckedNodes = data.getTreeCheckedNodes; var _getTreeCheckedNodes = data.getTreeCheckedNodes;
if (!!_getTreeCheckedNodes) { if (!!_getTreeCheckedNodes) {
data.getTreeCheckedNodes = function(setting, nodes, checked, results) { data.getTreeCheckedNodes = function(setting, nodes, checked, results) {
if (!!nodes && nodes.length > 0) { if (!!nodes && nodes.length > 0) {
var p = nodes[0].getParentNode(); var p = nodes[0].getParentNode();
if (!!p && !!p.isHidden) { if (!!p && !!p.isHidden) {
return []; return [];
} }
} }
return _getTreeCheckedNodes.apply(data, arguments); return _getTreeCheckedNodes.apply(data, arguments);
} }
} }
var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes; var _getTreeChangeCheckedNodes = data.getTreeChangeCheckedNodes;
if (!!_getTreeChangeCheckedNodes) { if (!!_getTreeChangeCheckedNodes) {
data.getTreeChangeCheckedNodes = function(setting, nodes, results) { data.getTreeChangeCheckedNodes = function(setting, nodes, results) {
if (!!nodes && nodes.length > 0) { if (!!nodes && nodes.length > 0) {
var p = nodes[0].getParentNode(); var p = nodes[0].getParentNode();
if (!!p && !!p.isHidden) { if (!!p && !!p.isHidden) {
return []; return [];
} }
} }
return _getTreeChangeCheckedNodes.apply(data, arguments); return _getTreeChangeCheckedNodes.apply(data, arguments);
} }
} }
var _expandCollapseSonNode = view.expandCollapseSonNode; var _expandCollapseSonNode = view.expandCollapseSonNode;
if (!!_expandCollapseSonNode) { if (!!_expandCollapseSonNode) {
view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) { view.expandCollapseSonNode = function(setting, node, expandFlag, animateFlag, callback) {
if (!!node && !!node.isHidden) { if (!!node && !!node.isHidden) {
return; return;
} }
_expandCollapseSonNode.apply(view, arguments); _expandCollapseSonNode.apply(view, arguments);
} }
} }
var _setSonNodeCheckBox = view.setSonNodeCheckBox; var _setSonNodeCheckBox = view.setSonNodeCheckBox;
if (!!_setSonNodeCheckBox) { if (!!_setSonNodeCheckBox) {
view.setSonNodeCheckBox = function(setting, node, value, srcNode) { view.setSonNodeCheckBox = function(setting, node, value, srcNode) {
if (!!node && !!node.isHidden) { if (!!node && !!node.isHidden) {
return; return;
} }
_setSonNodeCheckBox.apply(view, arguments); _setSonNodeCheckBox.apply(view, arguments);
} }
} }
var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf; var _repairParentChkClassWithSelf = view.repairParentChkClassWithSelf;
if (!!_repairParentChkClassWithSelf) { if (!!_repairParentChkClassWithSelf) {
view.repairParentChkClassWithSelf = function(setting, node) { view.repairParentChkClassWithSelf = function(setting, node) {
if (!!node && !!node.isHidden) { if (!!node && !!node.isHidden) {
return; return;
} }
_repairParentChkClassWithSelf.apply(view, arguments); _repairParentChkClassWithSelf.apply(view, arguments);
} }
} }
})(jQuery); })(jQuery);

View File

@ -1,170 +1,170 @@
=ZTree v3.x (JQuery Tree插件) 更新日志= =ZTree v3.x (JQuery Tree插件) 更新日志=
<font color="red">为了更好的优化及扩展zTree, 因此决定升级为v3.x并且对之前的v2.x不兼容会有很多结构上的修改对此深感无奈与抱歉请大家谅解。</font> <font color="red">为了更好的优化及扩展zTree, 因此决定升级为v3.x并且对之前的v2.x不兼容会有很多结构上的修改对此深感无奈与抱歉请大家谅解。</font>
<font color="red"> <font color="red">
具体修改内容可参考: 具体修改内容可参考:
* [http://www.ztree.me/v3/api.php zTree v3.0 API 文档] * [http://www.ztree.me/v3/api.php zTree v3.0 API 文档]
* [http://www.ztree.me/v3/demo.php#_101 zTree v3.0 Demo 演示] * [http://www.ztree.me/v3/demo.php#_101 zTree v3.0 Demo 演示]
* [http://www.ztree.me/v3/faq.php#_101 zTree v3.0 常见问题] * [http://www.ztree.me/v3/faq.php#_101 zTree v3.0 常见问题]
</font> </font>
<font color=#041594> <font color=#041594>
*2013.03.11* v3.5.12 *2013.03.11* v3.5.12
* 【修改】由于 jquery 1.9 中移除 event.srcElement 导致的 js 报错的bug。 * 【修改】由于 jquery 1.9 中移除 event.srcElement 导致的 js 报错的bug。
* 【修改】在异步加载模式下,使用 moveNode 方法,且 moveType != "inner" 时,也会导致 targetNode 自动加载子节点的 bug * 【修改】在异步加载模式下,使用 moveNode 方法,且 moveType != "inner" 时,也会导致 targetNode 自动加载子节点的 bug
* 【修改】对已经显示的节点(nochecked=true)使用 showNodes 或 showNode 方法后导致勾选框出现的bug。 * 【修改】对已经显示的节点(nochecked=true)使用 showNodes 或 showNode 方法后导致勾选框出现的bug。
* 【修改】对已经隐藏的节点(nochecked=false)使用 hideNodes 或 hideNode 方法后导致勾选框消失的bug。 * 【修改】对已经隐藏的节点(nochecked=false)使用 hideNodes 或 hideNode 方法后导致勾选框消失的bug。
* 【修改】getNodesByParamFuzzy 支持 大小写模糊。 * 【修改】getNodesByParamFuzzy 支持 大小写模糊。
* 【修改】className 结构,提取 _consts.className.BUTTON / LEVEL / ICO_LOADING / SWITCH便于快速修改 css 冲突。 * 【修改】className 结构,提取 _consts.className.BUTTON / LEVEL / ICO_LOADING / SWITCH便于快速修改 css 冲突。
例如:与 WordPress 产生冲突后,直接修改 core 中的 "button" 和 "level" 即可。 Issue: https://github.com/zTree/zTree_v3/issues/2 例如:与 WordPress 产生冲突后,直接修改 core 中的 "button" 和 "level" 即可。 Issue: https://github.com/zTree/zTree_v3/issues/2
*2013.01.28* v3.5.02 *2013.01.28* v3.5.02
* 【增加】setting.check.chkDisabledInherit 属性,用于设置 chkDisabled 在初始化时子节点是否可以继承父节点的 chkDisabled 属性 * 【增加】setting.check.chkDisabledInherit 属性,用于设置 chkDisabled 在初始化时子节点是否可以继承父节点的 chkDisabled 属性
* 【删除】内部 noSel 方法,使用 selectstart事件 和 "-moz-user-select"样式 处理禁止 节点文字被选择的功能 * 【删除】内部 noSel 方法,使用 selectstart事件 和 "-moz-user-select"样式 处理禁止 节点文字被选择的功能
* 【修改】不兼容 jQuery 1.9 的bug * 【修改】不兼容 jQuery 1.9 的bug
* 【修改】onDrop 的触发规则,保证异步加载模式下,可以在延迟加载结束后触发,避免 onDrop 中被拖拽的节点是已经更新后的数据。 * 【修改】onDrop 的触发规则,保证异步加载模式下,可以在延迟加载结束后触发,避免 onDrop 中被拖拽的节点是已经更新后的数据。
* 【修改】setChkDisabled 方法,增加 inheritParent, inheritChildren 参数设置是否让父子节点继承 disabled * 【修改】setChkDisabled 方法,增加 inheritParent, inheritChildren 参数设置是否让父子节点继承 disabled
* 【修改】异步加载时 拼接参数的方法,由 string 修改为 json 对象 * 【修改】异步加载时 拼接参数的方法,由 string 修改为 json 对象
* 【修正】1-2-3 3级节点时如果 2级节点 全部设置为 nocheck 或 chkDisabled后勾选3级节点时1级节点的半勾选状态错误的 bug * 【修正】1-2-3 3级节点时如果 2级节点 全部设置为 nocheck 或 chkDisabled后勾选3级节点时1级节点的半勾选状态错误的 bug
* 【修改】Demo: checkbox_nocheck.html & checkbox_chkDisabled.html; * 【修改】Demo: checkbox_nocheck.html & checkbox_chkDisabled.html;
* 【修改】Demo: edit_super.html增加 showRenameBtn & showRemoveBtn 的演示 * 【修改】Demo: edit_super.html增加 showRenameBtn & showRemoveBtn 的演示
* 【修改】Demo: asyncForAll, 将 post 修改为 get为了避免由于 IE10 的 bug 造成的客户端 以及 服务端崩溃 * 【修改】Demo: asyncForAll, 将 post 修改为 get为了避免由于 IE10 的 bug 造成的客户端 以及 服务端崩溃
IE10 ajax Post 无法提交参数的bug (http://bugs.jquery.com/ticket/12790) IE10 ajax Post 无法提交参数的bug (http://bugs.jquery.com/ticket/12790)
*2012.12.21* v3.5.01 *2012.12.21* v3.5.01
* 【优化】clone 方法 * 【优化】clone 方法
* 【修正】对于初始化无 children 属性的父节点进行 reAsyncChildNodes 操作时出错的 bug * 【修正】对于初始化无 children 属性的父节点进行 reAsyncChildNodes 操作时出错的 bug
* 【修正】beforeRename 回调中使用 cancelEditName 方法后,再 return false 导致无法重新进行编辑的 bug * 【修正】beforeRename 回调中使用 cancelEditName 方法后,再 return false 导致无法重新进行编辑的 bug
* 【修正】exedit 扩展包让 setting.data.key.url 失效的 bug * 【修正】exedit 扩展包让 setting.data.key.url 失效的 bug
* 【修正】setting.check.autoCheckTrigger 设置为 true 时onCheck 回调缺少 event 参数的 bug * 【修正】setting.check.autoCheckTrigger 设置为 true 时onCheck 回调缺少 event 参数的 bug
* 【修正】singlepath.html Demo 中的 bug * 【修正】singlepath.html Demo 中的 bug
*2012.11.20* v3.5 *2012.11.20* v3.5
* 【优化】原先的 clone 方法 (特别感谢:愚人码头) * 【优化】原先的 clone 方法 (特别感谢:愚人码头)
* 【修改】隐藏父节点后,使用 expandAll 方法导致 父节点展开的 bug * 【修改】隐藏父节点后,使用 expandAll 方法导致 父节点展开的 bug
* 【修改】使用 jQuery v1.7 以上时,设置 zTree 容器 ul 隐藏visibility: hidden;)后, 调用 selectNode 导致 IE 浏览器报错 Can't move focus 的 bug * 【修改】使用 jQuery v1.7 以上时,设置 zTree 容器 ul 隐藏visibility: hidden;)后, 调用 selectNode 导致 IE 浏览器报错 Can't move focus 的 bug
* 【修改】正在异步加载时,执行 destory 或 init 方法后,异步加载的节点影响新树的 bug * 【修改】正在异步加载时,执行 destory 或 init 方法后,异步加载的节点影响新树的 bug
* 【修改】方法 reAsyncChildNodes 在 refresh 的时候未清空内部 cache 导致内存泄露 的 bug * 【修改】方法 reAsyncChildNodes 在 refresh 的时候未清空内部 cache 导致内存泄露 的 bug
* 【修改】批量节点拖拽到其他父节点内inner导致顺序反转 的 bug * 【修改】批量节点拖拽到其他父节点内inner导致顺序反转 的 bug
* 【修改】对于 使用 html格式的 节点无法触发 双击事件 的 bug * 【修改】对于 使用 html格式的 节点无法触发 双击事件 的 bug
* 【修改】onCheck 回调中的 event ,保证与触发事件中的 event 一致 * 【修改】onCheck 回调中的 event ,保证与触发事件中的 event 一致
* 【修改】异步加载时,在 onNodeCreated 中执行 selectNode 后,导致节点折叠的 bug * 【修改】异步加载时,在 onNodeCreated 中执行 selectNode 后,导致节点折叠的 bug
* 【修改】API 中 dataFilter 的参数名称 childNodes -> responseData * 【修改】API 中 dataFilter 的参数名称 childNodes -> responseData
* 【修改】API 中 iconSkin 的 举例内容 * 【修改】API 中 iconSkin 的 举例内容
* 【修改】API 中 chkDisabled 的说明 * 【修改】API 中 chkDisabled 的说明
* 【修改】Demo 中 index.html 内的 loadReady 重复绑定问题 * 【修改】Demo 中 index.html 内的 loadReady 重复绑定问题
*2012.09.03* v3.4 *2012.09.03* v3.4
* 【增加】 Demo —— OutLook 样式的左侧菜单 * 【增加】 Demo —— OutLook 样式的左侧菜单
* 【增加】清空 zTree 的方法 $.fn.zTree.destory(treeId) & zTree.destory() * 【增加】清空 zTree 的方法 $.fn.zTree.destory(treeId) & zTree.destory()
* 【修改】core核心文件内 _eventProxy 方法中获取 tId 的方法,提高 DOM 的灵活性 * 【修改】core核心文件内 _eventProxy 方法中获取 tId 的方法,提高 DOM 的灵活性
* 【修改】初始化时 多层父节点的 checkbox 半选状态计算错误的 bug * 【修改】初始化时 多层父节点的 checkbox 半选状态计算错误的 bug
* 【修改】同时选中父、子节点后,利用 getSelectedNodes 获取选中节点并利用 removeNode 删除时报错的 bug * 【修改】同时选中父、子节点后,利用 getSelectedNodes 获取选中节点并利用 removeNode 删除时报错的 bug
* 【修改】treeNode.chkDisabled / nocheck 属性,支持字符串格式的 "false"/"true" * 【修改】treeNode.chkDisabled / nocheck 属性,支持字符串格式的 "false"/"true"
* 【修改】异步加载模式下无法利用 server 返回 xml 并且 在 dataFilter 中继续处理的 bug * 【修改】异步加载模式下无法利用 server 返回 xml 并且 在 dataFilter 中继续处理的 bug
* 【修改】title 只允许设置为 string 类型值的问题。 修正后允许设置为 number 类型的值 * 【修改】title 只允许设置为 string 类型值的问题。 修正后允许设置为 number 类型的值
* 【修改】zId 计数规则 & Cache 保存,减少 IE9 的 bug 造成的内存泄漏 * 【修改】zId 计数规则 & Cache 保存,减少 IE9 的 bug 造成的内存泄漏
* 【修改】API 页面搜索功能导致 IE 崩溃的 bug * 【修改】API 页面搜索功能导致 IE 崩溃的 bug
*2012.07.16* v3.3 *2012.07.16* v3.3
* 【增加】扩展库 exhide -- 节点隐藏功能 * 【增加】扩展库 exhide -- 节点隐藏功能
* 【修改】getNodesByFilter 方法,添加 invokeParam 自定义参数 * 【修改】getNodesByFilter 方法,添加 invokeParam 自定义参数
* 【修改】拖拽中测试代码未删除,导致出现黄颜色的 iframe 遮罩层的 bug * 【修改】拖拽中测试代码未删除,导致出现黄颜色的 iframe 遮罩层的 bug
* 【修改】延迟加载方法 对于使用 expandAll 进行全部展开时,导致 onNodeCreated 回调 和 addDiyDom 方法触发过早的 bug * 【修改】延迟加载方法 对于使用 expandAll 进行全部展开时,导致 onNodeCreated 回调 和 addDiyDom 方法触发过早的 bug
* 【修改】使用 moveNode 移动尚未生成 DOM 的节点时,视图会出现异常的 bug * 【修改】使用 moveNode 移动尚未生成 DOM 的节点时,视图会出现异常的 bug
* 【修改】删除节点后,相关节点的 isFirstNode 属性未重置的 bug * 【修改】删除节点后,相关节点的 isFirstNode 属性未重置的 bug
* 【修改】getPreNode(),getNextNode() 方法在对于特殊情况时计算错误的 bug * 【修改】getPreNode(),getNextNode() 方法在对于特殊情况时计算错误的 bug
* 【修改】设置 title 之后,如果重新将 title 内容设置为空后,会导致无法更新 title 的 bug * 【修改】设置 title 之后,如果重新将 title 内容设置为空后,会导致无法更新 title 的 bug
* 【修改】针对 setting.check.chkStyle=="radio" && setting.check.radioType=="all" 的情况时getTreeCheckedNodes方法优化找到一个结果就 break * 【修改】针对 setting.check.chkStyle=="radio" && setting.check.radioType=="all" 的情况时getTreeCheckedNodes方法优化找到一个结果就 break
* 【修改】zTreeObj.getCheckedNodes(false) 在 radioType = "all" 时计算错误的 bug * 【修改】zTreeObj.getCheckedNodes(false) 在 radioType = "all" 时计算错误的 bug
* 【修改】完善 API 中 beforeDrop / onDrop 的关于 treeId 的说明 * 【修改】完善 API 中 beforeDrop / onDrop 的关于 treeId 的说明
*2012.05.13* v3.2 *2012.05.13* v3.2
* 【增加】setting.data.key.url 允许修改 treeNode.url 属性 * 【增加】setting.data.key.url 允许修改 treeNode.url 属性
* 【增加】getNodesByFilter(filter, isSingle) 方法 * 【增加】getNodesByFilter(filter, isSingle) 方法
* 【增加】"与其他 DOM 拖拽互动" 的 Demo (http://www.ztree.me/v3/demo.php#_511) * 【增加】"与其他 DOM 拖拽互动" 的 Demo (http://www.ztree.me/v3/demo.php#_511)
* 【增加】"异步加载模式下全部展开" 的 Demo (http://www.ztree.me/v3/demo.php#_512) * 【增加】"异步加载模式下全部展开" 的 Demo (http://www.ztree.me/v3/demo.php#_512)
* 【修改】代码结构,将 addNodes、removeNode、removeChildNodes 方法 和 beforeRemove、onRemove 回调 转移到 core 内 * 【修改】代码结构,将 addNodes、removeNode、removeChildNodes 方法 和 beforeRemove、onRemove 回调 转移到 core 内
* 【修改】IE7的环境下无子节点的父节点反复展开出现多余空行的 bug * 【修改】IE7的环境下无子节点的父节点反复展开出现多余空行的 bug
* 【修改】异步加载时,如果出现网络异常等,会导致 图标显示错误的 bug * 【修改】异步加载时,如果出现网络异常等,会导致 图标显示错误的 bug
* 【修改】dataFilter中 return null 导致异常 的 bug * 【修改】dataFilter中 return null 导致异常 的 bug
* 【修改】removeChildNodes 方法清空子节点后,无法正常添加节点的 bug * 【修改】removeChildNodes 方法清空子节点后,无法正常添加节点的 bug
* 【修改】moveNode 后节点中的自定义元素的事件丢失的 bug * 【修改】moveNode 后节点中的自定义元素的事件丢失的 bug
* 【修改】moveNode 方法中设置 isSilent = true 时,如果移动到已展开的 父节点后,出现异常的 bug * 【修改】moveNode 方法中设置 isSilent = true 时,如果移动到已展开的 父节点后,出现异常的 bug
* 【修改】onClick/onDrag/onDrop 回调中 event 不是原始 event 的 bug * 【修改】onClick/onDrag/onDrop 回调中 event 不是原始 event 的 bug
* 【修改】onDrop 回调中 当拖拽无效时,无法获得 treeNodes 的 bug * 【修改】onDrop 回调中 当拖拽无效时,无法获得 treeNodes 的 bug
* 【修改】onDrop 无法判断拖拽是 移动还是复制的问题 * 【修改】onDrop 无法判断拖拽是 移动还是复制的问题
* 【修改】未开启异步加载模式时,拖拽节点到子节点为空的父节点内时 出现异常 的 bug * 【修改】未开启异步加载模式时,拖拽节点到子节点为空的父节点内时 出现异常 的 bug
* 【修改】拖拽过程中,反复在 父节点图标上划动时,会出现停顿的 bug * 【修改】拖拽过程中,反复在 父节点图标上划动时,会出现停顿的 bug
(需要css 结构—— button -> span.button) (需要css 结构—— button -> span.button)
* 【修改】拖拽操作时箭头 与 targetNode 背景之间的细节现实问题,便于用户拖拽时更容易区分 prev、next 和 inner 操作 * 【修改】拖拽操作时箭头 与 targetNode 背景之间的细节现实问题,便于用户拖拽时更容易区分 prev、next 和 inner 操作
* 【修改】拖拽操作时IE6/7 下 在 节点<a> 右侧 10px 内会导致 targetNode = root 的 bug * 【修改】拖拽操作时IE6/7 下 在 节点<a> 右侧 10px 内会导致 targetNode = root 的 bug
* 【修改】编辑模式下 默认的编辑按钮、删除按钮点击后,如果相应的 before 回调 return false 时会触发 onClick 回调的 bug * 【修改】编辑模式下 默认的编辑按钮、删除按钮点击后,如果相应的 before 回调 return false 时会触发 onClick 回调的 bug
*2012.02.14* v3.1 *2012.02.14* v3.1
* 【增加】ajax 的参数 setting.async.contentType ,让提交参数适用于 json 数据提交 (主要适用于 .Net 的开发)。 * 【增加】ajax 的参数 setting.async.contentType ,让提交参数适用于 json 数据提交 (主要适用于 .Net 的开发)。
* 【增加】setting.edit.editNameSelectAll, 用于设定编辑节点名称时初次显示 input 后 text 内容为全选 * 【增加】setting.edit.editNameSelectAll, 用于设定编辑节点名称时初次显示 input 后 text 内容为全选
* 【修改】异步加载 规则,不再仅仅依靠父节点的子节点数来判定,增加内部属性 zAsync保证默认状态下父节点及时无子节点也只能异步加载一次除非使用 reAsyncChildNodes 方法强行控制异步加载。 * 【修改】异步加载 规则,不再仅仅依靠父节点的子节点数来判定,增加内部属性 zAsync保证默认状态下父节点及时无子节点也只能异步加载一次除非使用 reAsyncChildNodes 方法强行控制异步加载。
* 【修改】放大浏览器后导致 界面出现多余连接线的bug 需要更新icon 图标和 css * 【修改】放大浏览器后导致 界面出现多余连接线的bug 需要更新icon 图标和 css
* 【修改】在编辑状态如果节点名超过编辑框宽度左右键在框内不起作用的bugIE 6 7 8 出现) * 【修改】在编辑状态如果节点名超过编辑框宽度左右键在框内不起作用的bugIE 6 7 8 出现)
CSS 中 filter:alpha(opacity=80) 造成的,应该是 ie 的 bug需要更新 css 文件 CSS 中 filter:alpha(opacity=80) 造成的,应该是 ie 的 bug需要更新 css 文件
* 【修改】title 设置后,如果属性不存在,则默认为 title 为空,便于数据容错和用户灵活使用 * 【修改】title 设置后,如果属性不存在,则默认为 title 为空,便于数据容错和用户灵活使用
* 【修改】editName 方法如果针对尚未展开的 父节点,会导致该父节点自动展开的 bug * 【修改】editName 方法如果针对尚未展开的 父节点,会导致该父节点自动展开的 bug
* 【修改】title 中存在标签时导致 title 显示异常的bug例如蓝色字22%"'`<input/>` * 【修改】title 中存在标签时导致 title 显示异常的bug例如蓝色字22%"'`<input/>`
*2012.01.10* v3.0 *2012.01.10* v3.0
* 【增加】setting.check.autoCheckTrigger 默认值 false可以设置联动选中时是否触发事件回调函数 * 【增加】setting.check.autoCheckTrigger 默认值 false可以设置联动选中时是否触发事件回调函数
* 【增加】setting.callback.beforeEditName 回调函数,以保证用户可以捕获点击编辑按钮的事件 * 【增加】setting.callback.beforeEditName 回调函数,以保证用户可以捕获点击编辑按钮的事件
* 【增加】treeNode.chkDisabled 属性,显示 checkbox 但是用户无法修改 checkbox 状态,并且该 checkbox 会影响父节点的 checkbox 的半选状态 * 【增加】treeNode.chkDisabled 属性,显示 checkbox 但是用户无法修改 checkbox 状态,并且该 checkbox 会影响父节点的 checkbox 的半选状态
* 【增加】setting.check.nocheckInherit 属性,用户设置子节点继承 nocheck 属性,用于批量初始化节点,不适用于已经显示的节点 * 【增加】setting.check.nocheckInherit 属性,用户设置子节点继承 nocheck 属性,用于批量初始化节点,不适用于已经显示的节点
* 【增加】setting.edit.drag.autoExpandTrigger 默认值 false可以设置自动展开、折叠操作时是否触发事件回调函数 * 【增加】setting.edit.drag.autoExpandTrigger 默认值 false可以设置自动展开、折叠操作时是否触发事件回调函数
* 【增加】setting.view.nameIsHTML 默认值 false允许用户对 name 设置 DOM 对象 * 【增加】setting.view.nameIsHTML 默认值 false允许用户对 name 设置 DOM 对象
* 【增加】treeNode.click 属性的说明文档 * 【增加】treeNode.click 属性的说明文档
* 【增加】treeObj.setChkDisabled 方法用于设置 checkbox / radio disabled 状态 * 【增加】treeObj.setChkDisabled 方法用于设置 checkbox / radio disabled 状态
* 【增加】treeNode.halfCheck 属性,用于强制设定节点的半选状态 * 【增加】treeNode.halfCheck 属性,用于强制设定节点的半选状态
* 【修改】异步加载 & 编辑功能 共存时,拖拽节点 或 增加节点 导致 ie 上报错的 bug apply 方法引起) * 【修改】异步加载 & 编辑功能 共存时,拖拽节点 或 增加节点 导致 ie 上报错的 bug apply 方法引起)
* 【修改】zTreeStyle 样式冲突 * 【修改】zTreeStyle 样式冲突
* 【修改】setting.data.key.title 默认值设置为 "",初始化时自动赋值为 setting.data.key.name 这样可避免希望 title 与 name 一致的用户反复设置参数 * 【修改】setting.data.key.title 默认值设置为 "",初始化时自动赋值为 setting.data.key.name 这样可避免希望 title 与 name 一致的用户反复设置参数
* 【修改】点击叶子节点的连接线会触发 expand 事件的 bug * 【修改】点击叶子节点的连接线会触发 expand 事件的 bug
* 【修改】IE 下 点击叶子节点连线会出现虚线框的 bug * 【修改】IE 下 点击叶子节点连线会出现虚线框的 bug
* 【修改】updateNode 导致 checkbox 半选状态错误的 bug * 【修改】updateNode 导致 checkbox 半选状态错误的 bug
* 【修改】checkNode 方法实现 toggle 操作, 取消 expandAll 方法的 toggle 操作 * 【修改】checkNode 方法实现 toggle 操作, 取消 expandAll 方法的 toggle 操作
* 【修改】zTree 内鼠标移动会抢页面上 input 内的焦点的 bug * 【修改】zTree 内鼠标移动会抢页面上 input 内的焦点的 bug
* 【修改】beforeRename / onRename 的触发方式——即使名称内容未改变也会触发,便于用户配合 beforeEditName 捕获编辑状态的结束,赋予用户更多调整规则的权利 * 【修改】beforeRename / onRename 的触发方式——即使名称内容未改变也会触发,便于用户配合 beforeEditName 捕获编辑状态的结束,赋予用户更多调整规则的权利
* 【修改】与 easyUI 共存时无法拖拽的bug * 【修改】与 easyUI 共存时无法拖拽的bug
* 【修改】beforeRename 在 Firefox 下如果利用 alert会触发两次的 bug * 【修改】beforeRename 在 Firefox 下如果利用 alert会触发两次的 bug
* 【修改】checkNode/expandNode/removeNode 方法,默认不触发回调函数,恢复 v2.6 的默认状态,同时增加 callbackFlag 参数,设置为 true 时,可以触发回调函数 * 【修改】checkNode/expandNode/removeNode 方法,默认不触发回调函数,恢复 v2.6 的默认状态,同时增加 callbackFlag 参数,设置为 true 时,可以触发回调函数
* 【修改】IE9下“根据参数查找节点”的Demo 报错行14 重新声明常量属性(Demo 自身的问题定义了history变量) * 【修改】IE9下“根据参数查找节点”的Demo 报错行14 重新声明常量属性(Demo 自身的问题定义了history变量)
* 【修改】初始化 zTree 时 onNodeCreated 事件回调函数中无法 用 getZTreeObj 获取 zTree 对象的 bug * 【修改】初始化 zTree 时 onNodeCreated 事件回调函数中无法 用 getZTreeObj 获取 zTree 对象的 bug
* 【修改】setting.edit.drag.prev / next / inner 参数,增加被拖拽的节点集合 * 【修改】setting.edit.drag.prev / next / inner 参数,增加被拖拽的节点集合
* 【修改】异步加载模式下otherParam 使用Array数组会出错的 bug。例如 ["id", "1", "name", "test"] * 【修改】异步加载模式下otherParam 使用Array数组会出错的 bug。例如 ["id", "1", "name", "test"]
* 【修改】FireFox 下多棵树拖拽异常的 bug * 【修改】FireFox 下多棵树拖拽异常的 bug
* 【修改】exedit 中调用 excheck库的方法时没有进行容错处理导致如果只加入 exedit 而没有 excheck的时候会出现 js 错误 * 【修改】exedit 中调用 excheck库的方法时没有进行容错处理导致如果只加入 exedit 而没有 excheck的时候会出现 js 错误
* 【修改】显示 checkbox 的 zTree 在编辑模式下,移动节点不会更新父节点半选状态的 bug * 【修改】显示 checkbox 的 zTree 在编辑模式下,移动节点不会更新父节点半选状态的 bug
* 【修改】treeNode.childs --> children; treeObject.removeChilds --> removeChildNodes; setting.data.key.childs --> children英文不好惹的祸抱歉了 * 【修改】treeNode.childs --> children; treeObject.removeChilds --> removeChildNodes; setting.data.key.childs --> children英文不好惹的祸抱歉了
* 【修改】onRemove 回调中得到的 treeNode 还可以查找 preNode、nextNode 的bug。 修正后getPreNode 和 getNextNode 都返回 null 为了便于查找父节点getParentNode 仍保留 * 【修改】onRemove 回调中得到的 treeNode 还可以查找 preNode、nextNode 的bug。 修正后getPreNode 和 getNextNode 都返回 null 为了便于查找父节点getParentNode 仍保留
* 【修改】简单数据模式下,如果 id 与 pId 的值相同会导致该节点无法正常加载的 bug * 【修改】简单数据模式下,如果 id 与 pId 的值相同会导致该节点无法正常加载的 bug
* 【修改】移动或删除中间节点会导致最后一个节点连接线图标变小的 bug * 【修改】移动或删除中间节点会导致最后一个节点连接线图标变小的 bug
*2011.09.05* v3.0 beta *2011.09.05* v3.0 beta
* 【修改】zTree 的 js 代码架构全面修改,并且拆分 * 【修改】zTree 的 js 代码架构全面修改,并且拆分
* 【修改】zTree 的 css 样式全面修改对浏览器可以更好地兼容同时解决了以前1个像素差的问题 * 【修改】zTree 的 css 样式全面修改对浏览器可以更好地兼容同时解决了以前1个像素差的问题
* 【优化】采用延迟加载技术,一次性加载大数据量的节点性能飞速提升 * 【优化】采用延迟加载技术,一次性加载大数据量的节点性能飞速提升
* 【增加】支持多节点同时选中、拖拽 * 【增加】支持多节点同时选中、拖拽
* 【增加】checkNode、checkAllNodes 等多种方法 * 【增加】checkNode、checkAllNodes 等多种方法
* 【增加】IE6 自动取消动画展开、折叠的功能 * 【增加】IE6 自动取消动画展开、折叠的功能
* 【修正】异步加载 & 编辑模式 能够更完美的共存 * 【修正】异步加载 & 编辑模式 能够更完美的共存
* 【修正】setting 配置更加合理,并且增加了若干项配置参数 * 【修正】setting 配置更加合理,并且增加了若干项配置参数
* 【修正】treeNode 节点数据的属性更加合理,并且增加了一些方法 * 【修正】treeNode 节点数据的属性更加合理,并且增加了一些方法
* 【修正】拖拽操作更加灵活方便,更容易制定自己的规则 * 【修正】拖拽操作更加灵活方便,更容易制定自己的规则
* 【修正】其他若干修改,详细对比请参考 url[http://www.ztree.me/v3/faq.php#_101 zTree v3.0 常见问题] * 【修正】其他若干修改,详细对比请参考 url[http://www.ztree.me/v3/faq.php#_101 zTree v3.0 常见问题]

File diff suppressed because one or more lines are too long

View File

@ -1,45 +1,45 @@
<?xml version="1.0" standalone="no"?> <?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!-- <!--
2013-9-30: Created. 2013-9-30: Created.
--> -->
<svg> <svg>
<metadata> <metadata>
Created by iconfont Created by iconfont
</metadata> </metadata>
<defs> <defs>
<font id="laydate-icon" horiz-adv-x="1024" > <font id="laydate-icon" horiz-adv-x="1024" >
<font-face <font-face
font-family="laydate-icon" font-family="laydate-icon"
font-weight="500" font-weight="500"
font-stretch="normal" font-stretch="normal"
units-per-em="1024" units-per-em="1024"
ascent="896" ascent="896"
descent="-128" descent="-128"
/> />
<missing-glyph /> <missing-glyph />
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001" <glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" /> <glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" /> <glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" /> <glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" /> <glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" />
</font> </font>
</defs></svg> </defs></svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,484 +1,484 @@
.select2-container { .select2-container {
box-sizing: border-box; box-sizing: border-box;
display: inline-block; display: inline-block;
margin: 0; margin: 0;
position: relative; position: relative;
vertical-align: middle; } vertical-align: middle; }
.select2-container .select2-selection--single { .select2-container .select2-selection--single {
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
display: block; display: block;
height: 28px; height: 28px;
user-select: none; user-select: none;
-webkit-user-select: none; } -webkit-user-select: none; }
.select2-container .select2-selection--single .select2-selection__rendered { .select2-container .select2-selection--single .select2-selection__rendered {
display: block; display: block;
padding-left: 8px; padding-left: 8px;
padding-right: 20px; padding-right: 20px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; } white-space: nowrap; }
.select2-container .select2-selection--single .select2-selection__clear { .select2-container .select2-selection--single .select2-selection__clear {
position: relative; } position: relative; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered { .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px; padding-right: 8px;
padding-left: 20px; } padding-left: 20px; }
.select2-container .select2-selection--multiple { .select2-container .select2-selection--multiple {
box-sizing: border-box; box-sizing: border-box;
cursor: pointer; cursor: pointer;
display: block; display: block;
min-height: 32px; min-height: 32px;
user-select: none; user-select: none;
-webkit-user-select: none; } -webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered { .select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block; display: inline-block;
overflow: hidden; overflow: hidden;
padding-left: 8px; padding-left: 8px;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; } white-space: nowrap; }
.select2-container .select2-search--inline { .select2-container .select2-search--inline {
float: left; } float: left; }
.select2-container .select2-search--inline .select2-search__field { .select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box; box-sizing: border-box;
border: none; border: none;
font-size: 100%; font-size: 100%;
margin-top: 5px; margin-top: 5px;
padding: 0; } padding: 0; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button { .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; } -webkit-appearance: none; }
.select2-dropdown { .select2-dropdown {
background-color: white; background-color: white;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
display: block; display: block;
position: absolute; position: absolute;
left: -100000px; left: -100000px;
width: 100%; width: 100%;
z-index: 1051; } z-index: 1051; }
.select2-results { .select2-results {
display: block; } display: block; }
.select2-results__options { .select2-results__options {
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; } padding: 0; }
.select2-results__option { .select2-results__option {
padding: 6px; padding: 6px;
user-select: none; user-select: none;
-webkit-user-select: none; } -webkit-user-select: none; }
.select2-results__option[aria-selected] { .select2-results__option[aria-selected] {
cursor: pointer; } cursor: pointer; }
.select2-container--open .select2-dropdown { .select2-container--open .select2-dropdown {
left: 0; } left: 0; }
.select2-container--open .select2-dropdown--above { .select2-container--open .select2-dropdown--above {
border-bottom: none; border-bottom: none;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; } border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below { .select2-container--open .select2-dropdown--below {
border-top: none; border-top: none;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; } border-top-right-radius: 0; }
.select2-search--dropdown { .select2-search--dropdown {
display: block; display: block;
padding: 4px; } padding: 4px; }
.select2-search--dropdown .select2-search__field { .select2-search--dropdown .select2-search__field {
padding: 4px; padding: 4px;
width: 100%; width: 100%;
box-sizing: border-box; } box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button { .select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; } -webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide { .select2-search--dropdown.select2-search--hide {
display: none; } display: none; }
.select2-close-mask { .select2-close-mask {
border: 0; border: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
display: block; display: block;
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
min-height: 100%; min-height: 100%;
min-width: 100%; min-width: 100%;
height: auto; height: auto;
width: auto; width: auto;
opacity: 0; opacity: 0;
z-index: 99; z-index: 99;
background-color: #fff; background-color: #fff;
filter: alpha(opacity=0); } filter: alpha(opacity=0); }
.select2-hidden-accessible { .select2-hidden-accessible {
border: 0 !important; border: 0 !important;
clip: rect(0 0 0 0) !important; clip: rect(0 0 0 0) !important;
-webkit-clip-path: inset(50%) !important; -webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important; clip-path: inset(50%) !important;
height: 1px !important; height: 1px !important;
overflow: hidden !important; overflow: hidden !important;
padding: 0 !important; padding: 0 !important;
position: absolute !important; position: absolute !important;
width: 1px !important; width: 1px !important;
white-space: nowrap !important; } white-space: nowrap !important; }
.select2-container--default .select2-selection--single { .select2-container--default .select2-selection--single {
background-color: #fff; background-color: #fff;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; } border-radius: 4px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { .select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444; color: #444;
line-height: 28px; } line-height: 28px; }
.select2-container--default .select2-selection--single .select2-selection__clear { .select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer; cursor: pointer;
float: right; float: right;
font-weight: bold; } font-weight: bold; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { .select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; } color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow { .select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px; height: 26px;
position: absolute; position: absolute;
top: 1px; top: 1px;
right: 1px; right: 1px;
width: 20px; } width: 20px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b { .select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent; border-color: #888 transparent transparent transparent;
border-style: solid; border-style: solid;
border-width: 5px 4px 0 4px; border-width: 5px 4px 0 4px;
height: 0; height: 0;
left: 50%; left: 50%;
margin-left: -4px; margin-left: -4px;
margin-top: -2px; margin-top: -2px;
position: absolute; position: absolute;
top: 50%; top: 50%;
width: 0; } width: 0; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear { .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; } float: left; }
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow { .select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px; left: 1px;
right: auto; } right: auto; }
.select2-container--default.select2-container--disabled .select2-selection--single { .select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee; background-color: #eee;
cursor: default; } cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear { .select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none; } display: none; }
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b { .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent; border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; } border-width: 0 4px 5px 4px; }
.select2-container--default .select2-selection--multiple { .select2-container--default .select2-selection--multiple {
background-color: white; background-color: white;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: text; } cursor: text; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { .select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box; box-sizing: border-box;
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0 5px; padding: 0 5px;
width: 100%; } width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li { .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; } list-style: none; }
.select2-container--default .select2-selection--multiple .select2-selection__placeholder { .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
color: #999; color: #999;
margin-top: 5px; margin-top: 5px;
float: left; } float: left; }
.select2-container--default .select2-selection--multiple .select2-selection__clear { .select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer; cursor: pointer;
float: right; float: right;
font-weight: bold; font-weight: bold;
margin-top: 5px; margin-top: 5px;
margin-right: 10px; } margin-right: 10px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { .select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4; background-color: #e4e4e4;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: default; cursor: default;
float: left; float: left;
margin-right: 5px; margin-right: 5px;
margin-top: 5px; margin-top: 5px;
padding: 0 5px; } padding: 0 5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999; color: #999;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-weight: bold; font-weight: bold;
margin-right: 2px; } margin-right: 2px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333; } color: #333; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline { .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right; } float: right; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice { .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px; margin-left: 5px;
margin-right: auto; } margin-right: auto; }
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px; margin-left: 2px;
margin-right: auto; } margin-right: auto; }
.select2-container--default.select2-container--focus .select2-selection--multiple { .select2-container--default.select2-container--focus .select2-selection--multiple {
border: solid black 1px; border: solid black 1px;
outline: 0; } outline: 0; }
.select2-container--default.select2-container--disabled .select2-selection--multiple { .select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee; background-color: #eee;
cursor: default; } cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection__choice__remove { .select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none; } display: none; }
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple { .select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; } border-top-right-radius: 0; }
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple { .select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; } border-bottom-right-radius: 0; }
.select2-container--default .select2-search--dropdown .select2-search__field { .select2-container--default .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa; } border: 1px solid #aaa; }
.select2-container--default .select2-search--inline .select2-search__field { .select2-container--default .select2-search--inline .select2-search__field {
background: transparent; background: transparent;
border: none; border: none;
outline: 0; outline: 0;
box-shadow: none; box-shadow: none;
-webkit-appearance: textfield; } -webkit-appearance: textfield; }
.select2-container--default .select2-results > .select2-results__options { .select2-container--default .select2-results > .select2-results__options {
max-height: 200px; max-height: 200px;
overflow-y: auto; } overflow-y: auto; }
.select2-container--default .select2-results__option[role=group] { .select2-container--default .select2-results__option[role=group] {
padding: 0; } padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] { .select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; } color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] { .select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd; } background-color: #ddd; }
.select2-container--default .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em; } padding-left: 1em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__group { .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0; } padding-left: 0; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em; margin-left: -1em;
padding-left: 2em; } padding-left: 2em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em; margin-left: -2em;
padding-left: 3em; } padding-left: 3em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em; margin-left: -3em;
padding-left: 4em; } padding-left: 4em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em; margin-left: -4em;
padding-left: 5em; } padding-left: 5em; }
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { .select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em; margin-left: -5em;
padding-left: 6em; } padding-left: 6em; }
.select2-container--default .select2-results__option--highlighted[aria-selected] { .select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #5897fb; background-color: #5897fb;
color: white; } color: white; }
.select2-container--default .select2-results__group { .select2-container--default .select2-results__group {
cursor: default; cursor: default;
display: block; display: block;
padding: 6px; } padding: 6px; }
.select2-container--classic .select2-selection--single { .select2-container--classic .select2-selection--single {
background-color: #f7f7f7; background-color: #f7f7f7;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
outline: 0; outline: 0;
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%); background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%); background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%); background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic .select2-selection--single:focus { .select2-container--classic .select2-selection--single:focus {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--single .select2-selection__rendered { .select2-container--classic .select2-selection--single .select2-selection__rendered {
color: #444; color: #444;
line-height: 28px; } line-height: 28px; }
.select2-container--classic .select2-selection--single .select2-selection__clear { .select2-container--classic .select2-selection--single .select2-selection__clear {
cursor: pointer; cursor: pointer;
float: right; float: right;
font-weight: bold; font-weight: bold;
margin-right: 10px; } margin-right: 10px; }
.select2-container--classic .select2-selection--single .select2-selection__placeholder { .select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999; } color: #999; }
.select2-container--classic .select2-selection--single .select2-selection__arrow { .select2-container--classic .select2-selection--single .select2-selection__arrow {
background-color: #ddd; background-color: #ddd;
border: none; border: none;
border-left: 1px solid #aaa; border-left: 1px solid #aaa;
border-top-right-radius: 4px; border-top-right-radius: 4px;
border-bottom-right-radius: 4px; border-bottom-right-radius: 4px;
height: 26px; height: 26px;
position: absolute; position: absolute;
top: 1px; top: 1px;
right: 1px; right: 1px;
width: 20px; width: 20px;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%); background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%); background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%); background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); } filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
.select2-container--classic .select2-selection--single .select2-selection__arrow b { .select2-container--classic .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent; border-color: #888 transparent transparent transparent;
border-style: solid; border-style: solid;
border-width: 5px 4px 0 4px; border-width: 5px 4px 0 4px;
height: 0; height: 0;
left: 50%; left: 50%;
margin-left: -4px; margin-left: -4px;
margin-top: -2px; margin-top: -2px;
position: absolute; position: absolute;
top: 50%; top: 50%;
width: 0; } width: 0; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear { .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left; } float: left; }
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow { .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
border: none; border: none;
border-right: 1px solid #aaa; border-right: 1px solid #aaa;
border-radius: 0; border-radius: 0;
border-top-left-radius: 4px; border-top-left-radius: 4px;
border-bottom-left-radius: 4px; border-bottom-left-radius: 4px;
left: 1px; left: 1px;
right: auto; } right: auto; }
.select2-container--classic.select2-container--open .select2-selection--single { .select2-container--classic.select2-container--open .select2-selection--single {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow { .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
background: transparent; background: transparent;
border: none; } border: none; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b { .select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent; border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; } border-width: 0 4px 5px 4px; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single { .select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
border-top: none; border-top: none;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%); background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%); background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%); background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); } filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single { .select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
border-bottom: none; border-bottom: none;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%); background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%); background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%); background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); } filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
.select2-container--classic .select2-selection--multiple { .select2-container--classic .select2-selection--multiple {
background-color: white; background-color: white;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: text; cursor: text;
outline: 0; } outline: 0; }
.select2-container--classic .select2-selection--multiple:focus { .select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--multiple .select2-selection__rendered { .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0 5px; } padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__clear { .select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none; } display: none; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice { .select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4; background-color: #e4e4e4;
border: 1px solid #aaa; border: 1px solid #aaa;
border-radius: 4px; border-radius: 4px;
cursor: default; cursor: default;
float: left; float: left;
margin-right: 5px; margin-right: 5px;
margin-top: 5px; margin-top: 5px;
padding: 0 5px; } padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove { .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
color: #888; color: #888;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-weight: bold; font-weight: bold;
margin-right: 2px; } margin-right: 2px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover { .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #555; } color: #555; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice { .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
float: right; float: right;
margin-left: 5px; margin-left: 5px;
margin-right: auto; } margin-right: auto; }
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px; margin-left: 2px;
margin-right: auto; } margin-right: auto; }
.select2-container--classic.select2-container--open .select2-selection--multiple { .select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb; } border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple { .select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
border-top: none; border-top: none;
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; } border-top-right-radius: 0; }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple { .select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom: none; border-bottom: none;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
border-bottom-right-radius: 0; } border-bottom-right-radius: 0; }
.select2-container--classic .select2-search--dropdown .select2-search__field { .select2-container--classic .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa; border: 1px solid #aaa;
outline: 0; } outline: 0; }
.select2-container--classic .select2-search--inline .select2-search__field { .select2-container--classic .select2-search--inline .select2-search__field {
outline: 0; outline: 0;
box-shadow: none; } box-shadow: none; }
.select2-container--classic .select2-dropdown { .select2-container--classic .select2-dropdown {
background-color: white; background-color: white;
border: 1px solid transparent; } border: 1px solid transparent; }
.select2-container--classic .select2-dropdown--above { .select2-container--classic .select2-dropdown--above {
border-bottom: none; } border-bottom: none; }
.select2-container--classic .select2-dropdown--below { .select2-container--classic .select2-dropdown--below {
border-top: none; } border-top: none; }
.select2-container--classic .select2-results > .select2-results__options { .select2-container--classic .select2-results > .select2-results__options {
max-height: 200px; max-height: 200px;
overflow-y: auto; } overflow-y: auto; }
.select2-container--classic .select2-results__option[role=group] { .select2-container--classic .select2-results__option[role=group] {
padding: 0; } padding: 0; }
.select2-container--classic .select2-results__option[aria-disabled=true] { .select2-container--classic .select2-results__option[aria-disabled=true] {
color: grey; } color: grey; }
.select2-container--classic .select2-results__option--highlighted[aria-selected] { .select2-container--classic .select2-results__option--highlighted[aria-selected] {
background-color: #3875d7; background-color: #3875d7;
color: white; } color: white; }
.select2-container--classic .select2-results__group { .select2-container--classic .select2-results__group {
cursor: default; cursor: default;
display: block; display: block;
padding: 6px; } padding: 6px; }
.select2-container--classic.select2-container--open .select2-dropdown { .select2-container--classic.select2-container--open .select2-dropdown {
border-color: #5897fb; } border-color: #5897fb; }

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,180 +1,180 @@
/*this is basic form validation using for validation person's basic information author:Clara Guo data:2017/07/20*/ /*this is basic form validation using for validation person's basic information author:Clara Guo data:2017/07/20*/
$(document).ready(function(){ $(document).ready(function(){
$.validator.setDefaults({ $.validator.setDefaults({
submitHandler: function(form) { submitHandler: function(form) {
form.submit(); form.submit();
} }
}); });
//手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$) //手机号码验证身份证正则合并:(^\d{15}$)|(^\d{17}([0-9]|X)$)
jQuery.validator.addMethod("isPhone",function(value,element){ jQuery.validator.addMethod("isPhone",function(value,element){
var length = value.length; var length = value.length;
var phone=/^1[3|4|5|6|7|8|9][0-9]\d{8}$/; var phone=/^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
return this.optional(element)||(length == 11 && phone.test(value)); return this.optional(element)||(length == 11 && phone.test(value));
},"请填写正确的11位手机号"); },"请填写正确的11位手机号");
//电话号码验证 //电话号码验证
jQuery.validator.addMethod("isTel",function(value,element){ jQuery.validator.addMethod("isTel",function(value,element){
var tel = /^(0\d{2,3}-)?\d{7,8}$/g;//区号3,4位,号码7,8位 var tel = /^(0\d{2,3}-)?\d{7,8}$/g;//区号3,4位,号码7,8位
return this.optional(element) || (tel.test(value)); return this.optional(element) || (tel.test(value));
},"请填写正确的座机号码"); },"请填写正确的座机号码");
//姓名校验 //姓名校验
jQuery.validator.addMethod("isName",function(value,element){ jQuery.validator.addMethod("isName",function(value,element){
var name=/^[\u4e00-\u9fa5]{2,6}$/; var name=/^[\u4e00-\u9fa5]{2,6}$/;
return this.optional(element) || (name.test(value)); return this.optional(element) || (name.test(value));
},"姓名只能用汉字,长度2-4位"); },"姓名只能用汉字,长度2-4位");
//校验用户名 //校验用户名
jQuery.validator.addMethod("isUserName",function(value,element){ jQuery.validator.addMethod("isUserName",function(value,element){
var userName=/^[a-zA-Z0-9]{2,13}$/; var userName=/^[a-zA-Z0-9]{2,13}$/;
return this.optional(element) || (userName).test(value); return this.optional(element) || (userName).test(value);
},'请输入数字或者字母,不包含特殊字符'); },'请输入数字或者字母,不包含特殊字符');
//校验身份证 //校验身份证
jQuery.validator.addMethod("isIdentity",function(value,element){ jQuery.validator.addMethod("isIdentity",function(value,element){
var id= /^(\d{15}$|^\d{18}$|^\d{17}(\d|X))$/; var id= /^(\d{15}$|^\d{18}$|^\d{17}(\d|X))$/;
return this.optional(element) || (id.test(value)); return this.optional(element) || (id.test(value));
},"请输入正确的15或18位身份证号,末尾为大写X"); },"请输入正确的15或18位身份证号,末尾为大写X");
//校验出生日期 //校验出生日期
jQuery.validator.addMethod("isBirth",function(value,element){ jQuery.validator.addMethod("isBirth",function(value,element){
var birth = /^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/; var birth = /^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/;
return this.optional(element) || (birth).test(value); return this.optional(element) || (birth).test(value);
},"出生日期格式示例2000-01-01"); },"出生日期格式示例2000-01-01");
//校验IP地址 //校验IP地址
jQuery.validator.addMethod("isIp",function(value,element){ jQuery.validator.addMethod("isIp",function(value,element){
var ip = /^(?:(?:2[0-4][0-9]\.)|(?:25[0-5]\.)|(?:1[0-9][0-9]\.)|(?:[1-9][0-9]\.)|(?:[0-9]\.)){3}(?:(?:2[0-4][0-9])|(?:25[0-5])|(?:1[0-9][0-9])|(?:[1-9][0-9])|(?:[0-9]))$/; var ip = /^(?:(?:2[0-4][0-9]\.)|(?:25[0-5]\.)|(?:1[0-9][0-9]\.)|(?:[1-9][0-9]\.)|(?:[0-9]\.)){3}(?:(?:2[0-4][0-9])|(?:25[0-5])|(?:1[0-9][0-9])|(?:[1-9][0-9])|(?:[0-9]))$/;
return this.optional(element) || (ip).test(value); return this.optional(element) || (ip).test(value);
},"IP地址格式示例127.0.0.1"); },"IP地址格式示例127.0.0.1");
jQuery.validator.addMethod("notEqual", function(value, element, param) { jQuery.validator.addMethod("notEqual", function(value, element, param) {
return value != param; return value != param;
}, $.validator.format("输入值不允许为{0}")); }, $.validator.format("输入值不允许为{0}"));
jQuery.validator.addMethod("gt", function(value, element, param) { jQuery.validator.addMethod("gt", function(value, element, param) {
return value > param; return value > param;
}, $.validator.format("输入值必须大于{0}")); }, $.validator.format("输入值必须大于{0}"));
//校验新旧密码是否相同 //校验新旧密码是否相同
jQuery.validator.addMethod("isdiff",function(){ jQuery.validator.addMethod("isdiff",function(){
var p1=$("#pwdOld").val(); var p1=$("#pwdOld").val();
var p2=$("#pwdNew").val(); var p2=$("#pwdNew").val();
if(p1==p2){ if(p1==p2){
return false; return false;
}else{ }else{
return true; return true;
} }
}); });
//校验新密码和确认密码是否相同 //校验新密码和确认密码是否相同
jQuery.validator.addMethod("issame",function(){ jQuery.validator.addMethod("issame",function(){
var p3=$("#confirm_password").val(); var p3=$("#confirm_password").val();
var p4=$("#pwdNew").val(); var p4=$("#pwdNew").val();
if(p3==p4){ if(p3==p4){
return true; return true;
}else{ }else{
return false; return false;
} }
}); });
//校验基础信息表单 //校验基础信息表单
$("#basicInfoForm").validate({ $("#basicInfoForm").validate({
errorElement:'span', errorElement:'span',
errorClass:'help-block error-mes', errorClass:'help-block error-mes',
rules:{ rules:{
name:{ name:{
required:true, required:true,
isName:true isName:true
}, },
sex:"required", sex:"required",
birth:"required", birth:"required",
mobile:{ mobile:{
required:true, required:true,
isPhone:true isPhone:true
}, },
email:{ email:{
required:true, required:true,
email:true email:true
} }
}, },
messages:{ messages:{
name:{ name:{
required:"请输入中文姓名", required:"请输入中文姓名",
isName:"姓名只能为汉字" isName:"姓名只能为汉字"
}, },
sex:{ sex:{
required:"请输入性别" required:"请输入性别"
}, },
birth:{ birth:{
required:"请输入出生年月" required:"请输入出生年月"
}, },
mobile:{ mobile:{
required:"请输入手机号", required:"请输入手机号",
isPhone:"请填写正确的11位手机号" isPhone:"请填写正确的11位手机号"
}, },
email:{ email:{
required:"请输入邮箱", required:"请输入邮箱",
email:"请填写正确的邮箱格式" email:"请填写正确的邮箱格式"
} }
}, },
errorPlacement:function(error,element){ errorPlacement:function(error,element){
element.next().remove(); element.next().remove();
element.closest('.gg-formGroup').append(error); element.closest('.gg-formGroup').append(error);
}, },
highlight:function(element){ highlight:function(element){
$(element).closest('.gg-formGroup').addClass('has-error has-feedback'); $(element).closest('.gg-formGroup').addClass('has-error has-feedback');
}, },
success:function(label){ success:function(label){
var el = label.closest('.gg-formGroup').find("input"); var el = label.closest('.gg-formGroup').find("input");
el.next().remove(); el.next().remove();
label.closest('.gg-formGroup').removeClass('has-error').addClass("has-feedback has-success"); label.closest('.gg-formGroup').removeClass('has-error').addClass("has-feedback has-success");
label.remove(); label.remove();
}, },
submitHandler:function(form){ submitHandler:function(form){
alert("保存成功!"); alert("保存成功!");
} }
}); });
//校验修改密码表单 //校验修改密码表单
$("#modifyPwd").validate({ $("#modifyPwd").validate({
onfocusout: function(element) { $(element).valid()}, onfocusout: function(element) { $(element).valid()},
debug:false, //表示校验通过后是否直接提交表单 debug:false, //表示校验通过后是否直接提交表单
onkeyup:false, //表示按键松开时候监听验证 onkeyup:false, //表示按键松开时候监听验证
rules:{ rules:{
pwdOld:{ pwdOld:{
required:true, required:true,
minlength:6 minlength:6
}, },
pwdNew:{ pwdNew:{
required:true, required:true,
minlength:6, minlength:6,
isdiff:true, isdiff:true,
//issame:true, //issame:true,
}, },
confirm_password:{ confirm_password:{
required:true, required:true,
minlength:6, minlength:6,
issame:true, issame:true,
} }
}, },
messages:{ messages:{
pwdOld : { pwdOld : {
required:'必填', required:'必填',
minlength:$.validator.format('密码长度要大于6') minlength:$.validator.format('密码长度要大于6')
}, },
pwdNew:{ pwdNew:{
required:'必填', required:'必填',
minlength:$.validator.format('密码长度要大于6'), minlength:$.validator.format('密码长度要大于6'),
isdiff:'原密码与新密码不能重复', isdiff:'原密码与新密码不能重复',
}, },
confirm_password:{ confirm_password:{
required:'必填', required:'必填',
minlength:$.validator.format('密码长度要大于6'), minlength:$.validator.format('密码长度要大于6'),
issame:'新密码要与确认新密码一致', issame:'新密码要与确认新密码一致',
} }
}, },
errorElement:"mes", errorElement:"mes",
errorClass:"gg-star", errorClass:"gg-star",
errorPlacement: function(error, element) errorPlacement: function(error, element)
{ {
element.closest('.gg-formGroup').append(error); element.closest('.gg-formGroup').append(error);
} }
}); });
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,27 +1,27 @@
/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014 /*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
* http://jqueryvalidation.org/ * http://jqueryvalidation.org/
* Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */ * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
! function (a) { ! function (a) {
"function" == typeof define && define.amd ? define(["jquery", "jquery.validate.min"], a) : a(jQuery) "function" == typeof define && define.amd ? define(["jquery", "jquery.validate.min"], a) : a(jQuery)
}(function (a) { }(function (a) {
var icon = "<i class='fa fa-times-circle'></i> "; var icon = "<i class='fa fa-times-circle'></i> ";
a.extend(a.validator.messages, { a.extend(a.validator.messages, {
required: icon + "必填", required: icon + "必填",
remote: icon + "请修正此栏位", remote: icon + "请修正此栏位",
email: icon + "请输入有效的电子邮件", email: icon + "请输入有效的电子邮件",
url: icon + "请输入有效的网址", url: icon + "请输入有效的网址",
date: icon + "请输入有效的日期", date: icon + "请输入有效的日期",
dateISO: icon + "请输入有效的日期 (YYYY-MM-DD)", dateISO: icon + "请输入有效的日期 (YYYY-MM-DD)",
number: icon + "请输入正确的数字", number: icon + "请输入正确的数字",
digits: icon + "只能输入数字", digits: icon + "只能输入数字",
creditcard: icon + "请输入有效的信用卡号码", creditcard: icon + "请输入有效的信用卡号码",
equalTo: icon + "你的输入不相同", equalTo: icon + "你的输入不相同",
extension: icon + "请输入有效的后缀", extension: icon + "请输入有效的后缀",
maxlength: a.validator.format(icon + "最多 {0} 个字"), maxlength: a.validator.format(icon + "最多 {0} 个字"),
minlength: a.validator.format(icon + "最少 {0} 个字"), minlength: a.validator.format(icon + "最少 {0} 个字"),
rangelength: a.validator.format(icon + "请输入长度为 {0} 至 {1} 之间的字串"), rangelength: a.validator.format(icon + "请输入长度为 {0} 至 {1} 之间的字串"),
range: a.validator.format(icon + "请输入 {0} 至 {1} 之间的数值"), range: a.validator.format(icon + "请输入 {0} 至 {1} 之间的数值"),
max: a.validator.format(icon + "请输入不大于 {0} 的数值"), max: a.validator.format(icon + "请输入不大于 {0} 的数值"),
min: a.validator.format(icon + "请输入不小于 {0} 的数值") min: a.validator.format(icon + "请输入不小于 {0} 的数值")
}) })
}); });

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More