From e87a818706621dbfd633371aaed96898c7cc8e88 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 29 Aug 2021 17:38:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=9C=9F=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E6=94=AF=E6=8C=81=E9=87=8D=E5=A4=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=9A=E7=BB=84=E6=97=A5=E6=9C=9F=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/utils/ruoyi.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index 67a31183..ce7253a2 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -55,16 +55,15 @@ export function resetForm(refName) { // 添加日期范围 export function addDateRange(params, dateRange, propName) { - var search = params; - search.params = {}; - if (null != dateRange && '' != dateRange) { - if (typeof (propName) === "undefined") { - search.params["beginTime"] = dateRange[0]; - search.params["endTime"] = dateRange[1]; - } else { - search.params["begin" + propName] = dateRange[0]; - search.params["end" + propName] = dateRange[1]; - } + let search = params; + search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; + dateRange = Array.isArray(dateRange) ? dateRange : []; + if (typeof (propName) === 'undefined') { + search.params['beginTime'] = dateRange[0]; + search.params['endTime'] = dateRange[1]; + } else { + search.params['begin' + propName] = dateRange[0]; + search.params['end' + propName] = dateRange[1]; } return search; }