diff --git a/src/pages/Suite/components/RightContent/ExportCase.tsx b/src/pages/Suite/components/RightContent/ExportCase.tsx index a338fd13b59cb58d152523170b19ef4278abaaa8..8c179bc9ab6482639e73a74be32e6e8a580ef73c 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) }