From 262ee4eb5c9adb18071f4a95f84932d491d39263 Mon Sep 17 00:00:00 2001 From: okayliao Date: Tue, 22 Jan 2019 15:44:47 +0800 Subject: [PATCH 01/89] =?UTF-8?q?fix:=20Mapper=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/quartz/mapper/SysJobLogMapper.java | 10 +++++++++- .../java/com/ruoyi/quartz/mapper/SysJobMapper.java | 5 +++-- .../main/resources/mapper/quartz/SysJobLogMapper.xml | 2 +- .../main/resources/mapper/system/SysRoleDeptMapper.xml | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java index 083c4e46a..23bd9321f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.quartz.mapper; -import java.util.List; import com.ruoyi.quartz.domain.SysJobLog; +import java.util.List; + /** * 调度任务日志信息 数据层 * @@ -18,6 +19,13 @@ public interface SysJobLogMapper */ public List selectJobLogList(SysJobLog jobLog); + /** + * 查询所有调度任务日志 + * + * @return 调度任务日志列表 + */ + public List selectJobLogAll(); + /** * 通过调度任务日志ID查询调度信息 * diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java index 34fd61846..e87cf7aed 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java @@ -1,8 +1,9 @@ package com.ruoyi.quartz.mapper; -import java.util.List; import com.ruoyi.quartz.domain.SysJob; +import java.util.List; + /** * 调度任务信息 数据层 * @@ -47,7 +48,7 @@ public interface SysJobMapper * @param ids 需要删除的数据ID * @return 结果 */ - public int deleteJobLogByIds(Long[] ids); + public int deleteJobByIds(Long[] ids); /** * 修改调度任务信息 diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml index 5353deb12..4c4706a74 100644 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml @@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml index cfbfd48bb..700671e15 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml @@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" From d5a89621a9dfaf9904b25830d66b5b0b4cdafefe Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 24 Jan 2019 16:31:50 +0800 Subject: [PATCH 02/89] =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E6=B1=A0=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/framework/config/GenConfig.java | 3 ++ .../framework/config/ThreadPoolConfig.java | 53 +++++++++++++++++++ .../ruoyi/framework/manager/AsyncManager.java | 5 +- .../SpringSessionValidationScheduler.java | 7 ++- .../com/ruoyi/generator/util/GenUtils.java | 10 ++-- .../ruoyi/quartz/mapper/SysJobLogMapper.java | 1 - .../com/ruoyi/quartz/mapper/SysJobMapper.java | 1 - .../com/ruoyi/quartz/util/ScheduleJob.java | 7 ++- 8 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java index 109c0cab4..7eacddd21 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java @@ -14,10 +14,13 @@ public class GenConfig { /** 作者 */ public static String author; + /** 生成包路径 */ public static String packageName; + /** 自动去除表前缀,默认是true */ public static String autoRemovePre; + /** 表前缀(类名不会包含表前缀) */ public static String tablePrefix; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java new file mode 100644 index 000000000..accdd5324 --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java @@ -0,0 +1,53 @@ +package com.ruoyi.framework.config; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * 线程池配置 + * + * @author ruoyi + **/ +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java index cb7188a74..936282515 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java @@ -1,9 +1,10 @@ package com.ruoyi.framework.manager; import java.util.TimerTask; -import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.ruoyi.common.utils.Threads; +import com.ruoyi.framework.util.SpringUtils; /** * 异步任务管理器 @@ -20,7 +21,7 @@ public class AsyncManager /** * 异步操作任务调度线程池 */ - private ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(5); + private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); /** * 单例模式 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java index f61094529..62731ca5c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/SpringSessionValidationScheduler.java @@ -1,6 +1,5 @@ package com.ruoyi.framework.shiro.web.session; -import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.apache.shiro.session.mgt.DefaultSessionManager; @@ -8,6 +7,8 @@ import org.apache.shiro.session.mgt.SessionValidationScheduler; import org.apache.shiro.session.mgt.ValidatingSessionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import com.ruoyi.common.utils.Threads; /** @@ -24,7 +25,9 @@ public class SpringSessionValidationScheduler implements SessionValidationSchedu /** * 定时器,用于处理超时的挂起请求,也用于连接断开时的重连。 */ - private final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); + @Autowired + @Qualifier("scheduledExecutorService") + private ScheduledExecutorService executorService; private volatile boolean enabled = false; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index e67f17846..bccc4650e 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -105,13 +105,11 @@ public class GenUtils */ public static String tableToJava(String tableName) { - if (Constants.AUTO_REOMVE_PRE.equals(Global.getAutoRemovePre())) + String autoRemovePre = Global.getAutoRemovePre(); + String tablePrefix = Global.getTablePrefix(); + if (Constants.AUTO_REOMVE_PRE.equals(autoRemovePre) && StringUtils.isNotEmpty(tablePrefix)) { - tableName = tableName.substring(tableName.indexOf("_") + 1); - } - if (StringUtils.isNotEmpty(Global.getTablePrefix())) - { - tableName = tableName.replace(Global.getTablePrefix(), ""); + tableName = tableName.replaceFirst(tablePrefix, ""); } return StringUtils.convertToCamelCase(tableName); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java index 23bd9321f..ee0710cea 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobLogMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.quartz.mapper; import com.ruoyi.quartz.domain.SysJobLog; - import java.util.List; /** diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java index e87cf7aed..1e030a3d5 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/mapper/SysJobMapper.java @@ -1,7 +1,6 @@ package com.ruoyi.quartz.mapper; import com.ruoyi.quartz.domain.SysJob; - import java.util.List; /** diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java index 4ce41f6f5..e3ced0aaf 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java @@ -1,14 +1,13 @@ package com.ruoyi.quartz.util; import java.util.Date; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.quartz.DisallowConcurrentExecution; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.quartz.QuartzJobBean; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.ScheduleConstants; @@ -29,7 +28,7 @@ public class ScheduleJob extends QuartzJobBean { private static final Logger log = LoggerFactory.getLogger(ScheduleJob.class); - private ExecutorService service = Executors.newSingleThreadExecutor(); + private ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) SpringContextUtil.getBean("publicThreadPool"); private final static ISysJobLogService jobLogService = (ISysJobLogService) SpringContextUtil.getBean("sysJobLogServiceImpl"); @@ -53,7 +52,7 @@ public class ScheduleJob extends QuartzJobBean // 执行任务 log.info("任务开始执行 - 名称:{} 方法:{}", job.getJobName(), job.getMethodName()); ScheduleRunnable task = new ScheduleRunnable(job.getJobName(), job.getMethodName(), job.getMethodParams()); - Future future = service.submit(task); + Future future = executor.submit(task); future.get(); long times = System.currentTimeMillis() - startTime; // 任务状态 0:成功 1:失败 From 25d7c2c1f78e5b7f44d8e7ca7db4ca7a0c110fd1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 24 Jan 2019 21:56:45 +0800 Subject: [PATCH 03/89] =?UTF-8?q?spring=E5=B7=A5=E5=85=B7=E7=B1=BB?= =?UTF-8?q?=E7=A7=BB=E8=87=B3common?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/spring}/SpringUtils.java | 2 +- .../ruoyi/framework/manager/AsyncManager.java | 2 +- .../manager/factory/AsyncFactory.java | 2 +- .../web/session/OnlineWebSessionManager.java | 2 +- .../ruoyi/framework/util/MessageUtils.java | 1 + .../com/ruoyi/quartz/util/ScheduleJob.java | 5 +- .../ruoyi/quartz/util/ScheduleRunnable.java | 3 +- .../ruoyi/quartz/util/SpringContextUtil.java | 49 ------------------- 8 files changed, 10 insertions(+), 56 deletions(-) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/util => ruoyi-common/src/main/java/com/ruoyi/common/utils/spring}/SpringUtils.java (95%) delete mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/SpringContextUtil.java diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java similarity index 95% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java index 99b0f05b4..daf253ecf 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/SpringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/spring/SpringUtils.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.util; +package com.ruoyi.common.utils.spring; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java index 936282515..485a63177 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/AsyncManager.java @@ -4,7 +4,7 @@ import java.util.TimerTask; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.ruoyi.common.utils.Threads; -import com.ruoyi.framework.util.SpringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; /** * 异步任务管理器 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java index d924af510..a85d775e9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java @@ -5,11 +5,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.AddressUtils; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.shiro.session.OnlineSession; import com.ruoyi.framework.util.LogUtils; import com.ruoyi.framework.util.ServletUtils; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.util.SpringUtils; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.domain.SysUserOnline; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java index 1c8edc6fd..080567eed 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/session/OnlineWebSessionManager.java @@ -14,8 +14,8 @@ import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.ShiroConstants; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.shiro.session.OnlineSession; -import com.ruoyi.framework.util.SpringUtils; import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.service.ISysUserOnlineService; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java index b787e1bd3..f656392cb 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java @@ -1,6 +1,7 @@ package com.ruoyi.framework.util; import org.springframework.context.MessageSource; +import com.ruoyi.common.utils.spring.SpringUtils; /** * 获取i18n资源文件 diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java index e3ced0aaf..9b606bc5f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java @@ -13,6 +13,7 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.domain.SysJobLog; import com.ruoyi.quartz.service.ISysJobLogService; @@ -28,9 +29,9 @@ public class ScheduleJob extends QuartzJobBean { private static final Logger log = LoggerFactory.getLogger(ScheduleJob.class); - private ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) SpringContextUtil.getBean("publicThreadPool"); + private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor"); - private final static ISysJobLogService jobLogService = (ISysJobLogService) SpringContextUtil.getBean("sysJobLogServiceImpl"); + private final static ISysJobLogService jobLogService = SpringUtils.getBean(ISysJobLogService.class); @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java index aea572b4d..5a96a1063 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.ReflectionUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; /** * 执行定时任务 @@ -23,7 +24,7 @@ public class ScheduleRunnable implements Runnable public ScheduleRunnable(String beanName, String methodName, String params) throws NoSuchMethodException, SecurityException { - this.target = SpringContextUtil.getBean(beanName); + this.target = SpringUtils.getBean(beanName); this.params = params; if (StringUtils.isNotEmpty(params)) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/SpringContextUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/SpringContextUtil.java deleted file mode 100644 index 6146b0391..000000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/SpringContextUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.ruoyi.quartz.util; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Service; - -/** - * spring管理环境中获取bean - * - * @author yangzz - */ -@Service("springContextUtil") -public class SpringContextUtil implements ApplicationContextAware -{ - // Spring应用上下文环境 - private static ApplicationContext applicationContext; - - /** - * 实现ApplicationContextAware接口的回调方法,设置上下文环境 - * - * @param applicationContext - */ - @Override - public void setApplicationContext(ApplicationContext applicationContext) - { - SpringContextUtil.applicationContext = applicationContext; - } - - /** - * @return ApplicationContext - */ - public static ApplicationContext getApplicationContext() - { - return applicationContext; - } - - /** - * 获取对象 - * - * @param name - * @return Object - * @throws BeansException - */ - public static Object getBean(String name) throws BeansException - { - return applicationContext.getBean(name); - } -} From 170e736c44e25a04b30cac5e1144618ed62c4586 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 25 Jan 2019 10:26:22 +0800 Subject: [PATCH 04/89] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=86=BB=E7=BB=93=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../columns/bootstrap-table-fixed-columns.css | 27 +++ .../columns/bootstrap-table-fixed-columns.js | 176 ++++++++++++++++++ .../main/resources/static/ruoyi/js/ry-ui.js | 12 +- .../src/main/resources/templates/include.html | 2 + 4 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css new file mode 100644 index 000000000..40855f9ae --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css @@ -0,0 +1,27 @@ +.fixed-table-header-columns, +.fixed-table-body-columns { + position: absolute; + background-color: #fff; + display: none; + box-sizing: border-box; + overflow: hidden; +} + +.fixed-table-header-columns .table, +.fixed-table-body-columns .table { + border-right: 1px solid #ddd; +} + +.fixed-table-header-columns .table.table-no-bordered, +.fixed-table-body-columns .table.table-no-bordered { + border-right: 1px solid transparent; +} + +.fixed-table-body-columns table { + position: absolute; + animation: none; +} + +.bootstrap-table .table-hover > tbody > tr.hover > td{ + background-color: #f5f5f5; +} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js new file mode 100644 index 000000000..24f4666f5 --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js @@ -0,0 +1,176 @@ +/** + * @author zhixin wen + * @version: v1.0.1 + */ +(function ($) { + 'use strict'; + + $.extend($.fn.bootstrapTable.defaults, { + fixedColumns: false, + fixedNumber: 1 + }); + + var BootstrapTable = $.fn.bootstrapTable.Constructor, + _initHeader = BootstrapTable.prototype.initHeader, + _initBody = BootstrapTable.prototype.initBody, + _resetView = BootstrapTable.prototype.resetView; + + BootstrapTable.prototype.initFixedColumns = function () { + this.$fixedHeader = $([ + '
', + '', + '', + '
', + '
'].join('')); + + this.timeoutHeaderColumns_ = 0; + this.$fixedHeader.find('table').attr('class', this.$el.attr('class')); + this.$fixedHeaderColumns = this.$fixedHeader.find('thead'); + this.$tableHeader.before(this.$fixedHeader); + + this.$fixedBody = $([ + '
', + '', + '', + '
', + '
'].join('')); + + this.timeoutBodyColumns_ = 0; + this.$fixedBody.find('table').attr('class', this.$el.attr('class')); + this.$fixedBodyColumns = this.$fixedBody.find('tbody'); + this.$tableBody.before(this.$fixedBody); + }; + + BootstrapTable.prototype.initHeader = function () { + _initHeader.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.fixedColumns) { + return; + } + + this.initFixedColumns(); + + var that = this, $trs = this.$header.find('tr').clone(); + $trs.each(function () { + $(this).find('th:gt(' + that.options.fixedNumber + ')').remove(); + }); + this.$fixedHeaderColumns.html('').append($trs); + }; + + BootstrapTable.prototype.initBody = function () { + _initBody.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.fixedColumns) { + return; + } + + var that = this, + rowspan = 0; + + this.$fixedBodyColumns.html(''); + this.$body.find('> tr[data-index]').each(function () { + var $tr = $(this).clone(), + $tds = $tr.find('td'); + + $tr.html(''); + var end = that.options.fixedNumber; + if (rowspan > 0) { + --end; + --rowspan; + } + for (var i = 0; i < end; i++) { + $tr.append($tds.eq(i).clone()); + } + that.$fixedBodyColumns.append($tr); + + if ($tds.eq(0).attr('rowspan')){ + rowspan = $tds.eq(0).attr('rowspan') - 1; + } + }); + }; + + BootstrapTable.prototype.resetView = function () { + _resetView.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.fixedColumns) { + return; + } + + clearTimeout(this.timeoutHeaderColumns_); + this.timeoutHeaderColumns_ = setTimeout($.proxy(this.fitHeaderColumns, this), this.$el.is(':hidden') ? 100 : 0); + + clearTimeout(this.timeoutBodyColumns_); + this.timeoutBodyColumns_ = setTimeout($.proxy(this.fitBodyColumns, this), this.$el.is(':hidden') ? 100 : 0); + }; + + BootstrapTable.prototype.fitHeaderColumns = function () { + var that = this, + visibleFields = this.getVisibleFields(), + headerWidth = 0; + + this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) { + var $this = $(this), + index = i; + + if (i >= that.options.fixedNumber) { + return false; + } + + if (that.options.detailView && !that.options.cardView) { + index = i - 1; + } + + that.$fixedHeader.find('th[data-field="' + visibleFields[index] + '"]') + .find('.fht-cell').width($this.innerWidth()); + headerWidth += $this.outerWidth(); + }); + this.$fixedHeader.width(headerWidth + 1).show(); + }; + + BootstrapTable.prototype.fitBodyColumns = function () { + var that = this, + top = -(parseInt(this.$el.css('margin-top')) - 2), + // the fixed height should reduce the scorll-x height + height = this.$tableBody.height() - 14; + + if (!this.$body.find('> tr[data-index]').length) { + this.$fixedBody.hide(); + return; + } + + if (!this.options.height) { + top = this.$fixedHeader.height(); + height = height - top; + } + + this.$fixedBody.css({ + width: this.$fixedHeader.width(), + height: height, + top: top + }).show(); + + this.$body.find('> tr').each(function (i) { + that.$fixedBody.find('tr:eq(' + i + ')').height($(this).height() - 1); + }); + + // events + this.$tableBody.on('scroll', function () { + that.$fixedBody.find('table').css('top', -$(this).scrollTop()); + }); + this.$body.find('> tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$fixedBody.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$fixedBody.find('tr[data-index="' + index + '"]').removeClass('hover'); + }); + this.$fixedBody.find('tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$body.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover'); + }); + }; + +})(jQuery); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 395b4ba11..63d8eac91 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -19,6 +19,8 @@ _striped = $.common.isEmpty(options.striped) ? false : options.striped; _escape = $.common.isEmpty(options.escape) ? false : options.escape; _showFooter = $.common.isEmpty(options.showFooter) ? false : options.showFooter; + _fixedColumns = $.common.isEmpty(options.fixedColumns) ? false : options.fixedColumns; + _fixedNumber = $.common.isEmpty(options.fixedNumber) ? 0 : options.fixedNumber; $('#bootstrap-table').bootstrapTable({ url: options.url, // 请求后台的URL(*) contentType: "application/x-www-form-urlencoded", // 编码类型 @@ -44,6 +46,8 @@ showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮 showExport: $.common.visible(options.showExport), // 是否支持导出文件 + fixedColumns: _fixedColumns, // 是否启用冻结列 + fixedNumber: _fixedNumber, // 冻结列的个数 queryParams: $.table._params, // 传递参数(*) columns: options.columns, // 显示列信息(*) responseHandler: $.table.responseHandler // 回调函数 @@ -140,6 +144,7 @@ return false; } var index = layer.load(2, {shade: false}); + $.modal.disable(); var formData = new FormData(); formData.append("file", $('#file')[0].files[0]); formData.append("updateSupport", $("input[name='updateSupport']").is(':checked')); @@ -157,6 +162,7 @@ $.table.refresh(); } else { layer.close(index); + $.modal.enable(); $.modal.alertError(result.msg); } } @@ -469,11 +475,13 @@ }, // 禁用按钮 disable: function() { - $("a[class*=layui-layer-btn]", window.parent.document).addClass("layer-disabled"); + var doc = window.top == window.parent ? window.document : window.parent.document; + $("a[class*=layui-layer-btn]", doc).addClass("layer-disabled"); }, // 启用按钮 enable: function() { - $("a[class*=layui-layer-btn]", window.parent.document).removeClass("layer-disabled"); + var doc = window.top == window.parent ? window.document : window.parent.document; + $("a[class*=layui-layer-btn]", doc).removeClass("layer-disabled"); }, // 打开遮罩层 loading: function (message) { diff --git a/ruoyi-admin/src/main/resources/templates/include.html b/ruoyi-admin/src/main/resources/templates/include.html index 9e9cc9e97..fbfc20a04 100644 --- a/ruoyi-admin/src/main/resources/templates/include.html +++ b/ruoyi-admin/src/main/resources/templates/include.html @@ -10,6 +10,7 @@ + @@ -24,6 +25,7 @@ + From 6b74dcb95f295a7ec3f4ca277063defda13e0259 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 25 Jan 2019 11:08:13 +0800 Subject: [PATCH 05/89] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E5=88=97=E5=86=BB=E7=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../columns/bootstrap-table-fixed-columns.css | 2 +- .../columns/bootstrap-table-fixed-columns.js | 290 +++++++++++------- .../main/resources/static/ruoyi/js/ry-ui.js | 8 +- 3 files changed, 192 insertions(+), 108 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css index 40855f9ae..b1ad801fe 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.css @@ -22,6 +22,6 @@ animation: none; } -.bootstrap-table .table-hover > tbody > tr.hover > td{ +.bootstrap-table .table-hover > tbody > tr.hover > td { background-color: #f5f5f5; } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js index 24f4666f5..adfae110e 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js @@ -1,13 +1,16 @@ /** - * @author zhixin wen - * @version: v1.0.1 + * 基于bootstrap-table-fixed-columns修改 + * 支持左右列冻结 + * Copyright (c) 2019 ruoyi */ (function ($) { 'use strict'; $.extend($.fn.bootstrapTable.defaults, { fixedColumns: false, - fixedNumber: 1 + fixedNumber: 1, + rightFixedColumns: false, + rightFixedNumber: 1 }); var BootstrapTable = $.fn.bootstrapTable.Constructor, @@ -16,83 +19,121 @@ _resetView = BootstrapTable.prototype.resetView; BootstrapTable.prototype.initFixedColumns = function () { - this.$fixedHeader = $([ - '
', - '', - '', - '
', - '
'].join('')); - this.timeoutHeaderColumns_ = 0; - this.$fixedHeader.find('table').attr('class', this.$el.attr('class')); - this.$fixedHeaderColumns = this.$fixedHeader.find('thead'); - this.$tableHeader.before(this.$fixedHeader); - - this.$fixedBody = $([ - '
', - '', - '', - '
', - '
'].join('')); - this.timeoutBodyColumns_ = 0; - this.$fixedBody.find('table').attr('class', this.$el.attr('class')); - this.$fixedBodyColumns = this.$fixedBody.find('tbody'); - this.$tableBody.before(this.$fixedBody); + if (this.options.fixedColumns) { + this.$fixedBody = $([ + '
', + '', + '', + '', + '
', + '
'].join('')); + + + this.$fixedBody.find('table').attr('class', this.$el.attr('class')); + this.$fixedHeaderColumns = this.$fixedBody.find('thead'); + this.$fixedBodyColumns = this.$fixedBody.find('tbody'); + this.$tableBody.before(this.$fixedBody); + } + if (this.options.rightFixedColumns) { + this.$rightfixedBody = $([ + '
', + '', + '', + '', + '
', + '
'].join('')); + + this.$rightfixedBody.find('table').attr('class', this.$el.attr('class')); + this.$rightfixedHeaderColumns = this.$rightfixedBody.find('thead'); + this.$rightfixedBodyColumns = this.$rightfixedBody.find('tbody'); + this.$tableBody.before(this.$rightfixedBody); + } }; BootstrapTable.prototype.initHeader = function () { _initHeader.apply(this, Array.prototype.slice.apply(arguments)); - if (!this.options.fixedColumns) { + if (!this.options.fixedColumns && !this.options.rightFixedColumns){ return; } - this.initFixedColumns(); - var that = this, $trs = this.$header.find('tr').clone(); - $trs.each(function () { - $(this).find('th:gt(' + that.options.fixedNumber + ')').remove(); - }); - this.$fixedHeaderColumns.html('').append($trs); + var $ltr = this.$header.find('tr:eq(0)').clone(), + $rtr = this.$header.find('tr:eq(0)').clone(), + $lths = $ltr.clone().find('th'), + $rths = $rtr.clone().find('th'); + + $ltr.html(''); + $rtr.html(''); + //右边列冻结 + if (this.options.rightFixedColumns) { + for (var i = 0; i < this.options.rightFixedNumber; i++) { + $rtr.append($rths.eq($rths.length - this.options.rightFixedNumber + i).clone()); + } + this.$rightfixedHeaderColumns.html('').append($rtr); + } + + //左边列冻结 + if (this.options.fixedColumns) { + for (var i = 0; i < this.options.fixedNumber; i++) { + $ltr.append($lths.eq(i).clone()); + } + this.$fixedHeaderColumns.html('').append($ltr); + } }; BootstrapTable.prototype.initBody = function () { _initBody.apply(this, Array.prototype.slice.apply(arguments)); - if (!this.options.fixedColumns) { + if (!this.options.fixedColumns && !this.options.rightFixedColumns) { return; } - var that = this, - rowspan = 0; + var that = this; + if (this.options.fixedColumns) { + this.$fixedBodyColumns.html(''); + this.$body.find('> tr[data-index]').each(function () { + var $tr = $(this).clone(), + $tds = $tr.clone().find('td'); - this.$fixedBodyColumns.html(''); - this.$body.find('> tr[data-index]').each(function () { - var $tr = $(this).clone(), - $tds = $tr.find('td'); + $tr.html(''); + for (var i = 0; i < that.options.fixedNumber; i++) { + $tr.append($tds.eq(i).clone()); + } + that.$fixedBodyColumns.append($tr); + }); + } + if (this.options.rightFixedColumns) { + this.$rightfixedBodyColumns.html(''); + this.$body.find('> tr[data-index]').each(function () { + var $tr = $(this).clone(), + $tds = $tr.clone().find('td'); - $tr.html(''); - var end = that.options.fixedNumber; - if (rowspan > 0) { - --end; - --rowspan; - } - for (var i = 0; i < end; i++) { - $tr.append($tds.eq(i).clone()); - } - that.$fixedBodyColumns.append($tr); - - if ($tds.eq(0).attr('rowspan')){ - rowspan = $tds.eq(0).attr('rowspan') - 1; - } - }); + $tr.html(''); + for (var i = 0; i < that.options.rightFixedNumber; i++) { + var indexTd = $tds.length - that.options.rightFixedNumber + i; + var oldTd = $tds.eq(indexTd); + var fixTd = oldTd.clone(); + var buttons = fixTd.find('button'); + //事件转移:冻结列里面的事件转移到实际按钮的事件 + buttons.each(function (key, item) { + $(item).click(function () { + that.$body.find("tr[data-index=" + $tr.attr('data-index') + "] td:eq(" + indexTd + ") button:eq(" + key + ")").click(); + }); + }); + $tr.append(fixTd); + } + that.$rightfixedBodyColumns.append($tr); + }); + } }; BootstrapTable.prototype.resetView = function () { _resetView.apply(this, Array.prototype.slice.apply(arguments)); - if (!this.options.fixedColumns) { + if (!this.options.fixedColumns && !this.options.rightFixedColumns) { return; } @@ -107,70 +148,109 @@ var that = this, visibleFields = this.getVisibleFields(), headerWidth = 0; + if (that.options.fixedColumns) { + this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) { + var $this = $(this), + index = i; - this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) { - var $this = $(this), - index = i; + if (i >= that.options.fixedNumber) { + return false; + } - if (i >= that.options.fixedNumber) { - return false; - } + if (that.options.detailView && !that.options.cardView) { + index = i - 1; + } - if (that.options.detailView && !that.options.cardView) { - index = i - 1; - } + that.$fixedBody.find('thead th[data-field="' + visibleFields[index] + '"]') + .find('.fht-cell').width($this.innerWidth() - 1); + headerWidth += $this.outerWidth(); + }); + this.$fixedBody.width(headerWidth - 1).show(); + } + if (that.options.rightFixedColumns) { + this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) { + var $this = $(this), + index = i; - that.$fixedHeader.find('th[data-field="' + visibleFields[index] + '"]') - .find('.fht-cell').width($this.innerWidth()); - headerWidth += $this.outerWidth(); - }); - this.$fixedHeader.width(headerWidth + 1).show(); + if (i >= visibleFields.length - that.options.rightFixedNumber) { + return false; + + + if (that.options.detailView && !that.options.cardView) { + index = i - 1; + } + that.$rightfixedBody.find('thead th[data-field="' + visibleFields[index] + '"]') + .find('.fht-cell').width($this.innerWidth() - 1); + headerWidth += $this.outerWidth(); + } + }); + this.$rightfixedBody.width(headerWidth - 1).show(); + } }; BootstrapTable.prototype.fitBodyColumns = function () { var that = this, top = -(parseInt(this.$el.css('margin-top')) - 2), - // the fixed height should reduce the scorll-x height - height = this.$tableBody.height() - 14; + height = this.$tableBody.height() - 2; - if (!this.$body.find('> tr[data-index]').length) { - this.$fixedBody.hide(); - return; + if (that.options.fixedColumns) { + if (!this.$body.find('> tr[data-index]').length) { + this.$fixedBody.hide(); + return; + } + + this.$body.find('> tr').each(function (i) { + that.$fixedBody.find('tbody tr:eq(' + i + ')').height($(this).height()); + }); + + //// events + this.$tableBody.on('scroll', function () { + that.$fixedBody.find('table').css('top', -$(this).scrollTop()); + }); + this.$body.find('> tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$fixedBody.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$fixedBody.find('tr[data-index="' + index + '"]').removeClass('hover'); + }); + this.$fixedBody.find('tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$body.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover'); + }); } + if (that.options.rightFixedColumns) { + if (!this.$body.find('> tr[data-index]').length) { + this.$rightfixedBody.hide(); + return; + } - if (!this.options.height) { - top = this.$fixedHeader.height(); - height = height - top; + this.$body.find('> tr').each(function (i) { + that.$rightfixedBody.find('tbody tr:eq(' + i + ')').height($(this).height()); + }); + + //// events + this.$tableBody.on('scroll', function () { + that.$rightfixedBody.find('table').css('top', -$(this).scrollTop()); + }); + this.$body.find('> tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$rightfixedBody.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$rightfixedBody.find('tr[data-index="' + index + '"]').removeClass('hover'); + }); + this.$rightfixedBody.find('tr[data-index]').off('hover').hover(function () { + var index = $(this).data('index'); + that.$body.find('tr[data-index="' + index + '"]').addClass('hover'); + }, function () { + var index = $(this).data('index'); + that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover'); + }); } - - this.$fixedBody.css({ - width: this.$fixedHeader.width(), - height: height, - top: top - }).show(); - - this.$body.find('> tr').each(function (i) { - that.$fixedBody.find('tr:eq(' + i + ')').height($(this).height() - 1); - }); - - // events - this.$tableBody.on('scroll', function () { - that.$fixedBody.find('table').css('top', -$(this).scrollTop()); - }); - this.$body.find('> tr[data-index]').off('hover').hover(function () { - var index = $(this).data('index'); - that.$fixedBody.find('tr[data-index="' + index + '"]').addClass('hover'); - }, function () { - var index = $(this).data('index'); - that.$fixedBody.find('tr[data-index="' + index + '"]').removeClass('hover'); - }); - this.$fixedBody.find('tr[data-index]').off('hover').hover(function () { - var index = $(this).data('index'); - that.$body.find('tr[data-index="' + index + '"]').addClass('hover'); - }, function () { - var index = $(this).data('index'); - that.$body.find('> tr[data-index="' + index + '"]').removeClass('hover'); - }); }; })(jQuery); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 63d8eac91..f1f2f8ef6 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -21,6 +21,8 @@ _showFooter = $.common.isEmpty(options.showFooter) ? false : options.showFooter; _fixedColumns = $.common.isEmpty(options.fixedColumns) ? false : options.fixedColumns; _fixedNumber = $.common.isEmpty(options.fixedNumber) ? 0 : options.fixedNumber; + _rightFixedColumns = $.common.isEmpty(options.rightFixedColumns) ? false : options.rightFixedColumns; + _rightFixedNumber = $.common.isEmpty(options.rightFixedNumber) ? 0 : options.rightFixedNumber; $('#bootstrap-table').bootstrapTable({ url: options.url, // 请求后台的URL(*) contentType: "application/x-www-form-urlencoded", // 编码类型 @@ -46,8 +48,10 @@ showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮 showExport: $.common.visible(options.showExport), // 是否支持导出文件 - fixedColumns: _fixedColumns, // 是否启用冻结列 - fixedNumber: _fixedNumber, // 冻结列的个数 + fixedColumns: _fixedColumns, // 是否启用冻结列(左侧) + fixedNumber: _fixedNumber, // 列冻结的个数(左侧) + rightFixedColumns: _rightFixedColumns, // 是否启用冻结列(右侧) + rightFixedNumber: _rightFixedNumber, // 列冻结的个数(右侧) queryParams: $.table._params, // 传递参数(*) columns: options.columns, // 显示列信息(*) responseHandler: $.table.responseHandler // 回调函数 From 894090c39fe5d736c0de631bab4a3dae6bded000 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 25 Jan 2019 17:48:17 +0800 Subject: [PATCH 06/89] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=B5=AE=E5=8A=A8=E6=8F=90=E7=A4=BA=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/ry-ui.js | 66 ++++++++++++------- .../templates/system/config/config.html | 8 +++ 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index f1f2f8ef6..32505448a 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -40,32 +40,33 @@ escape: _escape, // 转义HTML字符串 showFooter: _showFooter, // 是否显示表尾 iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 - toolbar: '#toolbar', // 指定工作栏 + toolbar: '#toolbar', // 指定工作栏 sidePagination: "server", // 启用服务端分页 search: $.common.visible(options.search), // 是否显示搜索框功能 showSearch: $.common.visible(options.showSearch), // 是否显示检索信息 showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮 - showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 - showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮 - showExport: $.common.visible(options.showExport), // 是否支持导出文件 - fixedColumns: _fixedColumns, // 是否启用冻结列(左侧) - fixedNumber: _fixedNumber, // 列冻结的个数(左侧) - rightFixedColumns: _rightFixedColumns, // 是否启用冻结列(右侧) - rightFixedNumber: _rightFixedNumber, // 列冻结的个数(右侧) + showColumns: $.common.visible(options.showColumns), // 是否显示隐藏某列下拉框 + showToggle: $.common.visible(options.showToggle), // 是否显示详细视图和列表视图的切换按钮 + showExport: $.common.visible(options.showExport), // 是否支持导出文件 + fixedColumns: _fixedColumns, // 是否启用冻结列(左侧) + fixedNumber: _fixedNumber, // 列冻结的个数(左侧) + rightFixedColumns: _rightFixedColumns, // 是否启用冻结列(右侧) + rightFixedNumber: _rightFixedNumber, // 列冻结的个数(右侧) queryParams: $.table._params, // 传递参数(*) columns: options.columns, // 显示列信息(*) - responseHandler: $.table.responseHandler // 回调函数 + responseHandler: $.table.responseHandler, // 回调函数 + onLoadSuccess: $.table.onLoadSuccess, // 回调函数 }); }, // 查询条件 queryParams: function(params) { return { // 传递参数查询参数 - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order }; }, // 请求获取数据后处理回调函数 @@ -73,10 +74,14 @@ if (res.code == 0) { return { rows: res.rows, total: res.total }; } else { - $.modal.alertWarning(res.msg); - return { rows: [], total: 0 }; + $.modal.alertWarning(res.msg); + return { rows: [], total: 0 }; } }, + // 当所有数据被加载时触发 + onLoadSuccess: function(data) { + $("[data-toggle='tooltip']").tooltip(); + }, // 序列号生成 serialNumber: function (index) { var table = $('#bootstrap-table').bootstrapTable('getOptions'); @@ -84,20 +89,31 @@ var pageNumber = table.pageNumber; return pageSize * (pageNumber - 1) + index + 1; }, + // 超出指定长度浮动提示 + tooltip: function (value, length) { + var _length = $.common.isEmpty(length) ? 12 : length; + var _text = ""; + if (value.length > _length) { + _text = value.substr(0, _length); + } else { + _text = value; + } + return '' + _text +''; + }, // 搜索-默认第一个form search: function(formId) { var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; var params = $("#bootstrap-table").bootstrapTable('getOptions'); params.queryParams = function(params) { - var search = {}; - $.each($("#" + currentId).serializeArray(), function(i, field) { - search[field.name] = field.value; - }); - search.pageSize = params.limit; - search.pageNum = params.offset / params.limit + 1; - search.searchValue = params.search; - search.orderByColumn = params.sort; - search.isAsc = params.order; + var search = {}; + $.each($("#" + currentId).serializeArray(), function(i, field) { + search[field.name] = field.value; + }); + search.pageSize = params.limit; + search.pageNum = params.offset / params.limit + 1; + search.searchValue = params.search; + search.orderByColumn = params.sort; + search.isAsc = params.order; return search; } $("#bootstrap-table").bootstrapTable('refresh', params); diff --git a/ruoyi-admin/src/main/resources/templates/system/config/config.html b/ruoyi-admin/src/main/resources/templates/system/config/config.html index 46c9ef87d..8e5da1367 100644 --- a/ruoyi-admin/src/main/resources/templates/system/config/config.html +++ b/ruoyi-admin/src/main/resources/templates/system/config/config.html @@ -102,6 +102,14 @@ return $.table.selectDictLabel(datas, value); } }, + { + field: 'remark', + title: '备注', + align: 'center', + formatter: function(value, row, index) { + return $.table.tooltip(value); + } + }, { field: 'createTime', title: '创建时间' From a8b7ba00acdedea16a1e24b3fd088aa13c5b08b6 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 25 Jan 2019 20:14:10 +0800 Subject: [PATCH 07/89] =?UTF-8?q?=E4=BF=AE=E6=94=B9tip=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/js/ry-ui.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 32505448a..b4934bdf3 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -54,8 +54,8 @@ rightFixedNumber: _rightFixedNumber, // 列冻结的个数(右侧) queryParams: $.table._params, // 传递参数(*) columns: options.columns, // 显示列信息(*) - responseHandler: $.table.responseHandler, // 回调函数 - onLoadSuccess: $.table.onLoadSuccess, // 回调函数 + responseHandler: $.table.responseHandler, // 在加载服务器发送来的数据之前处理函数 + onLoadSuccess: $.table.onLoadSuccess, // 当所有数据被加载时触发处理函数 }); }, // 查询条件 @@ -89,12 +89,12 @@ var pageNumber = table.pageNumber; return pageSize * (pageNumber - 1) + index + 1; }, - // 超出指定长度浮动提示 + // 列超出指定长度浮动提示 tooltip: function (value, length) { - var _length = $.common.isEmpty(length) ? 12 : length; + var _length = $.common.isEmpty(length) ? 20 : length; var _text = ""; if (value.length > _length) { - _text = value.substr(0, _length); + _text = value.substr(0, _length) + "..."; } else { _text = value; } From d5014c754cb6a6052f3bcfd3edd10d8650c3d3a0 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 28 Jan 2019 13:18:05 +0800 Subject: [PATCH 08/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E8=AF=A6=E6=83=85=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E8=A2=AB=E9=81=AE=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index b4934bdf3..3303b61d8 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -16,6 +16,7 @@ $.table._params = $.common.isEmpty(options.queryParams) ? $.table.queryParams : options.queryParams; _sortOrder = $.common.isEmpty(options.sortOrder) ? "asc" : options.sortOrder; _sortName = $.common.isEmpty(options.sortName) ? "" : options.sortName; + _pageSize = $.common.isEmpty(options.pageSize) ? 10 : options.pageSize; _striped = $.common.isEmpty(options.striped) ? false : options.striped; _escape = $.common.isEmpty(options.escape) ? false : options.escape; _showFooter = $.common.isEmpty(options.showFooter) ? false : options.showFooter; @@ -35,7 +36,7 @@ sortOrder: _sortOrder, // 排序方式 asc 或者 desc pagination: $.common.visible(options.pagination), // 是否显示分页(*) pageNumber: 1, // 初始化加载第一页,默认第一页 - pageSize: 10, // 每页的记录行数(*) + pageSize: _pageSize, // 每页的记录行数(*) pageList: [10, 25, 50], // 可供选择的每页的行数(*) escape: _escape, // 转义HTML字符串 showFooter: _showFooter, // 是否显示表尾 @@ -563,6 +564,7 @@ shade: 0.3, title: $.table._option.modalName + "详细", content: _url, + zIndex: 9999999999, btn: ['关闭'], // 弹层外区域关闭 shadeClose: true, From c5968b76ec64bc528fd6e6cd98ce1337b0a1c19b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 28 Jan 2019 13:59:59 +0800 Subject: [PATCH 09/89] =?UTF-8?q?=E5=8D=87=E7=BA=A7datepicker=E6=8B=93?= =?UTF-8?q?=E5=B1=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libs/datapicker/bootstrap-datepicker.js | 1671 -------------- .../datapicker/bootstrap-datetimepicker.css | 418 ++++ .../datapicker/bootstrap-datetimepicker.js | 1967 +++++++++++++++++ .../bootstrap-datetimepicker.min.css | 9 + .../bootstrap-datetimepicker.min.js | 1 + .../ajax/libs/datapicker/datepicker3.css | 789 ------- .../resources/templates/tool/build/build.html | 12 +- 7 files changed, 2403 insertions(+), 2464 deletions(-) delete mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datepicker.js create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js delete mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/datepicker3.css diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datepicker.js b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datepicker.js deleted file mode 100644 index 053b510d0..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datepicker.js +++ /dev/null @@ -1,1671 +0,0 @@ -/* ========================================================= - * bootstrap-datepicker.js - * Repo: https://github.com/eternicode/bootstrap-datepicker/ - * Demo: http://eternicode.github.io/bootstrap-datepicker/ - * Docs: http://bootstrap-datepicker.readthedocs.org/ - * Forked from http://www.eyecon.ro/bootstrap-datepicker - * ========================================================= - * Started by Stefan Petre; improvements by Andrew Rowls + contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================= */ - -(function($, undefined){ - - var $window = $(window); - - function UTCDate(){ - return new Date(Date.UTC.apply(Date, arguments)); - } - function UTCToday(){ - var today = new Date(); - return UTCDate(today.getFullYear(), today.getMonth(), today.getDate()); - } - function alias(method){ - return function(){ - return this[method].apply(this, arguments); - }; - } - - var DateArray = (function(){ - var extras = { - get: function(i){ - return this.slice(i)[0]; - }, - contains: function(d){ - // Array.indexOf is not cross-browser; - // $.inArray doesn't work with Dates - var val = d && d.valueOf(); - for (var i=0, l=this.length; i < l; i++) - if (this[i].valueOf() === val) - return i; - return -1; - }, - remove: function(i){ - this.splice(i,1); - }, - replace: function(new_array){ - if (!new_array) - return; - if (!$.isArray(new_array)) - new_array = [new_array]; - this.clear(); - this.push.apply(this, new_array); - }, - clear: function(){ - this.splice(0); - }, - copy: function(){ - var a = new DateArray(); - a.replace(this); - return a; - } - }; - - return function(){ - var a = []; - a.push.apply(a, arguments); - $.extend(a, extras); - return a; - }; - })(); - - - // Picker object - - var Datepicker = function(element, options){ - this.dates = new DateArray(); - this.viewDate = UTCToday(); - this.focusDate = null; - - this._process_options(options); - - this.element = $(element); - this.isInline = false; - this.isInput = this.element.is('input'); - this.component = this.element.is('.date') ? this.element.find('.add-on, .input-group-addon, .btn') : false; - this.hasInput = this.component && this.element.find('input').length; - if (this.component && this.component.length === 0) - this.component = false; - - this.picker = $(DPGlobal.template); - this._buildEvents(); - this._attachEvents(); - - if (this.isInline){ - this.picker.addClass('datepicker-inline').appendTo(this.element); - } - else { - this.picker.addClass('datepicker-dropdown dropdown-menu'); - } - - if (this.o.rtl){ - this.picker.addClass('datepicker-rtl'); - } - - this.viewMode = this.o.startView; - - if (this.o.calendarWeeks) - this.picker.find('tfoot th.today') - .attr('colspan', function(i, val){ - return parseInt(val) + 1; - }); - - this._allow_update = false; - - this.setStartDate(this._o.startDate); - this.setEndDate(this._o.endDate); - this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled); - - this.fillDow(); - this.fillMonths(); - - this._allow_update = true; - - this.update(); - this.showMode(); - - if (this.isInline){ - this.show(); - } - }; - - Datepicker.prototype = { - constructor: Datepicker, - - _process_options: function(opts){ - // Store raw options for reference - this._o = $.extend({}, this._o, opts); - // Processed options - var o = this.o = $.extend({}, this._o); - - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - var lang = o.language; - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - lang = defaults.language; - } - o.language = lang; - - switch (o.startView){ - case 2: - case 'decade': - o.startView = 2; - break; - case 1: - case 'year': - o.startView = 1; - break; - default: - o.startView = 0; - } - - switch (o.minViewMode){ - case 1: - case 'months': - o.minViewMode = 1; - break; - case 2: - case 'years': - o.minViewMode = 2; - break; - default: - o.minViewMode = 0; - } - - o.startView = Math.max(o.startView, o.minViewMode); - - // true, false, or Number > 0 - if (o.multidate !== true){ - o.multidate = Number(o.multidate) || false; - if (o.multidate !== false) - o.multidate = Math.max(0, o.multidate); - else - o.multidate = 1; - } - o.multidateSeparator = String(o.multidateSeparator); - - o.weekStart %= 7; - o.weekEnd = ((o.weekStart + 6) % 7); - - var format = DPGlobal.parseFormat(o.format); - if (o.startDate !== -Infinity){ - if (!!o.startDate){ - if (o.startDate instanceof Date) - o.startDate = this._local_to_utc(this._zero_time(o.startDate)); - else - o.startDate = DPGlobal.parseDate(o.startDate, format, o.language); - } - else { - o.startDate = -Infinity; - } - } - if (o.endDate !== Infinity){ - if (!!o.endDate){ - if (o.endDate instanceof Date) - o.endDate = this._local_to_utc(this._zero_time(o.endDate)); - else - o.endDate = DPGlobal.parseDate(o.endDate, format, o.language); - } - else { - o.endDate = Infinity; - } - } - - o.daysOfWeekDisabled = o.daysOfWeekDisabled||[]; - if (!$.isArray(o.daysOfWeekDisabled)) - o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/); - o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){ - return parseInt(d, 10); - }); - - var plc = String(o.orientation).toLowerCase().split(/\s+/g), - _plc = o.orientation.toLowerCase(); - plc = $.grep(plc, function(word){ - return (/^auto|left|right|top|bottom$/).test(word); - }); - o.orientation = {x: 'auto', y: 'auto'}; - if (!_plc || _plc === 'auto') - ; // no action - else if (plc.length === 1){ - switch (plc[0]){ - case 'top': - case 'bottom': - o.orientation.y = plc[0]; - break; - case 'left': - case 'right': - o.orientation.x = plc[0]; - break; - } - } - else { - _plc = $.grep(plc, function(word){ - return (/^left|right$/).test(word); - }); - o.orientation.x = _plc[0] || 'auto'; - - _plc = $.grep(plc, function(word){ - return (/^top|bottom$/).test(word); - }); - o.orientation.y = _plc[0] || 'auto'; - } - }, - _events: [], - _secondaryEvents: [], - _applyEvents: function(evs){ - for (var i=0, el, ch, ev; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } - else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.on(ev, ch); - } - }, - _unapplyEvents: function(evs){ - for (var i=0, el, ev, ch; i < evs.length; i++){ - el = evs[i][0]; - if (evs[i].length === 2){ - ch = undefined; - ev = evs[i][1]; - } - else if (evs[i].length === 3){ - ch = evs[i][1]; - ev = evs[i][2]; - } - el.off(ev, ch); - } - }, - _buildEvents: function(){ - if (this.isInput){ // single input - this._events = [ - [this.element, { - focus: $.proxy(this.show, this), - keyup: $.proxy(function(e){ - if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) - this.update(); - }, this), - keydown: $.proxy(this.keydown, this) - }] - ]; - } - else if (this.component && this.hasInput){ // component: input + button - this._events = [ - // For components that are not readonly, allow keyboard nav - [this.element.find('input'), { - focus: $.proxy(this.show, this), - keyup: $.proxy(function(e){ - if ($.inArray(e.keyCode, [27,37,39,38,40,32,13,9]) === -1) - this.update(); - }, this), - keydown: $.proxy(this.keydown, this) - }], - [this.component, { - click: $.proxy(this.show, this) - }] - ]; - } - else if (this.element.is('div')){ // inline datepicker - this.isInline = true; - } - else { - this._events = [ - [this.element, { - click: $.proxy(this.show, this) - }] - ]; - } - this._events.push( - // Component: listen for blur on element descendants - [this.element, '*', { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }], - // Input: listen for blur on element - [this.element, { - blur: $.proxy(function(e){ - this._focused_from = e.target; - }, this) - }] - ); - - this._secondaryEvents = [ - [this.picker, { - click: $.proxy(this.click, this) - }], - [$(window), { - resize: $.proxy(this.place, this) - }], - [$(document), { - 'mousedown touchstart': $.proxy(function(e){ - // Clicked outside the datepicker, hide it - if (!( - this.element.is(e.target) || - this.element.find(e.target).length || - this.picker.is(e.target) || - this.picker.find(e.target).length - )){ - this.hide(); - } - }, this) - }] - ]; - }, - _attachEvents: function(){ - this._detachEvents(); - this._applyEvents(this._events); - }, - _detachEvents: function(){ - this._unapplyEvents(this._events); - }, - _attachSecondaryEvents: function(){ - this._detachSecondaryEvents(); - this._applyEvents(this._secondaryEvents); - }, - _detachSecondaryEvents: function(){ - this._unapplyEvents(this._secondaryEvents); - }, - _trigger: function(event, altdate){ - var date = altdate || this.dates.get(-1), - local_date = this._utc_to_local(date); - - this.element.trigger({ - type: event, - date: local_date, - dates: $.map(this.dates, this._utc_to_local), - format: $.proxy(function(ix, format){ - if (arguments.length === 0){ - ix = this.dates.length - 1; - format = this.o.format; - } - else if (typeof ix === 'string'){ - format = ix; - ix = this.dates.length - 1; - } - format = format || this.o.format; - var date = this.dates.get(ix); - return DPGlobal.formatDate(date, format, this.o.language); - }, this) - }); - }, - - show: function(){ - if (!this.isInline) - this.picker.appendTo('body'); - this.picker.show(); - this.place(); - this._attachSecondaryEvents(); - this._trigger('show'); - }, - - hide: function(){ - if (this.isInline) - return; - if (!this.picker.is(':visible')) - return; - this.focusDate = null; - this.picker.hide().detach(); - this._detachSecondaryEvents(); - this.viewMode = this.o.startView; - this.showMode(); - - if ( - this.o.forceParse && - ( - this.isInput && this.element.val() || - this.hasInput && this.element.find('input').val() - ) - ) - this.setValue(); - this._trigger('hide'); - }, - - remove: function(){ - this.hide(); - this._detachEvents(); - this._detachSecondaryEvents(); - this.picker.remove(); - delete this.element.data().datepicker; - if (!this.isInput){ - delete this.element.data().date; - } - }, - - _utc_to_local: function(utc){ - return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000)); - }, - _local_to_utc: function(local){ - return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000)); - }, - _zero_time: function(local){ - return local && new Date(local.getFullYear(), local.getMonth(), local.getDate()); - }, - _zero_utc_time: function(utc){ - return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate())); - }, - - getDates: function(){ - return $.map(this.dates, this._utc_to_local); - }, - - getUTCDates: function(){ - return $.map(this.dates, function(d){ - return new Date(d); - }); - }, - - getDate: function(){ - return this._utc_to_local(this.getUTCDate()); - }, - - getUTCDate: function(){ - return new Date(this.dates.get(-1)); - }, - - setDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.update.apply(this, args); - this._trigger('changeDate'); - this.setValue(); - }, - - setUTCDates: function(){ - var args = $.isArray(arguments[0]) ? arguments[0] : arguments; - this.update.apply(this, $.map(args, this._utc_to_local)); - this._trigger('changeDate'); - this.setValue(); - }, - - setDate: alias('setDates'), - setUTCDate: alias('setUTCDates'), - - setValue: function(){ - var formatted = this.getFormattedDate(); - if (!this.isInput){ - if (this.component){ - this.element.find('input').val(formatted).change(); - } - } - else { - this.element.val(formatted).change(); - } - }, - - getFormattedDate: function(format){ - if (format === undefined) - format = this.o.format; - - var lang = this.o.language; - return $.map(this.dates, function(d){ - return DPGlobal.formatDate(d, format, lang); - }).join(this.o.multidateSeparator); - }, - - setStartDate: function(startDate){ - this._process_options({startDate: startDate}); - this.update(); - this.updateNavArrows(); - }, - - setEndDate: function(endDate){ - this._process_options({endDate: endDate}); - this.update(); - this.updateNavArrows(); - }, - - setDaysOfWeekDisabled: function(daysOfWeekDisabled){ - this._process_options({daysOfWeekDisabled: daysOfWeekDisabled}); - this.update(); - this.updateNavArrows(); - }, - - place: function(){ - if (this.isInline) - return; - var calendarWidth = this.picker.outerWidth(), - calendarHeight = this.picker.outerHeight(), - visualPadding = 10, - windowWidth = $window.width(), - windowHeight = $window.height(), - scrollTop = $window.scrollTop(); - - var zIndex = parseInt(this.element.parents().filter(function(){ - return $(this).css('z-index') !== 'auto'; - }).first().css('z-index'))+10; - var offset = this.component ? this.component.parent().offset() : this.element.offset(); - var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); - var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); - var left = offset.left, - top = offset.top; - - this.picker.removeClass( - 'datepicker-orient-top datepicker-orient-bottom '+ - 'datepicker-orient-right datepicker-orient-left' - ); - - if (this.o.orientation.x !== 'auto'){ - this.picker.addClass('datepicker-orient-' + this.o.orientation.x); - if (this.o.orientation.x === 'right') - left -= calendarWidth - width; - } - // auto x orientation is best-placement: if it crosses a window - // edge, fudge it sideways - else { - // Default to left - this.picker.addClass('datepicker-orient-left'); - if (offset.left < 0) - left -= offset.left - visualPadding; - else if (offset.left + calendarWidth > windowWidth) - left = windowWidth - calendarWidth - visualPadding; - } - - // auto y orientation is best-situation: top or bottom, no fudging, - // decision based on which shows more of the calendar - var yorient = this.o.orientation.y, - top_overflow, bottom_overflow; - if (yorient === 'auto'){ - top_overflow = -scrollTop + offset.top - calendarHeight; - bottom_overflow = scrollTop + windowHeight - (offset.top + height + calendarHeight); - if (Math.max(top_overflow, bottom_overflow) === bottom_overflow) - yorient = 'top'; - else - yorient = 'bottom'; - } - this.picker.addClass('datepicker-orient-' + yorient); - if (yorient === 'top') - top += height; - else - top -= calendarHeight + parseInt(this.picker.css('padding-top')); - - this.picker.css({ - top: top, - left: left, - zIndex: zIndex - }); - }, - - _allow_update: true, - update: function(){ - if (!this._allow_update) - return; - - var oldDates = this.dates.copy(), - dates = [], - fromArgs = false; - if (arguments.length){ - $.each(arguments, $.proxy(function(i, date){ - if (date instanceof Date) - date = this._local_to_utc(date); - dates.push(date); - }, this)); - fromArgs = true; - } - else { - dates = this.isInput - ? this.element.val() - : this.element.data('date') || this.element.find('input').val(); - if (dates && this.o.multidate) - dates = dates.split(this.o.multidateSeparator); - else - dates = [dates]; - delete this.element.data().date; - } - - dates = $.map(dates, $.proxy(function(date){ - return DPGlobal.parseDate(date, this.o.format, this.o.language); - }, this)); - dates = $.grep(dates, $.proxy(function(date){ - return ( - date < this.o.startDate || - date > this.o.endDate || - !date - ); - }, this), true); - this.dates.replace(dates); - - if (this.dates.length) - this.viewDate = new Date(this.dates.get(-1)); - else if (this.viewDate < this.o.startDate) - this.viewDate = new Date(this.o.startDate); - else if (this.viewDate > this.o.endDate) - this.viewDate = new Date(this.o.endDate); - - if (fromArgs){ - // setting date by clicking - this.setValue(); - } - else if (dates.length){ - // setting date by typing - if (String(oldDates) !== String(this.dates)) - this._trigger('changeDate'); - } - if (!this.dates.length && oldDates.length) - this._trigger('clearDate'); - - this.fill(); - }, - - fillDow: function(){ - var dowCnt = this.o.weekStart, - html = ''; - if (this.o.calendarWeeks){ - var cell = ' '; - html += cell; - this.picker.find('.datepicker-days thead tr:first-child').prepend(cell); - } - while (dowCnt < this.o.weekStart + 7){ - html += ''+dates[this.o.language].daysMin[(dowCnt++)%7]+''; - } - html += ''; - this.picker.find('.datepicker-days thead').append(html); - }, - - fillMonths: function(){ - var html = '', - i = 0; - while (i < 12){ - html += ''+dates[this.o.language].monthsShort[i++]+''; - } - this.picker.find('.datepicker-months td').html(html); - }, - - setRange: function(range){ - if (!range || !range.length) - delete this.range; - else - this.range = $.map(range, function(d){ - return d.valueOf(); - }); - this.fill(); - }, - - getClassNames: function(date){ - var cls = [], - year = this.viewDate.getUTCFullYear(), - month = this.viewDate.getUTCMonth(), - today = new Date(); - if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ - cls.push('old'); - } - else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ - cls.push('new'); - } - if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) - cls.push('focused'); - // Compare internal UTC date with local today, not UTC today - if (this.o.todayHighlight && - date.getUTCFullYear() === today.getFullYear() && - date.getUTCMonth() === today.getMonth() && - date.getUTCDate() === today.getDate()){ - cls.push('today'); - } - if (this.dates.contains(date) !== -1) - cls.push('active'); - if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || - $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){ - cls.push('disabled'); - } - if (this.range){ - if (date > this.range[0] && date < this.range[this.range.length-1]){ - cls.push('range'); - } - if ($.inArray(date.valueOf(), this.range) !== -1){ - cls.push('selected'); - } - } - return cls; - }, - - fill: function(){ - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(), - startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, - startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, - endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, - endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, - todaytxt = dates[this.o.language].today || dates['en'].today || '', - cleartxt = dates[this.o.language].clear || dates['en'].clear || '', - tooltip; - this.picker.find('.datepicker-days thead th.datepicker-switch') - .text(dates[this.o.language].months[month]+' '+year); - this.picker.find('tfoot th.today') - .text(todaytxt) - .toggle(this.o.todayBtn !== false); - this.picker.find('tfoot th.clear') - .text(cleartxt) - .toggle(this.o.clearBtn !== false); - this.updateNavArrows(); - this.fillMonths(); - var prevMonth = UTCDate(year, month-1, 28), - day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); - prevMonth.setUTCDate(day); - prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); - var nextMonth = new Date(prevMonth); - nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); - nextMonth = nextMonth.valueOf(); - var html = []; - var clsName; - while (prevMonth.valueOf() < nextMonth){ - if (prevMonth.getUTCDay() === this.o.weekStart){ - html.push(''); - if (this.o.calendarWeeks){ - // ISO 8601: First week contains first thursday. - // ISO also states week starts on Monday, but we can be more abstract here. - var - // Start of current week: based on weekstart/current date - ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), - // Thursday of this week - th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), - // First Thursday of year, year from thursday - yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), - // Calendar week: ms between thursdays, div ms per day, div 7 days - calWeek = (th - yth) / 864e5 / 7 + 1; - html.push(''+ calWeek +''); - - } - } - clsName = this.getClassNames(prevMonth); - clsName.push('day'); - - if (this.o.beforeShowDay !== $.noop){ - var before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); - if (before === undefined) - before = {}; - else if (typeof(before) === 'boolean') - before = {enabled: before}; - else if (typeof(before) === 'string') - before = {classes: before}; - if (before.enabled === false) - clsName.push('disabled'); - if (before.classes) - clsName = clsName.concat(before.classes.split(/\s+/)); - if (before.tooltip) - tooltip = before.tooltip; - } - - clsName = $.unique(clsName); - html.push(''+prevMonth.getUTCDate() + ''); - if (prevMonth.getUTCDay() === this.o.weekEnd){ - html.push(''); - } - prevMonth.setUTCDate(prevMonth.getUTCDate()+1); - } - this.picker.find('.datepicker-days tbody').empty().append(html.join('')); - - var months = this.picker.find('.datepicker-months') - .find('th:eq(1)') - .text(year) - .end() - .find('span').removeClass('active'); - - $.each(this.dates, function(i, d){ - if (d.getUTCFullYear() === year) - months.eq(d.getUTCMonth()).addClass('active'); - }); - - if (year < startYear || year > endYear){ - months.addClass('disabled'); - } - if (year === startYear){ - months.slice(0, startMonth).addClass('disabled'); - } - if (year === endYear){ - months.slice(endMonth+1).addClass('disabled'); - } - - html = ''; - year = parseInt(year/10, 10) * 10; - var yearCont = this.picker.find('.datepicker-years') - .find('th:eq(1)') - .text(year + '-' + (year + 9)) - .end() - .find('td'); - year -= 1; - var years = $.map(this.dates, function(d){ - return d.getUTCFullYear(); - }), - classes; - for (var i = -1; i < 11; i++){ - classes = ['year']; - if (i === -1) - classes.push('old'); - else if (i === 10) - classes.push('new'); - if ($.inArray(year, years) !== -1) - classes.push('active'); - if (year < startYear || year > endYear) - classes.push('disabled'); - html += ''+year+''; - year += 1; - } - yearCont.html(html); - }, - - updateNavArrows: function(){ - if (!this._allow_update) - return; - - var d = new Date(this.viewDate), - year = d.getUTCFullYear(), - month = d.getUTCMonth(); - switch (this.viewMode){ - case 0: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - case 1: - case 2: - if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){ - this.picker.find('.prev').css({visibility: 'hidden'}); - } - else { - this.picker.find('.prev').css({visibility: 'visible'}); - } - if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){ - this.picker.find('.next').css({visibility: 'hidden'}); - } - else { - this.picker.find('.next').css({visibility: 'visible'}); - } - break; - } - }, - - click: function(e){ - e.preventDefault(); - var target = $(e.target).closest('span, td, th'), - year, month, day; - if (target.length === 1){ - switch (target[0].nodeName.toLowerCase()){ - case 'th': - switch (target[0].className){ - case 'datepicker-switch': - this.showMode(1); - break; - case 'prev': - case 'next': - var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); - switch (this.viewMode){ - case 0: - this.viewDate = this.moveMonth(this.viewDate, dir); - this._trigger('changeMonth', this.viewDate); - break; - case 1: - case 2: - this.viewDate = this.moveYear(this.viewDate, dir); - if (this.viewMode === 1) - this._trigger('changeYear', this.viewDate); - break; - } - this.fill(); - break; - case 'today': - var date = new Date(); - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - - this.showMode(-2); - var which = this.o.todayBtn === 'linked' ? null : 'view'; - this._setDate(date, which); - break; - case 'clear': - var element; - if (this.isInput) - element = this.element; - else if (this.component) - element = this.element.find('input'); - if (element) - element.val("").change(); - this.update(); - this._trigger('changeDate'); - if (this.o.autoclose) - this.hide(); - break; - } - break; - case 'span': - if (!target.is('.disabled')){ - this.viewDate.setUTCDate(1); - if (target.is('.month')){ - day = 1; - month = target.parent().find('span').index(target); - year = this.viewDate.getUTCFullYear(); - this.viewDate.setUTCMonth(month); - this._trigger('changeMonth', this.viewDate); - if (this.o.minViewMode === 1){ - this._setDate(UTCDate(year, month, day)); - } - } - else { - day = 1; - month = 0; - year = parseInt(target.text(), 10)||0; - this.viewDate.setUTCFullYear(year); - this._trigger('changeYear', this.viewDate); - if (this.o.minViewMode === 2){ - this._setDate(UTCDate(year, month, day)); - } - } - this.showMode(-1); - this.fill(); - } - break; - case 'td': - if (target.is('.day') && !target.is('.disabled')){ - day = parseInt(target.text(), 10)||1; - year = this.viewDate.getUTCFullYear(); - month = this.viewDate.getUTCMonth(); - if (target.is('.old')){ - if (month === 0){ - month = 11; - year -= 1; - } - else { - month -= 1; - } - } - else if (target.is('.new')){ - if (month === 11){ - month = 0; - year += 1; - } - else { - month += 1; - } - } - this._setDate(UTCDate(year, month, day)); - } - break; - } - } - if (this.picker.is(':visible') && this._focused_from){ - $(this._focused_from).focus(); - } - delete this._focused_from; - }, - - _toggle_multidate: function(date){ - var ix = this.dates.contains(date); - if (!date){ - this.dates.clear(); - } - else if (ix !== -1){ - this.dates.remove(ix); - } - else { - this.dates.push(date); - } - if (typeof this.o.multidate === 'number') - while (this.dates.length > this.o.multidate) - this.dates.remove(0); - }, - - _setDate: function(date, which){ - if (!which || which === 'date') - this._toggle_multidate(date && new Date(date)); - if (!which || which === 'view') - this.viewDate = date && new Date(date); - - this.fill(); - this.setValue(); - this._trigger('changeDate'); - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - if (this.o.autoclose && (!which || which === 'date')){ - this.hide(); - } - }, - - moveMonth: function(date, dir){ - if (!date) - return undefined; - if (!dir) - return date; - var new_date = new Date(date.valueOf()), - day = new_date.getUTCDate(), - month = new_date.getUTCMonth(), - mag = Math.abs(dir), - new_month, test; - dir = dir > 0 ? 1 : -1; - if (mag === 1){ - test = dir === -1 - // If going back one month, make sure month is not current month - // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) - ? function(){ - return new_date.getUTCMonth() === month; - } - // If going forward one month, make sure month is as expected - // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) - : function(){ - return new_date.getUTCMonth() !== new_month; - }; - new_month = month + dir; - new_date.setUTCMonth(new_month); - // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 - if (new_month < 0 || new_month > 11) - new_month = (new_month + 12) % 12; - } - else { - // For magnitudes >1, move one month at a time... - for (var i=0; i < mag; i++) - // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... - new_date = this.moveMonth(new_date, dir); - // ...then reset the day, keeping it in the new month - new_month = new_date.getUTCMonth(); - new_date.setUTCDate(day); - test = function(){ - return new_month !== new_date.getUTCMonth(); - }; - } - // Common date-resetting loop -- if date is beyond end of month, make it - // end of month - while (test()){ - new_date.setUTCDate(--day); - new_date.setUTCMonth(new_month); - } - return new_date; - }, - - moveYear: function(date, dir){ - return this.moveMonth(date, dir*12); - }, - - dateWithinRange: function(date){ - return date >= this.o.startDate && date <= this.o.endDate; - }, - - keydown: function(e){ - if (this.picker.is(':not(:visible)')){ - if (e.keyCode === 27) // allow escape to hide and re-show picker - this.show(); - return; - } - var dateChanged = false, - dir, newDate, newViewDate, - focusDate = this.focusDate || this.viewDate; - switch (e.keyCode){ - case 27: // escape - if (this.focusDate){ - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - } - else - this.hide(); - e.preventDefault(); - break; - case 37: // left - case 39: // right - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 37 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir); - } - if (this.dateWithinRange(newDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 38: // up - case 40: // down - if (!this.o.keyboardNavigation) - break; - dir = e.keyCode === 38 ? -1 : 1; - if (e.ctrlKey){ - newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveYear(focusDate, dir); - this._trigger('changeYear', this.viewDate); - } - else if (e.shiftKey){ - newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); - newViewDate = this.moveMonth(focusDate, dir); - this._trigger('changeMonth', this.viewDate); - } - else { - newDate = new Date(this.dates.get(-1) || UTCToday()); - newDate.setUTCDate(newDate.getUTCDate() + dir * 7); - newViewDate = new Date(focusDate); - newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7); - } - if (this.dateWithinRange(newDate)){ - this.focusDate = this.viewDate = newViewDate; - this.setValue(); - this.fill(); - e.preventDefault(); - } - break; - case 32: // spacebar - // Spacebar is used in manually typing dates in some formats. - // As such, its behavior should not be hijacked. - break; - case 13: // enter - focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; - this._toggle_multidate(focusDate); - dateChanged = true; - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.setValue(); - this.fill(); - if (this.picker.is(':visible')){ - e.preventDefault(); - if (this.o.autoclose) - this.hide(); - } - break; - case 9: // tab - this.focusDate = null; - this.viewDate = this.dates.get(-1) || this.viewDate; - this.fill(); - this.hide(); - break; - } - if (dateChanged){ - if (this.dates.length) - this._trigger('changeDate'); - else - this._trigger('clearDate'); - var element; - if (this.isInput){ - element = this.element; - } - else if (this.component){ - element = this.element.find('input'); - } - if (element){ - element.change(); - } - } - }, - - showMode: function(dir){ - if (dir){ - this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir)); - } - this.picker - .find('>div') - .hide() - .filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName) - .css('display', 'block'); - this.updateNavArrows(); - } - }; - - var DateRangePicker = function(element, options){ - this.element = $(element); - this.inputs = $.map(options.inputs, function(i){ - return i.jquery ? i[0] : i; - }); - delete options.inputs; - - $(this.inputs) - .datepicker(options) - .bind('changeDate', $.proxy(this.dateUpdated, this)); - - this.pickers = $.map(this.inputs, function(i){ - return $(i).data('datepicker'); - }); - this.updateDates(); - }; - DateRangePicker.prototype = { - updateDates: function(){ - this.dates = $.map(this.pickers, function(i){ - return i.getUTCDate(); - }); - this.updateRanges(); - }, - updateRanges: function(){ - var range = $.map(this.dates, function(d){ - return d.valueOf(); - }); - $.each(this.pickers, function(i, p){ - p.setRange(range); - }); - }, - dateUpdated: function(e){ - // `this.updating` is a workaround for preventing infinite recursion - // between `changeDate` triggering and `setUTCDate` calling. Until - // there is a better mechanism. - if (this.updating) - return; - this.updating = true; - - var dp = $(e.target).data('datepicker'), - new_date = dp.getUTCDate(), - i = $.inArray(e.target, this.inputs), - l = this.inputs.length; - if (i === -1) - return; - - $.each(this.pickers, function(i, p){ - if (!p.getUTCDate()) - p.setUTCDate(new_date); - }); - - if (new_date < this.dates[i]){ - // Date being moved earlier/left - while (i >= 0 && new_date < this.dates[i]){ - this.pickers[i--].setUTCDate(new_date); - } - } - else if (new_date > this.dates[i]){ - // Date being moved later/right - while (i < l && new_date > this.dates[i]){ - this.pickers[i++].setUTCDate(new_date); - } - } - this.updateDates(); - - delete this.updating; - }, - remove: function(){ - $.map(this.pickers, function(p){ p.remove(); }); - delete this.element.data().datepicker; - } - }; - - function opts_from_el(el, prefix){ - // Derive options from element data-attrs - var data = $(el).data(), - out = {}, inkey, - replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); - prefix = new RegExp('^' + prefix.toLowerCase()); - function re_lower(_,a){ - return a.toLowerCase(); - } - for (var key in data) - if (prefix.test(key)){ - inkey = key.replace(replace, re_lower); - out[inkey] = data[key]; - } - return out; - } - - function opts_from_locale(lang){ - // Derive options from locale plugins - var out = {}; - // Check if "de-DE" style date is available, if not language should - // fallback to 2 letter code eg "de" - if (!dates[lang]){ - lang = lang.split('-')[0]; - if (!dates[lang]) - return; - } - var d = dates[lang]; - $.each(locale_opts, function(i,k){ - if (k in d) - out[k] = d[k]; - }); - return out; - } - - var old = $.fn.datepicker; - $.fn.datepicker = function(option){ - var args = Array.apply(null, arguments); - args.shift(); - var internal_return; - this.each(function(){ - var $this = $(this), - data = $this.data('datepicker'), - options = typeof option === 'object' && option; - if (!data){ - var elopts = opts_from_el(this, 'date'), - // Preliminary otions - xopts = $.extend({}, defaults, elopts, options), - locopts = opts_from_locale(xopts.language), - // Options priority: js args, data-attrs, locales, defaults - opts = $.extend({}, defaults, locopts, elopts, options); - if ($this.is('.input-daterange') || opts.inputs){ - var ropts = { - inputs: opts.inputs || $this.find('input').toArray() - }; - $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts)))); - } - else { - $this.data('datepicker', (data = new Datepicker(this, opts))); - } - } - if (typeof option === 'string' && typeof data[option] === 'function'){ - internal_return = data[option].apply(data, args); - if (internal_return !== undefined) - return false; - } - }); - if (internal_return !== undefined) - return internal_return; - else - return this; - }; - - var defaults = $.fn.datepicker.defaults = { - autoclose: false, - beforeShowDay: $.noop, - calendarWeeks: false, - clearBtn: false, - daysOfWeekDisabled: [], - endDate: Infinity, - forceParse: true, - format: 'yyyy-mm-dd', - keyboardNavigation: true, - language: 'en', - minViewMode: 0, - multidate: false, - multidateSeparator: ',', - orientation: "auto", - rtl: false, - startDate: -Infinity, - startView: 0, - todayBtn: false, - todayHighlight: false, - weekStart: 0 - }; - var locale_opts = $.fn.datepicker.locale_opts = [ - 'format', - 'rtl', - 'weekStart' - ]; - $.fn.datepicker.Constructor = Datepicker; - var dates = $.fn.datepicker.dates = { - en: { - days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], - daysShort: ["日", "一", "二", "三", "四", "五", "六", "日"], - daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], - months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], - monthsShort: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], - today: "今天", - clear: "清空" - } - }; - - var DPGlobal = { - modes: [ - { - clsName: 'days', - navFnc: 'Month', - navStep: 1 - }, - { - clsName: 'months', - navFnc: 'FullYear', - navStep: 1 - }, - { - clsName: 'years', - navFnc: 'FullYear', - navStep: 10 - }], - isLeapYear: function(year){ - return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); - }, - getDaysInMonth: function(year, month){ - return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; - }, - validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, - nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, - parseFormat: function(format){ - // IE treats \0 as a string end in inputs (truncating the value), - // so it's a bad format delimiter, anyway - var separators = format.replace(this.validParts, '\0').split('\0'), - parts = format.match(this.validParts); - if (!separators || !separators.length || !parts || parts.length === 0){ - throw new Error("Invalid date format."); - } - return {separators: separators, parts: parts}; - }, - parseDate: function(date, format, language){ - if (!date) - return undefined; - if (date instanceof Date) - return date; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var part_re = /([\-+]\d+)([dmwy])/, - parts = date.match(/([\-+]\d+)([dmwy])/g), - part, dir, i; - if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){ - date = new Date(); - for (i=0; i < parts.length; i++){ - part = part_re.exec(parts[i]); - dir = parseInt(part[1]); - switch (part[2]){ - case 'd': - date.setUTCDate(date.getUTCDate() + dir); - break; - case 'm': - date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir); - break; - case 'w': - date.setUTCDate(date.getUTCDate() + dir * 7); - break; - case 'y': - date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir); - break; - } - } - return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); - } - parts = date && date.match(this.nonpunctuation) || []; - date = new Date(); - var parsed = {}, - setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], - setters_map = { - yyyy: function(d,v){ - return d.setUTCFullYear(v); - }, - yy: function(d,v){ - return d.setUTCFullYear(2000+v); - }, - m: function(d,v){ - if (isNaN(d)) - return d; - v -= 1; - while (v < 0) v += 12; - v %= 12; - d.setUTCMonth(v); - while (d.getUTCMonth() !== v) - d.setUTCDate(d.getUTCDate()-1); - return d; - }, - d: function(d,v){ - return d.setUTCDate(v); - } - }, - val, filtered; - setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; - setters_map['dd'] = setters_map['d']; - date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); - var fparts = format.parts.slice(); - // Remove noop parts - if (parts.length !== fparts.length){ - fparts = $(fparts).filter(function(i,p){ - return $.inArray(p, setters_order) !== -1; - }).toArray(); - } - // Process remainder - function match_part(){ - var m = this.slice(0, parts[i].length), - p = parts[i].slice(0, m.length); - return m === p; - } - if (parts.length === fparts.length){ - var cnt; - for (i=0, cnt = fparts.length; i < cnt; i++){ - val = parseInt(parts[i], 10); - part = fparts[i]; - if (isNaN(val)){ - switch (part){ - case 'MM': - filtered = $(dates[language].months).filter(match_part); - val = $.inArray(filtered[0], dates[language].months) + 1; - break; - case 'M': - filtered = $(dates[language].monthsShort).filter(match_part); - val = $.inArray(filtered[0], dates[language].monthsShort) + 1; - break; - } - } - parsed[part] = val; - } - var _date, s; - for (i=0; i < setters_order.length; i++){ - s = setters_order[i]; - if (s in parsed && !isNaN(parsed[s])){ - _date = new Date(date); - setters_map[s](_date, parsed[s]); - if (!isNaN(_date)) - date = _date; - } - } - } - return date; - }, - formatDate: function(date, format, language){ - if (!date) - return ''; - if (typeof format === 'string') - format = DPGlobal.parseFormat(format); - var val = { - d: date.getUTCDate(), - D: dates[language].daysShort[date.getUTCDay()], - DD: dates[language].days[date.getUTCDay()], - m: date.getUTCMonth() + 1, - M: dates[language].monthsShort[date.getUTCMonth()], - MM: dates[language].months[date.getUTCMonth()], - yy: date.getUTCFullYear().toString().substring(2), - yyyy: date.getUTCFullYear() - }; - val.dd = (val.d < 10 ? '0' : '') + val.d; - val.mm = (val.m < 10 ? '0' : '') + val.m; - date = []; - var seps = $.extend([], format.separators); - for (var i=0, cnt = format.parts.length; i <= cnt; i++){ - if (seps.length) - date.push(seps.shift()); - date.push(val[format.parts[i]]); - } - return date.join(''); - }, - headTemplate: ''+ - ''+ - '«'+ - ''+ - '»'+ - ''+ - '', - contTemplate: '', - footTemplate: ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - '' - }; - DPGlobal.template = '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - ''+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'+ - ''+ - DPGlobal.headTemplate+ - DPGlobal.contTemplate+ - DPGlobal.footTemplate+ - '
'+ - '
'+ - '
'; - - $.fn.datepicker.DPGlobal = DPGlobal; - - - /* DATEPICKER NO CONFLICT - * =================== */ - - $.fn.datepicker.noConflict = function(){ - $.fn.datepicker = old; - return this; - }; - - - /* DATEPICKER DATA-API - * ================== */ - - $(document).on( - 'focus.datepicker.data-api click.datepicker.data-api', - '[data-provide="datepicker"]', - function(e){ - var $this = $(this); - if ($this.data('datepicker')) - return; - e.preventDefault(); - // component click requires us to explicitly show it - $this.datepicker('show'); - } - ); - $(function(){ - $('[data-provide="datepicker-inline"]').datepicker(); - }); - -}(window.jQuery)); diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css new file mode 100644 index 000000000..537c6a4ce --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.css @@ -0,0 +1,418 @@ +/*! + * Datetimepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +.datetimepicker { + padding: 4px; + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + direction: ltr; +} + +.datetimepicker-inline { + width: 220px; +} + +.datetimepicker.datetimepicker-rtl { + direction: rtl; +} + +.datetimepicker.datetimepicker-rtl table tr td span { + float: right; +} + +.datetimepicker-dropdown, .datetimepicker-dropdown-left { + top: 0; + left: 0; +} + +[class*=" datetimepicker-dropdown"]:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #cccccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; +} + +[class*=" datetimepicker-dropdown"]:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; +} + +[class*=" datetimepicker-dropdown-top"]:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #cccccc; + border-top-color: rgba(0, 0, 0, 0.2); + border-bottom: 0; +} + +[class*=" datetimepicker-dropdown-top"]:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #ffffff; + border-bottom: 0; +} + +.datetimepicker-dropdown-bottom-left:before { + top: -7px; + right: 6px; +} + +.datetimepicker-dropdown-bottom-left:after { + top: -6px; + right: 7px; +} + +.datetimepicker-dropdown-bottom-right:before { + top: -7px; + left: 6px; +} + +.datetimepicker-dropdown-bottom-right:after { + top: -6px; + left: 7px; +} + +.datetimepicker-dropdown-top-left:before { + bottom: -7px; + right: 6px; +} + +.datetimepicker-dropdown-top-left:after { + bottom: -6px; + right: 7px; +} + +.datetimepicker-dropdown-top-right:before { + bottom: -7px; + left: 6px; +} + +.datetimepicker-dropdown-top-right:after { + bottom: -6px; + left: 7px; +} + +.datetimepicker > div { + display: none; +} + +.datetimepicker.minutes div.datetimepicker-minutes { + display: block; +} + +.datetimepicker.hours div.datetimepicker-hours { + display: block; +} + +.datetimepicker.days div.datetimepicker-days { + display: block; +} + +.datetimepicker.months div.datetimepicker-months { + display: block; +} + +.datetimepicker.years div.datetimepicker-years { + display: block; +} + +.datetimepicker table { + margin: 0; +} + +.datetimepicker td, +.datetimepicker th { + text-align: center; + width: 20px; + height: 20px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + border: none; +} + +.table-striped .datetimepicker table tr td, +.table-striped .datetimepicker table tr th { + background-color: transparent; +} + +.datetimepicker table tr td.minute:hover { + background: #eeeeee; + cursor: pointer; +} + +.datetimepicker table tr td.hour:hover { + background: #eeeeee; + cursor: pointer; +} + +.datetimepicker table tr td.day:hover { + background: #eeeeee; + cursor: pointer; +} + +.datetimepicker table tr td.old, +.datetimepicker table tr td.new { + color: #999999; +} + +.datetimepicker table tr td.disabled, +.datetimepicker table tr td.disabled:hover { + background: none; + color: #999999; + cursor: default; +} + +.datetimepicker table tr td.today, +.datetimepicker table tr td.today:hover, +.datetimepicker table tr td.today.disabled, +.datetimepicker table tr td.today.disabled:hover { + background-color: #fde19a; + background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a)); + background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a); + background-image: -o-linear-gradient(top, #fdd49a, #fdf59a); + background-image: linear-gradient(to bottom, #fdd49a, #fdf59a); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0); + border-color: #fdf59a #fdf59a #fbed50; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); +} + +.datetimepicker table tr td.today:hover, +.datetimepicker table tr td.today:hover:hover, +.datetimepicker table tr td.today.disabled:hover, +.datetimepicker table tr td.today.disabled:hover:hover, +.datetimepicker table tr td.today:active, +.datetimepicker table tr td.today:hover:active, +.datetimepicker table tr td.today.disabled:active, +.datetimepicker table tr td.today.disabled:hover:active, +.datetimepicker table tr td.today.active, +.datetimepicker table tr td.today:hover.active, +.datetimepicker table tr td.today.disabled.active, +.datetimepicker table tr td.today.disabled:hover.active, +.datetimepicker table tr td.today.disabled, +.datetimepicker table tr td.today:hover.disabled, +.datetimepicker table tr td.today.disabled.disabled, +.datetimepicker table tr td.today.disabled:hover.disabled, +.datetimepicker table tr td.today[disabled], +.datetimepicker table tr td.today:hover[disabled], +.datetimepicker table tr td.today.disabled[disabled], +.datetimepicker table tr td.today.disabled:hover[disabled] { + background-color: #fdf59a; +} + +.datetimepicker table tr td.today:active, +.datetimepicker table tr td.today:hover:active, +.datetimepicker table tr td.today.disabled:active, +.datetimepicker table tr td.today.disabled:hover:active, +.datetimepicker table tr td.today.active, +.datetimepicker table tr td.today:hover.active, +.datetimepicker table tr td.today.disabled.active, +.datetimepicker table tr td.today.disabled:hover.active { + background-color: #fbf069; +} + +.datetimepicker table tr td.active, +.datetimepicker table tr td.active:hover, +.datetimepicker table tr td.active.disabled, +.datetimepicker table tr td.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(to bottom, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +.datetimepicker table tr td.active:hover, +.datetimepicker table tr td.active:hover:hover, +.datetimepicker table tr td.active.disabled:hover, +.datetimepicker table tr td.active.disabled:hover:hover, +.datetimepicker table tr td.active:active, +.datetimepicker table tr td.active:hover:active, +.datetimepicker table tr td.active.disabled:active, +.datetimepicker table tr td.active.disabled:hover:active, +.datetimepicker table tr td.active.active, +.datetimepicker table tr td.active:hover.active, +.datetimepicker table tr td.active.disabled.active, +.datetimepicker table tr td.active.disabled:hover.active, +.datetimepicker table tr td.active.disabled, +.datetimepicker table tr td.active:hover.disabled, +.datetimepicker table tr td.active.disabled.disabled, +.datetimepicker table tr td.active.disabled:hover.disabled, +.datetimepicker table tr td.active[disabled], +.datetimepicker table tr td.active:hover[disabled], +.datetimepicker table tr td.active.disabled[disabled], +.datetimepicker table tr td.active.disabled:hover[disabled] { + background-color: #0044cc; +} + +.datetimepicker table tr td.active:active, +.datetimepicker table tr td.active:hover:active, +.datetimepicker table tr td.active.disabled:active, +.datetimepicker table tr td.active.disabled:hover:active, +.datetimepicker table tr td.active.active, +.datetimepicker table tr td.active:hover.active, +.datetimepicker table tr td.active.disabled.active, +.datetimepicker table tr td.active.disabled:hover.active { + background-color: #003399; +} + +.datetimepicker table tr td span { + display: block; + width: 23%; + height: 54px; + line-height: 54px; + float: left; + margin: 1%; + cursor: pointer; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.datetimepicker .datetimepicker-hours span { + height: 26px; + line-height: 26px; +} + +.datetimepicker .datetimepicker-hours table tr td span.hour_am, +.datetimepicker .datetimepicker-hours table tr td span.hour_pm { + width: 14.6%; +} + +.datetimepicker .datetimepicker-hours fieldset legend, +.datetimepicker .datetimepicker-minutes fieldset legend { + margin-bottom: inherit; + line-height: 30px; +} + +.datetimepicker .datetimepicker-minutes span { + height: 26px; + line-height: 26px; +} + +.datetimepicker table tr td span:hover { + background: #eeeeee; +} + +.datetimepicker table tr td span.disabled, +.datetimepicker table tr td span.disabled:hover { + background: none; + color: #999999; + cursor: default; +} + +.datetimepicker table tr td span.active, +.datetimepicker table tr td span.active:hover, +.datetimepicker table tr td span.active.disabled, +.datetimepicker table tr td span.active.disabled:hover { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(to bottom, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +.datetimepicker table tr td span.active:hover, +.datetimepicker table tr td span.active:hover:hover, +.datetimepicker table tr td span.active.disabled:hover, +.datetimepicker table tr td span.active.disabled:hover:hover, +.datetimepicker table tr td span.active:active, +.datetimepicker table tr td span.active:hover:active, +.datetimepicker table tr td span.active.disabled:active, +.datetimepicker table tr td span.active.disabled:hover:active, +.datetimepicker table tr td span.active.active, +.datetimepicker table tr td span.active:hover.active, +.datetimepicker table tr td span.active.disabled.active, +.datetimepicker table tr td span.active.disabled:hover.active, +.datetimepicker table tr td span.active.disabled, +.datetimepicker table tr td span.active:hover.disabled, +.datetimepicker table tr td span.active.disabled.disabled, +.datetimepicker table tr td span.active.disabled:hover.disabled, +.datetimepicker table tr td span.active[disabled], +.datetimepicker table tr td span.active:hover[disabled], +.datetimepicker table tr td span.active.disabled[disabled], +.datetimepicker table tr td span.active.disabled:hover[disabled] { + background-color: #0044cc; +} + +.datetimepicker table tr td span.active:active, +.datetimepicker table tr td span.active:hover:active, +.datetimepicker table tr td span.active.disabled:active, +.datetimepicker table tr td span.active.disabled:hover:active, +.datetimepicker table tr td span.active.active, +.datetimepicker table tr td span.active:hover.active, +.datetimepicker table tr td span.active.disabled.active, +.datetimepicker table tr td span.active.disabled:hover.active { + background-color: #003399; +} + +.datetimepicker table tr td span.old { + color: #999999; +} + +.datetimepicker th.switch { + width: 145px; +} + +.datetimepicker th span.glyphicon { + pointer-events: none; +} + +.datetimepicker thead tr:first-child th, +.datetimepicker tfoot th { + cursor: pointer; +} + +.datetimepicker thead tr:first-child th:hover, +.datetimepicker tfoot th:hover { + background: #eeeeee; +} + +.input-append.date .add-on i, +.input-prepend.date .add-on i, +.input-group.date .input-group-addon span { + cursor: pointer; + width: 14px; + height: 14px; +} diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js new file mode 100644 index 000000000..f66d69c13 --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js @@ -0,0 +1,1967 @@ +/* ========================================================= + * bootstrap-datetimepicker.js + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Improvements by Andrew Rowls + * Improvements by Sébastien Malot + * Improvements by Yun Lai + * Improvements by Kenneth Henderick + * Improvements by CuGBabyBeaR + * Improvements by Christian Vaas + * + * Project URL : http://www.malot.fr/bootstrap-datetimepicker + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +(function(factory){ + if (typeof define === 'function' && define.amd) + define(['jquery'], factory); + else if (typeof exports === 'object') + factory(require('jquery')); + else + factory(jQuery); + +}(function($, undefined){ + + // Add ECMA262-5 Array methods if not supported natively (IE8) + if (!('indexOf' in Array.prototype)) { + Array.prototype.indexOf = function (find, i) { + if (i === undefined) i = 0; + if (i < 0) i += this.length; + if (i < 0) i = 0; + for (var n = this.length; i < n; i++) { + if (i in this && this[i] === find) { + return i; + } + } + return -1; + } + } + + // Add timezone abbreviation support for ie6+, Chrome, Firefox + function timeZoneAbbreviation() { + var abbreviation, date, formattedStr, i, len, matchedStrings, ref, str; + date = (new Date()).toString(); + formattedStr = ((ref = date.split('(')[1]) != null ? ref.slice(0, -1) : 0) || date.split(' '); + if (formattedStr instanceof Array) { + matchedStrings = []; + for (var i = 0, len = formattedStr.length; i < len; i++) { + str = formattedStr[i]; + if ((abbreviation = (ref = str.match(/\b[A-Z]+\b/)) !== null) ? ref[0] : 0) { + matchedStrings.push(abbreviation); + } + } + formattedStr = matchedStrings.pop(); + } + return formattedStr; + } + + function UTCDate() { + return new Date(Date.UTC.apply(Date, arguments)); + } + + // Picker object + var Datetimepicker = function (element, options) { + var that = this; + + this.element = $(element); + + // add container for single page application + // when page switch the datetimepicker div will be removed also. + this.container = options.container || 'body'; + + this.language = options.language || this.element.data('date-language') || 'en'; + this.language = this.language in dates ? this.language : this.language.split('-')[0]; // fr-CA fallback to fr + this.language = this.language in dates ? this.language : 'en'; + this.isRTL = dates[this.language].rtl || false; + this.formatType = options.formatType || this.element.data('format-type') || 'standard'; + this.format = DPGlobal.parseFormat(options.format || this.element.data('date-format') || dates[this.language].format || DPGlobal.getDefaultFormat(this.formatType, 'input'), this.formatType); + this.isInline = false; + this.isVisible = false; + this.isInput = this.element.is('input'); + this.fontAwesome = options.fontAwesome || this.element.data('font-awesome') || false; + + this.bootcssVer = options.bootcssVer || (this.isInput ? (this.element.is('.form-control') ? 3 : 2) : ( this.bootcssVer = this.element.is('.input-group') ? 3 : 2 )); + + this.component = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-remove, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o').parent() : this.element.find('.add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar, .add-on .fa-calendar, .add-on .fa-clock-o').parent()) : false; + this.componentReset = this.element.is('.date') ? ( this.bootcssVer === 3 ? this.element.find('.input-group-addon .glyphicon-remove, .input-group-addon .fa-times').parent():this.element.find('.add-on .icon-remove, .add-on .fa-times').parent()) : false; + this.hasInput = this.component && this.element.find('input').length; + if (this.component && this.component.length === 0) { + this.component = false; + } + this.linkField = options.linkField || this.element.data('link-field') || false; + this.linkFormat = DPGlobal.parseFormat(options.linkFormat || this.element.data('link-format') || DPGlobal.getDefaultFormat(this.formatType, 'link'), this.formatType); + this.minuteStep = options.minuteStep || this.element.data('minute-step') || 5; + this.pickerPosition = options.pickerPosition || this.element.data('picker-position') || 'bottom-right'; + this.showMeridian = options.showMeridian || this.element.data('show-meridian') || false; + this.initialDate = options.initialDate || new Date(); + this.zIndex = options.zIndex || this.element.data('z-index') || undefined; + this.title = typeof options.title === 'undefined' ? false : options.title; + this.timezone = options.timezone || timeZoneAbbreviation(); + + this.icons = { + leftArrow: this.fontAwesome ? 'fa-arrow-left' : (this.bootcssVer === 3 ? 'glyphicon-arrow-left' : 'icon-arrow-left'), + rightArrow: this.fontAwesome ? 'fa-arrow-right' : (this.bootcssVer === 3 ? 'glyphicon-arrow-right' : 'icon-arrow-right') + } + this.icontype = this.fontAwesome ? 'fa' : 'glyphicon'; + + this._attachEvents(); + + this.clickedOutside = function (e) { + // Clicked outside the datetimepicker, hide it + if ($(e.target).closest('.datetimepicker').length === 0) { + that.hide(); + } + } + + this.formatViewType = 'datetime'; + if ('formatViewType' in options) { + this.formatViewType = options.formatViewType; + } else if ('formatViewType' in this.element.data()) { + this.formatViewType = this.element.data('formatViewType'); + } + + this.minView = 0; + if ('minView' in options) { + this.minView = options.minView; + } else if ('minView' in this.element.data()) { + this.minView = this.element.data('min-view'); + } + this.minView = DPGlobal.convertViewMode(this.minView); + + this.maxView = DPGlobal.modes.length - 1; + if ('maxView' in options) { + this.maxView = options.maxView; + } else if ('maxView' in this.element.data()) { + this.maxView = this.element.data('max-view'); + } + this.maxView = DPGlobal.convertViewMode(this.maxView); + + this.wheelViewModeNavigation = false; + if ('wheelViewModeNavigation' in options) { + this.wheelViewModeNavigation = options.wheelViewModeNavigation; + } else if ('wheelViewModeNavigation' in this.element.data()) { + this.wheelViewModeNavigation = this.element.data('view-mode-wheel-navigation'); + } + + this.wheelViewModeNavigationInverseDirection = false; + + if ('wheelViewModeNavigationInverseDirection' in options) { + this.wheelViewModeNavigationInverseDirection = options.wheelViewModeNavigationInverseDirection; + } else if ('wheelViewModeNavigationInverseDirection' in this.element.data()) { + this.wheelViewModeNavigationInverseDirection = this.element.data('view-mode-wheel-navigation-inverse-dir'); + } + + this.wheelViewModeNavigationDelay = 100; + if ('wheelViewModeNavigationDelay' in options) { + this.wheelViewModeNavigationDelay = options.wheelViewModeNavigationDelay; + } else if ('wheelViewModeNavigationDelay' in this.element.data()) { + this.wheelViewModeNavigationDelay = this.element.data('view-mode-wheel-navigation-delay'); + } + + this.startViewMode = 2; + if ('startView' in options) { + this.startViewMode = options.startView; + } else if ('startView' in this.element.data()) { + this.startViewMode = this.element.data('start-view'); + } + this.startViewMode = DPGlobal.convertViewMode(this.startViewMode); + this.viewMode = this.startViewMode; + + this.viewSelect = this.minView; + if ('viewSelect' in options) { + this.viewSelect = options.viewSelect; + } else if ('viewSelect' in this.element.data()) { + this.viewSelect = this.element.data('view-select'); + } + this.viewSelect = DPGlobal.convertViewMode(this.viewSelect); + + this.forceParse = true; + if ('forceParse' in options) { + this.forceParse = options.forceParse; + } else if ('dateForceParse' in this.element.data()) { + this.forceParse = this.element.data('date-force-parse'); + } + var template = this.bootcssVer === 3 ? DPGlobal.templateV3 : DPGlobal.template; + while (template.indexOf('{iconType}') !== -1) { + template = template.replace('{iconType}', this.icontype); + } + while (template.indexOf('{leftArrow}') !== -1) { + template = template.replace('{leftArrow}', this.icons.leftArrow); + } + while (template.indexOf('{rightArrow}') !== -1) { + template = template.replace('{rightArrow}', this.icons.rightArrow); + } + this.picker = $(template) + .appendTo(this.isInline ? this.element : this.container) // 'body') + .on({ + click: $.proxy(this.click, this), + mousedown: $.proxy(this.mousedown, this) + }); + + if (this.wheelViewModeNavigation) { + if ($.fn.mousewheel) { + this.picker.on({mousewheel: $.proxy(this.mousewheel, this)}); + } else { + console.log('Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option'); + } + } + + if (this.isInline) { + this.picker.addClass('datetimepicker-inline'); + } else { + this.picker.addClass('datetimepicker-dropdown-' + this.pickerPosition + ' dropdown-menu'); + } + if (this.isRTL) { + this.picker.addClass('datetimepicker-rtl'); + var selector = this.bootcssVer === 3 ? '.prev span, .next span' : '.prev i, .next i'; + this.picker.find(selector).toggleClass(this.icons.leftArrow + ' ' + this.icons.rightArrow); + } + + $(document).on('mousedown touchend', this.clickedOutside); + + this.autoclose = false; + if ('autoclose' in options) { + this.autoclose = options.autoclose; + } else if ('dateAutoclose' in this.element.data()) { + this.autoclose = this.element.data('date-autoclose'); + } + + this.keyboardNavigation = true; + if ('keyboardNavigation' in options) { + this.keyboardNavigation = options.keyboardNavigation; + } else if ('dateKeyboardNavigation' in this.element.data()) { + this.keyboardNavigation = this.element.data('date-keyboard-navigation'); + } + + this.todayBtn = (options.todayBtn || this.element.data('date-today-btn') || false); + this.clearBtn = (options.clearBtn || this.element.data('date-clear-btn') || false); + this.todayHighlight = (options.todayHighlight || this.element.data('date-today-highlight') || false); + + this.weekStart = 0; + if (typeof options.weekStart !== 'undefined') { + this.weekStart = options.weekStart; + } else if (typeof this.element.data('date-weekstart') !== 'undefined') { + this.weekStart = this.element.data('date-weekstart'); + } else if (typeof dates[this.language].weekStart !== 'undefined') { + this.weekStart = dates[this.language].weekStart; + } + this.weekStart = this.weekStart % 7; + this.weekEnd = ((this.weekStart + 6) % 7); + this.onRenderDay = function (date) { + var render = (options.onRenderDay || function () { return []; })(date); + if (typeof render === 'string') { + render = [render]; + } + var res = ['day']; + return res.concat((render ? render : [])); + }; + this.onRenderHour = function (date) { + var render = (options.onRenderHour || function () { return []; })(date); + var res = ['hour']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + }; + this.onRenderMinute = function (date) { + var render = (options.onRenderMinute || function () { return []; })(date); + var res = ['minute']; + if (typeof render === 'string') { + render = [render]; + } + if (date < this.startDate || date > this.endDate) { + res.push('disabled'); + } else if (Math.floor(this.date.getUTCMinutes() / this.minuteStep) === Math.floor(date.getUTCMinutes() / this.minuteStep)) { + res.push('active'); + } + return res.concat((render ? render : [])); + }; + this.onRenderYear = function (date) { + var render = (options.onRenderYear || function () { return []; })(date); + var res = ['year']; + if (typeof render === 'string') { + render = [render]; + } + if (this.date.getUTCFullYear() === date.getUTCFullYear()) { + res.push('active'); + } + var currentYear = date.getUTCFullYear(); + var endYear = this.endDate.getUTCFullYear(); + if (date < this.startDate || currentYear > endYear) { + res.push('disabled'); + } + return res.concat((render ? render : [])); + } + this.onRenderMonth = function (date) { + var render = (options.onRenderMonth || function () { return []; })(date); + var res = ['month']; + if (typeof render === 'string') { + render = [render]; + } + return res.concat((render ? render : [])); + } + this.startDate = new Date(-8639968443048000); + this.endDate = new Date(8639968443048000); + this.datesDisabled = []; + this.daysOfWeekDisabled = []; + this.setStartDate(options.startDate || this.element.data('date-startdate')); + this.setEndDate(options.endDate || this.element.data('date-enddate')); + this.setDatesDisabled(options.datesDisabled || this.element.data('date-dates-disabled')); + this.setDaysOfWeekDisabled(options.daysOfWeekDisabled || this.element.data('date-days-of-week-disabled')); + this.setMinutesDisabled(options.minutesDisabled || this.element.data('date-minute-disabled')); + this.setHoursDisabled(options.hoursDisabled || this.element.data('date-hour-disabled')); + this.fillDow(); + this.fillMonths(); + this.update(); + this.showMode(); + + if (this.isInline) { + this.show(); + } + }; + + Datetimepicker.prototype = { + constructor: Datetimepicker, + + _events: [], + _attachEvents: function () { + this._detachEvents(); + if (this.isInput) { // single input + this._events = [ + [this.element, { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }] + ]; + } + else if (this.component && this.hasInput) { // component: input + button + this._events = [ + // For components that are not readonly, allow keyboard nav + [this.element.find('input'), { + focus: $.proxy(this.show, this), + keyup: $.proxy(this.update, this), + keydown: $.proxy(this.keydown, this) + }], + [this.component, { + click: $.proxy(this.show, this) + }] + ]; + if (this.componentReset) { + this._events.push([ + this.componentReset, + {click: $.proxy(this.reset, this)} + ]); + } + } + else if (this.element.is('div')) { // inline datetimepicker + this.isInline = true; + } + else { + this._events = [ + [this.element, { + click: $.proxy(this.show, this) + }] + ]; + } + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.on(ev); + } + }, + + _detachEvents: function () { + for (var i = 0, el, ev; i < this._events.length; i++) { + el = this._events[i][0]; + ev = this._events[i][1]; + el.off(ev); + } + this._events = []; + }, + + show: function (e) { + this.picker.show(); + this.height = this.component ? this.component.outerHeight() : this.element.outerHeight(); + if (this.forceParse) { + this.update(); + } + this.place(); + $(window).on('resize', $.proxy(this.place, this)); + if (e) { + e.stopPropagation(); + e.preventDefault(); + } + this.isVisible = true; + this.element.trigger({ + type: 'show', + date: this.date + }); + }, + + hide: function () { + if (!this.isVisible) return; + if (this.isInline) return; + this.picker.hide(); + $(window).off('resize', this.place); + this.viewMode = this.startViewMode; + this.showMode(); + if (!this.isInput) { + $(document).off('mousedown', this.hide); + } + + if ( + this.forceParse && + ( + this.isInput && this.element.val() || + this.hasInput && this.element.find('input').val() + ) + ) + this.setValue(); + this.isVisible = false; + this.element.trigger({ + type: 'hide', + date: this.date + }); + }, + + remove: function () { + this._detachEvents(); + $(document).off('mousedown', this.clickedOutside); + this.picker.remove(); + delete this.picker; + delete this.element.data().datetimepicker; + }, + + getDate: function () { + var d = this.getUTCDate(); + if (d === null) { + return null; + } + return new Date(d.getTime() + (d.getTimezoneOffset() * 60000)); + }, + + getUTCDate: function () { + return this.date; + }, + + getInitialDate: function () { + return this.initialDate + }, + + setInitialDate: function (initialDate) { + this.initialDate = initialDate; + }, + + setDate: function (d) { + this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset() * 60000))); + }, + + setUTCDate: function (d) { + if (d >= this.startDate && d <= this.endDate) { + this.date = d; + this.setValue(); + this.viewDate = this.date; + this.fill(); + } else { + this.element.trigger({ + type: 'outOfRange', + date: d, + startDate: this.startDate, + endDate: this.endDate + }); + } + }, + + setFormat: function (format) { + this.format = DPGlobal.parseFormat(format, this.formatType); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element && element.val()) { + this.setValue(); + } + }, + + setValue: function () { + var formatted = this.getFormattedDate(); + if (!this.isInput) { + if (this.component) { + this.element.find('input').val(formatted); + } + this.element.data('date', formatted); + } else { + this.element.val(formatted); + } + if (this.linkField) { + $('#' + this.linkField).val(this.getFormattedDate(this.linkFormat)); + } + }, + + getFormattedDate: function (format) { + format = format || this.format; + return DPGlobal.formatDate(this.date, format, this.language, this.formatType, this.timezone); + }, + + setStartDate: function (startDate) { + this.startDate = startDate || this.startDate; + if (this.startDate.valueOf() !== 8639968443048000) { + this.startDate = DPGlobal.parseDate(this.startDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setEndDate: function (endDate) { + this.endDate = endDate || this.endDate; + if (this.endDate.valueOf() !== 8639968443048000) { + this.endDate = DPGlobal.parseDate(this.endDate, this.format, this.language, this.formatType, this.timezone); + } + this.update(); + this.updateNavArrows(); + }, + + setDatesDisabled: function (datesDisabled) { + this.datesDisabled = datesDisabled || []; + if (!$.isArray(this.datesDisabled)) { + this.datesDisabled = this.datesDisabled.split(/,\s*/); + } + var mThis = this; + this.datesDisabled = $.map(this.datesDisabled, function (d) { + return DPGlobal.parseDate(d, mThis.format, mThis.language, mThis.formatType, mThis.timezone).toDateString(); + }); + this.update(); + this.updateNavArrows(); + }, + + setTitle: function (selector, value) { + return this.picker.find(selector) + .find('th:eq(1)') + .text(this.title === false ? value : this.title); + }, + + setDaysOfWeekDisabled: function (daysOfWeekDisabled) { + this.daysOfWeekDisabled = daysOfWeekDisabled || []; + if (!$.isArray(this.daysOfWeekDisabled)) { + this.daysOfWeekDisabled = this.daysOfWeekDisabled.split(/,\s*/); + } + this.daysOfWeekDisabled = $.map(this.daysOfWeekDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setMinutesDisabled: function (minutesDisabled) { + this.minutesDisabled = minutesDisabled || []; + if (!$.isArray(this.minutesDisabled)) { + this.minutesDisabled = this.minutesDisabled.split(/,\s*/); + } + this.minutesDisabled = $.map(this.minutesDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + setHoursDisabled: function (hoursDisabled) { + this.hoursDisabled = hoursDisabled || []; + if (!$.isArray(this.hoursDisabled)) { + this.hoursDisabled = this.hoursDisabled.split(/,\s*/); + } + this.hoursDisabled = $.map(this.hoursDisabled, function (d) { + return parseInt(d, 10); + }); + this.update(); + this.updateNavArrows(); + }, + + place: function () { + if (this.isInline) return; + + if (!this.zIndex) { + var index_highest = 0; + $('div').each(function () { + var index_current = parseInt($(this).css('zIndex'), 10); + if (index_current > index_highest) { + index_highest = index_current; + } + }); + this.zIndex = index_highest + 10; + } + + var offset, top, left, containerOffset; + if (this.container instanceof $) { + containerOffset = this.container.offset(); + } else { + containerOffset = $(this.container).offset(); + } + + if (this.component) { + offset = this.component.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.component.outerWidth() - this.picker.outerWidth(); + } + } else { + offset = this.element.offset(); + left = offset.left; + if (this.pickerPosition === 'bottom-left' || this.pickerPosition === 'top-left') { + left += this.element.outerWidth() - this.picker.outerWidth(); + } + } + + var bodyWidth = document.body.clientWidth || window.innerWidth; + if (left + 220 > bodyWidth) { + left = bodyWidth - 220; + } + + if (this.pickerPosition === 'top-left' || this.pickerPosition === 'top-right') { + top = offset.top - this.picker.outerHeight(); + } else { + top = offset.top + this.height; + } + + top = top - containerOffset.top; + left = left - containerOffset.left; + + this.picker.css({ + top: top, + left: left, + zIndex: this.zIndex + }); + }, + + hour_minute: "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]", + + update: function () { + var date, fromArgs = false; + if (arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) { + date = arguments[0]; + fromArgs = true; + } else { + date = (this.isInput ? this.element.val() : this.element.find('input').val()) || this.element.data('date') || this.initialDate; + if (typeof date === 'string') { + date = date.replace(/^\s+|\s+$/g,''); + } + } + + if (!date) { + date = new Date(); + fromArgs = false; + } + + if (typeof date === "string") { + if (new RegExp(this.hour_minute).test(date) || new RegExp(this.hour_minute + ":[0-5][0-9]").test(date)) { + date = this.getDate() + } + } + + this.date = DPGlobal.parseDate(date, this.format, this.language, this.formatType, this.timezone); + + if (fromArgs) this.setValue(); + + if (this.date < this.startDate) { + this.viewDate = new Date(this.startDate); + } else if (this.date > this.endDate) { + this.viewDate = new Date(this.endDate); + } else { + this.viewDate = new Date(this.date); + } + this.fill(); + }, + + fillDow: function () { + var dowCnt = this.weekStart, + html = ''; + while (dowCnt < this.weekStart + 7) { + html += '' + dates[this.language].daysMin[(dowCnt++) % 7] + ''; + } + html += ''; + this.picker.find('.datetimepicker-days thead').append(html); + }, + + fillMonths: function () { + var html = ''; + var d = new Date(this.viewDate); + for (var i = 0; i < 12; i++) { + d.setUTCMonth(i); + var classes = this.onRenderMonth(d); + html += '' + dates[this.language].monthsShort[i] + ''; + } + this.picker.find('.datetimepicker-months td').html(html); + }, + + fill: function () { + if (!this.date || !this.viewDate) { + return; + } + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + dayMonth = d.getUTCDate(), + hours = d.getUTCHours(), + startYear = this.startDate.getUTCFullYear(), + startMonth = this.startDate.getUTCMonth(), + endYear = this.endDate.getUTCFullYear(), + endMonth = this.endDate.getUTCMonth() + 1, + currentDate = (new UTCDate(this.date.getUTCFullYear(), this.date.getUTCMonth(), this.date.getUTCDate())).valueOf(), + today = new Date(); + this.setTitle('.datetimepicker-days', dates[this.language].months[month] + ' ' + year) + if (this.formatViewType === 'time') { + var formatted = this.getFormattedDate(); + this.setTitle('.datetimepicker-hours', formatted); + this.setTitle('.datetimepicker-minutes', formatted); + } else { + this.setTitle('.datetimepicker-hours', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + this.setTitle('.datetimepicker-minutes', dayMonth + ' ' + dates[this.language].months[month] + ' ' + year); + } + this.picker.find('tfoot th.today') + .text(dates[this.language].today || dates['en'].today) + .toggle(this.todayBtn !== false); + this.picker.find('tfoot th.clear') + .text(dates[this.language].clear || dates['en'].clear) + .toggle(this.clearBtn !== false); + this.updateNavArrows(); + this.fillMonths(); + var prevMonth = UTCDate(year, month - 1, 28, 0, 0, 0, 0), + day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); + prevMonth.setUTCDate(day); + prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7) % 7); + var nextMonth = new Date(prevMonth); + nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); + nextMonth = nextMonth.valueOf(); + var html = []; + var classes; + while (prevMonth.valueOf() < nextMonth) { + if (prevMonth.getUTCDay() === this.weekStart) { + html.push(''); + } + classes = this.onRenderDay(prevMonth); + if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() < month)) { + classes.push('old'); + } else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() === year && prevMonth.getUTCMonth() > month)) { + classes.push('new'); + } + // Compare internal UTC date with local today, not UTC today + if (this.todayHighlight && + prevMonth.getUTCFullYear() === today.getFullYear() && + prevMonth.getUTCMonth() === today.getMonth() && + prevMonth.getUTCDate() === today.getDate()) { + classes.push('today'); + } + if (prevMonth.valueOf() === currentDate) { + classes.push('active'); + } + if ((prevMonth.valueOf() + 86400000) <= this.startDate || prevMonth.valueOf() > this.endDate || + $.inArray(prevMonth.getUTCDay(), this.daysOfWeekDisabled) !== -1 || + $.inArray(prevMonth.toDateString(), this.datesDisabled) !== -1) { + classes.push('disabled'); + } + html.push('' + prevMonth.getUTCDate() + ''); + if (prevMonth.getUTCDay() === this.weekEnd) { + html.push(''); + } + prevMonth.setUTCDate(prevMonth.getUTCDate() + 1); + } + this.picker.find('.datetimepicker-days tbody').empty().append(html.join('')); + + html = []; + var txt = '', meridian = '', meridianOld = ''; + var hoursDisabled = this.hoursDisabled || []; + d = new Date(this.viewDate) + for (var i = 0; i < 24; i++) { + d.setUTCHours(i); + classes = this.onRenderHour(d); + if (hoursDisabled.indexOf(i) !== -1) { + classes.push('disabled'); + } + var actual = UTCDate(year, month, dayMonth, i); + // We want the previous hour for the startDate + if ((actual.valueOf() + 3600000) <= this.startDate || actual.valueOf() > this.endDate) { + classes.push('disabled'); + } else if (hours === i) { + classes.push('active'); + } + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (i < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (i % 12 ? i % 12 : 12); + if (i < 12) { + classes.push('hour_am'); + } else { + classes.push('hour_pm'); + } + html.push('' + txt + ''); + if (i === 23) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + txt + ''); + } + } + this.picker.find('.datetimepicker-hours td').html(html.join('')); + + html = []; + txt = ''; + meridian = ''; + meridianOld = ''; + var minutesDisabled = this.minutesDisabled || []; + d = new Date(this.viewDate); + for (var i = 0; i < 60; i += this.minuteStep) { + if (minutesDisabled.indexOf(i) !== -1) continue; + d.setUTCMinutes(i); + d.setUTCSeconds(0); + classes = this.onRenderMinute(d); + if (this.showMeridian && dates[this.language].meridiem.length === 2) { + meridian = (hours < 12 ? dates[this.language].meridiem[0] : dates[this.language].meridiem[1]); + if (meridian !== meridianOld) { + if (meridianOld !== '') { + html.push(''); + } + html.push('
' + meridian.toUpperCase() + ''); + } + meridianOld = meridian; + txt = (hours % 12 ? hours % 12 : 12); + html.push('' + txt + ':' + (i < 10 ? '0' + i : i) + ''); + if (i === 59) { + html.push('
'); + } + } else { + txt = i + ':00'; + html.push('' + hours + ':' + (i < 10 ? '0' + i : i) + ''); + } + } + this.picker.find('.datetimepicker-minutes td').html(html.join('')); + + var currentYear = this.date.getUTCFullYear(); + var months = this.setTitle('.datetimepicker-months', year) + .end() + .find('.month').removeClass('active'); + if (currentYear === year) { + // getUTCMonths() returns 0 based, and we need to select the next one + // To cater bootstrap 2 we don't need to select the next one + months.eq(this.date.getUTCMonth()).addClass('active'); + } + if (year < startYear || year > endYear) { + months.addClass('disabled'); + } + if (year === startYear) { + months.slice(0, startMonth).addClass('disabled'); + } + if (year === endYear) { + months.slice(endMonth).addClass('disabled'); + } + + html = ''; + year = parseInt(year / 10, 10) * 10; + var yearCont = this.setTitle('.datetimepicker-years', year + '-' + (year + 9)) + .end() + .find('td'); + year -= 1; + d = new Date(this.viewDate); + for (var i = -1; i < 11; i++) { + d.setUTCFullYear(year); + classes = this.onRenderYear(d); + if (i === -1 || i === 10) { + classes.push(old); + } + html += '' + year + ''; + year += 1; + } + yearCont.html(html); + this.place(); + }, + + updateNavArrows: function () { + var d = new Date(this.viewDate), + year = d.getUTCFullYear(), + month = d.getUTCMonth(), + day = d.getUTCDate(), + hour = d.getUTCHours(); + switch (this.viewMode) { + case 0: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate() + && hour <= this.startDate.getUTCHours()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate() + && hour >= this.endDate.getUTCHours()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 1: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth() + && day <= this.startDate.getUTCDate()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth() + && day >= this.endDate.getUTCDate()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 2: + if (year <= this.startDate.getUTCFullYear() + && month <= this.startDate.getUTCMonth()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear() + && month >= this.endDate.getUTCMonth()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + case 3: + case 4: + if (year <= this.startDate.getUTCFullYear()) { + this.picker.find('.prev').css({visibility: 'hidden'}); + } else { + this.picker.find('.prev').css({visibility: 'visible'}); + } + if (year >= this.endDate.getUTCFullYear()) { + this.picker.find('.next').css({visibility: 'hidden'}); + } else { + this.picker.find('.next').css({visibility: 'visible'}); + } + break; + } + }, + + mousewheel: function (e) { + + e.preventDefault(); + e.stopPropagation(); + + if (this.wheelPause) { + return; + } + + this.wheelPause = true; + + var originalEvent = e.originalEvent; + + var delta = originalEvent.wheelDelta; + + var mode = delta > 0 ? 1 : (delta === 0) ? 0 : -1; + + if (this.wheelViewModeNavigationInverseDirection) { + mode = -mode; + } + + this.showMode(mode); + + setTimeout($.proxy(function () { + + this.wheelPause = false + + }, this), this.wheelViewModeNavigationDelay); + + }, + + click: function (e) { + e.stopPropagation(); + e.preventDefault(); + var target = $(e.target).closest('span, td, th, legend'); + if (target.is('.' + this.icontype)) { + target = $(target).parent().closest('span, td, th, legend'); + } + if (target.length === 1) { + if (target.is('.disabled')) { + this.element.trigger({ + type: 'outOfRange', + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate + }); + return; + } + switch (target[0].nodeName.toLowerCase()) { + case 'th': + switch (target[0].className) { + case 'switch': + this.showMode(1); + break; + case 'prev': + case 'next': + var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); + switch (this.viewMode) { + case 0: + this.viewDate = this.moveHour(this.viewDate, dir); + break; + case 1: + this.viewDate = this.moveDate(this.viewDate, dir); + break; + case 2: + this.viewDate = this.moveMonth(this.viewDate, dir); + break; + case 3: + case 4: + this.viewDate = this.moveYear(this.viewDate, dir); + break; + } + this.fill(); + this.element.trigger({ + type: target[0].className + ':' + this.convertViewModeText(this.viewMode), + date: this.viewDate, + startDate: this.startDate, + endDate: this.endDate + }); + break; + case 'clear': + this.reset(); + if (this.autoclose) { + this.hide(); + } + break; + case 'today': + var date = new Date(); + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0); + + // Respect startDate and endDate. + if (date < this.startDate) date = this.startDate; + else if (date > this.endDate) date = this.endDate; + + this.viewMode = this.startViewMode; + this.showMode(0); + this._setDate(date); + this.fill(); + if (this.autoclose) { + this.hide(); + } + break; + } + break; + case 'span': + if (!target.is('.disabled')) { + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + day = this.viewDate.getUTCDate(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + + if (target.is('.month')) { + this.viewDate.setUTCDate(1); + month = target.parent().find('span').index(target); + day = this.viewDate.getUTCDate(); + this.viewDate.setUTCMonth(month); + this.element.trigger({ + type: 'changeMonth', + date: this.viewDate + }); + if (this.viewSelect >= 3) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.year')) { + this.viewDate.setUTCDate(1); + year = parseInt(target.text(), 10) || 0; + this.viewDate.setUTCFullYear(year); + this.element.trigger({ + type: 'changeYear', + date: this.viewDate + }); + if (this.viewSelect >= 4) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.hour')) { + hours = parseInt(target.text(), 10) || 0; + if (target.hasClass('hour_am') || target.hasClass('hour_pm')) { + if (hours === 12 && target.hasClass('hour_am')) { + hours = 0; + } else if (hours !== 12 && target.hasClass('hour_pm')) { + hours += 12; + } + } + this.viewDate.setUTCHours(hours); + this.element.trigger({ + type: 'changeHour', + date: this.viewDate + }); + if (this.viewSelect >= 1) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } else if (target.is('.minute')) { + minutes = parseInt(target.text().substr(target.text().indexOf(':') + 1), 10) || 0; + this.viewDate.setUTCMinutes(minutes); + this.element.trigger({ + type: 'changeMinute', + date: this.viewDate + }); + if (this.viewSelect >= 0) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + } + break; + case 'td': + if (target.is('.day') && !target.is('.disabled')) { + var day = parseInt(target.text(), 10) || 1; + var year = this.viewDate.getUTCFullYear(), + month = this.viewDate.getUTCMonth(), + hours = this.viewDate.getUTCHours(), + minutes = this.viewDate.getUTCMinutes(), + seconds = this.viewDate.getUTCSeconds(); + if (target.is('.old')) { + if (month === 0) { + month = 11; + year -= 1; + } else { + month -= 1; + } + } else if (target.is('.new')) { + if (month === 11) { + month = 0; + year += 1; + } else { + month += 1; + } + } + this.viewDate.setUTCFullYear(year); + this.viewDate.setUTCMonth(month, day); + this.element.trigger({ + type: 'changeDay', + date: this.viewDate + }); + if (this.viewSelect >= 2) { + this._setDate(UTCDate(year, month, day, hours, minutes, seconds, 0)); + } + } + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + break; + } + } + }, + + _setDate: function (date, which) { + if (!which || which === 'date') + this.date = date; + if (!which || which === 'view') + this.viewDate = date; + this.fill(); + this.setValue(); + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + if(date === null) + this.date = this.viewDate; + }, + + moveMinute: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCMinutes(new_date.getUTCMinutes() + (dir * this.minuteStep)); + return new_date; + }, + + moveHour: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCHours(new_date.getUTCHours() + dir); + return new_date; + }, + + moveDate: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()); + //dir = dir > 0 ? 1 : -1; + new_date.setUTCDate(new_date.getUTCDate() + dir); + return new_date; + }, + + moveMonth: function (date, dir) { + if (!dir) return date; + var new_date = new Date(date.valueOf()), + day = new_date.getUTCDate(), + month = new_date.getUTCMonth(), + mag = Math.abs(dir), + new_month, test; + dir = dir > 0 ? 1 : -1; + if (mag === 1) { + test = dir === -1 + // If going back one month, make sure month is not current month + // (eg, Mar 31 -> Feb 31 === Feb 28, not Mar 02) + ? function () { + return new_date.getUTCMonth() === month; + } + // If going forward one month, make sure month is as expected + // (eg, Jan 31 -> Feb 31 === Feb 28, not Mar 02) + : function () { + return new_date.getUTCMonth() !== new_month; + }; + new_month = month + dir; + new_date.setUTCMonth(new_month); + // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 + if (new_month < 0 || new_month > 11) + new_month = (new_month + 12) % 12; + } else { + // For magnitudes >1, move one month at a time... + for (var i = 0; i < mag; i++) + // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... + new_date = this.moveMonth(new_date, dir); + // ...then reset the day, keeping it in the new month + new_month = new_date.getUTCMonth(); + new_date.setUTCDate(day); + test = function () { + return new_month !== new_date.getUTCMonth(); + }; + } + // Common date-resetting loop -- if date is beyond end of month, make it + // end of month + while (test()) { + new_date.setUTCDate(--day); + new_date.setUTCMonth(new_month); + } + return new_date; + }, + + moveYear: function (date, dir) { + return this.moveMonth(date, dir * 12); + }, + + dateWithinRange: function (date) { + return date >= this.startDate && date <= this.endDate; + }, + + keydown: function (e) { + if (this.picker.is(':not(:visible)')) { + if (e.keyCode === 27) // allow escape to hide and re-show picker + this.show(); + return; + } + var dateChanged = false, + dir, newDate, newViewDate; + switch (e.keyCode) { + case 27: // escape + this.hide(); + e.preventDefault(); + break; + case 37: // left + case 39: // right + if (!this.keyboardNavigation) break; + dir = e.keyCode === 37 ? -1 : 1; + var viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir); + newViewDate = this.moveDate(this.viewDate, dir); + } else if (viewMode === 1) { + newDate = this.moveHour(this.date, dir); + newViewDate = this.moveHour(this.viewDate, dir); + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir); + newViewDate = this.moveMinute(this.viewDate, dir); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 38: // up + case 40: // down + if (!this.keyboardNavigation) break; + dir = e.keyCode === 38 ? -1 : 1; + viewMode = this.viewMode; + if (e.ctrlKey) { + viewMode += 2; + } else if (e.shiftKey) { + viewMode += 1; + } + if (viewMode === 4) { + newDate = this.moveYear(this.date, dir); + newViewDate = this.moveYear(this.viewDate, dir); + } else if (viewMode === 3) { + newDate = this.moveMonth(this.date, dir); + newViewDate = this.moveMonth(this.viewDate, dir); + } else if (viewMode === 2) { + newDate = this.moveDate(this.date, dir * 7); + newViewDate = this.moveDate(this.viewDate, dir * 7); + } else if (viewMode === 1) { + if (this.showMeridian) { + newDate = this.moveHour(this.date, dir * 6); + newViewDate = this.moveHour(this.viewDate, dir * 6); + } else { + newDate = this.moveHour(this.date, dir * 4); + newViewDate = this.moveHour(this.viewDate, dir * 4); + } + } else if (viewMode === 0) { + newDate = this.moveMinute(this.date, dir * 4); + newViewDate = this.moveMinute(this.viewDate, dir * 4); + } + if (this.dateWithinRange(newDate)) { + this.date = newDate; + this.viewDate = newViewDate; + this.setValue(); + this.update(); + e.preventDefault(); + dateChanged = true; + } + break; + case 13: // enter + if (this.viewMode !== 0) { + var oldViewMode = this.viewMode; + this.showMode(-1); + this.fill(); + if (oldViewMode === this.viewMode && this.autoclose) { + this.hide(); + } + } else { + this.fill(); + if (this.autoclose) { + this.hide(); + } + } + e.preventDefault(); + break; + case 9: // tab + this.hide(); + break; + } + if (dateChanged) { + var element; + if (this.isInput) { + element = this.element; + } else if (this.component) { + element = this.element.find('input'); + } + if (element) { + element.change(); + } + this.element.trigger({ + type: 'changeDate', + date: this.getDate() + }); + } + }, + + showMode: function (dir) { + if (dir) { + var newViewMode = Math.max(0, Math.min(DPGlobal.modes.length - 1, this.viewMode + dir)); + if (newViewMode >= this.minView && newViewMode <= this.maxView) { + this.element.trigger({ + type: 'changeMode', + date: this.viewDate, + oldViewMode: this.viewMode, + newViewMode: newViewMode + }); + + this.viewMode = newViewMode; + } + } + /* + vitalets: fixing bug of very special conditions: + jquery 1.7.1 + webkit + show inline datetimepicker in bootstrap popover. + Method show() does not set display css correctly and datetimepicker is not shown. + Changed to .css('display', 'block') solve the problem. + See https://github.com/vitalets/x-editable/issues/37 + + In jquery 1.7.2+ everything works fine. + */ + //this.picker.find('>div').hide().filter('.datetimepicker-'+DPGlobal.modes[this.viewMode].clsName).show(); + this.picker.find('>div').hide().filter('.datetimepicker-' + DPGlobal.modes[this.viewMode].clsName).css('display', 'block'); + this.updateNavArrows(); + }, + + reset: function () { + this._setDate(null, 'date'); + }, + + convertViewModeText: function (viewMode) { + switch (viewMode) { + case 4: + return 'decade'; + case 3: + return 'year'; + case 2: + return 'month'; + case 1: + return 'day'; + case 0: + return 'hour'; + } + } + }; + + var old = $.fn.datetimepicker; + $.fn.datetimepicker = function (option) { + var args = Array.apply(null, arguments); + args.shift(); + var internal_return; + this.each(function () { + var $this = $(this), + data = $this.data('datetimepicker'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('datetimepicker', (data = new Datetimepicker(this, $.extend({}, $.fn.datetimepicker.defaults, options)))); + } + if (typeof option === 'string' && typeof data[option] === 'function') { + internal_return = data[option].apply(data, args); + if (internal_return !== undefined) { + return false; + } + } + }); + if (internal_return !== undefined) + return internal_return; + else + return this; + }; + + $.fn.datetimepicker.defaults = { + }; + $.fn.datetimepicker.Constructor = Datetimepicker; + var dates = $.fn.datetimepicker.dates = { + en: { + days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'], + months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + meridiem: ['am', 'pm'], + suffix: ['st', 'nd', 'rd', 'th'], + today: 'Today', + clear: 'Clear' + } + }; + + var DPGlobal = { + modes: [ + { + clsName: 'minutes', + navFnc: 'Hours', + navStep: 1 + }, + { + clsName: 'hours', + navFnc: 'Date', + navStep: 1 + }, + { + clsName: 'days', + navFnc: 'Month', + navStep: 1 + }, + { + clsName: 'months', + navFnc: 'FullYear', + navStep: 1 + }, + { + clsName: 'years', + navFnc: 'FullYear', + navStep: 10 + } + ], + isLeapYear: function (year) { + return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)) + }, + getDaysInMonth: function (year, month) { + return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month] + }, + getDefaultFormat: function (type, field) { + if (type === 'standard') { + if (field === 'input') + return 'yyyy-mm-dd hh:ii'; + else + return 'yyyy-mm-dd hh:ii:ss'; + } else if (type === 'php') { + if (field === 'input') + return 'Y-m-d H:i'; + else + return 'Y-m-d H:i:s'; + } else { + throw new Error('Invalid format type.'); + } + }, + validParts: function (type) { + if (type === 'standard') { + return /t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g; + } else if (type === 'php') { + return /[dDjlNwzFmMnStyYaABgGhHis]/g; + } else { + throw new Error('Invalid format type.'); + } + }, + nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\rTZ]+/g, + parseFormat: function (format, type) { + // IE treats \0 as a string end in inputs (truncating the value), + // so it's a bad format delimiter, anyway + var separators = format.replace(this.validParts(type), '\0').split('\0'), + parts = format.match(this.validParts(type)); + if (!separators || !separators.length || !parts || parts.length === 0) { + throw new Error('Invalid date format.'); + } + return {separators: separators, parts: parts}; + }, + parseDate: function (date, format, language, type, timezone) { + if (date instanceof Date) { + var dateUTC = new Date(date.valueOf() - date.getTimezoneOffset() * 60000); + dateUTC.setMilliseconds(0); + return dateUTC; + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii', type); + } + if (/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)) { + format = this.parseFormat('yyyy-mm-dd hh:ii:ss', type); + } + if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) { + var part_re = /([-+]\d+)([dmwy])/, + parts = date.match(/([-+]\d+)([dmwy])/g), + part, dir; + date = new Date(); + for (var i = 0; i < parts.length; i++) { + part = part_re.exec(parts[i]); + dir = parseInt(part[1]); + switch (part[2]) { + case 'd': + date.setUTCDate(date.getUTCDate() + dir); + break; + case 'm': + date = Datetimepicker.prototype.moveMonth.call(Datetimepicker.prototype, date, dir); + break; + case 'w': + date.setUTCDate(date.getUTCDate() + dir * 7); + break; + case 'y': + date = Datetimepicker.prototype.moveYear.call(Datetimepicker.prototype, date, dir); + break; + } + } + return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), 0); + } + var parts = date && date.toString().match(this.nonpunctuation) || [], + date = new Date(0, 0, 0, 0, 0, 0, 0), + parsed = {}, + setters_order = ['hh', 'h', 'ii', 'i', 'ss', 's', 'yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'D', 'DD', 'd', 'dd', 'H', 'HH', 'p', 'P', 'z', 'Z'], + setters_map = { + hh: function (d, v) { + return d.setUTCHours(v); + }, + h: function (d, v) { + return d.setUTCHours(v); + }, + HH: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + H: function (d, v) { + return d.setUTCHours(v === 12 ? 0 : v); + }, + ii: function (d, v) { + return d.setUTCMinutes(v); + }, + i: function (d, v) { + return d.setUTCMinutes(v); + }, + ss: function (d, v) { + return d.setUTCSeconds(v); + }, + s: function (d, v) { + return d.setUTCSeconds(v); + }, + yyyy: function (d, v) { + return d.setUTCFullYear(v); + }, + yy: function (d, v) { + return d.setUTCFullYear(2000 + v); + }, + m: function (d, v) { + v -= 1; + while (v < 0) v += 12; + v %= 12; + d.setUTCMonth(v); + while (d.getUTCMonth() !== v) + if (isNaN(d.getUTCMonth())) + return d; + else + d.setUTCDate(d.getUTCDate() - 1); + return d; + }, + d: function (d, v) { + return d.setUTCDate(v); + }, + p: function (d, v) { + return d.setUTCHours(v === 1 ? d.getUTCHours() + 12 : d.getUTCHours()); + }, + z: function () { + return timezone + } + }, + val, filtered, part; + setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; + setters_map['dd'] = setters_map['d']; + setters_map['P'] = setters_map['p']; + setters_map['Z'] = setters_map['z']; + date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); + if (parts.length === format.parts.length) { + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + val = parseInt(parts[i], 10); + part = format.parts[i]; + if (isNaN(val)) { + switch (part) { + case 'MM': + filtered = $(dates[language].months).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m === p; + }); + val = $.inArray(filtered[0], dates[language].months) + 1; + break; + case 'M': + filtered = $(dates[language].monthsShort).filter(function () { + var m = this.slice(0, parts[i].length), + p = parts[i].slice(0, m.length); + return m.toLowerCase() === p.toLowerCase(); + }); + val = $.inArray(filtered[0], dates[language].monthsShort) + 1; + break; + case 'p': + case 'P': + val = $.inArray(parts[i].toLowerCase(), dates[language].meridiem); + break; + case 'z': + case 'Z': + timezone; + break; + + } + } + parsed[part] = val; + } + for (var i = 0, s; i < setters_order.length; i++) { + s = setters_order[i]; + if (s in parsed && !isNaN(parsed[s])) + setters_map[s](date, parsed[s]) + } + } + return date; + }, + formatDate: function (date, format, language, type, timezone) { + if (date === null) { + return ''; + } + var val; + if (type === 'standard') { + val = { + t: date.getTime(), + // year + yy: date.getUTCFullYear().toString().substring(2), + yyyy: date.getUTCFullYear(), + // month + m: date.getUTCMonth() + 1, + M: dates[language].monthsShort[date.getUTCMonth()], + MM: dates[language].months[date.getUTCMonth()], + // day + d: date.getUTCDate(), + D: dates[language].daysShort[date.getUTCDay()], + DD: dates[language].days[date.getUTCDay()], + p: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + // hour + h: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds(), + // timezone + z: timezone + }; + + if (dates[language].meridiem.length === 2) { + val.H = (val.h % 12 === 0 ? 12 : val.h % 12); + } + else { + val.H = val.h; + } + val.HH = (val.H < 10 ? '0' : '') + val.H; + val.P = val.p.toUpperCase(); + val.Z = val.z; + val.hh = (val.h < 10 ? '0' : '') + val.h; + val.ii = (val.i < 10 ? '0' : '') + val.i; + val.ss = (val.s < 10 ? '0' : '') + val.s; + val.dd = (val.d < 10 ? '0' : '') + val.d; + val.mm = (val.m < 10 ? '0' : '') + val.m; + } else if (type === 'php') { + // php format + val = { + // year + y: date.getUTCFullYear().toString().substring(2), + Y: date.getUTCFullYear(), + // month + F: dates[language].months[date.getUTCMonth()], + M: dates[language].monthsShort[date.getUTCMonth()], + n: date.getUTCMonth() + 1, + t: DPGlobal.getDaysInMonth(date.getUTCFullYear(), date.getUTCMonth()), + // day + j: date.getUTCDate(), + l: dates[language].days[date.getUTCDay()], + D: dates[language].daysShort[date.getUTCDay()], + w: date.getUTCDay(), // 0 -> 6 + N: (date.getUTCDay() === 0 ? 7 : date.getUTCDay()), // 1 -> 7 + S: (date.getUTCDate() % 10 <= dates[language].suffix.length ? dates[language].suffix[date.getUTCDate() % 10 - 1] : ''), + // hour + a: (dates[language].meridiem.length === 2 ? dates[language].meridiem[date.getUTCHours() < 12 ? 0 : 1] : ''), + g: (date.getUTCHours() % 12 === 0 ? 12 : date.getUTCHours() % 12), + G: date.getUTCHours(), + // minute + i: date.getUTCMinutes(), + // second + s: date.getUTCSeconds() + }; + val.m = (val.n < 10 ? '0' : '') + val.n; + val.d = (val.j < 10 ? '0' : '') + val.j; + val.A = val.a.toString().toUpperCase(); + val.h = (val.g < 10 ? '0' : '') + val.g; + val.H = (val.G < 10 ? '0' : '') + val.G; + val.i = (val.i < 10 ? '0' : '') + val.i; + val.s = (val.s < 10 ? '0' : '') + val.s; + } else { + throw new Error('Invalid format type.'); + } + var date = [], + seps = $.extend([], format.separators); + for (var i = 0, cnt = format.parts.length; i < cnt; i++) { + if (seps.length) { + date.push(seps.shift()); + } + date.push(val[format.parts[i]]); + } + if (seps.length) { + date.push(seps.shift()); + } + return date.join(''); + }, + convertViewMode: function (viewMode) { + switch (viewMode) { + case 4: + case 'decade': + viewMode = 4; + break; + case 3: + case 'year': + viewMode = 3; + break; + case 2: + case 'month': + viewMode = 2; + break; + case 1: + case 'day': + viewMode = 1; + break; + case 0: + case 'hour': + viewMode = 0; + break; + } + + return viewMode; + }, + headTemplate: '' + + '' + + '' + + '' + + '' + + '' + + '', + headTemplateV3: '' + + '' + + ' ' + + '' + + ' ' + + '' + + '', + contTemplate: '', + footTemplate: '' + + '' + + '' + + '' + }; + DPGlobal.template = '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplate + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
'; + DPGlobal.templateV3 = '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + '' + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
' + + '' + + DPGlobal.headTemplateV3 + + DPGlobal.contTemplate + + DPGlobal.footTemplate + + '
' + + '
' + + '
'; + $.fn.datetimepicker.DPGlobal = DPGlobal; + + /* DATETIMEPICKER NO CONFLICT + * =================== */ + + $.fn.datetimepicker.noConflict = function () { + $.fn.datetimepicker = old; + return this; + }; + + /* DATETIMEPICKER DATA-API + * ================== */ + + $(document).on( + 'focus.datetimepicker.data-api click.datetimepicker.data-api', + '[data-provide="datetimepicker"]', + function (e) { + var $this = $(this); + if ($this.data('datetimepicker')) return; + e.preventDefault(); + // component click requires us to explicitly show it + $this.datetimepicker('show'); + } + ); + $(function () { + $('[data-provide="datetimepicker-inline"]').datetimepicker(); + }); + +})); diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css new file mode 100644 index 000000000..78485fee7 --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.css @@ -0,0 +1,9 @@ +/*! + * Datetimepicker for Bootstrap + * + * Copyright 2012 Stefan Petre + * Improvements by Andrew Rowls + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */.datetimepicker{padding:4px;margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;direction:ltr}.datetimepicker-inline{width:220px}.datetimepicker.datetimepicker-rtl{direction:rtl}.datetimepicker.datetimepicker-rtl table tr td span{float:right}.datetimepicker-dropdown,.datetimepicker-dropdown-left{top:0;left:0}[class*=" datetimepicker-dropdown"]:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-bottom-color:rgba(0,0,0,0.2);position:absolute}[class*=" datetimepicker-dropdown"]:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-bottom:6px solid #fff;position:absolute}[class*=" datetimepicker-dropdown-top"]:before{content:'';display:inline-block;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ccc;border-top-color:rgba(0,0,0,0.2);border-bottom:0}[class*=" datetimepicker-dropdown-top"]:after{content:'';display:inline-block;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #fff;border-bottom:0}.datetimepicker-dropdown-bottom-left:before{top:-7px;right:6px}.datetimepicker-dropdown-bottom-left:after{top:-6px;right:7px}.datetimepicker-dropdown-bottom-right:before{top:-7px;left:6px}.datetimepicker-dropdown-bottom-right:after{top:-6px;left:7px}.datetimepicker-dropdown-top-left:before{bottom:-7px;right:6px}.datetimepicker-dropdown-top-left:after{bottom:-6px;right:7px}.datetimepicker-dropdown-top-right:before{bottom:-7px;left:6px}.datetimepicker-dropdown-top-right:after{bottom:-6px;left:7px}.datetimepicker>div{display:none}.datetimepicker.minutes div.datetimepicker-minutes{display:block}.datetimepicker.hours div.datetimepicker-hours{display:block}.datetimepicker.days div.datetimepicker-days{display:block}.datetimepicker.months div.datetimepicker-months{display:block}.datetimepicker.years div.datetimepicker-years{display:block}.datetimepicker table{margin:0}.datetimepicker td,.datetimepicker th{text-align:center;width:20px;height:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;border:0}.table-striped .datetimepicker table tr td,.table-striped .datetimepicker table tr th{background-color:transparent}.datetimepicker table tr td.minute:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.hour:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.day:hover{background:#eee;cursor:pointer}.datetimepicker table tr td.old,.datetimepicker table tr td.new{color:#999}.datetimepicker table tr td.disabled,.datetimepicker table tr td.disabled:hover{background:0;color:#999;cursor:default}.datetimepicker table tr td.today,.datetimepicker table tr td.today:hover,.datetimepicker table tr td.today.disabled,.datetimepicker table tr td.today.disabled:hover{background-color:#fde19a;background-image:-moz-linear-gradient(top,#fdd49a,#fdf59a);background-image:-ms-linear-gradient(top,#fdd49a,#fdf59a);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fdd49a),to(#fdf59a));background-image:-webkit-linear-gradient(top,#fdd49a,#fdf59a);background-image:-o-linear-gradient(top,#fdd49a,#fdf59a);background-image:linear-gradient(to bottom,#fdd49a,#fdf59a);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a',endColorstr='#fdf59a',GradientType=0);border-color:#fdf59a #fdf59a #fbed50;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.datetimepicker table tr td.today:hover,.datetimepicker table tr td.today:hover:hover,.datetimepicker table tr td.today.disabled:hover,.datetimepicker table tr td.today.disabled:hover:hover,.datetimepicker table tr td.today:active,.datetimepicker table tr td.today:hover:active,.datetimepicker table tr td.today.disabled:active,.datetimepicker table tr td.today.disabled:hover:active,.datetimepicker table tr td.today.active,.datetimepicker table tr td.today:hover.active,.datetimepicker table tr td.today.disabled.active,.datetimepicker table tr td.today.disabled:hover.active,.datetimepicker table tr td.today.disabled,.datetimepicker table tr td.today:hover.disabled,.datetimepicker table tr td.today.disabled.disabled,.datetimepicker table tr td.today.disabled:hover.disabled,.datetimepicker table tr td.today[disabled],.datetimepicker table tr td.today:hover[disabled],.datetimepicker table tr td.today.disabled[disabled],.datetimepicker table tr td.today.disabled:hover[disabled]{background-color:#fdf59a}.datetimepicker table tr td.today:active,.datetimepicker table tr td.today:hover:active,.datetimepicker table tr td.today.disabled:active,.datetimepicker table tr td.today.disabled:hover:active,.datetimepicker table tr td.today.active,.datetimepicker table tr td.today:hover.active,.datetimepicker table tr td.today.disabled.active,.datetimepicker table tr td.today.disabled:hover.active{background-color:#fbf069}.datetimepicker table tr td.active,.datetimepicker table tr td.active:hover,.datetimepicker table tr td.active.disabled,.datetimepicker table tr td.active.disabled:hover{background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-ms-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.datetimepicker table tr td.active:hover,.datetimepicker table tr td.active:hover:hover,.datetimepicker table tr td.active.disabled:hover,.datetimepicker table tr td.active.disabled:hover:hover,.datetimepicker table tr td.active:active,.datetimepicker table tr td.active:hover:active,.datetimepicker table tr td.active.disabled:active,.datetimepicker table tr td.active.disabled:hover:active,.datetimepicker table tr td.active.active,.datetimepicker table tr td.active:hover.active,.datetimepicker table tr td.active.disabled.active,.datetimepicker table tr td.active.disabled:hover.active,.datetimepicker table tr td.active.disabled,.datetimepicker table tr td.active:hover.disabled,.datetimepicker table tr td.active.disabled.disabled,.datetimepicker table tr td.active.disabled:hover.disabled,.datetimepicker table tr td.active[disabled],.datetimepicker table tr td.active:hover[disabled],.datetimepicker table tr td.active.disabled[disabled],.datetimepicker table tr td.active.disabled:hover[disabled]{background-color:#04c}.datetimepicker table tr td.active:active,.datetimepicker table tr td.active:hover:active,.datetimepicker table tr td.active.disabled:active,.datetimepicker table tr td.active.disabled:hover:active,.datetimepicker table tr td.active.active,.datetimepicker table tr td.active:hover.active,.datetimepicker table tr td.active.disabled.active,.datetimepicker table tr td.active.disabled:hover.active{background-color:#039}.datetimepicker table tr td span{display:block;width:23%;height:54px;line-height:54px;float:left;margin:1%;cursor:pointer;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.datetimepicker .datetimepicker-hours span{height:26px;line-height:26px}.datetimepicker .datetimepicker-hours table tr td span.hour_am,.datetimepicker .datetimepicker-hours table tr td span.hour_pm{width:14.6%}.datetimepicker .datetimepicker-hours fieldset legend,.datetimepicker .datetimepicker-minutes fieldset legend{margin-bottom:inherit;line-height:30px}.datetimepicker .datetimepicker-minutes span{height:26px;line-height:26px}.datetimepicker table tr td span:hover{background:#eee}.datetimepicker table tr td span.disabled,.datetimepicker table tr td span.disabled:hover{background:0;color:#999;cursor:default}.datetimepicker table tr td span.active,.datetimepicker table tr td span.active:hover,.datetimepicker table tr td span.active.disabled,.datetimepicker table tr td span.active.disabled:hover{background-color:#006dcc;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-ms-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc',endColorstr='#0044cc',GradientType=0);border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.datetimepicker table tr td span.active:hover,.datetimepicker table tr td span.active:hover:hover,.datetimepicker table tr td span.active.disabled:hover,.datetimepicker table tr td span.active.disabled:hover:hover,.datetimepicker table tr td span.active:active,.datetimepicker table tr td span.active:hover:active,.datetimepicker table tr td span.active.disabled:active,.datetimepicker table tr td span.active.disabled:hover:active,.datetimepicker table tr td span.active.active,.datetimepicker table tr td span.active:hover.active,.datetimepicker table tr td span.active.disabled.active,.datetimepicker table tr td span.active.disabled:hover.active,.datetimepicker table tr td span.active.disabled,.datetimepicker table tr td span.active:hover.disabled,.datetimepicker table tr td span.active.disabled.disabled,.datetimepicker table tr td span.active.disabled:hover.disabled,.datetimepicker table tr td span.active[disabled],.datetimepicker table tr td span.active:hover[disabled],.datetimepicker table tr td span.active.disabled[disabled],.datetimepicker table tr td span.active.disabled:hover[disabled]{background-color:#04c}.datetimepicker table tr td span.active:active,.datetimepicker table tr td span.active:hover:active,.datetimepicker table tr td span.active.disabled:active,.datetimepicker table tr td span.active.disabled:hover:active,.datetimepicker table tr td span.active.active,.datetimepicker table tr td span.active:hover.active,.datetimepicker table tr td span.active.disabled.active,.datetimepicker table tr td span.active.disabled:hover.active{background-color:#039}.datetimepicker table tr td span.old{color:#999}.datetimepicker th.switch{width:145px}.datetimepicker th span.glyphicon{pointer-events:none}.datetimepicker thead tr:first-child th,.datetimepicker tfoot th{cursor:pointer}.datetimepicker thead tr:first-child th:hover,.datetimepicker tfoot th:hover{background:#eee}.input-append.date .add-on i,.input-prepend.date .add-on i,.input-group.date .input-group-addon span{cursor:pointer;width:14px;height:14px} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js new file mode 100644 index 000000000..eba15ce5d --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js @@ -0,0 +1 @@ +(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(d,f){if(!("indexOf" in Array.prototype)){Array.prototype.indexOf=function(k,j){if(j===f){j=0}if(j<0){j+=this.length}if(j<0){j=0}for(var l=this.length;jthis.endDate){o.push("disabled")}else{if(Math.floor(this.date.getUTCMinutes()/this.minuteStep)===Math.floor(n.getUTCMinutes()/this.minuteStep)){o.push("active")}}return o.concat((p?p:[]))};this.onRenderYear=function(o){var q=(j.onRenderYear||function(){return[]})(o);var p=["year"];if(typeof q==="string"){q=[q]}if(this.date.getUTCFullYear()===o.getUTCFullYear()){p.push("active")}var n=o.getUTCFullYear();var r=this.endDate.getUTCFullYear();if(or){p.push("disabled")}return p.concat((q?q:[]))};this.onRenderMonth=function(n){var p=(j.onRenderMonth||function(){return[]})(n);var o=["month"];if(typeof p==="string"){p=[p]}return o.concat((p?p:[]))};this.startDate=new Date(-8639968443048000);this.endDate=new Date(8639968443048000);this.datesDisabled=[];this.daysOfWeekDisabled=[];this.setStartDate(j.startDate||this.element.data("date-startdate"));this.setEndDate(j.endDate||this.element.data("date-enddate"));this.setDatesDisabled(j.datesDisabled||this.element.data("date-dates-disabled"));this.setDaysOfWeekDisabled(j.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.setMinutesDisabled(j.minutesDisabled||this.element.data("date-minute-disabled"));this.setHoursDisabled(j.hoursDisabled||this.element.data("date-hour-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};g.prototype={constructor:g,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}],[this.component,{click:d.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:d.proxy(this.reset,this)}])}}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:d.proxy(this.show,this)}]]}}}for(var j=0,k,l;j=this.startDate&&i<=this.endDate){this.date=i;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:i,startDate:this.startDate,endDate:this.endDate})}},setFormat:function(j){this.format=c.parseFormat(j,this.formatType);var i;if(this.isInput){i=this.element}else{if(this.component){i=this.element.find("input")}}if(i&&i.val()){this.setValue()}},setValue:function(){var i=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(i)}this.element.data("date",i)}else{this.element.val(i)}if(this.linkField){d("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(i){i=i||this.format;return c.formatDate(this.date,i,this.language,this.formatType,this.timezone)},setStartDate:function(i){this.startDate=i||this.startDate;if(this.startDate.valueOf()!==8639968443048000){this.startDate=c.parseDate(this.startDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setEndDate:function(i){this.endDate=i||this.endDate;if(this.endDate.valueOf()!==8639968443048000){this.endDate=c.parseDate(this.endDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setDatesDisabled:function(j){this.datesDisabled=j||[];if(!d.isArray(this.datesDisabled)){this.datesDisabled=this.datesDisabled.split(/,\s*/)}var i=this;this.datesDisabled=d.map(this.datesDisabled,function(k){return c.parseDate(k,i.format,i.language,i.formatType,i.timezone).toDateString()});this.update();this.updateNavArrows()},setTitle:function(i,j){return this.picker.find(i).find("th:eq(1)").text(this.title===false?j:this.title)},setDaysOfWeekDisabled:function(i){this.daysOfWeekDisabled=i||[];if(!d.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=d.map(this.daysOfWeekDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setMinutesDisabled:function(i){this.minutesDisabled=i||[];if(!d.isArray(this.minutesDisabled)){this.minutesDisabled=this.minutesDisabled.split(/,\s*/)}this.minutesDisabled=d.map(this.minutesDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setHoursDisabled:function(i){this.hoursDisabled=i||[];if(!d.isArray(this.hoursDisabled)){this.hoursDisabled=this.hoursDisabled.split(/,\s*/)}this.hoursDisabled=d.map(this.hoursDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}if(!this.zIndex){var j=0;d("div").each(function(){var o=parseInt(d(this).css("zIndex"),10);if(o>j){j=o}});this.zIndex=j+10}var n,m,l,k;if(this.container instanceof d){k=this.container.offset()}else{k=d(this.container).offset()}if(this.component){n=this.component.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.component.outerWidth()-this.picker.outerWidth()}}else{n=this.element.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.element.outerWidth()-this.picker.outerWidth()}}var i=document.body.clientWidth||window.innerWidth;if(l+220>i){l=i-220}if(this.pickerPosition==="top-left"||this.pickerPosition==="top-right"){m=n.top-this.picker.outerHeight()}else{m=n.top+this.height}m=m-k.top;l=l-k.left;this.picker.css({top:m,left:l,zIndex:this.zIndex})},hour_minute:"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]",update:function(){var i,j=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0] instanceof Date)){i=arguments[0];j=true}else{i=(this.isInput?this.element.val():this.element.find("input").val())||this.element.data("date")||this.initialDate;if(typeof i==="string"){i=i.replace(/^\s+|\s+$/g,"")}}if(!i){i=new Date();j=false}if(typeof i==="string"){if(new RegExp(this.hour_minute).test(i)||new RegExp(this.hour_minute+":[0-5][0-9]").test(i)){i=this.getDate()}}this.date=c.parseDate(i,this.format,this.language,this.formatType,this.timezone);if(j){this.setValue()}if(this.datethis.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}}this.fill()},fillDow:function(){var i=this.weekStart,j="";while(i'+e[this.language].daysMin[(i++)%7]+""}j+="";this.picker.find(".datetimepicker-days thead").append(j)},fillMonths:function(){var l="";var m=new Date(this.viewDate);for(var k=0;k<12;k++){m.setUTCMonth(k);var j=this.onRenderMonth(m);l+=''+e[this.language].monthsShort[k]+""}this.picker.find(".datetimepicker-months td").html(l)},fill:function(){if(!this.date||!this.viewDate){return}var E=new Date(this.viewDate),t=E.getUTCFullYear(),G=E.getUTCMonth(),n=E.getUTCDate(),A=E.getUTCHours(),w=this.startDate.getUTCFullYear(),B=this.startDate.getUTCMonth(),p=this.endDate.getUTCFullYear(),x=this.endDate.getUTCMonth()+1,q=(new h(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),D=new Date();this.setTitle(".datetimepicker-days",e[this.language].months[G]+" "+t);if(this.formatViewType==="time"){var k=this.getFormattedDate();this.setTitle(".datetimepicker-hours",k);this.setTitle(".datetimepicker-minutes",k)}else{this.setTitle(".datetimepicker-hours",n+" "+e[this.language].months[G]+" "+t);this.setTitle(".datetimepicker-minutes",n+" "+e[this.language].months[G]+" "+t)}this.picker.find("tfoot th.today").text(e[this.language].today||e.en.today).toggle(this.todayBtn!==false);this.picker.find("tfoot th.clear").text(e[this.language].clear||e.en.clear).toggle(this.clearBtn!==false);this.updateNavArrows();this.fillMonths();var I=h(t,G-1,28,0,0,0,0),z=c.getDaysInMonth(I.getUTCFullYear(),I.getUTCMonth());I.setUTCDate(z);I.setUTCDate(z-(I.getUTCDay()-this.weekStart+7)%7);var j=new Date(I);j.setUTCDate(j.getUTCDate()+42);j=j.valueOf();var r=[];var F;while(I.valueOf()")}F=this.onRenderDay(I);if(I.getUTCFullYear()t||(I.getUTCFullYear()===t&&I.getUTCMonth()>G)){F.push("new")}}if(this.todayHighlight&&I.getUTCFullYear()===D.getFullYear()&&I.getUTCMonth()===D.getMonth()&&I.getUTCDate()===D.getDate()){F.push("today")}if(I.valueOf()===q){F.push("active")}if((I.valueOf()+86400000)<=this.startDate||I.valueOf()>this.endDate||d.inArray(I.getUTCDay(),this.daysOfWeekDisabled)!==-1||d.inArray(I.toDateString(),this.datesDisabled)!==-1){F.push("disabled")}r.push(''+I.getUTCDate()+"");if(I.getUTCDay()===this.weekEnd){r.push("")}I.setUTCDate(I.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(r.join(""));r=[];var u="",C="",s="";var l=this.hoursDisabled||[];E=new Date(this.viewDate);for(var y=0;y<24;y++){E.setUTCHours(y);F=this.onRenderHour(E);if(l.indexOf(y)!==-1){F.push("disabled")}var v=h(t,G,n,y);if((v.valueOf()+3600000)<=this.startDate||v.valueOf()>this.endDate){F.push("disabled")}else{if(A===y){F.push("active")}}if(this.showMeridian&&e[this.language].meridiem.length===2){C=(y<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("")}r.push('
'+C.toUpperCase()+"")}s=C;u=(y%12?y%12:12);if(y<12){F.push("hour_am")}else{F.push("hour_pm")}r.push(''+u+"");if(y===23){r.push("
")}}else{u=y+":00";r.push(''+u+"")}}this.picker.find(".datetimepicker-hours td").html(r.join(""));r=[];u="";C="";s="";var m=this.minutesDisabled||[];E=new Date(this.viewDate);for(var y=0;y<60;y+=this.minuteStep){if(m.indexOf(y)!==-1){continue}E.setUTCMinutes(y);E.setUTCSeconds(0);F=this.onRenderMinute(E);if(this.showMeridian&&e[this.language].meridiem.length===2){C=(A<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("")}r.push('
'+C.toUpperCase()+"")}s=C;u=(A%12?A%12:12);r.push(''+u+":"+(y<10?"0"+y:y)+"");if(y===59){r.push("
")}}else{u=y+":00";r.push(''+A+":"+(y<10?"0"+y:y)+"")}}this.picker.find(".datetimepicker-minutes td").html(r.join(""));var J=this.date.getUTCFullYear();var o=this.setTitle(".datetimepicker-months",t).end().find(".month").removeClass("active");if(J===t){o.eq(this.date.getUTCMonth()).addClass("active")}if(tp){o.addClass("disabled")}if(t===w){o.slice(0,B).addClass("disabled")}if(t===p){o.slice(x).addClass("disabled")}r="";t=parseInt(t/10,10)*10;var H=this.setTitle(".datetimepicker-years",t+"-"+(t+9)).end().find("td");t-=1;E=new Date(this.viewDate);for(var y=-1;y<11;y++){E.setUTCFullYear(t);F=this.onRenderYear(E);if(y===-1||y===10){F.push(b)}r+=''+t+"";t+=1}H.html(r);this.place()},updateNavArrows:function(){var m=new Date(this.viewDate),k=m.getUTCFullYear(),l=m.getUTCMonth(),j=m.getUTCDate(),i=m.getUTCHours();switch(this.viewMode){case 0:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()&&i<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()&&i>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(k<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(j){j.preventDefault();j.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var i=j.originalEvent;var l=i.wheelDelta;var k=l>0?1:(l===0)?0:-1;if(this.wheelViewModeNavigationInverseDirection){k=-k}this.showMode(k);setTimeout(d.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(m){m.stopPropagation();m.preventDefault();var n=d(m.target).closest("span, td, th, legend");if(n.is("."+this.icontype)){n=d(n).parent().closest("span, td, th, legend")}if(n.length===1){if(n.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(n[0].nodeName.toLowerCase()){case"th":switch(n[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var i=c.modes[this.viewMode].navStep*(n[0].className==="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,i);break;case 1:this.viewDate=this.moveDate(this.viewDate,i);break;case 2:this.viewDate=this.moveMonth(this.viewDate,i);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,i);break}this.fill();this.element.trigger({type:n[0].className+":"+this.convertViewModeText(this.viewMode),date:this.viewDate,startDate:this.startDate,endDate:this.endDate});break;case"clear":this.reset();if(this.autoclose){this.hide()}break;case"today":var j=new Date();j=h(j.getFullYear(),j.getMonth(),j.getDate(),j.getHours(),j.getMinutes(),j.getSeconds(),0);if(jthis.endDate){j=this.endDate}}this.viewMode=this.startViewMode;this.showMode(0);this._setDate(j);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!n.is(".disabled")){var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),q=this.viewDate.getUTCDate(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".month")){this.viewDate.setUTCDate(1);o=n.parent().find("span").index(n);q=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(o);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".year")){this.viewDate.setUTCDate(1);p=parseInt(n.text(),10)||0;this.viewDate.setUTCFullYear(p);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".hour")){r=parseInt(n.text(),10)||0;if(n.hasClass("hour_am")||n.hasClass("hour_pm")){if(r===12&&n.hasClass("hour_am")){r=0}else{if(r!==12&&n.hasClass("hour_pm")){r+=12}}}this.viewDate.setUTCHours(r);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".minute")){k=parseInt(n.text().substr(n.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(k);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(h(p,o,q,r,k,s,0))}}}}}if(this.viewMode!==0){var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(n.is(".day")&&!n.is(".disabled")){var q=parseInt(n.text(),10)||1;var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".old")){if(o===0){o=11;p-=1}else{o-=1}}else{if(n.is(".new")){if(o===11){o=0;p+=1}else{o+=1}}}this.viewDate.setUTCFullYear(p);this.viewDate.setUTCMonth(o,q);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(h(p,o,q,r,k,s,0))}}var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(i,k){if(!k||k==="date"){this.date=i}if(!k||k==="view"){this.viewDate=i}this.fill();this.setValue();var j;if(this.isInput){j=this.element}else{if(this.component){j=this.element.find("input")}}if(j){j.change()}this.element.trigger({type:"changeDate",date:this.getDate()});if(i===null){this.date=this.viewDate}},moveMinute:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCMinutes(k.getUTCMinutes()+(i*this.minuteStep));return k},moveHour:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCHours(k.getUTCHours()+i);return k},moveDate:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCDate(k.getUTCDate()+i);return k},moveMonth:function(j,k){if(!k){return j}var n=new Date(j.valueOf()),r=n.getUTCDate(),o=n.getUTCMonth(),m=Math.abs(k),q,p;k=k>0?1:-1;if(m===1){p=k===-1?function(){return n.getUTCMonth()===o}:function(){return n.getUTCMonth()!==q};q=o+k;n.setUTCMonth(q);if(q<0||q>11){q=(q+12)%12}}else{for(var l=0;l=this.startDate&&i<=this.endDate},keydown:function(o){if(this.picker.is(":not(:visible)")){if(o.keyCode===27){this.show()}return}var k=false,j,i,n;switch(o.keyCode){case 27:this.hide();o.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation){break}j=o.keyCode===37?-1:1;var m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j);n=this.moveDate(this.viewDate,j)}else{if(m===1){i=this.moveHour(this.date,j);n=this.moveHour(this.viewDate,j)}else{if(m===0){i=this.moveMinute(this.date,j);n=this.moveMinute(this.viewDate,j)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 38:case 40:if(!this.keyboardNavigation){break}j=o.keyCode===38?-1:1;m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j*7);n=this.moveDate(this.viewDate,j*7)}else{if(m===1){if(this.showMeridian){i=this.moveHour(this.date,j*6);n=this.moveHour(this.viewDate,j*6)}else{i=this.moveHour(this.date,j*4);n=this.moveHour(this.viewDate,j*4)}}else{if(m===0){i=this.moveMinute(this.date,j*4);n=this.moveMinute(this.viewDate,j*4)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 13:if(this.viewMode!==0){var p=this.viewMode;this.showMode(-1);this.fill();if(p===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}o.preventDefault();break;case 9:this.hide();break}if(k){var l;if(this.isInput){l=this.element}else{if(this.component){l=this.element.find("input")}}if(l){l.change()}this.element.trigger({type:"changeDate",date:this.getDate()})}},showMode:function(i){if(i){var j=Math.max(0,Math.min(c.modes.length-1,this.viewMode+i));if(j>=this.minView&&j<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:j});this.viewMode=j}}this.picker.find(">div").hide().filter(".datetimepicker-"+c.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(){this._setDate(null,"date")},convertViewModeText:function(i){switch(i){case 4:return"decade";case 3:return"year";case 2:return"month";case 1:return"day";case 0:return"hour"}}};var b=d.fn.datetimepicker;d.fn.datetimepicker=function(k){var i=Array.apply(null,arguments);i.shift();var j;this.each(function(){var n=d(this),m=n.data("datetimepicker"),l=typeof k==="object"&&k;if(!m){n.data("datetimepicker",(m=new g(this,d.extend({},d.fn.datetimepicker.defaults,l))))}if(typeof k==="string"&&typeof m[k]==="function"){j=m[k].apply(m,i);if(j!==f){return false}}});if(j!==f){return j}else{return this}};d.fn.datetimepicker.defaults={};d.fn.datetimepicker.Constructor=g;var e=d.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today",clear:"Clear"}};var c={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(i){return(((i%4===0)&&(i%100!==0))||(i%400===0))},getDaysInMonth:function(i,j){return[31,(c.isLeapYear(i)?29:28),31,30,31,30,31,31,30,31,30,31][j]},getDefaultFormat:function(i,j){if(i==="standard"){if(j==="input"){return"yyyy-mm-dd hh:ii"}else{return"yyyy-mm-dd hh:ii:ss"}}else{if(i==="php"){if(j==="input"){return"Y-m-d H:i"}else{return"Y-m-d H:i:s"}}else{throw new Error("Invalid format type.")}}},validParts:function(i){if(i==="standard"){return/t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else{if(i==="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(l,j){var i=l.replace(this.validParts(j),"\0").split("\0"),k=l.match(this.validParts(j));if(!i||!i.length||!k||k.length===0){throw new Error("Invalid date format.")}return{separators:i,parts:k}},parseDate:function(A,y,v,j,r){if(A instanceof Date){var u=new Date(A.valueOf()-A.getTimezoneOffset()*60000);u.setMilliseconds(0);return u}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii:ss",j)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(A)){var l=/([-+]\d+)([dmwy])/,q=A.match(/([-+]\d+)([dmwy])/g),t,p;A=new Date();for(var x=0;x',headTemplateV3:' ',contTemplate:'',footTemplate:''};c.template='
'+c.headTemplate+c.contTemplate+c.footTemplate+'
'+c.headTemplate+c.contTemplate+c.footTemplate+'
'+c.headTemplate+""+c.footTemplate+'
'+c.headTemplate+c.contTemplate+c.footTemplate+'
'+c.headTemplate+c.contTemplate+c.footTemplate+"
";c.templateV3='
'+c.headTemplateV3+c.contTemplate+c.footTemplate+'
'+c.headTemplateV3+c.contTemplate+c.footTemplate+'
'+c.headTemplateV3+""+c.footTemplate+'
'+c.headTemplateV3+c.contTemplate+c.footTemplate+'
'+c.headTemplateV3+c.contTemplate+c.footTemplate+"
";d.fn.datetimepicker.DPGlobal=c;d.fn.datetimepicker.noConflict=function(){d.fn.datetimepicker=b;return this};d(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(j){var i=d(this);if(i.data("datetimepicker")){return}j.preventDefault();i.datetimepicker("show")});d(function(){d('[data-provide="datetimepicker-inline"]').datetimepicker()})})); \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/datepicker3.css b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/datepicker3.css deleted file mode 100644 index e1f02da70..000000000 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/datepicker3.css +++ /dev/null @@ -1,789 +0,0 @@ -/*! - * Datepicker for Bootstrap - * - * Copyright 2012 Stefan Petre - * Improvements by Andrew Rowls - * Licensed under the Apache License v2.0 - * http://www.apache.org/licenses/LICENSE-2.0 - * - */ -.datepicker { - padding: 4px; - border-radius: 4px; - direction: ltr; - /*.dow { - border-top: 1px solid #ddd !important; - }*/ -} -.datepicker-inline { - width: 220px; -} -.datepicker.datepicker-rtl { - direction: rtl; -} -.datepicker.datepicker-rtl table tr td span { - float: right; -} -.datepicker-dropdown { - top: 0; - left: 0; -} -.datepicker-dropdown:before { - content: ''; - display: inline-block; - border-left: 7px solid transparent; - border-right: 7px solid transparent; - border-bottom: 7px solid #ccc; - border-top: 0; - border-bottom-color: rgba(0, 0, 0, 0.2); - position: absolute; -} -.datepicker-dropdown:after { - content: ''; - display: inline-block; - border-left: 6px solid transparent; - border-right: 6px solid transparent; - border-bottom: 6px solid #fff; - border-top: 0; - position: absolute; -} -.datepicker-dropdown.datepicker-orient-left:before { - left: 6px; -} -.datepicker-dropdown.datepicker-orient-left:after { - left: 7px; -} -.datepicker-dropdown.datepicker-orient-right:before { - right: 6px; -} -.datepicker-dropdown.datepicker-orient-right:after { - right: 7px; -} -.datepicker-dropdown.datepicker-orient-top:before { - top: -7px; -} -.datepicker-dropdown.datepicker-orient-top:after { - top: -6px; -} -.datepicker-dropdown.datepicker-orient-bottom:before { - bottom: -7px; - border-bottom: 0; - border-top: 7px solid #999; -} -.datepicker-dropdown.datepicker-orient-bottom:after { - bottom: -6px; - border-bottom: 0; - border-top: 6px solid #fff; -} -.datepicker > div { - display: none; -} -.datepicker.days div.datepicker-days { - display: block; -} -.datepicker.months div.datepicker-months { - display: block; -} -.datepicker.years div.datepicker-years { - display: block; -} -.datepicker table { - margin: 0; - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.datepicker table tr td, -.datepicker table tr th { - text-align: center; - width: 30px; - height: 30px; - border-radius: 4px; - border: none; -} -.table-striped .datepicker table tr td, -.table-striped .datepicker table tr th { - background-color: transparent; -} -.datepicker table tr td.day:hover, -.datepicker table tr td.day.focused { - background: #eeeeee; - cursor: pointer; -} -.datepicker table tr td.old, -.datepicker table tr td.new { - color: #999999; -} -.datepicker table tr td.disabled, -.datepicker table tr td.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td.today, -.datepicker table tr td.today:hover, -.datepicker table tr td.today.disabled, -.datepicker table tr td.today.disabled:hover { - color: #000000; - background-color: #ffdb99; - border-color: #ffb733; -} -.datepicker table tr td.today:hover, -.datepicker table tr td.today:hover:hover, -.datepicker table tr td.today.disabled:hover, -.datepicker table tr td.today.disabled:hover:hover, -.datepicker table tr td.today:focus, -.datepicker table tr td.today:hover:focus, -.datepicker table tr td.today.disabled:focus, -.datepicker table tr td.today.disabled:hover:focus, -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.today, -.open .dropdown-toggle.datepicker table tr td.today:hover, -.open .dropdown-toggle.datepicker table tr td.today.disabled, -.open .dropdown-toggle.datepicker table tr td.today.disabled:hover { - color: #000000; - background-color: #ffcd70; - border-color: #f59e00; -} -.datepicker table tr td.today:active, -.datepicker table tr td.today:hover:active, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.active, -.datepicker table tr td.today:hover.active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.today, -.open .dropdown-toggle.datepicker table tr td.today:hover, -.open .dropdown-toggle.datepicker table tr td.today.disabled, -.open .dropdown-toggle.datepicker table tr td.today.disabled:hover { - background-image: none; -} -.datepicker table tr td.today.disabled, -.datepicker table tr td.today:hover.disabled, -.datepicker table tr td.today.disabled.disabled, -.datepicker table tr td.today.disabled:hover.disabled, -.datepicker table tr td.today[disabled], -.datepicker table tr td.today:hover[disabled], -.datepicker table tr td.today.disabled[disabled], -.datepicker table tr td.today.disabled:hover[disabled], -fieldset[disabled] .datepicker table tr td.today, -fieldset[disabled] .datepicker table tr td.today:hover, -fieldset[disabled] .datepicker table tr td.today.disabled, -fieldset[disabled] .datepicker table tr td.today.disabled:hover, -.datepicker table tr td.today.disabled:hover, -.datepicker table tr td.today:hover.disabled:hover, -.datepicker table tr td.today.disabled.disabled:hover, -.datepicker table tr td.today.disabled:hover.disabled:hover, -.datepicker table tr td.today[disabled]:hover, -.datepicker table tr td.today:hover[disabled]:hover, -.datepicker table tr td.today.disabled[disabled]:hover, -.datepicker table tr td.today.disabled:hover[disabled]:hover, -fieldset[disabled] .datepicker table tr td.today:hover, -fieldset[disabled] .datepicker table tr td.today:hover:hover, -fieldset[disabled] .datepicker table tr td.today.disabled:hover, -fieldset[disabled] .datepicker table tr td.today.disabled:hover:hover, -.datepicker table tr td.today.disabled:focus, -.datepicker table tr td.today:hover.disabled:focus, -.datepicker table tr td.today.disabled.disabled:focus, -.datepicker table tr td.today.disabled:hover.disabled:focus, -.datepicker table tr td.today[disabled]:focus, -.datepicker table tr td.today:hover[disabled]:focus, -.datepicker table tr td.today.disabled[disabled]:focus, -.datepicker table tr td.today.disabled:hover[disabled]:focus, -fieldset[disabled] .datepicker table tr td.today:focus, -fieldset[disabled] .datepicker table tr td.today:hover:focus, -fieldset[disabled] .datepicker table tr td.today.disabled:focus, -fieldset[disabled] .datepicker table tr td.today.disabled:hover:focus, -.datepicker table tr td.today.disabled:active, -.datepicker table tr td.today:hover.disabled:active, -.datepicker table tr td.today.disabled.disabled:active, -.datepicker table tr td.today.disabled:hover.disabled:active, -.datepicker table tr td.today[disabled]:active, -.datepicker table tr td.today:hover[disabled]:active, -.datepicker table tr td.today.disabled[disabled]:active, -.datepicker table tr td.today.disabled:hover[disabled]:active, -fieldset[disabled] .datepicker table tr td.today:active, -fieldset[disabled] .datepicker table tr td.today:hover:active, -fieldset[disabled] .datepicker table tr td.today.disabled:active, -fieldset[disabled] .datepicker table tr td.today.disabled:hover:active, -.datepicker table tr td.today.disabled.active, -.datepicker table tr td.today:hover.disabled.active, -.datepicker table tr td.today.disabled.disabled.active, -.datepicker table tr td.today.disabled:hover.disabled.active, -.datepicker table tr td.today[disabled].active, -.datepicker table tr td.today:hover[disabled].active, -.datepicker table tr td.today.disabled[disabled].active, -.datepicker table tr td.today.disabled:hover[disabled].active, -fieldset[disabled] .datepicker table tr td.today.active, -fieldset[disabled] .datepicker table tr td.today:hover.active, -fieldset[disabled] .datepicker table tr td.today.disabled.active, -fieldset[disabled] .datepicker table tr td.today.disabled:hover.active { - background-color: #ffdb99; - border-color: #ffb733; -} -.datepicker table tr td.today:hover:hover { - color: #000; -} -.datepicker table tr td.today.active:hover { - color: #fff; -} -.datepicker table tr td.range, -.datepicker table tr td.range:hover, -.datepicker table tr td.range.disabled, -.datepicker table tr td.range.disabled:hover { - background: #eeeeee; - border-radius: 0; -} -.datepicker table tr td.range.today, -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today.disabled:hover { - color: #000000; - background-color: #f7ca77; - border-color: #f1a417; - border-radius: 0; -} -.datepicker table tr td.range.today:hover, -.datepicker table tr td.range.today:hover:hover, -.datepicker table tr td.range.today.disabled:hover, -.datepicker table tr td.range.today.disabled:hover:hover, -.datepicker table tr td.range.today:focus, -.datepicker table tr td.range.today:hover:focus, -.datepicker table tr td.range.today.disabled:focus, -.datepicker table tr td.range.today.disabled:hover:focus, -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.range.today, -.open .dropdown-toggle.datepicker table tr td.range.today:hover, -.open .dropdown-toggle.datepicker table tr td.range.today.disabled, -.open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover { - color: #000000; - background-color: #f4bb51; - border-color: #bf800c; -} -.datepicker table tr td.range.today:active, -.datepicker table tr td.range.today:hover:active, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.active, -.datepicker table tr td.range.today:hover.active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.range.today, -.open .dropdown-toggle.datepicker table tr td.range.today:hover, -.open .dropdown-toggle.datepicker table tr td.range.today.disabled, -.open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover { - background-image: none; -} -.datepicker table tr td.range.today.disabled, -.datepicker table tr td.range.today:hover.disabled, -.datepicker table tr td.range.today.disabled.disabled, -.datepicker table tr td.range.today.disabled:hover.disabled, -.datepicker table tr td.range.today[disabled], -.datepicker table tr td.range.today:hover[disabled], -.datepicker table tr td.range.today.disabled[disabled], -.datepicker table tr td.range.today.disabled:hover[disabled], -fieldset[disabled] .datepicker table tr td.range.today, -fieldset[disabled] .datepicker table tr td.range.today:hover, -fieldset[disabled] .datepicker table tr td.range.today.disabled, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, -.datepicker table tr td.range.today.disabled:hover, -.datepicker table tr td.range.today:hover.disabled:hover, -.datepicker table tr td.range.today.disabled.disabled:hover, -.datepicker table tr td.range.today.disabled:hover.disabled:hover, -.datepicker table tr td.range.today[disabled]:hover, -.datepicker table tr td.range.today:hover[disabled]:hover, -.datepicker table tr td.range.today.disabled[disabled]:hover, -.datepicker table tr td.range.today.disabled:hover[disabled]:hover, -fieldset[disabled] .datepicker table tr td.range.today:hover, -fieldset[disabled] .datepicker table tr td.range.today:hover:hover, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:hover, -.datepicker table tr td.range.today.disabled:focus, -.datepicker table tr td.range.today:hover.disabled:focus, -.datepicker table tr td.range.today.disabled.disabled:focus, -.datepicker table tr td.range.today.disabled:hover.disabled:focus, -.datepicker table tr td.range.today[disabled]:focus, -.datepicker table tr td.range.today:hover[disabled]:focus, -.datepicker table tr td.range.today.disabled[disabled]:focus, -.datepicker table tr td.range.today.disabled:hover[disabled]:focus, -fieldset[disabled] .datepicker table tr td.range.today:focus, -fieldset[disabled] .datepicker table tr td.range.today:hover:focus, -fieldset[disabled] .datepicker table tr td.range.today.disabled:focus, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:focus, -.datepicker table tr td.range.today.disabled:active, -.datepicker table tr td.range.today:hover.disabled:active, -.datepicker table tr td.range.today.disabled.disabled:active, -.datepicker table tr td.range.today.disabled:hover.disabled:active, -.datepicker table tr td.range.today[disabled]:active, -.datepicker table tr td.range.today:hover[disabled]:active, -.datepicker table tr td.range.today.disabled[disabled]:active, -.datepicker table tr td.range.today.disabled:hover[disabled]:active, -fieldset[disabled] .datepicker table tr td.range.today:active, -fieldset[disabled] .datepicker table tr td.range.today:hover:active, -fieldset[disabled] .datepicker table tr td.range.today.disabled:active, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:active, -.datepicker table tr td.range.today.disabled.active, -.datepicker table tr td.range.today:hover.disabled.active, -.datepicker table tr td.range.today.disabled.disabled.active, -.datepicker table tr td.range.today.disabled:hover.disabled.active, -.datepicker table tr td.range.today[disabled].active, -.datepicker table tr td.range.today:hover[disabled].active, -.datepicker table tr td.range.today.disabled[disabled].active, -.datepicker table tr td.range.today.disabled:hover[disabled].active, -fieldset[disabled] .datepicker table tr td.range.today.active, -fieldset[disabled] .datepicker table tr td.range.today:hover.active, -fieldset[disabled] .datepicker table tr td.range.today.disabled.active, -fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active { - background-color: #f7ca77; - border-color: #f1a417; -} -.datepicker table tr td.selected, -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected.disabled:hover { - color: #ffffff; - background-color: #999999; - border-color: #555555; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.selected:hover, -.datepicker table tr td.selected:hover:hover, -.datepicker table tr td.selected.disabled:hover, -.datepicker table tr td.selected.disabled:hover:hover, -.datepicker table tr td.selected:focus, -.datepicker table tr td.selected:hover:focus, -.datepicker table tr td.selected.disabled:focus, -.datepicker table tr td.selected.disabled:hover:focus, -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.selected, -.open .dropdown-toggle.datepicker table tr td.selected:hover, -.open .dropdown-toggle.datepicker table tr td.selected.disabled, -.open .dropdown-toggle.datepicker table tr td.selected.disabled:hover { - color: #ffffff; - background-color: #858585; - border-color: #373737; -} -.datepicker table tr td.selected:active, -.datepicker table tr td.selected:hover:active, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.active, -.datepicker table tr td.selected:hover.active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.selected, -.open .dropdown-toggle.datepicker table tr td.selected:hover, -.open .dropdown-toggle.datepicker table tr td.selected.disabled, -.open .dropdown-toggle.datepicker table tr td.selected.disabled:hover { - background-image: none; -} -.datepicker table tr td.selected.disabled, -.datepicker table tr td.selected:hover.disabled, -.datepicker table tr td.selected.disabled.disabled, -.datepicker table tr td.selected.disabled:hover.disabled, -.datepicker table tr td.selected[disabled], -.datepicker table tr td.selected:hover[disabled], -.datepicker table tr td.selected.disabled[disabled], -.datepicker table tr td.selected.disabled:hover[disabled], -fieldset[disabled] .datepicker table tr td.selected, -fieldset[disabled] .datepicker table tr td.selected:hover, -fieldset[disabled] .datepicker table tr td.selected.disabled, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover, -.datepicker table tr td.selected.disabled:hover, -.datepicker table tr td.selected:hover.disabled:hover, -.datepicker table tr td.selected.disabled.disabled:hover, -.datepicker table tr td.selected.disabled:hover.disabled:hover, -.datepicker table tr td.selected[disabled]:hover, -.datepicker table tr td.selected:hover[disabled]:hover, -.datepicker table tr td.selected.disabled[disabled]:hover, -.datepicker table tr td.selected.disabled:hover[disabled]:hover, -fieldset[disabled] .datepicker table tr td.selected:hover, -fieldset[disabled] .datepicker table tr td.selected:hover:hover, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover:hover, -.datepicker table tr td.selected.disabled:focus, -.datepicker table tr td.selected:hover.disabled:focus, -.datepicker table tr td.selected.disabled.disabled:focus, -.datepicker table tr td.selected.disabled:hover.disabled:focus, -.datepicker table tr td.selected[disabled]:focus, -.datepicker table tr td.selected:hover[disabled]:focus, -.datepicker table tr td.selected.disabled[disabled]:focus, -.datepicker table tr td.selected.disabled:hover[disabled]:focus, -fieldset[disabled] .datepicker table tr td.selected:focus, -fieldset[disabled] .datepicker table tr td.selected:hover:focus, -fieldset[disabled] .datepicker table tr td.selected.disabled:focus, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover:focus, -.datepicker table tr td.selected.disabled:active, -.datepicker table tr td.selected:hover.disabled:active, -.datepicker table tr td.selected.disabled.disabled:active, -.datepicker table tr td.selected.disabled:hover.disabled:active, -.datepicker table tr td.selected[disabled]:active, -.datepicker table tr td.selected:hover[disabled]:active, -.datepicker table tr td.selected.disabled[disabled]:active, -.datepicker table tr td.selected.disabled:hover[disabled]:active, -fieldset[disabled] .datepicker table tr td.selected:active, -fieldset[disabled] .datepicker table tr td.selected:hover:active, -fieldset[disabled] .datepicker table tr td.selected.disabled:active, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover:active, -.datepicker table tr td.selected.disabled.active, -.datepicker table tr td.selected:hover.disabled.active, -.datepicker table tr td.selected.disabled.disabled.active, -.datepicker table tr td.selected.disabled:hover.disabled.active, -.datepicker table tr td.selected[disabled].active, -.datepicker table tr td.selected:hover[disabled].active, -.datepicker table tr td.selected.disabled[disabled].active, -.datepicker table tr td.selected.disabled:hover[disabled].active, -fieldset[disabled] .datepicker table tr td.selected.active, -fieldset[disabled] .datepicker table tr td.selected:hover.active, -fieldset[disabled] .datepicker table tr td.selected.disabled.active, -fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active { - background-color: #999999; - border-color: #555555; -} -.datepicker table tr td.active, -.datepicker table tr td.active:hover, -.datepicker table tr td.active.disabled, -.datepicker table tr td.active.disabled:hover { - color: #ffffff; - background-color: #428bca; - border-color: #357ebd; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td.active:hover, -.datepicker table tr td.active:hover:hover, -.datepicker table tr td.active.disabled:hover, -.datepicker table tr td.active.disabled:hover:hover, -.datepicker table tr td.active:focus, -.datepicker table tr td.active:hover:focus, -.datepicker table tr td.active.disabled:focus, -.datepicker table tr td.active.disabled:hover:focus, -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.active, -.open .dropdown-toggle.datepicker table tr td.active:hover, -.open .dropdown-toggle.datepicker table tr td.active.disabled, -.open .dropdown-toggle.datepicker table tr td.active.disabled:hover { - color: #ffffff; - background-color: #3276b1; - border-color: #285e8e; -} -.datepicker table tr td.active:active, -.datepicker table tr td.active:hover:active, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.active, -.datepicker table tr td.active:hover.active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td.active, -.open .dropdown-toggle.datepicker table tr td.active:hover, -.open .dropdown-toggle.datepicker table tr td.active.disabled, -.open .dropdown-toggle.datepicker table tr td.active.disabled:hover { - background-image: none; -} -.datepicker table tr td.active.disabled, -.datepicker table tr td.active:hover.disabled, -.datepicker table tr td.active.disabled.disabled, -.datepicker table tr td.active.disabled:hover.disabled, -.datepicker table tr td.active[disabled], -.datepicker table tr td.active:hover[disabled], -.datepicker table tr td.active.disabled[disabled], -.datepicker table tr td.active.disabled:hover[disabled], -fieldset[disabled] .datepicker table tr td.active, -fieldset[disabled] .datepicker table tr td.active:hover, -fieldset[disabled] .datepicker table tr td.active.disabled, -fieldset[disabled] .datepicker table tr td.active.disabled:hover, -.datepicker table tr td.active.disabled:hover, -.datepicker table tr td.active:hover.disabled:hover, -.datepicker table tr td.active.disabled.disabled:hover, -.datepicker table tr td.active.disabled:hover.disabled:hover, -.datepicker table tr td.active[disabled]:hover, -.datepicker table tr td.active:hover[disabled]:hover, -.datepicker table tr td.active.disabled[disabled]:hover, -.datepicker table tr td.active.disabled:hover[disabled]:hover, -fieldset[disabled] .datepicker table tr td.active:hover, -fieldset[disabled] .datepicker table tr td.active:hover:hover, -fieldset[disabled] .datepicker table tr td.active.disabled:hover, -fieldset[disabled] .datepicker table tr td.active.disabled:hover:hover, -.datepicker table tr td.active.disabled:focus, -.datepicker table tr td.active:hover.disabled:focus, -.datepicker table tr td.active.disabled.disabled:focus, -.datepicker table tr td.active.disabled:hover.disabled:focus, -.datepicker table tr td.active[disabled]:focus, -.datepicker table tr td.active:hover[disabled]:focus, -.datepicker table tr td.active.disabled[disabled]:focus, -.datepicker table tr td.active.disabled:hover[disabled]:focus, -fieldset[disabled] .datepicker table tr td.active:focus, -fieldset[disabled] .datepicker table tr td.active:hover:focus, -fieldset[disabled] .datepicker table tr td.active.disabled:focus, -fieldset[disabled] .datepicker table tr td.active.disabled:hover:focus, -.datepicker table tr td.active.disabled:active, -.datepicker table tr td.active:hover.disabled:active, -.datepicker table tr td.active.disabled.disabled:active, -.datepicker table tr td.active.disabled:hover.disabled:active, -.datepicker table tr td.active[disabled]:active, -.datepicker table tr td.active:hover[disabled]:active, -.datepicker table tr td.active.disabled[disabled]:active, -.datepicker table tr td.active.disabled:hover[disabled]:active, -fieldset[disabled] .datepicker table tr td.active:active, -fieldset[disabled] .datepicker table tr td.active:hover:active, -fieldset[disabled] .datepicker table tr td.active.disabled:active, -fieldset[disabled] .datepicker table tr td.active.disabled:hover:active, -.datepicker table tr td.active.disabled.active, -.datepicker table tr td.active:hover.disabled.active, -.datepicker table tr td.active.disabled.disabled.active, -.datepicker table tr td.active.disabled:hover.disabled.active, -.datepicker table tr td.active[disabled].active, -.datepicker table tr td.active:hover[disabled].active, -.datepicker table tr td.active.disabled[disabled].active, -.datepicker table tr td.active.disabled:hover[disabled].active, -fieldset[disabled] .datepicker table tr td.active.active, -fieldset[disabled] .datepicker table tr td.active:hover.active, -fieldset[disabled] .datepicker table tr td.active.disabled.active, -fieldset[disabled] .datepicker table tr td.active.disabled:hover.active { - background-color: #428bca; - border-color: #357ebd; -} -.datepicker table tr td span { - display: block; - width: 23%; - height: 54px; - line-height: 54px; - float: left; - margin: 1%; - cursor: pointer; - border-radius: 4px; -} -.datepicker table tr td span:hover { - background: #eeeeee; -} -.datepicker table tr td span.disabled, -.datepicker table tr td span.disabled:hover { - background: none; - color: #999999; - cursor: default; -} -.datepicker table tr td span.active, -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active.disabled:hover { - color: #ffffff; - background-color: #428bca; - border-color: #357ebd; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); -} -.datepicker table tr td span.active:hover, -.datepicker table tr td span.active:hover:hover, -.datepicker table tr td span.active.disabled:hover, -.datepicker table tr td span.active.disabled:hover:hover, -.datepicker table tr td span.active:focus, -.datepicker table tr td span.active:hover:focus, -.datepicker table tr td span.active.disabled:focus, -.datepicker table tr td span.active.disabled:hover:focus, -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td span.active, -.open .dropdown-toggle.datepicker table tr td span.active:hover, -.open .dropdown-toggle.datepicker table tr td span.active.disabled, -.open .dropdown-toggle.datepicker table tr td span.active.disabled:hover { - color: #ffffff; - background-color: #3276b1; - border-color: #285e8e; -} -.datepicker table tr td span.active:active, -.datepicker table tr td span.active:hover:active, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.active, -.datepicker table tr td span.active:hover.active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active.disabled:hover.active, -.open .dropdown-toggle.datepicker table tr td span.active, -.open .dropdown-toggle.datepicker table tr td span.active:hover, -.open .dropdown-toggle.datepicker table tr td span.active.disabled, -.open .dropdown-toggle.datepicker table tr td span.active.disabled:hover { - background-image: none; -} -.datepicker table tr td span.active.disabled, -.datepicker table tr td span.active:hover.disabled, -.datepicker table tr td span.active.disabled.disabled, -.datepicker table tr td span.active.disabled:hover.disabled, -.datepicker table tr td span.active[disabled], -.datepicker table tr td span.active:hover[disabled], -.datepicker table tr td span.active.disabled[disabled], -.datepicker table tr td span.active.disabled:hover[disabled], -fieldset[disabled] .datepicker table tr td span.active, -fieldset[disabled] .datepicker table tr td span.active:hover, -fieldset[disabled] .datepicker table tr td span.active.disabled, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover, -.datepicker table tr td span.active.disabled:hover, -.datepicker table tr td span.active:hover.disabled:hover, -.datepicker table tr td span.active.disabled.disabled:hover, -.datepicker table tr td span.active.disabled:hover.disabled:hover, -.datepicker table tr td span.active[disabled]:hover, -.datepicker table tr td span.active:hover[disabled]:hover, -.datepicker table tr td span.active.disabled[disabled]:hover, -.datepicker table tr td span.active.disabled:hover[disabled]:hover, -fieldset[disabled] .datepicker table tr td span.active:hover, -fieldset[disabled] .datepicker table tr td span.active:hover:hover, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover, -.datepicker table tr td span.active.disabled:focus, -.datepicker table tr td span.active:hover.disabled:focus, -.datepicker table tr td span.active.disabled.disabled:focus, -.datepicker table tr td span.active.disabled:hover.disabled:focus, -.datepicker table tr td span.active[disabled]:focus, -.datepicker table tr td span.active:hover[disabled]:focus, -.datepicker table tr td span.active.disabled[disabled]:focus, -.datepicker table tr td span.active.disabled:hover[disabled]:focus, -fieldset[disabled] .datepicker table tr td span.active:focus, -fieldset[disabled] .datepicker table tr td span.active:hover:focus, -fieldset[disabled] .datepicker table tr td span.active.disabled:focus, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus, -.datepicker table tr td span.active.disabled:active, -.datepicker table tr td span.active:hover.disabled:active, -.datepicker table tr td span.active.disabled.disabled:active, -.datepicker table tr td span.active.disabled:hover.disabled:active, -.datepicker table tr td span.active[disabled]:active, -.datepicker table tr td span.active:hover[disabled]:active, -.datepicker table tr td span.active.disabled[disabled]:active, -.datepicker table tr td span.active.disabled:hover[disabled]:active, -fieldset[disabled] .datepicker table tr td span.active:active, -fieldset[disabled] .datepicker table tr td span.active:hover:active, -fieldset[disabled] .datepicker table tr td span.active.disabled:active, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover:active, -.datepicker table tr td span.active.disabled.active, -.datepicker table tr td span.active:hover.disabled.active, -.datepicker table tr td span.active.disabled.disabled.active, -.datepicker table tr td span.active.disabled:hover.disabled.active, -.datepicker table tr td span.active[disabled].active, -.datepicker table tr td span.active:hover[disabled].active, -.datepicker table tr td span.active.disabled[disabled].active, -.datepicker table tr td span.active.disabled:hover[disabled].active, -fieldset[disabled] .datepicker table tr td span.active.active, -fieldset[disabled] .datepicker table tr td span.active:hover.active, -fieldset[disabled] .datepicker table tr td span.active.disabled.active, -fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active { - background-color: #428bca; - border-color: #357ebd; -} -.datepicker table tr td span.old, -.datepicker table tr td span.new { - color: #999999; -} -.datepicker th.datepicker-switch { - width: 145px; -} -.datepicker thead tr:first-child th, -.datepicker tfoot tr th { - cursor: pointer; -} -.datepicker thead tr:first-child th:hover, -.datepicker tfoot tr th:hover { - background: #eeeeee; -} -.datepicker .cw { - font-size: 10px; - width: 12px; - padding: 0 2px 0 5px; - vertical-align: middle; -} -.datepicker thead tr:first-child th.cw { - cursor: default; - background-color: transparent; -} -.input-group.date .input-group-addon i { - cursor: pointer; - width: 16px; - height: 16px; -} -.input-daterange input { - text-align: center; -} -.input-daterange input:first-child { - border-radius: 3px 0 0 3px; -} -.input-daterange input:last-child { - border-radius: 0 3px 3px 0; -} -.input-daterange .input-group-addon { - width: auto; - min-width: 16px; - padding: 4px 5px; - font-weight: normal; - line-height: 1.428571429; - text-align: center; - text-shadow: 0 1px 0 #fff; - vertical-align: middle; - background-color: #eeeeee; - border-width: 1px 0; - margin-left: -5px; - margin-right: -5px; -} -.datepicker.dropdown-menu { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - float: left; - display: none; - min-width: 160px; - list-style: none; - background-color: #ffffff; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 5px; - -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); - -webkit-background-clip: padding-box; - -moz-background-clip: padding; - background-clip: padding-box; - *border-right-width: 2px; - *border-bottom-width: 2px; - color: #333333; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 13px; - line-height: 1.428571429; -} -.datepicker.dropdown-menu th, -.datepicker.dropdown-menu td { - padding: 4px 5px; -} diff --git a/ruoyi-admin/src/main/resources/templates/tool/build/build.html b/ruoyi-admin/src/main/resources/templates/tool/build/build.html index a7442e616..7c64a11a0 100644 --- a/ruoyi-admin/src/main/resources/templates/tool/build/build.html +++ b/ruoyi-admin/src/main/resources/templates/tool/build/build.html @@ -3,7 +3,7 @@ - + @@ -165,11 +165,15 @@
- + + $(".input-group.date").datetimepicker({ + format: "yyyy-mm-dd", + minView: "month", + autoclose: true + }); + From 0ced39f2d611d059836ea1d63c81f3482c7e23ca Mon Sep 17 00:00:00 2001 From: okayliao Date: Mon, 28 Jan 2019 15:20:04 +0800 Subject: [PATCH 10/89] =?UTF-8?q?fix:=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/templates/system/user/user.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/user/user.html b/ruoyi-admin/src/main/resources/templates/system/user/user.html index c1c6b21bc..234d4c666 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/user.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/user.html @@ -74,7 +74,7 @@ 删除 - 导入 + 导入 导出 From 3270db75afabe84c0bcffe755ffede5d78e70e3a Mon Sep 17 00:00:00 2001 From: okayliao Date: Mon, 28 Jan 2019 23:08:56 +0800 Subject: [PATCH 11/89] =?UTF-8?q?fix:=20=E5=85=B3=E9=97=AD=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E6=97=B6=EF=BC=8C=E4=BF=9D=E6=8C=81=20"?= =?UTF-8?q?=E8=AE=B0=E4=BD=8F=E6=88=91"=20=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/templates/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index e95911007..91ab7d9a3 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -59,7 +59,7 @@ -
+
From af64be2a31c97fbe99bbc7580d14f98777ffaa3b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 29 Jan 2019 10:07:57 +0800 Subject: [PATCH 12/89] =?UTF-8?q?=E9=81=BF=E5=85=8Dehcache=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=80=E7=9B=B4=E8=A2=AB=E5=8D=A0?= =?UTF-8?q?=E7=94=A8=EF=BC=8C=E6=97=A0=E6=B3=95=E5=AE=8C=E5=85=A8=E9=94=80?= =?UTF-8?q?=E6=AF=81=E9=A1=B9=E7=9B=AE=E9=87=8D=E6=96=B0=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/css/login.css | 15 ++++----- .../main/resources/static/css/login.min.css | 2 +- .../src/main/resources/templates/login.html | 2 +- .../ruoyi/framework/config/ShiroConfig.java | 33 ++++++++++++++++++- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/css/login.css b/ruoyi-admin/src/main/resources/static/css/login.css index c30e36725..af95567e4 100644 --- a/ruoyi-admin/src/main/resources/static/css/login.css +++ b/ruoyi-admin/src/main/resources/static/css/login.css @@ -85,20 +85,19 @@ body.signin { } } /* -¼checkʽ -*/ +登录界面check样式 +*/ .checkbox-custom { position: relative; padding: 0 15px 0 25px; margin-bottom: 7px; - margin-top: 0; display: inline-block; } /* -ʼcheckboxʽı +将初始的checkbox的样式改变 */ .checkbox-custom input[type="checkbox"] { - opacity: 0;/*ʼcheckbox*/ + opacity: 0; /*将初始的checkbox隐藏起来*/ position: absolute; cursor: pointer; z-index: 2; @@ -107,7 +106,7 @@ body.signin { left: 3px; } /* -µcheckboxλ +设计新的checkbox,位置 */ .checkbox-custom label:before { content: ''; @@ -123,7 +122,7 @@ body.signin { background: #fff; } /* -ʼcheckboxµcheckbox +点击初始的checkbox,将新的checkbox关联起来 */ .checkbox-custom input[type="checkbox"]:checked +label:after { position: absolute; @@ -142,7 +141,7 @@ body.signin { .checkbox-custom label { cursor: pointer; line-height: 1.2; - font-weight: normal;/*ırememberme*/ + font-weight: normal; /*改变了rememberme的字体*/ margin-bottom: 0; text-align: left; } \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/css/login.min.css b/ruoyi-admin/src/main/resources/static/css/login.min.css index d17df77c3..30c6633c7 100644 --- a/ruoyi-admin/src/main/resources/static/css/login.min.css +++ b/ruoyi-admin/src/main/resources/static/css/login.min.css @@ -1 +1 @@ -html{height:100%}body.signin{height:auto;background:url(../img/login-background.jpg) no-repeat center fixed;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;color:rgba(255,255,255,.95)}.signinpanel{width:750px;margin:10% auto 0}.signinpanel .logopanel{float:none;width:auto;padding:0;background:0}.signinpanel .signin-info ul{list-style:none;padding:0;margin:20px 0}.signinpanel .form-control{display:block;margin-top:15px}.signinpanel .uname{background:#fff url(../img/user.png) no-repeat 95% center;color:#333}.signinpanel .pword{background:#fff url(../img/locked.png) no-repeat 95% center;color:#333}.signinpanel .code{background:#fff no-repeat 95% center;color:#333;margin:0 0 15px 0}.signinpanel .btn{margin-top:15px}.signinpanel form{background:rgba(255,255,255,.2);border:1px solid rgba(255,255,255,.3);-moz-box-shadow:0 3px 0 rgba(12,12,12,.03);-webkit-box-shadow:0 3px 0 rgba(12,12,12,.03);box-shadow:0 3px 0 rgba(12,12,12,.03);-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;padding:30px}.signup-footer{border-top:solid 1px rgba(255,255,255,.3);margin:20px 0;padding-top:15px}@media screen and (max-width:768px){.signinpanel,.signuppanel{margin:0 auto;width:420px!important;padding:20px}.signinpanel form{margin-top:20px}.signup-footer,.signuppanel .form-control{margin-bottom:10px}.signup-footer .pull-left,.signup-footer .pull-right{float:none!important;text-align:center}.signinpanel .signin-info ul{display:none}}@media screen and (max-width:320px){.signinpanel,.signuppanel{margin:0 20px;width:auto}}.checkbox-custom{position:relative;padding:0 15px 0 25px;margin-bottom:7px;margin-top:0;display:inline-block}.checkbox-custom input[type="checkbox"]{opacity:0;position:absolute;cursor:pointer;z-index:2;margin:-6px 0 0 0;top:50%;left:3px}.checkbox-custom label:before{content:'';position:absolute;top:50%;left:0;margin-top:-9px;width:18px;height:17px;display:inline-block;border-radius:2px;border:1px solid #bbb;background:#fff}.checkbox-custom input[type="checkbox"]:checked+label:after{position:absolute;display:inline-block;font-family:'Glyphicons Halflings';content:"\e013";top:42%;left:3px;margin-top:-5px;font-size:11px;line-height:1;width:16px;height:16px;color:#333}.checkbox-custom label{cursor:pointer;line-height:1.2;font-weight:normal;margin-bottom:0;text-align:left} \ No newline at end of file +html{height:100%}body.signin{height:auto;background:url(../img/login-background.jpg) no-repeat center fixed;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;color:rgba(255,255,255,.95)}.signinpanel{width:750px;margin:10% auto 0}.signinpanel .logopanel{float:none;width:auto;padding:0;background:0}.signinpanel .signin-info ul{list-style:none;padding:0;margin:20px 0}.signinpanel .form-control{display:block;margin-top:15px}.signinpanel .uname{background:#fff url(../img/user.png) no-repeat 95% center;color:#333}.signinpanel .pword{background:#fff url(../img/locked.png) no-repeat 95% center;color:#333}.signinpanel .code{background:#fff no-repeat 95% center;color:#333;margin:0 0 15px 0}.signinpanel .btn{margin-top:15px}.signinpanel form{background:rgba(255,255,255,.2);border:1px solid rgba(255,255,255,.3);-moz-box-shadow:0 3px 0 rgba(12,12,12,.03);-webkit-box-shadow:0 3px 0 rgba(12,12,12,.03);box-shadow:0 3px 0 rgba(12,12,12,.03);-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;padding:30px}.signup-footer{border-top:solid 1px rgba(255,255,255,.3);margin:20px 0;padding-top:15px}@media screen and (max-width:768px){.signinpanel,.signuppanel{margin:0 auto;width:420px!important;padding:20px}.signinpanel form{margin-top:20px}.signup-footer,.signuppanel .form-control{margin-bottom:10px}.signup-footer .pull-left,.signup-footer .pull-right{float:none!important;text-align:center}.signinpanel .signin-info ul{display:none}}@media screen and (max-width:320px){.signinpanel,.signuppanel{margin:0 20px;width:auto}}.checkbox-custom{position:relative;padding:0 15px 0 25px;margin-bottom:7px;display:inline-block}.checkbox-custom input[type="checkbox"]{opacity:0;position:absolute;cursor:pointer;z-index:2;margin:-6px 0 0 0;top:50%;left:3px}.checkbox-custom label:before{content:'';position:absolute;top:50%;left:0;margin-top:-9px;width:18px;height:17px;display:inline-block;border-radius:2px;border:1px solid #bbb;background:#fff}.checkbox-custom input[type="checkbox"]:checked+label:after{position:absolute;display:inline-block;font-family:'Glyphicons Halflings';content:"\e013";top:42%;left:3px;margin-top:-5px;font-size:11px;line-height:1;width:16px;height:16px;color:#333}.checkbox-custom label{cursor:pointer;line-height:1.2;font-weight:normal;margin-bottom:0;text-align:left} \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index 91ab7d9a3..27ee765a5 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -59,7 +59,7 @@
-
+
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java index 33228e431..7a1718434 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java @@ -1,10 +1,16 @@ package com.ruoyi.framework.config; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.LinkedHashMap; import java.util.Map; import javax.servlet.Filter; +import org.apache.commons.io.IOUtils; import org.apache.shiro.cache.ehcache.EhCacheManager; import org.apache.shiro.codec.Base64; +import org.apache.shiro.config.ConfigurationException; +import org.apache.shiro.io.ResourceUtils; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; @@ -87,7 +93,7 @@ public class ShiroConfig EhCacheManager em = new EhCacheManager(); if (StringUtils.isNull(cacheManager)) { - em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml"); + em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream())); return em; } else @@ -97,6 +103,31 @@ public class ShiroConfig } } + /** + * 返回配置文件流 避免ehcache配置文件一直被占用,无法完全销毁项目重新部署 + */ + protected InputStream getCacheManagerConfigFileInputStream() + { + String configFile = "classpath:ehcache/ehcache-shiro.xml"; + InputStream inputStream = null; + try + { + inputStream = ResourceUtils.getInputStreamForPath(configFile); + byte[] b = IOUtils.toByteArray(inputStream); + InputStream in = new ByteArrayInputStream(b); + return in; + } + catch (IOException e) + { + throw new ConfigurationException( + "Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e); + } + finally + { + IOUtils.closeQuietly(inputStream); + } + } + /** * 自定义Realm */ From 97260b02cbad56fd545379265a761aca52c1f517 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 29 Jan 2019 11:23:16 +0800 Subject: [PATCH 13/89] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E4=B8=BA=E5=9B=BE=E7=89=87=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=B7=A8?= =?UTF-8?q?=E5=9F=9F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ajax/libs/cropbox/cropbox.js | 1 + .../main/resources/templates/system/user/profile/avatar.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/cropbox/cropbox.js b/ruoyi-admin/src/main/resources/static/ajax/libs/cropbox/cropbox.js index b25091e96..4e3891e96 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/cropbox/cropbox.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/cropbox/cropbox.js @@ -123,6 +123,7 @@ $(window).bind('mouseup', imgMouseUp); el.bind('mousewheel DOMMouseScroll', zoomImage); }; + obj.image.crossOrigin = 'Anonymous'; obj.image.src = options.imgSrc; el.on('remove', function(){$(window).unbind('mouseup', imgMouseUp)}); diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html index 77beb91a3..3d4018b0f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/profile/avatar.html @@ -38,7 +38,7 @@ $(window).load(function() { options.imgSrc = e.target.result; //根据MIME判断上传的文件是不是图片类型 if((options.imgSrc).indexOf("image/")==-1){ - $.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,JEPG,PNG后缀的文件。"); + $.modal.alertWarning("文件格式错误,请上传图片类型,如:JPG,JPEG,PNG后缀的文件。"); } else { cropper = $('.imageBox').cropbox(options); } From 2de9f0744917cf5bb85e0f9772974c4d8bff321b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 29 Jan 2019 17:15:01 +0800 Subject: [PATCH 14/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcombo=E5=B1=9E=E6=80=A7?= =?UTF-8?q?Excel=E5=85=BC=E5=AE=B9=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/poi/ExcelUtil.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 062fda9a5..555114011 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -22,6 +22,9 @@ import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.DataValidation; +import org.apache.poi.ss.usermodel.DataValidationConstraint; +import org.apache.poi.ss.usermodel.DataValidationHelper; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.usermodel.FillPatternType; import org.apache.poi.ss.usermodel.Font; @@ -33,6 +36,7 @@ import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFDataValidation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.annotation.Excel; @@ -499,13 +503,25 @@ public class ExcelUtil public static Sheet setHSSFValidation(Sheet sheet, String[] textlist, int firstRow, int endRow, int firstCol, int endCol) { + DataValidationHelper helper = sheet.getDataValidationHelper(); // 加载下拉列表内容 - DVConstraint constraint = DVConstraint.createExplicitListConstraint(textlist); + DataValidationConstraint constraint = helper.createExplicitListConstraint(textlist); // 设置数据有效性加载在哪个单元格上,四个参数分别是:起始行、终止行、起始列、终止列 CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); // 数据有效性对象 - HSSFDataValidation dataValidationList = new HSSFDataValidation(regions, constraint); - sheet.addValidationData(dataValidationList); + DataValidation dataValidation = helper.createValidation(constraint, regions); + // 处理Excel兼容性问题 + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + + sheet.addValidationData(dataValidation); return sheet; } From 3c92ab7463360d401b7721a71c2107fba2e06f3e Mon Sep 17 00:00:00 2001 From: lsm121 <270535199@qq.com> Date: Wed, 30 Jan 2019 13:08:00 +0800 Subject: [PATCH 15/89] =?UTF-8?q?=E8=B8=A2=E5=87=BA=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=B6=E6=9B=B4=E6=96=B0ehcash=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/monitor/SysUserOnlineController.java | 2 ++ .../com/ruoyi/framework/shiro/session/OnlineSessionDAO.java | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index aee26b913..c0fe90da7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -78,6 +78,7 @@ public class SysUserOnlineController extends BaseController return error("当前登陆用户无法强退"); } onlineSession.setStatus(OnlineStatus.off_line); + onlineSessionDAO.update(onlineSession); online.setStatus(OnlineStatus.off_line); userOnlineService.saveOnline(online); } @@ -105,6 +106,7 @@ public class SysUserOnlineController extends BaseController return error("用户已下线"); } onlineSession.setStatus(OnlineStatus.off_line); + onlineSessionDAO.update(onlineSession); online.setStatus(OnlineStatus.off_line); userOnlineService.saveOnline(online); return success(); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java index 20ae8c239..da4842919 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionDAO.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.shiro.session; import java.io.Serializable; import java.util.Date; import org.apache.shiro.session.Session; +import org.apache.shiro.session.UnknownSessionException; import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -54,6 +55,11 @@ public class OnlineSessionDAO extends EnterpriseCacheSessionDAO return sysShiroService.getSession(sessionId); } + @Override + public void update(Session session) throws UnknownSessionException { + super.update(session); + } + /** * 更新会话;如更新会话最后访问时间/停止会话/设置超时时间/设置移除属性等会调用 */ From 4829163bab003627f3443c1ebc92c12474fbdf8e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 31 Jan 2019 09:33:02 +0800 Subject: [PATCH 16/89] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=88=B6=E7=B1=BB=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/poi/ExcelUtil.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 555114011..340b253ab 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -7,8 +7,10 @@ import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -221,6 +223,10 @@ public class ExcelUtil { val = Convert.toFloat(val); } + else if (BigDecimal.class == fieldType) + { + val = Convert.toBigDecimal(val); + } else if (Date.class == fieldType) { if (val instanceof String) @@ -665,14 +671,29 @@ public class ExcelUtil private void createExcelField() { this.fields = new ArrayList(); - Field[] allFields = clazz.getDeclaredFields(); - // 得到所有field并存放到一个list中. - for (Field field : allFields) + List tempFields = new ArrayList<>(); + Class tempClass = clazz; + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); + while (tempClass != null) + { + tempClass = tempClass.getSuperclass(); + if (tempClass != null) + tempFields.addAll(Arrays.asList(tempClass.getDeclaredFields())); + } + putToFields(tempFields); + } + + /** + * 放到字段集合中 + */ + private void putToFields(List fields) + { + for (Field field : fields) { Excel attr = field.getAnnotation(Excel.class); if (attr != null && (attr.type() == Type.ALL || attr.type() == type)) { - fields.add(field); + this.fields.add(field); } } } From 742846b4212e01aa95a792391bac945f08364bd5 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 31 Jan 2019 11:45:55 +0800 Subject: [PATCH 17/89] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8C=89=E6=97=A5=E6=9C=9F=E5=AD=98=E5=82=A8=E5=8F=8A=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +++- .../controller/common/CommonController.java | 2 +- .../controller/system/SysLoginController.java | 2 +- .../system/SysProfileController.java | 2 +- .../main/resources/i18n/messages.properties | 11 ++---- .../mobile/bootstrap-table-mobile.js | 2 +- .../common}/exception/base/BaseException.java | 4 +- .../common/exception/file/FileException.java | 19 +++++++++ .../FileNameLengthLimitExceededException.java | 31 ++------------- .../file/FileSizeLimitExceededException.java | 16 ++++++++ .../exception/user/CaptchaException.java | 2 +- .../exception/user/RoleBlockedException.java | 2 +- .../exception/user/UserBlockedException.java | 2 +- .../exception/user/UserDeleteException.java | 2 +- .../common}/exception/user/UserException.java | 4 +- .../user/UserNotExistsException.java | 2 +- .../user/UserPasswordNotMatchException.java | 2 +- .../UserPasswordRetryLimitCountException.java | 2 +- ...UserPasswordRetryLimitExceedException.java | 2 +- .../com/ruoyi/common}/page/TableSupport.java | 5 +-- .../com/ruoyi/common/utils}/MessageUtils.java | 2 +- .../com/ruoyi/common/utils}/ServletUtils.java | 3 +- .../common/utils/file}/FileUploadUtils.java | 39 +++++++++++-------- .../ruoyi/framework/aspectj/LogAspect.java | 2 +- .../ruoyi/framework/config/ServerConfig.java | 3 +- .../manager/factory/AsyncFactory.java | 2 +- .../framework/shiro/realm/UserRealm.java | 13 ++++--- .../shiro/service/SysLoginService.java | 14 +++---- .../shiro/service/SysPasswordService.java | 6 +-- .../shiro/session/OnlineSessionFactory.java | 3 +- .../shiro/web/filter/LogoutFilter.java | 2 +- .../ruoyi/framework/util/PermissionUtils.java | 1 + .../framework/web/base/BaseController.java | 2 +- .../com/ruoyi/generator/util/GenUtils.java | 2 + 34 files changed, 121 insertions(+), 95 deletions(-) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/base/BaseException.java (90%) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/CaptchaException.java (79%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/RoleBlockedException.java (79%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserBlockedException.java (79%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserDeleteException.java (80%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserException.java (67%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserNotExistsException.java (80%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserPasswordNotMatchException.java (82%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserPasswordRetryLimitCountException.java (84%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/exception/user/UserPasswordRetryLimitExceedException.java (85%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/web => ruoyi-common/src/main/java/com/ruoyi/common}/page/TableSupport.java (82%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/util => ruoyi-common/src/main/java/com/ruoyi/common/utils}/MessageUtils.java (90%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/util => ruoyi-common/src/main/java/com/ruoyi/common/utils}/ServletUtils.java (93%) rename {ruoyi-framework/src/main/java/com/ruoyi/framework/util => ruoyi-common/src/main/java/com/ruoyi/common/utils/file}/FileUploadUtils.java (76%) diff --git a/pom.xml b/pom.xml index 912092021..4d93d707c 100644 --- a/pom.xml +++ b/pom.xml @@ -53,11 +53,17 @@ - + org.springframework spring-context-support + + + + org.springframework + spring-web + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index d57abddf9..fccdbc09e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.config.Global; +import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.framework.config.ServerConfig; -import com.ruoyi.framework.util.FileUploadUtils; /** * 通用请求处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 97d9d2794..16863e9d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.util.ServletUtils; import com.ruoyi.framework.web.base.BaseController; /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 92eacc3bb..d441165ec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -16,8 +16,8 @@ import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.config.Global; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.framework.shiro.service.SysPasswordService; -import com.ruoyi.framework.util.FileUploadUtils; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysDictDataService; diff --git a/ruoyi-admin/src/main/resources/i18n/messages.properties b/ruoyi-admin/src/main/resources/i18n/messages.properties index b62fc1c89..ef2a3e4b4 100644 --- a/ruoyi-admin/src/main/resources/i18n/messages.properties +++ b/ruoyi-admin/src/main/resources/i18n/messages.properties @@ -22,13 +22,10 @@ user.notfound=请重新登录 user.forcelogout=管理员强制退出,请重新登录 user.unknown.error=未知错误,请重新登录 -#批量插入用户错误信息 -user.import.excel.null=Excel数据为空,请按照导入模板填写数据 -user.import.excel.data.null=Excel数据为空,只有标题行,请按照导入模板填写数据 -user.import.excel.filetype.error=文件不是Excel文件 -user.import.excel.file.error=文件名为空,文件为空 -user.import.excel.fileinput.error=获取Excel2003流错误 -user.import.excel.fileinputx.error=获取Excel2007流错误 +##文件上传消息 +upload.exceed.maxSize=上传的文件大小超出限制的文件大小!
允许的文件最大大小是:{0}MB! +upload.filename.exceed.length=上传的文件名最长{0}个字符 + ##权限 no.permission=您没有数据的权限,请联系管理员添加权限 [{0}] no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}] diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js index 2376f9444..ee98b198b 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js @@ -15,7 +15,7 @@ // 判断是否 iphone var isIPhone = function () { - let browserName = navigator.userAgent.toLowerCase(); + var browserName = navigator.userAgent.toLowerCase(); return /(iPhone|iPad|iPod|iOS)/i.test(browserName); }; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java similarity index 90% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java index a1e33f6f0..3dd2c1ee7 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/base/BaseException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/base/BaseException.java @@ -1,7 +1,7 @@ -package com.ruoyi.framework.web.exception.base; +package com.ruoyi.common.exception.base; +import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.util.MessageUtils; /** * 基础异常 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java new file mode 100644 index 000000000..871f09b52 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileException.java @@ -0,0 +1,19 @@ +package com.ruoyi.common.exception.file; + +import com.ruoyi.common.exception.base.BaseException; + +/** + * 文件信息异常类 + * + * @author ruoyi + */ +public class FileException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public FileException(String code, Object[] args) + { + super("file", code, args, null); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java index b59fcbe4e..44941b8bc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileNameLengthLimitExceededException.java @@ -1,39 +1,16 @@ package com.ruoyi.common.exception.file; -import org.apache.commons.fileupload.FileUploadException; - /** - * 文件名超长 误异常类 + * 文件名称超长限制异常类 * * @author ruoyi */ -public class FileNameLengthLimitExceededException extends FileUploadException +public class FileNameLengthLimitExceededException extends FileException { private static final long serialVersionUID = 1L; - private int length; - private int maxLength; - private String filename; - public FileNameLengthLimitExceededException(String filename, int length, int maxLength) + public FileNameLengthLimitExceededException(int defaultFileNameLength) { - super("file name : [" + filename + "], length : [" + length + "], max length : [" + maxLength + "]"); - this.length = length; - this.maxLength = maxLength; - this.filename = filename; - } - - public String getFilename() - { - return filename; - } - - public int getLength() - { - return length; - } - - public int getMaxLength() - { - return maxLength; + super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java new file mode 100644 index 000000000..ec6ab054d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/file/FileSizeLimitExceededException.java @@ -0,0 +1,16 @@ +package com.ruoyi.common.exception.file; + +/** + * 文件名大小限制异常类 + * + * @author ruoyi + */ +public class FileSizeLimitExceededException extends FileException +{ + private static final long serialVersionUID = 1L; + + public FileSizeLimitExceededException(long defaultMaxSize) + { + super("upload.exceed.maxSize", new Object[] { defaultMaxSize }); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/CaptchaException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java similarity index 79% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/CaptchaException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java index dcd4e5234..e3334ae37 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/CaptchaException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/CaptchaException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 验证码错误异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/RoleBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java similarity index 79% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/RoleBlockedException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java index ea6d2517a..e11624426 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/RoleBlockedException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/RoleBlockedException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 角色锁定异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserBlockedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java similarity index 79% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserBlockedException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java index 10e2d85bf..8feb8493e 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserBlockedException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserBlockedException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户锁定异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserDeleteException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java similarity index 80% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserDeleteException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java index c1839375b..cf0724228 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserDeleteException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserDeleteException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户账号已被删除 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java similarity index 67% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java index a1f4fada9..79160d861 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserException.java @@ -1,6 +1,6 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; -import com.ruoyi.framework.web.exception.base.BaseException; +import com.ruoyi.common.exception.base.BaseException; /** * 用户信息异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserNotExistsException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java similarity index 80% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserNotExistsException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java index 8e9e75110..ed4bea3ac 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserNotExistsException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserNotExistsException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户不存在异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordNotMatchException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java similarity index 82% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordNotMatchException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java index 11f1df73a..71449e293 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordNotMatchException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordNotMatchException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户密码不正确或不符合规范异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitCountException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java similarity index 84% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitCountException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java index 65c95cf1a..4222135f5 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitCountException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitCountException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户错误记数异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitExceedException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java similarity index 85% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitExceedException.java rename to ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java index ad0ecf326..b48c40657 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/user/UserPasswordRetryLimitExceedException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/user/UserPasswordRetryLimitExceedException.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.web.exception.user; +package com.ruoyi.common.exception.user; /** * 用户错误最大次数异常类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java similarity index 82% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java rename to ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java index 658c32404..6b9342908 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/page/TableSupport.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java @@ -1,8 +1,7 @@ -package com.ruoyi.framework.web.page; +package com.ruoyi.common.page; import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.page.PageDomain; -import com.ruoyi.framework.util.ServletUtils; +import com.ruoyi.common.utils.ServletUtils; /** * 表格数据处理 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java similarity index 90% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java index f656392cb..879421ba0 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/MessageUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.util; +package com.ruoyi.common.utils; import org.springframework.context.MessageSource; import com.ruoyi.common.utils.spring.SpringUtils; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java similarity index 93% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java index 4f56a6fd9..f4b96af4b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ServletUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.util; +package com.ruoyi.common.utils; import java.io.IOException; import javax.servlet.http.HttpServletRequest; @@ -8,7 +8,6 @@ import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import com.ruoyi.common.support.Convert; -import com.ruoyi.common.utils.StringUtils; /** * 客户端工具类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java similarity index 76% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index b8e9ccf20..a1e2e2a81 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/FileUploadUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -1,11 +1,12 @@ -package com.ruoyi.framework.util; +package com.ruoyi.common.utils.file; import java.io.File; import java.io.IOException; -import org.apache.tomcat.util.http.fileupload.FileUploadBase.FileSizeLimitExceededException; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.config.Global; import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; +import com.ruoyi.common.exception.file.FileSizeLimitExceededException; +import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.Md5Utils; /** @@ -18,18 +19,18 @@ public class FileUploadUtils /** * 默认大小 50M */ - public static final long DEFAULT_MAX_SIZE = 52428800; + public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024; + + /** + * 默认的文件名最大长度 100 + */ + public static final int DEFAULT_FILE_NAME_LENGTH = 100; /** * 默认上传的地址 */ private static String defaultBaseDir = Global.getProfile(); - /** - * 默认的文件名最大长度 - */ - public static final int DEFAULT_FILE_NAME_LENGTH = 200; - /** * 默认文件类型jpg */ @@ -62,7 +63,7 @@ public class FileUploadUtils } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage(), e); } } @@ -82,7 +83,7 @@ public class FileUploadUtils } catch (Exception e) { - throw new IOException(e); + throw new IOException(e.getMessage(), e); } } @@ -104,19 +105,25 @@ public class FileUploadUtils int fileNamelength = file.getOriginalFilename().length(); if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) { - throw new FileNameLengthLimitExceededException(file.getOriginalFilename(), fileNamelength, - FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); } assertAllowed(file); - String fileName = encodingFilename(file.getOriginalFilename(), extension); + String fileName = extractFilename(file, extension); File desc = getAbsoluteFile(baseDir, baseDir + fileName); file.transferTo(desc); return fileName; } + public static final String extractFilename(MultipartFile file, String extension) + { + String filename = file.getOriginalFilename(); + filename = DateUtils.datePath() + "/" + encodingFilename(filename) + extension; + return filename; + } + private static final File getAbsoluteFile(String uploadDir, String filename) throws IOException { File desc = new File(File.separator + filename); @@ -135,10 +142,10 @@ public class FileUploadUtils /** * 编码文件名 */ - private static final String encodingFilename(String filename, String extension) + private static final String encodingFilename(String filename) { filename = filename.replace("_", " "); - filename = Md5Utils.hash(filename + System.nanoTime() + counter++) + extension; + filename = Md5Utils.hash(filename + System.nanoTime() + counter++); return filename; } @@ -154,7 +161,7 @@ public class FileUploadUtils long size = file.getSize(); if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) { - throw new FileSizeLimitExceededException("not allowed upload upload", size, DEFAULT_MAX_SIZE); + throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); } } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index e8d297c33..19619ab1d 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -15,10 +15,10 @@ import org.springframework.stereotype.Component; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessStatus; import com.ruoyi.common.json.JSON; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.util.ServletUtils; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.domain.SysUser; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java index cc4045b10..a7fb0998f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java @@ -2,7 +2,8 @@ package com.ruoyi.framework.config; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Component; -import com.ruoyi.framework.util.ServletUtils; + +import com.ruoyi.common.utils.ServletUtils; /** * 服务相关配置 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java index a85d775e9..94019095d 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java @@ -5,10 +5,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.AddressUtils; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.framework.shiro.session.OnlineSession; import com.ruoyi.framework.util.LogUtils; -import com.ruoyi.framework.util.ServletUtils; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.domain.SysOperLog; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java index e0298f388..258efba3f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/realm/UserRealm.java @@ -19,14 +19,15 @@ import org.apache.shiro.subject.PrincipalCollection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; + +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.RoleBlockedException; +import com.ruoyi.common.exception.user.UserBlockedException; +import com.ruoyi.common.exception.user.UserNotExistsException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.framework.shiro.service.SysLoginService; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.exception.user.CaptchaException; -import com.ruoyi.framework.web.exception.user.RoleBlockedException; -import com.ruoyi.framework.web.exception.user.UserBlockedException; -import com.ruoyi.framework.web.exception.user.UserNotExistsException; -import com.ruoyi.framework.web.exception.user.UserPasswordNotMatchException; -import com.ruoyi.framework.web.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysMenuService; import com.ruoyi.system.service.ISysRoleService; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java index 050153058..92ebe89d8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysLoginService.java @@ -7,17 +7,17 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.ShiroConstants; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.enums.UserStatus; +import com.ruoyi.common.exception.user.CaptchaException; +import com.ruoyi.common.exception.user.UserBlockedException; +import com.ruoyi.common.exception.user.UserDeleteException; +import com.ruoyi.common.exception.user.UserNotExistsException; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.MessageUtils; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.util.MessageUtils; -import com.ruoyi.framework.util.ServletUtils; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.exception.user.CaptchaException; -import com.ruoyi.framework.web.exception.user.UserBlockedException; -import com.ruoyi.framework.web.exception.user.UserDeleteException; -import com.ruoyi.framework.web.exception.user.UserNotExistsException; -import com.ruoyi.framework.web.exception.user.UserPasswordNotMatchException; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysUserService; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java index f3bd37f86..d8a763262 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/service/SysPasswordService.java @@ -9,11 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.exception.user.UserPasswordNotMatchException; +import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; +import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.util.MessageUtils; -import com.ruoyi.framework.web.exception.user.UserPasswordNotMatchException; -import com.ruoyi.framework.web.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.system.domain.SysUser; /** diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java index aed924706..e6f6896d9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/session/OnlineSessionFactory.java @@ -7,7 +7,8 @@ import org.apache.shiro.session.mgt.SessionFactory; import org.apache.shiro.web.session.mgt.WebSessionContext; import org.springframework.stereotype.Component; import com.ruoyi.common.utils.IpUtils; -import com.ruoyi.framework.util.ServletUtils; +import com.ruoyi.common.utils.ServletUtils; + import eu.bitwalker.useragentutils.UserAgent; /** diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java index bf70f17cd..5970838fc 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/shiro/web/filter/LogoutFilter.java @@ -7,10 +7,10 @@ import org.apache.shiro.subject.Subject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.utils.MessageUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.factory.AsyncFactory; -import com.ruoyi.framework.util.MessageUtils; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysUser; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java index f0e642636..835e8fc62 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/PermissionUtils.java @@ -2,6 +2,7 @@ package com.ruoyi.framework.util; import org.apache.commons.lang3.StringUtils; import com.ruoyi.common.constant.PermissionConstants; +import com.ruoyi.common.utils.MessageUtils; /** * permission 工具类 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java index 2d971e50c..4a83cdec3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java @@ -10,10 +10,10 @@ import com.github.pagehelper.PageInfo; import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.page.PageDomain; import com.ruoyi.common.page.TableDataInfo; +import com.ruoyi.common.page.TableSupport; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.page.TableSupport; import com.ruoyi.system.domain.SysUser; /** diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index bccc4650e..ce2442589 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -219,6 +219,7 @@ public class GenUtils javaTypeMap.put("smallint", "Integer"); javaTypeMap.put("mediumint", "Integer"); javaTypeMap.put("int", "Integer"); + javaTypeMap.put("number", "Integer"); javaTypeMap.put("integer", "integer"); javaTypeMap.put("bigint", "Long"); javaTypeMap.put("float", "Float"); @@ -227,6 +228,7 @@ public class GenUtils javaTypeMap.put("bit", "Boolean"); javaTypeMap.put("char", "String"); javaTypeMap.put("varchar", "String"); + javaTypeMap.put("varchar2", "String"); javaTypeMap.put("tinytext", "String"); javaTypeMap.put("text", "String"); javaTypeMap.put("mediumtext", "String"); From cc67d57ceff0306b24fad2c2bbdc01102cedd76e Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Feb 2019 14:12:03 +0800 Subject: [PATCH 18/89] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=88=86=E9=A1=B5=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/run.bat | 15 +++++++++++++++ .../src/main/resources/static/ruoyi/js/ry-ui.js | 9 +++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 bin/run.bat diff --git a/bin/run.bat b/bin/run.bat new file mode 100644 index 000000000..a49052e9f --- /dev/null +++ b/bin/run.bat @@ -0,0 +1,15 @@ +@echo off +echo. +echo [Ϣ] Web̡ +echo. + +%~d0 +cd %~dp0 +cd ../ruoyi-admin/target + +set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m + +java -jar %JAVA_OPTS% ruoyi-admin.jar + +cd bin +pause \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 3303b61d8..1d3493c19 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -14,6 +14,7 @@ init: function(options) { $.table._option = options; $.table._params = $.common.isEmpty(options.queryParams) ? $.table.queryParams : options.queryParams; + _sidePagination = $.common.isEmpty(options.sidePagination) ? "server" : options.pagination; _sortOrder = $.common.isEmpty(options.sortOrder) ? "asc" : options.sortOrder; _sortName = $.common.isEmpty(options.sortName) ? "" : options.sortName; _pageSize = $.common.isEmpty(options.pageSize) ? 10 : options.pageSize; @@ -42,7 +43,7 @@ showFooter: _showFooter, // 是否显示表尾 iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 toolbar: '#toolbar', // 指定工作栏 - sidePagination: "server", // 启用服务端分页 + sidePagination: _sidePagination, // server启用服务端分页client客户端分页 search: $.common.visible(options.search), // 是否显示搜索框功能 showSearch: $.common.visible(options.showSearch), // 是否显示检索信息 showRefresh: $.common.visible(options.showRefresh), // 是否显示刷新按钮 @@ -73,7 +74,11 @@ // 请求获取数据后处理回调函数 responseHandler: function(res) { if (res.code == 0) { - return { rows: res.rows, total: res.total }; + if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination === 'client') { + return res.rows; + } else { + return { rows: res.rows, total: res.total }; + } } else { $.modal.alertWarning(res.msg); return { rows: [], total: 0 }; From c03613f317b03f844c047338f00a3b404051947a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Feb 2019 15:27:41 +0800 Subject: [PATCH 19/89] =?UTF-8?q?=E5=BC=B9=E5=87=BA=E5=B1=82=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E8=B0=83=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/run.bat | 1 - .../main/resources/static/ruoyi/js/ry-ui.js | 24 +++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/bin/run.bat b/bin/run.bat index a49052e9f..90073a828 100644 --- a/bin/run.bat +++ b/bin/run.bat @@ -3,7 +3,6 @@ echo. echo [Ϣ] Web̡ echo. -%~d0 cd %~dp0 cd ../ruoyi-admin/target diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 1d3493c19..9162edd1a 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -99,10 +99,10 @@ tooltip: function (value, length) { var _length = $.common.isEmpty(length) ? 20 : length; var _text = ""; - if (value.length > _length) { + if ($.common.isNotEmpty(value) && value.length > _length) { _text = value.substr(0, _length) + "..."; } else { - _text = value; + _text = $.common.nullToStr(value); } return '' + _text +''; }, @@ -396,7 +396,7 @@ }); }, // 弹出层指定宽度 - open: function (title, url, width, height) { + open: function (title, url, width, height, callback) { //如果是移动端,就使用自适应大小弹窗 if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { width = 'auto'; @@ -414,6 +414,12 @@ if ($.common.isEmpty(height)) { height = ($(window).height() - 50); }; + if ($.common.isEmpty(callback)) { + callback = function(index, layero) { + var iframeWin = layero.find('iframe')[0]; + iframeWin.contentWindow.submitHandler(); + } + } layer.open({ type: 2, area: [width + 'px', height + 'px'], @@ -426,10 +432,7 @@ btn: ['确定', '关闭'], // 弹层外区域关闭 shadeClose: true, - yes: function(index, layero) { - var iframeWin = layero.find('iframe')[0]; - iframeWin.contentWindow.submitHandler(); - }, + yes: callback, cancel: function(index) { return true; } @@ -912,6 +915,13 @@ isNotEmpty: function (value) { return !$.common.isEmpty(value); }, + // 空对象转字符串 + nullToStr: function(value) { + if ($.common.isEmpty(value)) { + return '-' + } + return value; + }, // 是否显示数据 为空默认为显示 visible: function (value) { if ($.common.isEmpty(value) || value == true) { From fe4677bcf51d2714e1aa1eee0a3b2c59eca45d41 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Feb 2019 16:07:25 +0800 Subject: [PATCH 20/89] =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E5=8A=A8=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/js/ry-ui.js | 11 ++++++----- ruoyi-admin/src/main/resources/templates/login.html | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 9162edd1a..5150143cc 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -99,12 +99,13 @@ tooltip: function (value, length) { var _length = $.common.isEmpty(length) ? 20 : length; var _text = ""; - if ($.common.isNotEmpty(value) && value.length > _length) { - _text = value.substr(0, _length) + "..."; + var _value = $.common.nullToStr(value); + if (_value.length > _length) { + _text = _value.substr(0, _length) + "..."; } else { - _text = $.common.nullToStr(value); + _text = _value; } - return '' + _text +''; + return '' + _text +''; }, // 搜索-默认第一个form search: function(formId) { @@ -918,7 +919,7 @@ // 空对象转字符串 nullToStr: function(value) { if ($.common.isEmpty(value)) { - return '-' + return "-"; } return value; }, diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index 27ee765a5..2bddf4512 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -51,7 +51,7 @@
- +
From f3ea70c32c2ec4ea43d6a5fe7a5720d545fe2e88 Mon Sep 17 00:00:00 2001 From: okayliao Date: Fri, 15 Feb 2019 16:50:27 +0800 Subject: [PATCH 21/89] =?UTF-8?q?fix:=E7=99=BB=E5=BD=95=E5=9C=B0=E7=82=B9?= =?UTF-8?q?=20=E5=AD=97=E6=AE=B5=E5=90=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/templates/monitor/online/online.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html b/ruoyi-admin/src/main/resources/templates/monitor/online/online.html index c5117d719..4f13b900e 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/online/online.html @@ -77,7 +77,7 @@ title: '主机' }, { - field: 'longinLocation', + field: 'loginLocation', title: '登录地点' }, { From f1f7d7e4fca2a14f34ad81a142967bebee7ce50d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Feb 2019 17:46:24 +0800 Subject: [PATCH 22/89] =?UTF-8?q?=E4=BD=BF=E7=94=A8jsonview=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ajax/libs/jsonview/jquery.jsonview.css | 50 ++++ .../ajax/libs/jsonview/jquery.jsonview.js | 250 ++++++++++++++++++ .../main/resources/static/ruoyi/js/ry-ui.js | 3 +- .../templates/monitor/operlog/detail.html | 12 +- .../ruoyi/framework/aspectj/LogAspect.java | 2 +- sql/{ry_20190118.sql => ry_20190215.sql} | 0 6 files changed, 310 insertions(+), 7 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css create mode 100644 ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js rename sql/{ry_20190118.sql => ry_20190215.sql} (100%) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css b/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css new file mode 100644 index 000000000..e3cb8c5de --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.css @@ -0,0 +1,50 @@ +@charset "UTF-8"; +.jsonview { + font-family: monospace; + font-size: 1.1em; + white-space: pre-wrap; } + .jsonview .prop { + font-weight: bold; } + .jsonview .null { + color: red; } + .jsonview .bool { + color: blue; } + .jsonview .num { + color: blue; } + .jsonview .string { + color: green; + white-space: pre-wrap; } + .jsonview .string.multiline { + display: inline-block; + vertical-align: text-top; } + .jsonview .collapser { + position: absolute; + left: -1em; + cursor: pointer; } + .jsonview .collapsible { + transition: height 1.2s; + transition: width 1.2s; } + .jsonview .collapsible.collapsed { + height: .8em; + width: 1em; + display: inline-block; + overflow: hidden; + margin: 0; } + .jsonview .collapsible.collapsed:before { + content: "…"; + width: 1em; + margin-left: .2em; } + .jsonview .collapser.collapsed { + transform: rotate(0deg); } + .jsonview .q { + display: inline-block; + width: 0px; + color: transparent; } + .jsonview li { + position: relative; } + .jsonview ul { + list-style: none; + margin: 0 0 0 2em; + padding: 0; } + .jsonview h1 { + font-size: 1.2em; } diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js b/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js new file mode 100644 index 000000000..18738b440 --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/jsonview/jquery.jsonview.js @@ -0,0 +1,250 @@ +(function(jQuery) { + var $, Collapser, JSONFormatter, JSONView; + JSONFormatter = (function() { + function JSONFormatter(options) { + if (options == null) { + options = {}; + } + this.options = options; + } + + JSONFormatter.prototype.htmlEncode = function(html) { + if (html !== null) { + return html.toString().replace(/&/g, "&").replace(/"/g, """).replace(//g, ">"); + } else { + return ''; + } + }; + + JSONFormatter.prototype.jsString = function(s) { + s = JSON.stringify(s).slice(1, -1); + return this.htmlEncode(s); + }; + + JSONFormatter.prototype.decorateWithSpan = function(value, className) { + return "" + (this.htmlEncode(value)) + ""; + }; + + JSONFormatter.prototype.valueToHTML = function(value, level) { + var valueType; + if (level == null) { + level = 0; + } + valueType = Object.prototype.toString.call(value).match(/\s(.+)]/)[1].toLowerCase(); + return this["" + valueType + "ToHTML"].call(this, value, level); + }; + + JSONFormatter.prototype.nullToHTML = function(value) { + return this.decorateWithSpan('null', 'null'); + }; + + JSONFormatter.prototype.numberToHTML = function(value) { + return this.decorateWithSpan(value, 'num'); + }; + + JSONFormatter.prototype.stringToHTML = function(value) { + var multilineClass, newLinePattern; + if (/^(http|https|file):\/\/[^\s]+$/i.test(value)) { + return "\"" + (this.jsString(value)) + "\""; + } else { + multilineClass = ''; + value = this.jsString(value); + if (this.options.nl2br) { + newLinePattern = /([^>\\r\\n]?)(\\r\\n|\\n\\r|\\r|\\n)/g; + if (newLinePattern.test(value)) { + multilineClass = ' multiline'; + value = (value + '').replace(newLinePattern, '$1' + '
'); + } + } + return "\"" + value + "\""; + } + }; + + JSONFormatter.prototype.booleanToHTML = function(value) { + return this.decorateWithSpan(value, 'bool'); + }; + + JSONFormatter.prototype.arrayToHTML = function(array, level) { + var collapsible, hasContents, index, numProps, output, value, _i, _len; + if (level == null) { + level = 0; + } + hasContents = false; + output = ''; + numProps = array.length; + for (index = _i = 0, _len = array.length; _i < _len; index = ++_i) { + value = array[index]; + hasContents = true; + output += '
  • ' + this.valueToHTML(value, level + 1); + if (numProps > 1) { + output += ','; + } + output += '
  • '; + numProps--; + } + if (hasContents) { + collapsible = level === 0 ? '' : ' collapsible'; + return "[
      " + output + "
    ]"; + } else { + return '[ ]'; + } + }; + + JSONFormatter.prototype.objectToHTML = function(object, level) { + var collapsible, hasContents, numProps, output, prop, value; + if (level == null) { + level = 0; + } + hasContents = false; + output = ''; + numProps = 0; + for (prop in object) { + numProps++; + } + for (prop in object) { + value = object[prop]; + hasContents = true; + output += "
  • \"" + (this.jsString(prop)) + "\": " + (this.valueToHTML(value, level + 1)); + if (numProps > 1) { + output += ','; + } + output += '
  • '; + numProps--; + } + if (hasContents) { + collapsible = level === 0 ? '' : ' collapsible'; + return "{
      " + output + "
    }"; + } else { + return '{ }'; + } + }; + + JSONFormatter.prototype.jsonToHTML = function(json) { + return "
    " + (this.valueToHTML(json)) + "
    "; + }; + + return JSONFormatter; + + })(); + (typeof module !== "undefined" && module !== null) && (module.exports = JSONFormatter); + Collapser = { + bindEvent: function(item, collapsed) { + var collapser; + collapser = document.createElement('div'); + collapser.className = 'collapser'; + collapser.innerHTML = collapsed ? '+' : '-'; + collapser.addEventListener('click', (function(_this) { + return function(event) { + return _this.toggle(event.target); + }; + })(this)); + item.insertBefore(collapser, item.firstChild); + if (collapsed) { + return this.collapse(collapser); + } + }, + expand: function(collapser) { + var ellipsis, target; + target = this.collapseTarget(collapser); + ellipsis = target.parentNode.getElementsByClassName('ellipsis')[0]; + target.parentNode.removeChild(ellipsis); + target.style.display = ''; + return collapser.innerHTML = '-'; + }, + collapse: function(collapser) { + var ellipsis, target; + target = this.collapseTarget(collapser); + target.style.display = 'none'; + ellipsis = document.createElement('span'); + ellipsis.className = 'ellipsis'; + ellipsis.innerHTML = ' … '; + target.parentNode.insertBefore(ellipsis, target); + return collapser.innerHTML = '+'; + }, + toggle: function(collapser) { + var target; + target = this.collapseTarget(collapser); + if (target.style.display === 'none') { + return this.expand(collapser); + } else { + return this.collapse(collapser); + } + }, + collapseTarget: function(collapser) { + var target, targets; + targets = collapser.parentNode.getElementsByClassName('collapsible'); + if (!targets.length) { + return; + } + return target = targets[0]; + } + }; + $ = jQuery; + JSONView = { + collapse: function(el) { + if (el.innerHTML === '-') { + return Collapser.collapse(el); + } + }, + expand: function(el) { + if (el.innerHTML === '+') { + return Collapser.expand(el); + } + }, + toggle: function(el) { + return Collapser.toggle(el); + } + }; + return $.fn.JSONView = function() { + var args, defaultOptions, formatter, json, method, options, outputDoc; + args = arguments; + if (JSONView[args[0]] != null) { + method = args[0]; + return this.each(function() { + var $this, level; + $this = $(this); + if (args[1] != null) { + level = args[1]; + return $this.find(".jsonview .collapsible.level" + level).siblings('.collapser').each(function() { + return JSONView[method](this); + }); + } else { + return $this.find('.jsonview > ul > li > .collapsible').siblings('.collapser').each(function() { + return JSONView[method](this); + }); + } + }); + } else { + json = args[0]; + options = args[1] || {}; + defaultOptions = { + collapsed: false, + nl2br: false + }; + options = $.extend(defaultOptions, options); + formatter = new JSONFormatter({ + nl2br: options.nl2br + }); + if (Object.prototype.toString.call(json) === '[object String]') { + json = JSON.parse(json); + } + outputDoc = formatter.jsonToHTML(json); + return this.each(function() { + var $this, item, items, _i, _len, _results; + $this = $(this); + $this.html(outputDoc); + items = $this[0].getElementsByClassName('collapsible'); + _results = []; + for (_i = 0, _len = items.length; _i < _len; _i++) { + item = items[_i]; + if (item.parentNode.nodeName === 'LI') { + _results.push(Collapser.bindEvent(item.parentNode, options.collapsed)); + } else { + _results.push(void 0); + } + } + return _results; + }); + } + }; +})(jQuery); diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 5150143cc..daf4c7395 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -564,7 +564,7 @@ _width = 'auto'; _height = 'auto'; } - top.layer.open({ + layer.open({ type: 2, area: [_width + 'px', _height + 'px'], fix: false, @@ -573,7 +573,6 @@ shade: 0.3, title: $.table._option.modalName + "详细", content: _url, - zIndex: 9999999999, btn: ['关闭'], // 弹层外区域关闭 shadeClose: true, diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html index 844909dd9..b6c059a4c 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/operlog/detail.html @@ -3,6 +3,7 @@ xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> +
    @@ -43,12 +44,15 @@
    - + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java index 19619ab1d..252ccbd15 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/LogAspect.java @@ -151,7 +151,7 @@ public class LogAspect { Map map = ServletUtils.getRequest().getParameterMap(); String params = JSON.marshal(map); - operLog.setOperParam(StringUtils.substring(params, 0, 255)); + operLog.setOperParam(StringUtils.substring(params, 0, 2000)); } /** diff --git a/sql/ry_20190118.sql b/sql/ry_20190215.sql similarity index 100% rename from sql/ry_20190118.sql rename to sql/ry_20190215.sql From 2d588ed873bf5ccd952f902f3b05a7a7ba015abe Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Feb 2019 17:49:34 +0800 Subject: [PATCH 23/89] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=9C=B0=E7=82=B9?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/templates/monitor/online/online.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html b/ruoyi-admin/src/main/resources/templates/monitor/online/online.html index c5117d719..4f13b900e 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/online/online.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/online/online.html @@ -77,7 +77,7 @@ title: '主机' }, { - field: 'longinLocation', + field: 'loginLocation', title: '登录地点' }, { From 84b39901af486fdc36448c51ede140608fd9ee7b Mon Sep 17 00:00:00 2001 From: okayliao Date: Mon, 18 Feb 2019 23:48:38 +0800 Subject: [PATCH 24/89] =?UTF-8?q?fix:=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=9D=83=E9=99=90=E7=A0=81=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/monitor/operlog/operlog.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html b/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html index f20e754c0..fa289638f 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html +++ b/ruoyi-admin/src/main/resources/templates/monitor/operlog/operlog.html @@ -39,13 +39,13 @@
    From 6a3ba38b45b5b04cce721fde58dbe922ab52149d Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 24 Feb 2019 14:51:43 +0800 Subject: [PATCH 25/89] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=88addTab=E3=80=81editTab=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- .../main/resources/static/ruoyi/css/ry-ui.css | 19 ++ .../src/main/resources/static/ruoyi/index.js | 12 +- .../main/resources/static/ruoyi/js/common.js | 26 +- .../main/resources/static/ruoyi/js/ry-ui.js | 69 ++++- .../src/main/resources/templates/login.html | 8 +- .../resources/templates/system/user/add.html | 267 ++++++++++-------- .../resources/templates/system/user/edit.html | 250 ++++++++-------- .../resources/templates/system/user/user.html | 6 +- 9 files changed, 403 insertions(+), 258 deletions(-) diff --git a/README.md b/README.md index fed79d7cd..c14e3a375 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ - + @@ -62,7 +62,7 @@ - + diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css b/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css index 7c01cde22..d7677e6a9 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css +++ b/ruoyi-admin/src/main/resources/static/ruoyi/css/ry-ui.css @@ -533,3 +533,22 @@ label { .dropdown-menu > .divider { background-color:#eee; } + +.form-header { + font-size:15px; + color:#6379bb; + border-bottom:1px solid #ddd; + margin:8px 10px 25px 10px; + padding-bottom:5px +} + +.form-content { + background-color: #ffffff; + color: inherit; + padding: 10px 15px 15px 15px; + border-color: #e7eaec; + -webkit-border-image: none; + -o-border-image: none; + border-image: none; + border-width: 1px 0px; +} diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/index.js b/ruoyi-admin/src/main/resources/static/ruoyi/index.js index ede98818b..c9a016756 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/index.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/index.js @@ -249,7 +249,7 @@ $(function() { function closeTab() { var closeTabId = $(this).parents('.menuTab').data('id'); var currentWidth = $(this).parents('.menuTab').width(); - + var panelUrl = $(this).parents('.menuTab').data('panel'); // 当前元素处于活动状态 if ($(this).parents('.menuTab').hasClass('active')) { @@ -307,6 +307,16 @@ $(function() { return false; } }); + + if($.common.isNotEmpty(panelUrl)){ + $('.menuTab[data-id="' + panelUrl + '"]').addClass('active').siblings('.menuTab').removeClass('active'); + $('.mainContent .RuoYi_iframe').each(function() { + if ($(this).data('id') == panelUrl) { + $(this).show().siblings('.RuoYi_iframe').hide(); + return false; + } + }); + } } } // 当前元素不处于活动状态 diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index 596975c41..c1b0fae16 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -123,8 +123,25 @@ var refreshItem = function(){ target.attr('src', url).ready(); } +/** 关闭选项卡 */ +var closeItem = function(){ + var topWindow = $(window.parent.document); + var panelUrl = window.frameElement.getAttribute('data-panel'); + $('.page-tabs-content .active i', topWindow).click(); + if($.common.isNotEmpty(panelUrl)){ + $('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active'); + $('.mainContent .RuoYi_iframe', topWindow).each(function() { + if ($(this).data('id') == panelUrl) { + $(this).show().siblings('.RuoYi_iframe').hide(); + return false; + } + }); + } +} + /** 创建选项卡 */ function createMenuItem(dataUrl, menuName) { + var panelUrl = window.frameElement.getAttribute('data-id'); dataIndex = $.common.random(1,100), flag = true; if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false; @@ -149,12 +166,17 @@ function createMenuItem(dataUrl, menuName) { }); // 选项卡菜单不存在 if (flag) { - var str = '' + menuName + ' '; + var str = '' + menuName + ' '; $('.menuTab', topWindow).removeClass('active'); // 添加选项卡对应的iframe - var str1 = ''; + var str1 = ''; $('.mainContent', topWindow).find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1); + + window.parent.$.modal.loading("数据加载中,请稍后..."); + $('.mainContent iframe:visible', topWindow).load(function () { + window.parent.$.modal.closeLoading(); + }); // 添加选项卡 $('.menuTabs .page-tabs-content', topWindow).append(str); diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index daf4c7395..ee218ad1e 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -74,7 +74,7 @@ // 请求获取数据后处理回调函数 responseHandler: function(res) { if (res.code == 0) { - if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination === 'client') { + if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination == 'client') { return res.rows; } else { return { rows: res.rows, total: res.total }; @@ -503,6 +503,10 @@ }); layer.full(index); }, + // 选卡页方式打开 + openTab: function (title, url) { + createMenuItem(url, title); + }, // 禁用按钮 disable: function() { var doc = window.top == window.parent ? window.document : window.parent.document; @@ -609,13 +613,21 @@ $.operate.submit(url, "post", "json", ""); }); }, + // 添加访问请求 + addUrl: function(id) { + var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); + return url; + }, // 添加信息 add: function(id) { - var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); - $.modal.open("添加" + $.table._option.modalName, url); + $.modal.open("添加" + $.table._option.modalName, $.operate.addUrl(id)); }, - // 修改信息 - edit: function(id) { + // 添加信息,以tab页展现 + addTab: function (id) { + $.modal.openTab("添加" + $.table._option.modalName, $.operate.addUrl(id)); + }, + // 修改访问请求 + editUrl: function(id) { var url = "/404.html"; if ($.common.isNotEmpty(id)) { url = $.table._option.updateUrl.replace("{id}", id); @@ -627,7 +639,15 @@ } url = $.table._option.updateUrl.replace("{id}", id); } - $.modal.open("修改" + $.table._option.modalName, url); + return url; + }, + // 修改信息 + edit: function(id) { + $.modal.open("修改" + $.table._option.modalName, $.operate.editUrl(id)); + }, + // 修改信息,以tab页展现 + editTab: function(id) { + $.modal.openTab("修改" + $.table._option.modalName, $.operate.editUrl(id)); }, // 工具栏表格树修改 editTree: function() { @@ -672,6 +692,22 @@ }; $.ajax(config) }, + // 保存选项卡信息 + saveTab: function(url, data) { + var config = { + url: url, + type: "post", + dataType: "json", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + }, + success: function(result) { + $.operate.successTabCallback(result); + } + }; + $.ajax(config) + }, // 保存结果弹出msg刷新table表格 ajaxSuccess: function (result) { if (result.code == web_status.SUCCESS) { @@ -710,6 +746,25 @@ } $.modal.closeLoading(); $.modal.enable(); + }, + // 选项卡成功回调执行事件(父窗体静默更新) + successTabCallback: function(result) { + if (result.code == web_status.SUCCESS) { + var topWindow = $(window.parent.document); + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); + var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; + $.modal.close(); + $contentWindow.$.modal.msgSuccess(result.msg); + if ($contentWindow.$("#bootstrap-table").length > 0) { + $contentWindow.$.table.refresh(); + } else if ($contentWindow.$("#bootstrap-tree-table").length > 0) { + $contentWindow.$.treeTable.refresh(); + } + closeItem(); + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); } }, // 校验封装处理 @@ -780,7 +835,7 @@ searchNode: function() { // 取得输入的关键字的值 var value = $.common.trim($("#keyword").val()); - if ($.tree._lastValue === value) { + if ($.tree._lastValue == value) { return; } // 保存最后一次搜索名称 diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index 2bddf4512..6355d9506 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -7,10 +7,10 @@ 若依管理系统 - - - - + + + + + + org.springframework.boot spring-boot-dependencies @@ -37,6 +45,154 @@ pom import + + + + com.alibaba + druid-spring-boot-starter + ${druid.version} + + + + + com.github.penggle + kaptcha + ${kaptcha.version} + + + + + org.apache.shiro + shiro-core + ${shiro.version} + + + + + org.apache.shiro + shiro-spring + ${shiro.version} + + + + + org.apache.shiro + shiro-ehcache + ${shiro.version} + + + + + com.github.theborakompanioni + thymeleaf-extras-shiro + ${thymeleaf.extras.shiro.version} + + + + + eu.bitwalker + UserAgentUtils + ${bitwalker.version} + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + ${pagehelper.boot.version} + + + + + com.github.oshi + oshi-core + ${oshi.version} + + + + + io.springfox + springfox-swagger2 + ${swagger.version} + + + + + io.springfox + springfox-swagger-ui + ${swagger.version} + + + + + commons-io + commons-io + ${commons.io.version} + + + + + commons-fileupload + commons-fileupload + ${commons.fileupload.version} + + + + + org.jsoup + jsoup + ${jsoup.version} + + + + + org.apache.poi + poi-ooxml + ${poi.version} + + + + + org.apache.velocity + velocity + ${velocity.version} + + + + + com.ruoyi + ruoyi-quartz + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-generator + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-framework + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-system + ${ruoyi.version} + + + + + com.ruoyi + ruoyi-common + ${ruoyi.version} + + @@ -53,41 +209,7 @@ - - - org.springframework - spring-context-support - - - - - org.springframework - spring-web - - - - - org.mybatis.spring.boot - mybatis-spring-boot-starter - ${mybatis.boot.version} - - - - - mysql - mysql-connector-java - - - - javax.servlet - javax.servlet-api - - - - - org.slf4j - slf4j-api - + diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index de89a79e0..c767c90c9 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -15,8 +15,13 @@ web服务入口 - + + + + org.springframework.boot + spring-boot-starter-thymeleaf + @@ -29,21 +34,30 @@ io.springfox springfox-swagger2 - ${swagger.version} io.springfox springfox-swagger-ui - ${swagger.version} com.ruoyi ruoyi-framework - ${ruoyi.version} + + + + + com.ruoyi + ruoyi-quartz + + + + + com.ruoyi + ruoyi-generator diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 341e68df3..a22a1b237 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -12,12 +12,12 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; -import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.config.Global; +import com.ruoyi.common.config.ServerConfig; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; -import com.ruoyi.framework.config.ServerConfig; /** * 通用请求处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java index 9d1028b35..24078d908 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/DruidController.java @@ -4,7 +4,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; /** * druid 监控 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java index 786926f24..764197d39 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/ServerController.java @@ -5,7 +5,7 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.framework.web.domain.Server; /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index dcf5524ad..514a3f3f0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -9,13 +9,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.service.ISysLogininforService; -import com.ruoyi.framework.web.base.BaseController; /** * 系统访问记录 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index 34b3d46a6..c8793b555 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -11,13 +11,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.service.ISysOperLogService; -import com.ruoyi.framework.web.base.BaseController; /** * 操作日志记录 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index c0fe90da7..47283d779 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -10,7 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.OnlineStatus; import com.ruoyi.common.page.TableDataInfo; @@ -19,7 +20,6 @@ import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysUserOnline; import com.ruoyi.system.service.ISysUserOnlineService; -import com.ruoyi.framework.web.base.BaseController; /** * 在线用户监控 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java index d9381812b..230cc3b29 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysCaptchaController.java @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.google.code.kaptcha.Constants; import com.google.code.kaptcha.Producer; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; /** * 图片验证码(支持算术形式) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index db002154f..6e858a45d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -11,14 +11,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.service.ISysConfigService; -import com.ruoyi.framework.web.base.BaseController; /** * 参数配置 信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 290a4989a..b2594de97 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -11,12 +11,12 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; -import com.ruoyi.common.base.Ztree; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.base.BaseController; import com.ruoyi.system.domain.SysDept; import com.ruoyi.system.domain.SysRole; import com.ruoyi.system.service.ISysDeptService; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index 9b2bb2e10..a90e4bb65 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -11,14 +11,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysDictData; import com.ruoyi.system.service.ISysDictDataService; -import com.ruoyi.framework.web.base.BaseController; /** * 数据字典信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 454f191da..2a40ecde1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -11,14 +11,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysDictType; import com.ruoyi.system.service.ISysDictTypeService; -import com.ruoyi.framework.web.base.BaseController; /** * 数据字典信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java index f0d072245..0d16120f3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java @@ -6,10 +6,11 @@ import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import com.ruoyi.common.config.Global; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysMenuService; -import com.ruoyi.framework.web.base.BaseController; /** * 首页 业务处理 @@ -27,7 +28,7 @@ public class SysIndexController extends BaseController public String index(ModelMap mmap) { // 取身份信息 - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); // 根据用户id取出菜单 List menus = menuService.selectMenusByUser(user); mmap.put("menus", menus); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 16863e9d7..11eb52c4b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -10,10 +10,10 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.ResponseBody; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.web.base.BaseController; /** * 登录验证 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 5056eed58..07bdf3677 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; -import com.ruoyi.common.base.Ztree; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.base.BaseController; import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.SysRole; import com.ruoyi.system.service.ISysMenuService; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index ff3a7fd7d..afbaff17b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -11,13 +11,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService; -import com.ruoyi.framework.web.base.BaseController; /** * 公告 信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 66ab75bb7..760e06380 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -11,14 +11,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.service.ISysPostService; -import com.ruoyi.framework.web.base.BaseController; /** * 岗位信息操作处理 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index d441165ec..433041fe7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -12,8 +12,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.config.Global; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; @@ -22,7 +23,6 @@ import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysUserService; -import com.ruoyi.framework.web.base.BaseController; /** * 个人信息 业务处理 @@ -52,7 +52,7 @@ public class SysProfileController extends BaseController @GetMapping() public String profile(ModelMap mmap) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); user.setSex(dictDataService.selectDictLabel("sys_user_sex", user.getSex())); mmap.put("user", user); mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId())); @@ -64,7 +64,7 @@ public class SysProfileController extends BaseController @ResponseBody public boolean checkPassword(String password) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); if (passwordService.matches(user, password)) { return true; @@ -75,7 +75,7 @@ public class SysProfileController extends BaseController @GetMapping("/resetPwd") public String resetPwd(ModelMap mmap) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); mmap.put("user", userService.selectUserById(user.getUserId())); return prefix + "/resetPwd"; } @@ -85,14 +85,14 @@ public class SysProfileController extends BaseController @ResponseBody public AjaxResult resetPwd(String oldPassword, String newPassword) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); if (StringUtils.isNotEmpty(newPassword) && passwordService.matches(user, oldPassword)) { user.setSalt(ShiroUtils.randomSalt()); user.setPassword(passwordService.encryptPassword(user.getLoginName(), newPassword, user.getSalt())); if (userService.resetUserPwd(user) > 0) { - setSysUser(userService.selectUserById(user.getUserId())); + ShiroUtils.setSysUser(userService.selectUserById(user.getUserId())); return success(); } return error(); @@ -109,7 +109,7 @@ public class SysProfileController extends BaseController @GetMapping("/edit") public String edit(ModelMap mmap) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); mmap.put("user", userService.selectUserById(user.getUserId())); return prefix + "/edit"; } @@ -120,7 +120,7 @@ public class SysProfileController extends BaseController @GetMapping("/avatar") public String avatar(ModelMap mmap) { - SysUser user = getSysUser(); + SysUser user = ShiroUtils.getSysUser(); mmap.put("user", userService.selectUserById(user.getUserId())); return prefix + "/avatar"; } @@ -133,14 +133,14 @@ public class SysProfileController extends BaseController @ResponseBody public AjaxResult update(SysUser user) { - SysUser currentUser = getSysUser(); + SysUser currentUser = ShiroUtils.getSysUser(); currentUser.setUserName(user.getUserName()); currentUser.setEmail(user.getEmail()); currentUser.setPhonenumber(user.getPhonenumber()); currentUser.setSex(user.getSex()); if (userService.updateUserInfo(currentUser) > 0) { - setSysUser(userService.selectUserById(currentUser.getUserId())); + ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); return success(); } return error(); @@ -154,7 +154,7 @@ public class SysProfileController extends BaseController @ResponseBody public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file) { - SysUser currentUser = getSysUser(); + SysUser currentUser = ShiroUtils.getSysUser(); try { if (!file.isEmpty()) @@ -163,7 +163,7 @@ public class SysProfileController extends BaseController currentUser.setAvatar(avatar); if (userService.updateUserInfo(currentUser) > 0) { - setSysUser(userService.selectUserById(currentUser.getUserId())); + ShiroUtils.setSysUser(userService.selectUserById(currentUser.getUserId())); return success(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index bae777347..832c8b340 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -12,14 +12,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysRole; import com.ruoyi.system.service.ISysRoleService; -import com.ruoyi.framework.web.base.BaseController; /** * 角色信息 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index a7e94e8c2..edacd96be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -13,14 +13,14 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.shiro.service.SysPasswordService; import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.framework.web.base.BaseController; import com.ruoyi.system.domain.SysUser; import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysRoleService; @@ -85,7 +85,7 @@ public class SysUserController extends BaseController { ExcelUtil util = new ExcelUtil(SysUser.class); List userList = util.importExcel(file.getInputStream()); - String operName = getSysUser().getLoginName(); + String operName = ShiroUtils.getSysUser().getLoginName(); String message = userService.importUser(userList, updateSupport, operName); return AjaxResult.success(message); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java index 202c5765a..53ce0f1ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/BuildController.java @@ -4,7 +4,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; /** * build 表单构建 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java index a2d71b1ff..cfa748f30 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/SwaggerController.java @@ -4,7 +4,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; /** * swagger 接口 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java index f3b3c5ef9..73a1c0bec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java @@ -2,17 +2,14 @@ package com.ruoyi.web.controller.tool; import java.util.ArrayList; import java.util.List; - import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - -import com.ruoyi.common.base.AjaxResult; -import com.ruoyi.framework.web.base.BaseController; - +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 8ec2a1cc6..c75c11666 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -6,7 +6,7 @@ ruoyi: version: 3.2.0 # 版权年份 copyrightYear: 2019 - # 文件上传路径 + # 文件上传 profile: D:/profile/ # 获取ip地址开关 addressEnabled: true @@ -121,14 +121,3 @@ xss: excludes: /system/notice/* # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* - -# 代码生成 -gen: - # 作者 - author: ruoyi - # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool - packageName: com.ruoyi.system - # 自动去除表前缀,默认是true - autoRemovePre: true - # 表前缀(类名不会包含表前缀) - tablePrefix: sys_ \ No newline at end of file diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 5b99751d6..b6f766150 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -15,14 +15,25 @@ common通用工具 - - 2.5 - 1.3.3 - 1.11.3 - 3.17 - - + + + + org.springframework + spring-context-support + + + + + org.springframework + spring-web + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + @@ -40,28 +51,24 @@ commons-io commons-io - ${commons.io.version} commons-fileupload commons-fileupload - ${commons.fileupload.version} org.jsoup jsoup - ${jsoup.version} org.apache.poi poi-ooxml - ${poi.version} @@ -70,6 +77,12 @@ snakeyaml + + + javax.servlet + javax.servlet-api + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java index d44043e1b..2455b1dcc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java @@ -136,36 +136,4 @@ public class Global { return getConfig("ruoyi.profile") + "upload/"; } - - /** - * 获取作者 - */ - public static String getAuthor() - { - return StringUtils.nvl(getConfig("gen.author"), "ruoyi"); - } - - /** - * 生成包路径 - */ - public static String getPackageName() - { - return StringUtils.nvl(getConfig("gen.packageName"), "com.ruoyi.project.module"); - } - - /** - * 是否自动去除表前缀 - */ - public static String getAutoRemovePre() - { - return StringUtils.nvl(getConfig("gen.autoRemovePre"), "true"); - } - - /** - * 表前缀(类名不会包含表前缀) - */ - public static String getTablePrefix() - { - return StringUtils.nvl(getConfig("gen.tablePrefix"), "sys_"); - } } diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java similarity index 92% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java rename to ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java index a7fb0998f..ddb873097 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ServerConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/ServerConfig.java @@ -1,34 +1,33 @@ -package com.ruoyi.framework.config; - -import javax.servlet.http.HttpServletRequest; -import org.springframework.stereotype.Component; - -import com.ruoyi.common.utils.ServletUtils; - -/** - * 服务相关配置 - * - * @author ruoyi - * - */ -@Component -public class ServerConfig -{ - /** - * 获取完整的请求路径,包括:域名,端口,上下文访问路径 - * - * @return 服务地址 - */ - public String getUrl() - { - HttpServletRequest request = ServletUtils.getRequest(); - return getDomain(request); - } - - public static String getDomain(HttpServletRequest request) - { - StringBuffer url = request.getRequestURL(); - String contextPath = request.getServletContext().getContextPath(); - return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); - } -} +package com.ruoyi.common.config; + +import javax.servlet.http.HttpServletRequest; +import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.ServletUtils; + +/** + * 服务相关配置 + * + * @author ruoyi + * + */ +@Component +public class ServerConfig +{ + /** + * 获取完整的请求路径,包括:域名,端口,上下文访问路径 + * + * @return 服务地址 + */ + public String getUrl() + { + HttpServletRequest request = ServletUtils.getRequest(); + return getDomain(request); + } + + public static String getDomain(HttpServletRequest request) + { + StringBuffer url = request.getRequestURL(); + String contextPath = request.getServletContext().getContextPath(); + return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString(); + } +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java similarity index 92% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java rename to ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java index eb8b7f3d3..968a9692c 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSourceContextHolder.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/datasource/DynamicDataSourceContextHolder.java @@ -1,4 +1,4 @@ -package com.ruoyi.framework.datasource; +package com.ruoyi.common.config.datasource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java similarity index 94% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java rename to ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java index accdd5324..1fa05d3e4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java @@ -1,53 +1,53 @@ -package com.ruoyi.framework.config; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; -import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; - -/** - * 线程池配置 - * - * @author ruoyi - **/ -@Configuration -public class ThreadPoolConfig -{ - // 核心线程池大小 - private int corePoolSize = 50; - - // 最大可创建的线程数 - private int maxPoolSize = 200; - - // 队列最大长度 - private int queueCapacity = 1000; - - // 线程池维护线程所允许的空闲时间 - private int keepAliveSeconds = 300; - - @Bean(name = "threadPoolTaskExecutor") - public ThreadPoolTaskExecutor threadPoolTaskExecutor() - { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(maxPoolSize); - executor.setCorePoolSize(corePoolSize); - executor.setQueueCapacity(queueCapacity); - executor.setKeepAliveSeconds(keepAliveSeconds); - // 线程池对拒绝任务(无线程可用)的处理策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - return executor; - } - - /** - * 执行周期性或定时任务 - */ - @Bean(name = "scheduledExecutorService") - protected ScheduledExecutorService scheduledExecutorService() - { - return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()); - } -} +package com.ruoyi.common.config.thread; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * 线程池配置 + * + * @author ruoyi + **/ +@Configuration +public class ThreadPoolConfig +{ + // 核心线程池大小 + private int corePoolSize = 50; + + // 最大可创建的线程数 + private int maxPoolSize = 200; + + // 队列最大长度 + private int queueCapacity = 1000; + + // 线程池维护线程所允许的空闲时间 + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() + { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 线程池对拒绝任务(无线程可用)的处理策略 + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + return executor; + } + + /** + * 执行周期性或定时任务 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() + { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java index e194a6e0f..57154e71a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/UserConstants.java @@ -7,6 +7,11 @@ package com.ruoyi.common.constant; */ public class UserConstants { + /** + * 平台内系统用户的唯一标志 + */ + public static final String SYS_USER = "SYS_USER"; + /** 正常状态 */ public static final String NORMAL = "0"; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java similarity index 77% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index dbfea684e..c70dc587f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/base/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -1,161 +1,171 @@ -package com.ruoyi.framework.web.base; - -import java.beans.PropertyEditorSupport; -import java.util.Date; -import java.util.List; -import org.springframework.web.bind.WebDataBinder; -import org.springframework.web.bind.annotation.InitBinder; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.ruoyi.common.base.AjaxResult; -import com.ruoyi.common.page.PageDomain; -import com.ruoyi.common.page.TableDataInfo; -import com.ruoyi.common.page.TableSupport; -import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.sql.SqlUtil; -import com.ruoyi.framework.util.ShiroUtils; -import com.ruoyi.system.domain.SysUser; - -/** - * web层通用数据处理 - * - * @author ruoyi - */ -public class BaseController -{ - /** - * 将前台传递过来的日期格式的字符串,自动转化为Date类型 - */ - @InitBinder - public void initBinder(WebDataBinder binder) - { - // Date 类型转换 - binder.registerCustomEditor(Date.class, new PropertyEditorSupport() - { - @Override - public void setAsText(String text) - { - setValue(DateUtils.parseDate(text)); - } - }); - } - - /** - * 设置请求分页数据 - */ - protected void startPage() - { - PageDomain pageDomain = TableSupport.buildPageRequest(); - Integer pageNum = pageDomain.getPageNum(); - Integer pageSize = pageDomain.getPageSize(); - if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) - { - String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); - PageHelper.startPage(pageNum, pageSize, orderBy); - } - } - - /** - * 响应请求分页数据 - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected TableDataInfo getDataTable(List list) - { - TableDataInfo rspData = new TableDataInfo(); - rspData.setCode(0); - rspData.setRows(list); - rspData.setTotal(new PageInfo(list).getTotal()); - return rspData; - } - - /** - * 响应返回结果 - * - * @param rows 影响行数 - * @return 操作结果 - */ - protected AjaxResult toAjax(int rows) - { - return rows > 0 ? success() : error(); - } - - /** - * 响应返回结果 - * - * @param result 结果 - * @return 操作结果 - */ - protected AjaxResult toAjax(boolean result) - { - return result ? success() : error(); - } - - /** - * 返回成功 - */ - public AjaxResult success() - { - return AjaxResult.success(); - } - - /** - * 返回失败消息 - */ - public AjaxResult error() - { - return AjaxResult.error(); - } - - /** - * 返回成功消息 - */ - public AjaxResult success(String message) - { - return AjaxResult.success(message); - } - - /** - * 返回失败消息 - */ - public AjaxResult error(String message) - { - return AjaxResult.error(message); - } - - /** - * 返回错误码消息 - */ - public AjaxResult error(int code, String message) - { - return AjaxResult.error(code, message); - } - - /** - * 页面跳转 - */ - public String redirect(String url) - { - return StringUtils.format("redirect:{}", url); - } - - public SysUser getSysUser() - { - return ShiroUtils.getSysUser(); - } - - public void setSysUser(SysUser user) - { - ShiroUtils.setSysUser(user); - } - - public Long getUserId() - { - return getSysUser().getUserId(); - } - - public String getLoginName() - { - return getSysUser().getLoginName(); - } -} +package com.ruoyi.common.core.controller; + +import java.beans.PropertyEditorSupport; +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.InitBinder; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.page.PageDomain; +import com.ruoyi.common.page.TableDataInfo; +import com.ruoyi.common.page.TableSupport; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ServletUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.sql.SqlUtil; + +/** + * web层通用数据处理 + * + * @author ruoyi + */ +public class BaseController +{ + protected final Logger logger = LoggerFactory.getLogger(BaseController.class); + + /** + * 将前台传递过来的日期格式的字符串,自动转化为Date类型 + */ + @InitBinder + public void initBinder(WebDataBinder binder) + { + // Date 类型转换 + binder.registerCustomEditor(Date.class, new PropertyEditorSupport() + { + @Override + public void setAsText(String text) + { + setValue(DateUtils.parseDate(text)); + } + }); + } + + /** + * 设置请求分页数据 + */ + protected void startPage() + { + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) + { + String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy()); + PageHelper.startPage(pageNum, pageSize, orderBy); + } + } + + /** + * 获取request + */ + public HttpServletRequest getRequest() + { + return ServletUtils.getRequest(); + } + + /** + * 获取response + */ + public HttpServletResponse getResponse() + { + return ServletUtils.getResponse(); + } + + /** + * 获取session + */ + public HttpSession getSession() + { + return getRequest().getSession(); + } + + /** + * 响应请求分页数据 + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected TableDataInfo getDataTable(List list) + { + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(0); + rspData.setRows(list); + rspData.setTotal(new PageInfo(list).getTotal()); + return rspData; + } + + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(int rows) + { + return rows > 0 ? success() : error(); + } + + /** + * 响应返回结果 + * + * @param result 结果 + * @return 操作结果 + */ + protected AjaxResult toAjax(boolean result) + { + return result ? success() : error(); + } + + /** + * 返回成功 + */ + public AjaxResult success() + { + return AjaxResult.success(); + } + + /** + * 返回失败消息 + */ + public AjaxResult error() + { + return AjaxResult.error(); + } + + /** + * 返回成功消息 + */ + public AjaxResult success(String message) + { + return AjaxResult.success(message); + } + + /** + * 返回失败消息 + */ + public AjaxResult error(String message) + { + return AjaxResult.error(message); + } + + /** + * 返回错误码消息 + */ + public AjaxResult error(int code, String message) + { + return AjaxResult.error(code, message); + } + + /** + * 页面跳转 + */ + public String redirect(String url) + { + return StringUtils.format("redirect:{}", url); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/base/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java similarity index 92% rename from ruoyi-common/src/main/java/com/ruoyi/common/base/AjaxResult.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index 208df9975..b1e482814 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/base/AjaxResult.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.base; +package com.ruoyi.common.core.domain; import java.util.HashMap; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/base/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java similarity index 93% rename from ruoyi-common/src/main/java/com/ruoyi/common/base/BaseEntity.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index a3a9c4bb4..0fc68beb5 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/base/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.base; +package com.ruoyi.common.core.domain; import java.io.Serializable; import java.util.Date; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/base/Ztree.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java similarity index 91% rename from ruoyi-common/src/main/java/com/ruoyi/common/base/Ztree.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java index 70389e11c..e7fe780e4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/base/Ztree.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/Ztree.java @@ -1,104 +1,104 @@ -package com.ruoyi.common.base; - -import java.io.Serializable; - -/** - * Ztree树结构实体类 - * - * @author ruoyi - */ -public class Ztree implements Serializable -{ - private static final long serialVersionUID = 1L; - - /** 节点ID */ - private Long id; - - /** 节点父ID */ - private Long pId; - - /** 节点名称 */ - private String name; - - /** 节点标题 */ - private String title; - - /** 是否勾选 */ - private boolean checked = false; - - /** 是否展开 */ - private boolean open = false; - - /** 是否能勾选 */ - private boolean nocheck = false; - - public Long getId() - { - return id; - } - - public void setId(Long id) - { - this.id = id; - } - - public Long getpId() - { - return pId; - } - - public void setpId(Long pId) - { - this.pId = pId; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getTitle() - { - return title; - } - - public void setTitle(String title) - { - this.title = title; - } - - public boolean isChecked() - { - return checked; - } - - public void setChecked(boolean checked) - { - this.checked = checked; - } - - public boolean isOpen() - { - return open; - } - - public void setOpen(boolean open) - { - this.open = open; - } - - public boolean isNocheck() - { - return nocheck; - } - - public void setNocheck(boolean nocheck) - { - this.nocheck = nocheck; - } -} +package com.ruoyi.common.core.domain; + +import java.io.Serializable; + +/** + * Ztree树结构实体类 + * + * @author ruoyi + */ +public class Ztree implements Serializable +{ + private static final long serialVersionUID = 1L; + + /** 节点ID */ + private Long id; + + /** 节点父ID */ + private Long pId; + + /** 节点名称 */ + private String name; + + /** 节点标题 */ + private String title; + + /** 是否勾选 */ + private boolean checked = false; + + /** 是否展开 */ + private boolean open = false; + + /** 是否能勾选 */ + private boolean nocheck = false; + + public Long getId() + { + return id; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getpId() + { + return pId; + } + + public void setpId(Long pId) + { + this.pId = pId; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public boolean isChecked() + { + return checked; + } + + public void setChecked(boolean checked) + { + this.checked = checked; + } + + public boolean isOpen() + { + return open; + } + + public void setOpen(boolean open) + { + this.open = open; + } + + public boolean isNocheck() + { + return nocheck; + } + + public void setNocheck(boolean nocheck) + { + this.nocheck = nocheck; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 1a8277e5c..b9600a72a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -2,8 +2,8 @@ package com.ruoyi.common.utils.poi; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.base.AjaxResult; import com.ruoyi.common.config.Global; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.reflect.ReflectUtils; import com.ruoyi.common.support.Convert; diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 4c1107fa2..4d5431f44 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -33,14 +33,12 @@ com.alibaba druid-spring-boot-starter - ${druid.version} com.github.penggle kaptcha - ${kaptcha.version} javax.servlet-api @@ -49,80 +47,40 @@ - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - - - org.apache.shiro - shiro-core - ${shiro.version} - - org.apache.shiro shiro-spring - ${shiro.version} org.apache.shiro shiro-ehcache - ${shiro.version} - + com.github.theborakompanioni thymeleaf-extras-shiro - ${thymeleaf.extras.shiro.version} eu.bitwalker UserAgentUtils - ${bitwalker.version} com.ruoyi ruoyi-system - ${ruoyi.version} - - - - com.ruoyi - ruoyi-quartz - ${ruoyi.version} - - - - - com.ruoyi - ruoyi-generator - ${ruoyi.version} - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - ${pagehelper.boot.version} - com.github.oshi oshi-core - ${oshi.version} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 6260ca297..91e2beeb4 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -9,7 +9,7 @@ import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.stereotype.Component; import com.ruoyi.common.annotation.DataScope; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysRole; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java index c4eab3fbc..277176800 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataSourceAspect.java @@ -11,8 +11,8 @@ import org.slf4j.LoggerFactory; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import com.ruoyi.common.annotation.DataSource; +import com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.framework.datasource.DynamicDataSourceContextHolder; /** * 多数据源处理 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java index 2ece8dbfd..675a335e9 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.datasource; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; +import com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder; /** * 动态数据源 diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java index 05fce47bf..a57f1197b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/util/ShiroUtils.java @@ -7,6 +7,7 @@ import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.PrincipalCollection; import org.apache.shiro.subject.SimplePrincipalCollection; + import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.framework.shiro.realm.UserRealm; diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index 4dc1cb8a2..3d4e26611 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -6,7 +6,7 @@ import org.slf4j.LoggerFactory; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.exception.DemoModeException; import com.ruoyi.framework.util.PermissionUtils; diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index 76fc15e28..1586132ef 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -15,25 +15,26 @@ generator代码生成 - - 1.7 - - + + + org.apache.shiro + shiro-core + + org.apache.velocity velocity - ${velocity.version} - + com.ruoyi ruoyi-common - ${ruoyi.version} + \ No newline at end of file diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java similarity index 77% rename from ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java rename to ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java index 7eacddd21..c1b34897f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/GenConfig.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java @@ -1,6 +1,8 @@ -package com.ruoyi.framework.config; +package com.ruoyi.generator.config; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; /** @@ -10,6 +12,7 @@ import org.springframework.stereotype.Component; */ @Component @ConfigurationProperties(prefix = "gen") +@PropertySource(value = { "generator.yml" }) public class GenConfig { /** 作者 */ @@ -29,6 +32,7 @@ public class GenConfig return author; } + @Value("${author}") public void setAuthor(String author) { GenConfig.author = author; @@ -39,6 +43,7 @@ public class GenConfig return packageName; } + @Value("${packageName}") public void setPackageName(String packageName) { GenConfig.packageName = packageName; @@ -49,6 +54,7 @@ public class GenConfig return autoRemovePre; } + @Value("${autoRemovePre}") public void setAutoRemovePre(String autoRemovePre) { GenConfig.autoRemovePre = autoRemovePre; @@ -59,6 +65,7 @@ public class GenConfig return tablePrefix; } + @Value("${tablePrefix}") public void setTablePrefix(String tablePrefix) { GenConfig.tablePrefix = tablePrefix; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java similarity index 94% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/GenController.java rename to ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 367ac73ed..823c93f90 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -1,4 +1,4 @@ -package com.ruoyi.web.controller.tool; +package com.ruoyi.generator.controller; import java.io.IOException; import java.util.List; @@ -13,12 +13,12 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.support.Convert; import com.ruoyi.generator.domain.TableInfo; import com.ruoyi.generator.service.IGenService; -import com.ruoyi.framework.web.base.BaseController; /** * 代码生成 操作处理 diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/TableInfo.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/TableInfo.java index ee8acc0c5..d6219249f 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/TableInfo.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/TableInfo.java @@ -1,7 +1,7 @@ package com.ruoyi.generator.domain; import java.util.List; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.utils.StringUtils; /** diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenServiceImpl.java index 682921b66..e352ad98f 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/impl/GenServiceImpl.java @@ -14,9 +14,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.config.Global; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.generator.config.GenConfig; import com.ruoyi.generator.domain.ColumnInfo; import com.ruoyi.generator.domain.TableInfo; import com.ruoyi.generator.mapper.GenMapper; @@ -110,7 +110,7 @@ public class GenServiceImpl implements IGenService VelocityInitializer.initVelocity(); - String packageName = Global.getPackageName(); + String packageName = GenConfig.getPackageName(); String moduleName = GenUtils.getModuleName(packageName); VelocityContext context = GenUtils.getVelocityContext(table); diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index ce2442589..afedc06fd 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -5,10 +5,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.velocity.VelocityContext; -import com.ruoyi.common.config.Global; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.generator.config.GenConfig; import com.ruoyi.generator.domain.ColumnInfo; import com.ruoyi.generator.domain.TableInfo; @@ -64,7 +64,7 @@ public class GenUtils { // java对象数据传递到模板文件vm VelocityContext velocityContext = new VelocityContext(); - String packageName = Global.getPackageName(); + String packageName = GenConfig.getPackageName(); velocityContext.put("tableName", table.getTableName()); velocityContext.put("tableComment", replaceKeyword(table.getTableComment())); velocityContext.put("primaryKey", table.getPrimaryKey()); @@ -74,7 +74,7 @@ public class GenUtils velocityContext.put("columns", table.getColumns()); velocityContext.put("basePackage", getBasePackage(packageName)); velocityContext.put("package", packageName); - velocityContext.put("author", Global.getAuthor()); + velocityContext.put("author", GenConfig.getAuthor()); velocityContext.put("datetime", DateUtils.getDate()); return velocityContext; } @@ -105,8 +105,8 @@ public class GenUtils */ public static String tableToJava(String tableName) { - String autoRemovePre = Global.getAutoRemovePre(); - String tablePrefix = Global.getTablePrefix(); + String autoRemovePre = GenConfig.getAutoRemovePre(); + String tablePrefix = GenConfig.getTablePrefix(); if (Constants.AUTO_REOMVE_PRE.equals(autoRemovePre) && StringUtils.isNotEmpty(tablePrefix)) { tableName = tableName.replaceFirst(tablePrefix, ""); @@ -199,7 +199,7 @@ public class GenUtils public static String getProjectPath() { - String packageName = Global.getPackageName(); + String packageName = GenConfig.getPackageName(); StringBuffer projectPath = new StringBuffer(); projectPath.append("main/java/"); projectPath.append(packageName.replace(".", "/")); diff --git a/ruoyi-generator/src/main/resources/generator.yml b/ruoyi-generator/src/main/resources/generator.yml new file mode 100644 index 000000000..9e76f23f4 --- /dev/null +++ b/ruoyi-generator/src/main/resources/generator.yml @@ -0,0 +1,11 @@ + +# 代码生成 +gen: + # 作者 + author: ruoyi + # 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool + packageName: com.ruoyi.system + # 自动去除表前缀,默认是true + autoRemovePre: true + # 表前缀(类名不会包含表前缀) + tablePrefix: sys_ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/tool/gen/gen.html b/ruoyi-generator/src/main/resources/templates/tool/gen/gen.html similarity index 100% rename from ruoyi-admin/src/main/resources/templates/tool/gen/gen.html rename to ruoyi-generator/src/main/resources/templates/tool/gen/gen.html diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml index f3dbb2283..391a254da 100644 --- a/ruoyi-quartz/pom.xml +++ b/ruoyi-quartz/pom.xml @@ -17,6 +17,12 @@ + + + org.apache.shiro + shiro-core + + org.quartz-scheduler @@ -28,14 +34,13 @@ - - + + com.ruoyi ruoyi-common - ${ruoyi.version} - + \ No newline at end of file diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java index 83b60e694..e466ed057 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/config/ScheduleConfig.java @@ -10,7 +10,6 @@ import java.util.Properties; * 定时任务配置 * * @author ruoyi - * */ @Configuration public class ScheduleConfig diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java similarity index 88% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobController.java rename to ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index 902e54063..a07c901d1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -1,4 +1,4 @@ -package com.ruoyi.web.controller.monitor; +package com.ruoyi.quartz.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -11,14 +11,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.service.ISysJobService; -import com.ruoyi.framework.web.base.BaseController; /** * 调度任务信息操作处理 @@ -91,6 +90,8 @@ public class SysJobController extends BaseController /** * 任务调度状态修改 + * + * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:changeStatus") @@ -98,7 +99,6 @@ public class SysJobController extends BaseController @ResponseBody public AjaxResult changeStatus(SysJob job) { - job.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(jobService.changeStatus(job)); } @@ -125,14 +125,14 @@ public class SysJobController extends BaseController /** * 新增保存调度 + * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.INSERT) @RequiresPermissions("monitor:job:add") @PostMapping("/add") @ResponseBody - public AjaxResult addSave(SysJob job) + public AjaxResult addSave(SysJob job) throws Exception { - job.setCreateBy(ShiroUtils.getLoginName()); return toAjax(jobService.insertJobCron(job)); } @@ -148,17 +148,17 @@ public class SysJobController extends BaseController /** * 修改保存调度 + * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:edit") @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(SysJob job) + public AjaxResult editSave(SysJob job ) throws Exception { - job.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(jobService.updateJobCron(job)); } - + /** * 校验cron表达式是否有效 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java similarity index 92% rename from ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobLogController.java rename to ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java index 523c34fbc..a7a21a099 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysJobLogController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java @@ -1,4 +1,4 @@ -package com.ruoyi.web.controller.monitor; +package com.ruoyi.quartz.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.framework.web.base.BaseController; import com.ruoyi.quartz.domain.SysJobLog; import com.ruoyi.quartz.service.ISysJobLogService; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index f7cfd4fa4..807c85ea0 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -5,8 +5,8 @@ import java.util.Date; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.quartz.util.CronUtils; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java index f59241fc5..dc2cff48f 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java @@ -3,7 +3,7 @@ package com.ruoyi.quartz.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 定时任务调度日志表 sys_job_log diff --git a/ruoyi-admin/src/main/resources/templates/monitor/job/add.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/add.html similarity index 100% rename from ruoyi-admin/src/main/resources/templates/monitor/job/add.html rename to ruoyi-quartz/src/main/resources/templates/monitor/job/add.html diff --git a/ruoyi-admin/src/main/resources/templates/monitor/job/detail.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html similarity index 97% rename from ruoyi-admin/src/main/resources/templates/monitor/job/detail.html rename to ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html index 90fc16229..f75d8b7be 100644 --- a/ruoyi-admin/src/main/resources/templates/monitor/job/detail.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html @@ -1,94 +1,94 @@ - - - - - -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    默认策略
    -
    立即执行
    -
    执行一次
    -
    放弃执行
    -
    -
    - -
    -
    -
    -
    - -
    - + + + + + +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    默认策略
    +
    立即执行
    +
    执行一次
    +
    放弃执行
    +
    +
    + +
    +
    +
    +
    + +
    + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/monitor/job/edit.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html similarity index 100% rename from ruoyi-admin/src/main/resources/templates/monitor/job/edit.html rename to ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html diff --git a/ruoyi-admin/src/main/resources/templates/monitor/job/job.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html similarity index 100% rename from ruoyi-admin/src/main/resources/templates/monitor/job/job.html rename to ruoyi-quartz/src/main/resources/templates/monitor/job/job.html diff --git a/ruoyi-admin/src/main/resources/templates/monitor/job/jobLog.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html similarity index 100% rename from ruoyi-admin/src/main/resources/templates/monitor/job/jobLog.html rename to ruoyi-quartz/src/main/resources/templates/monitor/job/jobLog.html diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 29b671605..c886bd260 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -16,12 +16,19 @@ + + + + mysql + mysql-connector-java + + com.ruoyi ruoyi-common - ${ruoyi.version} + \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index 39f1cbcaf..dcdf04662 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 参数配置表 sys_config diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDept.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDept.java index 56cc262bc..69ee792eb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDept.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDept.java @@ -2,7 +2,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 部门表 sys_dept diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictData.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictData.java index 94bd93d13..b35508a4a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictData.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictData.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 字典数据表 sys_dict_data diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictType.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictType.java index 14be91afc..223269f26 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictType.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysDictType.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 字典类型表 sys_dict_type diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java index 7a173365a..9c466c6df 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java @@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Date; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 系统访问记录表 sys_logininfor diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysMenu.java index eb769755a..4e5f12833 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysMenu.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysMenu.java @@ -2,9 +2,9 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.domain.BaseEntity; import java.util.ArrayList; import java.util.List; -import com.ruoyi.common.base.BaseEntity; /** * 菜单权限表 sys_menu diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java index e119f55b4..61b680219 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysNotice.java @@ -2,7 +2,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 通知公告表 sys_notice diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java index 1a2d3d731..79db903ab 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysOperLog.java @@ -4,7 +4,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Date; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 操作日志记录表 oper_log diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java index 4cf37f407..bbd491442 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 岗位表 sys_post diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java index 5390a2439..1f05263b6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRole.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; /** * 角色表 sys_role diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java index fbb69b8f6..72155528a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUser.java @@ -2,7 +2,7 @@ package com.ruoyi.system.domain; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.Type; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import java.util.Date; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java index be4806673..c5467bb66 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysUserOnline.java @@ -3,7 +3,7 @@ package com.ruoyi.system.domain; import java.util.Date; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.enums.OnlineStatus; /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java index 7997192ad..6e75df247 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java @@ -1,7 +1,7 @@ package com.ruoyi.system.service; import java.util.List; -import com.ruoyi.common.base.Ztree; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.system.domain.SysDept; import com.ruoyi.system.domain.SysRole; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 782778d30..2b6dc3190 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -3,7 +3,7 @@ package com.ruoyi.system.service; import java.util.List; import java.util.Map; import java.util.Set; -import com.ruoyi.common.base.Ztree; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.SysRole; import com.ruoyi.system.domain.SysUser; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 65dd890cb..ae226daa0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -5,8 +5,8 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.annotation.DataScope; -import com.ruoyi.common.base.Ztree; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysDept; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index bb52b2a58..19683dedb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -11,8 +11,8 @@ import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.base.Ztree; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysMenu; import com.ruoyi.system.domain.SysRole; From a9f378218bcb006266fc932e14d4f5c21cd2c0b1 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 8 Mar 2019 15:25:24 +0800 Subject: [PATCH 47/89] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=98=BE=E7=A4=BASql?= =?UTF-8?q?=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/application-druid.yml | 5 ++++- .../src/main/resources/vm/java/Controller.java.vm | 4 ++-- ruoyi-generator/src/main/resources/vm/java/domain.java.vm | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index a5cba7c14..18c0b11cc 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -34,7 +34,9 @@ spring: validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false - testOnReturn: false + testOnReturn: false + webStatFilter: + enabled: true statViewServlet: enabled: true # 设置白名单,不填则允许所有访问 @@ -42,6 +44,7 @@ spring: url-pattern: /monitor/druid/* filter: stat: + enabled: true # 慢SQL记录 log-slow-sql: true slow-sql-millis: 1000 diff --git a/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm index b10de7c9c..7bd1dcef5 100644 --- a/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm @@ -14,9 +14,9 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import ${package}.domain.${className}; import ${package}.service.I${className}Service; -import com.ruoyi.framework.web.base.BaseController; +import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.page.TableDataInfo; -import com.ruoyi.common.base.AjaxResult; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; /** diff --git a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm index ed74b335c..7184ab5a2 100644 --- a/ruoyi-generator/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/domain.java.vm @@ -2,7 +2,7 @@ package ${package}.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.base.BaseEntity; +import com.ruoyi.common.core.domain.BaseEntity; #foreach ($column in $columns) #if($column.attrType == 'Date') import java.util.Date; From 29e20870fcb601f1903b58093a8b3633d8051fdf Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 8 Mar 2019 16:11:24 +0800 Subject: [PATCH 48/89] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=8C=85=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/monitor/SysLogininforController.java | 2 +- .../ruoyi/web/controller/monitor/SysOperlogController.java | 2 +- .../web/controller/monitor/SysUserOnlineController.java | 2 +- .../ruoyi/web/controller/system/SysConfigController.java | 2 +- .../ruoyi/web/controller/system/SysDictDataController.java | 2 +- .../ruoyi/web/controller/system/SysDictTypeController.java | 2 +- .../ruoyi/web/controller/system/SysNoticeController.java | 2 +- .../com/ruoyi/web/controller/system/SysPostController.java | 2 +- .../com/ruoyi/web/controller/system/SysRoleController.java | 2 +- .../com/ruoyi/web/controller/system/SysUserController.java | 2 +- .../com/ruoyi/common/core/controller/BaseController.java | 6 +++--- .../java/com/ruoyi/common/{ => core}/page/PageDomain.java | 2 +- .../com/ruoyi/common/{ => core}/page/TableDataInfo.java | 2 +- .../java/com/ruoyi/common/{ => core}/page/TableSupport.java | 2 +- .../com/ruoyi/common/{support => core/text}/CharsetKit.java | 2 +- .../com/ruoyi/common/{support => core/text}/Convert.java | 2 +- .../ruoyi/common/{support => core/text}/StrFormatter.java | 2 +- .../src/main/java/com/ruoyi/common/utils/ServletUtils.java | 2 +- .../src/main/java/com/ruoyi/common/utils/StringUtils.java | 2 +- .../src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 4 ++-- .../com/ruoyi/common/{ => utils}/reflect/ReflectUtils.java | 4 ++-- .../java/com/ruoyi/generator/controller/GenController.java | 4 ++-- .../src/main/resources/vm/java/Controller.java.vm | 2 +- .../java/com/ruoyi/quartz/controller/SysJobController.java | 2 +- .../com/ruoyi/quartz/controller/SysJobLogController.java | 2 +- .../com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java | 2 +- .../com/ruoyi/quartz/service/impl/SysJobServiceImpl.java | 2 +- .../com/ruoyi/system/service/impl/SysConfigServiceImpl.java | 2 +- .../ruoyi/system/service/impl/SysDictDataServiceImpl.java | 2 +- .../ruoyi/system/service/impl/SysDictTypeServiceImpl.java | 2 +- .../ruoyi/system/service/impl/SysLogininforServiceImpl.java | 2 +- .../com/ruoyi/system/service/impl/SysNoticeServiceImpl.java | 2 +- .../ruoyi/system/service/impl/SysOperLogServiceImpl.java | 2 +- .../com/ruoyi/system/service/impl/SysPostServiceImpl.java | 2 +- .../com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 2 +- .../com/ruoyi/system/service/impl/SysUserServiceImpl.java | 2 +- 36 files changed, 41 insertions(+), 41 deletions(-) rename ruoyi-common/src/main/java/com/ruoyi/common/{ => core}/page/PageDomain.java (92%) rename ruoyi-common/src/main/java/com/ruoyi/common/{ => core}/page/TableDataInfo.java (91%) rename ruoyi-common/src/main/java/com/ruoyi/common/{ => core}/page/TableSupport.java (92%) rename ruoyi-common/src/main/java/com/ruoyi/common/{support => core/text}/CharsetKit.java (95%) rename ruoyi-common/src/main/java/com/ruoyi/common/{support => core/text}/Convert.java (96%) rename ruoyi-common/src/main/java/com/ruoyi/common/{support => core/text}/StrFormatter.java (96%) rename ruoyi-common/src/main/java/com/ruoyi/common/{ => utils}/reflect/ReflectUtils.java (99%) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index 514a3f3f0..6f04cab78 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -11,8 +11,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.service.ISysLogininforService; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index c8793b555..468866e18 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.service.ISysOperLogService; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index 47283d779..c3ea3ad72 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.OnlineStatus; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.framework.shiro.session.OnlineSession; import com.ruoyi.framework.shiro.session.OnlineSessionDAO; import com.ruoyi.framework.util.ShiroUtils; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 6e858a45d..f27a1262c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysConfig; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index a90e4bb65..414f18298 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysDictData; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 2a40ecde1..56c061cf1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysDictType; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java index afbaff17b..671dc11e3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java index 760e06380..74f736bf1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysPost; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 832c8b340..1d6572851 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.util.ShiroUtils; import com.ruoyi.system.domain.SysRole; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index edacd96be..77298ffc7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -15,8 +15,8 @@ import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.framework.shiro.service.SysPasswordService; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index c70dc587f..31a9dbe7d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -13,9 +13,9 @@ import org.springframework.web.bind.annotation.InitBinder; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.page.PageDomain; -import com.ruoyi.common.page.TableDataInfo; -import com.ruoyi.common.page.TableSupport; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/page/PageDomain.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java similarity index 92% rename from ruoyi-common/src/main/java/com/ruoyi/common/page/PageDomain.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java index 65dcba4d3..7fccaf46e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/page/PageDomain.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/PageDomain.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.page; +package com.ruoyi.common.core.page; import com.ruoyi.common.utils.StringUtils; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java similarity index 91% rename from ruoyi-common/src/main/java/com/ruoyi/common/page/TableDataInfo.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index be4085399..10f3b4d4f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.page; +package com.ruoyi.common.core.page; import java.io.Serializable; import java.util.List; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java similarity index 92% rename from ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java index 6b9342908..0efd82b32 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/page/TableSupport.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableSupport.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.page; +package com.ruoyi.common.core.page; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.utils.ServletUtils; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/support/CharsetKit.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java similarity index 95% rename from ruoyi-common/src/main/java/com/ruoyi/common/support/CharsetKit.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java index eb980e1cd..8297661af 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/support/CharsetKit.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/CharsetKit.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.support; +package com.ruoyi.common.core.text; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/support/Convert.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java similarity index 96% rename from ruoyi-common/src/main/java/com/ruoyi/common/support/Convert.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java index eed8cd3ac..9dd076d04 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/support/Convert.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/Convert.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.support; +package com.ruoyi.common.core.text; import java.math.BigDecimal; import java.math.BigInteger; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/support/StrFormatter.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java similarity index 96% rename from ruoyi-common/src/main/java/com/ruoyi/common/support/StrFormatter.java rename to ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java index 0c031b7c0..dbf3e2375 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/support/StrFormatter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/text/StrFormatter.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.support; +package com.ruoyi.common.core.text; import com.ruoyi.common.utils.StringUtils; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java index f4b96af4b..4dab7190d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java @@ -7,7 +7,7 @@ import javax.servlet.http.HttpSession; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; /** * 客户端工具类 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java index 767a51f63..f7e667c90 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java @@ -2,7 +2,7 @@ package com.ruoyi.common.utils; import java.util.Collection; import java.util.Map; -import com.ruoyi.common.support.StrFormatter; +import com.ruoyi.common.core.text.StrFormatter; /** * 字符串工具类 diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index b9600a72a..a727aec98 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -4,11 +4,11 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel.Type; import com.ruoyi.common.config.Global; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.reflect.ReflectUtils; -import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.reflect.ReflectUtils; import org.apache.poi.hssf.usermodel.HSSFDateUtil; import org.apache.poi.hssf.usermodel.HSSFFont; import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/reflect/ReflectUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java similarity index 99% rename from ruoyi-common/src/main/java/com/ruoyi/common/reflect/ReflectUtils.java rename to ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java index 40205d979..b78e53e10 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/reflect/ReflectUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.reflect; +package com.ruoyi.common.utils.reflect; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -12,7 +12,7 @@ import org.apache.commons.lang3.Validate; import org.apache.poi.ss.usermodel.DateUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DateUtils; /** diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 823c93f90..b288a6ada 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -14,9 +14,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; -import com.ruoyi.common.support.Convert; import com.ruoyi.generator.domain.TableInfo; import com.ruoyi.generator.service.IGenService; diff --git a/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm index 7bd1dcef5..a52c1b9a8 100644 --- a/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/Controller.java.vm @@ -15,7 +15,7 @@ import com.ruoyi.common.enums.BusinessType; import ${package}.domain.${className}; import ${package}.service.I${className}Service; import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.page.TableDataInfo; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index a07c901d1..1e5344001 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.service.ISysJobService; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java index a7a21a099..2c3d8e271 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobLogController.java @@ -13,8 +13,8 @@ import org.springframework.web.bind.annotation.ResponseBody; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.page.TableDataInfo; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.quartz.domain.SysJobLog; import com.ruoyi.quartz.service.ISysJobLogService; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java index 37a4885cf..cc31bea21 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobLogServiceImpl.java @@ -3,7 +3,7 @@ package com.ruoyi.quartz.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.quartz.domain.SysJobLog; import com.ruoyi.quartz.mapper.SysJobLogMapper; import com.ruoyi.quartz.service.ISysJobLogService; diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java index a02d65dad..9031872ef 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -7,7 +7,7 @@ import org.quartz.Scheduler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.mapper.SysJobMapper; import com.ruoyi.quartz.service.ISysJobService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index 9853f6137..8b2a02d0a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -4,7 +4,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.mapper.SysConfigMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java index 4f8ae61d4..502e03f43 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictDataServiceImpl.java @@ -3,7 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysDictData; import com.ruoyi.system.mapper.SysDictDataMapper; import com.ruoyi.system.service.ISysDictDataService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 77c44f518..ace3d5488 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -4,8 +4,8 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysDictType; import com.ruoyi.system.mapper.SysDictDataMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java index ca9f868c6..3f183d62c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysLogininforServiceImpl.java @@ -3,7 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysLogininfor; import com.ruoyi.system.mapper.SysLogininforMapper; import com.ruoyi.system.service.ISysLogininforService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java index c8895a31c..0f4814d0a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysNoticeServiceImpl.java @@ -3,7 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.mapper.SysNoticeMapper; import com.ruoyi.system.service.ISysNoticeService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java index e8609abb5..c79668b2e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java @@ -3,7 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.SysOperLog; import com.ruoyi.system.mapper.SysOperLogMapper; import com.ruoyi.system.service.ISysOperLogService; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index 4158b8cbc..885b89240 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -4,8 +4,8 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.mapper.SysPostMapper; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 8c9060549..2523f5d3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -9,8 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysRole; import com.ruoyi.system.domain.SysRoleDept; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 8906b1558..16884c7ac 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -8,8 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.support.Convert; import com.ruoyi.common.utils.Md5Utils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.SysPost; From 4f8456071038cb880aad4ebc4e933a1614413073 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 8 Mar 2019 16:31:02 +0800 Subject: [PATCH 49/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E5=80=BC=E4=B8=BA0/1=E6=97=B6=E6=97=A0=E6=B3=95=E8=BE=93?= =?UTF-8?q?=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 2 +- ruoyi-generator/src/main/resources/vm/java/ServiceImpl.java.vm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 2c38c31c8..8a852611d 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -259,7 +259,7 @@ selectDictLabel: function(datas, value) { var actions = []; $.each(datas, function(index, dict) { - if (dict.dictValue == value) { + if (dict.dictValue == ('' + value)) { actions.push("" + dict.dictLabel + ""); return false; } diff --git a/ruoyi-generator/src/main/resources/vm/java/ServiceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/ServiceImpl.java.vm index 540c5ab39..c0df374b1 100644 --- a/ruoyi-generator/src/main/resources/vm/java/ServiceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/ServiceImpl.java.vm @@ -6,7 +6,7 @@ import org.springframework.stereotype.Service; import ${package}.mapper.${className}Mapper; import ${package}.domain.${className}; import ${package}.service.I${className}Service; -import com.ruoyi.common.support.Convert; +import com.ruoyi.common.core.text.Convert; /** * ${tableComment} 服务层实现 From d27d739558889ba26ee2e08ce0b3f77d2e538626 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 9 Mar 2019 21:14:55 +0800 Subject: [PATCH 50/89] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90?= =?UTF-8?q?=E9=85=8D=E7=BD=AEclasspath=E5=BC=95=E7=94=A8=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/generator/config/GenConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java index c1b34897f..49b42e7ae 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/config/GenConfig.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; */ @Component @ConfigurationProperties(prefix = "gen") -@PropertySource(value = { "generator.yml" }) +@PropertySource(value = { "classpath:generator.yml" }) public class GenConfig { /** 作者 */ From aa478f2bd673a79f01c9a1cfd1431c367b4a3dd8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 9 Mar 2019 21:29:19 +0800 Subject: [PATCH 51/89] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=98=BE=E7=A4=BA=E7=B1=BB=E5=9E=8B=E5=8F=8A?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E6=A0=BC=E5=BC=8F=E6=89=A9=E5=B1=95=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/common.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index 32e91b2ec..cda298a5c 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -72,12 +72,18 @@ $(function() { layui.use('laydate', function() { var laydate = layui.laydate; var times = $(".time-input"); + // 控制控件外观 + var type = times.attr("data-type") || 'date'; + // 控制回显格式 + var format = times.attr("data-format") || 'yyyy-MM-dd'; for (var i = 0; i < times.length; i++) { var time = times[i]; laydate.render({ elem: time, theme: 'molv', trigger: 'click', + type: type, + format: format, done: function(value, date) {} }); } From 32e2e212a7729a575a3885f82803987f4daff24a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 9 Mar 2019 22:21:09 +0800 Subject: [PATCH 52/89] =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E7=94=B1Controller?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=88=B0Service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/system/SysRoleController.java | 4 ---- .../ruoyi/web/controller/system/SysUserController.java | 3 --- .../com/ruoyi/quartz/service/impl/SysJobServiceImpl.java | 9 +++++++++ .../ruoyi/system/service/impl/SysDeptServiceImpl.java | 2 ++ .../system/service/impl/SysDictTypeServiceImpl.java | 2 ++ .../ruoyi/system/service/impl/SysRoleServiceImpl.java | 4 ++++ .../ruoyi/system/service/impl/SysUserServiceImpl.java | 3 +++ 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java index 1d6572851..90dbe548f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java @@ -4,7 +4,6 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -78,7 +77,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:add") @Log(title = "角色管理", businessType = BusinessType.INSERT) @PostMapping("/add") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(SysRole role) { @@ -104,7 +102,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(SysRole role) { @@ -129,7 +126,6 @@ public class SysRoleController extends BaseController @RequiresPermissions("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.UPDATE) @PostMapping("/rule") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult ruleSave(SysRole role) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 77298ffc7..14533c841 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -4,7 +4,6 @@ import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -116,7 +115,6 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:add") @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping("/add") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult addSave(SysUser user) { @@ -148,7 +146,6 @@ public class SysUserController extends BaseController @RequiresPermissions("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") - @Transactional(rollbackFor = Exception.class) @ResponseBody public AjaxResult editSave(SysUser user) { diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java index 9031872ef..8b1bc54e9 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -6,6 +6,7 @@ import org.quartz.CronTrigger; import org.quartz.Scheduler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.core.text.Convert; import com.ruoyi.quartz.domain.SysJob; @@ -80,6 +81,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int pauseJob(SysJob job) { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); @@ -97,6 +99,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int resumeJob(SysJob job) { job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); @@ -114,6 +117,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int deleteJob(SysJob job) { int rows = jobMapper.deleteJobById(job.getJobId()); @@ -131,6 +135,7 @@ public class SysJobServiceImpl implements ISysJobService * @return 结果 */ @Override + @Transactional public void deleteJobByIds(String ids) { Long[] jobIds = Convert.toLongArray(ids); @@ -147,6 +152,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int changeStatus(SysJob job) { int rows = 0; @@ -168,6 +174,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int run(SysJob job) { return ScheduleUtils.run(scheduler, selectJobById(job.getJobId())); @@ -179,6 +186,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 调度信息 */ @Override + @Transactional public int insertJobCron(SysJob job) { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); @@ -196,6 +204,7 @@ public class SysJobServiceImpl implements ISysJobService * @param job 调度信息 */ @Override + @Transactional public int updateJobCron(SysJob job) { int rows = jobMapper.updateJob(job); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index ae226daa0..f623c3f3c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.Ztree; @@ -184,6 +185,7 @@ public class SysDeptServiceImpl implements ISysDeptService * @return 结果 */ @Override + @Transactional public int updateDept(SysDept dept) { SysDept info = deptMapper.selectDeptById(dept.getParentId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index ace3d5488..7d205fc16 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.BusinessException; @@ -114,6 +115,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService * @return 结果 */ @Override + @Transactional public int updateDictType(SysDictType dictType) { SysDictType oldDict = dictTypeMapper.selectDictTypeById(dictType.getDictId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 2523f5d3c..0f5726167 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; @@ -163,6 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int insertRole(SysRole role) { // 新增角色信息 @@ -177,6 +179,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int updateRole(SysRole role) { // 修改角色信息 @@ -193,6 +196,7 @@ public class SysRoleServiceImpl implements ISysRoleService * @return 结果 */ @Override + @Transactional public int updateRule(SysRole role) { // 修改角色信息 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 16884c7ac..91aa01fc2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; @@ -158,6 +159,7 @@ public class SysUserServiceImpl implements ISysUserService * @return 结果 */ @Override + @Transactional public int insertUser(SysUser user) { // 新增用户信息 @@ -176,6 +178,7 @@ public class SysUserServiceImpl implements ISysUserService * @return 结果 */ @Override + @Transactional public int updateUser(SysUser user) { Long userId = user.getUserId(); From 4b8d64f16fbb3a9ab76fb656a6e88c6a17d9400c Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 13 Mar 2019 12:41:29 +0800 Subject: [PATCH 53/89] =?UTF-8?q?=E5=90=AF=E7=94=A8=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 8a852611d..9b278e4e3 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -31,6 +31,7 @@ showColumns: true, showToggle: true, showExport: false, + clickToSelect: true, fixedColumns: false, fixedNumber: 0, rightFixedColumns: false, @@ -66,6 +67,7 @@ showColumns: options.showColumns, // 是否显示隐藏某列下拉框 showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮 showExport: options.showExport, // 是否支持导出文件 + clickToSelect: options.clickToSelect, // 是否启用点击选中行 fixedColumns: options.fixedColumns, // 是否启用冻结列(左侧) fixedNumber: options.fixedNumber, // 列冻结的个数(左侧) rightFixedColumns: options.rightFixedColumns, // 是否启用冻结列(右侧) From c9bd08c2dee896fe8dc65ac438cb06bbfc155b57 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 13 Mar 2019 13:41:40 +0800 Subject: [PATCH 54/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=E5=A4=B1=E8=B4=A5=E5=90=8E?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=8A=B6=E6=80=81=E4=B8=BA=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 2 +- .../java/com/ruoyi/common/exception/BusinessException.java | 6 ++++++ .../main/java/com/ruoyi/quartz/util/ScheduleRunnable.java | 7 ++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 9b278e4e3..501826da4 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -31,7 +31,7 @@ showColumns: true, showToggle: true, showExport: false, - clickToSelect: true, + clickToSelect: false, fixedColumns: false, fixedNumber: 0, rightFixedColumns: false, diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java index 3a62c3b60..d490675e7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java @@ -16,6 +16,12 @@ public class BusinessException extends RuntimeException this.message = message; } + public BusinessException(String message, Throwable e) + { + super(message, e); + this.message = message; + } + @Override public String getMessage() { diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java index 5a96a1063..b890649a9 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java @@ -1,9 +1,8 @@ package com.ruoyi.quartz.util; import java.lang.reflect.Method; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.util.ReflectionUtils; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.spring.SpringUtils; @@ -15,8 +14,6 @@ import com.ruoyi.common.utils.spring.SpringUtils; */ public class ScheduleRunnable implements Runnable { - private static final Logger log = LoggerFactory.getLogger(ScheduleRunnable.class); - private Object target; private Method method; private String params; @@ -54,7 +51,7 @@ public class ScheduleRunnable implements Runnable } catch (Exception e) { - log.error("执行定时任务 - :", e); + throw new BusinessException("执行定时任务失败", e); } } } From 9fc42511c678f5f8e7031f28a8a3b01cbe036170 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 13 Mar 2019 13:52:09 +0800 Subject: [PATCH 55/89] =?UTF-8?q?datetimepicker=20=E6=B1=89=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libs/datapicker/bootstrap-datetimepicker.js | 13 ++++++++++++- .../libs/datapicker/bootstrap-datetimepicker.min.js | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js index f66d69c13..3361d4bab 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.js @@ -82,7 +82,7 @@ // when page switch the datetimepicker div will be removed also. this.container = options.container || 'body'; - this.language = options.language || this.element.data('date-language') || 'en'; + this.language = options.language || this.element.data('date-language') || 'zh-cn'; this.language = this.language in dates ? this.language : this.language.split('-')[0]; // fr-CA fallback to fr this.language = this.language in dates ? this.language : 'en'; this.isRTL = dates[this.language].rtl || false; @@ -1494,6 +1494,17 @@ }; $.fn.datetimepicker.Constructor = Datetimepicker; var dates = $.fn.datetimepicker.dates = { + 'zh-cn': { + days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"], + daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"], + daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"], + months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], + meridiem: ["上午", "下午"], + suffix: ["st", "nd", "rd", "th"], + today: "今天", + clear: "清除" + }, en: { days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js index eba15ce5d..7756ee5c2 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/datapicker/bootstrap-datetimepicker.min.js @@ -1 +1 @@ -(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(d,f){if(!("indexOf" in Array.prototype)){Array.prototype.indexOf=function(k,j){if(j===f){j=0}if(j<0){j+=this.length}if(j<0){j=0}for(var l=this.length;jthis.endDate){o.push("disabled")}else{if(Math.floor(this.date.getUTCMinutes()/this.minuteStep)===Math.floor(n.getUTCMinutes()/this.minuteStep)){o.push("active")}}return o.concat((p?p:[]))};this.onRenderYear=function(o){var q=(j.onRenderYear||function(){return[]})(o);var p=["year"];if(typeof q==="string"){q=[q]}if(this.date.getUTCFullYear()===o.getUTCFullYear()){p.push("active")}var n=o.getUTCFullYear();var r=this.endDate.getUTCFullYear();if(or){p.push("disabled")}return p.concat((q?q:[]))};this.onRenderMonth=function(n){var p=(j.onRenderMonth||function(){return[]})(n);var o=["month"];if(typeof p==="string"){p=[p]}return o.concat((p?p:[]))};this.startDate=new Date(-8639968443048000);this.endDate=new Date(8639968443048000);this.datesDisabled=[];this.daysOfWeekDisabled=[];this.setStartDate(j.startDate||this.element.data("date-startdate"));this.setEndDate(j.endDate||this.element.data("date-enddate"));this.setDatesDisabled(j.datesDisabled||this.element.data("date-dates-disabled"));this.setDaysOfWeekDisabled(j.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.setMinutesDisabled(j.minutesDisabled||this.element.data("date-minute-disabled"));this.setHoursDisabled(j.hoursDisabled||this.element.data("date-hour-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};g.prototype={constructor:g,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}],[this.component,{click:d.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:d.proxy(this.reset,this)}])}}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:d.proxy(this.show,this)}]]}}}for(var j=0,k,l;j=this.startDate&&i<=this.endDate){this.date=i;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:i,startDate:this.startDate,endDate:this.endDate})}},setFormat:function(j){this.format=c.parseFormat(j,this.formatType);var i;if(this.isInput){i=this.element}else{if(this.component){i=this.element.find("input")}}if(i&&i.val()){this.setValue()}},setValue:function(){var i=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(i)}this.element.data("date",i)}else{this.element.val(i)}if(this.linkField){d("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(i){i=i||this.format;return c.formatDate(this.date,i,this.language,this.formatType,this.timezone)},setStartDate:function(i){this.startDate=i||this.startDate;if(this.startDate.valueOf()!==8639968443048000){this.startDate=c.parseDate(this.startDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setEndDate:function(i){this.endDate=i||this.endDate;if(this.endDate.valueOf()!==8639968443048000){this.endDate=c.parseDate(this.endDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setDatesDisabled:function(j){this.datesDisabled=j||[];if(!d.isArray(this.datesDisabled)){this.datesDisabled=this.datesDisabled.split(/,\s*/)}var i=this;this.datesDisabled=d.map(this.datesDisabled,function(k){return c.parseDate(k,i.format,i.language,i.formatType,i.timezone).toDateString()});this.update();this.updateNavArrows()},setTitle:function(i,j){return this.picker.find(i).find("th:eq(1)").text(this.title===false?j:this.title)},setDaysOfWeekDisabled:function(i){this.daysOfWeekDisabled=i||[];if(!d.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=d.map(this.daysOfWeekDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setMinutesDisabled:function(i){this.minutesDisabled=i||[];if(!d.isArray(this.minutesDisabled)){this.minutesDisabled=this.minutesDisabled.split(/,\s*/)}this.minutesDisabled=d.map(this.minutesDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setHoursDisabled:function(i){this.hoursDisabled=i||[];if(!d.isArray(this.hoursDisabled)){this.hoursDisabled=this.hoursDisabled.split(/,\s*/)}this.hoursDisabled=d.map(this.hoursDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}if(!this.zIndex){var j=0;d("div").each(function(){var o=parseInt(d(this).css("zIndex"),10);if(o>j){j=o}});this.zIndex=j+10}var n,m,l,k;if(this.container instanceof d){k=this.container.offset()}else{k=d(this.container).offset()}if(this.component){n=this.component.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.component.outerWidth()-this.picker.outerWidth()}}else{n=this.element.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.element.outerWidth()-this.picker.outerWidth()}}var i=document.body.clientWidth||window.innerWidth;if(l+220>i){l=i-220}if(this.pickerPosition==="top-left"||this.pickerPosition==="top-right"){m=n.top-this.picker.outerHeight()}else{m=n.top+this.height}m=m-k.top;l=l-k.left;this.picker.css({top:m,left:l,zIndex:this.zIndex})},hour_minute:"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]",update:function(){var i,j=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0] instanceof Date)){i=arguments[0];j=true}else{i=(this.isInput?this.element.val():this.element.find("input").val())||this.element.data("date")||this.initialDate;if(typeof i==="string"){i=i.replace(/^\s+|\s+$/g,"")}}if(!i){i=new Date();j=false}if(typeof i==="string"){if(new RegExp(this.hour_minute).test(i)||new RegExp(this.hour_minute+":[0-5][0-9]").test(i)){i=this.getDate()}}this.date=c.parseDate(i,this.format,this.language,this.formatType,this.timezone);if(j){this.setValue()}if(this.datethis.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}}this.fill()},fillDow:function(){var i=this.weekStart,j="";while(i'+e[this.language].daysMin[(i++)%7]+""}j+="";this.picker.find(".datetimepicker-days thead").append(j)},fillMonths:function(){var l="";var m=new Date(this.viewDate);for(var k=0;k<12;k++){m.setUTCMonth(k);var j=this.onRenderMonth(m);l+=''+e[this.language].monthsShort[k]+""}this.picker.find(".datetimepicker-months td").html(l)},fill:function(){if(!this.date||!this.viewDate){return}var E=new Date(this.viewDate),t=E.getUTCFullYear(),G=E.getUTCMonth(),n=E.getUTCDate(),A=E.getUTCHours(),w=this.startDate.getUTCFullYear(),B=this.startDate.getUTCMonth(),p=this.endDate.getUTCFullYear(),x=this.endDate.getUTCMonth()+1,q=(new h(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),D=new Date();this.setTitle(".datetimepicker-days",e[this.language].months[G]+" "+t);if(this.formatViewType==="time"){var k=this.getFormattedDate();this.setTitle(".datetimepicker-hours",k);this.setTitle(".datetimepicker-minutes",k)}else{this.setTitle(".datetimepicker-hours",n+" "+e[this.language].months[G]+" "+t);this.setTitle(".datetimepicker-minutes",n+" "+e[this.language].months[G]+" "+t)}this.picker.find("tfoot th.today").text(e[this.language].today||e.en.today).toggle(this.todayBtn!==false);this.picker.find("tfoot th.clear").text(e[this.language].clear||e.en.clear).toggle(this.clearBtn!==false);this.updateNavArrows();this.fillMonths();var I=h(t,G-1,28,0,0,0,0),z=c.getDaysInMonth(I.getUTCFullYear(),I.getUTCMonth());I.setUTCDate(z);I.setUTCDate(z-(I.getUTCDay()-this.weekStart+7)%7);var j=new Date(I);j.setUTCDate(j.getUTCDate()+42);j=j.valueOf();var r=[];var F;while(I.valueOf()")}F=this.onRenderDay(I);if(I.getUTCFullYear()t||(I.getUTCFullYear()===t&&I.getUTCMonth()>G)){F.push("new")}}if(this.todayHighlight&&I.getUTCFullYear()===D.getFullYear()&&I.getUTCMonth()===D.getMonth()&&I.getUTCDate()===D.getDate()){F.push("today")}if(I.valueOf()===q){F.push("active")}if((I.valueOf()+86400000)<=this.startDate||I.valueOf()>this.endDate||d.inArray(I.getUTCDay(),this.daysOfWeekDisabled)!==-1||d.inArray(I.toDateString(),this.datesDisabled)!==-1){F.push("disabled")}r.push(''+I.getUTCDate()+"");if(I.getUTCDay()===this.weekEnd){r.push("")}I.setUTCDate(I.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(r.join(""));r=[];var u="",C="",s="";var l=this.hoursDisabled||[];E=new Date(this.viewDate);for(var y=0;y<24;y++){E.setUTCHours(y);F=this.onRenderHour(E);if(l.indexOf(y)!==-1){F.push("disabled")}var v=h(t,G,n,y);if((v.valueOf()+3600000)<=this.startDate||v.valueOf()>this.endDate){F.push("disabled")}else{if(A===y){F.push("active")}}if(this.showMeridian&&e[this.language].meridiem.length===2){C=(y<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("")}r.push('
    '+C.toUpperCase()+"")}s=C;u=(y%12?y%12:12);if(y<12){F.push("hour_am")}else{F.push("hour_pm")}r.push(''+u+"");if(y===23){r.push("
    ")}}else{u=y+":00";r.push(''+u+"")}}this.picker.find(".datetimepicker-hours td").html(r.join(""));r=[];u="";C="";s="";var m=this.minutesDisabled||[];E=new Date(this.viewDate);for(var y=0;y<60;y+=this.minuteStep){if(m.indexOf(y)!==-1){continue}E.setUTCMinutes(y);E.setUTCSeconds(0);F=this.onRenderMinute(E);if(this.showMeridian&&e[this.language].meridiem.length===2){C=(A<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("")}r.push('
    '+C.toUpperCase()+"")}s=C;u=(A%12?A%12:12);r.push(''+u+":"+(y<10?"0"+y:y)+"");if(y===59){r.push("
    ")}}else{u=y+":00";r.push(''+A+":"+(y<10?"0"+y:y)+"")}}this.picker.find(".datetimepicker-minutes td").html(r.join(""));var J=this.date.getUTCFullYear();var o=this.setTitle(".datetimepicker-months",t).end().find(".month").removeClass("active");if(J===t){o.eq(this.date.getUTCMonth()).addClass("active")}if(tp){o.addClass("disabled")}if(t===w){o.slice(0,B).addClass("disabled")}if(t===p){o.slice(x).addClass("disabled")}r="";t=parseInt(t/10,10)*10;var H=this.setTitle(".datetimepicker-years",t+"-"+(t+9)).end().find("td");t-=1;E=new Date(this.viewDate);for(var y=-1;y<11;y++){E.setUTCFullYear(t);F=this.onRenderYear(E);if(y===-1||y===10){F.push(b)}r+=''+t+"";t+=1}H.html(r);this.place()},updateNavArrows:function(){var m=new Date(this.viewDate),k=m.getUTCFullYear(),l=m.getUTCMonth(),j=m.getUTCDate(),i=m.getUTCHours();switch(this.viewMode){case 0:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()&&i<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()&&i>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(k<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(j){j.preventDefault();j.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var i=j.originalEvent;var l=i.wheelDelta;var k=l>0?1:(l===0)?0:-1;if(this.wheelViewModeNavigationInverseDirection){k=-k}this.showMode(k);setTimeout(d.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(m){m.stopPropagation();m.preventDefault();var n=d(m.target).closest("span, td, th, legend");if(n.is("."+this.icontype)){n=d(n).parent().closest("span, td, th, legend")}if(n.length===1){if(n.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(n[0].nodeName.toLowerCase()){case"th":switch(n[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var i=c.modes[this.viewMode].navStep*(n[0].className==="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,i);break;case 1:this.viewDate=this.moveDate(this.viewDate,i);break;case 2:this.viewDate=this.moveMonth(this.viewDate,i);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,i);break}this.fill();this.element.trigger({type:n[0].className+":"+this.convertViewModeText(this.viewMode),date:this.viewDate,startDate:this.startDate,endDate:this.endDate});break;case"clear":this.reset();if(this.autoclose){this.hide()}break;case"today":var j=new Date();j=h(j.getFullYear(),j.getMonth(),j.getDate(),j.getHours(),j.getMinutes(),j.getSeconds(),0);if(jthis.endDate){j=this.endDate}}this.viewMode=this.startViewMode;this.showMode(0);this._setDate(j);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!n.is(".disabled")){var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),q=this.viewDate.getUTCDate(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".month")){this.viewDate.setUTCDate(1);o=n.parent().find("span").index(n);q=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(o);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".year")){this.viewDate.setUTCDate(1);p=parseInt(n.text(),10)||0;this.viewDate.setUTCFullYear(p);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".hour")){r=parseInt(n.text(),10)||0;if(n.hasClass("hour_am")||n.hasClass("hour_pm")){if(r===12&&n.hasClass("hour_am")){r=0}else{if(r!==12&&n.hasClass("hour_pm")){r+=12}}}this.viewDate.setUTCHours(r);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".minute")){k=parseInt(n.text().substr(n.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(k);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(h(p,o,q,r,k,s,0))}}}}}if(this.viewMode!==0){var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(n.is(".day")&&!n.is(".disabled")){var q=parseInt(n.text(),10)||1;var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".old")){if(o===0){o=11;p-=1}else{o-=1}}else{if(n.is(".new")){if(o===11){o=0;p+=1}else{o+=1}}}this.viewDate.setUTCFullYear(p);this.viewDate.setUTCMonth(o,q);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(h(p,o,q,r,k,s,0))}}var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(i,k){if(!k||k==="date"){this.date=i}if(!k||k==="view"){this.viewDate=i}this.fill();this.setValue();var j;if(this.isInput){j=this.element}else{if(this.component){j=this.element.find("input")}}if(j){j.change()}this.element.trigger({type:"changeDate",date:this.getDate()});if(i===null){this.date=this.viewDate}},moveMinute:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCMinutes(k.getUTCMinutes()+(i*this.minuteStep));return k},moveHour:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCHours(k.getUTCHours()+i);return k},moveDate:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCDate(k.getUTCDate()+i);return k},moveMonth:function(j,k){if(!k){return j}var n=new Date(j.valueOf()),r=n.getUTCDate(),o=n.getUTCMonth(),m=Math.abs(k),q,p;k=k>0?1:-1;if(m===1){p=k===-1?function(){return n.getUTCMonth()===o}:function(){return n.getUTCMonth()!==q};q=o+k;n.setUTCMonth(q);if(q<0||q>11){q=(q+12)%12}}else{for(var l=0;l=this.startDate&&i<=this.endDate},keydown:function(o){if(this.picker.is(":not(:visible)")){if(o.keyCode===27){this.show()}return}var k=false,j,i,n;switch(o.keyCode){case 27:this.hide();o.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation){break}j=o.keyCode===37?-1:1;var m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j);n=this.moveDate(this.viewDate,j)}else{if(m===1){i=this.moveHour(this.date,j);n=this.moveHour(this.viewDate,j)}else{if(m===0){i=this.moveMinute(this.date,j);n=this.moveMinute(this.viewDate,j)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 38:case 40:if(!this.keyboardNavigation){break}j=o.keyCode===38?-1:1;m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j*7);n=this.moveDate(this.viewDate,j*7)}else{if(m===1){if(this.showMeridian){i=this.moveHour(this.date,j*6);n=this.moveHour(this.viewDate,j*6)}else{i=this.moveHour(this.date,j*4);n=this.moveHour(this.viewDate,j*4)}}else{if(m===0){i=this.moveMinute(this.date,j*4);n=this.moveMinute(this.viewDate,j*4)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 13:if(this.viewMode!==0){var p=this.viewMode;this.showMode(-1);this.fill();if(p===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}o.preventDefault();break;case 9:this.hide();break}if(k){var l;if(this.isInput){l=this.element}else{if(this.component){l=this.element.find("input")}}if(l){l.change()}this.element.trigger({type:"changeDate",date:this.getDate()})}},showMode:function(i){if(i){var j=Math.max(0,Math.min(c.modes.length-1,this.viewMode+i));if(j>=this.minView&&j<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:j});this.viewMode=j}}this.picker.find(">div").hide().filter(".datetimepicker-"+c.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(){this._setDate(null,"date")},convertViewModeText:function(i){switch(i){case 4:return"decade";case 3:return"year";case 2:return"month";case 1:return"day";case 0:return"hour"}}};var b=d.fn.datetimepicker;d.fn.datetimepicker=function(k){var i=Array.apply(null,arguments);i.shift();var j;this.each(function(){var n=d(this),m=n.data("datetimepicker"),l=typeof k==="object"&&k;if(!m){n.data("datetimepicker",(m=new g(this,d.extend({},d.fn.datetimepicker.defaults,l))))}if(typeof k==="string"&&typeof m[k]==="function"){j=m[k].apply(m,i);if(j!==f){return false}}});if(j!==f){return j}else{return this}};d.fn.datetimepicker.defaults={};d.fn.datetimepicker.Constructor=g;var e=d.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today",clear:"Clear"}};var c={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(i){return(((i%4===0)&&(i%100!==0))||(i%400===0))},getDaysInMonth:function(i,j){return[31,(c.isLeapYear(i)?29:28),31,30,31,30,31,31,30,31,30,31][j]},getDefaultFormat:function(i,j){if(i==="standard"){if(j==="input"){return"yyyy-mm-dd hh:ii"}else{return"yyyy-mm-dd hh:ii:ss"}}else{if(i==="php"){if(j==="input"){return"Y-m-d H:i"}else{return"Y-m-d H:i:s"}}else{throw new Error("Invalid format type.")}}},validParts:function(i){if(i==="standard"){return/t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else{if(i==="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(l,j){var i=l.replace(this.validParts(j),"\0").split("\0"),k=l.match(this.validParts(j));if(!i||!i.length||!k||k.length===0){throw new Error("Invalid date format.")}return{separators:i,parts:k}},parseDate:function(A,y,v,j,r){if(A instanceof Date){var u=new Date(A.valueOf()-A.getTimezoneOffset()*60000);u.setMilliseconds(0);return u}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii:ss",j)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(A)){var l=/([-+]\d+)([dmwy])/,q=A.match(/([-+]\d+)([dmwy])/g),t,p;A=new Date();for(var x=0;x',headTemplateV3:' ',contTemplate:'',footTemplate:''};c.template='
    '+c.headTemplate+c.contTemplate+c.footTemplate+'
    '+c.headTemplate+c.contTemplate+c.footTemplate+'
    '+c.headTemplate+""+c.footTemplate+'
    '+c.headTemplate+c.contTemplate+c.footTemplate+'
    '+c.headTemplate+c.contTemplate+c.footTemplate+"
    ";c.templateV3='
    '+c.headTemplateV3+c.contTemplate+c.footTemplate+'
    '+c.headTemplateV3+c.contTemplate+c.footTemplate+'
    '+c.headTemplateV3+""+c.footTemplate+'
    '+c.headTemplateV3+c.contTemplate+c.footTemplate+'
    '+c.headTemplateV3+c.contTemplate+c.footTemplate+"
    ";d.fn.datetimepicker.DPGlobal=c;d.fn.datetimepicker.noConflict=function(){d.fn.datetimepicker=b;return this};d(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(j){var i=d(this);if(i.data("datetimepicker")){return}j.preventDefault();i.datetimepicker("show")});d(function(){d('[data-provide="datetimepicker-inline"]').datetimepicker()})})); \ No newline at end of file +(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{if(typeof exports==="object"){factory(require("jquery"))}else{factory(jQuery)}}}(function($,undefined){if(!("indexOf" in Array.prototype)){Array.prototype.indexOf=function(find,i){if(i===undefined){i=0}if(i<0){i+=this.length}if(i<0){i=0}for(var n=this.length;ithis.endDate){res.push("disabled")}else{if(Math.floor(this.date.getUTCMinutes()/this.minuteStep)===Math.floor(date.getUTCMinutes()/this.minuteStep)){res.push("active")}}return res.concat((render?render:[]))};this.onRenderYear=function(date){var render=(options.onRenderYear||function(){return[]})(date);var res=["year"];if(typeof render==="string"){render=[render]}if(this.date.getUTCFullYear()===date.getUTCFullYear()){res.push("active")}var currentYear=date.getUTCFullYear();var endYear=this.endDate.getUTCFullYear();if(dateendYear){res.push("disabled")}return res.concat((render?render:[]))};this.onRenderMonth=function(date){var render=(options.onRenderMonth||function(){return[]})(date);var res=["month"];if(typeof render==="string"){render=[render]}return res.concat((render?render:[]))};this.startDate=new Date(-8639968443048000);this.endDate=new Date(8639968443048000);this.datesDisabled=[];this.daysOfWeekDisabled=[];this.setStartDate(options.startDate||this.element.data("date-startdate"));this.setEndDate(options.endDate||this.element.data("date-enddate"));this.setDatesDisabled(options.datesDisabled||this.element.data("date-dates-disabled"));this.setDaysOfWeekDisabled(options.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.setMinutesDisabled(options.minutesDisabled||this.element.data("date-minute-disabled"));this.setHoursDisabled(options.hoursDisabled||this.element.data("date-hour-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};Datetimepicker.prototype={constructor:Datetimepicker,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:$.proxy(this.show,this),keyup:$.proxy(this.update,this),keydown:$.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:$.proxy(this.show,this),keyup:$.proxy(this.update,this),keydown:$.proxy(this.keydown,this)}],[this.component,{click:$.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:$.proxy(this.reset,this)}])}}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:$.proxy(this.show,this)}]]}}}for(var i=0,el,ev;i=this.startDate&&d<=this.endDate){this.date=d;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:d,startDate:this.startDate,endDate:this.endDate})}},setFormat:function(format){this.format=DPGlobal.parseFormat(format,this.formatType);var element;if(this.isInput){element=this.element}else{if(this.component){element=this.element.find("input")}}if(element&&element.val()){this.setValue()}},setValue:function(){var formatted=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(formatted)}this.element.data("date",formatted)}else{this.element.val(formatted)}if(this.linkField){$("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(format){format=format||this.format;return DPGlobal.formatDate(this.date,format,this.language,this.formatType,this.timezone)},setStartDate:function(startDate){this.startDate=startDate||this.startDate;if(this.startDate.valueOf()!==8639968443048000){this.startDate=DPGlobal.parseDate(this.startDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setEndDate:function(endDate){this.endDate=endDate||this.endDate;if(this.endDate.valueOf()!==8639968443048000){this.endDate=DPGlobal.parseDate(this.endDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setDatesDisabled:function(datesDisabled){this.datesDisabled=datesDisabled||[];if(!$.isArray(this.datesDisabled)){this.datesDisabled=this.datesDisabled.split(/,\s*/)}var mThis=this;this.datesDisabled=$.map(this.datesDisabled,function(d){return DPGlobal.parseDate(d,mThis.format,mThis.language,mThis.formatType,mThis.timezone).toDateString()});this.update();this.updateNavArrows()},setTitle:function(selector,value){return this.picker.find(selector).find("th:eq(1)").text(this.title===false?value:this.title)},setDaysOfWeekDisabled:function(daysOfWeekDisabled){this.daysOfWeekDisabled=daysOfWeekDisabled||[];if(!$.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=$.map(this.daysOfWeekDisabled,function(d){return parseInt(d,10)});this.update();this.updateNavArrows()},setMinutesDisabled:function(minutesDisabled){this.minutesDisabled=minutesDisabled||[];if(!$.isArray(this.minutesDisabled)){this.minutesDisabled=this.minutesDisabled.split(/,\s*/)}this.minutesDisabled=$.map(this.minutesDisabled,function(d){return parseInt(d,10)});this.update();this.updateNavArrows()},setHoursDisabled:function(hoursDisabled){this.hoursDisabled=hoursDisabled||[];if(!$.isArray(this.hoursDisabled)){this.hoursDisabled=this.hoursDisabled.split(/,\s*/)}this.hoursDisabled=$.map(this.hoursDisabled,function(d){return parseInt(d,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}if(!this.zIndex){var index_highest=0;$("div").each(function(){var index_current=parseInt($(this).css("zIndex"),10);if(index_current>index_highest){index_highest=index_current}});this.zIndex=index_highest+10}var offset,top,left,containerOffset;if(this.container instanceof $){containerOffset=this.container.offset()}else{containerOffset=$(this.container).offset()}if(this.component){offset=this.component.offset();left=offset.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){left+=this.component.outerWidth()-this.picker.outerWidth()}}else{offset=this.element.offset();left=offset.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){left+=this.element.outerWidth()-this.picker.outerWidth()}}var bodyWidth=document.body.clientWidth||window.innerWidth;if(left+220>bodyWidth){left=bodyWidth-220}if(this.pickerPosition==="top-left"||this.pickerPosition==="top-right"){top=offset.top-this.picker.outerHeight()}else{top=offset.top+this.height}top=top-containerOffset.top;left=left-containerOffset.left;this.picker.css({top:top,left:left,zIndex:this.zIndex})},hour_minute:"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]",update:function(){var date,fromArgs=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0] instanceof Date)){date=arguments[0];fromArgs=true}else{date=(this.isInput?this.element.val():this.element.find("input").val())||this.element.data("date")||this.initialDate;if(typeof date==="string"){date=date.replace(/^\s+|\s+$/g,"")}}if(!date){date=new Date();fromArgs=false}if(typeof date==="string"){if(new RegExp(this.hour_minute).test(date)||new RegExp(this.hour_minute+":[0-5][0-9]").test(date)){date=this.getDate()}}this.date=DPGlobal.parseDate(date,this.format,this.language,this.formatType,this.timezone);if(fromArgs){this.setValue()}if(this.datethis.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}}this.fill()},fillDow:function(){var dowCnt=this.weekStart,html="";while(dowCnt'+dates[this.language].daysMin[(dowCnt++)%7]+""}html+="";this.picker.find(".datetimepicker-days thead").append(html)},fillMonths:function(){var html="";var d=new Date(this.viewDate);for(var i=0;i<12;i++){d.setUTCMonth(i);var classes=this.onRenderMonth(d);html+=''+dates[this.language].monthsShort[i]+""}this.picker.find(".datetimepicker-months td").html(html)},fill:function(){if(!this.date||!this.viewDate){return}var d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth(),dayMonth=d.getUTCDate(),hours=d.getUTCHours(),startYear=this.startDate.getUTCFullYear(),startMonth=this.startDate.getUTCMonth(),endYear=this.endDate.getUTCFullYear(),endMonth=this.endDate.getUTCMonth()+1,currentDate=(new UTCDate(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),today=new Date();this.setTitle(".datetimepicker-days",dates[this.language].months[month]+" "+year);if(this.formatViewType==="time"){var formatted=this.getFormattedDate();this.setTitle(".datetimepicker-hours",formatted);this.setTitle(".datetimepicker-minutes",formatted)}else{this.setTitle(".datetimepicker-hours",dayMonth+" "+dates[this.language].months[month]+" "+year);this.setTitle(".datetimepicker-minutes",dayMonth+" "+dates[this.language].months[month]+" "+year)}this.picker.find("tfoot th.today").text(dates[this.language].today||dates["en"].today).toggle(this.todayBtn!==false);this.picker.find("tfoot th.clear").text(dates[this.language].clear||dates["en"].clear).toggle(this.clearBtn!==false);this.updateNavArrows();this.fillMonths();var prevMonth=UTCDate(year,month-1,28,0,0,0,0),day=DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(),prevMonth.getUTCMonth());prevMonth.setUTCDate(day);prevMonth.setUTCDate(day-(prevMonth.getUTCDay()-this.weekStart+7)%7);var nextMonth=new Date(prevMonth);nextMonth.setUTCDate(nextMonth.getUTCDate()+42);nextMonth=nextMonth.valueOf();var html=[];var classes;while(prevMonth.valueOf()")}classes=this.onRenderDay(prevMonth);if(prevMonth.getUTCFullYear()year||(prevMonth.getUTCFullYear()===year&&prevMonth.getUTCMonth()>month)){classes.push("new")}}if(this.todayHighlight&&prevMonth.getUTCFullYear()===today.getFullYear()&&prevMonth.getUTCMonth()===today.getMonth()&&prevMonth.getUTCDate()===today.getDate()){classes.push("today")}if(prevMonth.valueOf()===currentDate){classes.push("active")}if((prevMonth.valueOf()+86400000)<=this.startDate||prevMonth.valueOf()>this.endDate||$.inArray(prevMonth.getUTCDay(),this.daysOfWeekDisabled)!==-1||$.inArray(prevMonth.toDateString(),this.datesDisabled)!==-1){classes.push("disabled")}html.push(''+prevMonth.getUTCDate()+"");if(prevMonth.getUTCDay()===this.weekEnd){html.push("")}prevMonth.setUTCDate(prevMonth.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(html.join(""));html=[];var txt="",meridian="",meridianOld="";var hoursDisabled=this.hoursDisabled||[];d=new Date(this.viewDate);for(var i=0;i<24;i++){d.setUTCHours(i);classes=this.onRenderHour(d);if(hoursDisabled.indexOf(i)!==-1){classes.push("disabled")}var actual=UTCDate(year,month,dayMonth,i);if((actual.valueOf()+3600000)<=this.startDate||actual.valueOf()>this.endDate){classes.push("disabled")}else{if(hours===i){classes.push("active")}}if(this.showMeridian&&dates[this.language].meridiem.length===2){meridian=(i<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);if(meridian!==meridianOld){if(meridianOld!==""){html.push("")}html.push('
    '+meridian.toUpperCase()+"")}meridianOld=meridian;txt=(i%12?i%12:12);if(i<12){classes.push("hour_am")}else{classes.push("hour_pm")}html.push(''+txt+"");if(i===23){html.push("
    ")}}else{txt=i+":00";html.push(''+txt+"")}}this.picker.find(".datetimepicker-hours td").html(html.join(""));html=[];txt="";meridian="";meridianOld="";var minutesDisabled=this.minutesDisabled||[];d=new Date(this.viewDate);for(var i=0;i<60;i+=this.minuteStep){if(minutesDisabled.indexOf(i)!==-1){continue}d.setUTCMinutes(i);d.setUTCSeconds(0);classes=this.onRenderMinute(d);if(this.showMeridian&&dates[this.language].meridiem.length===2){meridian=(hours<12?dates[this.language].meridiem[0]:dates[this.language].meridiem[1]);if(meridian!==meridianOld){if(meridianOld!==""){html.push("")}html.push('
    '+meridian.toUpperCase()+"")}meridianOld=meridian;txt=(hours%12?hours%12:12);html.push(''+txt+":"+(i<10?"0"+i:i)+"");if(i===59){html.push("
    ")}}else{txt=i+":00";html.push(''+hours+":"+(i<10?"0"+i:i)+"")}}this.picker.find(".datetimepicker-minutes td").html(html.join(""));var currentYear=this.date.getUTCFullYear();var months=this.setTitle(".datetimepicker-months",year).end().find(".month").removeClass("active");if(currentYear===year){months.eq(this.date.getUTCMonth()).addClass("active")}if(yearendYear){months.addClass("disabled")}if(year===startYear){months.slice(0,startMonth).addClass("disabled")}if(year===endYear){months.slice(endMonth).addClass("disabled")}html="";year=parseInt(year/10,10)*10;var yearCont=this.setTitle(".datetimepicker-years",year+"-"+(year+9)).end().find("td");year-=1;d=new Date(this.viewDate);for(var i=-1;i<11;i++){d.setUTCFullYear(year);classes=this.onRenderYear(d);if(i===-1||i===10){classes.push(old)}html+=''+year+"";year+=1}yearCont.html(html);this.place()},updateNavArrows:function(){var d=new Date(this.viewDate),year=d.getUTCFullYear(),month=d.getUTCMonth(),day=d.getUTCDate(),hour=d.getUTCHours();switch(this.viewMode){case 0:if(year<=this.startDate.getUTCFullYear()&&month<=this.startDate.getUTCMonth()&&day<=this.startDate.getUTCDate()&&hour<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(year>=this.endDate.getUTCFullYear()&&month>=this.endDate.getUTCMonth()&&day>=this.endDate.getUTCDate()&&hour>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(year<=this.startDate.getUTCFullYear()&&month<=this.startDate.getUTCMonth()&&day<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(year>=this.endDate.getUTCFullYear()&&month>=this.endDate.getUTCMonth()&&day>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(year<=this.startDate.getUTCFullYear()&&month<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(year>=this.endDate.getUTCFullYear()&&month>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(year<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(year>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(e){e.preventDefault();e.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var originalEvent=e.originalEvent;var delta=originalEvent.wheelDelta;var mode=delta>0?1:(delta===0)?0:-1;if(this.wheelViewModeNavigationInverseDirection){mode=-mode}this.showMode(mode);setTimeout($.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(e){e.stopPropagation();e.preventDefault();var target=$(e.target).closest("span, td, th, legend");if(target.is("."+this.icontype)){target=$(target).parent().closest("span, td, th, legend")}if(target.length===1){if(target.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(target[0].nodeName.toLowerCase()){case"th":switch(target[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var dir=DPGlobal.modes[this.viewMode].navStep*(target[0].className==="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,dir);break;case 1:this.viewDate=this.moveDate(this.viewDate,dir);break;case 2:this.viewDate=this.moveMonth(this.viewDate,dir);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,dir);break}this.fill();this.element.trigger({type:target[0].className+":"+this.convertViewModeText(this.viewMode),date:this.viewDate,startDate:this.startDate,endDate:this.endDate});break;case"clear":this.reset();if(this.autoclose){this.hide()}break;case"today":var date=new Date();date=UTCDate(date.getFullYear(),date.getMonth(),date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds(),0);if(datethis.endDate){date=this.endDate}}this.viewMode=this.startViewMode;this.showMode(0);this._setDate(date);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!target.is(".disabled")){var year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth(),day=this.viewDate.getUTCDate(),hours=this.viewDate.getUTCHours(),minutes=this.viewDate.getUTCMinutes(),seconds=this.viewDate.getUTCSeconds();if(target.is(".month")){this.viewDate.setUTCDate(1);month=target.parent().find("span").index(target);day=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(month);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(UTCDate(year,month,day,hours,minutes,seconds,0))}}else{if(target.is(".year")){this.viewDate.setUTCDate(1);year=parseInt(target.text(),10)||0;this.viewDate.setUTCFullYear(year);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(UTCDate(year,month,day,hours,minutes,seconds,0))}}else{if(target.is(".hour")){hours=parseInt(target.text(),10)||0;if(target.hasClass("hour_am")||target.hasClass("hour_pm")){if(hours===12&&target.hasClass("hour_am")){hours=0}else{if(hours!==12&&target.hasClass("hour_pm")){hours+=12}}}this.viewDate.setUTCHours(hours);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(UTCDate(year,month,day,hours,minutes,seconds,0))}}else{if(target.is(".minute")){minutes=parseInt(target.text().substr(target.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(minutes);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(UTCDate(year,month,day,hours,minutes,seconds,0))}}}}}if(this.viewMode!==0){var oldViewMode=this.viewMode;this.showMode(-1);this.fill();if(oldViewMode===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(target.is(".day")&&!target.is(".disabled")){var day=parseInt(target.text(),10)||1;var year=this.viewDate.getUTCFullYear(),month=this.viewDate.getUTCMonth(),hours=this.viewDate.getUTCHours(),minutes=this.viewDate.getUTCMinutes(),seconds=this.viewDate.getUTCSeconds();if(target.is(".old")){if(month===0){month=11;year-=1}else{month-=1}}else{if(target.is(".new")){if(month===11){month=0;year+=1}else{month+=1}}}this.viewDate.setUTCFullYear(year);this.viewDate.setUTCMonth(month,day);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(UTCDate(year,month,day,hours,minutes,seconds,0))}}var oldViewMode=this.viewMode;this.showMode(-1);this.fill();if(oldViewMode===this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(date,which){if(!which||which==="date"){this.date=date}if(!which||which==="view"){this.viewDate=date}this.fill();this.setValue();var element;if(this.isInput){element=this.element}else{if(this.component){element=this.element.find("input")}}if(element){element.change()}this.element.trigger({type:"changeDate",date:this.getDate()});if(date===null){this.date=this.viewDate}},moveMinute:function(date,dir){if(!dir){return date}var new_date=new Date(date.valueOf());new_date.setUTCMinutes(new_date.getUTCMinutes()+(dir*this.minuteStep));return new_date},moveHour:function(date,dir){if(!dir){return date}var new_date=new Date(date.valueOf());new_date.setUTCHours(new_date.getUTCHours()+dir);return new_date},moveDate:function(date,dir){if(!dir){return date}var new_date=new Date(date.valueOf());new_date.setUTCDate(new_date.getUTCDate()+dir);return new_date},moveMonth:function(date,dir){if(!dir){return date}var new_date=new Date(date.valueOf()),day=new_date.getUTCDate(),month=new_date.getUTCMonth(),mag=Math.abs(dir),new_month,test;dir=dir>0?1:-1;if(mag===1){test=dir===-1?function(){return new_date.getUTCMonth()===month}:function(){return new_date.getUTCMonth()!==new_month};new_month=month+dir;new_date.setUTCMonth(new_month);if(new_month<0||new_month>11){new_month=(new_month+12)%12}}else{for(var i=0;i=this.startDate&&date<=this.endDate},keydown:function(e){if(this.picker.is(":not(:visible)")){if(e.keyCode===27){this.show()}return}var dateChanged=false,dir,newDate,newViewDate;switch(e.keyCode){case 27:this.hide();e.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation){break}dir=e.keyCode===37?-1:1;var viewMode=this.viewMode;if(e.ctrlKey){viewMode+=2}else{if(e.shiftKey){viewMode+=1}}if(viewMode===4){newDate=this.moveYear(this.date,dir);newViewDate=this.moveYear(this.viewDate,dir)}else{if(viewMode===3){newDate=this.moveMonth(this.date,dir);newViewDate=this.moveMonth(this.viewDate,dir)}else{if(viewMode===2){newDate=this.moveDate(this.date,dir);newViewDate=this.moveDate(this.viewDate,dir)}else{if(viewMode===1){newDate=this.moveHour(this.date,dir);newViewDate=this.moveHour(this.viewDate,dir)}else{if(viewMode===0){newDate=this.moveMinute(this.date,dir);newViewDate=this.moveMinute(this.viewDate,dir)}}}}}if(this.dateWithinRange(newDate)){this.date=newDate;this.viewDate=newViewDate;this.setValue();this.update();e.preventDefault();dateChanged=true}break;case 38:case 40:if(!this.keyboardNavigation){break}dir=e.keyCode===38?-1:1;viewMode=this.viewMode;if(e.ctrlKey){viewMode+=2}else{if(e.shiftKey){viewMode+=1}}if(viewMode===4){newDate=this.moveYear(this.date,dir);newViewDate=this.moveYear(this.viewDate,dir)}else{if(viewMode===3){newDate=this.moveMonth(this.date,dir);newViewDate=this.moveMonth(this.viewDate,dir)}else{if(viewMode===2){newDate=this.moveDate(this.date,dir*7);newViewDate=this.moveDate(this.viewDate,dir*7)}else{if(viewMode===1){if(this.showMeridian){newDate=this.moveHour(this.date,dir*6);newViewDate=this.moveHour(this.viewDate,dir*6)}else{newDate=this.moveHour(this.date,dir*4);newViewDate=this.moveHour(this.viewDate,dir*4)}}else{if(viewMode===0){newDate=this.moveMinute(this.date,dir*4);newViewDate=this.moveMinute(this.viewDate,dir*4)}}}}}if(this.dateWithinRange(newDate)){this.date=newDate;this.viewDate=newViewDate;this.setValue();this.update();e.preventDefault();dateChanged=true}break;case 13:if(this.viewMode!==0){var oldViewMode=this.viewMode;this.showMode(-1);this.fill();if(oldViewMode===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}e.preventDefault();break;case 9:this.hide();break}if(dateChanged){var element;if(this.isInput){element=this.element}else{if(this.component){element=this.element.find("input")}}if(element){element.change()}this.element.trigger({type:"changeDate",date:this.getDate()})}},showMode:function(dir){if(dir){var newViewMode=Math.max(0,Math.min(DPGlobal.modes.length-1,this.viewMode+dir));if(newViewMode>=this.minView&&newViewMode<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:newViewMode});this.viewMode=newViewMode}}this.picker.find(">div").hide().filter(".datetimepicker-"+DPGlobal.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(){this._setDate(null,"date")},convertViewModeText:function(viewMode){switch(viewMode){case 4:return"decade";case 3:return"year";case 2:return"month";case 1:return"day";case 0:return"hour"}}};var old=$.fn.datetimepicker;$.fn.datetimepicker=function(option){var args=Array.apply(null,arguments);args.shift();var internal_return;this.each(function(){var $this=$(this),data=$this.data("datetimepicker"),options=typeof option==="object"&&option;if(!data){$this.data("datetimepicker",(data=new Datetimepicker(this,$.extend({},$.fn.datetimepicker.defaults,options))))}if(typeof option==="string"&&typeof data[option]==="function"){internal_return=data[option].apply(data,args);if(internal_return!==undefined){return false}}});if(internal_return!==undefined){return internal_return}else{return this}};$.fn.datetimepicker.defaults={};$.fn.datetimepicker.Constructor=Datetimepicker;var dates=$.fn.datetimepicker.dates={"zh-cn":{days:["星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日"],daysShort:["周日","周一","周二","周三","周四","周五","周六","周日"],daysMin:["日","一","二","三","四","五","六","日"],months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],meridiem:["上午","下午"],suffix:["st","nd","rd","th"],today:"今天",clear:"清除"},en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today",clear:"Clear"}};var DPGlobal={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0))},getDaysInMonth:function(year,month){return[31,(DPGlobal.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month]},getDefaultFormat:function(type,field){if(type==="standard"){if(field==="input"){return"yyyy-mm-dd hh:ii"}else{return"yyyy-mm-dd hh:ii:ss"}}else{if(type==="php"){if(field==="input"){return"Y-m-d H:i"}else{return"Y-m-d H:i:s"}}else{throw new Error("Invalid format type.")}}},validParts:function(type){if(type==="standard"){return/t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else{if(type==="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(format,type){var separators=format.replace(this.validParts(type),"\0").split("\0"),parts=format.match(this.validParts(type));if(!separators||!separators.length||!parts||parts.length===0){throw new Error("Invalid date format.")}return{separators:separators,parts:parts}},parseDate:function(date,format,language,type,timezone){if(date instanceof Date){var dateUTC=new Date(date.valueOf()-date.getTimezoneOffset()*60000);dateUTC.setMilliseconds(0);return dateUTC}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(date)){format=this.parseFormat("yyyy-mm-dd",type)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(date)){format=this.parseFormat("yyyy-mm-dd hh:ii",type)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(date)){format=this.parseFormat("yyyy-mm-dd hh:ii:ss",type)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)){var part_re=/([-+]\d+)([dmwy])/,parts=date.match(/([-+]\d+)([dmwy])/g),part,dir;date=new Date();for(var i=0;i"+""+''+''+''+""+"",headTemplateV3:""+""+' '+''+' '+""+"",contTemplate:'',footTemplate:""+''+''+""};DPGlobal.template='
    '+'
    '+''+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplate+""+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplate+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+"
    ";DPGlobal.templateV3='
    '+'
    '+''+DPGlobal.headTemplateV3+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplateV3+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplateV3+""+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplateV3+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+'
    '+''+DPGlobal.headTemplateV3+DPGlobal.contTemplate+DPGlobal.footTemplate+"
    "+"
    "+"
    ";$.fn.datetimepicker.DPGlobal=DPGlobal;$.fn.datetimepicker.noConflict=function(){$.fn.datetimepicker=old;return this};$(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(e){var $this=$(this);if($this.data("datetimepicker")){return}e.preventDefault();$this.datetimepicker("show")});$(function(){$('[data-provide="datetimepicker-inline"]').datetimepicker()})})); \ No newline at end of file From e34b4ea63dace1ab59a8b1a6ab503e1f530e1133 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 13 Mar 2019 19:45:12 +0800 Subject: [PATCH 56/89] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B9=B6=E5=8F=91=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/common/config/Global.java | 11 +- .../common/constant/ScheduleConstants.java | 5 +- .../com/ruoyi/common/json/JSONObject.java | 3 + .../com/ruoyi/common/utils/ExceptionUtil.java | 41 +++++ .../java/com/ruoyi/common/utils/YamlUtil.java | 2 +- .../com/ruoyi/common/utils/poi/ExcelUtil.java | 2 + .../quartz/controller/SysJobController.java | 29 ++-- .../java/com/ruoyi/quartz/domain/SysJob.java | 18 +- .../com/ruoyi/quartz/domain/SysJobLog.java | 33 +++- .../ruoyi/quartz/service/ISysJobService.java | 20 ++- .../service/impl/SysJobServiceImpl.java | 26 +-- .../ruoyi/quartz/util/AbstractQuartzJob.java | 108 ++++++++++++ .../com/ruoyi/quartz/util/JobInvokeUtil.java | 57 ++++++ .../QuartzDisallowConcurrentExecution.java | 21 +++ .../ruoyi/quartz/util/QuartzJobExecution.java | 19 ++ .../com/ruoyi/quartz/util/ScheduleJob.java | 80 --------- .../ruoyi/quartz/util/ScheduleRunnable.java | 57 ------ .../com/ruoyi/quartz/util/ScheduleUtils.java | 164 +++++++----------- .../resources/mapper/quartz/SysJobMapper.xml | 6 +- .../resources/templates/monitor/job/add.html | 7 + .../templates/monitor/job/detail.html | 5 + .../resources/templates/monitor/job/edit.html | 7 + .../resources/templates/monitor/job/job.html | 4 +- sql/{ry_20190215.sql => ry_20190313.sql} | 5 +- 24 files changed, 430 insertions(+), 300 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java create mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java create mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java create mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java create mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java delete mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java delete mode 100644 ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java rename sql/{ry_20190215.sql => ry_20190313.sql} (98%) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java index 2455b1dcc..3b09d457c 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/Global.java @@ -22,7 +22,7 @@ public class Global /** * 当前对象实例 */ - private static Global global = null; + private static Global global; /** * 保存全局属性值 @@ -34,18 +34,13 @@ public class Global } /** - * 静态工厂方法 获取当前对象实例 多线程安全单例模式(使用双重同步锁) + * 静态工厂方法 */ - public static synchronized Global getInstance() { if (global == null) { - synchronized (Global.class) - { - if (global == null) - global = new Global(); - } + global = new Global(); } return global; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java index c2701f7d4..b82036666 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/ScheduleConstants.java @@ -7,9 +7,10 @@ package com.ruoyi.common.constant; */ public interface ScheduleConstants { - public static final String TASK_CLASS_NAME = "__TASK_CLASS_NAME__"; + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; - public static final String TASK_PROPERTIES = "__TASK_PROPERTIES__"; + /** 执行目标key */ + public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; /** 默认 */ public static final String MISFIRE_DEFAULT = "0"; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java index e4c27a4d0..24ef6ccb7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/json/JSONObject.java @@ -223,6 +223,7 @@ public class JSONObject extends LinkedHashMap { return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() { + @Override public Object callback(JSONArray arr, int index) { return elementAt(arr, index); @@ -257,6 +258,7 @@ public class JSONObject extends LinkedHashMap { endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() { + @Override public Void callback(JSONArray arr, int index) { elementAt(arr, index, value); @@ -285,6 +287,7 @@ public class JSONObject extends LinkedHashMap { return endArray(matcher.group(1), matcher.group(2), new EndArrayCallback() { + @Override public JSONObject callback(JSONArray arr, int index) { return objAt(arr, index); diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java new file mode 100644 index 000000000..5ca4cb85d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java @@ -0,0 +1,41 @@ +package com.ruoyi.common.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import org.apache.commons.lang3.exception.ExceptionUtils; + +/** + * 错误信息处理类。 + * + * @author ruoyi + */ +public class ExceptionUtil +{ + + /** + * 获取exception的详细错误信息。 + */ + public static String getExceptionMessage(Throwable e) + { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw, true)); + String str = sw.toString(); + return str; + } + + public static String getRootErrorMseeage(Exception e) + { + Throwable root = ExceptionUtils.getRootCause(e); + root = (root == null ? e : root); + if (root == null) + { + return ""; + } + String msg = root.getMessage(); + if (msg == null) + { + return "null"; + } + return StringUtils.defaultString(msg); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/YamlUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/YamlUtil.java index e8e05b5fd..bb8a4ed68 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/YamlUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/YamlUtil.java @@ -40,7 +40,7 @@ public class YamlUtil if (map != null && !map.isEmpty() && qualifiedKey != null) { String input = String.valueOf(qualifiedKey); - if (!input.equals("")) + if (!"".equals(input)) { if (input.contains(".")) { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index a727aec98..ff5c45ad4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -647,7 +647,9 @@ public class ExcelUtil { tempClass = tempClass.getSuperclass(); if (tempClass != null) + { tempFields.addAll(Arrays.asList(tempClass.getDeclaredFields())); + } } putToFields(tempFields); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index 1e5344001..3318f72a6 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -2,6 +2,7 @@ package com.ruoyi.quartz.controller; import java.util.List; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.quartz.SchedulerException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -15,6 +16,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.service.ISysJobService; @@ -65,18 +67,10 @@ public class SysJobController extends BaseController @RequiresPermissions("monitor:job:remove") @PostMapping("/remove") @ResponseBody - public AjaxResult remove(String ids) + public AjaxResult remove(String ids) throws SchedulerException { - try - { - jobService.deleteJobByIds(ids); - return success(); - } - catch (Exception e) - { - e.printStackTrace(); - return error(e.getMessage()); - } + jobService.deleteJobByIds(ids); + return success(); } @RequiresPermissions("monitor:job:detail") @@ -90,14 +84,12 @@ public class SysJobController extends BaseController /** * 任务调度状态修改 - * - * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:changeStatus") @PostMapping("/changeStatus") @ResponseBody - public AjaxResult changeStatus(SysJob job) + public AjaxResult changeStatus(SysJob job) throws SchedulerException { return toAjax(jobService.changeStatus(job)); } @@ -109,9 +101,10 @@ public class SysJobController extends BaseController @RequiresPermissions("monitor:job:changeStatus") @PostMapping("/run") @ResponseBody - public AjaxResult run(SysJob job) + public AjaxResult run(SysJob job) throws SchedulerException { - return toAjax(jobService.run(job)); + jobService.run(job); + return success(); } /** @@ -125,7 +118,6 @@ public class SysJobController extends BaseController /** * 新增保存调度 - * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.INSERT) @RequiresPermissions("monitor:job:add") @@ -148,13 +140,12 @@ public class SysJobController extends BaseController /** * 修改保存调度 - * @throws Exception */ @Log(title = "定时任务", businessType = BusinessType.UPDATE) @RequiresPermissions("monitor:job:edit") @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(SysJob job ) throws Exception + public AjaxResult editSave(SysJob job) throws SchedulerException, TaskException { return toAjax(jobService.updateJobCron(job)); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index 807c85ea0..be66d2e32 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -47,6 +47,9 @@ public class SysJob extends BaseEntity implements Serializable @Excel(name = "计划策略 ") private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; + /** 是否并发执行(0允许 1禁止) */ + private String concurrent; + /** 任务状态(0正常 1暂停) */ @Excel(name = "任务状态", readConverterExp = "0=正常,1=暂停") private String status; @@ -130,6 +133,16 @@ public class SysJob extends BaseEntity implements Serializable this.misfirePolicy = misfirePolicy; } + public String getConcurrent() + { + return concurrent; + } + + public void setConcurrent(String concurrent) + { + this.concurrent = concurrent; + } + public String getStatus() { return status; @@ -139,7 +152,7 @@ public class SysJob extends BaseEntity implements Serializable { this.status = status; } - + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -151,6 +164,7 @@ public class SysJob extends BaseEntity implements Serializable .append("cronExpression", getCronExpression()) .append("nextValidTime", getNextValidTime()) .append("misfirePolicy", getMisfirePolicy()) + .append("concurrent", getConcurrent()) .append("status", getStatus()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) @@ -159,4 +173,4 @@ public class SysJob extends BaseEntity implements Serializable .append("remark", getRemark()) .toString(); } -} +} \ No newline at end of file diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java index dc2cff48f..290b34938 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java @@ -1,7 +1,9 @@ package com.ruoyi.quartz.domain; +import java.util.Date; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; @@ -46,6 +48,14 @@ public class SysJobLog extends BaseEntity @Excel(name = "异常信息") private String exceptionInfo; + /** 开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + /** 结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + public Long getJobLogId() { return jobLogId; @@ -125,6 +135,26 @@ public class SysJobLog extends BaseEntity { this.exceptionInfo = exceptionInfo; } + + public Date getStartTime() + { + return startTime; + } + + public void setStartTime(Date startTime) + { + this.startTime = startTime; + } + + public Date getEndTime() + { + return endTime; + } + + public void setEndTime(Date endTime) + { + this.endTime = endTime; + } @Override public String toString() { @@ -137,7 +167,8 @@ public class SysJobLog extends BaseEntity .append("jobMessage", getJobMessage()) .append("status", getStatus()) .append("exceptionInfo", getExceptionInfo()) - .append("createTime", getCreateTime()) + .append("startTime", getStartTime()) + .append("endTime", getEndTime()) .toString(); } } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java index 0cf3a000b..1e94f5ec6 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/ISysJobService.java @@ -1,6 +1,8 @@ package com.ruoyi.quartz.service; import java.util.List; +import org.quartz.SchedulerException; +import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.quartz.domain.SysJob; /** @@ -32,7 +34,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int pauseJob(SysJob job); + public int pauseJob(SysJob job) throws SchedulerException; /** * 恢复任务 @@ -40,7 +42,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int resumeJob(SysJob job); + public int resumeJob(SysJob job) throws SchedulerException; /** * 删除任务后,所对应的trigger也将被删除 @@ -48,7 +50,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int deleteJob(SysJob job); + public int deleteJob(SysJob job) throws SchedulerException; /** * 批量删除调度信息 @@ -56,7 +58,7 @@ public interface ISysJobService * @param ids 需要删除的数据ID * @return 结果 */ - public void deleteJobByIds(String ids); + public void deleteJobByIds(String ids) throws SchedulerException; /** * 任务调度状态修改 @@ -64,7 +66,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int changeStatus(SysJob job); + public int changeStatus(SysJob job) throws SchedulerException; /** * 立即运行任务 @@ -72,7 +74,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int run(SysJob job); + public void run(SysJob job) throws SchedulerException; /** * 新增任务表达式 @@ -80,7 +82,7 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int insertJobCron(SysJob job); + public int insertJobCron(SysJob job) throws SchedulerException, TaskException; /** * 更新任务的时间表达式 @@ -88,8 +90,8 @@ public interface ISysJobService * @param job 调度信息 * @return 结果 */ - public int updateJobCron(SysJob job); - + public int updateJobCron(SysJob job) throws SchedulerException, TaskException; + /** * 校验cron表达式是否有效 * diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java index 8b1bc54e9..c024fec66 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java @@ -4,11 +4,13 @@ import java.util.List; import javax.annotation.PostConstruct; import org.quartz.CronTrigger; import org.quartz.Scheduler; +import org.quartz.SchedulerException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.constant.ScheduleConstants; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.exception.job.TaskException; import com.ruoyi.quartz.domain.SysJob; import com.ruoyi.quartz.mapper.SysJobMapper; import com.ruoyi.quartz.service.ISysJobService; @@ -33,7 +35,7 @@ public class SysJobServiceImpl implements ISysJobService * 项目启动时,初始化定时器 */ @PostConstruct - public void init() + public void init() throws SchedulerException, TaskException { List jobList = jobMapper.selectJobAll(); for (SysJob job : jobList) @@ -82,7 +84,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int pauseJob(SysJob job) + public int pauseJob(SysJob job) throws SchedulerException { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); int rows = jobMapper.updateJob(job); @@ -100,7 +102,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int resumeJob(SysJob job) + public int resumeJob(SysJob job) throws SchedulerException { job.setStatus(ScheduleConstants.Status.NORMAL.getValue()); int rows = jobMapper.updateJob(job); @@ -118,7 +120,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int deleteJob(SysJob job) + public int deleteJob(SysJob job) throws SchedulerException { int rows = jobMapper.deleteJobById(job.getJobId()); if (rows > 0) @@ -136,7 +138,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public void deleteJobByIds(String ids) + public void deleteJobByIds(String ids) throws SchedulerException { Long[] jobIds = Convert.toLongArray(ids); for (Long jobId : jobIds) @@ -153,7 +155,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int changeStatus(SysJob job) + public int changeStatus(SysJob job) throws SchedulerException { int rows = 0; String status = job.getStatus(); @@ -175,9 +177,9 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int run(SysJob job) + public void run(SysJob job) throws SchedulerException { - return ScheduleUtils.run(scheduler, selectJobById(job.getJobId())); + ScheduleUtils.run(scheduler, selectJobById(job.getJobId())); } /** @@ -187,7 +189,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int insertJobCron(SysJob job) + public int insertJobCron(SysJob job) throws SchedulerException, TaskException { job.setStatus(ScheduleConstants.Status.PAUSE.getValue()); int rows = jobMapper.insertJob(job); @@ -205,7 +207,7 @@ public class SysJobServiceImpl implements ISysJobService */ @Override @Transactional - public int updateJobCron(SysJob job) + public int updateJobCron(SysJob job) throws SchedulerException, TaskException { int rows = jobMapper.updateJob(job); if (rows > 0) @@ -214,7 +216,7 @@ public class SysJobServiceImpl implements ISysJobService } return rows; } - + /** * 校验cron表达式是否有效 * @@ -225,5 +227,5 @@ public class SysJobServiceImpl implements ISysJobService public boolean checkCronExpressionIsValid(String cronExpression) { return CronUtils.isValid(cronExpression); - } + } } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java new file mode 100644 index 000000000..7cd0893e7 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/AbstractQuartzJob.java @@ -0,0 +1,108 @@ +package com.ruoyi.quartz.util; + +import java.util.Date; +import org.quartz.Job; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.constant.ScheduleConstants; +import com.ruoyi.common.utils.ExceptionUtil; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.quartz.domain.SysJob; +import com.ruoyi.quartz.domain.SysJobLog; +import com.ruoyi.quartz.service.ISysJobLogService; + +/** + * 抽象quartz调用 + * + * @author ruoyi + */ +public abstract class AbstractQuartzJob implements Job +{ + private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class); + + /** + * 线程本地变量 + */ + private static ThreadLocal threadLocal = new ThreadLocal<>(); + + @Override + public void execute(JobExecutionContext context) throws JobExecutionException + { + SysJob sysJob = new SysJob(); + BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); + try + { + before(context, sysJob); + if (sysJob != null) + { + doExecute(context, sysJob); + } + after(context, sysJob, null); + } + catch (Exception e) + { + log.error("任务执行异常 - :", e); + after(context, sysJob, e); + } + } + + /** + * 执行前 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + */ + protected void before(JobExecutionContext context, SysJob sysJob) + { + threadLocal.set(new Date()); + } + + /** + * 执行后 + * + * @param context 工作执行上下文对象 + * @param sysScheduleJob 系统计划任务 + */ + protected void after(JobExecutionContext context, SysJob sysJob, Exception e) + { + Date startTime = threadLocal.get(); + threadLocal.remove(); + + final SysJobLog sysJobLog = new SysJobLog(); + sysJobLog.setJobName(sysJob.getJobName()); + sysJobLog.setJobGroup(sysJob.getJobGroup()); + sysJobLog.setMethodName(sysJob.getMethodName()); + sysJobLog.setMethodParams(sysJob.getMethodParams()); + sysJobLog.setStartTime(startTime); + sysJobLog.setEndTime(new Date()); + long runMs = sysJobLog.getEndTime().getTime() - sysJobLog.getStartTime().getTime(); + sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒"); + if (e != null) + { + sysJobLog.setStatus(Constants.FAIL); + String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000); + sysJobLog.setExceptionInfo(errorMsg); + } + else + { + sysJobLog.setStatus(Constants.SUCCESS); + } + + // 写入数据库当中 + SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog); + } + + /** + * 执行方法,由子类重载 + * + * @param context 工作执行上下文对象 + * @param sysJob 系统计划任务 + * @throws Exception 执行过程中的异常 + */ + protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception; +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java new file mode 100644 index 000000000..3a867404b --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java @@ -0,0 +1,57 @@ +package com.ruoyi.quartz.util; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 任务执行工具 + * + * @author ruoyi + */ +public class JobInvokeUtil +{ + /** + * 执行方法 + * + * @param sysJob 系统任务 + */ + public static void invokeMethod(SysJob sysJob) throws Exception + { + Object bean = SpringUtils.getBean(sysJob.getJobName()); + String methodName = sysJob.getMethodName(); + String methodParams = sysJob.getMethodParams(); + + invokeSpringBean(bean, methodName, methodParams); + } + + /** + * 调用任务方法 + * + * @param bean 目标对象 + * @param methodName 方法名称 + * @param methodParams 方法参数 + * @throws InvocationTargetException + * @throws SecurityException + * @throws NoSuchMethodException + * @throws IllegalArgumentException + * @throws IllegalAccessException + */ + private static void invokeSpringBean(Object bean, String methodName, String methodParams) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException + { + if (StringUtils.isNotEmpty(methodParams)) + { + Method method = bean.getClass().getDeclaredMethod(methodName, String.class); + method.invoke(bean, methodParams); + } + else + { + Method method = bean.getClass().getDeclaredMethod(methodName); + method.invoke(bean); + } + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java new file mode 100644 index 000000000..96a6dcf8e --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java @@ -0,0 +1,21 @@ +package com.ruoyi.quartz.util; + +import org.quartz.DisallowConcurrentExecution; +import org.quartz.JobExecutionContext; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务处理(禁止并发执行) + * + * @author ruoyi + * + */ +@DisallowConcurrentExecution +public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java new file mode 100644 index 000000000..87a06bc13 --- /dev/null +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java @@ -0,0 +1,19 @@ +package com.ruoyi.quartz.util; + +import org.quartz.JobExecutionContext; +import com.ruoyi.quartz.domain.SysJob; + +/** + * 定时任务处理(允许并发执行) + * + * @author ruoyi + * + */ +public class QuartzJobExecution extends AbstractQuartzJob +{ + @Override + protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception + { + JobInvokeUtil.invokeMethod(sysJob); + } +} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java deleted file mode 100644 index 9b606bc5f..000000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleJob.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.ruoyi.quartz.util; - -import java.util.Date; -import java.util.concurrent.Future; -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.scheduling.quartz.QuartzJobBean; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.ScheduleConstants; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.bean.BeanUtils; -import com.ruoyi.common.utils.spring.SpringUtils; -import com.ruoyi.quartz.domain.SysJob; -import com.ruoyi.quartz.domain.SysJobLog; -import com.ruoyi.quartz.service.ISysJobLogService; - -/** - * 定时任务处理 - * - * @author ruoyi - * - */ -@DisallowConcurrentExecution -public class ScheduleJob extends QuartzJobBean -{ - private static final Logger log = LoggerFactory.getLogger(ScheduleJob.class); - - private ThreadPoolTaskExecutor executor = SpringUtils.getBean("threadPoolTaskExecutor"); - - private final static ISysJobLogService jobLogService = SpringUtils.getBean(ISysJobLogService.class); - - @Override - protected void executeInternal(JobExecutionContext context) throws JobExecutionException - { - SysJob job = new SysJob(); - BeanUtils.copyBeanProp(job, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES)); - - SysJobLog jobLog = new SysJobLog(); - jobLog.setJobName(job.getJobName()); - jobLog.setJobGroup(job.getJobGroup()); - jobLog.setMethodName(job.getMethodName()); - jobLog.setMethodParams(job.getMethodParams()); - jobLog.setCreateTime(new Date()); - - long startTime = System.currentTimeMillis(); - - try - { - // 执行任务 - log.info("任务开始执行 - 名称:{} 方法:{}", job.getJobName(), job.getMethodName()); - ScheduleRunnable task = new ScheduleRunnable(job.getJobName(), job.getMethodName(), job.getMethodParams()); - Future future = executor.submit(task); - future.get(); - long times = System.currentTimeMillis() - startTime; - // 任务状态 0:成功 1:失败 - jobLog.setStatus(Constants.SUCCESS); - jobLog.setJobMessage(job.getJobName() + " 总共耗时:" + times + "毫秒"); - - log.info("任务执行结束 - 名称:{} 耗时:{} 毫秒", job.getJobName(), times); - } - catch (Exception e) - { - log.info("任务执行失败 - 名称:{} 方法:{}", job.getJobName(), job.getMethodName()); - log.error("任务执行异常 - :", e); - long times = System.currentTimeMillis() - startTime; - jobLog.setJobMessage(job.getJobName() + " 总共耗时:" + times + "毫秒"); - // 任务状态 0:成功 1:失败 - jobLog.setStatus(Constants.FAIL); - jobLog.setExceptionInfo(StringUtils.substring(e.getMessage(), 0, 2000)); - } - finally - { - jobLogService.addJobLog(jobLog); - } - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java deleted file mode 100644 index b890649a9..000000000 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleRunnable.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.ruoyi.quartz.util; - -import java.lang.reflect.Method; -import org.springframework.util.ReflectionUtils; -import com.ruoyi.common.exception.BusinessException; -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.spring.SpringUtils; - -/** - * 执行定时任务 - * - * @author ruoyi - * - */ -public class ScheduleRunnable implements Runnable -{ - private Object target; - private Method method; - private String params; - - public ScheduleRunnable(String beanName, String methodName, String params) - throws NoSuchMethodException, SecurityException - { - this.target = SpringUtils.getBean(beanName); - this.params = params; - - if (StringUtils.isNotEmpty(params)) - { - this.method = target.getClass().getDeclaredMethod(methodName, String.class); - } - else - { - this.method = target.getClass().getDeclaredMethod(methodName); - } - } - - @Override - public void run() - { - try - { - ReflectionUtils.makeAccessible(method); - if (StringUtils.isNotEmpty(params)) - { - method.invoke(target, params); - } - else - { - method.invoke(target); - } - } - catch (Exception e) - { - throw new BusinessException("执行定时任务失败", e); - } - } -} diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java index 9a6b9ca68..4bfa85c0b 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/ScheduleUtils.java @@ -2,6 +2,7 @@ package com.ruoyi.quartz.util; import org.quartz.CronScheduleBuilder; import org.quartz.CronTrigger; +import org.quartz.Job; import org.quartz.JobBuilder; import org.quartz.JobDataMap; import org.quartz.JobDetail; @@ -27,6 +28,18 @@ public class ScheduleUtils { private static final Logger log = LoggerFactory.getLogger(ScheduleUtils.class); + /** + * 得到quartz任务类 + * + * @param sysJob 执行计划 + * @return 具体执行任务类 + */ + private static Class getQuartzJobClass(SysJob sysJob) + { + boolean isConcurrent = "0".equals(sysJob.getConcurrent()); + return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; + } + /** * 获取触发器key */ @@ -62,147 +75,89 @@ public class ScheduleUtils /** * 创建定时任务 */ - public static void createScheduleJob(Scheduler scheduler, SysJob job) + public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException { - try + Class jobClass = getQuartzJobClass(job); + // 构建job信息 + JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(job.getJobId())).build(); + + // 表达式调度构建器 + CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); + cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); + + // 按新的cronExpression表达式构建一个新的trigger + CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId())) + .withSchedule(cronScheduleBuilder).build(); + + // 放入参数,运行时的方法可以获取 + jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); + + scheduler.scheduleJob(jobDetail, trigger); + + // 暂停任务 + if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) { - // 构建job信息 - JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(job.getJobId())).build(); - - // 表达式调度构建器 - CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); - cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); - - // 按新的cronExpression表达式构建一个新的trigger - CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(job.getJobId())) - .withSchedule(cronScheduleBuilder).build(); - - // 放入参数,运行时的方法可以获取 - jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); - - scheduler.scheduleJob(jobDetail, trigger); - - // 暂停任务 - if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) - { - pauseJob(scheduler, job.getJobId()); - } - } - catch (SchedulerException e) - { - log.error("createScheduleJob 异常:", e); - } - catch (TaskException e) - { - log.error("createScheduleJob 异常:", e); + pauseJob(scheduler, job.getJobId()); } } /** * 更新定时任务 */ - public static void updateScheduleJob(Scheduler scheduler, SysJob job) + public static void updateScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException { - try + JobKey jobKey = getJobKey(job.getJobId()); + + // 判断是否存在 + if (scheduler.checkExists(jobKey)) { - TriggerKey triggerKey = getTriggerKey(job.getJobId()); - - // 表达式调度构建器 - CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression()); - cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder); - - CronTrigger trigger = getCronTrigger(scheduler, job.getJobId()); - - // 按新的cronExpression表达式重新构建trigger - trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(cronScheduleBuilder).build(); - - // 参数 - trigger.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job); - - scheduler.rescheduleJob(triggerKey, trigger); - - // 暂停任务 - if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) - { - pauseJob(scheduler, job.getJobId()); - } - + // 先移除,然后做更新操作 + scheduler.deleteJob(jobKey); } - catch (SchedulerException e) + + createScheduleJob(scheduler, job); + + // 暂停任务 + if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) { - log.error("SchedulerException 异常:", e); - } - catch (TaskException e) - { - log.error("SchedulerException 异常:", e); + pauseJob(scheduler, job.getJobId()); } } /** * 立即执行任务 */ - public static int run(Scheduler scheduler, SysJob job) + public static void run(Scheduler scheduler, SysJob job) throws SchedulerException { - int rows = 0; - try - { - // 参数 - JobDataMap dataMap = new JobDataMap(); - dataMap.put(ScheduleConstants.TASK_PROPERTIES, job); + // 参数 + JobDataMap dataMap = new JobDataMap(); + dataMap.put(ScheduleConstants.TASK_PROPERTIES, job); - scheduler.triggerJob(getJobKey(job.getJobId()), dataMap); - rows = 1; - } - catch (SchedulerException e) - { - log.error("run 异常:", e); - } - return rows; + scheduler.triggerJob(getJobKey(job.getJobId()), dataMap); } /** * 暂停任务 */ - public static void pauseJob(Scheduler scheduler, Long jobId) + public static void pauseJob(Scheduler scheduler, Long jobId) throws SchedulerException { - try - { - scheduler.pauseJob(getJobKey(jobId)); - } - catch (SchedulerException e) - { - log.error("pauseJob 异常:", e); - } + scheduler.pauseJob(getJobKey(jobId)); } /** * 恢复任务 */ - public static void resumeJob(Scheduler scheduler, Long jobId) + public static void resumeJob(Scheduler scheduler, Long jobId) throws SchedulerException { - try - { - scheduler.resumeJob(getJobKey(jobId)); - } - catch (SchedulerException e) - { - log.error("resumeJob 异常:", e); - } + scheduler.resumeJob(getJobKey(jobId)); } /** * 删除定时任务 */ - public static void deleteScheduleJob(Scheduler scheduler, Long jobId) + public static void deleteScheduleJob(Scheduler scheduler, Long jobId) throws SchedulerException { - try - { - scheduler.deleteJob(getJobKey(jobId)); - } - catch (SchedulerException e) - { - log.error("deleteScheduleJob 异常:", e); - } + scheduler.deleteJob(getJobKey(jobId)); } public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb) @@ -219,7 +174,8 @@ public class ScheduleUtils case ScheduleConstants.MISFIRE_DO_NOTHING: return cb.withMisfireHandlingInstructionDoNothing(); default: - throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); + throw new TaskException("The task misfire policy '" + job.getMisfirePolicy() + + "' cannot be used in cron schedule tasks", Code.CONFIG_ERROR); } } } diff --git a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml index 758dbb3a5..0e4a6a748 100644 --- a/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml +++ b/ruoyi-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml @@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select job_id, job_name, job_group, method_name, method_params, cron_expression, misfire_policy, status, create_by, create_time, remark + select job_id, job_name, job_group, method_name, method_params, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark from sys_job @@ -69,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" method_params = #{methodParams}, cron_expression = #{cronExpression}, misfire_policy = #{misfirePolicy}, + concurrent = #{concurrent}, status = #{status}, remark = #{remark}, update_by = #{updateBy}, @@ -86,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" method_params, cron_expression, misfire_policy, + concurrent, status, remark, create_by, @@ -98,6 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{methodParams}, #{cronExpression}, #{misfirePolicy}, + #{concurrent}, #{status}, #{remark}, #{createBy}, diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/add.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/add.html index d78f6f50c..e8b5e6258 100644 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/add.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/add.html @@ -43,6 +43,13 @@ +
    + +
    + + +
    +
    diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html index f75d8b7be..1e0f5491a 100644 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/detail.html @@ -82,6 +82,11 @@
    执行一次
    放弃执行
    +
    + +
    +
    +
    diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html index 02bc33273..3497d1402 100644 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/edit.html @@ -44,6 +44,13 @@
    +
    + +
    + + +
    +
    diff --git a/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html b/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html index 9194ad418..b2b1b0fea 100644 --- a/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html +++ b/ruoyi-quartz/src/main/resources/templates/monitor/job/job.html @@ -122,7 +122,7 @@ align: 'center', formatter: function(value, row, index) { var actions = []; - actions.push(' 执行 '); + actions.push(' 执行一次 '); actions.push('详细 '); return actions.join(''); } @@ -142,7 +142,7 @@ /* 立即执行一次 */ function run(jobId) { - $.modal.confirm("确认要立即执行任务吗?", function() { + $.modal.confirm("确认要立即执行一次任务吗?", function() { $.operate.post(prefix + "/run", { "jobId": jobId}); }) } diff --git a/sql/ry_20190215.sql b/sql/ry_20190313.sql similarity index 98% rename from sql/ry_20190215.sql rename to sql/ry_20190313.sql index 49d5541b3..e6ee374a0 100644 --- a/sql/ry_20190215.sql +++ b/sql/ry_20190313.sql @@ -568,6 +568,7 @@ create table sys_job ( method_params varchar(50) default null comment '方法参数', cron_expression varchar(255) default '' comment 'cron执行表达式', misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', + concurrent char default '1' comment '是否并发执行(0允许 1禁止)', status char(1) default '0' comment '状态(0正常 1暂停)', create_by varchar(64) default '' comment '创建者', create_time datetime comment '创建时间', @@ -577,8 +578,8 @@ create table sys_job ( primary key (job_id, job_name, job_group) ) engine=innodb auto_increment=100 default charset=utf8 comment = '定时任务调度表'; -insert into sys_job values(1, 'ryTask', '系统默认(无参)', 'ryNoParams', '', '0/10 * * * * ?', '3', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -insert into sys_job values(2, 'ryTask', '系统默认(有参)', 'ryParams', 'ry', '0/20 * * * * ?', '3', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_job values(1, 'ryTask', '系统默认(无参)', 'ryNoParams', '', '0/10 * * * * ?', '3', '1', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); +insert into sys_job values(2, 'ryTask', '系统默认(有参)', 'ryParams', 'ry', '0/20 * * * * ?', '3', '1', '1', 'admin', '2018-03-16 11-33-00', 'ry', '2018-03-16 11-33-00', ''); -- ---------------------------- From 47f5d7a7b711b2433bf031e0970484f816796012 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 13 Mar 2019 20:24:12 +0800 Subject: [PATCH 57/89] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=A2=9E=E5=8A=A0=E5=B9=B6=E5=8F=91=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/common/utils/ExceptionUtil.java | 1 - .../java/com/ruoyi/quartz/controller/SysJobController.java | 2 +- .../src/main/java/com/ruoyi/quartz/domain/SysJob.java | 1 + .../src/main/java/com/ruoyi/quartz/domain/SysJobLog.java | 3 --- .../src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java | 5 ----- sql/ry_20190313.sql | 4 ++-- 6 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java index 5ca4cb85d..4ca52838a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ExceptionUtil.java @@ -11,7 +11,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils; */ public class ExceptionUtil { - /** * 获取exception的详细错误信息。 */ diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java index 3318f72a6..1fb405956 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java @@ -123,7 +123,7 @@ public class SysJobController extends BaseController @RequiresPermissions("monitor:job:add") @PostMapping("/add") @ResponseBody - public AjaxResult addSave(SysJob job) throws Exception + public AjaxResult addSave(SysJob job) throws SchedulerException, TaskException { return toAjax(jobService.insertJobCron(job)); } diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index be66d2e32..de10afd82 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -48,6 +48,7 @@ public class SysJob extends BaseEntity implements Serializable private String misfirePolicy = ScheduleConstants.MISFIRE_DEFAULT; /** 是否并发执行(0允许 1禁止) */ + @Excel(name = "并发执行", readConverterExp = "0=允许,1=禁止") private String concurrent; /** 任务状态(0正常 1暂停) */ diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java index 290b34938..9356629c4 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJobLog.java @@ -3,7 +3,6 @@ package com.ruoyi.quartz.domain; import java.util.Date; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; @@ -49,11 +48,9 @@ public class SysJobLog extends BaseEntity private String exceptionInfo; /** 开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; /** 结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; public Long getJobLogId() diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java index 3a867404b..c126951da 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java @@ -33,11 +33,6 @@ public class JobInvokeUtil * @param bean 目标对象 * @param methodName 方法名称 * @param methodParams 方法参数 - * @throws InvocationTargetException - * @throws SecurityException - * @throws NoSuchMethodException - * @throws IllegalArgumentException - * @throws IllegalAccessException */ private static void invokeSpringBean(Object bean, String methodName, String methodParams) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, diff --git a/sql/ry_20190313.sql b/sql/ry_20190313.sql index e6ee374a0..13750c577 100644 --- a/sql/ry_20190313.sql +++ b/sql/ry_20190313.sql @@ -406,7 +406,7 @@ create table sys_oper_log ( oper_url varchar(255) default '' comment '请求URL', oper_ip varchar(50) default '' comment '主机地址', oper_location varchar(255) default '' comment '操作地点', - oper_param varchar(255) default '' comment '请求参数', + oper_param varchar(2000) default '' comment '请求参数', status int(1) default 0 comment '操作状态(0正常 1异常)', error_msg varchar(2000) default '' comment '错误消息', oper_time datetime comment '操作时间', @@ -568,7 +568,7 @@ create table sys_job ( method_params varchar(50) default null comment '方法参数', cron_expression varchar(255) default '' comment 'cron执行表达式', misfire_policy varchar(20) default '3' comment '计划执行错误策略(1立即执行 2执行一次 3放弃执行)', - concurrent char default '1' comment '是否并发执行(0允许 1禁止)', + concurrent char(1) default '1' comment '是否并发执行(0允许 1禁止)', status char(1) default '0' comment '状态(0正常 1暂停)', create_by varchar(64) default '' comment '创建者', create_time datetime comment '创建时间', From c9dad631df11c01d687e23e9860998f31ad0d182 Mon Sep 17 00:00:00 2001 From: geekymv Date: Wed, 13 Mar 2019 22:14:03 +0800 Subject: [PATCH 58/89] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=97=A5=E5=BF=97(=E9=BB=98=E8=AE=A4=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E7=BA=BF=E7=A8=8B=E6=B1=A0=E4=BC=9A=E6=8D=95?= =?UTF-8?q?=E8=8E=B7=E4=BB=BB=E5=8A=A1=E6=8A=9B=E5=87=BA=E7=9A=84=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=BC=82=E5=B8=B8=EF=BC=8C=E4=BD=86=E6=98=AF=E4=B8=8D?= =?UTF-8?q?=E5=81=9A=E4=BB=BB=E4=BD=95=E5=A4=84=E7=90=86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/thread/ThreadPoolConfig.java | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java index 1fa05d3e4..e1292d2e7 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java @@ -1,9 +1,14 @@ package com.ruoyi.common.config.thread; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor; import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -16,6 +21,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration public class ThreadPoolConfig { + private static final Logger log = LoggerFactory.getLogger(ThreadPoolConfig.class); + // 核心线程池大小 private int corePoolSize = 50; @@ -48,6 +55,25 @@ public class ThreadPoolConfig protected ScheduledExecutorService scheduledExecutorService() { return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()); + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { + @Override + protected void afterExecute(Runnable r, Throwable t) { + super.afterExecute(r, t); + if (t == null && r instanceof Future) { + try { + Object result = ((Future) r).get(); + } catch (CancellationException ce) { + t = ce; + } catch (ExecutionException ee) { + t = ee.getCause(); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); // ignore/reset + } + } + if(t != null) { + log.error(t.getMessage()); + } + } + }; } } From 9bf809061e7d64d593b6bcfc6ff7a3001619da60 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Thu, 14 Mar 2019 19:41:26 +0800 Subject: [PATCH 59/89] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20=E5=A6=82=E6=9E=9C=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=B8=BAajax=E8=BF=94=E5=9B=9Ejson=EF=BC=8C=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E8=B7=B3=E8=BD=AC=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/error/unauth.html | 4 ++-- .../web/exception/GlobalExceptionHandler.java | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/error/unauth.html b/ruoyi-admin/src/main/resources/templates/error/unauth.html index e2b03c3e0..b662c1229 100644 --- a/ruoyi-admin/src/main/resources/templates/error/unauth.html +++ b/ruoyi-admin/src/main/resources/templates/error/unauth.html @@ -14,8 +14,8 @@

    您没有访问权限!

    - 对不起,您正在寻找的页面已经找到。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。 - 主页 + 对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面 + 返回主页
    diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java index 3d4e26611..b3d560041 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java @@ -1,14 +1,17 @@ package com.ruoyi.framework.web.exception; +import javax.servlet.http.HttpServletRequest; import org.apache.shiro.authz.AuthorizationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.servlet.ModelAndView; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.exception.DemoModeException; +import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.framework.util.PermissionUtils; /** @@ -22,13 +25,22 @@ public class GlobalExceptionHandler private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); /** - * 权限校验失败 + * 权限校验失败 如果请求为ajax返回json,普通请求跳转页面 */ @ExceptionHandler(AuthorizationException.class) - public AjaxResult handleAuthorizationException(AuthorizationException e) + public Object handleAuthorizationException(HttpServletRequest request, AuthorizationException e) { log.error(e.getMessage(), e); - return AjaxResult.error(PermissionUtils.getMsg(e.getMessage())); + if (ServletUtils.isAjaxRequest(request)) + { + return AjaxResult.error(PermissionUtils.getMsg(e.getMessage())); + } + else + { + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("/error/unauth"); + return modelAndView; + } } /** From 00a661e325433001da8990483ebbd454e1046d6b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Mar 2019 18:19:23 +0800 Subject: [PATCH 60/89] =?UTF-8?q?=E6=8D=95=E8=8E=B7=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0=E6=89=A7=E8=A1=8C=E4=BB=BB=E5=8A=A1=E6=8A=9B=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/thread/ThreadPoolConfig.java | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java index e1292d2e7..6638b6b4d 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java @@ -55,25 +55,45 @@ public class ThreadPoolConfig protected ScheduledExecutorService scheduledExecutorService() { return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) + { @Override - protected void afterExecute(Runnable r, Throwable t) { + protected void afterExecute(Runnable r, Throwable t) + { super.afterExecute(r, t); - if (t == null && r instanceof Future) { - try { - Object result = ((Future) r).get(); - } catch (CancellationException ce) { - t = ce; - } catch (ExecutionException ee) { - t = ee.getCause(); - } catch (InterruptedException ie) { - Thread.currentThread().interrupt(); // ignore/reset - } - } - if(t != null) { - log.error(t.getMessage()); - } + printException(r, t); } }; } + + private static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future) + { + try + { + Future future = (Future) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + log.error(t.getMessage(), t); + } + } } From e26b65459e6106a482aead55e92e7fe151c51c08 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 15 Mar 2019 19:02:28 +0800 Subject: [PATCH 61/89] =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=96=B9=E6=B3=95=E7=A7=BB=E5=85=A5=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/thread/ThreadPoolConfig.java | 41 +------------------ .../java/com/ruoyi/common/utils/Threads.java | 39 +++++++++++++++++- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java index 6638b6b4d..1ff207552 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/thread/ThreadPoolConfig.java @@ -1,17 +1,13 @@ package com.ruoyi.common.config.thread; -import java.util.concurrent.CancellationException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor; import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import com.ruoyi.common.utils.Threads; /** * 线程池配置 @@ -21,8 +17,6 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Configuration public class ThreadPoolConfig { - private static final Logger log = LoggerFactory.getLogger(ThreadPoolConfig.class); - // 核心线程池大小 private int corePoolSize = 50; @@ -61,39 +55,8 @@ public class ThreadPoolConfig protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); - printException(r, t); + Threads.printException(r, t); } }; } - - private static void printException(Runnable r, Throwable t) - { - if (t == null && r instanceof Future) - { - try - { - Future future = (Future) r; - if (future.isDone()) - { - future.get(); - } - } - catch (CancellationException ce) - { - t = ce; - } - catch (ExecutionException ee) - { - t = ee.getCause(); - } - catch (InterruptedException ie) - { - Thread.currentThread().interrupt(); - } - } - if (t != null) - { - log.error(t.getMessage(), t); - } - } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java index 0ccd6b6c0..193419506 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Threads.java @@ -1,6 +1,9 @@ package com.ruoyi.common.utils; +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +15,7 @@ import org.slf4j.LoggerFactory; */ public class Threads { - private static final Logger logger = LoggerFactory.getLogger("sys-user"); + private static final Logger logger = LoggerFactory.getLogger(Threads.class); /** * sleep等待,单位为毫秒 @@ -59,4 +62,38 @@ public class Threads } } } + + /** + * 打印线程异常信息 + */ + public static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future) + { + try + { + Future future = (Future) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + logger.error(t.getMessage(), t); + } + } } From d066bf022bc571610c05a220b1cfa7d0efbb44f0 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 17 Mar 2019 19:47:35 +0800 Subject: [PATCH 62/89] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=A0=91=E7=AC=AC=E4=B8=80=E7=BA=A7=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/common.js | 6 ++++-- .../src/main/resources/templates/system/menu/menu.html | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index cda298a5c..e18e40dd1 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -103,9 +103,11 @@ $(function() { }).bind("input propertychange", $.tree.searchNode); } // tree表格树 展开/折叠 - var expandFlag = false; + var expandFlag; $("#expandAllBtn").click(function() { - if (expandFlag) { + var dataExpand = $.common.isEmpty($.table._option.expandAll) ? true : $.table._option.expandAll; + expandFlag = $.common.isEmpty(expandFlag) ? dataExpand : expandFlag; + if (!expandFlag) { $('#' + $.table._option.id).bootstrapTreeTable('expandAll'); } else { $('#' + $.table._option.id).bootstrapTreeTable('collapseAll'); diff --git a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html b/ruoyi-admin/src/main/resources/templates/system/menu/menu.html index 786cc7b60..68786089b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/menu/menu.html +++ b/ruoyi-admin/src/main/resources/templates/system/menu/menu.html @@ -59,7 +59,7 @@ parentCode: "parentId", uniqueId: "menuId", expandAll: false, - expandFirst: true, + expandFirst: false, url: prefix + "/list", createUrl: prefix + "/add/{id}", updateUrl: prefix + "/edit/{id}", From 92d98a2a6eebdce61082b415e59fce33ff453c37 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 17 Mar 2019 20:52:45 +0800 Subject: [PATCH 63/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8DIE=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 501826da4..768c7fa19 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -173,7 +173,7 @@ $.modal.loading("正在导出数据,请稍后..."); $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function(result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; } else { $.modal.alertError(result.msg); } @@ -184,7 +184,7 @@ importTemplate: function() { $.get($.table._option.importTemplateUrl, function(result) { if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + result.msg + "&delete=" + true; + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; } else { $.modal.alertError(result.msg); } From fb2887b3bf3f760c8a10bdd8273458dfc1e18cbe Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 17 Mar 2019 21:26:01 +0800 Subject: [PATCH 64/89] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B8=BA=E2=80=9C=E7=9B=AE=E5=BD=95=E2=80=9D,perms=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E4=BF=9D=E5=AD=98=E4=B8=BANULL=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/system/SysMenuMapper.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml index a7bcaf408..dd66fdb14 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml @@ -23,12 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select menu_id, menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time + select menu_id, menu_name, parent_id, order_num, url, menu_type, visible, ifnull(perms,'') as perms, icon, create_by, create_time from sys_menu +
    +
    +
    +
    +
    +
    个人资料
    +
    +
    +
    +

    +

    修改头像

    +
    +
      +
    • + 登录名称: +

      [[${user.loginName}]]

      +
    • +
    • + 手机号码: +

      [[${user.phonenumber}]]

      +
    • +
    • + 所属部门: +

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

      +
    • +
    • + 邮箱地址: +

      [[${user.email}]]

      +
    • +
    • + 创建时间: +

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

      +
    • +
    +
    +
    +
    + +
    +
    +
    +
    基本资料
    +
    +
    + -
    -
    -
    -
    - image -
    [[${user.loginIp}]]
    -
    -
    -
    -

    [[${user.loginName}]]

    -

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

    [[${user.phonenumber}]]

    -

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

    -

    性别:[[${user.sex}]]

    -

    [[${user.email}]]

    -

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

    -
    -
    - +
    + +
    +
    + + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +   + +
    +
    +
    +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +   + +
    +
    +
    +
    +
    + -
    + diff --git a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html b/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html index ee3385418..e6a87b68d 100644 --- a/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html +++ b/ruoyi-admin/src/main/resources/templates/system/user/profile/resetPwd.html @@ -1,7 +1,8 @@ - - + + +
    @@ -33,7 +34,7 @@
    -
    + - + + + - - + - - diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 4f74fa941..11ef319ec 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -18,7 +18,6 @@ @@ -158,7 +157,6 @@ - diff --git a/ruoyi-admin/src/main/resources/templates/login.html b/ruoyi-admin/src/main/resources/templates/login.html index 221f06a6c..3a820d2c4 100644 --- a/ruoyi-admin/src/main/resources/templates/login.html +++ b/ruoyi-admin/src/main/resources/templates/login.html @@ -82,7 +82,6 @@ - diff --git a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html b/ruoyi-admin/src/main/resources/templates/system/role/authUser.html index d6c411dc6..f61f9ef09 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/authUser.html @@ -28,7 +28,7 @@
    - 分配用户 + 添加用户 批量取消授权 diff --git a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html b/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html index f26cea0ae..0650df3a2 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html @@ -110,7 +110,7 @@ }; } - /* 分配用户-选择用户-提交 */ + /* 添加用户-选择用户-提交 */ function submitHandler() { var rows = $.table.selectFirstColumns(); if (rows.length == 0) { From cdaa3da76ab43730997f21e5d828f2e9d4ca2ae7 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 12 Apr 2019 12:44:51 +0800 Subject: [PATCH 86/89] =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=BF=81=E7=A7=BB=E8=87=B3=E5=B7=A5=E5=85=B7=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/CommonController.java | 32 +-------------- .../src/main/resources/application.yml | 6 ++- .../ruoyi/common/utils/file/FileUtils.java | 39 +++++++++++++++++++ 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index a22a1b237..8628f3938 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -1,7 +1,5 @@ package com.ruoyi.web.controller.common; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; @@ -58,7 +56,7 @@ public class CommonController response.setCharacterEncoding("utf-8"); response.setContentType("multipart/form-data"); response.setHeader("Content-Disposition", - "attachment;fileName=" + setFileDownloadHeader(request, realFileName)); + "attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName)); FileUtils.writeBytes(filePath, response.getOutputStream()); if (delete) { @@ -95,32 +93,4 @@ public class CommonController return AjaxResult.error(e.getMessage()); } } - - public String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException - { - final String agent = request.getHeader("USER-AGENT"); - String filename = fileName; - if (agent.contains("MSIE")) - { - // IE浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - filename = filename.replace("+", " "); - } - else if (agent.contains("Firefox")) - { - // 火狐浏览器 - filename = new String(fileName.getBytes(), "ISO8859-1"); - } - else if (agent.contains("Chrome")) - { - // google浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - } - else - { - // 其它浏览器 - filename = URLEncoder.encode(filename, "utf-8"); - } - return filename; - } } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 0d959287b..bb4af0cd6 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -58,8 +58,10 @@ spring: # 文件上传 servlet: multipart: - max-file-size: 30MB - max-request-size: 30MB + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB # 服务模块 devtools: restart: diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java index afbe43ae0..03f5aa2a2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java @@ -5,6 +5,9 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import javax.servlet.http.HttpServletRequest; /** * 文件处理工具类 @@ -100,4 +103,40 @@ public class FileUtils { return filename.matches(FILENAME_PATTERN); } + + /** + * 下载文件名重新编码 + * + * @param request 请求对象 + * @param fileName 文件名 + * @return 编码后的文件名 + */ + public static String setFileDownloadHeader(HttpServletRequest request, String fileName) + throws UnsupportedEncodingException + { + final String agent = request.getHeader("USER-AGENT"); + String filename = fileName; + if (agent.contains("MSIE")) + { + // IE浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + filename = filename.replace("+", " "); + } + else if (agent.contains("Firefox")) + { + // 火狐浏览器 + filename = new String(fileName.getBytes(), "ISO8859-1"); + } + else if (agent.contains("Chrome")) + { + // google浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + else + { + // 其它浏览器 + filename = URLEncoder.encode(filename, "utf-8"); + } + return filename; + } } From d8883da0347e194fa344e5399c0396c3641d6249 Mon Sep 17 00:00:00 2001 From: RyzeBB <1079684518@qq.com> Date: Fri, 12 Apr 2019 15:12:47 +0800 Subject: [PATCH 87/89] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9Aweidu?= =?UTF-8?q?=20=E6=8F=90=E4=BA=A4=E6=8F=8F=E8=BF=B0=EF=BC=9A4=E7=BA=A7?= =?UTF-8?q?=E6=88=96=E8=80=85=E6=9B=B4=E5=A4=9A=E7=BA=A7=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=BB=93=E6=9E=84=E5=BD=92=E5=B1=9E=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E5=88=A4=E5=AE=9A=E5=A4=B1=E6=95=88?= =?UTF-8?q?=20=E6=8F=90=E4=BA=A4=E6=97=B6=E9=97=B4=EF=BC=9A2019-04-12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/ry-ui.js | 2443 +++++++++-------- 1 file changed, 1222 insertions(+), 1221 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 23698bcb9..f9e6d211e 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -1,1222 +1,1223 @@ -/** - * 通用js方法封装处理 - * Copyright (c) 2019 ruoyi - */ -(function ($) { - $.extend({ - _treeTable: {}, - _tree: {}, - // 表格封装处理 - table: { - _option: {}, - // 初始化表格参数 - init: function(options) { - var defaults = { - id: "bootstrap-table", - type: 0, // 0 代表bootstrapTable 1代表bootstrapTreeTable - height: undefined, - sidePagination: "server", - sortName: "", - sortOrder: "asc", - pagination: true, - pageSize: 10, - toolbar: "toolbar", - striped: false, - escape: false, - showFooter: false, - search: false, - showSearch: true, - showPageGo: false, - showRefresh: true, - showColumns: true, - showToggle: true, - showExport: false, - clickToSelect: false, - rememberSelected: false, - fixedColumns: false, - fixedNumber: 0, - rightFixedColumns: false, - rightFixedNumber: 0, - queryParams: $.table.queryParams, - }; - var options = $.extend(defaults, options); - $.table._option = options; - $.table.initEvent(); - $('#' + options.id).bootstrapTable({ - url: options.url, // 请求后台的URL(*) - contentType: "application/x-www-form-urlencoded", // 编码类型 - method: 'post', // 请求方式(*) - cache: false, // 是否使用缓存 - height: options.height, // 表格的高度 - striped: options.striped, // 是否显示行间隔色 - sortable: true, // 是否启用排序 - sortStable: true, // 设置为 true 将获得稳定的排序 - sortName: options.sortName, // 排序列名称 - sortOrder: options.sortOrder, // 排序方式 asc 或者 desc - pagination: options.pagination, // 是否显示分页(*) - pageNumber: 1, // 初始化加载第一页,默认第一页 - pageSize: options.pageSize, // 每页的记录行数(*) - pageList: [10, 25, 50], // 可供选择的每页的行数(*) - escape: options.escape, // 转义HTML字符串 - showFooter: options.showFooter, // 是否显示表尾 - iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 - toolbar: '#' + options.toolbar, // 指定工作栏 - sidePagination: options.sidePagination, // server启用服务端分页client客户端分页 - search: options.search, // 是否显示搜索框功能 - showSearch: options.showSearch, // 是否显示检索信息 - showPageGo: options.showPageGo, // 是否显示跳转页 - showRefresh: options.showRefresh, // 是否显示刷新按钮 - showColumns: options.showColumns, // 是否显示隐藏某列下拉框 - showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮 - showExport: options.showExport, // 是否支持导出文件 - clickToSelect: options.clickToSelect, // 是否启用点击选中行 - rememberSelected: options.rememberSelected, // 启用翻页记住前面的选择 - fixedColumns: options.fixedColumns, // 是否启用冻结列(左侧) - fixedNumber: options.fixedNumber, // 列冻结的个数(左侧) - rightFixedColumns: options.rightFixedColumns, // 是否启用冻结列(右侧) - rightFixedNumber: options.rightFixedNumber, // 列冻结的个数(右侧) - queryParams: options.queryParams, // 传递参数(*) - columns: options.columns, // 显示列信息(*) - responseHandler: $.table.responseHandler, // 在加载服务器发送来的数据之前处理函数 - onLoadSuccess: $.table.onLoadSuccess, // 当所有数据被加载时触发处理函数 - }); - }, - // 查询条件 - queryParams: function(params) { - return { - // 传递参数查询参数 - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order - }; - }, - // 请求获取数据后处理回调函数 - responseHandler: function(res) { - if (res.code == 0) { - if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination == 'client') { - return res.rows; - } else { - if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { - var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId; - $.each(res.rows, function(i, row) { - row.state = $.inArray(row[column], selectionIds) !== -1; - }) - } - return { rows: res.rows, total: res.total }; - } - } else { - $.modal.alertWarning(res.msg); - return { rows: [], total: 0 }; - } - }, - // 初始化事件 - initEvent: function(data) { - // 触发行点击事件 加载成功事件 - $("#" + $.table._option.id).on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table load-success.bs.table", function () { - // 工具栏按钮控制 - var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); - $('#' + $.table._option.toolbar + ' .btn-del').toggleClass('disabled', !rows.length); - $('#' + $.table._option.toolbar + ' .btn-edit').toggleClass('disabled', rows.length!=1); - }); - // 绑定选中事件、取消事件、全部选中、全部取消 - $("#" + $.table._option.id).on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rows) { - // 复选框分页保留保存选中数组 - var rowIds = $.table.affectedRowIds(rows); - if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { - func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference'; - selectionIds = _[func](selectionIds, rowIds); - } - }); - }, - // 当所有数据被加载时触发 - onLoadSuccess: function(data) { - // 浮动提示框特效 - $("[data-toggle='tooltip']").tooltip(); - }, - // 表格销毁 - destroy: function (tableId) { - var currentId = $.common.isEmpty(tableId) ? $.table._option.id : tableId; - $("#" + currentId).bootstrapTable('destroy'); - }, - // 序列号生成 - serialNumber: function (index) { - var table = $('#' + $.table._option.id).bootstrapTable('getOptions'); - var pageSize = table.pageSize; - var pageNumber = table.pageNumber; - return pageSize * (pageNumber - 1) + index + 1; - }, - // 列超出指定长度浮动提示 - tooltip: function (value, length) { - var _length = $.common.isEmpty(length) ? 20 : length; - var _text = ""; - var _value = $.common.nullToStr(value); - if (_value.length > _length) { - _text = _value.substr(0, _length) + "..."; - } else { - _text = _value; - } - return '' + _text +''; - }, - // 下拉按钮切换 - dropdownToggle: function (value) { - var actions = []; - actions.push('
    '); - actions.push(''); - actions.push(''); - actions.push('
    '); - return actions.join(''); - }, - // 搜索-默认第一个form - search: function(formId) { - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; - var params = $("#" + $.table._option.id).bootstrapTable('getOptions'); - params.queryParams = function(params) { - var search = {}; - $.each($("#" + currentId).serializeArray(), function(i, field) { - search[field.name] = field.value; - }); - search.pageSize = params.limit; - search.pageNum = params.offset / params.limit + 1; - search.searchValue = params.search; - search.orderByColumn = params.sort; - search.isAsc = params.order; - return search; - } - $("#" + $.table._option.id).bootstrapTable('refresh', params); - }, - // 导出数据 - exportExcel: function(formId) { - $.modal.confirm("确定导出所有" + $.table._option.modalName + "吗?", function() { - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; - $.modal.loading("正在导出数据,请稍后..."); - $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function(result) { - if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - }); - }); - }, - // 下载模板 - importTemplate: function() { - $.get($.table._option.importTemplateUrl, function(result) { - if (result.code == web_status.SUCCESS) { - window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - }); - }, - // 导入数据 - importExcel: function(formId) { - var currentId = $.common.isEmpty(formId) ? 'importForm' : formId; - $.form.reset(currentId); - layer.open({ - type: 1, - area: ['400px', '230px'], - fix: false, - //不固定 - maxmin: true, - shade: 0.3, - title: '导入' + $.table._option.modalName + '数据', - content: $('#' + currentId), - btn: [' 导入', ' 取消'], - // 弹层外区域关闭 - shadeClose: true, - btn1: function(index, layero){ - var file = layero.find('#file').val(); - if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){ - $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。"); - return false; - } - var index = layer.load(2, {shade: false}); - $.modal.disable(); - var formData = new FormData(); - formData.append("file", $('#file')[0].files[0]); - formData.append("updateSupport", $("input[name='updateSupport']").is(':checked')); - $.ajax({ - url: $.table._option.importUrl, - data: formData, - cache: false, - contentType: false, - processData: false, - type: 'POST', - success: function (result) { - if (result.code == web_status.SUCCESS) { - $.modal.closeAll(); - $.modal.alertSuccess(result.msg); - $.table.refresh(); - } else if (result.code == web_status.WARNING) { - layer.close(index); - $.modal.enable(); - $.modal.alertWarning(result.msg) - } else { - layer.close(index); - $.modal.enable(); - $.modal.alertError(result.msg); - } - } - }); - } - }); - }, - // 刷新表格 - refresh: function() { - $("#" + $.table._option.id).bootstrapTable('refresh', { - silent: true - }); - }, - // 查询表格指定列值 - selectColumns: function(column) { - var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) { - return row[column]; - }); - if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { - rows = rows.concat(selectionIds); - } - return $.common.uniqueFn(rows); - }, - // 获取当前页选中或者取消的行ID - affectedRowIds: function(rows) { - var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId; - var rowIds; - if ($.isArray(rows)) { - rowIds = $.map(rows, function(row) { - return row[column]; - }); - } else { - rowIds = [rows[column]]; - } - return rowIds; - }, - // 查询表格首列值 - selectFirstColumns: function() { - var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) { - return row[$.table._option.columns[1].field]; - }); - if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { - rows = rows.concat(selectionIds); - } - return $.common.uniqueFn(rows); - }, - // 回显数据字典 - selectDictLabel: function(datas, value) { - var actions = []; - $.each(datas, function(index, dict) { - if (dict.dictValue == ('' + value)) { - var listClass = $.common.equals("default", dict.listClass) ? "" : "badge badge-" + dict.listClass; - actions.push($.common.sprintf("%s", listClass, dict.dictLabel)); - return false; - } - }); - return actions.join(''); - }, - // 显示表格指定列 - showColumn: function(column) { - $("#" + $.table._option.id).bootstrapTable('showColumn', column); - }, - // 隐藏表格指定列 - hideColumn: function(column) { - $("#" + $.table._option.id).bootstrapTable('hideColumn', column); - } - }, - // 表格树封装处理 - treeTable: { - // 初始化表格 - init: function(options) { - var defaults = { - id: "bootstrap-tree-table", - type: 1, // 0 代表bootstrapTable 1代表bootstrapTreeTable - height: 0, - rootIdValue: null, - ajaxParams: {}, - toolbar: "toolbar", - striped: false, - expandColumn: 1, - showRefresh: true, - showColumns: true, - expandAll: true, - expandFirst: true - }; - var options = $.extend(defaults, options); - $.table._option = options; - var treeTable = $('#' + options.id).bootstrapTreeTable({ - code: options.code, // 用于设置父子关系 - parentCode: options.parentCode, // 用于设置父子关系 - type: 'get', // 请求方式(*) - url: options.url, // 请求后台的URL(*) - ajaxParams: options.ajaxParams, // 请求数据的ajax的data属性 - rootIdValue: options.rootIdValue, // 设置指定根节点id值 - height: options.height, // 表格树的高度 - expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮 - striped: options.striped, // 是否显示行间隔色 - bordered: true, // 是否显示边框 - toolbar: '#' + options.toolbar, // 指定工作栏 - showRefresh: options.showRefresh, // 是否显示刷新按钮 - showColumns: options.showColumns, // 是否显示隐藏某列下拉框 - expandAll: options.expandAll, // 是否全部展开 - expandFirst: options.expandFirst, // 是否默认第一级展开--expandAll为false时生效 - columns: options.columns - }); - $._treeTable = treeTable; - }, - // 条件查询 - search: function(formId) { - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; - var params = {}; - $.each($("#" + currentId).serializeArray(), function(i, field) { - params[field.name] = field.value; - }); - $._treeTable.bootstrapTreeTable('refresh', params); - }, - // 刷新 - refresh: function() { - $._treeTable.bootstrapTreeTable('refresh'); - }, - }, - // 表单封装处理 - form: { - // 表单重置 - reset: function(formId) { - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; - $("#" + currentId)[0].reset(); - }, - // 获取选中复选框项 - selectCheckeds: function(name) { - var checkeds = ""; - $('input:checkbox[name="' + name + '"]:checked').each(function(i) { - if (0 == i) { - checkeds = $(this).val(); - } else { - checkeds += ("," + $(this).val()); - } - }); - return checkeds; - }, - // 获取选中下拉框项 - selectSelects: function(name) { - var selects = ""; - $('#' + name + ' option:selected').each(function (i) { - if (0 == i) { - selects = $(this).val(); - } else { - selects += ("," + $(this).val()); - } - }); - return selects; - } - }, - // 弹出层封装处理 - modal: { - // 显示图标 - icon: function(type) { - var icon = ""; - if (type == modal_status.WARNING) { - icon = 0; - } else if (type == modal_status.SUCCESS) { - icon = 1; - } else if (type == modal_status.FAIL) { - icon = 2; - } else { - icon = 3; - } - return icon; - }, - // 消息提示 - msg: function(content, type) { - if (type != undefined) { - layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); - } else { - layer.msg(content); - } - }, - // 错误消息 - msgError: function(content) { - $.modal.msg(content, modal_status.FAIL); - }, - // 成功消息 - msgSuccess: function(content) { - $.modal.msg(content, modal_status.SUCCESS); - }, - // 警告消息 - msgWarning: function(content) { - $.modal.msg(content, modal_status.WARNING); - }, - // 弹出提示 - alert: function(content, type) { - layer.alert(content, { - icon: $.modal.icon(type), - title: "系统提示", - btn: ['确认'], - btnclass: ['btn btn-primary'], - }); - }, - // 消息提示并刷新父窗体 - msgReload: function(msg, type) { - layer.msg(msg, { - icon: $.modal.icon(type), - time: 500, - shade: [0.1, '#8F8F8F'] - }, - function() { - $.modal.reload(); - }); - }, - // 错误提示 - alertError: function(content) { - $.modal.alert(content, modal_status.FAIL); - }, - // 成功提示 - alertSuccess: function(content) { - $.modal.alert(content, modal_status.SUCCESS); - }, - // 警告提示 - alertWarning: function(content) { - $.modal.alert(content, modal_status.WARNING); - }, - // 关闭窗体 - close: function () { - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - }, - // 关闭全部窗体 - closeAll: function () { - layer.closeAll(); - }, - // 确认窗体 - confirm: function (content, callBack) { - layer.confirm(content, { - icon: 3, - title: "系统提示", - btn: ['确认', '取消'], - btnclass: ['btn btn-primary', 'btn btn-danger'], - }, function (index) { - layer.close(index); - callBack(true); - }); - }, - // 弹出层指定宽度 - open: function (title, url, width, height, callback) { - //如果是移动端,就使用自适应大小弹窗 - if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { - width = 'auto'; - height = 'auto'; - } - if ($.common.isEmpty(title)) { - title = false; - }; - if ($.common.isEmpty(url)) { - url = "/404.html"; - }; - if ($.common.isEmpty(width)) { - width = 800; - }; - if ($.common.isEmpty(height)) { - height = ($(window).height() - 50); - }; - if ($.common.isEmpty(callback)) { - callback = function(index, layero) { - var iframeWin = layero.find('iframe')[0]; - iframeWin.contentWindow.submitHandler(); - } - } - layer.open({ - type: 2, - area: [width + 'px', height + 'px'], - fix: false, - //不固定 - maxmin: true, - shade: 0.3, - title: title, - content: url, - btn: ['确定', '关闭'], - // 弹层外区域关闭 - shadeClose: true, - yes: callback, - cancel: function(index) { - return true; - } - }); - }, - // 弹出层指定参数选项 - openOptions: function (options) { - var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url; - var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title; - var _width = $.common.isEmpty(options.width) ? "800" : options.width; - var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height; - layer.open({ - type: 2, - maxmin: true, - shade: 0.3, - title: _title, - fix: false, - area: [_width + 'px', _height + 'px'], - content: _url, - shadeClose: true, - btn: [' 确认', ' 关闭'], - yes: function (index, layero) { - options.callBack(index, layero) - }, cancel: function () { - return true; - } - }); - }, - // 弹出层全屏 - openFull: function (title, url, width, height) { - //如果是移动端,就使用自适应大小弹窗 - if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { - width = 'auto'; - height = 'auto'; - } - if ($.common.isEmpty(title)) { - title = false; - }; - if ($.common.isEmpty(url)) { - url = "/404.html"; - }; - if ($.common.isEmpty(width)) { - width = 800; - }; - if ($.common.isEmpty(height)) { - height = ($(window).height() - 50); - }; - var index = layer.open({ - type: 2, - area: [width + 'px', height + 'px'], - fix: false, - //不固定 - maxmin: true, - shade: 0.3, - title: title, - content: url, - btn: ['确定', '关闭'], - // 弹层外区域关闭 - shadeClose: true, - yes: function(index, layero) { - var iframeWin = layero.find('iframe')[0]; - iframeWin.contentWindow.submitHandler(); - }, - cancel: function(index) { - return true; - } - }); - layer.full(index); - }, - // 选卡页方式打开 - openTab: function (title, url) { - createMenuItem(url, title); - }, - // 禁用按钮 - disable: function() { - var doc = window.top == window.parent ? window.document : window.parent.document; - $("a[class*=layui-layer-btn]", doc).addClass("layer-disabled"); - }, - // 启用按钮 - enable: function() { - var doc = window.top == window.parent ? window.document : window.parent.document; - $("a[class*=layui-layer-btn]", doc).removeClass("layer-disabled"); - }, - // 打开遮罩层 - loading: function (message) { - $.blockUI({ message: '
    ' + message + '
    ' }); - }, - // 关闭遮罩层 - closeLoading: function () { - setTimeout(function(){ - $.unblockUI(); - }, 50); - }, - // 重新加载 - reload: function () { - parent.location.reload(); - } - }, - // 操作封装处理 - operate: { - // 提交数据 - submit: function(url, type, dataType, data) { - var config = { - url: url, - type: type, - dataType: dataType, - data: data, - beforeSend: function () { - $.modal.loading("正在处理中,请稍后..."); - }, - success: function(result) { - $.operate.ajaxSuccess(result); - } - }; - $.ajax(config) - }, - // post请求传输 - post: function(url, data) { - $.operate.submit(url, "post", "json", data); - }, - // get请求传输 - get: function(url) { - $.operate.submit(url, "get", "json", ""); - }, - // 详细信息 - detail: function(id, width, height) { - var _url = $.common.isEmpty(id) ? $.table._option.detailUrl : $.table._option.detailUrl.replace("{id}", id); - var _width = $.common.isEmpty(width) ? "800" : width; - var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height; - //如果是移动端,就使用自适应大小弹窗 - if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { - _width = 'auto'; - _height = 'auto'; - } - layer.open({ - type: 2, - area: [_width + 'px', _height + 'px'], - fix: false, - //不固定 - maxmin: true, - shade: 0.3, - title: $.table._option.modalName + "详细", - content: _url, - btn: ['关闭'], - // 弹层外区域关闭 - shadeClose: true, - cancel: function(index){ - return true; - } - }); - }, - // 删除信息 - remove: function(id) { - $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { - var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); - if($.table._option.type == table_type.bootstrapTreeTable) { - $.operate.get(url); - } else { - var data = { "ids": id }; - $.operate.submit(url, "post", "json", data); - } - }); - - }, - // 批量删除信息 - removeAll: function() { - var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); - if (rows.length == 0) { - $.modal.alertWarning("请至少选择一条记录"); - return; - } - $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { - var url = $.table._option.removeUrl; - var data = { "ids": rows.join() }; - $.operate.submit(url, "post", "json", data); - }); - }, - // 清空信息 - clean: function() { - $.modal.confirm("确定清空所有" + $.table._option.modalName + "吗?", function() { - var url = $.table._option.cleanUrl; - $.operate.submit(url, "post", "json", ""); - }); - }, - // 添加信息 - add: function(id) { - $.modal.open("添加" + $.table._option.modalName, $.operate.addUrl(id)); - }, - // 添加信息,以tab页展现 - addTab: function (id) { - $.modal.openTab("添加" + $.table._option.modalName, $.operate.addUrl(id)); - }, - // 添加信息 全屏 - addFull: function(id) { - var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); - $.modal.openFull("添加" + $.table._option.modalName, url); - }, - // 添加访问地址 - addUrl: function(id) { - var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); - return url; - }, - // 修改信息 - edit: function(id) { - if($.common.isEmpty(id) && $.table._option.type == table_type.bootstrapTreeTable) { - var row = $('#' + $.table._option.id).bootstrapTreeTable('getSelections')[0]; - if ($.common.isEmpty(row)) { - $.modal.alertWarning("请至少选择一条记录"); - return; - } - var url = $.table._option.updateUrl.replace("{id}", row[$.table._option.uniqueId]); - $.modal.open("修改" + $.table._option.modalName, url); - } else { - $.modal.open("修改" + $.table._option.modalName, $.operate.editUrl(id)); - } - }, - // 修改信息,以tab页展现 - editTab: function(id) { - $.modal.openTab("修改" + $.table._option.modalName, $.operate.editUrl(id)); - }, - // 修改信息 全屏 - editFull: function(id) { - var url = "/404.html"; - if ($.common.isNotEmpty(id)) { - url = $.table._option.updateUrl.replace("{id}", id); - } else { - var row = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); - url = $.table._option.updateUrl.replace("{id}", row); - } - $.modal.openFull("修改" + $.table._option.modalName, url); - }, - // 修改访问地址 - editUrl: function(id) { - var url = "/404.html"; - if ($.common.isNotEmpty(id)) { - url = $.table._option.updateUrl.replace("{id}", id); - } else { - var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); - if (id.length == 0) { - $.modal.alertWarning("请至少选择一条记录"); - return; - } - url = $.table._option.updateUrl.replace("{id}", id); - } - return url; - }, - // 保存信息 刷新表格 - save: function(url, data) { - var config = { - url: url, - type: "post", - dataType: "json", - data: data, - beforeSend: function () { - $.modal.loading("正在处理中,请稍后..."); - $.modal.disable(); - }, - success: function(result) { - $.operate.successCallback(result); - } - }; - $.ajax(config) - }, - // 保存信息 弹出提示框 - saveModal: function(url, data) { - var config = { - url: url, - type: "post", - dataType: "json", - data: data, - beforeSend: function () { - $.modal.loading("正在处理中,请稍后..."); - }, - success: function(result) { - if (result.code == web_status.SUCCESS) { - $.modal.alertSuccess(result.msg) - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - } - }; - $.ajax(config) - }, - // 保存选项卡信息 - saveTab: function(url, data) { - var config = { - url: url, - type: "post", - dataType: "json", - data: data, - beforeSend: function () { - $.modal.loading("正在处理中,请稍后..."); - }, - success: function(result) { - $.operate.successTabCallback(result); - } - }; - $.ajax(config) - }, - // 保存结果弹出msg刷新table表格 - ajaxSuccess: function (result) { - if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTable) { - $.modal.msgSuccess(result.msg); - $.table.refresh(); - } else if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTreeTable) { - $.modal.msgSuccess(result.msg); - $.treeTable.refresh(); - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - }, - // 成功结果提示msg(父窗体全局更新) - saveSuccess: function (result) { - if (result.code == web_status.SUCCESS) { - $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - }, - // 成功回调执行事件(父窗体静默更新) - successCallback: function(result) { - if (result.code == web_status.SUCCESS) { - var parent = window.parent; - if (parent.$.table._option.type == table_type.bootstrapTable) { - $.modal.close(); - parent.$.modal.msgSuccess(result.msg); - parent.$.table.refresh(); - } else if (parent.$.table._option.type == table_type.bootstrapTreeTable) { - $.modal.close(); - parent.$.modal.msgSuccess(result.msg); - parent.$.treeTable.refresh(); - } else { - $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); - } - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - $.modal.enable(); - }, - // 选项卡成功回调执行事件(父窗体静默更新) - successTabCallback: function(result) { - if (result.code == web_status.SUCCESS) { - var topWindow = $(window.parent.document); - var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); - var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; - $.modal.close(); - $contentWindow.$.modal.msgSuccess(result.msg); - $contentWindow.$(".layui-layer-padding").removeAttr("style"); - if ($contentWindow.$.table._option.type == table_type.bootstrapTable) { - $contentWindow.$.table.refresh(); - } else if ($contentWindow.$.table._option.type == table_type.bootstrapTreeTable) { - $contentWindow.$.treeTable.refresh(); - } - closeItem(); - } else if (result.code == web_status.WARNING) { - $.modal.alertWarning(result.msg) - } else { - $.modal.alertError(result.msg); - } - $.modal.closeLoading(); - } - }, - // 校验封装处理 - validate: { - // 判断返回标识是否唯一 false 不存在 true 存在 - unique: function (value) { - if (value == "0") { - return true; - } - return false; - }, - // 表单验证 - form: function (formId) { - var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; - return $("#" + currentId).validate().form(); - } - }, - // 树插件封装处理 - tree: { - _option: {}, - _lastValue: {}, - // 初始化树结构 - init: function(options) { - var defaults = { - id: "tree", // 属性ID - expandLevel: 0, // 展开等级节点 - view: { - selectedMulti: false, // 设置是否允许同时选中多个节点 - nameIsHTML: true // 设置 name 属性是否支持 HTML 脚本 - }, - check: { - enable: false, // 置 zTree 的节点上是否显示 checkbox / radio - nocheckInherit: true, // 设置子节点是否自动继承 - }, - data: { - key: { - title: "title" // 节点数据保存节点提示信息的属性名称 - }, - simpleData: { - enable: true // true / false 分别表示 使用 / 不使用 简单数据模式 - } - }, - }; - var options = $.extend(defaults, options); - $.tree._option = options; - // 树结构初始化加载 - var setting = { - callback: { - onClick: options.onClick, // 用于捕获节点被点击的事件回调函数 - onCheck: options.onCheck, // 用于捕获 checkbox / radio 被勾选 或 取消勾选的事件回调函数 - onDblClick: options.onDblClick // 用于捕获鼠标双击之后的事件回调函数 - }, - check: options.check, - view: options.view, - data: options.data - }; - $.get(options.url, function(data) { - var treeId = $("#treeId").val(); - tree = $.fn.zTree.init($("#" + options.id), setting, data); - $._tree = tree; - var nodes = tree.getNodesByParam("level", options.expandLevel - 1); - for (var i = 0; i < nodes.length; i++) { - tree.expandNode(nodes[i], true, false, false); - } - var node = tree.getNodesByParam("id", treeId, null)[0]; - $.tree.selectByIdName(treeId, node); - }); - }, - // 搜索节点 - searchNode: function() { - // 取得输入的关键字的值 - var value = $.common.trim($("#keyword").val()); - if ($.tree._lastValue == value) { - return; - } - // 保存最后一次搜索名称 - $.tree._lastValue = value; - var nodes = $._tree.getNodes(); - // 如果要查空字串,就退出不查了。 - if (value == "") { - $.tree.showAllNode(nodes); - return; - } - $.tree.hideAllNode(nodes); - // 根据搜索值模糊匹配 - $.tree.updateNodes($._tree.getNodesByParamFuzzy("name", value)); - }, - // 根据Id和Name选中指定节点 - selectByIdName: function(treeId, node) { - if ($.common.isNotEmpty(treeId) && treeId == node.id) { - $._tree.selectNode(node, true); - } - }, - // 显示所有节点 - showAllNode: function(nodes) { - nodes = $._tree.transformToArray(nodes); - for (var i = nodes.length - 1; i >= 0; i--) { - if (nodes[i].getParentNode() != null) { - $._tree.expandNode(nodes[i], true, false, false, false); - } else { - $._tree.expandNode(nodes[i], true, true, false, false); - } - $._tree.showNode(nodes[i]); - $.tree.showAllNode(nodes[i].children); - } - }, - // 隐藏所有节点 - hideAllNode: function(nodes) { - var tree = $.fn.zTree.getZTreeObj("tree"); - var nodes = $._tree.transformToArray(nodes); - for (var i = nodes.length - 1; i >= 0; i--) { - $._tree.hideNode(nodes[i]); - } - }, - // 显示所有父节点 - showParent: function(treeNode) { - var parentNode; - while ((parentNode = treeNode.getParentNode()) != null) { - $._tree.showNode(parentNode); - $._tree.expandNode(parentNode, true, false, false); - treeNode = parentNode; - } - }, - // 显示所有孩子节点 - showChildren: function(treeNode) { - if (treeNode.isParent) { - for (var idx in treeNode.children) { - var node = treeNode.children[idx]; - $._tree.showNode(node); - $.tree.showChildren(node); - } - } - }, - // 更新节点状态 - updateNodes: function(nodeList) { - $._tree.showNodes(nodeList); - for (var i = 0, l = nodeList.length; i < l; i++) { - var treeNode = nodeList[i]; - $.tree.showChildren(treeNode); - $.tree.showParent(treeNode) - } - }, - // 获取当前被勾选集合 - getCheckedNodes: function(column) { - var _column = $.common.isEmpty(column) ? "id" : column; - var nodes = $._tree.getCheckedNodes(true); - return $.map(nodes, function (row) { - return row[_column]; - }).join(); - }, - // 不允许根父节点选择 - notAllowParents: function(_tree) { - var nodes = _tree.getSelectedNodes(); - for (var i = 0; i < nodes.length; i++) { - if (nodes[i].level == 0) { - $.modal.msgError("不能选择根节点(" + nodes[i].name + ")"); - return false; - } - if (nodes[i].isParent) { - $.modal.msgError("不能选择父节点(" + nodes[i].name + ")"); - return false; - } - } - return true; - }, - // 不允许最后层级节点选择 - notAllowLastLevel: function(_tree) { - var nodes = _tree.getSelectedNodes(); - for (var i = 0; i < nodes.length; i++) { - if (nodes[i].level == nodes.length + 1) { - $.modal.msgError("不能选择最后层级节点(" + nodes[i].name + ")"); - return false; - } - } - return true; - }, - // 隐藏/显示搜索栏 - toggleSearch: function() { - $('#search').slideToggle(200); - $('#btnShow').toggle(); - $('#btnHide').toggle(); - $('#keyword').focus(); - }, - // 折叠 - collapse: function() { - $._tree.expandAll(false); - }, - // 展开 - expand: function() { - $._tree.expandAll(true); - } - }, - // 通用方法封装处理 - common: { - // 判断字符串是否为空 - isEmpty: function (value) { - if (value == null || this.trim(value) == "") { - return true; - } - return false; - }, - // 判断一个字符串是否为非空串 - isNotEmpty: function (value) { - return !$.common.isEmpty(value); - }, - // 空对象转字符串 - nullToStr: function(value) { - if ($.common.isEmpty(value)) { - return "-"; - } - return value; - }, - // 是否显示数据 为空默认为显示 - visible: function (value) { - if ($.common.isEmpty(value) || value == true) { - return true; - } - return false; - }, - // 空格截取 - trim: function (value) { - if (value == null) { - return ""; - } - return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, ""); - }, - // 比较两个字符串(大小写敏感) - equals: function (str, that) { - return str == that; - }, - // 比较两个字符串(大小写不敏感) - equalsIgnoreCase: function (str, that) { - return String(str).toUpperCase() === String(that).toUpperCase(); - }, - // 将字符串按指定字符分割 - split: function (str, sep, maxLen) { - if ($.common.isEmpty(str)) { - return null; - } - var value = String(str).split(sep); - return maxLen ? value.slice(0, maxLen - 1) : value; - }, - // 字符串格式化(%s ) - sprintf: function (str) { - var args = arguments, flag = true, i = 1; - str = str.replace(/%s/g, function () { - var arg = args[i++]; - if (typeof arg === 'undefined') { - flag = false; - return ''; - } - return arg; - }); - return flag ? str : ''; - }, - // 指定随机数返回 - random: function (min, max) { - return Math.floor((Math.random() * max) + min); - }, - // 判断字符串是否是以start开头 - startWith: function(value, start) { - var reg = new RegExp("^" + start); - return reg.test(value) - }, - // 判断字符串是否是以end结尾 - endWith: function(value, end) { - var reg = new RegExp(end + "$"); - return reg.test(value) - }, - // 数组去重 - uniqueFn: function(array) { - var result = []; - var hashObj = {}; - for (var i = 0; i < array.length; i++) { - if (!hashObj[array[i]]) { - hashObj[array[i]] = true; - result.push(array[i]); - } - } - return result; - } - } - }); -})(jQuery); - -/** 表格类型 */ -table_type = { - bootstrapTable: 0, - bootstrapTreeTable: 1 -}; - -/** 消息状态码 */ -web_status = { - SUCCESS: 0, - FAIL: 500, - WARNING: 301 -}; - -/** 弹窗状态码 */ -modal_status = { - SUCCESS: "success", - FAIL: "error", - WARNING: "warning" +/** + * 通用js方法封装处理 + * Copyright (c) 2019 ruoyi + */ +(function ($) { + $.extend({ + _treeTable: {}, + _tree: {}, + // 表格封装处理 + table: { + _option: {}, + // 初始化表格参数 + init: function(options) { + var defaults = { + id: "bootstrap-table", + type: 0, // 0 代表bootstrapTable 1代表bootstrapTreeTable + height: undefined, + sidePagination: "server", + sortName: "", + sortOrder: "asc", + pagination: true, + pageSize: 10, + toolbar: "toolbar", + striped: false, + escape: false, + showFooter: false, + search: false, + showSearch: true, + showPageGo: false, + showRefresh: true, + showColumns: true, + showToggle: true, + showExport: false, + clickToSelect: false, + rememberSelected: false, + fixedColumns: false, + fixedNumber: 0, + rightFixedColumns: false, + rightFixedNumber: 0, + queryParams: $.table.queryParams, + }; + var options = $.extend(defaults, options); + $.table._option = options; + $.table.initEvent(); + $('#' + options.id).bootstrapTable({ + url: options.url, // 请求后台的URL(*) + contentType: "application/x-www-form-urlencoded", // 编码类型 + method: 'post', // 请求方式(*) + cache: false, // 是否使用缓存 + height: options.height, // 表格的高度 + striped: options.striped, // 是否显示行间隔色 + sortable: true, // 是否启用排序 + sortStable: true, // 设置为 true 将获得稳定的排序 + sortName: options.sortName, // 排序列名称 + sortOrder: options.sortOrder, // 排序方式 asc 或者 desc + pagination: options.pagination, // 是否显示分页(*) + pageNumber: 1, // 初始化加载第一页,默认第一页 + pageSize: options.pageSize, // 每页的记录行数(*) + pageList: [10, 25, 50], // 可供选择的每页的行数(*) + escape: options.escape, // 转义HTML字符串 + showFooter: options.showFooter, // 是否显示表尾 + iconSize: 'outline', // 图标大小:undefined默认的按钮尺寸 xs超小按钮sm小按钮lg大按钮 + toolbar: '#' + options.toolbar, // 指定工作栏 + sidePagination: options.sidePagination, // server启用服务端分页client客户端分页 + search: options.search, // 是否显示搜索框功能 + showSearch: options.showSearch, // 是否显示检索信息 + showPageGo: options.showPageGo, // 是否显示跳转页 + showRefresh: options.showRefresh, // 是否显示刷新按钮 + showColumns: options.showColumns, // 是否显示隐藏某列下拉框 + showToggle: options.showToggle, // 是否显示详细视图和列表视图的切换按钮 + showExport: options.showExport, // 是否支持导出文件 + clickToSelect: options.clickToSelect, // 是否启用点击选中行 + rememberSelected: options.rememberSelected, // 启用翻页记住前面的选择 + fixedColumns: options.fixedColumns, // 是否启用冻结列(左侧) + fixedNumber: options.fixedNumber, // 列冻结的个数(左侧) + rightFixedColumns: options.rightFixedColumns, // 是否启用冻结列(右侧) + rightFixedNumber: options.rightFixedNumber, // 列冻结的个数(右侧) + queryParams: options.queryParams, // 传递参数(*) + columns: options.columns, // 显示列信息(*) + responseHandler: $.table.responseHandler, // 在加载服务器发送来的数据之前处理函数 + onLoadSuccess: $.table.onLoadSuccess, // 当所有数据被加载时触发处理函数 + }); + }, + // 查询条件 + queryParams: function(params) { + return { + // 传递参数查询参数 + pageSize: params.limit, + pageNum: params.offset / params.limit + 1, + searchValue: params.search, + orderByColumn: params.sort, + isAsc: params.order + }; + }, + // 请求获取数据后处理回调函数 + responseHandler: function(res) { + if (res.code == 0) { + if ($.common.isNotEmpty($.table._option.sidePagination) && $.table._option.sidePagination == 'client') { + return res.rows; + } else { + if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { + var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId; + $.each(res.rows, function(i, row) { + row.state = $.inArray(row[column], selectionIds) !== -1; + }) + } + return { rows: res.rows, total: res.total }; + } + } else { + $.modal.alertWarning(res.msg); + return { rows: [], total: 0 }; + } + }, + // 初始化事件 + initEvent: function(data) { + // 触发行点击事件 加载成功事件 + $("#" + $.table._option.id).on("check.bs.table uncheck.bs.table check-all.bs.table uncheck-all.bs.table load-success.bs.table", function () { + // 工具栏按钮控制 + var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); + $('#' + $.table._option.toolbar + ' .btn-del').toggleClass('disabled', !rows.length); + $('#' + $.table._option.toolbar + ' .btn-edit').toggleClass('disabled', rows.length!=1); + }); + // 绑定选中事件、取消事件、全部选中、全部取消 + $("#" + $.table._option.id).on("check.bs.table check-all.bs.table uncheck.bs.table uncheck-all.bs.table", function (e, rows) { + // 复选框分页保留保存选中数组 + var rowIds = $.table.affectedRowIds(rows); + if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { + func = $.inArray(e.type, ['check', 'check-all']) > -1 ? 'union' : 'difference'; + selectionIds = _[func](selectionIds, rowIds); + } + }); + }, + // 当所有数据被加载时触发 + onLoadSuccess: function(data) { + // 浮动提示框特效 + $("[data-toggle='tooltip']").tooltip(); + }, + // 表格销毁 + destroy: function (tableId) { + var currentId = $.common.isEmpty(tableId) ? $.table._option.id : tableId; + $("#" + currentId).bootstrapTable('destroy'); + }, + // 序列号生成 + serialNumber: function (index) { + var table = $('#' + $.table._option.id).bootstrapTable('getOptions'); + var pageSize = table.pageSize; + var pageNumber = table.pageNumber; + return pageSize * (pageNumber - 1) + index + 1; + }, + // 列超出指定长度浮动提示 + tooltip: function (value, length) { + var _length = $.common.isEmpty(length) ? 20 : length; + var _text = ""; + var _value = $.common.nullToStr(value); + if (_value.length > _length) { + _text = _value.substr(0, _length) + "..."; + } else { + _text = _value; + } + return '' + _text +''; + }, + // 下拉按钮切换 + dropdownToggle: function (value) { + var actions = []; + actions.push('
    '); + actions.push(''); + actions.push(''); + actions.push('
    '); + return actions.join(''); + }, + // 搜索-默认第一个form + search: function(formId) { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + var params = $("#" + $.table._option.id).bootstrapTable('getOptions'); + params.queryParams = function(params) { + var search = {}; + $.each($("#" + currentId).serializeArray(), function(i, field) { + search[field.name] = field.value; + }); + search.pageSize = params.limit; + search.pageNum = params.offset / params.limit + 1; + search.searchValue = params.search; + search.orderByColumn = params.sort; + search.isAsc = params.order; + return search; + } + $("#" + $.table._option.id).bootstrapTable('refresh', params); + }, + // 导出数据 + exportExcel: function(formId) { + $.modal.confirm("确定导出所有" + $.table._option.modalName + "吗?", function() { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + $.modal.loading("正在导出数据,请稍后..."); + $.post($.table._option.exportUrl, $("#" + currentId).serializeArray(), function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }); + }); + }, + // 下载模板 + importTemplate: function() { + $.get($.table._option.importTemplateUrl, function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + }); + }, + // 导入数据 + importExcel: function(formId) { + var currentId = $.common.isEmpty(formId) ? 'importForm' : formId; + $.form.reset(currentId); + layer.open({ + type: 1, + area: ['400px', '230px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: '导入' + $.table._option.modalName + '数据', + content: $('#' + currentId), + btn: [' 导入', ' 取消'], + // 弹层外区域关闭 + shadeClose: true, + btn1: function(index, layero){ + var file = layero.find('#file').val(); + if (file == '' || (!$.common.endWith(file, '.xls') && !$.common.endWith(file, '.xlsx'))){ + $.modal.msgWarning("请选择后缀为 “xls”或“xlsx”的文件。"); + return false; + } + var index = layer.load(2, {shade: false}); + $.modal.disable(); + var formData = new FormData(); + formData.append("file", $('#file')[0].files[0]); + formData.append("updateSupport", $("input[name='updateSupport']").is(':checked')); + $.ajax({ + url: $.table._option.importUrl, + data: formData, + cache: false, + contentType: false, + processData: false, + type: 'POST', + success: function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.closeAll(); + $.modal.alertSuccess(result.msg); + $.table.refresh(); + } else if (result.code == web_status.WARNING) { + layer.close(index); + $.modal.enable(); + $.modal.alertWarning(result.msg) + } else { + layer.close(index); + $.modal.enable(); + $.modal.alertError(result.msg); + } + } + }); + } + }); + }, + // 刷新表格 + refresh: function() { + $("#" + $.table._option.id).bootstrapTable('refresh', { + silent: true + }); + }, + // 查询表格指定列值 + selectColumns: function(column) { + var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) { + return row[column]; + }); + if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { + rows = rows.concat(selectionIds); + } + return $.common.uniqueFn(rows); + }, + // 获取当前页选中或者取消的行ID + affectedRowIds: function(rows) { + var column = $.common.isEmpty($.table._option.uniqueId) ? $.table._option.columns[1].field : $.table._option.uniqueId; + var rowIds; + if ($.isArray(rows)) { + rowIds = $.map(rows, function(row) { + return row[column]; + }); + } else { + rowIds = [rows[column]]; + } + return rowIds; + }, + // 查询表格首列值 + selectFirstColumns: function() { + var rows = $.map($('#' + $.table._option.id).bootstrapTable('getSelections'), function (row) { + return row[$.table._option.columns[1].field]; + }); + if ($.common.isNotEmpty($.table._option.rememberSelected) && $.table._option.rememberSelected) { + rows = rows.concat(selectionIds); + } + return $.common.uniqueFn(rows); + }, + // 回显数据字典 + selectDictLabel: function(datas, value) { + var actions = []; + $.each(datas, function(index, dict) { + if (dict.dictValue == ('' + value)) { + var listClass = $.common.equals("default", dict.listClass) ? "" : "badge badge-" + dict.listClass; + actions.push($.common.sprintf("%s", listClass, dict.dictLabel)); + return false; + } + }); + return actions.join(''); + }, + // 显示表格指定列 + showColumn: function(column) { + $("#" + $.table._option.id).bootstrapTable('showColumn', column); + }, + // 隐藏表格指定列 + hideColumn: function(column) { + $("#" + $.table._option.id).bootstrapTable('hideColumn', column); + } + }, + // 表格树封装处理 + treeTable: { + // 初始化表格 + init: function(options) { + var defaults = { + id: "bootstrap-tree-table", + type: 1, // 0 代表bootstrapTable 1代表bootstrapTreeTable + height: 0, + rootIdValue: null, + ajaxParams: {}, + toolbar: "toolbar", + striped: false, + expandColumn: 1, + showRefresh: true, + showColumns: true, + expandAll: true, + expandFirst: true + }; + var options = $.extend(defaults, options); + $.table._option = options; + var treeTable = $('#' + options.id).bootstrapTreeTable({ + code: options.code, // 用于设置父子关系 + parentCode: options.parentCode, // 用于设置父子关系 + type: 'get', // 请求方式(*) + url: options.url, // 请求后台的URL(*) + ajaxParams: options.ajaxParams, // 请求数据的ajax的data属性 + rootIdValue: options.rootIdValue, // 设置指定根节点id值 + height: options.height, // 表格树的高度 + expandColumn: options.expandColumn, // 在哪一列上面显示展开按钮 + striped: options.striped, // 是否显示行间隔色 + bordered: true, // 是否显示边框 + toolbar: '#' + options.toolbar, // 指定工作栏 + showRefresh: options.showRefresh, // 是否显示刷新按钮 + showColumns: options.showColumns, // 是否显示隐藏某列下拉框 + expandAll: options.expandAll, // 是否全部展开 + expandFirst: options.expandFirst, // 是否默认第一级展开--expandAll为false时生效 + columns: options.columns + }); + $._treeTable = treeTable; + }, + // 条件查询 + search: function(formId) { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + var params = {}; + $.each($("#" + currentId).serializeArray(), function(i, field) { + params[field.name] = field.value; + }); + $._treeTable.bootstrapTreeTable('refresh', params); + }, + // 刷新 + refresh: function() { + $._treeTable.bootstrapTreeTable('refresh'); + }, + }, + // 表单封装处理 + form: { + // 表单重置 + reset: function(formId) { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + $("#" + currentId)[0].reset(); + }, + // 获取选中复选框项 + selectCheckeds: function(name) { + var checkeds = ""; + $('input:checkbox[name="' + name + '"]:checked').each(function(i) { + if (0 == i) { + checkeds = $(this).val(); + } else { + checkeds += ("," + $(this).val()); + } + }); + return checkeds; + }, + // 获取选中下拉框项 + selectSelects: function(name) { + var selects = ""; + $('#' + name + ' option:selected').each(function (i) { + if (0 == i) { + selects = $(this).val(); + } else { + selects += ("," + $(this).val()); + } + }); + return selects; + } + }, + // 弹出层封装处理 + modal: { + // 显示图标 + icon: function(type) { + var icon = ""; + if (type == modal_status.WARNING) { + icon = 0; + } else if (type == modal_status.SUCCESS) { + icon = 1; + } else if (type == modal_status.FAIL) { + icon = 2; + } else { + icon = 3; + } + return icon; + }, + // 消息提示 + msg: function(content, type) { + if (type != undefined) { + layer.msg(content, { icon: $.modal.icon(type), time: 1000, shift: 5 }); + } else { + layer.msg(content); + } + }, + // 错误消息 + msgError: function(content) { + $.modal.msg(content, modal_status.FAIL); + }, + // 成功消息 + msgSuccess: function(content) { + $.modal.msg(content, modal_status.SUCCESS); + }, + // 警告消息 + msgWarning: function(content) { + $.modal.msg(content, modal_status.WARNING); + }, + // 弹出提示 + alert: function(content, type) { + layer.alert(content, { + icon: $.modal.icon(type), + title: "系统提示", + btn: ['确认'], + btnclass: ['btn btn-primary'], + }); + }, + // 消息提示并刷新父窗体 + msgReload: function(msg, type) { + layer.msg(msg, { + icon: $.modal.icon(type), + time: 500, + shade: [0.1, '#8F8F8F'] + }, + function() { + $.modal.reload(); + }); + }, + // 错误提示 + alertError: function(content) { + $.modal.alert(content, modal_status.FAIL); + }, + // 成功提示 + alertSuccess: function(content) { + $.modal.alert(content, modal_status.SUCCESS); + }, + // 警告提示 + alertWarning: function(content) { + $.modal.alert(content, modal_status.WARNING); + }, + // 关闭窗体 + close: function () { + var index = parent.layer.getFrameIndex(window.name); + parent.layer.close(index); + }, + // 关闭全部窗体 + closeAll: function () { + layer.closeAll(); + }, + // 确认窗体 + confirm: function (content, callBack) { + layer.confirm(content, { + icon: 3, + title: "系统提示", + btn: ['确认', '取消'], + btnclass: ['btn btn-primary', 'btn btn-danger'], + }, function (index) { + layer.close(index); + callBack(true); + }); + }, + // 弹出层指定宽度 + open: function (title, url, width, height, callback) { + //如果是移动端,就使用自适应大小弹窗 + if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { + width = 'auto'; + height = 'auto'; + } + if ($.common.isEmpty(title)) { + title = false; + }; + if ($.common.isEmpty(url)) { + url = "/404.html"; + }; + if ($.common.isEmpty(width)) { + width = 800; + }; + if ($.common.isEmpty(height)) { + height = ($(window).height() - 50); + }; + if ($.common.isEmpty(callback)) { + callback = function(index, layero) { + var iframeWin = layero.find('iframe')[0]; + iframeWin.contentWindow.submitHandler(); + } + } + layer.open({ + type: 2, + area: [width + 'px', height + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: title, + content: url, + btn: ['确定', '关闭'], + // 弹层外区域关闭 + shadeClose: true, + yes: callback, + cancel: function(index) { + return true; + } + }); + }, + // 弹出层指定参数选项 + openOptions: function (options) { + var _url = $.common.isEmpty(options.url) ? "/404.html" : options.url; + var _title = $.common.isEmpty(options.title) ? "系统窗口" : options.title; + var _width = $.common.isEmpty(options.width) ? "800" : options.width; + var _height = $.common.isEmpty(options.height) ? ($(window).height() - 50) : options.height; + layer.open({ + type: 2, + maxmin: true, + shade: 0.3, + title: _title, + fix: false, + area: [_width + 'px', _height + 'px'], + content: _url, + shadeClose: true, + btn: [' 确认', ' 关闭'], + yes: function (index, layero) { + options.callBack(index, layero) + }, cancel: function () { + return true; + } + }); + }, + // 弹出层全屏 + openFull: function (title, url, width, height) { + //如果是移动端,就使用自适应大小弹窗 + if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { + width = 'auto'; + height = 'auto'; + } + if ($.common.isEmpty(title)) { + title = false; + }; + if ($.common.isEmpty(url)) { + url = "/404.html"; + }; + if ($.common.isEmpty(width)) { + width = 800; + }; + if ($.common.isEmpty(height)) { + height = ($(window).height() - 50); + }; + var index = layer.open({ + type: 2, + area: [width + 'px', height + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: title, + content: url, + btn: ['确定', '关闭'], + // 弹层外区域关闭 + shadeClose: true, + yes: function(index, layero) { + var iframeWin = layero.find('iframe')[0]; + iframeWin.contentWindow.submitHandler(); + }, + cancel: function(index) { + return true; + } + }); + layer.full(index); + }, + // 选卡页方式打开 + openTab: function (title, url) { + createMenuItem(url, title); + }, + // 禁用按钮 + disable: function() { + var doc = window.top == window.parent ? window.document : window.parent.document; + $("a[class*=layui-layer-btn]", doc).addClass("layer-disabled"); + }, + // 启用按钮 + enable: function() { + var doc = window.top == window.parent ? window.document : window.parent.document; + $("a[class*=layui-layer-btn]", doc).removeClass("layer-disabled"); + }, + // 打开遮罩层 + loading: function (message) { + $.blockUI({ message: '
    ' + message + '
    ' }); + }, + // 关闭遮罩层 + closeLoading: function () { + setTimeout(function(){ + $.unblockUI(); + }, 50); + }, + // 重新加载 + reload: function () { + parent.location.reload(); + } + }, + // 操作封装处理 + operate: { + // 提交数据 + submit: function(url, type, dataType, data) { + var config = { + url: url, + type: type, + dataType: dataType, + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + }, + success: function(result) { + $.operate.ajaxSuccess(result); + } + }; + $.ajax(config) + }, + // post请求传输 + post: function(url, data) { + $.operate.submit(url, "post", "json", data); + }, + // get请求传输 + get: function(url) { + $.operate.submit(url, "get", "json", ""); + }, + // 详细信息 + detail: function(id, width, height) { + var _url = $.common.isEmpty(id) ? $.table._option.detailUrl : $.table._option.detailUrl.replace("{id}", id); + var _width = $.common.isEmpty(width) ? "800" : width; + var _height = $.common.isEmpty(height) ? ($(window).height() - 50) : height; + //如果是移动端,就使用自适应大小弹窗 + if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) { + _width = 'auto'; + _height = 'auto'; + } + layer.open({ + type: 2, + area: [_width + 'px', _height + 'px'], + fix: false, + //不固定 + maxmin: true, + shade: 0.3, + title: $.table._option.modalName + "详细", + content: _url, + btn: ['关闭'], + // 弹层外区域关闭 + shadeClose: true, + cancel: function(index){ + return true; + } + }); + }, + // 删除信息 + remove: function(id) { + $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() { + var url = $.common.isEmpty(id) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{id}", id); + if($.table._option.type == table_type.bootstrapTreeTable) { + $.operate.get(url); + } else { + var data = { "ids": id }; + $.operate.submit(url, "post", "json", data); + } + }); + + }, + // 批量删除信息 + removeAll: function() { + var rows = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); + if (rows.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { + var url = $.table._option.removeUrl; + var data = { "ids": rows.join() }; + $.operate.submit(url, "post", "json", data); + }); + }, + // 清空信息 + clean: function() { + $.modal.confirm("确定清空所有" + $.table._option.modalName + "吗?", function() { + var url = $.table._option.cleanUrl; + $.operate.submit(url, "post", "json", ""); + }); + }, + // 添加信息 + add: function(id) { + $.modal.open("添加" + $.table._option.modalName, $.operate.addUrl(id)); + }, + // 添加信息,以tab页展现 + addTab: function (id) { + $.modal.openTab("添加" + $.table._option.modalName, $.operate.addUrl(id)); + }, + // 添加信息 全屏 + addFull: function(id) { + var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); + $.modal.openFull("添加" + $.table._option.modalName, url); + }, + // 添加访问地址 + addUrl: function(id) { + var url = $.common.isEmpty(id) ? $.table._option.createUrl : $.table._option.createUrl.replace("{id}", id); + return url; + }, + // 修改信息 + edit: function(id) { + if($.common.isEmpty(id) && $.table._option.type == table_type.bootstrapTreeTable) { + var row = $('#' + $.table._option.id).bootstrapTreeTable('getSelections')[0]; + if ($.common.isEmpty(row)) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + var url = $.table._option.updateUrl.replace("{id}", row[$.table._option.uniqueId]); + $.modal.open("修改" + $.table._option.modalName, url); + } else { + $.modal.open("修改" + $.table._option.modalName, $.operate.editUrl(id)); + } + }, + // 修改信息,以tab页展现 + editTab: function(id) { + $.modal.openTab("修改" + $.table._option.modalName, $.operate.editUrl(id)); + }, + // 修改信息 全屏 + editFull: function(id) { + var url = "/404.html"; + if ($.common.isNotEmpty(id)) { + url = $.table._option.updateUrl.replace("{id}", id); + } else { + var row = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); + url = $.table._option.updateUrl.replace("{id}", row); + } + $.modal.openFull("修改" + $.table._option.modalName, url); + }, + // 修改访问地址 + editUrl: function(id) { + var url = "/404.html"; + if ($.common.isNotEmpty(id)) { + url = $.table._option.updateUrl.replace("{id}", id); + } else { + var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId); + if (id.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + url = $.table._option.updateUrl.replace("{id}", id); + } + return url; + }, + // 保存信息 刷新表格 + save: function(url, data) { + var config = { + url: url, + type: "post", + dataType: "json", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + $.modal.disable(); + }, + success: function(result) { + $.operate.successCallback(result); + } + }; + $.ajax(config) + }, + // 保存信息 弹出提示框 + saveModal: function(url, data) { + var config = { + url: url, + type: "post", + dataType: "json", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + }, + success: function(result) { + if (result.code == web_status.SUCCESS) { + $.modal.alertSuccess(result.msg) + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + } + }; + $.ajax(config) + }, + // 保存选项卡信息 + saveTab: function(url, data) { + var config = { + url: url, + type: "post", + dataType: "json", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + }, + success: function(result) { + $.operate.successTabCallback(result); + } + }; + $.ajax(config) + }, + // 保存结果弹出msg刷新table表格 + ajaxSuccess: function (result) { + if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTable) { + $.modal.msgSuccess(result.msg); + $.table.refresh(); + } else if (result.code == web_status.SUCCESS && $.table._option.type == table_type.bootstrapTreeTable) { + $.modal.msgSuccess(result.msg); + $.treeTable.refresh(); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }, + // 成功结果提示msg(父窗体全局更新) + saveSuccess: function (result) { + if (result.code == web_status.SUCCESS) { + $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }, + // 成功回调执行事件(父窗体静默更新) + successCallback: function(result) { + if (result.code == web_status.SUCCESS) { + var parent = window.parent; + if (parent.$.table._option.type == table_type.bootstrapTable) { + $.modal.close(); + parent.$.modal.msgSuccess(result.msg); + parent.$.table.refresh(); + } else if (parent.$.table._option.type == table_type.bootstrapTreeTable) { + $.modal.close(); + parent.$.modal.msgSuccess(result.msg); + parent.$.treeTable.refresh(); + } else { + $.modal.msgReload("保存成功,正在刷新数据请稍后……", modal_status.SUCCESS); + } + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + $.modal.enable(); + }, + // 选项卡成功回调执行事件(父窗体静默更新) + successTabCallback: function(result) { + if (result.code == web_status.SUCCESS) { + var topWindow = $(window.parent.document); + var currentId = $('.page-tabs-content', topWindow).find('.active').attr('data-panel'); + var $contentWindow = $('.RuoYi_iframe[data-id="' + currentId + '"]', topWindow)[0].contentWindow; + $.modal.close(); + $contentWindow.$.modal.msgSuccess(result.msg); + $contentWindow.$(".layui-layer-padding").removeAttr("style"); + if ($contentWindow.$.table._option.type == table_type.bootstrapTable) { + $contentWindow.$.table.refresh(); + } else if ($contentWindow.$.table._option.type == table_type.bootstrapTreeTable) { + $contentWindow.$.treeTable.refresh(); + } + closeItem(); + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + } + }, + // 校验封装处理 + validate: { + // 判断返回标识是否唯一 false 不存在 true 存在 + unique: function (value) { + if (value == "0") { + return true; + } + return false; + }, + // 表单验证 + form: function (formId) { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + return $("#" + currentId).validate().form(); + } + }, + // 树插件封装处理 + tree: { + _option: {}, + _lastValue: {}, + // 初始化树结构 + init: function(options) { + var defaults = { + id: "tree", // 属性ID + expandLevel: 0, // 展开等级节点 + view: { + selectedMulti: false, // 设置是否允许同时选中多个节点 + nameIsHTML: true // 设置 name 属性是否支持 HTML 脚本 + }, + check: { + enable: false, // 置 zTree 的节点上是否显示 checkbox / radio + nocheckInherit: true, // 设置子节点是否自动继承 + }, + data: { + key: { + title: "title" // 节点数据保存节点提示信息的属性名称 + }, + simpleData: { + enable: true // true / false 分别表示 使用 / 不使用 简单数据模式 + } + }, + }; + var options = $.extend(defaults, options); + $.tree._option = options; + // 树结构初始化加载 + var setting = { + callback: { + onClick: options.onClick, // 用于捕获节点被点击的事件回调函数 + onCheck: options.onCheck, // 用于捕获 checkbox / radio 被勾选 或 取消勾选的事件回调函数 + onDblClick: options.onDblClick // 用于捕获鼠标双击之后的事件回调函数 + }, + check: options.check, + view: options.view, + data: options.data + }; + $.get(options.url, function(data) { + var treeId = $("#treeId").val(); + tree = $.fn.zTree.init($("#" + options.id), setting, data); + $._tree = tree; + var nodes = tree.getNodesByParam("level", options.expandLevel - 1); + for (var i = 0; i < nodes.length; i++) { + tree.expandNode(nodes[i], true, false, false); + } + var node = tree.getNodesByParam("id", treeId, null)[0]; + $.tree.selectByIdName(treeId, node); + }); + }, + // 搜索节点 + searchNode: function() { + // 取得输入的关键字的值 + var value = $.common.trim($("#keyword").val()); + if ($.tree._lastValue == value) { + return; + } + // 保存最后一次搜索名称 + $.tree._lastValue = value; + var nodes = $._tree.getNodes(); + // 如果要查空字串,就退出不查了。 + if (value == "") { + $.tree.showAllNode(nodes); + return; + } + $.tree.hideAllNode(nodes); + // 根据搜索值模糊匹配 + $.tree.updateNodes($._tree.getNodesByParamFuzzy("name", value)); + }, + // 根据Id和Name选中指定节点 + selectByIdName: function(treeId, node) { + if ($.common.isNotEmpty(treeId) && treeId == node.id) { + $._tree.selectNode(node, true); + } + }, + // 显示所有节点 + showAllNode: function(nodes) { + nodes = $._tree.transformToArray(nodes); + for (var i = nodes.length - 1; i >= 0; i--) { + if (nodes[i].getParentNode() != null) { + $._tree.expandNode(nodes[i], true, false, false, false); + } else { + $._tree.expandNode(nodes[i], true, true, false, false); + } + $._tree.showNode(nodes[i]); + $.tree.showAllNode(nodes[i].children); + } + }, + // 隐藏所有节点 + hideAllNode: function(nodes) { + var tree = $.fn.zTree.getZTreeObj("tree"); + var nodes = $._tree.transformToArray(nodes); + for (var i = nodes.length - 1; i >= 0; i--) { + $._tree.hideNode(nodes[i]); + } + }, + // 显示所有父节点 + showParent: function(treeNode) { + var parentNode; + while ((parentNode = treeNode.getParentNode()) != null) { + $._tree.showNode(parentNode); + $._tree.expandNode(parentNode, true, false, false); + treeNode = parentNode; + } + }, + // 显示所有孩子节点 + showChildren: function(treeNode) { + if (treeNode.isParent) { + for (var idx in treeNode.children) { + var node = treeNode.children[idx]; + $._tree.showNode(node); + $.tree.showChildren(node); + } + } + }, + // 更新节点状态 + updateNodes: function(nodeList) { + $._tree.showNodes(nodeList); + for (var i = 0, l = nodeList.length; i < l; i++) { + var treeNode = nodeList[i]; + $.tree.showChildren(treeNode); + $.tree.showParent(treeNode) + } + }, + // 获取当前被勾选集合 + getCheckedNodes: function(column) { + var _column = $.common.isEmpty(column) ? "id" : column; + var nodes = $._tree.getCheckedNodes(true); + return $.map(nodes, function (row) { + return row[_column]; + }).join(); + }, + // 不允许根父节点选择 + notAllowParents: function(_tree) { + var nodes = _tree.getSelectedNodes(); + for (var i = 0; i < nodes.length; i++) { + if (nodes[i].level == 0) { + $.modal.msgError("不能选择根节点(" + nodes[i].name + ")"); + return false; + } + if (nodes[i].isParent) { + $.modal.msgError("不能选择父节点(" + nodes[i].name + ")"); + return false; + } + } + return true; + }, + // 不允许最后层级节点选择 + notAllowLastLevel: function(_tree) { + var nodes = _tree.getSelectedNodes(); + for (var i = 0; i < nodes.length; i++) { + //if (nodes[i].level == nodes.length + 1)判断是否是最后层级节点该条件判定四级组织结构时失效,如下只需判定选择的节点:isParent == false即可 modify by weidu 2019-04-10 + if (!nodes[i].isParent) { + $.modal.msgError("不能选择最后层级节点(" + nodes[i].name + ")"); + return false; + } + } + return true; + }, + // 隐藏/显示搜索栏 + toggleSearch: function() { + $('#search').slideToggle(200); + $('#btnShow').toggle(); + $('#btnHide').toggle(); + $('#keyword').focus(); + }, + // 折叠 + collapse: function() { + $._tree.expandAll(false); + }, + // 展开 + expand: function() { + $._tree.expandAll(true); + } + }, + // 通用方法封装处理 + common: { + // 判断字符串是否为空 + isEmpty: function (value) { + if (value == null || this.trim(value) == "") { + return true; + } + return false; + }, + // 判断一个字符串是否为非空串 + isNotEmpty: function (value) { + return !$.common.isEmpty(value); + }, + // 空对象转字符串 + nullToStr: function(value) { + if ($.common.isEmpty(value)) { + return "-"; + } + return value; + }, + // 是否显示数据 为空默认为显示 + visible: function (value) { + if ($.common.isEmpty(value) || value == true) { + return true; + } + return false; + }, + // 空格截取 + trim: function (value) { + if (value == null) { + return ""; + } + return value.toString().replace(/(^\s*)|(\s*$)|\r|\n/g, ""); + }, + // 比较两个字符串(大小写敏感) + equals: function (str, that) { + return str == that; + }, + // 比较两个字符串(大小写不敏感) + equalsIgnoreCase: function (str, that) { + return String(str).toUpperCase() === String(that).toUpperCase(); + }, + // 将字符串按指定字符分割 + split: function (str, sep, maxLen) { + if ($.common.isEmpty(str)) { + return null; + } + var value = String(str).split(sep); + return maxLen ? value.slice(0, maxLen - 1) : value; + }, + // 字符串格式化(%s ) + sprintf: function (str) { + var args = arguments, flag = true, i = 1; + str = str.replace(/%s/g, function () { + var arg = args[i++]; + if (typeof arg === 'undefined') { + flag = false; + return ''; + } + return arg; + }); + return flag ? str : ''; + }, + // 指定随机数返回 + random: function (min, max) { + return Math.floor((Math.random() * max) + min); + }, + // 判断字符串是否是以start开头 + startWith: function(value, start) { + var reg = new RegExp("^" + start); + return reg.test(value) + }, + // 判断字符串是否是以end结尾 + endWith: function(value, end) { + var reg = new RegExp(end + "$"); + return reg.test(value) + }, + // 数组去重 + uniqueFn: function(array) { + var result = []; + var hashObj = {}; + for (var i = 0; i < array.length; i++) { + if (!hashObj[array[i]]) { + hashObj[array[i]] = true; + result.push(array[i]); + } + } + return result; + } + } + }); +})(jQuery); + +/** 表格类型 */ +table_type = { + bootstrapTable: 0, + bootstrapTreeTable: 1 +}; + +/** 消息状态码 */ +web_status = { + SUCCESS: 0, + FAIL: 500, + WARNING: 301 +}; + +/** 弹窗状态码 */ +modal_status = { + SUCCESS: "success", + FAIL: "error", + WARNING: "warning" }; \ No newline at end of file From 2ad741c4e8045229132a58e1e770759fe93a94f8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 12 Apr 2019 19:10:52 +0800 Subject: [PATCH 88/89] =?UTF-8?q?Constants=E9=83=A8=E5=88=86=E5=B8=B8?= =?UTF-8?q?=E9=87=8F=E6=B7=BB=E5=8A=A0final=E4=BF=AE=E9=A5=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/web/controller/common/CommonController.java | 2 +- .../src/main/resources/static/ruoyi/js/ry-ui.js | 1 - .../main/java/com/ruoyi/common/constant/Constants.java | 10 +++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index 8628f3938..817798bae 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -48,7 +48,7 @@ public class CommonController { if (!FileUtils.isValidFilename(fileName)) { - throw new Exception(StringUtils.format(" 文件名称({})非法,不允许下载。 ", fileName)); + throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName)); } String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1); String filePath = Global.getDownloadPath() + fileName; diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index f9e6d211e..5d4a24589 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -1085,7 +1085,6 @@ notAllowLastLevel: function(_tree) { var nodes = _tree.getSelectedNodes(); for (var i = 0; i < nodes.length; i++) { - //if (nodes[i].level == nodes.length + 1)判断是否是最后层级节点该条件判定四级组织结构时失效,如下只需判定选择的节点:isParent == false即可 modify by weidu 2019-04-10 if (!nodes[i].isParent) { $.modal.msgError("不能选择最后层级节点(" + nodes[i].name + ")"); return false; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java index 9dd843c36..1a52c1f7f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java @@ -40,25 +40,25 @@ public class Constants /** * 自动去除表前缀 */ - public static String AUTO_REOMVE_PRE = "true"; + public static final String AUTO_REOMVE_PRE = "true"; /** * 当前记录起始索引 */ - public static String PAGE_NUM = "pageNum"; + public static final String PAGE_NUM = "pageNum"; /** * 每页显示记录数 */ - public static String PAGE_SIZE = "pageSize"; + public static final String PAGE_SIZE = "pageSize"; /** * 排序列 */ - public static String ORDER_BY_COLUMN = "orderByColumn"; + public static final String ORDER_BY_COLUMN = "orderByColumn"; /** * 排序的方向 "desc" 或者 "asc". */ - public static String IS_ASC = "isAsc"; + public static final String IS_ASC = "isAsc"; } From 2d580917923d754bb1d34401802aa2586901a795 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 12 Apr 2019 19:28:21 +0800 Subject: [PATCH 89/89] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/system/dict/data/data.html | 11 +++-------- .../resources/templates/system/role/authUser.html | 11 +++-------- .../resources/templates/system/role/selectUser.html | 11 +++-------- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html b/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html index 06cedfc8e..e2af0293e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html +++ b/ruoyi-admin/src/main/resources/templates/system/dict/data/data.html @@ -122,14 +122,9 @@ }); function queryParams(params) { - return { - dictType: $("#dictType").val(), - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order - }; + var search = $.table.queryParams(params); + search.dictType = $("#dictType").val(); + return search; } /*字典数据-新增字典*/ diff --git a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html b/ruoyi-admin/src/main/resources/templates/system/role/authUser.html index f61f9ef09..649023551 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/authUser.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/authUser.html @@ -114,14 +114,9 @@ }); function queryParams(params) { - return { - roleId: $("#roleId").val(), - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order - }; + var search = $.table.queryParams(params); + search.roleId = $("#roleId").val(); + return search; } /* 分配用户-选择用户 */ diff --git a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html b/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html index 0650df3a2..fa98d8fda 100644 --- a/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html +++ b/ruoyi-admin/src/main/resources/templates/system/role/selectUser.html @@ -100,14 +100,9 @@ }); function queryParams(params) { - return { - roleId: $("#roleId").val(), - pageSize: params.limit, - pageNum: params.offset / params.limit + 1, - searchValue: params.search, - orderByColumn: params.sort, - isAsc: params.order - }; + var search = $.table.queryParams(params); + search.roleId = $("#roleId").val(); + return search; } /* 添加用户-选择用户-提交 */