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

This commit is contained in:
DwCay
2023-05-18 17:26:51 +03:00
parent f94a010596
commit d232e71f0d
4 changed files with 120 additions and 32 deletions

View File

@@ -108,14 +108,17 @@ export default {
if (!this.fillInspection) this.modelValue = value;
},
},
fillInspection(value) {
if (value) {
this.isEdit = true;
this.modelValue = null;
} else {
this.isEdit = false;
this.modelValue = this.state;
}
fillInspection: {
immediate: true,
handler(value) {
if (value) {
this.isEdit = true;
this.modelValue = null;
} else {
this.isEdit = false;
this.modelValue = this.state;
}
},
},
},
};

View File

@@ -1,5 +1,11 @@
<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
.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 }}
@@ -65,12 +71,14 @@ import BaseInput from "@/components/base/BaseInput.vue";
import BaseInputNumber from "@/components/base/BaseInputNumber.vue";
import { thermometryResultsMap } from "@/pages/newMedicalCard/utils/medicalConfig";
import { mapState } from "vuex";
import { mapActions } from "vuex";
export default {
name: "ThermometryForm",
components: { MedicalFormWrapper, BaseInput, BaseInputNumber },
props: {
data: Object,
fillInspection: Boolean,
},
data() {
return {
@@ -84,13 +92,36 @@ export default {
}),
},
methods: {
...mapActions({
getProtocolData: "getProtocolData",
}),
openEdit() {
this.isEdit = true;
},
cancelEdit() {
this.getProtocolData({
key: this.data.key,
});
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>

View File

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

View File

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