From 3fd217676acf183618a201d4563e0fef81c2e3dc Mon Sep 17 00:00:00 2001 From: sunxiaobin89 <470459819@qq.com> Date: Thu, 15 Sep 2022 13:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/modules/laydate.css | 2 +- src/modules/layer.js | 46 ++++++++++++++++++++++++++++--------- src/modules/table.js | 11 ++++++++- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/css/modules/laydate.css b/src/css/modules/laydate.css index 44118799..4881d37b 100644 --- a/src/css/modules/laydate.css +++ b/src/css/modules/laydate.css @@ -121,7 +121,7 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;} .laydate-day-mark::after{background-color: #5FB878;} .layui-laydate-content td.layui-this .laydate-day-mark::after{display: none;} .layui-laydate-footer span[lay-type="date"]{color: #5FB878;} -.layui-laydate .layui-this{background-color: #009688 !important; color: #fff !important;} +.layui-laydate .layui-this,.layui-laydate .layui-this>div{background-color: #009688 !important; color: #fff !important;} .layui-laydate .laydate-disabled, .layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} .layui-laydate-content td>div{padding: 7px 0;height: 100%;} diff --git a/src/modules/layer.js b/src/modules/layer.js index 141c1138..d4855c38 100644 --- a/src/modules/layer.js +++ b/src/modules/layer.js @@ -988,18 +988,30 @@ layer.style = function(index, options, limit){ //最小化 layer.min = function(index, options){ options = options || {}; - var layero = $('#'+ doms[0] + index) - ,shadeo = $('#'+ doms.SHADE + index) - ,titHeight = layero.find(doms[1]).outerHeight() || 0 - ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' - ,position = layero.css('position') - ,settings = { + var layero = $('#'+ doms[0] + index); + + var maxminStatus = layero.data('maxminStatus'); + // 检查当前的状态是否已经是最小化 + if (maxminStatus === 'min') { + return; + } + // 当前处于最大化的状态 先恢初始状态再执行最小化 + if (maxminStatus === 'max') { + layer.restore(index); + } + layero.data('maxminStatus', 'min'); + + var shadeo = $('#'+ doms.SHADE + index); + var titHeight = layero.find(doms[1]).outerHeight() || 0; + var left = layero.attr('minLeft') || (181*ready.minIndex)+'px'; + var position = layero.css('position') + var settings = { width: 180 ,height: titHeight ,position: 'fixed' ,overflow: 'hidden' }; - + //记录宽高坐标,用于还原 ready.record(layero); @@ -1029,10 +1041,13 @@ layer.min = function(index, options){ //还原 layer.restore = function(index){ - var layero = $('#'+ doms[0] + index) - ,shadeo = $('#'+ doms.SHADE + index) - ,area = layero.attr('area').split(',') - ,type = layero.attr('type'); + var layero = $('#'+ doms[0] + index); + // 恢复最大最小状态 + layero.data('maxminStatus', ''); + + var shadeo = $('#'+ doms.SHADE + index); + var area = layero.attr('area').split(','); + var type = layero.attr('type'); //恢复原来尺寸 layer.style(index, { @@ -1056,6 +1071,15 @@ layer.restore = function(index){ //全屏 layer.full = function(index){ var layero = $('#'+ doms[0] + index), timer; + // 检查当前的状态是否已经是最小化 + var maxminStatus = layero.data('maxminStatus'); + if (maxminStatus === 'max') { + return; + } + if (maxminStatus === 'min') { + layer.restore(index); + } + layero.data('maxminStatus', 'max'); ready.record(layero); if(!doms.html.attr('layer-full')){ doms.html.css('overflow','hidden').attr('layer-full', index); diff --git a/src/modules/table.js b/src/modules/table.js index 9ce4da67..472b134a 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -1567,7 +1567,16 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ bodyHeight -= (that.layPage.outerHeight() || 43); } - that.layMain.outerHeight(bodyHeight); + if (options.adaptiveHeight) { + layui.each({elem: height, layMain: bodyHeight}, function (elemName, elemHeight) { + that[elemName].css({ + height: 'auto', + maxHeight: elemHeight + 'px' + }); + }); + } else { + that.layMain.outerHeight(bodyHeight); + } }; //获取滚动条宽度