[WIP] Добавил переход на медкарту, возможность редактирования основных данных
This commit is contained in:
@@ -33,14 +33,14 @@
|
|||||||
size="M"
|
size="M"
|
||||||
)
|
)
|
||||||
base-input(
|
base-input(
|
||||||
v-model="addresses.house_number",
|
v-model="addresses.house",
|
||||||
label="Дом",
|
label="Дом",
|
||||||
placeholder="Номер дома",
|
placeholder="Номер дома",
|
||||||
disabled,
|
disabled,
|
||||||
size="M"
|
size="M"
|
||||||
)
|
)
|
||||||
base-input(
|
base-input(
|
||||||
v-model="addresses.apartment_number",
|
v-model="addresses.flat",
|
||||||
label="Квартира",
|
label="Квартира",
|
||||||
placeholder="Номер квартиры",
|
placeholder="Номер квартиры",
|
||||||
disabled,
|
disabled,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
.thumb.h-full.rounded(:style="thumbStyle")
|
.thumb.h-full.rounded(:style="thumbStyle")
|
||||||
span.grey-color {{ medcardInfo?.filling_percentage || 0 }}%
|
span.grey-color {{ medcardInfo?.filling_percentage || 0 }}%
|
||||||
.field(:style="{...headerStyle(headerConfig[6])}")
|
.field(:style="{...headerStyle(headerConfig[6])}")
|
||||||
q-icon.medcard.cursor-pointer(name="app:medcard", size="20px")
|
q-icon.medcard.cursor-pointer(name="app:medcard", size="20px", @click="openMedicalCard")
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -36,6 +36,7 @@ import * as moment from "moment/moment";
|
|||||||
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
|
import TheNotificationProvider from "@/components/Notifications/TheNotificationProvider";
|
||||||
import { addNotification } from "@/components/Notifications/notificationContext";
|
import { addNotification } from "@/components/Notifications/notificationContext";
|
||||||
import avatar from "@/assets/images/person.png";
|
import avatar from "@/assets/images/person.png";
|
||||||
|
import { mapActions } from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "MedicalCardSearchRow",
|
name: "MedicalCardSearchRow",
|
||||||
components: { TheNotificationProvider },
|
components: { TheNotificationProvider },
|
||||||
@@ -72,6 +73,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
getMedicalCardData: "getMedicalCardDataByPersonId",
|
||||||
|
}),
|
||||||
|
openMedicalCard() {
|
||||||
|
this.getMedicalCardData({
|
||||||
|
personId: this.medcardInfo.person_id,
|
||||||
|
successCallback: (id) => this.$router.push("medical-card/" + id),
|
||||||
|
});
|
||||||
|
},
|
||||||
convertDate(date) {
|
convertDate(date) {
|
||||||
return moment(date)?.format("DD MMMM YYYY");
|
return moment(date)?.format("DD MMMM YYYY");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
:is-check-change="isCheckChange"
|
:is-check-change="isCheckChange"
|
||||||
:is-loading-data="isLoadingData"
|
:is-loading-data="isLoadingData"
|
||||||
:is-edit="isEdit"
|
:is-edit="isEdit"
|
||||||
:save="saveChange"
|
:save="updateBasicData"
|
||||||
:cancel="cancelEdit"
|
:cancel="cancelEdit"
|
||||||
:open-edit="openEdit"
|
:open-edit="openEdit"
|
||||||
)
|
)
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
)
|
)
|
||||||
.select(v-else-if="field.type === 'select'")
|
.select(v-else-if="field.type === 'select'")
|
||||||
base-select(
|
base-select(
|
||||||
:readonly="!isEdit"
|
readonly,
|
||||||
v-model="basic[data.dataKey][field.key]"
|
v-model="basic[data.dataKey][field.key]"
|
||||||
@update:model-value="checkChangeInput"
|
@update:model-value="checkChangeInput"
|
||||||
:hide-dropdown-icon="!isEdit"
|
:hide-dropdown-icon="!isEdit"
|
||||||
@@ -43,13 +43,13 @@
|
|||||||
v-else-if="field.type === 'date'",
|
v-else-if="field.type === 'date'",
|
||||||
v-model="basic[data.dataKey][field.key]",
|
v-model="basic[data.dataKey][field.key]",
|
||||||
size="M",
|
size="M",
|
||||||
:readonly="!isEdit",
|
readonly
|
||||||
@update:model-value="checkChangeInput",
|
@update:model-value="checkChangeInput",
|
||||||
:width="302"
|
:width="302"
|
||||||
)
|
)
|
||||||
base-input(
|
base-input(
|
||||||
v-else,
|
v-else,
|
||||||
:readonly="!isEdit"
|
:readonly="checkRow(data.dataLabel)"
|
||||||
v-model="basic[data.dataKey][field.key]"
|
v-model="basic[data.dataKey][field.key]"
|
||||||
@update:model-value="checkChangeInput"
|
@update:model-value="checkChangeInput"
|
||||||
:type="field.type"
|
:type="field.type"
|
||||||
@@ -81,6 +81,8 @@ import {
|
|||||||
import { mapGetters, mapState } from "vuex";
|
import { mapGetters, mapState } from "vuex";
|
||||||
import BaseInput from "@/components/base/BaseInput.vue";
|
import BaseInput from "@/components/base/BaseInput.vue";
|
||||||
import BaseInputDate from "@/components/base/BaseInputDate.vue";
|
import BaseInputDate from "@/components/base/BaseInputDate.vue";
|
||||||
|
import { mapActions } from "vuex";
|
||||||
|
import { removeEmptyFields } from "@/shared/utils/changesObjects";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BasicDataForm",
|
name: "BasicDataForm",
|
||||||
@@ -118,6 +120,46 @@ export default {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
postAddress: "postAddress",
|
||||||
|
}),
|
||||||
|
updateBasicData() {
|
||||||
|
const photoFormData = new FormData();
|
||||||
|
if (
|
||||||
|
this.basic.personalData.photo.file &&
|
||||||
|
this.basic.personalData.photo.photo !==
|
||||||
|
this.initDataBasic.personalData.photo.photo
|
||||||
|
) {
|
||||||
|
photoFormData.append("photo", this.basic.personalData?.photo?.file[0]);
|
||||||
|
console.log("photo_update");
|
||||||
|
}
|
||||||
|
Object.keys(this.basic).map((key) => {
|
||||||
|
if (key === "registrationAddress")
|
||||||
|
this.getRequestChangeData(
|
||||||
|
this.basic.registrationAddress,
|
||||||
|
this.initDataBasic[key]
|
||||||
|
);
|
||||||
|
if (key === "residenceAddress")
|
||||||
|
this.getRequestChangeData(
|
||||||
|
this.basic.residenceAddress,
|
||||||
|
this.initDataBasic[key]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
this.isEdit = false;
|
||||||
|
},
|
||||||
|
getRequestChangeData(updateData, initData) {
|
||||||
|
if (
|
||||||
|
Object.keys(removeEmptyFields(updateData)).length &&
|
||||||
|
JSON.stringify(updateData) !== JSON.stringify(initData)
|
||||||
|
)
|
||||||
|
return this.postAddress({
|
||||||
|
id: this.basic.personalData.id,
|
||||||
|
address: updateData,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
checkRow(label) {
|
||||||
|
return label === "Личные данные" ? true : !this.isEdit;
|
||||||
|
},
|
||||||
checkChangeInput() {
|
checkChangeInput() {
|
||||||
this.isCheckChange = checkChangeData(this.initDataBasic, this.basic);
|
this.isCheckChange = checkChangeData(this.initDataBasic, this.basic);
|
||||||
},
|
},
|
||||||
@@ -130,7 +172,7 @@ export default {
|
|||||||
this.isEdit = false;
|
this.isEdit = false;
|
||||||
this.isCheckChange = false;
|
this.isCheckChange = false;
|
||||||
},
|
},
|
||||||
updateBasicData() {
|
oldUpdateBasicData() {
|
||||||
let registration = this.basic.registrationAddress;
|
let registration = this.basic.registrationAddress;
|
||||||
let residence = this.basic.residenceAddress;
|
let residence = this.basic.residenceAddress;
|
||||||
let personal = this.basic.personalData;
|
let personal = this.basic.personalData;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export const baseDataForm = [
|
|||||||
type: "text",
|
type: "text",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "house_number",
|
key: "house",
|
||||||
label: "Дом",
|
label: "Дом",
|
||||||
type: "text",
|
type: "text",
|
||||||
rules: [(val) => !/^[\W0]/.test(val)],
|
rules: [(val) => !/^[\W0]/.test(val)],
|
||||||
@@ -75,7 +75,7 @@ export const baseDataForm = [
|
|||||||
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "apartment_number",
|
key: "flat",
|
||||||
label: "Квартира",
|
label: "Квартира",
|
||||||
type: "text",
|
type: "text",
|
||||||
rules: [(val) => !/^[\W0]/.test(val)],
|
rules: [(val) => !/^[\W0]/.test(val)],
|
||||||
@@ -104,7 +104,7 @@ export const baseDataForm = [
|
|||||||
type: "text",
|
type: "text",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "house_number",
|
key: "house",
|
||||||
label: "Дом",
|
label: "Дом",
|
||||||
type: "text",
|
type: "text",
|
||||||
rules: [(val) => !/^[\W0]/.test(val)],
|
rules: [(val) => !/^[\W0]/.test(val)],
|
||||||
@@ -112,7 +112,7 @@ export const baseDataForm = [
|
|||||||
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "apartment_number",
|
key: "flat",
|
||||||
label: "Квартира",
|
label: "Квартира",
|
||||||
type: "text",
|
type: "text",
|
||||||
rules: [(val) => !/^[\W0]/.test(val)],
|
rules: [(val) => !/^[\W0]/.test(val)],
|
||||||
@@ -124,12 +124,12 @@ export const baseDataForm = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const errorMap = {
|
export const errorMap = {
|
||||||
house_number: {
|
house: {
|
||||||
title: "Дом",
|
title: "Дом",
|
||||||
error:
|
error:
|
||||||
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
"Номер дома должен начинатся не с нуля и только с цифробуквенного символа",
|
||||||
},
|
},
|
||||||
apartment_number: {
|
flat: {
|
||||||
title: "Квартира",
|
title: "Квартира",
|
||||||
error:
|
error:
|
||||||
"Номер квартиры должен начинатся не с нуля и только с цифробуквенного символа",
|
"Номер квартиры должен начинатся не с нуля и только с цифробуквенного символа",
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ const state = () => ({
|
|||||||
region: null,
|
region: null,
|
||||||
city: null,
|
city: null,
|
||||||
street: null,
|
street: null,
|
||||||
house_number: null,
|
house: null,
|
||||||
apartment_number: null,
|
flat: null,
|
||||||
},
|
},
|
||||||
residenceAddress: {
|
residenceAddress: {
|
||||||
region: null,
|
region: null,
|
||||||
city: null,
|
city: null,
|
||||||
street: null,
|
street: null,
|
||||||
house_number: null,
|
house: null,
|
||||||
apartment_number: null,
|
flat: null,
|
||||||
},
|
},
|
||||||
insuranceDMS: {
|
insuranceDMS: {
|
||||||
series: null,
|
series: null,
|
||||||
@@ -163,17 +163,17 @@ const getters = {
|
|||||||
region: registrationAddress?.region || "",
|
region: registrationAddress?.region || "",
|
||||||
city: registrationAddress?.city || "",
|
city: registrationAddress?.city || "",
|
||||||
street: registrationAddress?.street || "",
|
street: registrationAddress?.street || "",
|
||||||
house_number: registrationAddress?.house_number || "",
|
house: registrationAddress?.house || "",
|
||||||
apartment_number: registrationAddress?.apartment_number || "",
|
flat: registrationAddress?.flat || "",
|
||||||
id: registrationAddress?.id || "",
|
category: "Адрес регистрации",
|
||||||
},
|
},
|
||||||
residenceAddress: {
|
residenceAddress: {
|
||||||
region: residenceAddress?.region || "",
|
region: residenceAddress?.region || "",
|
||||||
city: residenceAddress?.city || "",
|
city: residenceAddress?.city || "",
|
||||||
street: residenceAddress?.street || "",
|
street: residenceAddress?.street || "",
|
||||||
house_number: residenceAddress?.house_number || "",
|
house: residenceAddress?.house || "",
|
||||||
apartment_number: residenceAddress?.apartment_number || "",
|
flat: residenceAddress?.flat || "",
|
||||||
id: residenceAddress?.id || "",
|
category: "Адрес проживания",
|
||||||
},
|
},
|
||||||
insuranceDMS: {
|
insuranceDMS: {
|
||||||
series: DMS?.series,
|
series: DMS?.series,
|
||||||
@@ -429,6 +429,11 @@ const getters = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
postAddress(context, { id, address }) {
|
||||||
|
fetchWrapper.post(`address/${id}`, {
|
||||||
|
...address,
|
||||||
|
});
|
||||||
|
},
|
||||||
deleteItemData({ commit }, props) {
|
deleteItemData({ commit }, props) {
|
||||||
commit("setDataWithouDeleted", props);
|
commit("setDataWithouDeleted", props);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user