change disabled method
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user