diff --git a/src/components/UploadForm.tsx b/src/components/UploadForm.tsx index b92e29f..8c9efae 100644 --- a/src/components/UploadForm.tsx +++ b/src/components/UploadForm.tsx @@ -10,6 +10,7 @@ import { notify, upload } from './factory' import { ErrorFetch } from './ErrorFetch' export type UploadFormProps = { + multiple?: boolean url: string disabled?: boolean accept?: string @@ -22,7 +23,7 @@ export type UploadFormProps = { onUploadError?: (error: unknown) => void } -export const UploadForm = memo(({ url, disabled, style, formData, mimeTypes, onUploadStart, onUploadSuccess, onUploadComplete, onUploadError }) => { +export const UploadForm = memo(({ url, multiple, disabled, style, formData, mimeTypes, onUploadStart, onUploadSuccess, onUploadComplete, onUploadError }) => { const [fileList, setfileList] = useState[]>([]) const checkMimeTypes = useCallback((file: RcFile) => { @@ -38,7 +39,7 @@ export const UploadForm = memo(({ url, disabled, style, formDat onUploadStart?.() try { const formDataLocal = new FormData() - fileList.forEach((val) => formDataLocal.append('files', val.originFileObj as Blob)) + fileList.forEach((val) => formDataLocal.append(multiple ? 'files' : 'file', val.originFileObj as Blob)) if(formData) for(const propName in formData) @@ -60,7 +61,7 @@ export const UploadForm = memo(({ url, disabled, style, formDat setfileList([]) onUploadComplete?.() } - }, [fileList, formData, onUploadComplete, onUploadError, onUploadStart, onUploadSuccess, url]) + }, [fileList, formData, onUploadComplete, onUploadError, onUploadStart, onUploadSuccess, url, multiple]) const isSendButtonEnabled = fileList.length > 0 return( @@ -72,6 +73,7 @@ export const UploadForm = memo(({ url, disabled, style, formDat fileList={fileList} onChange={(props) => setfileList(props.fileList)} beforeUpload={checkMimeTypes} + maxCount={multiple ? undefined : 1} > diff --git a/src/pages/Documents/DocumentsTemplate.jsx b/src/pages/Documents/DocumentsTemplate.jsx index c98e45b..dbb4576 100755 --- a/src/pages/Documents/DocumentsTemplate.jsx +++ b/src/pages/Documents/DocumentsTemplate.jsx @@ -137,6 +137,7 @@ export const DocumentsTemplate = ({ idCategory, well: givenWell, mimeTypes, head
Загрузка setShowLoader(true)} diff --git a/src/pages/DrillingProgram/CategoryRender.jsx b/src/pages/DrillingProgram/CategoryRender.jsx index a161f28..db5b2d4 100755 --- a/src/pages/DrillingProgram/CategoryRender.jsx +++ b/src/pages/DrillingProgram/CategoryRender.jsx @@ -123,6 +123,7 @@ export const CategoryRender = memo(({ partData, onUpdate, onEdit, onHistory, set
{permissionToUpload && ( { Очистить список операций перед импортом