WIP Доработал работу полей в форме Основных данных

This commit is contained in:
DwCay
2023-04-05 14:41:21 +03:00
parent 1a3f00cd79
commit 326a93e1c9
5 changed files with 81 additions and 26 deletions

View File

@@ -1,7 +1,32 @@
import { fetchWrapper } from "@/shared/fetchWrapper";
import { genderOptions } from "@/pages/newMedicalCard/utils/configMedical";
const state = () => ({
medicalCard: {},
basicData: {
basicData: {
last_name: null,
first_name: null,
patronymic: null,
gender: null,
birth_date: null,
photo: null,
},
registrationAddress: {
region: null,
city: null,
street: null,
house_number: null,
apartment_number: null,
},
residenceAddress: {
region: null,
city: null,
street: null,
house_number: null,
apartment_number: null,
},
},
avatar: "",
});
@@ -18,7 +43,9 @@ const getters = {
last_name: person?.last_name,
first_name: person?.first_name,
patronymic: person?.patronymic,
gender: person?.gender,
gender:
person?.gender &&
genderOptions.find((el) => el.id === person?.gender),
birth_date: person?.birth_date
? new Date(person?.birth_date)
: new Date(),
@@ -55,7 +82,13 @@ const actions = {
"medicalId"
)}/detail/`
)
.then((res) => commit("setMedicalCard", res));
.then((res) => {
commit("setMedicalCard", res);
commit("setBasicData");
});
},
returnInitData({ commit }) {
commit("setBasicData");
},
};
@@ -63,6 +96,9 @@ const mutations = {
setMedicalCard(state, card) {
state.medicalCard = card;
},
setBasicData(state) {
state.basicData = { ...this.getters.getBasicData };
},
};
export default {