From 53af5a49329644d0f64c17bab2039c11a687e502 Mon Sep 17 00:00:00 2001 From: Well Date: Wed, 3 Jul 2024 16:08:13 +0800 Subject: [PATCH] upload result v1 --- api/laboratory/forms100.py | 4 ++++ l2-frontend/src/components/UploadFile.vue | 2 +- l2-frontend/src/components/types-and-forms-file.ts | 14 ++++++++++++-- l2-frontend/src/ui-cards/LaboratoryHeader.vue | 3 +++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 api/laboratory/forms100.py diff --git a/api/laboratory/forms100.py b/api/laboratory/forms100.py new file mode 100644 index 0000000000..9ac40d0dd1 --- /dev/null +++ b/api/laboratory/forms100.py @@ -0,0 +1,4 @@ + +def form_01(request): + print('fdfd') + return diff --git a/l2-frontend/src/components/UploadFile.vue b/l2-frontend/src/components/UploadFile.vue index bc722d52ef..9eea5e58a5 100644 --- a/l2-frontend/src/components/UploadFile.vue +++ b/l2-frontend/src/components/UploadFile.vue @@ -141,7 +141,7 @@ const selectedForm = ref(null); const changeType = () => { fileFilter.value = `.${selectedType.value}`; - currentFileForms.value = getForms(String(selectedType.value), props.formsFile); + currentFileForms.value = getForms(String(selectedType.value), props.formsFile, props.uploadResult); if (currentFileForms.value.length > 0) { selectedForm.value = currentFileForms.value[0].id; } diff --git a/l2-frontend/src/components/types-and-forms-file.ts b/l2-frontend/src/components/types-and-forms-file.ts index 1d251fefa6..e738afec21 100644 --- a/l2-frontend/src/components/types-and-forms-file.ts +++ b/l2-frontend/src/components/types-and-forms-file.ts @@ -11,6 +11,7 @@ export interface formsFile { export default function typesAndForms() { const fileTypes = ref({ XLSX: { id: 'XLSX', label: 'XLSX' }, + PDF: { id: 'PDF', label: 'PDF' }, }); // todo - сделать соотношение - расширение файла - и все виды accept фильтров {xlsx: '.xlx, .xlsx, ws-excel'} const getTypes = (types: string[]): typesFile[] => { @@ -27,19 +28,28 @@ export default function typesAndForms() { return result; }; + const isResult = ref([ + 'api.laboratory.forms100.form_01', + ]); + /* (101.01) - 101 номер файла, 01 - номер функции в файле для обработки загруженного файла (см. parseFile) */ const fileForms = ref({ XLSX: { 'api.contracts.forms100.form_01': { id: 'api.contracts.forms100.form_01', label: 'Загрузка цен по прайсу' }, }, + PDF: { + 'api.laboratory.forms100.form_01': { id: 'api.laboratory.forms100.form_01', label: 'Загрузка PDF результата' }, + }, }); // todo - режим UploadResult - получать по расширению файла - только функции связанные с сохранением результата (анализаторы) // todo - UploadResult + forms - получать только выбранные isResult функции - const getForms = (type: string, forms: string[] = []): formsFile[] => { + const getForms = (type: string, forms: string[] = [], onlyResult = false): formsFile[] => { let result: formsFile[] = []; if (forms && forms.length > 0) { for (const form of forms) { - if (fileForms.value[type][form]) { + if (!onlyResult && fileForms.value[type][form]) { + result.push(fileForms.value[type][form]); + } else if (onlyResult && isResult.value.includes(form)) { result.push(fileForms.value[type][form]); } } diff --git a/l2-frontend/src/ui-cards/LaboratoryHeader.vue b/l2-frontend/src/ui-cards/LaboratoryHeader.vue index ed65fd5a6b..3c9c474103 100644 --- a/l2-frontend/src/ui-cards/LaboratoryHeader.vue +++ b/l2-frontend/src/ui-cards/LaboratoryHeader.vue @@ -36,6 +36,7 @@ + @@ -45,10 +46,12 @@ import LaboratorySelector from '@/ui-cards/LaboratorySelector.vue'; import ExecutionList from '@/ui-cards/ExecutionList.vue'; import LaboratoryJournal from '@/ui-cards/LaboratoryJournal.vue'; import LaboratoryPrintResults from '@/ui-cards/LaboratoryPrintResults.vue'; +import UploadFileModal from "@/modals/UploadFileModal.vue"; export default { name: 'LaboratoryHeader', components: { + UploadFileModal, LoadFile, LaboratorySelector, ExecutionList,