1) 增加file 重新选择文件功能
This commit is contained in:
parent
e4057c7cfa
commit
fac9dc2937
|
@ -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 (
|
||||
<div className="upload-excel-01">
|
||||
<input
|
||||
ref={uploadInputRef}
|
||||
type="file"
|
||||
accept=".xls,.xlsx,.csv"
|
||||
className="upload-input"
|
||||
|
|
|
@ -113,8 +113,13 @@ export default class acclist extends React.Component {
|
|||
}
|
||||
|
||||
getKeyCodeList(data) {
|
||||
console.log("data => 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 {
|
||||
|
|
Loading…
Reference in New Issue