--添加解析execl插件,活动告警部分功能

This commit is contained in:
lai committed 2023-09-27 09:57:01 +08:00
1 parent 3b9b56fec9
commit ccf2eeef4d
23 files changed
+416 -100

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
import { read, utils } from 'xlsx';
/**
* 字体图标文件-静态资源文件路径
*/
const baseUrl = import.meta.env.VITE_HISTORY_BASE_URL;
export const scriptUrl = `${
baseUrl.length === 1 && baseUrl.indexOf('/') === 0
? ''
: baseUrl.indexOf('/') === -1
? '/' + baseUrl
: baseUrl
}/alarmHelp`;
/**
* 格式时间字符串
* @param dateStr 时间字符串
* @param formatStr 时间格式 默认YYYY-MM-DD HH:mm:ss
* @returns Date对象
*/
export async function parseStrToDate(): Promise<Record<string, any>[]> {
const f = await (await fetch(scriptUrl+"/20001.xlsx")).arrayBuffer();
const wb = read(f);1
const data = utils.sheet_to_json< Record<string, any>>(wb.Sheets[wb.SheetNames[0]]);
console.log(data);
return data;
}