Browse Source

!82 日期控件功问题修复及功能增强

Merge pull request !82 from javacspring/develop
pull/82/MERGE
javacspring 6 years ago committed by 若依
parent
commit
5b29b2098b
  1. 63
      ruoyi-admin/src/main/resources/static/ruoyi/js/common.js

63
ruoyi-admin/src/main/resources/static/ruoyi/js/common.js

@ -69,25 +69,50 @@ $(function() {
}
// laydate time-input 时间控件绑定
if ($(".time-input").length > 0) {
layui.use('laydate', function() {
var laydate = layui.laydate;
var times = $(".time-input");
// 控制控件外观
var type = times.attr("data-type") || 'date';
// 控制回显格式
var format = times.attr("data-format") || 'yyyy-MM-dd';
for (var i = 0; i < times.length; i++) {
var time = times[i];
laydate.render({
elem: time,
theme: 'molv',
trigger: 'click',
type: type,
format: format,
done: function(value, date) {}
});
}
});
layui.use('laydate', function () {
var com = layui.laydate;
$(".time-input").each(function (index, item) {
var time = $(item);
// 控制控件外观
var type = time.attr("data-type") || 'date';
// 控制回显格式
var format = time.attr("data-format") || 'yyyy-MM-dd';
// 控制日期控件按钮
var buttons = time.attr("data-btn") || 'clear|now|confirm', newBtnArr = [];
// 日期控件选择完成后回调处理
var callback = time.attr("data-callback") || {};
if (buttons) {
if (buttons.indexOf("|") > 0) {
var btnArr = buttons.split("|"), btnLen = btnArr.length;
for (var j = 0; j < btnLen; j++) {
if ("clear" === btnArr[j] || "now" === btnArr[j] || "confirm" === btnArr[j]) {
newBtnArr.push(btnArr[j]);
}
}
} else {
if ("clear" === buttons || "now" === buttons || "confirm" === buttons) {
newBtnArr.push(buttons);
}
}
} else {
newBtnArr = ['clear', 'now', 'confirm'];
}
com.render({
elem: item,
theme: 'molv',
trigger: 'click',
type: type,
format: format,
btns: newBtnArr,
done: function (value, data) {
if (typeof window[callback] != 'undefined'
&& window[callback] instanceof Function) {
window[callback](value, data);
}
}
});
});
});
}
// tree 关键字搜索绑定
if ($("#keyword").length > 0) {

Loading…
Cancel
Save