From c8a2c2577a554859662dc2b3e800a0ea3a8a9836 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 12 Jul 2021 14:04:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/dynamicdate/dynamicdate.trigger.js | 4 ++-- src/widget/dynamicdatetime/dynamicdatetime.trigger.js | 4 ++-- src/widget/year/trigger.year.js | 5 +++-- src/widget/yearmonth/trigger.yearmonth.js | 5 +++-- src/widget/yearquarter/trigger.yearquarter.js | 5 +++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/widget/dynamicdate/dynamicdate.trigger.js b/src/widget/dynamicdate/dynamicdate.trigger.js index 6a6170e917..807d6e3a53 100644 --- a/src/widget/dynamicdate/dynamicdate.trigger.js +++ b/src/widget/dynamicdate/dynamicdate.trigger.js @@ -22,8 +22,6 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, { BI.DynamicDateTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options, c = this._const; this.storeTriggerValue = ""; - var start = BI.parseDateTime(o.min, "%Y-%X-%d"); - var end = BI.parseDateTime(o.max, "%Y-%X-%d"); this.editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -50,6 +48,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, { if (!self._dateCheck(v)) { str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text"); } else { + var start = BI.parseDateTime(o.min, "%Y-%X-%d"); + var end = BI.parseDateTime(o.max, "%Y-%X-%d"); str = BI.i18nText("BI-Basic_Date_Range_Error", start.getFullYear(), start.getMonth() + 1, diff --git a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js index 1d2066516b..6e23f36544 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.trigger.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.trigger.js @@ -22,8 +22,6 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { BI.DynamicDateTimeTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options, c = this._const; this.storeTriggerValue = ""; - var start = BI.parseDateTime(o.min, "%Y-%X-%d"); - var end = BI.parseDateTime(o.max, "%Y-%X-%d"); this.editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -50,6 +48,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, { if (!self._dateCheck(v)) { str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text"); } else { + var start = BI.parseDateTime(o.min, "%Y-%X-%d"); + var end = BI.parseDateTime(o.max, "%Y-%X-%d"); str = BI.i18nText("BI-Basic_Date_Range_Error", start.getFullYear(), start.getMonth() + 1, diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index be289ee71d..545f422f5c 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -22,8 +22,6 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { _init: function () { BI.DynamicYearTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options, c = this._const; - var start = BI.parseDateTime(o.min, "%Y-%X-%d"); - var end = BI.parseDateTime(o.max, "%Y-%X-%d"); this.editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -39,6 +37,9 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, { allowBlank: true, errorText: function (v) { if (BI.isPositiveInteger(v)) { + var start = BI.parseDateTime(o.min, "%Y-%X-%d"); + var end = BI.parseDateTime(o.max, "%Y-%X-%d"); + return BI.i18nText("BI-Basic_Year_Range_Error", start.getFullYear(), end.getFullYear()); diff --git a/src/widget/yearmonth/trigger.yearmonth.js b/src/widget/yearmonth/trigger.yearmonth.js index a41747a8c0..c08e1e67f3 100644 --- a/src/widget/yearmonth/trigger.yearmonth.js +++ b/src/widget/yearmonth/trigger.yearmonth.js @@ -65,8 +65,6 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, { _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; - var start = BI.parseDateTime(o.min, "%Y-%X-%d"); - var end = BI.parseDateTime(o.max, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -89,6 +87,9 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, { return BI.i18nText("BI-Year_Trigger_Invalid_Text"); } + var start = BI.parseDateTime(o.min, "%Y-%X-%d"); + var end = BI.parseDateTime(o.max, "%Y-%X-%d"); + return BI.i18nText("BI-Basic_Year_Month_Range_Error", start.getFullYear(), start.getMonth() + 1, diff --git a/src/widget/yearquarter/trigger.yearquarter.js b/src/widget/yearquarter/trigger.yearquarter.js index bf19e80cb9..2d4a3f06e2 100644 --- a/src/widget/yearquarter/trigger.yearquarter.js +++ b/src/widget/yearquarter/trigger.yearquarter.js @@ -60,8 +60,6 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, { _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; - var start = BI.parseDateTime(o.min, "%Y-%X-%d"); - var end = BI.parseDateTime(o.max, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, @@ -83,6 +81,9 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, { return BI.i18nText("BI-Year_Trigger_Invalid_Text"); } + var start = BI.parseDateTime(o.min, "%Y-%X-%d"); + var end = BI.parseDateTime(o.max, "%Y-%X-%d"); + return BI.i18nText("BI-Basic_Year_Quarter_Range_Error", start.getFullYear(), BI.getQuarter(start),