Merge branch 'ASTRA-82' into 'master'

WIP Набросала отображение данных

See merge request andrusyakka/urban-couscous!364
This commit is contained in:
Daria Golova
2023-05-15 15:47:28 +00:00
4 changed files with 85 additions and 15 deletions

View File

@@ -8,7 +8,7 @@
.index-wrapper.w-full(v-if="isEdit") .index-wrapper.w-full(v-if="isEdit")
.rounded.border.px-4.py-2(v-if="data.content?.list") .rounded.border.px-4.py-2(v-if="data.content?.list")
.flex.flex-col .flex.flex-col
.py-2.radio-item(v-for="item in data.content?.list") .py-2.radio-item.flex.justify-between.items-center(v-for="item in data.content?.list")
q-radio( q-radio(
v-model="modelValue", v-model="modelValue",
dense, dense,
@@ -17,22 +17,30 @@
unchecked-icon="check_box_outline_blank" unchecked-icon="check_box_outline_blank"
) )
span.text-sm.line-height.blue-color {{ item?.label ? item.label : item }} span.text-sm.line-height.blue-color {{ item?.label ? item.label : item }}
.alert-icon.flex.justify-center.items-center.rounded.w-6.h-6(v-if="item?.icon")
q-icon(name="warning_amber", size="13")
base-input( base-input(
v-else, v-else,
v-model="modelValue", v-model="modelValue",
outlined, outlined,
type="number" type="number",
:rule="data?.rules" :rule="data?.rules",
step="any",
) )
.rounded.grey-background.py-3.px-4.blue-color .rounded.grey-background.py-3.px-4.blue-color
span.font-bold.text-base.line-height Справка span.font-bold.text-base.line-height Справка
.text-sm.line-height.mt-2(:class="{'whitespace-pre-line': data.content?.whitespace}") {{ data.content?.reference}} .text-sm.line-height.mt-2(:class="{'whitespace-pre-line': data.content?.whitespace}") {{ data.content?.reference}}
.w-full.flex.gap-x-1(v-else)
.text-sm.line-height.blue-color.py-6px.px-3.grey-background.rounded {{ displayedValue }}
.flex.rounded.grey-background.w-8.h-8.justify-center.items-center.text-xl
q-icon(name="warning_amber", color="white")
</template> </template>
<script> <script>
import BaseButton from "@/components/base/BaseButton.vue"; import BaseButton from "@/components/base/BaseButton.vue";
import BaseInput from "@/components/base/BaseInput.vue"; import BaseInput from "@/components/base/BaseInput.vue";
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue"; import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
import { mapState } from "vuex";
export default { export default {
name: "IndexForm", name: "IndexForm",
@@ -43,14 +51,38 @@ export default {
data() { data() {
return { return {
isEdit: false, isEdit: false,
modelValue: "", modelValue: null,
}; };
}, },
computed: {
...mapState({
protocolData: (state) => state.medical.protocolData,
}),
state() {
return this.protocolData[this.data.state];
},
displayedValue() {
if (this.data.content?.list) {
return this.data.content?.list.find(
(elem) => elem.value === this.modelValue
).label;
}
return this.modelValue;
},
},
methods: { methods: {
changeEdit(value) { changeEdit(value) {
this.isEdit = value; this.isEdit = value;
}, },
}, },
watch: {
state: {
immediate: true,
handler(value) {
this.modelValue = value;
},
},
},
}; };
</script> </script>
@@ -73,10 +105,16 @@ export default {
.blue-color .blue-color
color: var(--font-dark-blue-color) color: var(--font-dark-blue-color)
.grey-background .grey-background
background-color: var(--bg-light-grey) background-color: var(--bg-light-grey)
.radio-item .radio-item
border-bottom: 1px solid var(--bg-light-grey) border-bottom: 1px solid var(--bg-light-grey)
.radio-item:last-child .radio-item:last-child
border-bottom: none border-bottom: none
.alert-icon
background-color: var(--bg-light-grey)
color: var(--font-grey-color)
</style> </style>

View File

@@ -74,7 +74,7 @@ export default {
}, },
computed: { computed: {
...mapState({ ...mapState({
protocolsData: (state) => state.medical.protocolsData, protocolsList: (state) => state.medical.protocolsList,
}), }),
sortingClass() { sortingClass() {
return this.sorting return this.sorting
@@ -86,8 +86,8 @@ export default {
}; };
}, },
sortingYears() { sortingYears() {
if (!this.protocolsData) return []; if (!this.protocolsList) return [];
let years = this.protocolsData let years = this.protocolsList
.map((elem) => { .map((elem) => {
return elem?.start.slice(0, 4); return elem?.start.slice(0, 4);
}) })
@@ -95,9 +95,9 @@ export default {
return this.sorting ? [...new Set(years.reverse())] : [...new Set(years)]; return this.sorting ? [...new Set(years.reverse())] : [...new Set(years)];
}, },
sortingProtocols() { sortingProtocols() {
if (!this.protocolsData) return []; if (!this.protocolsList) return [];
let protocols = []; let protocols = [];
this.protocolsData.forEach((elem) => this.protocolsList.forEach((elem) =>
protocols.push({ protocols.push({
id: elem.id, id: elem.id,
employee: { employee: {

View File

@@ -611,7 +611,28 @@ export const protocolForms = [
2 — налет поражает до 2/3 зуба, отмечается поддесневой камень; 2 — налет поражает до 2/3 зуба, отмечается поддесневой камень;
3 — налет покрывает более 2/3 поверхности, поддесневой камень поражает шейки зубов.`, 3 — налет покрывает более 2/3 поверхности, поддесневой камень поражает шейки зубов.`,
whitespace: true, whitespace: true,
list: [0, 1, 2, 3], list: [
{
label: "0",
value: 0,
},
{
label: "1",
value: 1,
},
{
label: "2",
value: 2,
icon: true,
color: "var(--bg-event-orange-color)",
},
{
label: "3",
value: 3,
icon: true,
color: "var(--border-red-color)",
},
],
}, },
}, },
{ {
@@ -627,6 +648,12 @@ export const protocolForms = [
whitespace: true, whitespace: true,
}, },
rules: [(val) => val <= 10 && val >= 0], rules: [(val) => val <= 10 && val >= 0],
checkRangeColor: (val) => {
let roundedVal = parseInt(val);
if (roundedVal >= 3 && roundedVal <= 5)
return "var(--bg-event-orange-color)";
if (roundedVal >= 6 && roundedVal <= 10) return "var(--border-red-color)";
},
}, },
{ {
title: "Данные обследования", title: "Данные обследования",

View File

@@ -59,7 +59,7 @@ const state = () => ({
avatar: "", avatar: "",
benefitData: [], benefitData: [],
events: [], events: [],
protocolsData: [ protocolsList: [
{ {
id: 1, id: 1,
employee: { employee: {
@@ -126,6 +126,11 @@ const state = () => ({
status: "filled", status: "filled",
}, },
], ],
protocolData: {
bite: "distal bite",
hygieneIndex: 2,
KPUIndex: 3,
},
}); });
const getters = { const getters = {
@@ -338,8 +343,8 @@ const actions = {
}, },
createProtocol({ commit, rootGetters, state }, data) { createProtocol({ commit, rootGetters, state }, data) {
data.employee = rootGetters.getUserData; data.employee = rootGetters.getUserData;
data.id = state.protocolsData.length + 1; data.id = state.protocolsList.length + 1;
commit("setProtocolsData", data); commit("setProtocolsList", data);
}, },
}; };
@@ -370,8 +375,8 @@ const mutations = {
state.events = res.events; state.events = res.events;
}); });
}, },
setProtocolsData(state, data) { setProtocolsList(state, data) {
state.protocolsData = [...state.protocolsData, data]; state.protocolsList = [...state.protocolsList, data];
}, },
}; };