From 274b0ffe09e46c0446a095e65dba1b0fab606bfe Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 24 Mar 2021 16:09:43 +0800 Subject: [PATCH] =?UTF-8?q?BI-83687=20fix:=20=E5=8A=A8=E6=80=81=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=9D=A2=E6=9D=BF=E6=8F=90=E7=A4=BA=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/year/card.dynamic.year.js | 6 +- src/widget/year/popup.year.js | 2 +- .../yearmonth/card.dynamic.yearmonth.js | 76 +++++++++++-------- src/widget/yearmonth/popup.yearmonth.js | 2 +- .../yearquarter/card.dynamic.yearquarter.js | 76 +++++++++++-------- src/widget/yearquarter/popup.yearquarter.js | 2 +- 6 files changed, 94 insertions(+), 70 deletions(-) diff --git a/src/widget/year/card.dynamic.year.js b/src/widget/year/card.dynamic.year.js index cbd086022..536fc0163 100644 --- a/src/widget/year/card.dynamic.year.js +++ b/src/widget/year/card.dynamic.year.js @@ -93,6 +93,10 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, { }; }, + getInputValue: function () { + return this._getValue(); + }, + getValue: function () { return this.checkValidation() ? this._getValue() : {}; }, @@ -106,7 +110,7 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, { invalid = !this._checkDate(this._getValue()); errorText = this._getErrorText(); } - invalid && show && BI.Bubbles.show("dynamic-year-error", errorText, this.wrapper); + invalid && show && BI.Bubbles.show("dynamic-year-error", errorText, this.item); return !invalid; }, diff --git a/src/widget/year/popup.year.js b/src/widget/year/popup.year.js index 3a00aad88..0782b43f1 100644 --- a/src/widget/year/popup.year.js +++ b/src/widget/year/popup.year.js @@ -87,7 +87,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { this.yearButton.setValue(BI.i18nText("BI-Basic_Current_Year")); this.yearButton.setEnable(!this._checkYearValid()); } else { - var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); + var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); date = BI.print(date, "%Y"); this.yearButton.setValue(date); this.yearButton.setEnable(false); diff --git a/src/widget/yearmonth/card.dynamic.yearmonth.js b/src/widget/yearmonth/card.dynamic.yearmonth.js index 7d5ee8d56..9b6ffb66d 100644 --- a/src/widget/yearmonth/card.dynamic.yearmonth.js +++ b/src/widget/yearmonth/card.dynamic.yearmonth.js @@ -15,47 +15,53 @@ BI.DynamicYearMonthCard = BI.inherit(BI.Widget, { var self = this; return { type: "bi.vertical", - ref: function (_ref) { - self.wrapper = _ref; - }, items: [{ type: "bi.label", text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), textAlign: "left", height: 24 }, { - type: "bi.dynamic_date_param_item", - validationChecker: BI.bind(self._checkDate, self), - ref: function () { - self.year = this; + type: "bi.vertical", + ref: function (_ref) { + self.wrapper = _ref; }, - listeners: [{ - eventName: "EVENT_CHANGE", - action: function () { - self.fireEvent("EVENT_CHANGE"); - } + items: [{ + el: { + type: "bi.dynamic_date_param_item", + validationChecker: BI.bind(self._checkDate, self), + ref: function () { + self.year = this; + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }, { + eventName: "EVENT_INPUT_CHANGE", + action: function () { + BI.Bubbles.hide("dynamic-year-month-error"); + } + }] + }, + bgap: 10, }, { - eventName: "EVENT_INPUT_CHANGE", - action: function () { - BI.Bubbles.hide("dynamic-year-month-error"); - } - }] - }, { - type: "bi.dynamic_date_param_item", - dateType: BI.DynamicDateCard.TYPE.MONTH, - ref: function () { - self.month = this; - }, - listeners: [{ - eventName: "EVENT_CHANGE", - action: function () { - self.fireEvent("EVENT_CHANGE"); - } - }, { - eventName: "EVENT_INPUT_CHANGE", - action: function () { - BI.Bubbles.hide("dynamic-year-month-error"); - } + type: "bi.dynamic_date_param_item", + dateType: BI.DynamicDateCard.TYPE.MONTH, + ref: function () { + self.month = this; + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }, { + eventName: "EVENT_INPUT_CHANGE", + action: function () { + BI.Bubbles.hide("dynamic-year-month-error"); + } + }] }] }], vgap: 10, @@ -132,6 +138,10 @@ BI.DynamicYearMonthCard = BI.inherit(BI.Widget, { }; }, + getInputValue: function () { + return this._getValue(); + }, + getValue: function () { return this.checkValidation() ? this._getValue() : {}; }, diff --git a/src/widget/yearmonth/popup.yearmonth.js b/src/widget/yearmonth/popup.yearmonth.js index e94fd58b7..8ebaaefc0 100644 --- a/src/widget/yearmonth/popup.yearmonth.js +++ b/src/widget/yearmonth/popup.yearmonth.js @@ -87,7 +87,7 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, { this.textButton.setValue(BI.i18nText("BI-Basic_Current_Month")); this.textButton.setEnable(!this._checkTodayValid()); } else { - var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); + var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); date = BI.print(date, "%Y-%x"); this.textButton.setValue(date); this.textButton.setEnable(false); diff --git a/src/widget/yearquarter/card.dynamic.yearquarter.js b/src/widget/yearquarter/card.dynamic.yearquarter.js index 1d4030023..588aa05cf 100644 --- a/src/widget/yearquarter/card.dynamic.yearquarter.js +++ b/src/widget/yearquarter/card.dynamic.yearquarter.js @@ -15,47 +15,53 @@ BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, { var self = this; return { type: "bi.vertical", - ref: function (_ref) { - self.wrapper = _ref; - }, items: [{ type: "bi.label", text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), textAlign: "left", height: 24 }, { - type: "bi.dynamic_date_param_item", - validationChecker: BI.bind(self._checkDate, self), - ref: function () { - self.year = this; + type: "bi.vertical", + ref: function (_ref) { + self.wrapper = _ref; }, - listeners: [{ - eventName: "EVENT_CHANGE", - action: function () { - self.fireEvent("EVENT_CHANGE"); - } + items: [{ + el: { + type: "bi.dynamic_date_param_item", + validationChecker: BI.bind(self._checkDate, self), + ref: function () { + self.year = this; + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }, { + eventName: "EVENT_INPUT_CHANGE", + action: function () { + BI.Bubbles.hide("dynamic-year-quarter-error"); + } + }] + }, + bgap: 10 }, { - eventName: "EVENT_INPUT_CHANGE", - action: function () { - BI.Bubbles.hide("dynamic-year-quarter-error"); - } - }] - }, { - type: "bi.dynamic_date_param_item", - dateType: BI.DynamicDateCard.TYPE.QUARTER, - ref: function () { - self.quarter = this; - }, - listeners: [{ - eventName: "EVENT_CHANGE", - action: function () { - self.fireEvent("EVENT_CHANGE"); - } - }, { - eventName: "EVENT_INPUT_CHANGE", - action: function () { - BI.Bubbles.hide("dynamic-year-quarter-error"); - } + type: "bi.dynamic_date_param_item", + dateType: BI.DynamicDateCard.TYPE.QUARTER, + ref: function () { + self.quarter = this; + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); + } + }, { + eventName: "EVENT_INPUT_CHANGE", + action: function () { + BI.Bubbles.hide("dynamic-year-quarter-error"); + } + }] }] }], vgap: 10, @@ -132,6 +138,10 @@ BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, { }; }, + getInputValue: function () { + return this._getValue(); + }, + getValue: function () { return this.checkValidation() ? this._getValue() : {}; }, diff --git a/src/widget/yearquarter/popup.yearquarter.js b/src/widget/yearquarter/popup.yearquarter.js index 16d29b424..e1e001d1b 100644 --- a/src/widget/yearquarter/popup.yearquarter.js +++ b/src/widget/yearquarter/popup.yearquarter.js @@ -80,7 +80,7 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, { this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter")); this.textButton.setEnable(!this._checkTodayValid()); } else { - var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); + var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); date = BI.print(date, "%Y-%Q"); this.textButton.setValue(date); this.textButton.setEnable(false);