From ebfde4cfcfa43ba5ee0694c60672c26a919cf031 Mon Sep 17 00:00:00 2001 From: Well Date: Fri, 20 Oct 2023 15:56:27 +0800 Subject: [PATCH 1/3] . --- contracts/models.py | 28 ++++---- .../src/construct/ConstructCompany.vue | 71 ++++++++++++++++++- 2 files changed, 83 insertions(+), 16 deletions(-) diff --git a/contracts/models.py b/contracts/models.py index 57c98b20f1..8d56891e06 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -233,25 +233,25 @@ def get_by_date(date: str, company_id: int, month: bool = False) -> list[dict]: result = [] prev_card_id = -1 examination_data = get_examination_data(company_id, date_start, date_end) - for i in examination_data: - if prev_card_id != i.card_id: + for data in examination_data: + if prev_card_id != data.card_id: result.append( { - "card_id": i.card_id, - "fio": i.family + " " + i.name + " " + i.patronymic, - "harmful_factors": [f"{i.harmful_factor}; "], - "research_id": [i.research_id], - "research_titles": [f"{i.research_title}; "], - "date": i.examination_date.strftime("%d.%m.%Y"), + "card_id": data.card_id, + "fio": data.family + " " + data.name + " " + data.patronymic, + "harmful_factors": [f"{data.harmful_factor}; "], + "research_id": [data.research_id], + "research_titles": [f"{data.research_title}; "], + "date": data.examination_date.strftime("%d.%m.%Y"), } ) else: - if f"{i.harmful_factor}; " not in result[-1]["harmful_factors"]: - result[-1]["harmful_factors"].append(f"{i.harmful_factor}; ") - if i.research_id not in result[-1]["research_id"]: - result[-1]["research_id"].append(i.research_id) - result[-1]["research_titles"].append(f"{i.research_title}; ") - prev_card_id = i.card_id + if f"{data.harmful_factor}; " not in result[-1]["harmful_factors"]: + result[-1]["harmful_factors"].append(f"{data.harmful_factor}; ") + if data.research_id not in result[-1]["research_id"]: + result[-1]["research_id"].append(data.research_id) + result[-1]["research_titles"].append(f"{data.research_title}; ") + prev_card_id = data.card_id if month: result = sorted(result, key=lambda d: d["date"]) else: diff --git a/l2-frontend/src/construct/ConstructCompany.vue b/l2-frontend/src/construct/ConstructCompany.vue index 15ad5111b4..319ae45ae9 100644 --- a/l2-frontend/src/construct/ConstructCompany.vue +++ b/l2-frontend/src/construct/ConstructCompany.vue @@ -307,6 +307,7 @@ :table-data="examListPagination" row-key-field-name="card_id" :checkbox-option="checkboxOption" + :cell-selection-option="cellSelectionOption" />
rowIndex + 1, }, { - field: 'fio', key: 'fio', title: 'Пациент', align: 'left', width: 300, + field: 'card', + key: 'card', + title: '', + align: 'center', + width: 30, + renderBodyCell: ({ row, column, rowIndex }, h) => ( + + +   + + + ), + }, + { + field: 'fio', + key: 'fio', + title: 'Пациент', + align: 'left', + width: 300, + }, + { + field: 'date', key: 'date', title: 'Дата', align: 'center', width: 50, }, { field: 'harmful_factors', key: 'harmful_factors', title: 'Вредные факторы', align: 'left', width: 200, @@ -440,6 +481,7 @@ export default { mounted() { this.getCompanies(); this.getContracts(); + this.getInternalBase(); }, methods: { async getCompanies() { @@ -552,6 +594,15 @@ export default { async getResearches() { this.researches = await this.$api('/get-research-list'); }, + async getInternalBase() { + await this.$store.dispatch(actions.DEC_LOADING); + const baseData = await this.$api('/bases'); + await this.$store.dispatch(actions.DEC_LOADING); + this.basePk = baseData.bases[0].pk; + }, + openCard(cardPk) { + window.open(`/ui/directions?card_pk=${cardPk}&base_pk=${this.basePk}`); + }, pageNumberChange(number: number) { this.page = number; }, @@ -704,4 +755,20 @@ export default { flex: 1; padding: 7px 0; } +.transparentButton { + background-color: transparent !important; + color: #434A54; + border: none; + border-radius: 4px; + padding: 6px 12px; +} +.transparentButton:hover { + background-color: #434a54 !important; + color: #FFFFFF; + border: none; +} +.transparentButton:active { + background-color: #37BC9B !important; + color: #FFFFFF; +} From 5f31a5694b16855776323e8fbbedd7cc6ada1894 Mon Sep 17 00:00:00 2001 From: Wellheor Date: Mon, 23 Oct 2023 14:44:00 +0800 Subject: [PATCH 2/3] black --- .../src/construct/ConstructCompany.vue | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/l2-frontend/src/construct/ConstructCompany.vue b/l2-frontend/src/construct/ConstructCompany.vue index 319ae45ae9..613b704964 100644 --- a/l2-frontend/src/construct/ConstructCompany.vue +++ b/l2-frontend/src/construct/ConstructCompany.vue @@ -350,7 +350,6 @@ import { } from 'vue-easytable'; import 'vue-easytable/libs/theme-default/index.css'; import Treeselect from '@riophae/vue-treeselect'; - import '@riophae/vue-treeselect/dist/vue-treeselect.css'; import ruRu from '@/locales/ve'; @@ -408,22 +407,14 @@ export default { title: '', align: 'center', width: 30, - renderBodyCell: ({ row, column, rowIndex }, h) => ( - - -   - - + renderBodyCell: ({ row }, h) => ( + h('div', { class: 'button' }, [ + h( + 'button', + { class: this.button.transparentButton, on: { click: () => { this.openCard(row.card_id); } } }, + [h('i', { class: 'fa-solid fa-user' })], + ), + ]) ), }, { @@ -755,20 +746,23 @@ export default { flex: 1; padding: 7px 0; } + + + From b49b0701167b9c1c5320207087b3211d8f42a18e Mon Sep 17 00:00:00 2001 From: Wellheor Date: Mon, 23 Oct 2023 15:14:53 +0800 Subject: [PATCH 3/3] . --- contracts/models.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/contracts/models.py b/contracts/models.py index 8d56891e06..57c98b20f1 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -233,25 +233,25 @@ def get_by_date(date: str, company_id: int, month: bool = False) -> list[dict]: result = [] prev_card_id = -1 examination_data = get_examination_data(company_id, date_start, date_end) - for data in examination_data: - if prev_card_id != data.card_id: + for i in examination_data: + if prev_card_id != i.card_id: result.append( { - "card_id": data.card_id, - "fio": data.family + " " + data.name + " " + data.patronymic, - "harmful_factors": [f"{data.harmful_factor}; "], - "research_id": [data.research_id], - "research_titles": [f"{data.research_title}; "], - "date": data.examination_date.strftime("%d.%m.%Y"), + "card_id": i.card_id, + "fio": i.family + " " + i.name + " " + i.patronymic, + "harmful_factors": [f"{i.harmful_factor}; "], + "research_id": [i.research_id], + "research_titles": [f"{i.research_title}; "], + "date": i.examination_date.strftime("%d.%m.%Y"), } ) else: - if f"{data.harmful_factor}; " not in result[-1]["harmful_factors"]: - result[-1]["harmful_factors"].append(f"{data.harmful_factor}; ") - if data.research_id not in result[-1]["research_id"]: - result[-1]["research_id"].append(data.research_id) - result[-1]["research_titles"].append(f"{data.research_title}; ") - prev_card_id = data.card_id + if f"{i.harmful_factor}; " not in result[-1]["harmful_factors"]: + result[-1]["harmful_factors"].append(f"{i.harmful_factor}; ") + if i.research_id not in result[-1]["research_id"]: + result[-1]["research_id"].append(i.research_id) + result[-1]["research_titles"].append(f"{i.research_title}; ") + prev_card_id = i.card_id if month: result = sorted(result, key=lambda d: d["date"]) else: