Исправила отображение контактов на записи
This commit is contained in:
@@ -55,6 +55,7 @@ export default {
|
||||
default: false,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "text",
|
||||
},
|
||||
accept: {
|
||||
|
||||
@@ -147,7 +147,12 @@ export default {
|
||||
return date && date?.length === 10 ? date : null;
|
||||
},
|
||||
defaultRule(val) {
|
||||
return !val || moment(this.convertRUFormat(val)).isValid();
|
||||
return (
|
||||
!val ||
|
||||
moment(
|
||||
this.checkFormat(val) ? this.convertRUFormat(val) : null
|
||||
).isValid()
|
||||
);
|
||||
},
|
||||
closeCalendar() {
|
||||
this.calendarVisibility = false;
|
||||
|
||||
@@ -64,15 +64,27 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
contacts() {
|
||||
let contactList = this.record?.person?.contacts
|
||||
?.filter(
|
||||
(elem) => elem.category === "PHONE" || elem.category === "EMAIL"
|
||||
)
|
||||
?.map((elem) => ({
|
||||
kind: elem.category,
|
||||
icon: networks.find((item) => item.id === elem.category)?.icon,
|
||||
value: elem.value,
|
||||
}));
|
||||
let contactList = [];
|
||||
this.record?.person?.contacts?.find((elem) => {
|
||||
if (elem.category === "PHONE") {
|
||||
contactList.push({
|
||||
kind: elem?.category,
|
||||
icon: networks?.find((item) => item.id === elem.category)?.icon,
|
||||
value: elem?.value,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
this.record?.person?.contacts?.find((elem) => {
|
||||
if (elem.category === "EMAIL") {
|
||||
contactList.push({
|
||||
kind: elem?.category,
|
||||
icon: networks?.find((item) => item.id === elem.category)?.icon,
|
||||
value: elem?.value,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (this.collapsedDisplayCondition) {
|
||||
contactList.length = 1;
|
||||
return contactList;
|
||||
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
return {
|
||||
patient: {},
|
||||
phone: "",
|
||||
birth_date: {},
|
||||
birth_date: "",
|
||||
time: {},
|
||||
patientData: patientData,
|
||||
currentStatus: patientData.statuses.find((e) => e.name === "Не принят"),
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
v-if="field.type === 'date'",
|
||||
v-model="docData[data.dataKey][field.key]",
|
||||
:name="data.dataKey + ':' + field.key",
|
||||
@update:model-value="checkChangeDocData(data.dataKey)",
|
||||
@update:model-value="checkChangeDocData",
|
||||
:readonly="!isEdit",
|
||||
:width="302",
|
||||
:mask="field?.inputMask",
|
||||
@@ -57,7 +57,7 @@
|
||||
v-if="field.type === 'text'",
|
||||
v-model="docData[data.dataKey][field.key]",
|
||||
:name="data.dataKey + ':' + field.key",
|
||||
@update:model-value="checkChangeDocData(data.dataKey)",
|
||||
@update:model-value="checkChangeDocData",
|
||||
:readonly="!isEdit",
|
||||
:type="field.type",
|
||||
:width="302",
|
||||
@@ -105,7 +105,6 @@ export default {
|
||||
docData: null,
|
||||
isCheckChange: false,
|
||||
isLoadingData: true,
|
||||
approvedPassportData: false,
|
||||
copiedFields: [
|
||||
"series",
|
||||
"number",
|
||||
@@ -165,15 +164,13 @@ export default {
|
||||
.getValidationComponents()
|
||||
.filter((elem) => !this.personDataField.includes(elem.name))
|
||||
.forEach((elem) => elem.resetValidation());
|
||||
this.approvedPassportData = true;
|
||||
return true;
|
||||
}
|
||||
this.approvedPassportData = false;
|
||||
return defaultRule(val);
|
||||
},
|
||||
removeImage(docKey, field) {
|
||||
this.docData[docKey][field] = {};
|
||||
this.isCheckChange = true;
|
||||
this.checkChangeDocData();
|
||||
},
|
||||
copyValue(text) {
|
||||
navigator.clipboard.writeText(text);
|
||||
@@ -182,15 +179,7 @@ export default {
|
||||
return !this.isEdit && this.copiedFields.some((elem) => elem === key);
|
||||
},
|
||||
cancelEdit() {
|
||||
const { passport, insurance_number, tax_identification_number } =
|
||||
this.initialDocData;
|
||||
this.docData = {
|
||||
passport: JSON.parse(JSON.stringify(passport)),
|
||||
insurance_number: JSON.parse(JSON.stringify(insurance_number)),
|
||||
tax_identification_number: JSON.parse(
|
||||
JSON.stringify(tax_identification_number)
|
||||
),
|
||||
};
|
||||
this.docData = this.destruct(this.initialDocData);
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
this.$refs.documentForm.resetValidation();
|
||||
@@ -198,10 +187,10 @@ export default {
|
||||
openEdit() {
|
||||
this.isEdit = true;
|
||||
},
|
||||
checkChangeDocData(key) {
|
||||
checkChangeDocData() {
|
||||
this.isCheckChange = checkChangeData(
|
||||
this.initialDocData?.[key],
|
||||
this.docData?.[key]
|
||||
this.destruct(this.initialDocData),
|
||||
this.docData
|
||||
);
|
||||
},
|
||||
openModal(id) {
|
||||
@@ -231,7 +220,6 @@ export default {
|
||||
Object.keys(this.docData).forEach((elem) => {
|
||||
this.checkChangePhoto(elem, "attachments");
|
||||
let newData = JSON.parse(JSON.stringify(this.docData[elem]));
|
||||
console.log("prep", newData);
|
||||
newData.attachments = {};
|
||||
if (!checkChangeData(this.initialDocData?.[elem], newData)) return;
|
||||
delete newData.id;
|
||||
@@ -243,24 +231,24 @@ export default {
|
||||
delete newData.issued_by_org_code;
|
||||
}
|
||||
delete newData.attachments;
|
||||
Object.keys(this.docData[elem])?.forEach((key) => {
|
||||
if (!this.docData[elem]?.[key]) delete newData?.[key];
|
||||
});
|
||||
if (!this.initialDocData?.[elem]?.id) {
|
||||
console.log("post", newData);
|
||||
newData.person_id =
|
||||
this.$store.state.medical?.basicData?.personalData?.id;
|
||||
console.log("create", newData);
|
||||
//request.push(this.createData("documents/", newData));
|
||||
request.push(this.createData("documents/", newData));
|
||||
} else {
|
||||
console.log("create", newData);
|
||||
// request.push(
|
||||
// this.updateData(
|
||||
// `documents/${this.initialDocData?.[elem]?.id}`,
|
||||
// newData
|
||||
// )
|
||||
// );
|
||||
request.push(
|
||||
this.updateData(
|
||||
`documents/${this.initialDocData?.[elem]?.id}`,
|
||||
newData
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
Promise.allSettled(request).then(() => {
|
||||
this.getMedicalCardData(this.$route.params.id);
|
||||
this.getMedicalDataById(this.$route.params.id);
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
this.$refs.form?.resetValidation();
|
||||
@@ -292,26 +280,25 @@ export default {
|
||||
return date ? date.split(".").reverse().join("-") : "";
|
||||
},
|
||||
...mapActions({
|
||||
getMedicalCardData: "getMedicalCardDataById",
|
||||
getMedicalDataById: "getMedicalDataById",
|
||||
}),
|
||||
destruct(data) {
|
||||
const { passport, insurance_number, tax_identification_number } =
|
||||
JSON.parse(JSON.stringify(data));
|
||||
return {
|
||||
passport: passport,
|
||||
insurance_number: insurance_number,
|
||||
tax_identification_number: tax_identification_number,
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
initialDocData: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(value) {
|
||||
if (Object.keys(value).length) {
|
||||
const { passport, insurance_number, tax_identification_number } =
|
||||
value;
|
||||
this.docData = {
|
||||
passport: JSON.parse(JSON.stringify(passport)),
|
||||
insurance_number: JSON.parse(JSON.stringify(insurance_number)),
|
||||
tax_identification_number: JSON.parse(
|
||||
JSON.stringify(tax_identification_number)
|
||||
),
|
||||
};
|
||||
console.log(this.docData);
|
||||
} else this.docData = this.initializationData;
|
||||
if (Object.keys(value).length) this.docData = this.destruct(value);
|
||||
else this.docData = this.initializationData;
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -17,23 +17,27 @@
|
||||
:style="{marginTop: field.label === 'Документы' ? '20px' : null}"
|
||||
)
|
||||
.label-field.font-sm.text-sm.whitespace-nowrap {{`${field.label} :`}}
|
||||
.avatar-field.flex.gap-3.items-center.h-10.w-10(v-if="field.type === 'attachments'")
|
||||
.flex.w-10.h-10.relative(v-if="insuranceData[insurance.insuranceKey][field.key]?.photo")
|
||||
.flex.gap-3.items-center.h-10.w-10(
|
||||
v-if="field.type === 'photo'",
|
||||
:style="{'min-width': field.label === 'Документы' ? '324px' : '302px'}"
|
||||
)
|
||||
.flex.w-10.h-10.relative(v-if="insuranceData[insurance.insuranceKey]?.attachments?.photo")
|
||||
img.rounded.avatar.object-cover(
|
||||
:src="insuranceData[insurance.insuranceKey][field.key]?.photo",
|
||||
:src="insuranceData[insurance.insuranceKey]?.attachments?.photo",
|
||||
alt="AV"
|
||||
)
|
||||
q-badge.delete(
|
||||
floating,
|
||||
v-if="isEdit",
|
||||
@click="removeImage(insurance?.insuranceKey, field?.key)",
|
||||
rounded
|
||||
rounded,
|
||||
:style="{padding: 0}"
|
||||
)
|
||||
q-icon(name="app:icon-cancel", size="8px")
|
||||
q-icon.cancel-icon(name="app:cancel-mini", size="16px")
|
||||
.replace-photo.font-medium.text-base.cursor-pointer(
|
||||
v-if="isEdit",
|
||||
@click="changeModal(insurance.insuranceKey)"
|
||||
) {{ insuranceData[insurance.insuranceKey][field.key]?.photo ? "Заменить фото" : "Добавить фото" }}
|
||||
) {{ insuranceData[insurance.insuranceKey]?.attachments?.photo ? "Заменить фото" : "Добавить фото" }}
|
||||
base-modal(
|
||||
v-if="insurance.insuranceKey === photoId"
|
||||
v-model="showModal",
|
||||
@@ -48,7 +52,7 @@
|
||||
.category-select.flex.items-center.change.px-4.rounded {{selectCategory(basic[insurance.insuranceKey][field.key])}}
|
||||
q-btn.change.flex.w-7.h-9.rounded-md(
|
||||
v-if="isEdit",
|
||||
@click="showModalCategories = true",
|
||||
@click="openModalCategories",
|
||||
dense,
|
||||
padding="8px"
|
||||
)
|
||||
@@ -75,28 +79,26 @@
|
||||
span(
|
||||
:style="{color: 'var(--font-dark-blue-color)'}"
|
||||
) {{"\xa0" + basic?.benefit[insurance?.discount] + "%"}}
|
||||
.input-container.flex.flex-col.relative(v-if="field.type === 'text'")
|
||||
.input-container.flex.flex-col.relative(v-else)
|
||||
base-input(
|
||||
v-model="insuranceData[insurance.insuranceKey][field.key]",
|
||||
@update:model-value="checkChangeInput(insurance.insuranceKey)",
|
||||
:mask="field?.inputMask",
|
||||
@update:model-value="checkChangeInput",
|
||||
:readonly="!isEdit",
|
||||
:type="field.type",
|
||||
size="M",
|
||||
:name="insurance.insuranceKey + ':' + field.key",
|
||||
:rule="[(val) => checkFields(val, insurance.insuranceKey, field.key, field.rules)]"
|
||||
:rule="[(val) => checkFields(val, insurance.insuranceKey, field.rules)]"
|
||||
)
|
||||
q-icon.my-auto.text-lg.label-field.cursor-pointer.copy(
|
||||
size="18px",
|
||||
name="app:copy",
|
||||
v-if="checkCopiedFields(field.key, basic[insurance.insuranceKey])",
|
||||
@click="copyValue(basic[insurance.insuranceKey][field.key])"
|
||||
v-if="checkCopiedFields(field.key, insuranceData[insurance.insuranceKey])",
|
||||
@click="copyValue(insuranceData[insurance.insuranceKey][field.key])"
|
||||
)
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { baseInsuranceForm } from "@/pages/newMedicalCard/utils/medicalConfig";
|
||||
import { mapGetters, mapState } from "vuex";
|
||||
import { mapActions, mapGetters, mapState } from "vuex";
|
||||
import MedicalFormWrapper from "@/pages/newMedicalCard/components/MedicalFormWrapper.vue";
|
||||
import BaseAvatar from "@/components/base/BaseAvatar.vue";
|
||||
import { fetchWrapper } from "@/shared/fetchWrapper";
|
||||
@@ -131,13 +133,31 @@ export default {
|
||||
photoId: "",
|
||||
copiedFields: ["series", "number"],
|
||||
insuranceData: {},
|
||||
initializationData: {
|
||||
OMS: {
|
||||
category: "OMS",
|
||||
id: null,
|
||||
series: null,
|
||||
number: null,
|
||||
issued_by: null,
|
||||
issued_at: "",
|
||||
attachments: null,
|
||||
},
|
||||
DMS: {
|
||||
category: "OMS",
|
||||
id: null,
|
||||
series: null,
|
||||
number: null,
|
||||
issued_by: null,
|
||||
issued_at: "",
|
||||
attachments: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
url: "getUrl",
|
||||
//avatar: "getAvatar",
|
||||
//initDataBasic: "getBasicData",
|
||||
}),
|
||||
...mapState({
|
||||
basic: (state) => state.medical?.basicData,
|
||||
@@ -174,8 +194,8 @@ export default {
|
||||
this.$store.dispatch("getBenefitData", text);
|
||||
},
|
||||
removeImage(docKey, field) {
|
||||
this.basic[docKey][field] = {};
|
||||
this.isCheckChange = true;
|
||||
this.insuranceData[docKey][field] = {};
|
||||
this.checkChangeInput();
|
||||
},
|
||||
checkCopiedFields(key, item) {
|
||||
return (
|
||||
@@ -209,10 +229,11 @@ export default {
|
||||
openModalCategories() {
|
||||
//if (this.isEdit) this.showModalCategories = true;
|
||||
},
|
||||
checkChangeInput(key) {
|
||||
this.isCheckChange =
|
||||
JSON.stringify(this.initialDocData?.[key]) !==
|
||||
JSON.stringify(this.insuranceData?.[key]);
|
||||
checkChangeInput() {
|
||||
this.isCheckChange = checkChangeData(
|
||||
this.destruct(this.initialDocData),
|
||||
this.insuranceData
|
||||
);
|
||||
},
|
||||
confirmChangePhoto() {
|
||||
this.showModal = false;
|
||||
@@ -224,9 +245,9 @@ export default {
|
||||
if (!validate) {
|
||||
getFieldsNameUnvalidated(form).forEach((elem) => {
|
||||
let error = {};
|
||||
this.configData.forEach(({ dataKey, fields }) => {
|
||||
this.insuranceConfig.forEach(({ insuranceKey, fields }) => {
|
||||
let findedElem = fields.find(
|
||||
(el) => dataKey + ":" + el.key === elem
|
||||
(el) => insuranceKey + ":" + el.key === elem
|
||||
);
|
||||
if (findedElem) error = findedElem?.errorMessage;
|
||||
});
|
||||
@@ -237,176 +258,35 @@ export default {
|
||||
Object.keys(this.insuranceData).forEach((elem) => {
|
||||
this.checkChangePhoto(elem, "attachments");
|
||||
let newData = JSON.parse(JSON.stringify(this.insuranceData[elem]));
|
||||
console.log("prep", newData);
|
||||
newData.attachments = {};
|
||||
if (!checkChangeData(this.initialDocData?.[elem], newData)) return;
|
||||
delete newData.id;
|
||||
delete newData.attachments;
|
||||
Object.keys(this.insuranceData[elem])?.forEach((key) => {
|
||||
if (!this.insuranceData?.[elem]?.[key]) delete newData?.[key];
|
||||
});
|
||||
if (!this.initialDocData?.[elem]?.id) {
|
||||
console.log("post", newData);
|
||||
newData.person_id =
|
||||
this.$store.state.medical?.basicData?.personalData?.id;
|
||||
console.log("create", newData);
|
||||
//request.push(this.createData("documents/", newData));
|
||||
} else {
|
||||
console.log("create", newData);
|
||||
// request.push(
|
||||
// this.updateData(
|
||||
// `documents/${this.initialDocData?.[elem]?.id}`,
|
||||
// newData
|
||||
// )
|
||||
// );
|
||||
}
|
||||
request.push(this.createData("documents/", newData));
|
||||
} else
|
||||
request.push(
|
||||
this.updateData(
|
||||
`documents/${this.initialDocData?.[elem]?.id}`,
|
||||
newData
|
||||
)
|
||||
);
|
||||
});
|
||||
if (request.length)
|
||||
Promise.allSettled(request).then(() => {
|
||||
this.getMedicalCardData(this.$route.params.id);
|
||||
this.getMedicalDataById(this.$route.params.id);
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
this.$refs.form?.resetValidation();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// let insuranceDMS = this.basic.insuranceDMS;
|
||||
// let insuranceOMS = this.basic.insuranceOMS;
|
||||
// let personal = this.basic.personalData;
|
||||
// let benefit = this.basic.benefit;
|
||||
|
||||
// const insuranceFormDataDMS = new FormData();
|
||||
// const insuranceFormDataOMS = new FormData();
|
||||
// const benefitFormData = new FormData();
|
||||
|
||||
// if (insuranceDMS.series && insuranceDMS.number) {
|
||||
// for (let key in insuranceDMS) {
|
||||
// if (insuranceDMS[key] && key !== "photo" && key !== "id")
|
||||
// insuranceFormDataDMS.append(key, insuranceDMS[key]);
|
||||
// }
|
||||
// }
|
||||
// if (
|
||||
// insuranceDMS.photo.file &&
|
||||
// insuranceDMS.photo.photo !== this.initDataBasic.insuranceDMS.photo.photo
|
||||
// )
|
||||
// insuranceFormDataDMS.append("photo", insuranceDMS.photo.file[0]);
|
||||
|
||||
// if (insuranceOMS.series && insuranceOMS.number) {
|
||||
// for (let key in insuranceOMS) {
|
||||
// if (insuranceOMS[key] && key !== "photo" && key !== "id")
|
||||
// insuranceFormDataOMS.append(key, insuranceOMS[key]);
|
||||
// }
|
||||
// }
|
||||
// if (
|
||||
// insuranceOMS.photo.file &&
|
||||
// insuranceOMS.photo.photo !== this.initDataBasic.insuranceOMS.photo.photo
|
||||
// )
|
||||
// insuranceFormDataOMS.append("photo", insuranceOMS.photo.file[0]);
|
||||
|
||||
// const request = Object.keys(this.basic).map((key) => {
|
||||
// if (
|
||||
// key === "insuranceDMS" &&
|
||||
// !insuranceDMS?.id &&
|
||||
// insuranceDMS.series &&
|
||||
// insuranceDMS.number
|
||||
// ) {
|
||||
// insuranceFormDataDMS.append("title", "DMS");
|
||||
// insuranceFormDataDMS.append("person", personal.id);
|
||||
// return this.sendData(
|
||||
// `general/insurance_policy/create/`,
|
||||
// insuranceFormDataDMS
|
||||
// );
|
||||
// }
|
||||
// if (
|
||||
// key === "insuranceOMS" &&
|
||||
// !insuranceOMS?.id &&
|
||||
// insuranceOMS.series &&
|
||||
// insuranceOMS.number
|
||||
// ) {
|
||||
// insuranceFormDataOMS.append("title", "OMS");
|
||||
// insuranceFormDataOMS.append("person", personal.id);
|
||||
// return this.sendData(
|
||||
// `general/insurance_policy/create/`,
|
||||
// insuranceFormDataOMS
|
||||
// );
|
||||
// }
|
||||
// if (
|
||||
// checkChangeData(this.initDataBasic.insuranceDMS, insuranceDMS) &&
|
||||
// key === "insuranceDMS" &&
|
||||
// insuranceDMS.id
|
||||
// ) {
|
||||
// this.checkedPhoto(
|
||||
// insuranceDMS.photo,
|
||||
// insuranceDMS.id,
|
||||
// "insurance_policy",
|
||||
// "delete_photo"
|
||||
// );
|
||||
// insuranceFormDataDMS.append("title", "DMS");
|
||||
// return this.sendData(
|
||||
// `general/insurance_policy/${insuranceDMS.id}/update/`,
|
||||
// insuranceFormDataDMS
|
||||
// );
|
||||
// } else if (
|
||||
// insuranceDMS.id &&
|
||||
// (!insuranceDMS.series || !insuranceDMS.number)
|
||||
// ) {
|
||||
// this.addErrorNotification(
|
||||
// "Ошибка заполнения формы ДМС",
|
||||
// "Пожалуйста заполните все поля"
|
||||
// );
|
||||
// }
|
||||
// if (
|
||||
// checkChangeData(this.initDataBasic.insuranceOMS, insuranceOMS) &&
|
||||
// key === "insuranceOMS" &&
|
||||
// insuranceOMS.id
|
||||
// ) {
|
||||
// this.checkedPhoto(
|
||||
// insuranceOMS.photo,
|
||||
// insuranceOMS.id,
|
||||
// "insurance_policy",
|
||||
// "delete_photo"
|
||||
// );
|
||||
// insuranceFormDataOMS.append("title", "OMS");
|
||||
// return this.sendData(
|
||||
// `general/insurance_policy/${insuranceOMS.id}/update/`,
|
||||
// insuranceFormDataOMS
|
||||
// );
|
||||
// } else if (
|
||||
// insuranceOMS.id &&
|
||||
// (!insuranceOMS.series || !insuranceOMS.number)
|
||||
// ) {
|
||||
// this.addErrorNotification(
|
||||
// "Ошибка заполнения формы ОМС",
|
||||
// "Пожалуйста заполните все поля"
|
||||
// );
|
||||
// }
|
||||
// if (
|
||||
// checkChangeData(this.initDataBasic.benefit, benefit) &&
|
||||
// key === "benefit"
|
||||
// ) {
|
||||
// this.checkedPhoto(
|
||||
// benefit.photo,
|
||||
// personal.id,
|
||||
// "person",
|
||||
// "delete_photo_benefit"
|
||||
// );
|
||||
// fetchWrapper.post(`general/person/${personal.id}/update/`, {
|
||||
// benefit: benefit.id,
|
||||
// });
|
||||
// if (
|
||||
// benefit.photo.file &&
|
||||
// benefit.photo.photo !== this.initDataBasic.benefit.photo.photo
|
||||
// ) {
|
||||
// benefitFormData.append("photo_benefit", benefit.photo.file[0]);
|
||||
// return this.sendData(
|
||||
// `general/person/${personal.id}/update/`,
|
||||
// benefitFormData
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// return request;
|
||||
},
|
||||
|
||||
//todo удалить
|
||||
|
||||
checkChangePhoto(updatedObjId, field) {
|
||||
if (this.insuranceData[updatedObjId][field]?.file)
|
||||
console.log(
|
||||
@@ -418,33 +298,30 @@ export default {
|
||||
addErrorNotification(title, message) {
|
||||
addNotification(title + message, title, message, "error", 5000);
|
||||
},
|
||||
async sendData(url, body) {
|
||||
return await fetchWrapper.post(url, body, "formData");
|
||||
async createData(url, body) {
|
||||
return await fetchWrapper.post(url, body);
|
||||
},
|
||||
async updateData(url, body) {
|
||||
return await fetchWrapper.patch(url, body);
|
||||
},
|
||||
cancelEdit() {
|
||||
const { OMS, DMS } = JSON.parse(JSON.stringify(this.initialDocData));
|
||||
this.insuranceData = {
|
||||
OMS: OMS,
|
||||
DMS: DMS,
|
||||
};
|
||||
console.log("insuranceData cancel", this.insuranceData);
|
||||
this.insuranceData = this.destruct(this.initialDocData);
|
||||
this.isEdit = false;
|
||||
this.isCheckChange = false;
|
||||
},
|
||||
openEdit() {
|
||||
this.isEdit = true;
|
||||
},
|
||||
// saveChange() {
|
||||
// this.isLoadingData = true;
|
||||
// let updateBasic = this.updateInsurance();
|
||||
// Promise.allSettled(updateBasic)
|
||||
// .then(() => this.$store.dispatch("getMedicalCardData"))
|
||||
// .then(() => {
|
||||
// this.isLoadingData = false;
|
||||
// this.isEdit = false;
|
||||
// this.isCheckChange = false;
|
||||
// });
|
||||
// },
|
||||
destruct(data) {
|
||||
const { OMS, DMS } = JSON.parse(JSON.stringify(data));
|
||||
return {
|
||||
OMS: OMS,
|
||||
DMS: DMS,
|
||||
};
|
||||
},
|
||||
...mapActions({
|
||||
getMedicalDataById: "getMedicalDataById",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
showModalCategories: {
|
||||
@@ -457,12 +334,9 @@ export default {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
const { OMS, DMS } = JSON.parse(JSON.stringify(newVal));
|
||||
this.insuranceData = {
|
||||
OMS: OMS,
|
||||
DMS: DMS,
|
||||
};
|
||||
console.log("insuranceData watch", this.insuranceData);
|
||||
if (Object.keys(newVal).length) {
|
||||
this.insuranceData = this.destruct(newVal);
|
||||
} else this.insuranceData = this.initializationData;
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -477,9 +351,6 @@ export default {
|
||||
background: rgba(0, 0, 0, 0.05)
|
||||
color: var(--font-dark-blue-color)
|
||||
|
||||
.avatar-field
|
||||
min-width: 302px
|
||||
|
||||
.avatar
|
||||
height: 100%
|
||||
|
||||
@@ -540,4 +411,7 @@ export default {
|
||||
|
||||
.q-field--outlined.q-field--readonly :deep(.q-field__native)
|
||||
cursor: default
|
||||
|
||||
.cancel-icon :deep(path)
|
||||
fill: white
|
||||
</style>
|
||||
|
||||
@@ -64,7 +64,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
protocolData: {
|
||||
date: null,
|
||||
date: "",
|
||||
startTime: null,
|
||||
},
|
||||
};
|
||||
@@ -96,19 +96,27 @@ export default {
|
||||
...mapActions({
|
||||
createProtocol: "createProtocol",
|
||||
}),
|
||||
checkFormat(date) {
|
||||
return date && date?.length === 10 ? date : null;
|
||||
},
|
||||
saveProtocol() {
|
||||
if (
|
||||
!Object.keys(this.protocolData).every((key) => this.protocolData[key])
|
||||
) {
|
||||
)
|
||||
return;
|
||||
}
|
||||
let time = this.protocolData.startTime.split(":");
|
||||
let start = moment(this.protocolData.date).hour(time[0]).minute(time[1]);
|
||||
let start = moment(this.checkFormat(this.protocolData.date))
|
||||
?.hour(time[0])
|
||||
?.minute(time[1]);
|
||||
let createdProtocol = {
|
||||
start: start.isValid() ? start.format() : null,
|
||||
end: start.isValid() ? start.add(30, "m").format() : null,
|
||||
status: null,
|
||||
};
|
||||
if (
|
||||
Object.keys(createdProtocol)?.some((elem) => !createdProtocol?.[elem])
|
||||
)
|
||||
return;
|
||||
createdProtocol.status = null;
|
||||
this.createProtocol(createdProtocol);
|
||||
this.changeShownCreateModal(false);
|
||||
this.createInspection();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template lang="pug">
|
||||
.flex.flex-col.gap-y-2.wrapper.h-full.w-full
|
||||
basic-data-form
|
||||
//contacts-form
|
||||
contacts-form
|
||||
documents-form
|
||||
//insurance-form
|
||||
insurance-form
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -398,7 +398,7 @@ export const baseInsuranceForm = [
|
||||
rules: (val) => ruleNotValue(val),
|
||||
errorMessage: {
|
||||
title: "Ошибка валидации",
|
||||
message: "Номер полиса ДМС не заполнен",
|
||||
message: "Номер полиса ОМС не заполнен",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -34,20 +34,6 @@ const state = () => ({
|
||||
house: null,
|
||||
flat: null,
|
||||
},
|
||||
// insuranceDMS: {
|
||||
// series: null,
|
||||
// number: null,
|
||||
// photo: null,
|
||||
// id: null,
|
||||
// organization: null,
|
||||
// },
|
||||
// insuranceOMS: {
|
||||
// series: null,
|
||||
// number: null,
|
||||
// photo: null,
|
||||
// id: null,
|
||||
// organization: null,
|
||||
// },
|
||||
benefit: {
|
||||
id: null,
|
||||
discount: null,
|
||||
@@ -151,7 +137,7 @@ const getters = {
|
||||
(person?.gender &&
|
||||
genderOptions.find((el) => el.id === person?.gender)) ||
|
||||
"",
|
||||
birth_date: person?.birth_date ? new Date(person?.birth_date) : "",
|
||||
birth_date: person?.birth_date || "",
|
||||
photo: person?.photo
|
||||
? {
|
||||
photo: rootState.getUrl + person.photo,
|
||||
@@ -208,7 +194,8 @@ const getters = {
|
||||
series: document?.series || (isPolicy || isPassport ? "" : "000"),
|
||||
number: document?.number || "",
|
||||
issued_by: document?.issued_by || (isPassport ? "" : "000"),
|
||||
issued_by_org_code: document?.issued_by_org_code || "",
|
||||
issued_by_org_code:
|
||||
document?.issued_by_org_code || (isPassport ? "000-000" : ""),
|
||||
issued_at: document?.issued_at || "",
|
||||
attachments: document?.attachments?.length
|
||||
? {
|
||||
@@ -218,15 +205,6 @@ const getters = {
|
||||
: {},
|
||||
};
|
||||
});
|
||||
// passport = documents?.find(({ category }) => category === "passport"),
|
||||
// insurance_number = documents?.find(
|
||||
// ({ category }) => category === "insurance_number"
|
||||
// ),
|
||||
// tax_identification_number = documents?.find(
|
||||
// ({ category }) => category === "tax_identification_number"
|
||||
// ),
|
||||
// OMS = documents?.find(({ category }) => category === "OMS"),
|
||||
// DMS = documents?.find(({ category }) => category === "DMS");
|
||||
return result;
|
||||
},
|
||||
getContactsData(state) {
|
||||
|
||||
Reference in New Issue
Block a user