| | |
| | | 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 解析,数字会转为字符串处理 |
| | | * 用法:JSONbigString.parse(jsonStr)) |
| | |
| | | * @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) { |
| | |
| | | * 最近 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(); |
| | |
| | | return num.toFixed(precision).replace(/\.?0+$/, ''); |
| | | }; |
| | | |
| | | |
| | | type GetTextWidthOption = { |
| | | size?: string; |
| | | family?: string; |
| | |
| | | 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; |
| | | } |
| | | |
| | | |