WIP Прикрутила поиск по совпадению от 3 символов
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.wrapper-table.relative.flex.flex-col.gap-y-8.px-6.py-6.h-full.w-full
|
.wrapper-table.relative.flex.flex-col.gap-y-8.px-6.py-6.h-full.w-full
|
||||||
clients-table-hat(:is-open-actions="marked.length" :open-form="openForm")
|
clients-table-hat(
|
||||||
|
:is-open-actions="marked.length",
|
||||||
|
:open-form="openForm",
|
||||||
|
@search="filterDataClients",
|
||||||
|
@reset-search="fetchDataClients"
|
||||||
|
)
|
||||||
.flex.flex-col.h-full.gap-y-2.table-container.w-full
|
.flex.flex-col.h-full.gap-y-2.table-container.w-full
|
||||||
clients-table-header(:check="selectedCheck" :is-check="selectAll")
|
clients-table-header(:check="selectedCheck" :is-check="selectAll")
|
||||||
.flex.flex-col
|
.flex.flex-col
|
||||||
@@ -40,7 +45,6 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isOpenFormCreate: false,
|
|
||||||
selectAll: false,
|
selectAll: false,
|
||||||
marked: [],
|
marked: [],
|
||||||
dataClients: [],
|
dataClients: [],
|
||||||
@@ -50,6 +54,11 @@ export default {
|
|||||||
saveDataClients(data) {
|
saveDataClients(data) {
|
||||||
this.dataClients = data.results;
|
this.dataClients = data.results;
|
||||||
},
|
},
|
||||||
|
filterDataClients(text) {
|
||||||
|
fetchWrapper
|
||||||
|
.get(`general/person/?last_name=${text}`)
|
||||||
|
.then((data) => this.saveDataClients(data));
|
||||||
|
},
|
||||||
fetchDataClients() {
|
fetchDataClients() {
|
||||||
fetchWrapper
|
fetchWrapper
|
||||||
.get("general/person/")
|
.get("general/person/")
|
||||||
|
|||||||
@@ -2,10 +2,14 @@
|
|||||||
.flex.justify-between.w-full.h-fit
|
.flex.justify-between.w-full.h-fit
|
||||||
.flex.gap-2.w-fit.h-fit
|
.flex.gap-2.w-fit.h-fit
|
||||||
.input
|
.input
|
||||||
base-input(:with-icon="true" icon-position="left")
|
base-input(:with-icon="true", icon-position="left", v-model:value="searchClient")
|
||||||
.icon-search
|
.icon-search
|
||||||
button.filter-button.flex.items-center.justify-center.box-border(class="px-2.5")
|
button.filter-button.flex.items-center.justify-center.box-border(
|
||||||
|
class="px-2.5"
|
||||||
|
@click="searchLastName"
|
||||||
|
)
|
||||||
.icon-filter.text-xl.leading-4
|
.icon-filter.text-xl.leading-4
|
||||||
|
button.filter-button.flex.items-center.justify-center.px-10px(@click="resetLastName") Очистить
|
||||||
clients-table-header-actions(v-if="!!isOpenActions" :is-selected-one="isOpenActions===1")
|
clients-table-header-actions(v-if="!!isOpenActions" :is-selected-one="isOpenActions===1")
|
||||||
.flex.w-fit.h-fit.gap-x-2
|
.flex.w-fit.h-fit.gap-x-2
|
||||||
base-button(left-icon="icon-download" :icon-left-size="16" :size="40" :outlined="true")
|
base-button(left-icon="icon-download" :icon-left-size="16" :size="40" :outlined="true")
|
||||||
@@ -28,6 +32,21 @@ export default {
|
|||||||
openForm: Function,
|
openForm: Function,
|
||||||
isOpenActions: Number,
|
isOpenActions: Number,
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
searchClient: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
searchLastName() {
|
||||||
|
if (this.searchClient.length >= 3)
|
||||||
|
this.$emit("search", this.searchClient);
|
||||||
|
},
|
||||||
|
resetLastName() {
|
||||||
|
this.$emit("reset-search", this.searchClient);
|
||||||
|
this.searchClient = "";
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ export default {
|
|||||||
check: Function,
|
check: Function,
|
||||||
isCheck: Boolean,
|
isCheck: Boolean,
|
||||||
client: Object,
|
client: Object,
|
||||||
fetchDataClients: Function,
|
|
||||||
currentYear: Number,
|
currentYear: Number,
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
Reference in New Issue
Block a user