Merge branch 'ASTRA-49' into 'master'
WIP Добавил обновление дополнительной информации See merge request andrusyakka/urban-couscous!344
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
v-model="value",
|
v-model="value",
|
||||||
:name="name",
|
:name="name",
|
||||||
:class="{'circle': circle, 'font-input': true}",
|
:class="{'circle': circle, 'font-input': true}",
|
||||||
:input-style="{ color: textColor, borderColor: borderColor}",
|
:input-style="{ color: textColor, borderColor: borderColor, resize: resize}",
|
||||||
:borderless="borderless",
|
:borderless="borderless",
|
||||||
:placeholder="placeholder",
|
:placeholder="placeholder",
|
||||||
:outlined="outlined",
|
:outlined="outlined",
|
||||||
@@ -75,6 +75,10 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
resize: {
|
||||||
|
type: String,
|
||||||
|
default: "none",
|
||||||
|
},
|
||||||
mask: String,
|
mask: String,
|
||||||
debounce: [String, Number],
|
debounce: [String, Number],
|
||||||
width: Number,
|
width: Number,
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ export default {
|
|||||||
configData: confidantConfig,
|
configData: confidantConfig,
|
||||||
mapNetworks: mapNetworks,
|
mapNetworks: mapNetworks,
|
||||||
listPersons: [],
|
listPersons: [],
|
||||||
|
initPerson: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -149,11 +150,13 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
choiceConfidant(e) {
|
choiceConfidant(e) {
|
||||||
const newConfidant = this.listPersons.find(
|
fetchWrapper
|
||||||
(el) => el.id === e.currentTarget.id
|
.get(`general/person/${e.currentTarget.id}/detail/`)
|
||||||
);
|
.then((res) => {
|
||||||
this.confidants[this.index] = getConfidantObject(newConfidant);
|
this.confidants[this.index] = getConfidantObject(res);
|
||||||
|
this.initPerson = res;
|
||||||
this.isOpenListConfidant = false;
|
this.isOpenListConfidant = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
saveNetwork() {
|
saveNetwork() {
|
||||||
if (this.newNetwork.username) {
|
if (this.newNetwork.username) {
|
||||||
@@ -162,6 +165,7 @@ export default {
|
|||||||
username: this.newNetwork.username,
|
username: this.newNetwork.username,
|
||||||
});
|
});
|
||||||
this.isOpenPopupAdding = false;
|
this.isOpenPopupAdding = false;
|
||||||
|
this.isCheckChange = true;
|
||||||
this.newNetwork = {
|
this.newNetwork = {
|
||||||
kind: mapNetworks["TELEGRAM"],
|
kind: mapNetworks["TELEGRAM"],
|
||||||
username: "",
|
username: "",
|
||||||
@@ -206,19 +210,14 @@ export default {
|
|||||||
this.confidants[this.index] = initData || getConfidantObject();
|
this.confidants[this.index] = initData || getConfidantObject();
|
||||||
},
|
},
|
||||||
saveChange() {
|
saveChange() {
|
||||||
const initConfidantData = this.initConfidant.find(
|
const initConfidantData = this.initConfidant[this.index];
|
||||||
(el) => el.id === this.confidant.id
|
|
||||||
);
|
|
||||||
const initPersonData = this.listPersons.find(
|
|
||||||
(el) => el.id === this.confidant.id
|
|
||||||
);
|
|
||||||
const form = this.$refs.formConfidant;
|
const form = this.$refs.formConfidant;
|
||||||
form.validate().then((validate) => {
|
form.validate().then((validate) => {
|
||||||
if (validate) {
|
if (validate) {
|
||||||
getRequestConfidant(
|
getRequestConfidant(
|
||||||
this.confidant,
|
this.confidant,
|
||||||
initConfidantData,
|
initConfidantData,
|
||||||
initPersonData
|
this.initPerson
|
||||||
).then(() => {
|
).then(() => {
|
||||||
this.$store.dispatch("getMedicalCardData");
|
this.$store.dispatch("getMedicalCardData");
|
||||||
this.isLoadingData = false;
|
this.isLoadingData = false;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.flex.flex-col.gap-27px.w-full
|
.wrapper.flex.flex-col.gap-27px.h-full.pb-4
|
||||||
.flex.flex-col.gap-2
|
.flex.flex-col.gap-2
|
||||||
confidant-form(v-for="(confidant, index) in confidants" :index="index" :confidant="confidant")
|
confidant-form(v-for="(confidant, index) in confidants" :index="index" :confidant="confidant")
|
||||||
base-button(
|
base-button.ml-30px(
|
||||||
left-icon="icon-plus"
|
left-icon="icon-plus"
|
||||||
added-border-none
|
added-border-none
|
||||||
:icon-left-size="12"
|
:icon-left-size="12"
|
||||||
@@ -32,3 +32,13 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.wrapper
|
||||||
|
width: 83.2%
|
||||||
|
overflow-y: auto
|
||||||
|
@media (max-width: 600px)
|
||||||
|
width: fit-content
|
||||||
|
&::-webkit-scrollbar
|
||||||
|
width: 0
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ export function getConfidantObject(data) {
|
|||||||
},
|
},
|
||||||
networks,
|
networks,
|
||||||
note: {
|
note: {
|
||||||
value: data.note ? data.note.join("") : "",
|
id: data?.note[0]?.id,
|
||||||
|
value: data?.note.length ? data?.note[0].description : "",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,32 @@ export function getRequestArrayData(
|
|||||||
return requests.concat(deleteRequests);
|
return requests.concat(deleteRequests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getRequestNote(note, initNote, personId) {
|
||||||
|
if (note.id) {
|
||||||
|
const initChangeNote = initNote?.value || {
|
||||||
|
id: initNote.id,
|
||||||
|
value: initNote.description,
|
||||||
|
};
|
||||||
|
if (note.value && note.value !== initChangeNote.value) {
|
||||||
|
return fetchWrapper.post(`general/note/${note.id}/update/`, {
|
||||||
|
title: note.value,
|
||||||
|
description: note.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!note.value) {
|
||||||
|
return fetchWrapper.del(`general/note/${note.id}/delete/`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!note.id && note.value) {
|
||||||
|
return fetchWrapper.post(`general/note/create/`, {
|
||||||
|
title: note.value,
|
||||||
|
description: note.value,
|
||||||
|
person: personId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
||||||
const medicalId = localStorage.getItem("medicalId");
|
const medicalId = localStorage.getItem("medicalId");
|
||||||
const fullName = `${confidant.last_name.value} ${confidant.first_name.value} ${confidant.patronymic.value}`;
|
const fullName = `${confidant.last_name.value} ${confidant.first_name.value} ${confidant.patronymic.value}`;
|
||||||
@@ -82,7 +108,9 @@ export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
|||||||
return fetchWrapper
|
return fetchWrapper
|
||||||
.post(`general/person/create/`, { full_name: fullName })
|
.post(`general/person/create/`, { full_name: fullName })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return Promise.allSettled(
|
return getRequestNote(confidant.note, null, res.id)
|
||||||
|
.then(() =>
|
||||||
|
Promise.allSettled(
|
||||||
getRequestArrayData(
|
getRequestArrayData(
|
||||||
[],
|
[],
|
||||||
contacts,
|
contacts,
|
||||||
@@ -91,7 +119,9 @@ export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
|||||||
"general",
|
"general",
|
||||||
"contact"
|
"contact"
|
||||||
)
|
)
|
||||||
).then(() =>
|
)
|
||||||
|
)
|
||||||
|
.then(() =>
|
||||||
fetchWrapper.post(
|
fetchWrapper.post(
|
||||||
`medical_card/medical_history/${medicalId}/update/`,
|
`medical_card/medical_history/${medicalId}/update/`,
|
||||||
{
|
{
|
||||||
@@ -126,6 +156,9 @@ export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
|||||||
.post(`general/person/${confidant.id}/update/`, {
|
.post(`general/person/${confidant.id}/update/`, {
|
||||||
full_name: fullName,
|
full_name: fullName,
|
||||||
})
|
})
|
||||||
|
.then(() =>
|
||||||
|
getRequestNote(confidant.note, initPerson.note, confidant.id)
|
||||||
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (contacts.length) {
|
if (contacts.length) {
|
||||||
return Promise.allSettled(
|
return Promise.allSettled(
|
||||||
@@ -159,6 +192,9 @@ export function getRequestConfidant(confidant, initConfidant, initPerson) {
|
|||||||
.post(`general/person/${confidant.id}/update/`, {
|
.post(`general/person/${confidant.id}/update/`, {
|
||||||
full_name: fullName,
|
full_name: fullName,
|
||||||
})
|
})
|
||||||
|
.then(() =>
|
||||||
|
getRequestNote(confidant.note, initConfidant.note, confidant.id)
|
||||||
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (contacts.length) {
|
if (contacts.length) {
|
||||||
return Promise.allSettled(
|
return Promise.allSettled(
|
||||||
|
|||||||
Reference in New Issue
Block a user