From b38d6ee6b3dc90876a36471fa53584a5050c9764 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 29 Mar 2018 10:29:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=A7=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E4=BA=9B=E8=AE=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bundle.js | 17 ++++++++++++++--- dist/case.js | 4 ++-- dist/widget.js | 13 ++++++++++++- src/case/calendar/calendar.js | 4 ++-- src/widget/datepane/card.static.datepane.js | 13 ++++++++++++- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index 5e001d76a..aaa6a5769 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -73708,7 +73708,7 @@ BI.extend(BI.Calendar, { var year = BI.getDate().getFullYear(); var month = BI.getDate().getMonth(); var page = (json.year - year) * 12; - page += json.month - month; + page += json.month - 1 - month; return page; }, getDateJSONByPage: function (v) { @@ -73725,7 +73725,7 @@ BI.extend(BI.Calendar, { var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); return { year: BI.getDate().getFullYear() + year, - month: month + month: month + 1 }; } }); @@ -87998,8 +87998,19 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, { max: o.max }); this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { - self.selectedTime = self.datePicker.getValue(); + var value = self.datePicker.getValue(); + var monthDay = BI.getDate(value.year, value.month - 1, 1).getMonthDays(); + var day = self.selectedTime.day || 0; + if (day > monthDay) { + day = monthDay; + } + self.selectedTime = { + year: value.year, + month: value.month, + day: day + }; self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); + self.calendar.setValue(self.selectedTime); }); this.calendar = BI.createWidget({ diff --git a/dist/case.js b/dist/case.js index 36019acf4..d32e38344 100644 --- a/dist/case.js +++ b/dist/case.js @@ -1768,7 +1768,7 @@ BI.extend(BI.Calendar, { var year = BI.getDate().getFullYear(); var month = BI.getDate().getMonth(); var page = (json.year - year) * 12; - page += json.month - month; + page += json.month - 1 - month; return page; }, getDateJSONByPage: function (v) { @@ -1785,7 +1785,7 @@ BI.extend(BI.Calendar, { var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); return { year: BI.getDate().getFullYear() + year, - month: month + month: month + 1 }; } }); diff --git a/dist/widget.js b/dist/widget.js index 4dcb9d530..946e0f356 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -1487,8 +1487,19 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, { max: o.max }); this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { - self.selectedTime = self.datePicker.getValue(); + var value = self.datePicker.getValue(); + var monthDay = BI.getDate(value.year, value.month - 1, 1).getMonthDays(); + var day = self.selectedTime.day || 0; + if (day > monthDay) { + day = monthDay; + } + self.selectedTime = { + year: value.year, + month: value.month, + day: day + }; self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); + self.calendar.setValue(self.selectedTime); }); this.calendar = BI.createWidget({ diff --git a/src/case/calendar/calendar.js b/src/case/calendar/calendar.js index f755fa4e0..88af96547 100644 --- a/src/case/calendar/calendar.js +++ b/src/case/calendar/calendar.js @@ -177,7 +177,7 @@ BI.extend(BI.Calendar, { var year = BI.getDate().getFullYear(); var month = BI.getDate().getMonth(); var page = (json.year - year) * 12; - page += json.month - month; + page += json.month - 1 - month; return page; }, getDateJSONByPage: function (v) { @@ -194,7 +194,7 @@ BI.extend(BI.Calendar, { var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); return { year: BI.getDate().getFullYear() + year, - month: month + month: month + 1 }; } }); diff --git a/src/widget/datepane/card.static.datepane.js b/src/widget/datepane/card.static.datepane.js index b97fac1bd..650d90bc5 100644 --- a/src/widget/datepane/card.static.datepane.js +++ b/src/widget/datepane/card.static.datepane.js @@ -30,8 +30,19 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, { max: o.max }); this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { - self.selectedTime = self.datePicker.getValue(); + var value = self.datePicker.getValue(); + var monthDay = BI.getDate(value.year, value.month - 1, 1).getMonthDays(); + var day = self.selectedTime.day || 0; + if (day > monthDay) { + day = monthDay; + } + self.selectedTime = { + year: value.year, + month: value.month, + day: day + }; self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); + self.calendar.setValue(self.selectedTime); }); this.calendar = BI.createWidget({