From 08fc4740d50fa7595dbf4ebf58165a28ce073f1a Mon Sep 17 00:00:00 2001 From: RuoYi Date: Fri, 27 Aug 2021 11:51:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=87=8D=E7=BD=AE=E5=BC=80?= =?UTF-8?q?=E5=A7=8B/=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/common.js | 31 ++++++++++--------- .../main/resources/static/ruoyi/js/ry-ui.js | 9 ++++++ 2 files changed, 26 insertions(+), 14 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 d16d0459..227f37d2 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -2,6 +2,9 @@ * 通用方法封装处理 * Copyright (c) 2019 ruoyi */ + +var startLayDate; +var endLayDate; $(function() { // layer扩展皮肤 @@ -48,7 +51,7 @@ $(function() { if ($(".select-time").length > 0) { layui.use('laydate', function() { var laydate = layui.laydate; - var startDate = laydate.render({ + startLayDate = laydate.render({ elem: '#startTime', max: $('#endTime').val(), theme: 'molv', @@ -57,17 +60,17 @@ $(function() { done: function(value, date) { // 结束时间大于开始时间 if (value !== '') { - endDate.config.min.year = date.year; - endDate.config.min.month = date.month - 1; - endDate.config.min.date = date.date; + endLayDate.config.min.year = date.year; + endLayDate.config.min.month = date.month - 1; + endLayDate.config.min.date = date.date; } else { - endDate.config.min.year = ''; - endDate.config.min.month = ''; - endDate.config.min.date = ''; + endLayDate.config.min.year = ''; + endLayDate.config.min.month = ''; + endLayDate.config.min.date = ''; } } }); - var endDate = laydate.render({ + endLayDate = laydate.render({ elem: '#endTime', min: $('#startTime').val(), theme: 'molv', @@ -76,13 +79,13 @@ $(function() { done: function(value, date) { // 开始时间小于结束时间 if (value !== '') { - startDate.config.max.year = date.year; - startDate.config.max.month = date.month - 1; - startDate.config.max.date = date.date; + startLayDate.config.max.year = date.year; + startLayDate.config.max.month = date.month - 1; + startLayDate.config.max.date = date.date; } else { - startDate.config.max.year = '2099'; - startDate.config.max.month = '12'; - startDate.config.max.date = '31'; + startLayDate.config.max.year = '2099'; + startLayDate.config.max.month = '12'; + startLayDate.config.max.date = '31'; } } }); 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 2c38d8f2..e98c666f 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 @@ -680,6 +680,14 @@ var table = { } else if (table.options.type == table_type.bootstrapTreeTable) { $("#" + tableId).bootstrapTreeTable('refresh', []); } + if ($.common.isNotEmpty(startLayDate) && $.common.isNotEmpty(endLayDate)) { + endLayDate.config.min.year = ''; + endLayDate.config.min.month = ''; + endLayDate.config.min.date = ''; + startLayDate.config.max.year = '2099'; + startLayDate.config.max.month = '12'; + startLayDate.config.max.date = '31'; + } }, // 获取选中复选框项 selectCheckeds: function(name) { @@ -877,6 +885,7 @@ var table = { content: _url, shadeClose: $.common.isEmpty(options.shadeClose) ? true : options.shadeClose, skin: options.skin, + // options.btn设置为0表示不显示按钮 btn: $.common.isEmpty(options.btn) ? _btn : options.btn, yes: options.yes, cancel: function () {