|
|
|
@ -9,7 +9,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
iconWidth: 24 |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
|
props: () => ({ |
|
|
|
|
extraCls: "bi-date-time-trigger", |
|
|
|
|
min: "1900-01-01", // 最小日期
|
|
|
|
|
max: "2099-12-31", // 最大日期
|
|
|
|
@ -17,8 +17,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
iconWidth: 24, |
|
|
|
|
format: "", // 显示的日期格式化方式
|
|
|
|
|
allowEdit: true, // 是否允许编辑
|
|
|
|
|
watermark: "" |
|
|
|
|
}, |
|
|
|
|
watermark: BI.i18nText("BI-Basic_Unrestricted"), |
|
|
|
|
}), |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
BI.DynamicDateTimeTrigger.superclass._init.apply(this, arguments); |
|
|
|
@ -44,7 +44,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
hgap: c.hgap, |
|
|
|
|
vgap: c.vgap, |
|
|
|
|
allowBlank: true, |
|
|
|
|
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"), |
|
|
|
|
watermark: o.watermark, |
|
|
|
|
errorText: function (v) { |
|
|
|
|
var str = ""; |
|
|
|
|
if (!BI.isKey(o.format)) { |
|
|
|
@ -149,7 +149,11 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getTitle: function () { |
|
|
|
|
var o = this.options; |
|
|
|
|
var storeValue = this.storeValue || {}; |
|
|
|
|
if (BI.isEmptyObject(storeValue)) { |
|
|
|
|
return o.watermark; |
|
|
|
|
} |
|
|
|
|
var type = storeValue.type || BI.DynamicDateCombo.Static; |
|
|
|
|
var value = storeValue.value; |
|
|
|
|
switch (type) { |
|
|
|
@ -197,7 +201,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
// 这边不能直接用\d+去切日期, 因为format格式可能是20190607这样的没有分割符的 = =
|
|
|
|
|
// 先看一下是否是合法的, 如果合法就变成标准格式的走原来的流程, 不合法不关心
|
|
|
|
|
var date = BI.parseDateTime(v, this._getFormatString()); |
|
|
|
|
if(BI.print(date, this._getFormatString()) === v) { |
|
|
|
|
if (BI.print(date, this._getFormatString()) === v) { |
|
|
|
|
v = BI.print(date, c.compareFormat); |
|
|
|
|
result = [0, 1, 2]; |
|
|
|
|
} |
|
|
|
@ -214,7 +218,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
BI.isNumeric(v) && v.length === 1 && (suffixArray[idx] = "0" + v); |
|
|
|
|
}); |
|
|
|
|
// hh:mm
|
|
|
|
|
if(suffixArray.length === 2 && !hasSecond) { |
|
|
|
|
if (suffixArray.length === 2 && !hasSecond) { |
|
|
|
|
suffixArray.push("00"); |
|
|
|
|
} |
|
|
|
|
var suffixString = suffixArray.join(":"); |
|
|
|
@ -283,42 +287,42 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
_getText: function (obj) { |
|
|
|
|
var value = ""; |
|
|
|
|
var endText = ""; |
|
|
|
|
if(BI.isNotNull(obj.year)) { |
|
|
|
|
if(BI.parseInt(obj.year) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.year)) { |
|
|
|
|
if (BI.parseInt(obj.year) !== 0) { |
|
|
|
|
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); |
|
|
|
|
} |
|
|
|
|
if(BI.isNotNull(obj.quarter)) { |
|
|
|
|
if(BI.parseInt(obj.quarter) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.quarter)) { |
|
|
|
|
if (BI.parseInt(obj.quarter) !== 0) { |
|
|
|
|
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); |
|
|
|
|
} |
|
|
|
|
if(BI.isNotNull(obj.month)) { |
|
|
|
|
if(BI.parseInt(obj.month) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.month)) { |
|
|
|
|
if (BI.parseInt(obj.month) !== 0) { |
|
|
|
|
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); |
|
|
|
|
} |
|
|
|
|
if(BI.isNotNull(obj.week)) { |
|
|
|
|
if(BI.parseInt(obj.week) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.week)) { |
|
|
|
|
if (BI.parseInt(obj.week) !== 0) { |
|
|
|
|
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); |
|
|
|
|
} |
|
|
|
|
if(BI.isNotNull(obj.day)) { |
|
|
|
|
if(BI.parseInt(obj.day) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.day)) { |
|
|
|
|
if (BI.parseInt(obj.day) !== 0) { |
|
|
|
|
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; |
|
|
|
|
} |
|
|
|
|
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { |
|
|
|
|
if (BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { |
|
|
|
|
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
|
|
|
|
} |
|
|
|
|
return value + endText; |
|
|
|
|
return value + endText; |
|
|
|
|
|
|
|
|
|
function getPositionText (baseText, position) { |
|
|
|
|
function getPositionText(baseText, position) { |
|
|
|
|
switch (position) { |
|
|
|
|
case BI.DynamicDateCard.OFFSET.BEGIN: |
|
|
|
|
return baseText + BI.i18nText("BI-Basic_Begin_Start"); |
|
|
|
|