From 7ea988cb5fa47ae404c3d282971941789ab7f063 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 30 May 2018 14:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=97=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bundle.js | 14 ++++++++++++-- dist/fineui.js | 14 ++++++++++++-- dist/widget.js | 14 ++++++++++++-- src/widget/dynamicdate/dynamicdate.caculate.js | 14 ++++++++++++-- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index ac3fe196b..1e5a2358b 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -90357,8 +90357,18 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** date = date.getOffsetDate(BI.parseInt(obj.day)); } if (BI.isNotNull(obj.workDay)) { - // todo 根据工作日做偏移 暂时按天偏移 - date = date.getOffsetDate(BI.parseInt(obj.workDay)); + // 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算 + if(BI.isNotNull(Date.holidays)) { + var count = Math.abs(obj.workDay); + for (var i = 0; i < count; i++) { + date = date.getOffsetDate(obj.workDay < 0 ? -1 : 1); + if(BI.isNotNull(Date.holidays[date.print("%Y-%X-%d")])) { + i--; + } + } + } else { + date = date.getOffsetDate(BI.parseInt(obj.workDay)); + } } if (BI.isNotNull(obj.position) && obj.position !== BI.DynamicDateCard.OFFSET.CURRENT) { date = this.getBeginDate(date, obj); diff --git a/dist/fineui.js b/dist/fineui.js index ad917b9ed..3ff5719e7 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -90600,8 +90600,18 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** date = date.getOffsetDate(BI.parseInt(obj.day)); } if (BI.isNotNull(obj.workDay)) { - // todo 根据工作日做偏移 暂时按天偏移 - date = date.getOffsetDate(BI.parseInt(obj.workDay)); + // 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算 + if(BI.isNotNull(Date.holidays)) { + var count = Math.abs(obj.workDay); + for (var i = 0; i < count; i++) { + date = date.getOffsetDate(obj.workDay < 0 ? -1 : 1); + if(BI.isNotNull(Date.holidays[date.print("%Y-%X-%d")])) { + i--; + } + } + } else { + date = date.getOffsetDate(BI.parseInt(obj.workDay)); + } } if (BI.isNotNull(obj.position) && obj.position !== BI.DynamicDateCard.OFFSET.CURRENT) { date = this.getBeginDate(date, obj); diff --git a/dist/widget.js b/dist/widget.js index 362385c04..9f591f72e 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -2778,8 +2778,18 @@ BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** date = date.getOffsetDate(BI.parseInt(obj.day)); } if (BI.isNotNull(obj.workDay)) { - // todo 根据工作日做偏移 暂时按天偏移 - date = date.getOffsetDate(BI.parseInt(obj.workDay)); + // 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算 + if(BI.isNotNull(Date.holidays)) { + var count = Math.abs(obj.workDay); + for (var i = 0; i < count; i++) { + date = date.getOffsetDate(obj.workDay < 0 ? -1 : 1); + if(BI.isNotNull(Date.holidays[date.print("%Y-%X-%d")])) { + i--; + } + } + } else { + date = date.getOffsetDate(BI.parseInt(obj.workDay)); + } } if (BI.isNotNull(obj.position) && obj.position !== BI.DynamicDateCard.OFFSET.CURRENT) { date = this.getBeginDate(date, obj); diff --git a/src/widget/dynamicdate/dynamicdate.caculate.js b/src/widget/dynamicdate/dynamicdate.caculate.js index 649b36729..75ad50dac 100644 --- a/src/widget/dynamicdate/dynamicdate.caculate.js +++ b/src/widget/dynamicdate/dynamicdate.caculate.js @@ -28,8 +28,18 @@ date = date.getOffsetDate(BI.parseInt(obj.day)); } if (BI.isNotNull(obj.workDay)) { - // todo 根据工作日做偏移 暂时按天偏移 - date = date.getOffsetDate(BI.parseInt(obj.workDay)); + // 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算 + if(BI.isNotNull(Date.holidays)) { + var count = Math.abs(obj.workDay); + for (var i = 0; i < count; i++) { + date = date.getOffsetDate(obj.workDay < 0 ? -1 : 1); + if(BI.isNotNull(Date.holidays[date.print("%Y-%X-%d")])) { + i--; + } + } + } else { + date = date.getOffsetDate(BI.parseInt(obj.workDay)); + } } if (BI.isNotNull(obj.position) && obj.position !== BI.DynamicDateCard.OFFSET.CURRENT) { date = this.getBeginDate(date, obj);