mirror of https://github.com/layui/layui
laydate修复面板联动的一些问题;
parent
3ec8870678
commit
93f8f6a48e
|
@ -113,8 +113,8 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
||||||
.layui-laydate-content{border-top: none 0; border-bottom: none 0;}
|
.layui-laydate-content{border-top: none 0; border-bottom: none 0;}
|
||||||
.layui-laydate-content th{color: #333;}
|
.layui-laydate-content th{color: #333;}
|
||||||
.layui-laydate-content td{color: #666;}
|
.layui-laydate-content td{color: #666;}
|
||||||
.layui-laydate-content td.laydate-selected{background-color: #B5FFF8;}
|
.layui-laydate-content td.laydate-selected>div{background-color: #00F7DE;}
|
||||||
.laydate-selected:hover{background-color: #00F7DE !important;}
|
.laydate-selected:hover>div{background-color: #00F7DE !important;}
|
||||||
.layui-laydate-content td>div:hover,
|
.layui-laydate-content td>div:hover,
|
||||||
.layui-laydate-list li:hover,
|
.layui-laydate-list li:hover,
|
||||||
.layui-laydate-shortcut>li:hover{background-color: #eee; color: #333;}
|
.layui-laydate-shortcut>li:hover{background-color: #eee; color: #333;}
|
||||||
|
@ -123,8 +123,8 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
|
||||||
.laydate-time-list>li:hover{background: none;}
|
.laydate-time-list>li:hover{background: none;}
|
||||||
.layui-laydate-content .laydate-day-prev,
|
.layui-laydate-content .laydate-day-prev,
|
||||||
.layui-laydate-content .laydate-day-next{color: #d2d2d2;}
|
.layui-laydate-content .laydate-day-next{color: #d2d2d2;}
|
||||||
.laydate-selected.laydate-day-prev,
|
.laydate-selected.laydate-day-prev>div,
|
||||||
.laydate-selected.laydate-day-next{background-color: #f8f8f8 !important;}
|
.laydate-selected.laydate-day-next>div{background-color: #f8f8f8 !important;}
|
||||||
.layui-laydate-footer{border-top: 1px solid #e2e2e2;}
|
.layui-laydate-footer{border-top: 1px solid #e2e2e2;}
|
||||||
.layui-laydate-hint{color: #FF5722;}
|
.layui-laydate-hint{color: #FF5722;}
|
||||||
.laydate-day-mark::after{background-color: #5FB878;}
|
.laydate-day-mark::after{background-color: #5FB878;}
|
||||||
|
|
|
@ -252,7 +252,8 @@
|
||||||
//切换日历联动方式
|
//切换日历联动方式
|
||||||
that.autoCalendarModel = function () {
|
that.autoCalendarModel = function () {
|
||||||
var state = that.calendarLinkage;
|
var state = that.calendarLinkage;
|
||||||
that.calendarLinkage = (options.range && (options.type === 'date' || options.type === 'datetime')) && that.startDate && that.endDate && that.startDate.year === that.endDate.year && that.startDate.month === that.endDate.month;
|
that.calendarLinkage = (options.range && (options.type === 'date' || options.type === 'datetime'))
|
||||||
|
&& that.startDate && that.endDate && that.startDate.year === that.endDate.year && that.startDate.month === that.endDate.month;
|
||||||
lay(that.elem)[that.calendarLinkage ? 'addClass' : 'removeClass']('layui-laydate-linkage');
|
lay(that.elem)[that.calendarLinkage ? 'addClass' : 'removeClass']('layui-laydate-linkage');
|
||||||
return that.calendarLinkage != state; // 返回发生了变化
|
return that.calendarLinkage != state; // 返回发生了变化
|
||||||
};
|
};
|
||||||
|
@ -839,8 +840,7 @@
|
||||||
if(fn === 'limit') {
|
if(fn === 'limit') {
|
||||||
if (options.range) {
|
if (options.range) {
|
||||||
checkValid(that.calendarLinkage ? that.startDate : dateTime); // 校验开始时间
|
checkValid(that.calendarLinkage ? that.startDate : dateTime); // 校验开始时间
|
||||||
checkValid(that.endDate); // 校验结束时间
|
that.endDate && checkValid(that.endDate); // 校验结束时间
|
||||||
that.endState = !that.calendarLinkage || !!(that.startDate && that.endDate);
|
|
||||||
} else {
|
} else {
|
||||||
checkValid(dateTime);
|
checkValid(dateTime);
|
||||||
}
|
}
|
||||||
|
@ -1709,6 +1709,7 @@
|
||||||
// 重新选择或者第一次选择
|
// 重新选择或者第一次选择
|
||||||
index = 0;
|
index = 0;
|
||||||
that.endState = false;
|
that.endState = false;
|
||||||
|
that.endDate = {};
|
||||||
} else {
|
} else {
|
||||||
index = 1;
|
index = 1;
|
||||||
that.endState = true;
|
that.endState = true;
|
||||||
|
@ -1759,6 +1760,8 @@
|
||||||
if (!index) {
|
if (!index) {
|
||||||
that.startDate = lay.extend({}, dateTime); // 同步startDate
|
that.startDate = lay.extend({}, dateTime); // 同步startDate
|
||||||
}
|
}
|
||||||
|
// 校验另外一个日期是否在有效的范围内
|
||||||
|
if (that.endState && !that.limit({date: that.thisDateTime(1 - index)})) {
|
||||||
// 根据选择之后判断是否需要切换模式
|
// 根据选择之后判断是否需要切换模式
|
||||||
var isChange;
|
var isChange;
|
||||||
if (that.endState && that.autoCalendarModel.auto) {
|
if (that.endState && that.autoCalendarModel.auto) {
|
||||||
|
@ -1778,8 +1781,8 @@
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
isChange && (options.dateTime = lay.extend({}, that.startDate));
|
isChange && (options.dateTime = lay.extend({}, that.startDate));
|
||||||
|
}
|
||||||
that.calendar(null, that.calendarLinkage ? null : index, isChange || that.calendarLinkage ? 'init' : null).done(null, 'change');
|
that.calendar(null, that.calendarLinkage ? null : index, isChange || that.calendarLinkage ? 'init' : null).done(null, 'change');
|
||||||
// that.calendar(null, null, 'init').done(null, 'change');
|
|
||||||
} else if(options.position === 'static'){ //直接嵌套的选中
|
} else if(options.position === 'static'){ //直接嵌套的选中
|
||||||
that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调
|
that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调
|
||||||
} else if(options.type === 'date'){
|
} else if(options.type === 'date'){
|
||||||
|
@ -1928,10 +1931,9 @@
|
||||||
year: YM[0]
|
year: YM[0]
|
||||||
,month: YM[1]
|
,month: YM[1]
|
||||||
});
|
});
|
||||||
if (that.calendarLinkage) {
|
|
||||||
that.checkDate('limit').calendar(null, null, 'init');
|
that.checkDate('limit').calendar(null, null, 'init');
|
||||||
} else {
|
if (!that.calendarLinkage) {
|
||||||
that.checkDate('limit').calendar(null, index);
|
|
||||||
that.choose(lay(elemCont).find('td.layui-this'), index);
|
that.choose(lay(elemCont).find('td.layui-this'), index);
|
||||||
that.done(null, 'change');
|
that.done(null, 'change');
|
||||||
}
|
}
|
||||||
|
@ -1945,10 +1947,9 @@
|
||||||
year: YM[0]
|
year: YM[0]
|
||||||
,month: YM[1]
|
,month: YM[1]
|
||||||
});
|
});
|
||||||
if (that.calendarLinkage) {
|
|
||||||
that.checkDate('limit').calendar(null, null, 'init');
|
that.checkDate('limit').calendar(null, null, 'init');
|
||||||
} else {
|
if (!that.calendarLinkage) {
|
||||||
that.checkDate('limit').calendar(null, index);
|
|
||||||
that.choose(lay(elemCont).find('td.layui-this'), index);
|
that.choose(lay(elemCont).find('td.layui-this'), index);
|
||||||
that.done(null, 'change');
|
that.done(null, 'change');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue