Merge pull request #175 from dderbentsov/UC-104

Исправил редактирование приоритета, возраста, телефона клиента
This commit is contained in:
frontgavrilin
2022-12-05 16:53:11 +03:00
committed by GitHub
3 changed files with 37 additions and 14 deletions

View File

@@ -37,7 +37,7 @@
) )
table-cell-body-priority( table-cell-body-priority(
v-if="!rowOverlay", v-if="!rowOverlay",
:value="dataClient.priority", :value="dataClient",
:choose-priority="choosePriority", :choose-priority="choosePriority",
:is-open-change="isOpenChange", :is-open-change="isOpenChange",
:width="columnBody.find(el => el.name === 'priority').width" :width="columnBody.find(el => el.name === 'priority').width"
@@ -207,11 +207,19 @@ export default {
} }
}, },
postUpdateClient() { postUpdateClient() {
fetchWrapper.post(`general/person/${this.client.id}/update/`, { let foundElement = this.prioritySettings.settings.find(
full_name: this.dataClient.fullName, (el) => el.text === this.dataClient.priority
birth_date: this.dataClient.age, );
priority: this.dataClient.priority, let data = {};
}); if (this.dataClient.age) {
data.birth_date = this.dataClient.age;
}
if (
this.dataClient.priority !== this.client.priority &&
this.dataClient.priority
) {
data.priority = foundElement.priority;
}
}, },
postContactsClient() { postContactsClient() {
let contacts = [...this.dataClient.contacts]; let contacts = [...this.dataClient.contacts];

View File

@@ -1,11 +1,20 @@
<template lang="pug"> <template lang="pug">
.flex.box-border.px-4.items-center.w-full.text-sm(:style="{ minWidth : width + 'px' }") .flex.box-border.px-4.items-center.w-full.text-sm(:style="{ minWidth : width + 'px' }")
span.text-sm(v-if="!isOpenChange") {{value.phone.username.replace(/\+7(\d{3})(\d{3})(\d{2})(\d{2})/, '+7 ($1) $2-$3-$4')}} span.text-sm(
base-input(v-if="isOpenChange" :width-input="154" v-model:value="value.phone.username" :placeholder="value.phone.username") v-if="!isOpenChange"
) {{value.phone.username.replace(/\+7(\d{3})(\d{3})(\d{2})(\d{2})/, '+7 ($1) $2-$3-$4')}}
base-input(
v-if="isOpenChange",
:width-input="154",
v-model:value="value.phone.username",
:placeholder="value.phone.username",
v-mask="'+7 (###) ###-##-##'"
)
</template> </template>
<script> <script>
import BaseInput from "@/components/base/BaseInput"; import BaseInput from "@/components/base/BaseInput";
import { mask } from "vue-the-mask";
export default { export default {
name: "TableCellBodyPhone", name: "TableCellBodyPhone",
components: { BaseInput }, components: { BaseInput },
@@ -14,5 +23,6 @@ export default {
width: Number, width: Number,
isOpenChange: Boolean, isOpenChange: Boolean,
}, },
directives: { mask },
}; };
</script> </script>

View File

@@ -1,10 +1,10 @@
<template lang="pug"> <template lang="pug">
.flex.box-border.px-4.items-center.w-full.gap-x-2(:style="{ minWidth : width + 'px' }") .flex.box-border.px-4.items-center.w-full.gap-x-2(:style="{ minWidth : width + 'px' }")
.flex.gap-x-2.items-center(v-if="!isOpenChange") .flex.gap-x-2.items-center(v-if="!isOpenChange")
.dot.w-2.h-2(:style="{ backgroundColor : settings.settings.find((el) => el.text == value).color }") .dot.w-2.h-2(:style="{ backgroundColor: prioritySettings.settings.find((el) => el.text == value.priority).color }")
span.text-sm(:style="{ color : settings.settings.find((el) => el.text == value).color }") {{value}} span.text-sm(:style="{ color: prioritySettings.settings.find((el) => el.text == value.priority).color }") {{value.priority}}
.flex.gap-x-2.text-sm(class="w-[164px]") .flex.gap-x-2.text-sm(class="w-[164px]")
base-select(v-if="isOpenChange", :items="getPriorityList", v-model="value") base-select(v-if="isOpenChange", :items="getPriorityList", v-model="value.priority")
</template> </template>
<script> <script>
@@ -12,16 +12,21 @@ import { column } from "@/pages/clients/utils/tableConfig";
import BaseSelect from "@/components/base/BaseSelect"; import BaseSelect from "@/components/base/BaseSelect";
export default { export default {
name: "TableCellBodyPriority", name: "TableCellBodyPriority",
props: ["value", "width", "isOpenChange", "choosePriority"], props: {
value: Object,
width: Number,
isOpenChange: Boolean,
choosePriority: Function,
},
components: { BaseSelect }, components: { BaseSelect },
data() { data() {
return { return {
settings: column.find((el) => el.name === "priority"), prioritySettings: column.find((el) => el.name === "priority"),
}; };
}, },
computed: { computed: {
getPriorityList() { getPriorityList() {
return this.settings.settings.map((el) => { return this.prioritySettings.settings.map((el) => {
return { label: el.text, id: el.id }; return { label: el.text, id: el.id };
}); });
}, },