WIP Подтянула данные в форму мед.карты
This commit is contained in:
@@ -7,7 +7,10 @@
|
||||
:steps="steps",
|
||||
:currentStep="currentStep"
|
||||
)
|
||||
component(v-bind:is="currentTabComponent")
|
||||
component(
|
||||
v-bind:is="currentTabComponent",
|
||||
:client-detail="clientData",
|
||||
)
|
||||
.flex.justify-between
|
||||
.flex
|
||||
base-button.font-semibold(
|
||||
@@ -38,6 +41,7 @@ import MedicalBaseData from "@/pages/medicalCard/components/MedicalBaseData";
|
||||
import MedicalIdentityDocuments from "@/pages/medicalCard/components/MedicalIdentityDocuments";
|
||||
import MedicalPolicyDocuments from "@/pages/medicalCard/components/MedicalPolicyDocuments";
|
||||
import BaseStepper from "@/components/base/BaseStepper.vue";
|
||||
import { fetchWrapper } from "@/shared/fetchWrapper.js";
|
||||
|
||||
export default {
|
||||
name: "FormCreateMedicalCard",
|
||||
@@ -51,6 +55,9 @@ export default {
|
||||
MedicalPolicyDocuments,
|
||||
BaseStepper,
|
||||
},
|
||||
props: {
|
||||
selectedClientId: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isBaseData: true,
|
||||
@@ -77,6 +84,8 @@ export default {
|
||||
component: "medical-policy-documents",
|
||||
},
|
||||
],
|
||||
sourceСlientDetail: {},
|
||||
clientData: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -92,6 +101,73 @@ export default {
|
||||
this.currentStep -= 1;
|
||||
},
|
||||
finish() {},
|
||||
fetchClientDetail() {
|
||||
fetchWrapper
|
||||
.get(`/general/person/${this.selectedClientId}/detail/`)
|
||||
.then((detail) => this.saveClientDetail(detail));
|
||||
},
|
||||
saveClientDetail(detail) {
|
||||
this.sourceСlientDetail = detail;
|
||||
this.clientData = {
|
||||
id: detail.id,
|
||||
address: detail.address,
|
||||
benefit_code: detail.benefit_code,
|
||||
birth_date: detail.birth_date ? new Date(detail.birth_date) : null,
|
||||
//contacts: detail.contacts,
|
||||
fullName: `${detail.last_name ?? ""} ${detail.first_name ?? ""} ${
|
||||
detail.patronymic ?? ""
|
||||
}`,
|
||||
gender: detail?.gender,
|
||||
insurance_number: detail.insurance_number,
|
||||
special_mark: detail.special_mark,
|
||||
phone: detail.contacts.find((el) => el.kind === "PHONE")?.username,
|
||||
email: detail.contacts.find((el) => el.kind === "EMAIL")?.username,
|
||||
};
|
||||
this.saveClientIdentityDoc(detail.identity_documents);
|
||||
this.saveCLientPolicy(detail.insurance_policy);
|
||||
},
|
||||
saveCLientPolicy(data) {
|
||||
let OMSPolicy = data.find((el) => el.title === "OMS"),
|
||||
DMSPolicy = data.find((el) => el.title === "DMS");
|
||||
this.clientData.OMSPolicy = {
|
||||
number:
|
||||
OMSPolicy?.series && OMSPolicy?.number
|
||||
? `${OMSPolicy?.series} ${OMSPolicy?.number}`
|
||||
: "",
|
||||
organization: OMSPolicy?.organization || "",
|
||||
title: "OMS",
|
||||
};
|
||||
if (OMSPolicy?.id) this.clientData.OMSPolicy.id = OMSPolicy?.id;
|
||||
this.clientData.DMSPolicy = {
|
||||
number:
|
||||
DMSPolicy?.series && DMSPolicy?.number
|
||||
? `${DMSPolicy?.series} ${DMSPolicy?.number}`
|
||||
: "",
|
||||
organization: DMSPolicy?.organization || "",
|
||||
title: "DMS",
|
||||
};
|
||||
if (DMSPolicy?.id) this.clientData.DMSPolicy.id = DMSPolicy?.id;
|
||||
},
|
||||
saveClientIdentityDoc(data) {
|
||||
let identityDoc = data.find((el) => el.kind === "PASSPORT");
|
||||
this.clientData.identity_documents = {
|
||||
kind: "PASSPORT",
|
||||
number:
|
||||
identityDoc?.series && identityDoc?.number
|
||||
? `${identityDoc?.series} ${identityDoc?.number}`
|
||||
: "",
|
||||
issued_by_org: identityDoc?.issued_by_org || "",
|
||||
issued_by_org_code: identityDoc?.issued_by_org_code || "",
|
||||
issued_by_date: identityDoc?.issued_by_date
|
||||
? new Date(identityDoc?.issued_by_date)
|
||||
: null,
|
||||
};
|
||||
if (identityDoc?.id)
|
||||
this.clientData.identity_documents.id = identityDoc?.id;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchClientDetail();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user