[WIP] Добавил автоматический поиск категорий льгот при вводе трех символов, поменял местами ОМС и ДМС, добавил чек выбранной льготы

This commit is contained in:
megavrilinvv
2023-04-24 12:14:12 +03:00
parent 4a124465c9
commit 236402e01e
4 changed files with 60 additions and 29 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

@@ -57,6 +57,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 +82,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 +143,12 @@ export default {
localStorage.removeItem("searchBenefit", text); localStorage.removeItem("searchBenefit", text);
} }
}, },
checkCopiedFields(key) { checkCopiedFields(key, item) {
return !this.isEdit && this.copiedFields.some((elem) => elem === key); return (
!this.isEdit &&
this.copiedFields.some((elem) => elem === key) &&
item[key]
);
}, },
copyValue(text) { copyValue(text) {
navigator.clipboard.writeText(text); navigator.clipboard.writeText(text);

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",