Merge branch 'ASTRA-46' into 'master'

[WIP] Добавил автоматический поиск категорий льгот при вводе трех символов,...

See merge request andrusyakka/urban-couscous!331
This commit is contained in:
Vasiliy Gavrilin
2023-04-24 09:40:56 +00:00
4 changed files with 78 additions and 30 deletions

View File

@@ -5,7 +5,9 @@
base-input( base-input(
placeholder="Поиск", placeholder="Поиск",
@keyup.enter="searchCategory", @keyup.enter="searchCategory",
@input="searchCategory",
v-model="searchBenefit", v-model="searchBenefit",
debounce="100",
outlined, outlined,
:width="300", :width="300",
iconLeft iconLeft
@@ -31,13 +33,13 @@
.buttons-group.flex.py-4.px-8.justify-center .buttons-group.flex.py-4.px-8.justify-center
base-button.text-base.font-semibold(outlined, :size="40", @click="closeModalCategories") Отменить base-button.text-base.font-semibold(outlined, :size="40", @click="closeModalCategories") Отменить
base-button.text-base.font-semibold( base-button.text-base.font-semibold(
v-if="selected.length > 0", v-if="selected[0]?.id",
:size="40", :size="40",
@click="saveCategories(selected[0])" @click="saveCategories(selected[0])"
) Сохранить ) Сохранить
.right-side.flex.px-14.font-bold.relative .right-side.flex.px-14.font-bold.relative
q-icon(name="app:icon-cancel").text-sm.absolute.top-4.right-4.cursor-pointer(@click="closeModalCategories") q-icon(name="app:icon-cancel").text-sm.absolute.top-4.right-4.cursor-pointer(@click="closeModalCategories")
.flex.py-10.gap-y-6.flex-col(v-if="selected.length > 0 && selected[0]?.name !== 'Без льготы'") .flex.py-10.gap-y-6.flex-col(v-if="selected[0]?.id && selected[0]?.name !== 'Без льготы'")
.flex.text-6xl {{selected[0]?.name}} .flex.text-6xl {{selected[0]?.name}}
.flex.text-xm.flex-col.gap-y-3 Критерии: .flex.text-xm.flex-col.gap-y-3 Критерии:
.flex.flex-col.gap-y-2 .flex.flex-col.gap-y-2
@@ -69,6 +71,7 @@ export default {
closeModalCategories: Function, closeModalCategories: Function,
saveCategories: Function, saveCategories: Function,
showModal: Boolean, showModal: Boolean,
basic: Object,
}, },
data() { data() {
return { return {
@@ -103,7 +106,28 @@ export default {
showModal: { showModal: {
immediate: true, immediate: true,
handler(newVal) { handler(newVal) {
if (!newVal) this.searchBenefit = ""; if (!newVal) {
this.searchBenefit = "";
} else {
this.selected.push(
this.benefitData.find((e) => e.name === "Без льготы")
);
}
},
},
benefitData: {
immediate: true,
deep: true,
handler() {
if (this.benefitData && this.showModal && !this.basic.id) {
this.selected.push(
this.benefitData.find((e) => e.name === "Без льготы")
);
} else if (this.basic.id) {
this.selected.push(
this.benefitData.find((e) => e.id === this.basic.id)
);
}
}, },
}, },
}, },

View File

@@ -24,6 +24,7 @@
:square="square", :square="square",
:standout="standout" :standout="standout"
:accept="accept", :accept="accept",
:debounce="debounce",
hide-bottom-space hide-bottom-space
) )
template(v-slot:prepend, v-if="iconLeft") template(v-slot:prepend, v-if="iconLeft")
@@ -75,6 +76,7 @@ export default {
default: "", default: "",
}, },
mask: String, mask: String,
debounce: [String, Number],
width: Number, width: Number,
maxLength: Number, maxLength: Number,
textColor: String, textColor: String,

View File

@@ -18,11 +18,18 @@
) )
.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 === 'avatar'") .avatar-field.flex.gap-3.items-center.h-10.w-10(v-if="field.type === 'avatar'")
.flex.w-10.h-10(v-if="basic[insurance.insuranceKey][field.key]?.photo") .flex.w-10.h-10.relative(v-if="basic[insurance.insuranceKey][field.key]?.photo")
img.avatar.object-cover( img.avatar.object-cover(
:src="basic[insurance.insuranceKey][field.key].photo", :src="basic[insurance.insuranceKey][field.key].photo",
alt="AV" alt="AV"
) )
q-badge.delete(
floating,
v-if="isEdit",
@click="removeImage(insurance?.insuranceKey, field?.key)",
rounded
)
q-icon(name="app:icon-cancel", size="8px")
.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)"
@@ -57,6 +64,7 @@
:close-modal-categories="closeModalCategories", :close-modal-categories="closeModalCategories",
:save-categories="saveCategories", :save-categories="saveCategories",
:show-modal="showModalCategories", :show-modal="showModalCategories",
:basic="basic.benefit",
@search="filterDataBenefit" @search="filterDataBenefit"
) )
.flex.font-medium.text-smm.absolute.top-11( .flex.font-medium.text-smm.absolute.top-11(
@@ -81,7 +89,7 @@
q-icon.my-auto.text-lg.label-field.cursor-pointer( q-icon.my-auto.text-lg.label-field.cursor-pointer(
size="18px", size="18px",
name="app:icon-copy", name="app:icon-copy",
v-if="checkCopiedFields(field.key)", v-if="checkCopiedFields(field.key, basic[insurance.insuranceKey])",
@click="copyValue(basic[insurance.insuranceKey][field.key])" @click="copyValue(basic[insurance.insuranceKey][field.key])"
) )
</template> </template>
@@ -142,8 +150,16 @@ export default {
localStorage.removeItem("searchBenefit", text); localStorage.removeItem("searchBenefit", text);
} }
}, },
checkCopiedFields(key) { removeImage(docKey, field) {
return !this.isEdit && this.copiedFields.some((elem) => elem === key); this.basic[docKey][field] = {};
this.isCheckChange = true;
},
checkCopiedFields(key, item) {
return (
!this.isEdit &&
this.copiedFields.some((elem) => elem === key) &&
item[key]
);
}, },
copyValue(text) { copyValue(text) {
navigator.clipboard.writeText(text); navigator.clipboard.writeText(text);
@@ -370,4 +386,10 @@ export default {
.label-field .label-field
color: var(--font-grey-color) color: var(--font-grey-color)
.q-badge
padding: 4px
cursor: pointer
.delete
background-color: var(--btn-red-color)
</style> </style>

View File

@@ -292,29 +292,6 @@ export const baseInfoMenu = [
]; ];
export const baseInsuranceForm = [ export const baseInsuranceForm = [
{
insuranceLabel: "ДМС",
insuranceKey: "insuranceDMS",
fields: [
{
key: "series",
label: "Серия",
type: "text",
inputMask: "####",
},
{
key: "number",
label: "Номер",
type: "text",
inputMask: "####-####-####",
},
{
key: "photo",
label: "Фото ДМС",
type: "avatar",
},
],
},
{ {
insuranceLabel: "ОМС", insuranceLabel: "ОМС",
insuranceKey: "insuranceOMS", insuranceKey: "insuranceOMS",
@@ -338,6 +315,29 @@ export const baseInsuranceForm = [
}, },
], ],
}, },
{
insuranceLabel: "ДМС",
insuranceKey: "insuranceDMS",
fields: [
{
key: "series",
label: "Серия",
type: "text",
inputMask: "####",
},
{
key: "number",
label: "Номер",
type: "text",
inputMask: "####-####-####",
},
{
key: "photo",
label: "Фото ДМС",
type: "avatar",
},
],
},
{ {
insuranceLabel: "Категория льготы", insuranceLabel: "Категория льготы",
insuranceKey: "benefit", insuranceKey: "benefit",