laydate修复点击日历面板头部的上下月上下年或者选择年月转换日历直接确认而不是跳转到对应面板的问题

pull/1185/head
sunxiaobin89 2 years ago
parent 7a7578acc5
commit 2fba280516

@ -977,7 +977,7 @@
that.startDate = that.startDate || value && lay.extend({}, options.dateTime); // 有默认值才初始化startDate that.startDate = that.startDate || value && lay.extend({}, options.dateTime); // 有默认值才初始化startDate
that.autoCalendarModel.auto && that.autoCalendarModel(); that.autoCalendarModel.auto && that.autoCalendarModel();
that.endState = !that.rangeLinked || !!(that.startDate && that.endDate); // 初始化选中范围状态 that.endState = !options.range || !that.rangeLinked || !!(that.startDate && that.endDate); // 初始化选中范围状态
fn && fn(); fn && fn();
return that; return that;
@ -1401,7 +1401,6 @@
} }
} else { } else {
that.checkDate('limit').calendar(dateTime, index, 'init'); // 重新渲染一下两个面板 that.checkDate('limit').calendar(dateTime, index, 'init'); // 重新渲染一下两个面板
that.rangeLinked || that.choose(lay(elemCont).find('td.layui-this'), index);
that.closeList(); that.closeList();
} }
@ -1416,7 +1415,7 @@
} }
} }
that.done(null, 'change'); (that.autoCalendarModel.auto && !that.rangeLinked) ? that.choose(lay(elemCont).find('td.layui-this'), index) : (that.endState && that.done(null, 'change'));
lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED); lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED);
}); });
} else { //时间选择面板 - 选择事件 } else { //时间选择面板 - 选择事件
@ -1946,8 +1945,8 @@
} else { } else {
dateTime.year--; dateTime.year--;
that.checkDate('limit').calendar(null, index); that.checkDate('limit').calendar(null, index);
that.choose(lay(elemCont).find('td.layui-this'), index); // 面板自动切换的模式下重新判定是否发生模式转换等细节处理
that.done(null, 'change'); that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change');
} }
} }
,prevMonth: function(){ ,prevMonth: function(){
@ -1962,8 +1961,7 @@
that.checkDate('limit').calendar(null, null, 'init'); that.checkDate('limit').calendar(null, null, 'init');
if (!that.rangeLinked) { if (!that.rangeLinked) {
that.choose(lay(elemCont).find('td.layui-this'), index); that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change');
that.done(null, 'change');
} }
} }
,nextMonth: function(){ ,nextMonth: function(){
@ -1978,8 +1976,7 @@
that.checkDate('limit').calendar(null, null, 'init'); that.checkDate('limit').calendar(null, null, 'init');
if (!that.rangeLinked) { if (!that.rangeLinked) {
that.choose(lay(elemCont).find('td.layui-this'), index); that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change');
that.done(null, 'change');
} }
} }
,nextYear: function(){ ,nextYear: function(){
@ -1990,8 +1987,7 @@
} else { } else {
dateTime.year++; dateTime.year++;
that.checkDate('limit').calendar(null, index); that.checkDate('limit').calendar(null, index);
that.choose(lay(elemCont).find('td.layui-this'), index); that.autoCalendarModel.auto ? that.choose(lay(elemCont).find('td.layui-this'), index) : that.done(null, 'change');
that.done(null, 'change');
} }
} }
}; };

Loading…
Cancel
Save