From fac9dc2937706b2c7657419e4d8ffa3bf62049ea Mon Sep 17 00:00:00 2001 From: zhangds Date: Thu, 11 Aug 2022 18:12:36 +0800 Subject: [PATCH] =?UTF-8?q?1)=20=E5=A2=9E=E5=8A=A0file=20=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UseUploadExcel/index.jsx | 19 ++++++++++++++++++- src/pages/plan/keyList/index.jsx | 10 ++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) 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 {