删除多余代码
parent
82f3a01ac3
commit
9c9cb23ab2
|
|
@ -1,8 +1,3 @@
|
|||
// NProgress.start();
|
||||
// window.onload = function () {
|
||||
// NProgress.done();
|
||||
// }
|
||||
|
||||
layui.use(["element", "layer"], function () {
|
||||
var element = layui.element;
|
||||
var $ = layui.jquery;
|
||||
|
|
|
|||
|
|
@ -1,91 +0,0 @@
|
|||
var dateUtil = {
|
||||
/**
|
||||
* 格式化时间
|
||||
* @param date
|
||||
* @param fmt
|
||||
* @returns {*}
|
||||
*/
|
||||
dateFormat: function (date, fmt) {
|
||||
var o = {
|
||||
"M+": date.getMonth() + 1,
|
||||
"d+": date.getDate(),
|
||||
"h+": date.getHours(),
|
||||
"m+": date.getMinutes(),
|
||||
"s+": date.getSeconds(),
|
||||
"q+": Math.floor((date.getMonth() + 3) / 3),
|
||||
"S": date.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/.test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var strUtil = {
|
||||
/**
|
||||
* 判断字符串是否为空
|
||||
* @param str 传入的字符串
|
||||
* @returns {}
|
||||
*/
|
||||
isEmpty: function (str) {
|
||||
if (str != null && str.length > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 判断两个字符串是否相同
|
||||
* @param str1
|
||||
* @param str2
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isEquals: function (str1, str2) {
|
||||
if (str1 == str2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 忽略大小写判断字符串是否相同
|
||||
* @param str1
|
||||
* @param str2
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isEqualsIgnoreCase: function (str1, str2) {
|
||||
if (str1.toUpperCase() == str2.toUpperCase()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 判断是否是数字
|
||||
* @param value
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isNum: function (value) {
|
||||
if (value != null && value.length > 0 && isNaN(value) == false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 判断是否是中文
|
||||
* @param str
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
isChinese: function (str) {
|
||||
var reg = /^([u4E00-u9FA5]|[uFE30-uFFA0])*$/;
|
||||
if (reg.test(str)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
|
@ -43,60 +43,85 @@ layui.define("layer", function (exports) {
|
|||
});
|
||||
return deferred.promise();
|
||||
},
|
||||
table: {
|
||||
/**
|
||||
* 主要用于针对表格批量操作操作之前的检查
|
||||
* @param table
|
||||
* @returns {string}
|
||||
*/
|
||||
batchCheck: function (table) {
|
||||
var checkStatus = table.checkStatus("tableId");
|
||||
var rows = checkStatus.data.length;
|
||||
if (rows > 0) {
|
||||
var idsStr = "";
|
||||
for (var i = 0; i < checkStatus.data.length; i++) {
|
||||
idsStr += checkStatus.data[i].id + ",";
|
||||
}
|
||||
return idsStr;
|
||||
} else {
|
||||
layer.msg("未选择有效数据", {offset: "t", anim: 6});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 在表格页面操作成功后弹窗提示
|
||||
* @param content
|
||||
*/
|
||||
successMsg: function (content) {
|
||||
layer.msg(content, {icon: 1, time: 1000}, function () {
|
||||
// 刷新当前页table数据
|
||||
$(".layui-laypage-btn")[0].click();
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 判断是否为一个正常的数字
|
||||
* @param num
|
||||
*/
|
||||
isNum: function (num) {
|
||||
if (num && !isNaN(num)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* 判断一个数字是否包括在某个范围
|
||||
* @param num
|
||||
* @param begin
|
||||
* @param end
|
||||
*/
|
||||
isNumWith: function (num, begin, end) {
|
||||
if (this.isNum(num)) {
|
||||
if (num >= begin && num <= end) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
table: {
|
||||
/**
|
||||
* 主要用于针对表格批量操作操作之前的检查
|
||||
* @param table
|
||||
* @returns {string}
|
||||
*/
|
||||
batchCheck: function (table) {
|
||||
var checkStatus = table.checkStatus("tableId");
|
||||
var rows = checkStatus.data.length;
|
||||
if (rows > 0) {
|
||||
var idsStr = "";
|
||||
for (var i = 0; i < checkStatus.data.length; i++) {
|
||||
idsStr += checkStatus.data[i].id + ",";
|
||||
}
|
||||
return idsStr;
|
||||
} else {
|
||||
layer.msg("未选择有效数据", {offset: "t", anim: 6});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 在表格页面操作成功后弹窗提示
|
||||
* @param content
|
||||
*/
|
||||
successMsg: function (content) {
|
||||
layer.msg(content, {icon: 1, time: 1000}, function () {
|
||||
// 刷新当前页table数据
|
||||
$(".layui-laypage-btn")[0].click();
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 判断是否为一个正常的数字
|
||||
* @param num
|
||||
*/
|
||||
isNum: function (num) {
|
||||
if (num && !isNaN(num)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* 判断一个数字是否包括在某个范围
|
||||
* @param num
|
||||
* @param begin
|
||||
* @param end
|
||||
*/
|
||||
isNumWith: function (num, begin, end) {
|
||||
if (this.isNum(num)) {
|
||||
if (num >= begin && num <= end) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
date: {
|
||||
/**
|
||||
* 格式化时间
|
||||
* @param date
|
||||
* @param fmt
|
||||
* @returns {*}
|
||||
*/
|
||||
dateFormat: function (date, fmt) {
|
||||
var o = {
|
||||
"M+": date.getMonth() + 1,
|
||||
"d+": date.getDate(),
|
||||
"h+": date.getHours(),
|
||||
"m+": date.getMinutes(),
|
||||
"s+": date.getSeconds(),
|
||||
"q+": Math.floor((date.getMonth() + 3) / 3),
|
||||
"S": date.getMilliseconds()
|
||||
};
|
||||
if (/(y+)/.test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports("okUtils", okUtils);
|
||||
|
|
|
|||
Loading…
Reference in New Issue