fix: Исправлена работа Upload и кнопки Назад в StepDocumentUpload
- Upload: добавлен disabled во время загрузки - Upload onChange: правильная обработка newFileList - Кнопка Назад: убран disabled - теперь всегда доступна - DEV кнопка Назад: также убран disabled - Добавлено логирование handleUpload и onChange для отладки
This commit is contained in:
@@ -56,6 +56,8 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
}, [isAlreadyUploaded, documentConfig.file_type]);
|
||||
|
||||
const handleUpload = async () => {
|
||||
console.log('🚀 handleUpload called', { fileListLength: fileList.length });
|
||||
|
||||
if (fileList.length === 0) {
|
||||
message.error('Пожалуйста, выберите файл для загрузки');
|
||||
return;
|
||||
@@ -66,6 +68,7 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
try {
|
||||
const formDataToSend = new FormData();
|
||||
fileList.forEach((file) => {
|
||||
console.log('📎 File:', file.name, file.originFileObj);
|
||||
if (file.originFileObj) {
|
||||
formDataToSend.append('files', file.originFileObj);
|
||||
}
|
||||
@@ -74,6 +77,13 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
formDataToSend.append('session_id', sessionId);
|
||||
formDataToSend.append('file_type', documentConfig.file_type);
|
||||
formDataToSend.append('voucher', formData.voucher || '');
|
||||
|
||||
console.log('📤 Uploading to n8n:', {
|
||||
claim_id: claimId,
|
||||
session_id: sessionId,
|
||||
file_type: documentConfig.file_type,
|
||||
voucher: formData.voucher
|
||||
});
|
||||
|
||||
// Показываем модалку обработки
|
||||
setProcessingModalVisible(true);
|
||||
@@ -235,11 +245,15 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
{/* Загрузка файла */}
|
||||
<Upload
|
||||
fileList={fileList}
|
||||
onChange={({ fileList }) => setFileList(fileList)}
|
||||
onChange={({ fileList: newFileList }) => {
|
||||
console.log('📁 Upload onChange:', newFileList?.length, 'files');
|
||||
setFileList(newFileList || []);
|
||||
}}
|
||||
beforeUpload={() => false}
|
||||
maxCount={documentConfig.maxFiles}
|
||||
accept="image/*,application/pdf"
|
||||
listType="picture"
|
||||
disabled={uploading}
|
||||
>
|
||||
<Button icon={<UploadOutlined />} size="large" block disabled={uploading}>
|
||||
{documentConfig.maxFiles > 1
|
||||
@@ -255,7 +269,7 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
|
||||
{/* Кнопки */}
|
||||
<div style={{ marginTop: 24, display: 'flex', gap: 12 }}>
|
||||
<Button onClick={onPrev} size="large" disabled={uploading}>
|
||||
<Button onClick={onPrev} size="large">
|
||||
← Назад
|
||||
</Button>
|
||||
|
||||
@@ -297,7 +311,7 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
🔧 DEV MODE - Быстрая навигация
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<Button onClick={onPrev} size="small" disabled={uploading}>
|
||||
<Button onClick={onPrev} size="small">
|
||||
← Назад
|
||||
</Button>
|
||||
<Button
|
||||
@@ -318,7 +332,6 @@ const StepDocumentUpload: React.FC<Props> = ({
|
||||
}}
|
||||
size="small"
|
||||
style={{ flex: 1 }}
|
||||
disabled={uploading}
|
||||
>
|
||||
Пропустить [dev] →
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user