Merge branch 'ASTRA-79' into 'master'

WIP Добавил обновление пустых и заполненных данных Первичного осмотра

See merge request andrusyakka/urban-couscous!377
This commit is contained in:
Aleksey Demin
2023-05-18 14:29:11 +00:00
4 changed files with 120 additions and 32 deletions

View File

@@ -108,7 +108,9 @@ export default {
if (!this.fillInspection) this.modelValue = value; if (!this.fillInspection) this.modelValue = value;
}, },
}, },
fillInspection(value) { fillInspection: {
immediate: true,
handler(value) {
if (value) { if (value) {
this.isEdit = true; this.isEdit = true;
this.modelValue = null; this.modelValue = null;
@@ -118,6 +120,7 @@ export default {
} }
}, },
}, },
},
}; };
</script> </script>

View File

@@ -1,5 +1,11 @@
<template lang="pug"> <template lang="pug">
medical-form-wrapper(:title="data.title", :is-edit="isEdit", :open-edit="openEdit", :cancel="cancelEdit") medical-form-wrapper(
:title="data.title",
:is-edit="isEdit",
:open-edit="openEdit",
:buttonsPresence="!fillInspection",
:cancel="cancelEdit"
)
.thermometry-wrapper.grid.gap-x-20.gap-y-5 .thermometry-wrapper.grid.gap-x-20.gap-y-5
.flex.flex-col.gap-y-4.items-start(v-if="isEdit" v-for="(dataValue, key) in protocol[data.key]") .flex.flex-col.gap-y-4.items-start(v-if="isEdit" v-for="(dataValue, key) in protocol[data.key]")
span.font-semibold.text-smm(v-if="data.key === 'thermometry'") {{ data.config[key].title }} span.font-semibold.text-smm(v-if="data.key === 'thermometry'") {{ data.config[key].title }}
@@ -65,12 +71,14 @@ import BaseInput from "@/components/base/BaseInput.vue";
import BaseInputNumber from "@/components/base/BaseInputNumber.vue"; import BaseInputNumber from "@/components/base/BaseInputNumber.vue";
import { thermometryResultsMap } from "@/pages/newMedicalCard/utils/medicalConfig"; import { thermometryResultsMap } from "@/pages/newMedicalCard/utils/medicalConfig";
import { mapState } from "vuex"; import { mapState } from "vuex";
import { mapActions } from "vuex";
export default { export default {
name: "ThermometryForm", name: "ThermometryForm",
components: { MedicalFormWrapper, BaseInput, BaseInputNumber }, components: { MedicalFormWrapper, BaseInput, BaseInputNumber },
props: { props: {
data: Object, data: Object,
fillInspection: Boolean,
}, },
data() { data() {
return { return {
@@ -84,13 +92,36 @@ export default {
}), }),
}, },
methods: { methods: {
...mapActions({
getProtocolData: "getProtocolData",
}),
openEdit() { openEdit() {
this.isEdit = true; this.isEdit = true;
}, },
cancelEdit() { cancelEdit() {
this.getProtocolData({
key: this.data.key,
});
this.isEdit = false; this.isEdit = false;
}, },
}, },
watch: {
fillInspection: {
immediate: true,
handler(value) {
if (value) {
this.isEdit = true;
} else {
this.isEdit = false;
}
},
},
},
mounted() {
if (this.fillInspection) {
this.isEdit = true;
}
},
}; };
</script> </script>

View File

@@ -7,6 +7,7 @@
<script> <script>
import MedicalProtocolsList from "@/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsList.vue"; import MedicalProtocolsList from "@/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsList.vue";
import MedicalProtocolsInspection from "@/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue"; import MedicalProtocolsInspection from "@/pages/newMedicalCard/components/InitialInspectionProtocol/MedicalProtocolsInspection.vue";
import { mapActions } from "vuex";
export default { export default {
name: "MedicalProtocolsWrapper", name: "MedicalProtocolsWrapper",
components: { MedicalProtocolsList, MedicalProtocolsInspection }, components: { MedicalProtocolsList, MedicalProtocolsInspection },
@@ -17,13 +18,22 @@ export default {
}; };
}, },
methods: { methods: {
...mapActions({
getProtocolData: "getProtocolData",
}),
openInspection() { openInspection() {
this.inspection = true; this.inspection = true;
this.fillInspection = false; this.fillInspection = false;
this.getProtocolData({
fillInspection: false,
});
}, },
createInspection() { createInspection() {
this.fillInspection = true; this.fillInspection = true;
this.inspection = false; this.inspection = false;
this.getProtocolData({
fillInspection: true,
});
}, },
}, },
}; };

View File

@@ -126,29 +126,7 @@ const state = () => ({
status: "filled", status: "filled",
}, },
], ],
protocolData: { protocolData: null,
bite: "distal bite",
hygieneIndex: 2,
KPUIndex: 6.1,
thermometry: {
cold: {
value: 22,
result: "Реакция нормальная",
},
heat: {
value: 50,
result: "Повышенная чувствительность",
},
},
tonometry: {
pulse: {
value: 84,
},
pressure: {
value: 120,
},
},
},
}); });
const getters = { const getters = {
@@ -301,6 +279,56 @@ const getters = {
let firstName = state?.medicalCard?.person?.first_name; let firstName = state?.medicalCard?.person?.first_name;
return lastName?.[0] + firstName?.[0]; return lastName?.[0] + firstName?.[0];
}, },
getProtocolData() {
return {
bite: "distal bite",
hygieneIndex: 2,
KPUIndex: 6.1,
thermometry: {
cold: {
value: 22,
result: "Реакция нормальная",
},
heat: {
value: 50,
result: "Повышенная чувствительность",
},
},
tonometry: {
pulse: {
value: 84,
},
pressure: {
value: 120,
},
},
};
},
getInitProtocol() {
return {
bite: null,
hygieneIndex: null,
KPUIndex: null,
thermometry: {
cold: {
value: null,
result: null,
},
heat: {
value: null,
result: null,
},
},
tonometry: {
pulse: {
value: null,
},
pressure: {
value: null,
},
},
};
},
}; };
const actions = { const actions = {
@@ -364,6 +392,9 @@ const actions = {
data.id = state.protocolsList.length + 1; data.id = state.protocolsList.length + 1;
commit("setProtocolsList", data); commit("setProtocolsList", data);
}, },
getProtocolData({ commit }, props) {
commit("setProtocolData", props);
},
}; };
const mutations = { const mutations = {
@@ -396,6 +427,19 @@ const mutations = {
setProtocolsList(state, data) { setProtocolsList(state, data) {
state.protocolsList = [...state.protocolsList, data]; state.protocolsList = [...state.protocolsList, data];
}, },
setProtocolData(state, props) {
if (props?.key) {
state.protocolData[props.key] = {
...JSON.parse(JSON.stringify(this.getters.getProtocolData[props.key])),
};
} else {
if (props.fillInspection) {
state.protocolData = this.getters.getInitProtocol;
} else {
state.protocolData = this.getters.getProtocolData;
}
}
},
}; };
export default { export default {