From 153576cf99bdd78c622b8cde1774ee25a369ccab Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Sun, 31 Dec 2023 23:15:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(laydate):=20=E4=BF=AE=E5=A4=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=20rangeLinked=20=E6=97=B6=EF=BC=8C=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E6=97=A5=E6=9C=9F=EF=BC=8C=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E6=97=B6=E9=97=B4=E4=BC=9A=E5=8F=8D=E9=80=89?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20(#1517)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(laydate): 修复 laydate 开启 rangeLinked 时,选择同一日期,某些情况时间会反选的问题 * chore(laydate): 简化代码 * update code * update code --- src/modules/laydate.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/modules/laydate.js b/src/modules/laydate.js index d6cc4067..41aaf390 100644 --- a/src/modules/laydate.js +++ b/src/modules/laydate.js @@ -1802,7 +1802,6 @@ // 重新选择或者第一次选择 index = 0; that.endState = false; - that.endDate = {}; } else { index = 1; that.endState = true; @@ -1860,18 +1859,22 @@ if (that.endState && that.autoCalendarModel.auto) { isChange = that.autoCalendarModel(); } - if ((isChange || that.rangeLinked && that.endState) && that.newDate(that.startDate) > that.newDate(that.endDate)) { + // 判断是否反选 + var needSwapDate = (isChange || that.rangeLinked && that.endState) && that.newDate(that.startDate) > that.newDate(that.endDate); + if (needSwapDate){ var isSameDate = that.startDate.year === that.endDate.year && that.startDate.month === that.endDate.month && that.startDate.date === that.endDate.date; - // 判断是否反选 - var startDate = that.startDate; - that.startDate = lay.extend({}, that.endDate, isSameDate ? {} : that.startTime); + var startDate; + // 如果是同一天并且出现了反选证明是时分秒出现开始时间大于结束时间的现象 + if(isSameDate){ + startDate = that.startTime; + that.startTime = that.endTime; + that.endTime = startDate; + } + // 当出现反向选择时(即“后点击”的日期比“先点击”的日期小),重新提取区间 + startDate = that.startDate; + that.startDate = lay.extend({}, that.endDate, that.startTime); options.dateTime = lay.extend({}, that.startDate); - that.endDate = lay.extend({}, startDate, isSameDate ? {} : that.endTime); - isSameDate && ( // 如果是同一天并且出现了反选证明是时分秒出现开始时间大于结束时间的现象 - startDate = that.startTime, - that.startTime = that.endTime, - that.endTime = startDate - ) + that.endDate = lay.extend({}, startDate, that.endTime); } isChange && (options.dateTime = lay.extend({}, that.startDate)); } From ce4696b52907329d599a999cd0f5c4f20bf4b502 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Sun, 31 Dec 2023 23:27:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(table):=20=E9=9D=9E=E5=B8=B8=E8=A7=84?= =?UTF-8?q?=E5=88=97=E8=AE=BE=E7=BD=AE=20`field`=20=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=20excel=20=E5=90=88=E8=AE=A1=E8=A1=8C?= =?UTF-8?q?=E9=94=99=E4=BD=8D=20(#1522)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/table.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/table.js b/src/modules/table.js index adc1a592..72e5cc8b 100644 --- a/src/modules/table.js +++ b/src/modules/table.js @@ -2967,6 +2967,9 @@ layui.define(['lay', 'laytpl', 'laypage', 'form', 'util'], function(exports){ // 插入内容 vals.push(content); + }else if(item3.field && item3.type !== 'normal'){ + // https://gitee.com/layui/layui/issues/I8PHCR + if(i1 == 0) fieldsIsHide[item3.field] = true; } }); }