-
setComment(e.target.value)} />
+
setReason(e.target.value)} />
{
- setFileList([file]);
+ beforeUpload={(f) => {
+ setFile(f);
return false;
}}
- onRemove={() => setFileList([])}>
+ onRemove={() => setFile(null)}>
- Перетащите файлы сюда
+ Перетащите файл сюда
diff --git a/src/widgets/FilesDrawer/documentRows.test.ts b/src/widgets/FilesDrawer/documentRows.test.ts
index 88683a7..d99e3fc 100644
--- a/src/widgets/FilesDrawer/documentRows.test.ts
+++ b/src/widgets/FilesDrawer/documentRows.test.ts
@@ -145,6 +145,13 @@ describe('buildDocumentRows: предупреждения', () => {
expect(rows[0].issueCounts).toEqual({ error: 0, info: 0 });
});
+ it('fileId — id файла и у строки документа, и у строки файла без документов (удаление идёт по файлу)', () => {
+ const withDoc = buildDocumentRows([file({ id: 'f7', documents: [doc({ id: 'd7' })] })]);
+ expect(withDoc[0]).toMatchObject({ key: 'd7', documentId: 'd7', fileId: 'f7' });
+ const failed = buildDocumentRows([file({ id: 'f8', status: 'ERROR' })]);
+ expect(failed[0]).toMatchObject({ key: 'f8', documentId: null, fileId: 'f8' });
+ });
+
it('job null — пустые списки; старый формат строк не ломает', () => {
expect(buildDocumentRows([file({ documents: [doc()] })])[0]).toMatchObject({ fileWarnings: [], mappingWarnings: [] });
const legacy = buildDocumentRows([file({ job: job({ warnings: ['старое'] as never }), documents: [doc()] })]);
diff --git a/src/widgets/FilesDrawer/documentRows.ts b/src/widgets/FilesDrawer/documentRows.ts
index 369e959..2a62265 100644
--- a/src/widgets/FilesDrawer/documentRows.ts
+++ b/src/widgets/FilesDrawer/documentRows.ts
@@ -10,6 +10,8 @@ export interface DocumentRow {
key: string;
/** id документа; null — строка файла без документов */
documentId: string | null;
+ /** id файла: удаление и замена — файлом целиком */
+ fileId: string;
name: string;
fileType: FileType;
subtitle: string;
@@ -20,8 +22,6 @@ export interface DocumentRow {
statusLabel: string;
errorReason: string | null;
linkable: boolean;
- consolidationId: string | null;
- legalEntityId: string | null;
/** предупреждения разбора файла (общие для всех документов файла) */
fileWarnings: FileWarningOut[];
mappingWarnings: string[];
@@ -66,6 +66,7 @@ export function buildDocumentRows(files: FileOut[], labelFor?: (f: FileOut) => s
{
key: f.id,
documentId: null,
+ fileId: f.id,
name,
fileType: f.file_type,
subtitle: join([f.file_type, date, extra]),
@@ -74,8 +75,6 @@ export function buildDocumentRows(files: FileOut[], labelFor?: (f: FileOut) => s
statusLabel: failed ? 'Ошибка' : 'Обработка',
errorReason: errorReason(f),
linkable: false,
- consolidationId: f.consolidation_id,
- legalEntityId: f.legal_entity_id,
fileWarnings,
mappingWarnings,
issueCounts: { error: 0, info: 0 },
@@ -90,10 +89,8 @@ export function buildDocumentRows(files: FileOut[], labelFor?: (f: FileOut) => s
const status = documentRowStatus(d.status);
return {
key: d.id,
- consolidationId: f.consolidation_id,
documentId: d.id,
- file_id: f.id,
- legalEntityId: f.legal_entity_id,
+ fileId: f.id,
name,
fileType: f.file_type,
subtitle: join([typeText, f.file_type, date, extra]),