From 2cc77798c9e21bd7d903d7fa25e7f36d6bf85c36 Mon Sep 17 00:00:00 2001 From: wulibaibao <13366578180@163.com> Date: Fri, 15 Apr 2022 12:17:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=BC=E5=85=A5=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/RightContent/ExportCase.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/Suite/components/RightContent/ExportCase.tsx b/src/pages/Suite/components/RightContent/ExportCase.tsx index a338fd1..8c179bc 100644 --- a/src/pages/Suite/components/RightContent/ExportCase.tsx +++ b/src/pages/Suite/components/RightContent/ExportCase.tsx @@ -1,5 +1,5 @@ import React from "react" -import { Modal, Form, Space, Button, Typography, Upload, message, UploadProps } from "antd" +import { Modal, Form, Space, Button, Typography, Upload, message, UploadProps, Tooltip } from "antd" import { UploadOutlined } from "@ant-design/icons" import { downloadCaseTempFile } from "@/pages/Suite/services"; @@ -17,12 +17,29 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re const [visible, setVisible] = React.useState(false) const [loading, setLoading] = React.useState(false) + const [fileList, setFileList] = React.useState([]) const uploadProps: UploadProps = { action: "/api/case/import/", method: 'post', accept: '.xls,.xlsx', name: "excel", + maxCount: 1, + multiple: false, + fileList, + itemRender: (originNode, file, currFileList) => { + const errorNode = {originNode.props.children}; + return ( + file.status === 'error' ? errorNode : originNode + ) + }, + onChange(info: any) { + console.log(info) + setFileList(info.fileList) + }, + onRemove(info: any) { + setFileList(info.fileList || []) + } }; React.useImperativeHandle(ref, () => ({ @@ -36,6 +53,7 @@ const ReactComponent: React.ForwardRefRenderFunction = (props, re const handleCancel = () => { setVisible(false) + setFileList([]) setLoading(false) } -- Gitee