From 32d0aa7ac0034561d3b8b5a9d35a54ba1cace6a6 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 06 五月 2025 17:00:08 +0800 Subject: [PATCH] #pda物料组托 --- rsf-admin/src/page/components/ImportModal.jsx | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-) diff --git a/rsf-admin/src/page/components/ImportModal.jsx b/rsf-admin/src/page/components/ImportModal.jsx index 70f84cf..71328ff 100644 --- a/rsf-admin/src/page/components/ImportModal.jsx +++ b/rsf-admin/src/page/components/ImportModal.jsx @@ -22,7 +22,7 @@ import MatnrList from '../basicInfo/matnr/MatnrList'; import request from '@/utils/request' -const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10, value, parmas = {} }) => { +const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10, value, parmas = {}}) => { const refresh = useRefresh(); const translate = useTranslate(); @@ -57,17 +57,15 @@ } form.append('file', file); const { data: { code, data, msg } } = await request.post(`/${value}/import`, form) - if (code === 200) { handleClose() + notify(msg); + refresh() } else { notify(msg); - } }; - - const handleClose = () => { reset(); @@ -78,6 +76,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> @@ -230,14 +244,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