From e36430729f3251967e87ac5af04627c9d380f9a6 Mon Sep 17 00:00:00 2001
From: meihangbo <50980487@qq.com>
Date: Mon, 4 Jul 2022 09:31:12 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=8E=A7=E4=BB=B6?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AD=E5=9B=BD=E6=B3=95=E5=AE=9A=E8=8A=82?=
=?UTF-8?q?=E5=81=87=E6=97=A5=E5=8F=8A=E8=A1=A5=E7=8F=AD=E6=A0=87=E6=B3=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
examples/laydate.html | 16 +++++++++++
src/css/modules/laydate/default/laydate.css | 4 +++
src/modules/laydate.js | 30 +++++++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/examples/laydate.html b/examples/laydate.html
index 7caf70ba..95e21780 100644
--- a/examples/laydate.html
+++ b/examples/laydate.html
@@ -76,6 +76,11 @@ body{padding: 50px 100px;}
+标注法定节假日及补班:
+
+
+
+
@@ -133,6 +138,10 @@ layui.use('laydate', function(laydate){
//全局配置
laydate.set({
//trigger: 'focus'
+ workrest: [
+ ['2022-1-1', '2022-1-2', '2022-1-3', '2022-1-31', '2022-2-1', '2022-2-2', '2022-2-3', '2022-2-4', '2022-2-5', '2022-2-6', '2022-4-3', '2022-4-4', '2022-4-5', '2022-4-30', '2022-5-1', '2022-5-2', '2022-5-3', '2022-5-4', '2022-6-3', '2022-6-4', '2022-6-5', '2022-9-10', '2022-9-11', '2022-9-12', '2022-10-1', '2022-10-2', '2022-10-3', '2022-10-4', '2022-10-5', '2022-10-6', '2022-10-7'],
+ ['2022-1-29', '2022-1-30', '2022-4-2', '2022-4-24', '2022-5-7', '2022-10-8', '2022-10-9']
+ ]
})
//范围选择1
@@ -279,6 +288,13 @@ layui.use('laydate', function(laydate){
console.log(value)
}
});
+
+ // 标注法定节假日及补班
+ var ins5555 = laydate.render({
+ elem: '#test5555',
+ value: '2022-5-21',
+ isWorkrest: true
+ });
//墨绿主题
laydate.render({
diff --git a/src/css/modules/laydate/default/laydate.css b/src/css/modules/laydate/default/laydate.css
index 2f54cf9c..9a0f3e9a 100644
--- a/src/css/modules/laydate/default/laydate.css
+++ b/src/css/modules/laydate/default/laydate.css
@@ -60,6 +60,10 @@ html #layuicss-laydate{display: none; position: absolute; width: 1989px;}
.layui-laydate-content td{position: relative; cursor: pointer;}
.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;}
.laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;}
+.laydate-day-workrest:before{position: absolute; left: 0;top: 3px;font-size: 12px;transform: scale(.7);}
+.laydate-day-workrest.rest:before{content:'假';color: #d11211;}
+.laydate-day-workrest.work:before{content:'班';color: #1589ee;}
+.layui-laydate .layui-this .laydate-day-workrest:before{color: #fff;}
/* 底部结构 */
.layui-laydate-footer{position: relative; height: 46px; line-height: 26px; padding: 10px;}
diff --git a/src/modules/laydate.js b/src/modules/laydate.js
index 3436ebe5..8d2a421b 100644
--- a/src/modules/laydate.js
+++ b/src/modules/laydate.js
@@ -121,6 +121,8 @@
,position: null //控件定位方式定位, 默认absolute,支持:fixed/absolute/static
,calendar: false //是否开启公历重要节日,仅支持中文版
,mark: {} //日期备注,如重要事件或活动标记
+ ,isWorkrest: false // 是否标注节假日或补假上班, 默认 false
+ ,workrest: [] // 标注法定节假日或补假上班
,zIndex: null //控件层叠顺序
,done: null //控件选择完毕后的回调,点击清空/现在/确定也均会触发
,change: null //日期时间改变后的回调
@@ -279,6 +281,10 @@
,'0-10-1': '国庆'
,'0-12-25': '圣诞'
} : {}, options.mark);
+
+ if(options.isWorkrest){
+ options.workrest = lay.extend({}, (options.calendar && options.lang === 'cn') ? [] : [], options.workrest);
+ }
//获取限制内日期
lay.each(['min', 'max'], function(i, item){
@@ -795,6 +801,22 @@
return that;
};
+
+ // 标注法定节假日或补假上班
+ Class.prototype.workrest = function(td, YMD) {
+ var that = this,
+ workrest,
+ workclsArr = ['rest', 'work'],
+ options = that.config;
+ lay.each(options.workrest, function(idx, itm) {
+ lay.each(itm, function(i, dayStr) {
+ if(dayStr === td[0].getAttribute('lay-ymd')){
+ td.html('' + YMD[2] + '');
+ }
+ });
+ });
+ return that;
+ }
//无效日期范围的标记
Class.prototype.limit = function(elem, date, index, time){
@@ -886,6 +908,14 @@
,month: YMD[1] - 1
,date: YMD[2]
}, index_);
+
+ if(options.isWorkrest){
+ that.workrest(item, YMD).limit(item, {
+ year: YMD[0]
+ ,month: YMD[1] - 1
+ ,date: YMD[2]
+ }, index_);
+ }
});
//同步头部年月
From 2b392ba6e01929ab05d2e6474fb0d8449ac7fffc Mon Sep 17 00:00:00 2001
From: drgg62086 <105614092+drgg62086@users.noreply.github.com>
Date: Mon, 4 Jul 2022 12:43:01 +0800
Subject: [PATCH 2/3] Update table.js
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
数据表格ajax请求增加jsonp相关参数
---
src/modules/table.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/modules/table.js b/src/modules/table.js
index b5812a0c..2e81ba58 100644
--- a/src/modules/table.js
+++ b/src/modules/table.js
@@ -835,7 +835,8 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
,url: options.url
,contentType: options.contentType
,data: data
- ,dataType: 'json'
+ ,dataType:options.dataType || 'json'
+ ,jsonpCallback:options.jsonpCallback
,headers: options.headers || {}
,success: function(res){
// 若有数据解析的回调,则获得其返回的数据
@@ -2324,6 +2325,7 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
// 过滤与数据无关的参数
var dataParams = new RegExp('^('+ [
'data', 'url', 'method', 'contentType',
+ 'dataType','jsonpCallback',
'headers', 'where', 'page', 'limit',
'request', 'response', 'parseData',
'scrollPos'
From b7a36cb0d62c91fa8a0b0110a4f7bcc7fc19e2f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B2=81=E6=9C=88=E5=B0=8F=E5=81=B7?= <470459819@qq.com>
Date: Tue, 5 Jul 2022 03:12:16 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtable=E5=92=8Cform?=
=?UTF-8?q?=E7=9A=84=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/form.js | 7 +++++--
src/modules/table.js | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/modules/form.js b/src/modules/form.js
index 35166efb..dd0c92ad 100644
--- a/src/modules/form.js
+++ b/src/modules/form.js
@@ -670,6 +670,7 @@ layui.define('layer', function(exports){
// elem 即要验证的区域表单选择器 - return true or false
Form.prototype.validate = function(elem){
+ var that = this;
var stop = null; //验证不通过状态
var verify = form.config.verify; //验证规则
var DANGER = 'layui-form-danger'; //警示样式
@@ -680,8 +681,10 @@ layui.define('layer', function(exports){
if(!elem[0]) return !0;
// 若节点不存在特定属性,则查找容器内有待验证的子节点
- if(!elem.attr('lay-verify')){
- elem = elem.find('*[lay-verify]');
+ if(elem.attr('lay-verify') === undefined){ // 如果校验的是一个不带验证规则的容器,校验内部的verify节点
+ if (that.validate(elem.find('*[lay-verify]')) === false) {
+ return false;
+ }
}
//开始校验
diff --git a/src/modules/table.js b/src/modules/table.js
index b5812a0c..bbe36362 100644
--- a/src/modules/table.js
+++ b/src/modules/table.js
@@ -796,6 +796,8 @@ layui.define(['laytpl', 'laypage', 'form', 'util'], function(exports){
that.layPage.find(ELEM_PAGE_VIEW).addClass(HIDE_V);
table.cache[that.key] = []; //格式化缓存数据
+
+ that.syncCheckAll();
};
// 初始页码