diff --git a/src/components/UseUploadExcel/index.jsx b/src/components/UseUploadExcel/index.jsx index c39cf947..91222ab8 100644 --- a/src/components/UseUploadExcel/index.jsx +++ b/src/components/UseUploadExcel/index.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState, useRef, useEffect } from "react"; import { Button, Icon, BlockLoading, Notify, Grid } from "zent"; import { bachUploadAll, handelResponse } from "../../assets/api.js"; import "./style.less"; @@ -32,6 +32,20 @@ const UseUploadExcel = (props) => { const [totalData, setTotalData] = useState(0); const [errCoun, setErrCoun] = useState(0); const [tableData, setTableData] = useState([]); + const uploadInputRef = useRef(null); + const [isFileClick, setIsFileClick] = useState(false); + + useEffect(() => { + try { + let el = uploadInputRef.current; + console.log(el); + if (el) { + el.click(); + } + } catch (err) { + console.log("err =>", err); + } + }, [uploadInputRef, isFileClick]); const bachUploadState_200 = (res) => { setFilesTip(200); @@ -146,6 +160,8 @@ const UseUploadExcel = (props) => { setPartSuccessTag(false); setShowUpType(false); setDisabledSureBtn(true); + + setIsFileClick(!isFileClick); // onClose(); }; @@ -200,6 +216,7 @@ const UseUploadExcel = (props) => { return (