|
|
|
@ -25428,6 +25428,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
|
|
|
|
|
if (!window.BI) { |
|
|
|
|
window.BI = {}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function isEmpty (value) { |
|
|
|
|
// 判断是否为空值
|
|
|
|
|
var result = value === "" || value === null || value === undefined; |
|
|
|
@ -25717,7 +25718,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
|
|
|
|
|
|
|
|
|
|
// replace the html special tags
|
|
|
|
|
BI.htmlEncode = function (text) { |
|
|
|
|
return (text == null) ? '' : String(text).replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>').replace(/\s/g, ' '); |
|
|
|
|
return (text == null) ? "" : String(text).replace(/&/g, "&").replace(/\"/g, """).replace(/</g, "<").replace(/>/g, ">").replace(/\s/g, " "); |
|
|
|
|
}; |
|
|
|
|
// html decode
|
|
|
|
|
BI.htmlDecode = function (text) { |
|
|
|
@ -25932,6 +25933,70 @@ BI.ShowAction = BI.inherit(BI.Action, {
|
|
|
|
|
return text; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 将Java提供的日期格式字符串装换为JS识别的日期格式字符串 |
|
|
|
|
* @class FR.parseFmt |
|
|
|
|
* @param fmt 日期格式 |
|
|
|
|
* @returns {String} |
|
|
|
|
*/ |
|
|
|
|
BI.parseFmt = function (fmt) { |
|
|
|
|
if (!fmt) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
//日期
|
|
|
|
|
fmt = String(fmt) |
|
|
|
|
//年
|
|
|
|
|
.replace(/y{4,}/g, "%Y")//yyyy的时候替换为Y
|
|
|
|
|
.replace(/y{2}/g, "%y")//yy的时候替换为y
|
|
|
|
|
//月
|
|
|
|
|
.replace(/M{4,}/g, "%b")//MMMM的时候替换为b,八
|
|
|
|
|
.replace(/M{3}/g, "%B")//MMM的时候替换为M,八月
|
|
|
|
|
.replace(/M{2}/g, "%X")//MM的时候替换为X,08
|
|
|
|
|
.replace(/M{1}/g, "%x")//M的时候替换为x,8
|
|
|
|
|
.replace(/a{1}/g, "%p"); |
|
|
|
|
//天
|
|
|
|
|
if (new RegExp("d{2,}", "g").test(fmt)) { |
|
|
|
|
fmt = fmt.replace(/d{2,}/g, "%d");//dd的时候替换为d
|
|
|
|
|
} else { |
|
|
|
|
fmt = fmt.replace(/d{1}/g, "%e");//d的时候替换为j
|
|
|
|
|
} |
|
|
|
|
//时
|
|
|
|
|
if (new RegExp("h{2,}", "g").test(fmt)) {//12小时制
|
|
|
|
|
fmt = fmt.replace(/h{2,}/g, "%I"); |
|
|
|
|
} else { |
|
|
|
|
fmt = fmt.replace(/h{1}/g, "%I"); |
|
|
|
|
} |
|
|
|
|
if (new RegExp("H{2,}", "g").test(fmt)) {//24小时制
|
|
|
|
|
fmt = fmt.replace(/H{2,}/g, "%H"); |
|
|
|
|
} else { |
|
|
|
|
fmt = fmt.replace(/H{1}/g, "%H"); |
|
|
|
|
} |
|
|
|
|
fmt = fmt.replace(/m{2,}/g, "%M")//分
|
|
|
|
|
//秒
|
|
|
|
|
.replace(/s{2,}/g, "%S"); |
|
|
|
|
|
|
|
|
|
return fmt; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 把字符串按照对应的格式转化成日期对象 |
|
|
|
|
* |
|
|
|
|
* @example |
|
|
|
|
* var result = FR.str2Date('2013-12-12', 'yyyy-MM-dd');//Thu Dec 12 2013 00:00:00 GMT+0800
|
|
|
|
|
* |
|
|
|
|
* @class FR.str2Date |
|
|
|
|
* @param str 字符串 |
|
|
|
|
* @param format 日期格式 |
|
|
|
|
* @returns {*} |
|
|
|
|
*/ |
|
|
|
|
BI.str2Date = function (str, format) { |
|
|
|
|
if (typeof str != "string" || typeof format != "string") { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
var fmt = BI.parseFmt(format); |
|
|
|
|
return BI.parseDateTime(str, fmt); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 把日期对象按照指定格式转化成字符串 |
|
|
|
|
* |
|
|
|
@ -26062,8 +26127,6 @@ BI.ShowAction = BI.inherit(BI.Action, {
|
|
|
|
|
return parseInt(str); |
|
|
|
|
} |
|
|
|
|
return parseFloat(str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
BI.object2Date = function (obj) { |
|
|
|
@ -26105,7 +26168,7 @@ BI.ShowAction = BI.inherit(BI.Action, {
|
|
|
|
|
return dt; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dt = BI.str2Date(str, "HH:mm:ss"); |
|
|
|
|
dt = BI.parseDateTime(str, "HH:mm:ss"); |
|
|
|
|
if (!isInvalidDate(dt)) { |
|
|
|
|
return dt; |
|
|
|
|
} |
|
|
|
|