|
|
@ -9,13 +9,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
// 纵向排列月
|
|
|
|
// 纵向排列月
|
|
|
|
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; |
|
|
|
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; |
|
|
|
var items = []; |
|
|
|
var items = BI.chunk(month, 2); |
|
|
|
items.push(month.slice(0, 2)); |
|
|
|
|
|
|
|
items.push(month.slice(2, 4)); |
|
|
|
|
|
|
|
items.push(month.slice(4, 6)); |
|
|
|
|
|
|
|
items.push(month.slice(6, 8)); |
|
|
|
|
|
|
|
items.push(month.slice(8, 10)); |
|
|
|
|
|
|
|
items.push(month.slice(10, 12)); |
|
|
|
|
|
|
|
return BI.map(items, function (i, item) { |
|
|
|
return BI.map(items, function (i, item) { |
|
|
|
return BI.map(item, function (j, td) { |
|
|
|
return BI.map(item, function (j, td) { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -57,10 +51,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, { |
|
|
|
action: function () { |
|
|
|
action: function () { |
|
|
|
var value = this.getValue(); |
|
|
|
var value = this.getValue(); |
|
|
|
self._checkMonthStatus(value); |
|
|
|
self._checkMonthStatus(value); |
|
|
|
self.setValue({ |
|
|
|
self._setYear(value); |
|
|
|
year: value, |
|
|
|
|
|
|
|
month: self.selectedMonth |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}] |
|
|
|
}] |
|
|
|
}, { |
|
|
|
}, { |
|
|
@ -106,7 +97,8 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, { |
|
|
|
var o = this.options; |
|
|
|
var o = this.options; |
|
|
|
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); |
|
|
|
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); |
|
|
|
var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); |
|
|
|
var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); |
|
|
|
var minMonth = 0; var maxMonth = 11; |
|
|
|
var minMonth = 0; |
|
|
|
|
|
|
|
var maxMonth = 11; |
|
|
|
minYear === year && (minMonth = minDate.getMonth()); |
|
|
|
minYear === year && (minMonth = minDate.getMonth()); |
|
|
|
maxYear === year && (maxMonth = maxDate.getMonth()); |
|
|
|
maxYear === year && (maxMonth = maxDate.getMonth()); |
|
|
|
var yearInvalid = year < minYear || year > maxYear; |
|
|
|
var yearInvalid = year < minYear || year > maxYear; |
|
|
@ -116,6 +108,22 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_setYear: function (year) { |
|
|
|
|
|
|
|
var o = this.options; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var dateVoid = BI.checkDateVoid(year, this.selectedMonth, 1, o.min, o.max); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在切换年的时候,如果月份不在区间内了,取消选中
|
|
|
|
|
|
|
|
if (BI.contains(["y", "m"], dateVoid[0])) { |
|
|
|
|
|
|
|
this.selectedYear = year; |
|
|
|
|
|
|
|
this.month.setValue(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.selectedYear = year; |
|
|
|
|
|
|
|
this.month.setValue(this.selectedMonth); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
setMinDate: function (minDate) { |
|
|
|
setMinDate: function (minDate) { |
|
|
|
if (this.options.min !== minDate) { |
|
|
|
if (this.options.min !== minDate) { |
|
|
|
this.options.min = minDate; |
|
|
|
this.options.min = minDate; |
|
|
|