From c466f4d8c054270821ed0263f390178995621a74 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 03 三月 2025 10:27:08 +0800 Subject: [PATCH] #新增 1. 添加EXcel导入功能模板 --- rsf-admin/src/page/components/ImportModal.jsx | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) diff --git a/rsf-admin/src/page/components/ImportModal.jsx b/rsf-admin/src/page/components/ImportModal.jsx index 501cb22..3775169 100644 --- a/rsf-admin/src/page/components/ImportModal.jsx +++ b/rsf-admin/src/page/components/ImportModal.jsx @@ -18,6 +18,7 @@ import { Link } from 'react-router-dom'; import DialogCloseButton from './DialogCloseButton'; import { usePapaParse } from './usePapaParse'; +import MatnrList from '../basicInfo/matnr/MatnrList'; const ImportModal = ({ open, onClose, importTemp, useCodeImport, onceBatch = 10 }) => { const refresh = useRefresh(); @@ -144,22 +145,30 @@ <Alert severity="info" action={ - <Button - component={Link} - label="common.action.import.download" - color="info" - to={importTemp} - download={'import_template.csv'} - /> + <MatnrList.Context.Consumer> + {context => ( + <Button + component={Link} + onClick={() => { + downloadTemplate(context) + }} + label="common.action.import.download" + color="info" + to={importTemp} + download={'import_template.csv'} + /> + )} + + </MatnrList.Context.Consumer> } > {translate('common.action.import.msg')} </Alert> <FileInput - source="csv" - label="CSV File" - accept={{ 'text/csv': ['.csv'] }} + source="xlsx" + label="Xlsx File" + accept={{ 'text/xlsx': ['.xls', '.xlsx'] }} onChange={handleFileChange} > <FileField source="src" title="title" /> @@ -201,6 +210,15 @@ </Dialog> ); } +{/**涓嬭浇鎵撳嵃妯℃澘锛屼紶鍏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