From 6e3dff485788426e94b7fad0edb1717e3f0c9f40 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 14 十一月 2024 11:24:06 +0800 Subject: [PATCH] selfAdapt --- src/utils/util.ts | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/util.ts b/src/utils/util.ts index 7aee14c..830c686 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -214,7 +214,6 @@ ) => { if (!treeData || treeData.length === 0) return; if (!parent) parent = treeData; - for (let index = 0; index < treeData.length; index++) { const value = treeData[index] as any; if (markParent) { @@ -233,7 +232,7 @@ if (value[childrenKey] && value[childrenKey].length !== 0) { // 閫掑綊璺冲嚭 - const callResult = travelTree(value[childrenKey], callback, value, markParent); + const callResult = travelTree(value[childrenKey], callback, value, markParent, childrenKey); if (callResult) { return true; } @@ -471,6 +470,7 @@ const startDate = new Date(); startDate.setTime(startDate.getTime() - 3600 * 1000 * 24 * dates); startDate.setHours(0, 0, 0, 0); + endDate.setHours(23,59,59,59) return [startDate, endDate]; }; @@ -707,7 +707,9 @@ */ export const toMyFixed = (num, precision) => { if (num == null) return ''; - return num.toFixed(precision).replace(/\.?0+$/, ''); + if (!precision) return num + ''; + const factor = Math.pow(10, precision); + return Math.round(Number(num) * factor) / factor + ''; }; type GetTextWidthOption = { @@ -743,5 +745,3 @@ } return decodedData; } - - -- Gitblit v1.9.3