Commit 5452ce6e authored by Sixiang_Zzb's avatar Sixiang_Zzb

用户模块批量上传优化

parent 8031fe53
......@@ -24,7 +24,7 @@ const ResultPageFailed = (props: any) => {
subTitle={<p>server has been handled it ,please try again or back.</p>}
extra={[
<Button type="primary" key="ok">
{/* <a href={'http://47.74.233.180:8651/tos/excel/down?operator_id=' + getCookie('id')}>
{/* <a href={'http://47.74.233.180:8651/tos/excel/down?operator_id=' + resultId}>
Download
</a> */}
<a href={'http://192.168.1.28:8651/tos/excel/down?operator_id=' + resultId}>Download</a>
......
......@@ -47,7 +47,7 @@ const Users = (props: any) => {
const [loading, setLoading] = useState(false);
const [fileUploading, setFileUploading] = useState(false);
const [compent, setCompent] = useState({ loading: false, fileUploading: false });
// const [compent, setCompent] = useState({ loading: false, fileUploading: false });
const userInfo = localStorage.getItem('userInfo') || '';
const id = JSON.parse(userInfo).userModel.id;
......@@ -108,9 +108,12 @@ const Users = (props: any) => {
if (info.file.status == 'uploading') {
setFileUploading(true);
}
console.log(info);
if (info.file.status === 'done') {
if (info.file.response.error_code == '0000') {
history.push(location.pathname + '/Result');
} else if (info.file.response.error_code == '0002') {
message.error(info.file.response.error_msg);
} else {
history.push(location.pathname + '/ResultFailed');
message.error(
......@@ -250,15 +253,17 @@ const Users = (props: any) => {
</button>
<div className={styles.buttonAdd}>
<Upload {...propsUpload}>
<Button icon={compent.fileUploading ? null : <UploadOutlined />}>
{compent.fileUploading ? (
<>
<Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} />
Uploading
</>
<Button
disabled={fileUploading}
icon={
fileUploading ? (
<LoadingOutlined style={{ fontSize: 16 }} spin />
) : (
'Batch Upload'
)}
<UploadOutlined />
)
}
>
{fileUploading ? 'Uploading' : 'Batch Upload'}
</Button>
</Upload>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment