WIP Добавил обновление Контактов
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
:open-edit="openEdit"
|
||||
)
|
||||
.flex.flex-col.gap-19px.w-full
|
||||
.flex.flex-col.gap-4
|
||||
.flex.gap-4.items-center(v-for="(allergy, index) in allergies")
|
||||
.flex.flex-col.gap-4.w-full
|
||||
.flex.gap-4.items-center.w-full.justify-between(v-for="(allergy, index) in allergies")
|
||||
.label-field.font-sm.text-sm.whitespace-nowrap {{ `Аллерген ${index+1}:` }}
|
||||
.flex.gap-2.w-full.items-center
|
||||
base-input(
|
||||
@@ -51,6 +51,7 @@ import BaseButton from "@/components/base/BaseButton.vue";
|
||||
import BaseInput from "@/components/base/BaseInput.vue";
|
||||
import { checkChangeData } from "@/shared/utils/changesObjects";
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
import { getRequestArrayData } from "@/shared/utils/wrapperRequestChangeData";
|
||||
|
||||
export default {
|
||||
name: "AllergiesForm",
|
||||
@@ -65,15 +66,35 @@ export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
allergies: (state) => state.medical.allergies,
|
||||
personId: (state) => state.medical.medicalCard.person.id,
|
||||
}),
|
||||
...mapGetters({
|
||||
initAllergies: "getAllergiesData",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
updateAllergies() {
|
||||
const notEmptyAllergies = this.allergies.filter(
|
||||
(el) => el.name && el.title
|
||||
);
|
||||
return getRequestArrayData(
|
||||
this.initAllergies,
|
||||
notEmptyAllergies,
|
||||
"person",
|
||||
this.personId,
|
||||
"general",
|
||||
"allergic"
|
||||
);
|
||||
},
|
||||
saveChange() {
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
this.isLoadingData = true;
|
||||
Promise.allSettled(this.updateAllergies())
|
||||
.then(() => this.$store.dispatch("getMedicalCardData"))
|
||||
.then(() => {
|
||||
this.isLoadingData = false;
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
});
|
||||
},
|
||||
cancelEdit() {
|
||||
this.$store.dispatch("returnInitData");
|
||||
|
||||
Reference in New Issue
Block a user