|
|
|
@ -3,11 +3,14 @@ import styles from './index.less';
|
|
|
|
|
import { Input, Upload, UploadProps, message } from 'antd';
|
|
|
|
|
import ButtonComp from '@/components/ButtonComp';
|
|
|
|
|
import { college_table_query, deviceInit_init, deviceInstall_deviceInstall } from '@/services/api';
|
|
|
|
|
import { useParams } from 'umi';
|
|
|
|
|
import { fileStr, sysType } from '@/utils';
|
|
|
|
|
|
|
|
|
|
interface PageProps {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DeviceInstall: FC<PageProps> = ({ }) => {
|
|
|
|
|
const urlParams = useParams();
|
|
|
|
|
const [dataLoading, setDataLoading] = useState(false);
|
|
|
|
|
const [fileInfo, setFileInfo] = useState({
|
|
|
|
|
"secret": "",
|
|
|
|
@ -35,11 +38,13 @@ const DeviceInstall: FC<PageProps> = ({ }) => {
|
|
|
|
|
const props: UploadProps = {
|
|
|
|
|
maxCount: 1,
|
|
|
|
|
beforeUpload: (file: any) => {
|
|
|
|
|
let str = sysType[urlParams?.fileType] + fileStr[urlParams?.fileType]
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', file);
|
|
|
|
|
formData.append('sysType ', str);
|
|
|
|
|
deviceInit_init(formData).then((res) => {
|
|
|
|
|
if (res?.result == "success" && res?.data.length > 0) {
|
|
|
|
|
message.success('数据加载成功');
|
|
|
|
|
message.success('数据加载成功')
|
|
|
|
|
setFileInfo(res?.data[0]);
|
|
|
|
|
localStorage.setItem('deviceInit', JSON.stringify(res?.data[0]));
|
|
|
|
|
setDataLoading(true);
|
|
|
|
|