|  |  | 
 |  |  | import { usePapaParse } from './usePapaParse'; | 
 |  |  | import MatnrList from '../basicInfo/matnr/MatnrList'; | 
 |  |  | import request from '@/utils/request' | 
 |  |  |  | 
 |  |  | const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10, value, parmas = {} }) => { | 
 |  |  | import ImportExportOutlinedIcon from '@mui/icons-material/ImportExportOutlined'; | 
 |  |  | const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10, value, parmas = {}}) => { | 
 |  |  |     const refresh = useRefresh(); | 
 |  |  |     const translate = useTranslate(); | 
 |  |  |  | 
 |  |  | 
 |  |  |         } | 
 |  |  |         form.append('file', file); | 
 |  |  |         const { data: { code, data, msg } } = await request.post(`/${value}/import`, form) | 
 |  |  |  | 
 |  |  |         if (code === 200) { | 
 |  |  |             handleClose() | 
 |  |  |         } else { | 
 |  |  |             notify(msg); | 
 |  |  |  | 
 |  |  |             refresh() | 
 |  |  |         } else { | 
 |  |  |             handleClose() | 
 |  |  |             notify(msg); | 
 |  |  |             refresh() | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     }; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     const handleClose = () => { | 
 |  |  |         reset(); | 
 |  |  | 
 |  |  |     }; | 
 |  |  |  | 
 |  |  |     const downloadTemplate = async (type) => { | 
 |  |  |         const res = await request.post(`/${value}/template/download`, {}) | 
 |  |  |         const res = await request.post(`/${value}/template/download`, {}, { | 
 |  |  |             responseType: "blob", | 
 |  |  |         }) | 
 |  |  |         const url = window.URL.createObjectURL( | 
 |  |  |             new Blob([res.data], { type: res.headers["content-type"] }), | 
 |  |  |         ); | 
 |  |  |  | 
 |  |  |         const link = document.createElement("a"); | 
 |  |  |         link.href = url; | 
 |  |  |         link.setAttribute("download", `${value}.xlsx`); | 
 |  |  | 
 |  |  |                 <Toolbar | 
 |  |  |                     sx={{ | 
 |  |  |                         width: '100%', | 
 |  |  |                         justifyContent: 'end' | 
 |  |  |                     }} | 
 |  |  |                 > | 
 |  |  |                     {importer.state === 'idle' ? ( | 
 |  |  | 
 |  |  |                             <Button | 
 |  |  |                                 label="common.action.import.title" | 
 |  |  |                                 variant="contained" | 
 |  |  |                                 startIcon={<ImportExportOutlinedIcon />} | 
 |  |  |                                 size='medium' | 
 |  |  |                                 onClick={startImport} | 
 |  |  |                                 disabled={!file} | 
 |  |  |                             /> |