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