fix: remove params when searching by id on VnSearchbar
gitea/salix-front/pipeline/pr-master This commit looks good
Details
gitea/salix-front/pipeline/pr-master This commit looks good
Details
This commit is contained in:
parent
608f881eab
commit
2ee4f0e65c
|
@ -63,6 +63,10 @@ const props = defineProps({
|
|||
type: Function,
|
||||
default: undefined,
|
||||
},
|
||||
searchRemoveParams: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
});
|
||||
|
||||
const searchText = ref();
|
||||
|
@ -101,12 +105,18 @@ async function search() {
|
|||
|
||||
const filter = {
|
||||
params: {
|
||||
...Object.fromEntries(staticParams),
|
||||
search: searchText.value,
|
||||
},
|
||||
...{ filter: props.filter },
|
||||
filter: props.filter,
|
||||
};
|
||||
|
||||
if (!props.searchRemoveParams || !searchText.value) {
|
||||
filter.params = {
|
||||
...Object.fromEntries(staticParams),
|
||||
search: searchText.value,
|
||||
};
|
||||
}
|
||||
|
||||
if (props.whereFilter) {
|
||||
filter.filter = {
|
||||
where: props.whereFilter(searchText.value),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script setup>
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { onMounted, onUnmounted, ref, computed, watch, provide, nextTick } from 'vue';
|
||||
import { onMounted, onUnmounted, ref, computed, watch, provide } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
|
@ -101,6 +101,7 @@ provide('onItemSaved', onItemSaved);
|
|||
url="Orders/CatalogFilter"
|
||||
:label="t('Search items')"
|
||||
:info="t('You can search items by name or id')"
|
||||
:search-remove-params="false"
|
||||
/>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
|
|
|
@ -163,7 +163,13 @@ onUnmounted(() => {
|
|||
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
||||
</template>
|
||||
</VnInput>
|
||||
<VnSearchbar v-if="!showSearchBar" :data-key="datakey" :url="url" :redirect="false" />
|
||||
<VnSearchbar
|
||||
v-if="!showSearchBar"
|
||||
:data-key="datakey"
|
||||
:url="url"
|
||||
:redirect="false"
|
||||
:search-remove-params="false"
|
||||
/>
|
||||
<QTree
|
||||
ref="treeRef"
|
||||
:nodes="nodes"
|
||||
|
|
Loading…
Reference in New Issue