[WIP] Добавил адаптив на форму пациентов

This commit is contained in:
megavrilinvv
2023-06-02 17:09:06 +03:00
parent e579eb4e52
commit 9eb03a5ad5
3 changed files with 108 additions and 73 deletions

View File

@@ -1,6 +1,6 @@
<template lang="pug"> <template lang="pug">
.w-full.flex.gap-x-2 .w-full.flex.gap-x-2
calendar-open-sidebar(:class="{'close': !isOpen, 'active': isOpen}" :open-sidebar="openSidebar") calendar-open-sidebar.close(:class="{'active': isOpen}", :open-sidebar="openSidebar")
calendar-sidebar.-ml-2(v-if="!isOpen", :open-sidebar="openSidebar") calendar-sidebar.-ml-2(v-if="!isOpen", :open-sidebar="openSidebar")
calendar-wrapper calendar-wrapper
</template> </template>

View File

@@ -1,77 +1,77 @@
<template lang="pug"> <template lang="pug">
.flex.flex-col.gap-y-1 .flex.flex-col.gap-y-1
.item.flex.flex-col .form.flex.items-center.justify-end.py-4.pr-4.rounded-t
.form.flex.items-center.justify-end.py-4.pr-4.rounded-t q-btn.rotate-180(
q-btn.rotate-180( @click="openSidebar",
@click="openSidebar", dense,
dense, padding="8px",
padding="8px", style="color: var(--font-grey-color); background: var(--bg-light-grey)"
style="color: var(--font-grey-color); background: var(--bg-light-grey)" )
img(:src="arrow")
.form.flex.p-4
q-btn(
color="primary",
size="16px",
label="Создать запись",
no-caps,
icon="add",
:style="{width: '100%', height: '40px'}",
padding="0"
)
.flex.flex-col.gap-y-1
q-expansion-item.expansion.font-bold.text-xm(
v-for="(elem, index) in patientList",
expand-separator,
:label="elem.label",
@click="choiceForm(elem.choice, index)",
:class="{'patient': elem.label === 'Пациенты'}"
)
.select.flex.flex-col.font-medium.text-smm.px-4(
v-if="elem.label !== 'Пациенты'",
v-for="item in elem.data"
) )
img(:src="arrow") .status.flex.items-center.gap-x-1.px-2
.form.flex.p-4 img(:src="item.icon")
q-btn( span {{item.name}}
color="primary", .flex.flex-col.p-4.pb-0(:class="choiceState()", v-else)
size="16px", .flex.h-8.w-full.items-center.justify-between
label="Создать запись", base-input(
no-caps, v-model="foundPerson",
icon="add", debounce="10",
:style="{width: '100%', height: '40px'}", @keyup.enter="searchPerson",
padding="0" @input="searchPerson",
) id="input",
.flex.flex-col.gap-y-1(v-for="elem in patientList") placeholder="Найти пациента...",
q-expansion-item.expansion.font-bold.text-xm( outlined,
expand-separator :width="160",
:label="elem.label", iconLeft,
:class="{'patient': elem.label === 'Пациенты'}" fontSize="12px",
) lineHeight="16px",
.select.flex.flex-col.font-medium.text-smm.px-4( textColor="var(--font-grey-color)"
v-if="elem.label !== 'Пациенты'", )
v-for="item in elem.data" q-icon(name="app:icon-search", size="16px", style="color: var(--font-grey-color)")
q-btn.btn.ml-2(
@click="sortPerson(elem.data)",
icon="app:sort-number",
:style="{width: '32px', height: '32px'}",
padding="0"
)
.flex.items-center.justify-between.font-medium.text-smm.h-10.py-2.cursor-pointer(
@click="checkAll(elem.data)"
) )
.status.flex.items-center.gap-x-1.px-2 span Все
img(:src="item.icon") img(v-if="selectAll(elem.data)", :src="icon_ok")
span {{item.name}} .person-wrapper.flex.flex-col
.flex.flex-col.p-4.pb-0(v-else) .person.items-center.flex.justify-between.py-2.cursor-pointer(
.flex.h-8.w-full.items-center.justify-between v-for="(person, index) in choiceData(elem.data)",
base-input( @click="checkPerson(index, elem.data)"
v-model="foundPerson", )
debounce="10", .flex.items-center.gap-x-2
@keyup.enter="searchPerson", img.h-10.w-10.object-cover.rounded-full(:src="person.avatar")
@input="searchPerson", .flex.flex-col.font-medium
id="input", .text-smm {{trimOwnerName(person.last_name, person.first_name, person.patronymic)}}
placeholder="Найти пациента...", .text.text-xsx {{person.birthday}}
outlined, img.h-6.w-6(v-if="person.check", :src="icon_ok")
:width="160",
iconLeft,
fontSize="12px",
lineHeight="16px",
textColor="var(--font-grey-color)"
)
q-icon(name="app:icon-search", size="16px", style="color: var(--font-grey-color)")
q-btn.btn.ml-2(
@click="sortPerson(elem.data)",
icon="app:sort-number",
:style="{width: '32px', height: '32px'}",
padding="0"
)
.flex.flex-col
.flex.items-center.justify-between.font-medium.text-smm.h-10.py-2.cursor-pointer(
@click="checkAll(elem.data)"
)
span Все
img(v-if="selectAll(elem.data)", :src="icon_ok")
.person-wrapper.flex.flex-col
.person.items-center.flex.justify-between.py-2.cursor-pointer(
v-for="(person, index) in choiceData(elem.data)",
@click="checkPerson(index, elem.data)"
)
.flex.items-center.gap-x-2
img.h-10.w-10.object-cover.rounded-full(:src="person.avatar")
.flex.flex-col.font-medium
.text-smm {{trimOwnerName(person.last_name, person.first_name, person.patronymic)}}
.text.text-xsx {{person.birthday}}
img.h-6.w-6(v-if="person.check", :src="icon_ok")
</template> </template>
<script> <script>
@@ -96,6 +96,22 @@ export default {
}; };
}, },
methods: { methods: {
choiceState() {
let num = 0;
this.patientList.forEach((e) => {
if (e.choice) num += 1;
});
return {
one: num === 1,
two: num === 2,
three: num === 3,
};
},
choiceForm(choice, idx) {
if (choice)
return (this.patientList.find((e) => e.id === idx).choice = false);
this.patientList.find((e) => e.id === idx).choice = true;
},
trimOwnerName(lastName, firstName, patronymic) { trimOwnerName(lastName, firstName, patronymic) {
let checkedFirstName = firstName !== null ? firstName[0] + "." : ""; let checkedFirstName = firstName !== null ? firstName[0] + "." : "";
let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : ""; let checkedPatronymic = patronymic !== null ? patronymic[0] + "." : "";
@@ -138,12 +154,22 @@ export default {
</script> </script>
<style lang="sass" scoped> <style lang="sass" scoped>
.one
max-height: calc(100vh - 394px)
.two
max-height: calc(100vh - 498px)
.three
max-height: calc(100vh - 632px)
.form .form
background: var(--default-white) background: var(--default-white)
width: 100% width: 100%
height: 72px height: 72px
.expansion .expansion
height: 54px
background: var(--default-white) background: var(--default-white)
border-radius: 4px border-radius: 4px
color: var(--font-dark-blue-color) color: var(--font-dark-blue-color)
@@ -162,6 +188,7 @@ export default {
.q-expansion-item .q-expansion-item
border-radius: 0 border-radius: 0
height: 100%
.q-expansion-item :deep(.q-separator) .q-expansion-item :deep(.q-separator)
display: none display: none
@@ -187,15 +214,17 @@ export default {
.text .text
color: var(--font-grey-color) color: var(--font-grey-color)
.q-expansion-item :deep(.q-item)
height: 54px
.person-wrapper .person-wrapper
height: 272px
overflow-y: auto overflow-y: auto
margin-right: -10px margin-right: -10px
&::-webkit-scrollbar &::-webkit-scrollbar
width: 4px width: 4px
&::-webkit-scrollbar-track:vertical &::-webkit-scrollbar-track:vertical
margin-top: -26px margin-top: -26px
margin-bottom: 8px margin-bottom: 26px
.person .person
height: 56px height: 56px

View File

@@ -10,23 +10,28 @@ import not_filled from "@/assets/icons/medcard_not_filled.svg";
export const patientList = [ export const patientList = [
{ {
label: "Статус приема", label: "Статус приема",
id: 0,
data: [ data: [
{ name: "Не принят", icon: not_accepted }, { name: "Не принят", icon: not_accepted },
{ name: "Принят", icon: accepted }, { name: "Принят", icon: accepted },
{ name: "Отказ", icon: rejected }, { name: "Отказ", icon: rejected },
{ name: "На приеме", icon: reception }, { name: "На приеме", icon: reception },
], ],
choice: false,
}, },
{ {
label: "Первичная медкарта", label: "Первичная медкарта",
id: 1,
data: [ data: [
{ name: "Не заполнена", icon: not_filled }, { name: "Не заполнена", icon: not_filled },
{ name: "Частично заполнена", icon: partially_filled }, { name: "Частично заполнена", icon: partially_filled },
{ name: "Заполнена", icon: filled }, { name: "Заполнена", icon: filled },
], ],
choice: false,
}, },
{ {
label: "Пациенты", label: "Пациенты",
id: 2,
data: [ data: [
{ {
id: 0, id: 0,
@@ -128,5 +133,6 @@ export const patientList = [
check: false, check: false,
}, },
], ],
choice: false,
}, },
]; ];