From e9060cf8f241536a896d69d0044769bd3b0e8d49 Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期五, 25 十月 2024 09:25:49 +0800 Subject: [PATCH] Merge branch 'test' of http://47.103.154.90:83/r/WI/Web.Admin.V1.0 into test --- src/utils/util.ts | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/utils/util.ts b/src/utils/util.ts index 8941a5f..7aee14c 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -1,11 +1,11 @@ import { ElMessage, ElMessageBox } from 'element-plus'; import JSONbig from 'json-bigint'; + import { storeToRefs } from 'pinia'; import { unref, type Ref } from 'vue'; import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes'; import { useThemeConfig } from '/@/stores/themeConfig'; import request from '/@/utils/request'; - /** * @description 褰撶鍒� JSON 涓瓨鍦ㄨ繃闀跨殑鏁板瓧鏃讹紝浣跨敤 JSONbigString 瑙f瀽锛屾暟瀛椾細杞负瀛楃涓插鐞� * 鐢ㄦ硶锛欽SONbigString.parse(jsonStr)锛� @@ -258,7 +258,7 @@ * @param tableData * @returns */ -export const flatten = (tableData: any[], removeChild?: boolean, children = 'Children'): any[] => { +export const flatten = (tableData: any[], removeChild?: boolean, children = 'children'): any[] => { const flattenedData: any[] = []; for (const item of tableData) { @@ -464,7 +464,8 @@ * 鏈�杩� n 澶╃殑 startDate銆乪ndDate * @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(); @@ -709,7 +710,6 @@ return num.toFixed(precision).replace(/\.?0+$/, ''); }; - type GetTextWidthOption = { size?: string; family?: string; @@ -734,3 +734,14 @@ document.body.removeChild(spanEle); return width; } + +export function decodeFormData(formDataString) { + const params = new URLSearchParams(formDataString); + const decodedData = {}; + for (const [key, value] of params) { + decodedData[key] = decodeURIComponent(value); + } + return decodedData; +} + + -- Gitblit v1.9.3