WIP Добавил запрос на данные медицинской карты и переход на страницу карты
This commit is contained in:
@@ -32,9 +32,8 @@
|
|||||||
:update-data-client="updateDataClient",
|
:update-data-client="updateDataClient",
|
||||||
:fetch-data-clients="fetchDataClients",
|
:fetch-data-clients="fetchDataClients",
|
||||||
:fetch-created-client-data="fetchCreatedClientData",
|
:fetch-created-client-data="fetchCreatedClientData",
|
||||||
:create-medical-card="medicalCardHandler",
|
@handler-click-popup="handlerClickPopup",
|
||||||
:created-client-name="createdClientName",
|
:created-client-name="createdClientName",
|
||||||
@delete-client="deleteClientHandler",
|
|
||||||
@recover-client="clearDeletedRowId",
|
@recover-client="clearDeletedRowId",
|
||||||
)
|
)
|
||||||
client-table-pagination(
|
client-table-pagination(
|
||||||
@@ -115,6 +114,7 @@ export default {
|
|||||||
marked: [],
|
marked: [],
|
||||||
dataClients: [
|
dataClients: [
|
||||||
{
|
{
|
||||||
|
medical_history: [],
|
||||||
initialization: true,
|
initialization: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -127,6 +127,7 @@ export default {
|
|||||||
currentPage: 0,
|
currentPage: 0,
|
||||||
length: 0,
|
length: 0,
|
||||||
},
|
},
|
||||||
|
medicalHistory: {},
|
||||||
showModal: false,
|
showModal: false,
|
||||||
clientId: "",
|
clientId: "",
|
||||||
deletedRowId: "",
|
deletedRowId: "",
|
||||||
@@ -159,6 +160,9 @@ export default {
|
|||||||
saveDataClients(data) {
|
saveDataClients(data) {
|
||||||
this.dataClients = data.results;
|
this.dataClients = data.results;
|
||||||
},
|
},
|
||||||
|
saveDataMedicalHistory(data) {
|
||||||
|
this.medicalHistory = data;
|
||||||
|
},
|
||||||
saveClientsCount(data) {
|
saveClientsCount(data) {
|
||||||
if (!this.clientsCount) this.clientsCount = data.count;
|
if (!this.clientsCount) this.clientsCount = data.count;
|
||||||
},
|
},
|
||||||
@@ -253,29 +257,33 @@ export default {
|
|||||||
openModal() {
|
openModal() {
|
||||||
this.showModal = true;
|
this.showModal = true;
|
||||||
},
|
},
|
||||||
medicalCardHandler() {
|
async handlerClickPopup(action, id) {
|
||||||
this.modalConfig = this.modalConfig.map((el) => {
|
this.modalConfig = this.modalConfig.map((el) => {
|
||||||
return el.name === "medical"
|
return el.name === action
|
||||||
? { ...el, view: true }
|
? { ...el, view: true }
|
||||||
: { ...el, view: false };
|
: { ...el, view: false };
|
||||||
});
|
});
|
||||||
|
if (action === "delete") {
|
||||||
|
this.clientId = id;
|
||||||
|
this.titleModal = "Удалить клиента";
|
||||||
|
this.openModal();
|
||||||
|
}
|
||||||
|
if (action === "medical") {
|
||||||
|
if (id) {
|
||||||
|
fetchWrapper
|
||||||
|
.get(`medical_card/medical_history/${id}/detail/`)
|
||||||
|
.then((res) => this.saveDataMedicalHistory(res));
|
||||||
|
this.$router.push("medical-card");
|
||||||
|
} else {
|
||||||
this.titleModal = "Создать мед.карту";
|
this.titleModal = "Создать мед.карту";
|
||||||
this.openModal();
|
this.openModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
createMedicalCard() {
|
createMedicalCard() {
|
||||||
this.showMedicalCard = true;
|
this.showMedicalCard = true;
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
},
|
},
|
||||||
deleteClientHandler(id) {
|
|
||||||
this.clientId = id;
|
|
||||||
this.modalConfig = this.modalConfig.map((el) => {
|
|
||||||
return el.name === "delete"
|
|
||||||
? { ...el, view: true }
|
|
||||||
: { ...el, view: false };
|
|
||||||
});
|
|
||||||
this.titleModal = "Удалить клиента";
|
|
||||||
this.openModal();
|
|
||||||
},
|
|
||||||
writeDeletedRowId() {
|
writeDeletedRowId() {
|
||||||
this.deletedRowId = this.clientId;
|
this.deletedRowId = this.clientId;
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
:open-change-data="openChangeData",
|
:open-change-data="openChangeData",
|
||||||
:disabled-delete="!!deletedClientId && !rowOverlay",
|
:disabled-delete="!!deletedClientId && !rowOverlay",
|
||||||
@delete-client="transmitDeleteClient",
|
@delete-client="transmitDeleteClient",
|
||||||
:create-medical-card="createMedicalCard"
|
:create-medical-card="transmitMedicalCard"
|
||||||
)
|
)
|
||||||
.flex.z-10(
|
.flex.z-10(
|
||||||
v-if="isOpenChange && !rowOverlay",
|
v-if="isOpenChange && !rowOverlay",
|
||||||
@@ -267,7 +267,7 @@ export default {
|
|||||||
"Дата рождения позже текущего дня"
|
"Дата рождения позже текущего дня"
|
||||||
);
|
);
|
||||||
this.dataClient.age = this.client.birth_date || "";
|
this.dataClient.age = this.client.birth_date || "";
|
||||||
} else if (!Object.keys(data).length == 0)
|
} else if (!Object.keys(data).length === 0)
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
.post(`general/person/${this.client.id}/update/`, {
|
.post(`general/person/${this.client.id}/update/`, {
|
||||||
...data,
|
...data,
|
||||||
@@ -394,9 +394,16 @@ export default {
|
|||||||
openChangeData() {
|
openChangeData() {
|
||||||
this.isOpenChange = true;
|
this.isOpenChange = true;
|
||||||
},
|
},
|
||||||
|
transmitMedicalCard() {
|
||||||
|
this.$emit(
|
||||||
|
"handler-click-popup",
|
||||||
|
"medical",
|
||||||
|
this.client?.medical_history[0]?.id
|
||||||
|
);
|
||||||
|
},
|
||||||
transmitDeleteClient() {
|
transmitDeleteClient() {
|
||||||
this.isOpenDetailInfo = false;
|
this.isOpenDetailInfo = false;
|
||||||
this.$emit("delete-client", this.client.id);
|
this.$emit("handler-click-popup", "delete", this.client.id);
|
||||||
},
|
},
|
||||||
async deleteClient() {
|
async deleteClient() {
|
||||||
await fetchWrapper.del(`general/person/${this.client.id}/delete/`);
|
await fetchWrapper.del(`general/person/${this.client.id}/delete/`);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default createRouter({
|
|||||||
{ path: "calendar", component: TheCalendar },
|
{ path: "calendar", component: TheCalendar },
|
||||||
{ path: "clients", component: TheUser },
|
{ path: "clients", component: TheUser },
|
||||||
{ path: "settings", component: TheSettings },
|
{ path: "settings", component: TheSettings },
|
||||||
{ path: "medicalCard", component: TheMedicalCard },
|
{ path: "medical-card", component: TheMedicalCard },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user