chore:加强了文件格式的校验和错误提示
This commit is contained in:
parent
2efe64862d
commit
32f38e1efb
@ -5,6 +5,8 @@ import * as XLSX from "xlsx";
|
||||
import { every, has } from "lodash-es";
|
||||
import { useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import { errorToast } from "@/components/GlobalToast";
|
||||
import { WorldGeo } from "./components/world-geo";
|
||||
import Web3BoxPng from "@/assets/image/home/web3-box.png";
|
||||
import Web3Box2Png from "@/assets/image/home/web3-box2.png";
|
||||
@ -15,10 +17,7 @@ import InterSvg from "@/assets/svg/home/inter.svg?react";
|
||||
import TrashSvg from "@/assets/svg/home/trash.svg?react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import eventBus, { eventTypes } from "@/utils/eventBus";
|
||||
import {
|
||||
setProxyInfoProxies,
|
||||
setProxiesLine,
|
||||
} from "@/store/web3Slice";
|
||||
import { setProxyInfoProxies, setProxiesLine } from "@/store/web3Slice";
|
||||
import type { AppDispatch, RootState } from "@/store";
|
||||
import "./index.scss";
|
||||
import { DialogConfig, FormAlertDialog } from "./components/FormAlertDialog";
|
||||
@ -130,13 +129,14 @@ const DecentralizedElasticNetwork = () => {
|
||||
];
|
||||
if (every(requiredFields, (field) => has(firstRow, field))) {
|
||||
jsonData.forEach((item: any) => {
|
||||
eventBus.emit(eventTypes.NODE_ADD, item);
|
||||
eventBus.emit(eventTypes.NODE_INIT, item);
|
||||
});
|
||||
}
|
||||
setOpen(false);
|
||||
return;
|
||||
} else {
|
||||
errorToast("Excel 文件为空或格式不正确", toast);
|
||||
}
|
||||
}
|
||||
console.error("Excel 文件为空或格式不正确");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error selecting file:", err);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user