From b011b1368c2f8813ef2684a4a63914e6e59b5e15 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期四, 05 六月 2025 17:06:51 +0800 Subject: [PATCH] DO单优化 出库单优化 --- rsf-admin/src/page/components/ImportModal.jsx | 40 ++++++++++++++++++++++++++-------------- 1 files changed, 26 insertions(+), 14 deletions(-) diff --git a/rsf-admin/src/page/components/ImportModal.jsx b/rsf-admin/src/page/components/ImportModal.jsx index 70f84cf..caee07f 100644 --- a/rsf-admin/src/page/components/ImportModal.jsx +++ b/rsf-admin/src/page/components/ImportModal.jsx @@ -21,8 +21,8 @@ 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(); @@ -57,17 +57,17 @@ } 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(); @@ -78,6 +78,22 @@ e.preventDefault(); reset(); }; + + const downloadTemplate = async (type) => { + 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`); + document.body.appendChild(link); + link.click(); + link.remove(); + } return ( <Dialog open={open} maxWidth="md" fullWidth> @@ -206,6 +222,7 @@ <Toolbar sx={{ width: '100%', + justifyContent: 'end' }} > {importer.state === 'idle' ? ( @@ -213,6 +230,8 @@ <Button label="common.action.import.title" variant="contained" + startIcon={<ImportExportOutlinedIcon />} + size='medium' onClick={startImport} disabled={!file} /> @@ -230,14 +249,7 @@ ); } {/**涓嬭浇鎵撳嵃妯℃澘锛屼紶鍏ype绫诲瀷锛岃皟鐢ㄤ笅杞芥ā鏉挎帴鍙� */ } -const downloadTemplate = (type) => { - // 涓嬭浇鐗╂枡妯℃澘 - if (type != undefined && type == 'matnr') { - } - console.log('======>'); - console.log(type); -} function millisecondsToTime(ms) { var seconds = Math.floor((ms / 1000) % 60); -- Gitblit v1.9.1