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 (
1", data); let queryParams = _.omitBy( - { ...data, ...this.state.conditionalQuery, hash: this.state.hashPop }, + { + ...data, + ...this.state.conditionalQuery, + hash: data.hash !== "" ? data.hash : this.state.hashPop, + }, (value) => { return _.isNaN(value) || _.isNil(value); } @@ -206,13 +211,14 @@ export default class acclist extends React.Component { } iptsureFn(hash) { + console.log("hash =>", hash); let status = this.state.status > 0 ? this.state.status : null; this.setState({ page: 1, limit: 10 }); let data = { page: 1, limit: 10, }; - /* 兼容不同参数 当进行倒入操作时hash为字符串否则为object */ + // /* 兼容不同参数 当进行倒入操作时hash为字符串否则为object */ if (typeof hash !== "string") { data = { ...data, ...hash }; } else {