diff --git a/l2-frontend/src/components/UploadFile.vue b/l2-frontend/src/components/UploadFile.vue index 5c8dd37822..439261317b 100644 --- a/l2-frontend/src/components/UploadFile.vue +++ b/l2-frontend/src/components/UploadFile.vue @@ -26,11 +26,17 @@ placeholder="Выберите структуру файла" />
Такие структуры файла не поддерживаются
+
+ Нет разрешенных форм +
{ allowedForms.value = result; }; +const noSupportedFileForms = ref(false); + onMounted(async () => { await allowedFormsForOrganization(); currentFileTypes.value = getTypes(props.typesFile); @@ -161,6 +171,7 @@ const changeType = () => { } else { selectedForm.value = null; } + noSupportedFileForms.value = unsupportedFileForms(selectedType.value, props.formsFile); }; watch(selectedType, () => { diff --git a/l2-frontend/src/components/types-and-forms-file.ts b/l2-frontend/src/components/types-and-forms-file.ts index 92976f2412..5e887df075 100644 --- a/l2-frontend/src/components/types-and-forms-file.ts +++ b/l2-frontend/src/components/types-and-forms-file.ts @@ -48,6 +48,16 @@ export default function typesAndForms() { } return result; }; + const unsupportedFileForms = (type: string, forms: string[]) => { + const result = forms.filter(form => { + const supportedForm = fileForms.value[type][form]; + if (supportedForm) { + return supportedForm.id === form; + } + return false; + }); + return result.length === 0; + }; const getForms = (type: string, forms: string[] = null, onlyResult = false, allowedForms: string[] = null): formsFile[] => { let result: formsFile[] = []; @@ -65,5 +75,7 @@ export default function typesAndForms() { } return result; }; - return { getTypes, getForms, getFileFilters }; + return { + getTypes, getForms, getFileFilters, unsupportedFileForms, + }; }