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