Merge pull request #123 from dderbentsov/UC-54
Добавил сохранение адресов и паспортных данных
This commit is contained in:
@@ -49,6 +49,7 @@
|
|||||||
:style="{fontWeight:key === 'numba'&&600}",
|
:style="{fontWeight:key === 'numba'&&600}",
|
||||||
v-model:value="sectionInfo[key]",
|
v-model:value="sectionInfo[key]",
|
||||||
:width="settings[section].width"
|
:width="settings[section].width"
|
||||||
|
:sharp="settings[section].sharps[key]"
|
||||||
)
|
)
|
||||||
.copy.icon-copy.cursor-pointer(
|
.copy.icon-copy.cursor-pointer(
|
||||||
v-if="item.copy",
|
v-if="item.copy",
|
||||||
@@ -91,7 +92,9 @@ export default {
|
|||||||
section: String,
|
section: String,
|
||||||
deleteDoc: Function,
|
deleteDoc: Function,
|
||||||
updateDocument: Function,
|
updateDocument: Function,
|
||||||
|
updateAddress: Function,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
additionalData: {
|
additionalData: {
|
||||||
@@ -119,7 +122,11 @@ export default {
|
|||||||
saveChange() {
|
saveChange() {
|
||||||
this.isOpenChange = false;
|
this.isOpenChange = false;
|
||||||
this.isChange = false;
|
this.isChange = false;
|
||||||
this.updateDocument();
|
if (this.section === "pass") {
|
||||||
|
this.updateDocument();
|
||||||
|
} else if (this.section === "addresses") {
|
||||||
|
this.updateAddress();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
openAddingWrap() {
|
openAddingWrap() {
|
||||||
if (!this.isChange) {
|
if (!this.isChange) {
|
||||||
|
|||||||
@@ -3,9 +3,14 @@
|
|||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
v-model:section-info="dataDocument"
|
v-model:section-info="dataDocument"
|
||||||
section="pass"
|
section="pass"
|
||||||
|
:update-document="updateDocument"
|
||||||
)
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(:section-info="dataAddress" section="addresses")
|
client-detail-info-section(
|
||||||
|
:section-info="dataAddress"
|
||||||
|
section="addresses"
|
||||||
|
:update-address="updateAddress"
|
||||||
|
)
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
client-detail-info-section(
|
client-detail-info-section(
|
||||||
:section-info="dataAttachments"
|
:section-info="dataAttachments"
|
||||||
@@ -27,6 +32,8 @@ export default {
|
|||||||
saveNewDoc: Function,
|
saveNewDoc: Function,
|
||||||
deleteDoc: Function,
|
deleteDoc: Function,
|
||||||
dataDocument: Object,
|
dataDocument: Object,
|
||||||
|
updateDocument: Function,
|
||||||
|
updateAddress: Function,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,16 +1,25 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.input-wrapper.flex.gap-x-2.px-3.box-border.w-max-fit(class="py-2.5")
|
.input-wrapper.flex.gap-x-2.px-3.box-border.w-max-fit(class="py-2.5")
|
||||||
textarea.place-input.w-full.outline-0.text-sm.not-italic.resize-none(:rows="Math.ceil(value.length/heightInput)" :value="value" @input="$emit('update:value', $event.target.value)")
|
input.place-input.w-full.outline-0.text-sm.not-italic.resize-none(
|
||||||
|
:rows="Math.ceil(value.length/heightInput)"
|
||||||
|
:value="value"
|
||||||
|
@input="$emit('update:value', $event.target.value)"
|
||||||
|
v-mask="sharp"
|
||||||
|
)
|
||||||
slot
|
slot
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mask } from "vue-the-mask";
|
||||||
export default {
|
export default {
|
||||||
name: "ClientDetailInput",
|
name: "ClientDetailInput",
|
||||||
props: {
|
props: {
|
||||||
value: String,
|
value: String,
|
||||||
width: Number,
|
width: Number,
|
||||||
|
sharp: String,
|
||||||
},
|
},
|
||||||
|
directives: { mask },
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
heightInput() {
|
heightInput() {
|
||||||
return ((this.width / 100) * 70) / 11;
|
return ((this.width / 100) * 70) / 11;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
:data-document="dataIdentityDocument"
|
:data-document="dataIdentityDocument"
|
||||||
:save-new-doc="saveNewDoc"
|
:save-new-doc="saveNewDoc"
|
||||||
:delete-doc="deleteDoc"
|
:delete-doc="deleteDoc"
|
||||||
|
:update-document="postUpdateIdentityDocument"
|
||||||
|
:update-address="postUpdateAddress"
|
||||||
)
|
)
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -40,6 +42,7 @@ import ClientDetailInfoWrapper from "@/pages/clients/components/ClientDetailInfo
|
|||||||
import BaseButton from "@/components/base/BaseButton";
|
import BaseButton from "@/components/base/BaseButton";
|
||||||
import { fetchWrapper } from "@/shared/fetchWrapper";
|
import { fetchWrapper } from "@/shared/fetchWrapper";
|
||||||
import { column } from "@/pages/clients/utils/tableConfig";
|
import { column } from "@/pages/clients/utils/tableConfig";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ClientsTableRow",
|
name: "ClientsTableRow",
|
||||||
components: {
|
components: {
|
||||||
@@ -68,6 +71,8 @@ export default {
|
|||||||
prioritySettings: column.find((el) => el.name === "priority"),
|
prioritySettings: column.find((el) => el.name === "priority"),
|
||||||
isOpenChange: false,
|
isOpenChange: false,
|
||||||
dataClient: {},
|
dataClient: {},
|
||||||
|
docId: "",
|
||||||
|
addressId: "",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -114,6 +119,7 @@ export default {
|
|||||||
priority: this.dataClient.priority,
|
priority: this.dataClient.priority,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
postContactsClient() {
|
postContactsClient() {
|
||||||
let contacts = [...this.dataClient.contacts];
|
let contacts = [...this.dataClient.contacts];
|
||||||
if (
|
if (
|
||||||
@@ -155,7 +161,6 @@ export default {
|
|||||||
// deleteContacts.forEach((el) => this.postDeleteContact(el));
|
// deleteContacts.forEach((el) => this.postDeleteContact(el));
|
||||||
updateContacts.forEach((el) => this.postUpdateContact(el));
|
updateContacts.forEach((el) => this.postUpdateContact(el));
|
||||||
},
|
},
|
||||||
|
|
||||||
postCreateContact(contact) {
|
postCreateContact(contact) {
|
||||||
fetchWrapper.post("general/contact/create/", {
|
fetchWrapper.post("general/contact/create/", {
|
||||||
kind: contact.kind,
|
kind: contact.kind,
|
||||||
@@ -173,14 +178,7 @@ export default {
|
|||||||
postDeleteContact(contact) {
|
postDeleteContact(contact) {
|
||||||
fetchWrapper.del(`general/contact/${contact.id}/delete/`);
|
fetchWrapper.del(`general/contact/${contact.id}/delete/`);
|
||||||
},
|
},
|
||||||
postUpdateIdentityDocument() {
|
|
||||||
fetchWrapper.post(
|
|
||||||
`general/identity_document/${this.identity_document}/update/`,
|
|
||||||
{
|
|
||||||
series_number: this.dataIdentityDocument.numba,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
addNetwork(network) {
|
addNetwork(network) {
|
||||||
this.dataClient.contacts.push(network);
|
this.dataClient.contacts.push(network);
|
||||||
},
|
},
|
||||||
@@ -210,23 +208,52 @@ export default {
|
|||||||
},
|
},
|
||||||
saveClientDetail(data) {
|
saveClientDetail(data) {
|
||||||
this.saveIdentityDocument(
|
this.saveIdentityDocument(
|
||||||
data.identity_documents.find((el) => el.kind === "Паспорт")
|
data.identity_documents.find(
|
||||||
|
(el) => el.kind === "Паспорт" || el.kind === "PASSPORT"
|
||||||
|
)
|
||||||
);
|
);
|
||||||
this.saveAddress(data.address[0]);
|
this.saveAddress(data.address[0]);
|
||||||
this.saveAttachments([...data.attachments]);
|
this.saveAttachments([...data.attachments]);
|
||||||
},
|
},
|
||||||
saveIdentityDocument(data) {
|
saveIdentityDocument(data) {
|
||||||
this.dataIdentityDocument = {
|
this.dataIdentityDocument = {
|
||||||
numba: data?.numba || "",
|
numba:
|
||||||
|
data?.series && data?.numba
|
||||||
|
? data?.series + " " + data?.numba || ""
|
||||||
|
: "",
|
||||||
issued_by_org: data?.issued_by_org || "",
|
issued_by_org: data?.issued_by_org || "",
|
||||||
issued_by_org_code: data?.issued_by_org_code || "",
|
issued_by_org_code: data?.issued_by_org_code || "",
|
||||||
issued_by_date: data?.issued_by_date || "",
|
issued_by_date:
|
||||||
|
data?.issued_by_date.split("-").reverse().join(".") || "",
|
||||||
};
|
};
|
||||||
|
this.docId = data?.id;
|
||||||
|
},
|
||||||
|
postUpdateIdentityDocument() {
|
||||||
|
console.log(this.dataIdentityDocument);
|
||||||
|
fetchWrapper
|
||||||
|
.post(`general/identity_document/${this.docId}/update/`, {
|
||||||
|
series_number: this.dataIdentityDocument.numba,
|
||||||
|
issued_by_org: this.dataIdentityDocument.issued_by_org,
|
||||||
|
issued_by_org_code: this.dataIdentityDocument.issued_by_org_code,
|
||||||
|
issued_by_date: this.dataIdentityDocument.issued_by_date
|
||||||
|
.split(".")
|
||||||
|
.reverse()
|
||||||
|
.join("-"),
|
||||||
|
})
|
||||||
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
},
|
},
|
||||||
saveAddress(data) {
|
saveAddress(data) {
|
||||||
this.dataAddress = {
|
this.dataAddress = {
|
||||||
join_adress: data?.join_adress || "",
|
join_adress: data?.join_adress || "",
|
||||||
};
|
};
|
||||||
|
this.addressId = data?.id;
|
||||||
|
},
|
||||||
|
postUpdateAddress() {
|
||||||
|
fetchWrapper
|
||||||
|
.post(`general/address/${this.addressId}/update/`, {
|
||||||
|
full_address: this.dataAddress.join_adress,
|
||||||
|
})
|
||||||
|
.then(() => this.fetchClientDetail(this.id));
|
||||||
},
|
},
|
||||||
saveAttachments(data) {
|
saveAttachments(data) {
|
||||||
this.dataAttachments = [...data];
|
this.dataAttachments = [...data];
|
||||||
|
|||||||
@@ -113,6 +113,12 @@ export const detail = {
|
|||||||
issued_by_org_code: "Код подразделения",
|
issued_by_org_code: "Код подразделения",
|
||||||
issued_by_date: "Дата выдачи",
|
issued_by_date: "Дата выдачи",
|
||||||
},
|
},
|
||||||
|
sharps: {
|
||||||
|
numba: "#### ######",
|
||||||
|
issued_by_org: "XXXXXX",
|
||||||
|
issued_by_org_code: "###-###",
|
||||||
|
issued_by_date: "##.##.####",
|
||||||
|
},
|
||||||
width: 280,
|
width: 280,
|
||||||
},
|
},
|
||||||
snils: {
|
snils: {
|
||||||
|
|||||||
Reference in New Issue
Block a user