fix: Удалён дублирующийся код в Step1Policy.tsx
Проблема: После строки 657 весь код компонента дублировался, что вызывало синтаксическую ошибку 'Unexpected token' на строке 659. Решение: Удалены строки 659-820 (дубликат кода).
This commit is contained in:
@@ -622,168 +622,6 @@ export default function Step1Policy({ formData, updateFormData, onNext, addDebug
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
{/* 🔧 Технические кнопки для разработки */}
|
||||
<div style={{
|
||||
marginTop: 24,
|
||||
padding: 16,
|
||||
background: '#f0f0f0',
|
||||
borderRadius: 8,
|
||||
border: '2px dashed #999'
|
||||
}}>
|
||||
<div style={{ marginBottom: 8, fontSize: 12, color: '#666', fontWeight: 'bold' }}>
|
||||
🔧 DEV MODE - Быстрая навигация (без валидации)
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<Button
|
||||
type="dashed"
|
||||
onClick={() => {
|
||||
// Пропускаем валидацию, заполняем минимальные данные
|
||||
const devData = {
|
||||
voucher: 'E1000-123456789',
|
||||
claim_id: `CLM-DEV-${Math.random().toString(36).substr(2, 6).toUpperCase()}`,
|
||||
};
|
||||
updateFormData(devData);
|
||||
onNext();
|
||||
}}
|
||||
size="small"
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
Далее → (Step 2) [пропустить]
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
)}
|
||||
</div>
|
||||
</Form.Item>
|
||||
|
||||
{/* Прогресс обработки */}
|
||||
{uploading && uploadProgress && (
|
||||
<Alert
|
||||
message={uploadProgress}
|
||||
type="info"
|
||||
showIcon
|
||||
icon={<Spin indicator={<LoadingOutlined style={{ fontSize: 16 }} spin />} />}
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Form.Item>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<Button
|
||||
onClick={() => {
|
||||
setPolicyNotFound(false);
|
||||
setFileList([]);
|
||||
}}
|
||||
size="large"
|
||||
disabled={uploading}
|
||||
>
|
||||
Отмена
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={handleSubmitWithScan}
|
||||
loading={uploading}
|
||||
size="large"
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
{uploading ? 'Обрабатываем...' : 'Продолжить со сканом'}
|
||||
</Button>
|
||||
</div>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!policyNotFound && (
|
||||
<div style={{ marginTop: 16, padding: 12, background: '#f0f9ff', borderRadius: 8 }}>
|
||||
<p style={{ margin: 0, fontSize: 13, color: '#666' }}>
|
||||
💡 Введите номер полиса. Кириллица автоматически заменяется на латиницу, тире вставляется автоматически
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Модальное окно ожидания OCR результата */}
|
||||
<Modal
|
||||
open={ocrModalVisible}
|
||||
closable={ocrModalContent !== 'loading'}
|
||||
maskClosable={false}
|
||||
footer={ocrModalContent === 'loading' ? null :
|
||||
ocrModalContent?.success ? [
|
||||
// ✅ Полис распознан - кнопка "Продолжить"
|
||||
<Button key="next" type="primary" onClick={() => {
|
||||
setOcrModalVisible(false);
|
||||
onNext(); // Переход на следующий шаг
|
||||
}}>
|
||||
Продолжить →
|
||||
</Button>
|
||||
] : [
|
||||
// ❌ Полис не распознан - кнопка "Загрузить другой файл"
|
||||
<Button key="retry" type="primary" onClick={() => {
|
||||
setOcrModalVisible(false);
|
||||
setFileList([]); // Очищаем список файлов
|
||||
setPolicyNotFound(true); // Показываем форму загрузки снова
|
||||
}}>
|
||||
Загрузить другой файл
|
||||
</Button>
|
||||
]
|
||||
}
|
||||
width={700}
|
||||
centered
|
||||
>
|
||||
{ocrModalContent === 'loading' ? (
|
||||
<div style={{ textAlign: 'center', padding: '40px 20px' }}>
|
||||
<Spin indicator={<LoadingOutlined style={{ fontSize: 48 }} spin />} />
|
||||
<h3 style={{ marginTop: 24, marginBottom: 12 }}>⏳ Обрабатываем документ</h3>
|
||||
<p style={{ color: '#666', marginBottom: 8 }}>OCR распознавание текста...</p>
|
||||
<p style={{ color: '#666', marginBottom: 8 }}>AI анализ содержимого...</p>
|
||||
<p style={{ color: '#666' }}>Проверка валидности полиса...</p>
|
||||
<p style={{ color: '#999', fontSize: 12, marginTop: 20 }}>
|
||||
Это может занять 20-30 секунд. Пожалуйста, подождите...
|
||||
</p>
|
||||
</div>
|
||||
) : ocrModalContent ? (
|
||||
<div>
|
||||
<h3 style={{ marginBottom: 16 }}>
|
||||
{ocrModalContent.success ? '✅ Результат распознавания' : '❌ Ошибка распознавания'}
|
||||
</h3>
|
||||
{ocrModalContent.success ? (
|
||||
<div>
|
||||
<p><strong>Номер полиса:</strong> {ocrModalContent.data?.policy_number || 'н/д'}</p>
|
||||
<p><strong>Владелец:</strong> {ocrModalContent.data?.policyholder_full_name || 'н/д'}</p>
|
||||
{ocrModalContent.data?.insured_persons?.length > 0 && (
|
||||
<>
|
||||
<p><strong>Застрахованные лица:</strong></p>
|
||||
<ul>
|
||||
{ocrModalContent.data.insured_persons.map((person: any, i: number) => (
|
||||
<li key={i}>{person.full_name} (ДР: {person.birth_date || 'н/д'})</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
{ocrModalContent.data?.policy_period && (
|
||||
<p><strong>Период:</strong> {ocrModalContent.data.policy_period.insured_from} - {ocrModalContent.data.policy_period.insured_to}</p>
|
||||
)}
|
||||
<p style={{ marginTop: 16 }}><strong>Полный ответ AI:</strong></p>
|
||||
<pre style={{ background: '#f5f5f5', padding: 12, borderRadius: 4, fontSize: 12, maxHeight: 400, overflow: 'auto' }}>
|
||||
{JSON.stringify(ocrModalContent.data, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
<p>{ocrModalContent.message || 'Документ не распознан'}</p>
|
||||
<p style={{ marginTop: 16 }}><strong>Полный ответ:</strong></p>
|
||||
<pre style={{ background: '#fff3f3', padding: 12, borderRadius: 4, fontSize: 12, maxHeight: 400, overflow: 'auto' }}>
|
||||
{JSON.stringify(ocrModalContent.data, null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
</Modal>
|
||||
|
||||
{/* 🔧 Технические кнопки для разработки */}
|
||||
<div style={{
|
||||
marginTop: 24,
|
||||
|
||||
Reference in New Issue
Block a user