From e59624e2637e646a2eb56ce0909d93cbdd7b576d Mon Sep 17 00:00:00 2001 From: kandrusyak Date: Wed, 16 Aug 2023 20:19:21 +0300 Subject: [PATCH] change disabled method --- .../BasicDataForms/BasicDataForm.vue | 75 +------------------ .../newMedicalCard/utils/medicalConfig.js | 5 ++ 2 files changed, 8 insertions(+), 72 deletions(-) diff --git a/src/pages/newMedicalCard/components/BasicDataForms/BasicDataForm.vue b/src/pages/newMedicalCard/components/BasicDataForms/BasicDataForm.vue index 5d7c6e7..28a7245 100644 --- a/src/pages/newMedicalCard/components/BasicDataForms/BasicDataForm.vue +++ b/src/pages/newMedicalCard/components/BasicDataForms/BasicDataForm.vue @@ -25,7 +25,7 @@ base-modal(v-model="showModal" title="Загрузить изображение") base-upload-photo( v-model="basic[data.dataKey][field.key]" - :confirm-upload="confirmCahngeAvatar" + :confirm-upload="confirmChangeAvatar" ) .select(v-else-if="field.type === 'select'") base-select( @@ -49,7 +49,7 @@ ) base-input( v-else, - :readonly="checkRow(data.dataLabel)" + :readonly="field.disabled || !this.isEdit" v-model="basic[data.dataKey][field.key]" @update:model-value="checkChangeInput" :type="field.type" @@ -69,10 +69,7 @@ import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWra import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider.vue"; import { getFieldsNameUnvalidated } from "@/shared/utils/changesObjects"; import { addNotification } from "@/components/Notifications/notificationContext"; -import { getRequestChangeData } from "@/shared/utils/wrapperRequestChangeData"; import { checkChangeData } from "@/shared/utils/changesObjects"; -import { fetchWrapper } from "@/shared/fetchWrapper"; -import moment from "moment"; import { baseDataForm, genderOptions, @@ -168,13 +165,10 @@ export default { }); } }, - checkRow(label) { - return label === "Личные данные" ? true : !this.isEdit; - }, checkChangeInput() { this.isCheckChange = checkChangeData(this.initDataBasic, this.basic); }, - confirmCahngeAvatar() { + confirmChangeAvatar() { this.showModal = false; this.isCheckChange = true; }, @@ -183,69 +177,6 @@ export default { this.isEdit = false; this.isCheckChange = false; }, - oldUpdateBasicData() { - let registration = this.basic.registrationAddress; - let residence = this.basic.residenceAddress; - let personal = this.basic.personalData; - const personalFormData = new FormData(); - personalFormData.append( - "full_name", - `${personal.last_name} ${personal.first_name} ${personal.patronymic}` - ); - if (personal.birth_date) { - personalFormData.append( - "birth_date", - moment(personal.birth_date).format("YYYY-MM-DD") - ); - } - if (personal.gender) { - personalFormData.append("gender", personal.gender?.id); - } - if ( - personal.photo.file && - personal.photo.photo !== this.initDataBasic.personalData.photo.photo - ) { - personalFormData.append("photo", personal.photo.file[0]); - } - const request = Object.keys(this.basic).map((key) => { - if (key === "personalData") { - return fetchWrapper.post( - `general/person/${personal.id}/update/`, - personalFormData, - "formData" - ); - } - if (key === "registrationAddress") { - let createRegistration = { - person: personal.id, - registration_flg: true, - ...registration, - }; - return getRequestChangeData( - createRegistration, - registration, - this.initDataBasic[key], - "address", - registration.id - ); - } - if (key === "residenceAddress") { - let createResidence = { - person: personal.id, - residence_flg: true, - ...residence, - }; - return getRequestChangeData( - createResidence, - residence, - this.initDataBasic[key], - "address", - residence.id - ); - } - }); - return request; - }, saveChange() { const form = this.$refs.formBasicData; form.validate().then((validate) => { diff --git a/src/pages/newMedicalCard/utils/medicalConfig.js b/src/pages/newMedicalCard/utils/medicalConfig.js index 032be1b..a856b1d 100644 --- a/src/pages/newMedicalCard/utils/medicalConfig.js +++ b/src/pages/newMedicalCard/utils/medicalConfig.js @@ -19,26 +19,31 @@ export const baseDataForm = [ key: "last_name", label: "Фамилия", type: "text", + disabled: true, }, { key: "first_name", label: "Имя", type: "text", + disabled: true, }, { key: "patronymic", label: "Отчество", type: "text", + disabled: true, }, { key: "gender", label: "Пол", type: "select", + disabled: true, }, { key: "birth_date", label: "Дата рождения", type: "date", + disabled: true, }, { key: "photo",