From a8d64db9490afada57af838995a4d701fa87ecb4 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 19 Jul 2021 15:24:52 +0800 Subject: [PATCH] =?UTF-8?q?BI-90534=20fix:=20=E7=BB=86=E5=8C=96check?= =?UTF-8?q?=E6=A0=87=E7=BA=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/yearmonth/trigger.yearmonth.js | 6 +++++- src/widget/yearquarter/trigger.yearquarter.js | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/widget/yearmonth/trigger.yearmonth.js b/src/widget/yearmonth/trigger.yearmonth.js index 021c52fe6..df9ad4843 100644 --- a/src/widget/yearmonth/trigger.yearmonth.js +++ b/src/widget/yearmonth/trigger.yearmonth.js @@ -67,7 +67,11 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, { height: o.height, validationChecker: function (v) { if (isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, parseInt(v, 10) === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear() ? BI.parseDateTime(o.min, "%Y-%X-%d").getMonth() + 1 : 1, 1, o.min, o.max)[0]); + var month = self.monthEditor.getValue(); + if(BI.isEmptyString(month)) { + month = parseInt(v, 10) === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear() ? (BI.parseDateTime(o.min, "%Y-%X-%d").getMonth() + 1) : 1; + } + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, month, 1, o.min, o.max)[0]); } var year = self.yearEditor.getValue(); diff --git a/src/widget/yearquarter/trigger.yearquarter.js b/src/widget/yearquarter/trigger.yearquarter.js index 2d4a3f06e..419e4b160 100644 --- a/src/widget/yearquarter/trigger.yearquarter.js +++ b/src/widget/yearquarter/trigger.yearquarter.js @@ -65,7 +65,13 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, { height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, parseInt(v, 10) === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear() ? BI.parseDateTime(o.min, "%Y-%X-%d").getMonth() + 1 : 1, 1, o.min, o.max)[0]); + var month = self.quarterEditor.getValue(); + if(BI.isEmptyString(month)) { + month = parseInt(v, 10) === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear() ? BI.parseDateTime(o.min, "%Y-%X-%d").getMonth() + 1 : 1; + } else { + month = (v - 1) * 3 + 1; + } + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, month, 1, o.min, o.max)[0]); } var year = self.yearEditor.getValue();