WIP Сделал шаблон Контактов
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
:open-edit="openEdit"
|
||||
)
|
||||
.form-wrap.gap-24.w-full
|
||||
.data-section.flex.flex-col.gap-4(v-for="data in configData")
|
||||
.flex.flex-col.gap-4(v-for="data in configData")
|
||||
.font-semibold.text-sm.whitespace-nowrap {{data.dataLabel}}
|
||||
.flex.w-full.justify-between.items-center.gap-4(v-for="field in data.fields")
|
||||
.label-field.font-sm.text-sm.whitespace-nowrap {{`${field.label} :`}}
|
||||
@@ -208,8 +208,6 @@ export default {
|
||||
border-radius: 50%
|
||||
.replace-photo
|
||||
color: var(--btn-blue-color)
|
||||
.input
|
||||
color: purple
|
||||
.form-wrap
|
||||
display: grid
|
||||
grid-template-columns: repeat(3, 1fr)
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
<template lang="pug">
|
||||
medical-form-wrapper(
|
||||
title="Контакты"
|
||||
:is-check-change="isCheckChange"
|
||||
:is-loading-data="isLoadingData"
|
||||
:is-edit="isEdit"
|
||||
:save="saveChange"
|
||||
:cancel="cancelEdit"
|
||||
:open-edit="openEdit"
|
||||
)
|
||||
.form-wrap.gap-24.w-full
|
||||
.flex.flex-col.gap-4(v-for="(data, key) in contacts")
|
||||
.font-semibold.text-sm.whitespace-nowrap {{configData[key].title}}
|
||||
.flex.w-full.justify-between.items-center.gap-4(v-for="(value, index) in data")
|
||||
.label-field.font-sm.text-sm.whitespace-nowrap {{`${configData[key].fieldName} ${index+1} :`}}
|
||||
.input-wrapper.items-center.flex.gap-10px
|
||||
base-input.w-full(
|
||||
:disabled="!isEdit"
|
||||
v-model="value.username"
|
||||
:mask="configData[key].inputMask"
|
||||
@update:model-value="checkChangeInput"
|
||||
type="text"
|
||||
:standout="!isEdit"
|
||||
:outlined="isEdit"
|
||||
text-color="black"
|
||||
)
|
||||
.delete-contact.icon-cancel.text-xxs.cursor-pointer(
|
||||
v-if="isEdit"
|
||||
@click="() => deleteContact(key, value?.id)"
|
||||
)
|
||||
.add-contact.flex.gap-10px.items-center.cursor-pointer(
|
||||
v-if="isEdit"
|
||||
@click="() => addNewContact(key)"
|
||||
)
|
||||
.icon-plus
|
||||
span.font-medium.text-base Добавить
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
||||
import BaseInput from "@/components/base/BaseInput.vue";
|
||||
import { contactsDataForm } from "@/pages/newMedicalCard/utils/medicalConfig";
|
||||
import { mapState, mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ContactsForm",
|
||||
components: { MedicalFormWrapper, BaseInput },
|
||||
data() {
|
||||
return {
|
||||
isEdit: false,
|
||||
isLoadingData: false,
|
||||
isCheckChange: false,
|
||||
configData: contactsDataForm,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
initContactsData: "getContactsData",
|
||||
}),
|
||||
...mapState({
|
||||
contacts: (state) => state.medical.contactsData,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
openEdit() {
|
||||
this.isEdit = true;
|
||||
},
|
||||
cancelEdit() {
|
||||
this.isEdit = false;
|
||||
},
|
||||
saveChange() {
|
||||
this.isEdit = false;
|
||||
},
|
||||
checkChangeInput() {
|
||||
// this.isCheckChange = checkChangeData(
|
||||
// this.initContactsData,
|
||||
// this.contacts
|
||||
// );
|
||||
let initData = JSON.stringify(this.initContactsData);
|
||||
let changeData = JSON.stringify(this.contacts);
|
||||
if (initData !== changeData) {
|
||||
this.isCheckChange = true;
|
||||
} else {
|
||||
this.isCheckChange = false;
|
||||
}
|
||||
},
|
||||
addNewContact(key) {
|
||||
this.contacts[key].push({
|
||||
kind: this.configData[key].kind,
|
||||
});
|
||||
},
|
||||
deleteContact(key, id) {
|
||||
if (id) {
|
||||
let deleteIndex = this.contacts[key].findIndex((el) => el.id === id);
|
||||
|
||||
this.contacts[key].splice(deleteIndex, 1);
|
||||
} else {
|
||||
this.contacts[key].pop();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="sass" scoped>
|
||||
.input-wrapper
|
||||
width: 324px
|
||||
.form-wrap
|
||||
display: grid
|
||||
grid-template-columns: repeat(3, 1fr)
|
||||
grid-template-rows: repeat(1, 1fr)
|
||||
@media(max-width: 1900px)
|
||||
grid-template-columns: repeat(2, 1fr)
|
||||
grid-template-rows: repeat(2, 1fr)
|
||||
@media(max-width: 1320px)
|
||||
grid-template-columns: repeat(1, 1fr)
|
||||
grid-template-rows: repeat(3, 1fr)
|
||||
.label-field
|
||||
color: var(--font-grey-color)
|
||||
.delete-contact
|
||||
color: var(--font-grey-color)
|
||||
.add-contact
|
||||
color: var(--btn-blue-color)
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
<template lang="pug">
|
||||
.flex.flex-col.gap-y-2.wrapper.h-full
|
||||
basic-data-form
|
||||
contacts-form
|
||||
documents-form
|
||||
insurance-form
|
||||
</template>
|
||||
@@ -9,10 +10,11 @@
|
||||
import BasicDataForm from "@/pages/newMedicalCard/components/BasicDataForms/BasicDataForm.vue";
|
||||
import DocumentsForm from "@/pages/newMedicalCard/components/BasicDataForms/DocumentsForm.vue";
|
||||
import InsuranceForm from "@/pages/newMedicalCard/components/BasicDataForms/InsuranceForm.vue";
|
||||
import ContactsForm from "@/pages/newMedicalCard/components/BasicDataForms/ContactsForm.vue";
|
||||
|
||||
export default {
|
||||
name: "MedicalBasicDataWrapper",
|
||||
components: { BasicDataForm, DocumentsForm, InsuranceForm },
|
||||
components: { BasicDataForm, DocumentsForm, InsuranceForm, ContactsForm },
|
||||
};
|
||||
</script>
|
||||
<style lang="sass" scoped>
|
||||
|
||||
Reference in New Issue
Block a user