WIP Добавил выбор соцсети и доверенного лица из существующих персон
This commit is contained in:
@@ -15,51 +15,71 @@
|
|||||||
.font-semibold.text-sm.whitespace-nowrap {{data.dataLabel}}
|
.font-semibold.text-sm.whitespace-nowrap {{data.dataLabel}}
|
||||||
.flex.w-full.h-full.justify-between.gap-4(v-for="field in data.fields")
|
.flex.w-full.h-full.justify-between.gap-4(v-for="field in data.fields")
|
||||||
.label-field.font-sm.text-sm.whitespace-nowrap.mt-10px {{`${field.label} :`}}
|
.label-field.font-sm.text-sm.whitespace-nowrap.mt-10px {{`${field.label} :`}}
|
||||||
.input-wrapper.items-center.flex.h-10.gap-10px
|
.input-wrapper.items-center.h-fit.gap-10px
|
||||||
.flex.gap-1(v-if="field.key === 'networks'")
|
.w-full.flex.gap-x-1.gap-y-2(v-if="field.key === 'networks'" :style="{'flex-wrap': 'wrap !important'}")
|
||||||
.flex.rounded-full.cursor-pointer.items-center.gap-10px.py-1.pl-1.pr-2(
|
.flex.rounded-full.cursor-pointer.h-fit.items-center.gap-10px.py-1.pl-1.pr-2(
|
||||||
v-for="network in confidant.networks"
|
v-for="network in confidant.networks"
|
||||||
@click="() => copyLinkNetwork(network.username)"
|
@click="() => copyLinkNetwork(network.username)"
|
||||||
style="background-color: var(--bg-light-grey)"
|
style="background-color: var(--bg-light-grey)"
|
||||||
)
|
)
|
||||||
q-icon.icon(:name="mapNetworks[network.kind].icon" :class="{old: network.id, new: !network.id}")
|
q-icon.icon(:name="mapNetworks[network.kind].icon" :class="{old: network.id, new: !network.id}")
|
||||||
span.text-sm.font-medium {{ mapNetworks[network.kind].title || network.username }}
|
span.text-smm.font-medium {{ mapNetworks[network.kind].title || network.username }}
|
||||||
.flex.add-network.w-7.h-7.rounded-full.items-center.justify-center.cursor-pointer(v-if="isEdit")
|
.flex.relative
|
||||||
q-icon.w-3.h-3(name="app:plus")
|
q-btn(
|
||||||
//- .flex.gap-10px(v-else :key="key+index")
|
v-if="isEdit"
|
||||||
//- base-select-networks(
|
icon="add",
|
||||||
//- :list-data="Object.values(mapNetworks)"
|
size="17px",
|
||||||
//- :option-data="data.kind"
|
class="add-network"
|
||||||
//- :choose-option="(e) => chooseNetwork(e, index)"
|
@click.stop
|
||||||
//- :style-border="true"
|
round,
|
||||||
//- :size-input="50"
|
dense,
|
||||||
//- )
|
no-caps,
|
||||||
//- base-input.w-full(
|
padding="3px"
|
||||||
//- v-model="data.username"
|
)
|
||||||
//- type="text"
|
q-menu(v-model="isOpenPopupAdding", anchor="bottom left", self="top right")
|
||||||
//- no-error-icon
|
.menu-wrapper.flex.flex-col.gap-y-3.p-4
|
||||||
//- :name="key"
|
base-adding-network(
|
||||||
//- :rule="configData[key].rules"
|
:items="Object.values(mapNetworks)",
|
||||||
//- :standout="!isEdit"
|
:network="newNetwork",
|
||||||
//- :outlined="isEdit"
|
)
|
||||||
//- text-color="black"
|
.w-fit
|
||||||
//- )
|
q-btn(
|
||||||
|
color="primary",
|
||||||
base-input.w-full(
|
label="Добавить",
|
||||||
v-else
|
no-caps,
|
||||||
:readonly="!isEdit"
|
@click="saveNetwork",
|
||||||
v-model="confidant[field.key]"
|
padding="8px 24px"
|
||||||
@update:model-value="checkChangeInput"
|
)
|
||||||
:mask="field.mask"
|
.flex.w-full.relative(v-else)
|
||||||
:type="field.type"
|
q-menu.h-fit(
|
||||||
:name="field.key"
|
v-if="field.key === 'last_name'"
|
||||||
:placeholder="field.placeholder"
|
fit
|
||||||
:standout="!isEdit"
|
v-model="isOpenListConfidant"
|
||||||
:outlined="isEdit"
|
:style="{'max-height': '160px'}"
|
||||||
no-error-icon
|
no-focus
|
||||||
:rule="field.rules"
|
anchor="bottom right"
|
||||||
text-color="black"
|
self="top right"
|
||||||
)
|
)
|
||||||
|
.flex.flex-col.w-full.h-full.overflow-y-auto
|
||||||
|
.confidant-item.flex.h-10.items-center.cursor-pointer.text-base.px-2(
|
||||||
|
v-for="person in listPersons"
|
||||||
|
:id="person.id"
|
||||||
|
@click="(e) => choiceConfidant(e)"
|
||||||
|
) {{ `${person.last_name || ""} ${person.first_name || ""} ${person.patronymic || ""}` }}
|
||||||
|
base-input.w-full(
|
||||||
|
:readonly="!isEdit"
|
||||||
|
v-model="confidant[field.key]"
|
||||||
|
@update:model-value="(val) => checkChangeInput(val, field.key)"
|
||||||
|
:mask="field.mask"
|
||||||
|
:type="field.type"
|
||||||
|
:name="field.key"
|
||||||
|
:placeholder="field.placeholder"
|
||||||
|
:standout="!isEdit"
|
||||||
|
:outlined="isEdit"
|
||||||
|
no-error-icon
|
||||||
|
:rule="field.rules"
|
||||||
|
text-color="black"
|
||||||
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -67,6 +87,9 @@ import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWra
|
|||||||
import BaseInput from "@/components/base/BaseInput.vue";
|
import BaseInput from "@/components/base/BaseInput.vue";
|
||||||
import BaseSelectNetworks from "@/components/base/BaseSelectNetworks.vue";
|
import BaseSelectNetworks from "@/components/base/BaseSelectNetworks.vue";
|
||||||
import BaseButton from "@/components/base/BaseButton.vue";
|
import BaseButton from "@/components/base/BaseButton.vue";
|
||||||
|
import BasePopup from "@/components/base/BasePopup.vue";
|
||||||
|
import BaseAddingNetwork from "@/components/base/BaseAddingNetwork.vue";
|
||||||
|
import BaseSelect from "@/components/base/BaseSelect.vue";
|
||||||
import { checkChangeData } from "@/shared/utils/changesObjects";
|
import { checkChangeData } from "@/shared/utils/changesObjects";
|
||||||
import { mapState, mapGetters } from "vuex";
|
import { mapState, mapGetters } from "vuex";
|
||||||
import {
|
import {
|
||||||
@@ -76,12 +99,26 @@ import {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ConfidantForm",
|
name: "ConfidantForm",
|
||||||
components: { MedicalFormWrapper, BaseInput, BaseSelectNetworks, BaseButton },
|
components: {
|
||||||
|
MedicalFormWrapper,
|
||||||
|
BaseInput,
|
||||||
|
BaseSelectNetworks,
|
||||||
|
BaseSelect,
|
||||||
|
BaseButton,
|
||||||
|
BasePopup,
|
||||||
|
BaseAddingNetwork,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
newNetwork: {
|
||||||
|
kind: mapNetworks["TELEGRAM"],
|
||||||
|
username: "",
|
||||||
|
},
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
isLoadingData: false,
|
isLoadingData: false,
|
||||||
isCheckChange: false,
|
isCheckChange: false,
|
||||||
|
isOpenPopupAdding: false,
|
||||||
|
isOpenListConfidant: false,
|
||||||
configData: confidantConfig,
|
configData: confidantConfig,
|
||||||
mapNetworks: mapNetworks,
|
mapNetworks: mapNetworks,
|
||||||
};
|
};
|
||||||
@@ -95,11 +132,41 @@ export default {
|
|||||||
initConfidant: "getConfidantData",
|
initConfidant: "getConfidantData",
|
||||||
}),
|
}),
|
||||||
...mapState({
|
...mapState({
|
||||||
|
listPersons: (state) => state.medical.personFiltredList,
|
||||||
confidants: (state) => state.medical.confidantData,
|
confidants: (state) => state.medical.confidantData,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
checkChangeInput() {
|
choiceConfidant(e) {
|
||||||
|
const newConfidant = this.listPersons.find(
|
||||||
|
(el) => el.id === e.currentTarget.id
|
||||||
|
);
|
||||||
|
this.confidants[this.index] = { ...newConfidant, note: "" };
|
||||||
|
this.isOpenListConfidant = false;
|
||||||
|
},
|
||||||
|
saveNetwork() {
|
||||||
|
this.confidants[this.index].networks.push({
|
||||||
|
kind: this.newNetwork.kind.id,
|
||||||
|
username: this.newNetwork.username,
|
||||||
|
});
|
||||||
|
this.isOpenPopupAdding = false;
|
||||||
|
},
|
||||||
|
checkChangeInput(val, key) {
|
||||||
|
if (key === "last_name" && val.length > 0) {
|
||||||
|
localStorage.setItem("searchConfidant", val);
|
||||||
|
this.$store.dispatch("getPersonsFiltredList").then(() => {
|
||||||
|
if (key === "last_name" && val.length > 1) {
|
||||||
|
localStorage.setItem("searchConfidant", val);
|
||||||
|
this.$store.dispatch("getPersonsFiltredList").then(() => {
|
||||||
|
if (this.listPersons.length > 0) {
|
||||||
|
this.isOpenListConfidant = true;
|
||||||
|
} else {
|
||||||
|
this.isOpenListConfidant = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.isCheckChange = checkChangeData(this.initConfidant, this.confidant);
|
this.isCheckChange = checkChangeData(this.initConfidant, this.confidant);
|
||||||
},
|
},
|
||||||
saveChange() {
|
saveChange() {
|
||||||
@@ -135,6 +202,9 @@ export default {
|
|||||||
color: var(--font-grey-color)
|
color: var(--font-grey-color)
|
||||||
.input-wrapper
|
.input-wrapper
|
||||||
width: 302px
|
width: 302px
|
||||||
|
.confidant-item
|
||||||
|
&:hover
|
||||||
|
background-color: var(--bg-light-grey)
|
||||||
.add-network
|
.add-network
|
||||||
color: var(--font-dark-blue-color)
|
color: var(--font-dark-blue-color)
|
||||||
background-color: var(--bg-light-grey)
|
background-color: var(--bg-light-grey)
|
||||||
|
|||||||
@@ -135,37 +135,44 @@ export const errorMap = {
|
|||||||
|
|
||||||
export const mapNetworks = {
|
export const mapNetworks = {
|
||||||
VK: {
|
VK: {
|
||||||
|
id: "VK",
|
||||||
title: "VK",
|
title: "VK",
|
||||||
icon: "app:icon-vk",
|
icon: "app:icon-vk",
|
||||||
network: "VK",
|
network: "VK",
|
||||||
},
|
},
|
||||||
TELEGRAM: {
|
TELEGRAM: {
|
||||||
|
id: "TELEGRAM",
|
||||||
title: "Telegram",
|
title: "Telegram",
|
||||||
icon: "app:icon-tg",
|
icon: "app:icon-tg",
|
||||||
network: "TELEGRAM",
|
network: "TELEGRAM",
|
||||||
},
|
},
|
||||||
GMAIL: {
|
GMAIL: {
|
||||||
|
id: "GMAIL",
|
||||||
title: "Gmail",
|
title: "Gmail",
|
||||||
icon: "app:icon-google",
|
icon: "app:icon-google",
|
||||||
network: "GMAIL",
|
network: "GMAIL",
|
||||||
},
|
},
|
||||||
SLACK: {
|
SLACK: {
|
||||||
|
id: "SLACK",
|
||||||
title: "Slack",
|
title: "Slack",
|
||||||
icon: "app:icon-slack",
|
icon: "app:icon-slack",
|
||||||
network: "SLACK",
|
network: "SLACK",
|
||||||
markerLink: "slack",
|
markerLink: "slack",
|
||||||
},
|
},
|
||||||
DISCORD: {
|
DISCORD: {
|
||||||
|
id: "DISCORD",
|
||||||
title: "Discord",
|
title: "Discord",
|
||||||
icon: "app:icon-discord",
|
icon: "app:icon-discord",
|
||||||
network: "DISCORD",
|
network: "DISCORD",
|
||||||
},
|
},
|
||||||
VIBER: {
|
VIBER: {
|
||||||
|
id: "VIBER",
|
||||||
title: "Viber",
|
title: "Viber",
|
||||||
icon: "wifi_calling_3",
|
icon: "wifi_calling_3",
|
||||||
network: "VIBER",
|
network: "VIBER",
|
||||||
},
|
},
|
||||||
WHATS_APP: {
|
WHATS_APP: {
|
||||||
|
id: "WHATS_APP",
|
||||||
title: "WhatsApp",
|
title: "WhatsApp",
|
||||||
icon: "call",
|
icon: "call",
|
||||||
network: "WHATS_APP",
|
network: "WHATS_APP",
|
||||||
@@ -218,14 +225,14 @@ export const confidantConfig = [
|
|||||||
{
|
{
|
||||||
dataLabel: "Общая информация",
|
dataLabel: "Общая информация",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
|
||||||
key: "first_name",
|
|
||||||
label: "Имя",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: "last_name",
|
key: "last_name",
|
||||||
label: "Фамилия",
|
label: "Фамилия",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "first_name",
|
||||||
|
label: "Имя",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "patronymic",
|
key: "patronymic",
|
||||||
label: "Отчество",
|
label: "Отчество",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { genderOptions } from "@/pages/newMedicalCard/utils/medicalConfig";
|
|||||||
const state = () => ({
|
const state = () => ({
|
||||||
medicalCard: {},
|
medicalCard: {},
|
||||||
confidantData: [],
|
confidantData: [],
|
||||||
|
personFiltredList: [],
|
||||||
contactsData: {
|
contactsData: {
|
||||||
phones: [],
|
phones: [],
|
||||||
emails: [],
|
emails: [],
|
||||||
@@ -252,6 +253,15 @@ const actions = {
|
|||||||
commit("setConfidantData");
|
commit("setConfidantData");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
getPersonsFiltredList({ commit }) {
|
||||||
|
fetchWrapper
|
||||||
|
.get(
|
||||||
|
`general/person/?last_name=${localStorage.getItem("searchConfidant")}`
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
commit("setPersonFiltredList", res.results);
|
||||||
|
});
|
||||||
|
},
|
||||||
returnInitData({ commit }) {
|
returnInitData({ commit }) {
|
||||||
commit("setBasicData");
|
commit("setBasicData");
|
||||||
commit("setContactsData");
|
commit("setContactsData");
|
||||||
@@ -295,6 +305,9 @@ const mutations = {
|
|||||||
setConfidantData(state) {
|
setConfidantData(state) {
|
||||||
state.confidantData = this.getters.getConfidantData;
|
state.confidantData = this.getters.getConfidantData;
|
||||||
},
|
},
|
||||||
|
setPersonFiltredList(state, persons) {
|
||||||
|
state.personFiltredList = persons;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user