Skip to content

Commit

Permalink
upload result v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Wellheor1 committed Jul 3, 2024
1 parent 8422669 commit 53af5a4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions api/laboratory/forms100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

def form_01(request):
print('fdfd')
return
2 changes: 1 addition & 1 deletion l2-frontend/src/components/UploadFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 12 additions & 2 deletions l2-frontend/src/components/types-and-forms-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] => {
Expand All @@ -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]);
}
}
Expand Down
3 changes: 3 additions & 0 deletions l2-frontend/src/ui-cards/LaboratoryHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<ul class="nav navbar-nav">
<LoadFile />
</ul>
<UploadFileModal title="Прикрепить результат" />
</div>
</template>

Expand All @@ -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,
Expand Down

0 comments on commit 53af5a4

Please sign in to comment.