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 { Button, Icon, BlockLoading, Notify, Grid } from "zent";
|
||||||
import { bachUploadAll, handelResponse } from "../../assets/api.js";
|
import { bachUploadAll, handelResponse } from "../../assets/api.js";
|
||||||
import "./style.less";
|
import "./style.less";
|
||||||
|
@ -32,6 +32,20 @@ const UseUploadExcel = (props) => {
|
||||||
const [totalData, setTotalData] = useState(0);
|
const [totalData, setTotalData] = useState(0);
|
||||||
const [errCoun, setErrCoun] = useState(0);
|
const [errCoun, setErrCoun] = useState(0);
|
||||||
const [tableData, setTableData] = useState([]);
|
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) => {
|
const bachUploadState_200 = (res) => {
|
||||||
setFilesTip(200);
|
setFilesTip(200);
|
||||||
|
@ -146,6 +160,8 @@ const UseUploadExcel = (props) => {
|
||||||
setPartSuccessTag(false);
|
setPartSuccessTag(false);
|
||||||
setShowUpType(false);
|
setShowUpType(false);
|
||||||
setDisabledSureBtn(true);
|
setDisabledSureBtn(true);
|
||||||
|
|
||||||
|
setIsFileClick(!isFileClick);
|
||||||
// onClose();
|
// onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -200,6 +216,7 @@ const UseUploadExcel = (props) => {
|
||||||
return (
|
return (
|
||||||
<div className="upload-excel-01">
|
<div className="upload-excel-01">
|
||||||
<input
|
<input
|
||||||
|
ref={uploadInputRef}
|
||||||
type="file"
|
type="file"
|
||||||
accept=".xls,.xlsx,.csv"
|
accept=".xls,.xlsx,.csv"
|
||||||
className="upload-input"
|
className="upload-input"
|
||||||
|
|
|
@ -113,8 +113,13 @@ export default class acclist extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getKeyCodeList(data) {
|
getKeyCodeList(data) {
|
||||||
|
console.log("data => 1", data);
|
||||||
let queryParams = _.omitBy(
|
let queryParams = _.omitBy(
|
||||||
{ ...data, ...this.state.conditionalQuery, hash: this.state.hashPop },
|
{
|
||||||
|
...data,
|
||||||
|
...this.state.conditionalQuery,
|
||||||
|
hash: data.hash !== "" ? data.hash : this.state.hashPop,
|
||||||
|
},
|
||||||
(value) => {
|
(value) => {
|
||||||
return _.isNaN(value) || _.isNil(value);
|
return _.isNaN(value) || _.isNil(value);
|
||||||
}
|
}
|
||||||
|
@ -206,13 +211,14 @@ export default class acclist extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
iptsureFn(hash) {
|
iptsureFn(hash) {
|
||||||
|
console.log("hash =>", hash);
|
||||||
let status = this.state.status > 0 ? this.state.status : null;
|
let status = this.state.status > 0 ? this.state.status : null;
|
||||||
this.setState({ page: 1, limit: 10 });
|
this.setState({ page: 1, limit: 10 });
|
||||||
let data = {
|
let data = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
};
|
};
|
||||||
/* 兼容不同参数 当进行倒入操作时hash为字符串否则为object */
|
// /* 兼容不同参数 当进行倒入操作时hash为字符串否则为object */
|
||||||
if (typeof hash !== "string") {
|
if (typeof hash !== "string") {
|
||||||
data = { ...data, ...hash };
|
data = { ...data, ...hash };
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue