WIP Добавил обновление дополнительной информации

This commit is contained in:
DwCay
2023-05-02 19:14:36 +03:00
parent 4b4fa45e9c
commit eb76007da1
5 changed files with 87 additions and 37 deletions

View File

@@ -133,6 +133,7 @@ export default {
configData: confidantConfig,
mapNetworks: mapNetworks,
listPersons: [],
initPerson: null,
};
},
props: {
@@ -149,11 +150,13 @@ export default {
},
methods: {
choiceConfidant(e) {
const newConfidant = this.listPersons.find(
(el) => el.id === e.currentTarget.id
);
this.confidants[this.index] = getConfidantObject(newConfidant);
this.isOpenListConfidant = false;
fetchWrapper
.get(`general/person/${e.currentTarget.id}/detail/`)
.then((res) => {
this.confidants[this.index] = getConfidantObject(res);
this.initPerson = res;
this.isOpenListConfidant = false;
});
},
saveNetwork() {
if (this.newNetwork.username) {
@@ -162,6 +165,7 @@ export default {
username: this.newNetwork.username,
});
this.isOpenPopupAdding = false;
this.isCheckChange = true;
this.newNetwork = {
kind: mapNetworks["TELEGRAM"],
username: "",
@@ -206,19 +210,14 @@ export default {
this.confidants[this.index] = initData || getConfidantObject();
},
saveChange() {
const initConfidantData = this.initConfidant.find(
(el) => el.id === this.confidant.id
);
const initPersonData = this.listPersons.find(
(el) => el.id === this.confidant.id
);
const initConfidantData = this.initConfidant[this.index];
const form = this.$refs.formConfidant;
form.validate().then((validate) => {
if (validate) {
getRequestConfidant(
this.confidant,
initConfidantData,
initPersonData
this.initPerson
).then(() => {
this.$store.dispatch("getMedicalCardData");
this.isLoadingData = false;

View File

@@ -1,8 +1,8 @@
<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
confidant-form(v-for="(confidant, index) in confidants" :index="index" :confidant="confidant")
base-button(
base-button.ml-30px(
left-icon="icon-plus"
added-border-none
:icon-left-size="12"
@@ -32,3 +32,13 @@ export default {
},
};
</script>
<style lang="sass" scoped>
.wrapper
width: 83.2%
overflow-y: auto
@media (max-width: 600px)
width: fit-content
&::-webkit-scrollbar
width: 0
</style>

View File

@@ -48,7 +48,8 @@ export function getConfidantObject(data) {
},
networks,
note: {
value: data.note ? data.note.join("") : "",
id: data?.note[0]?.id,
value: data?.note.length ? data?.note[0].description : "",
},
};
}