wujingjing
2024-10-31 bb4170bb6bf4af9cd76f976b1460ea76d33b3bb9
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;
         }
@@ -464,7 +463,8 @@
 * 最近 n 天的 startDate、endDate
 * @param dates
 */
export const getRecentDateRange = (dates: number) => {
export const getRecentDateRange = (dates: number, includesCurrent = true) => {
   dates = includesCurrent ? dates - 1 : dates;
   // 获取当前日期
   const endDate = new Date();
   const startDate = new Date();
@@ -706,7 +706,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 = {
@@ -742,5 +744,3 @@
   }
   return decodedData;
}