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,
|
type: Function,
|
||||||
default: undefined,
|
default: undefined,
|
||||||
},
|
},
|
||||||
|
searchRemoveParams: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const searchText = ref();
|
const searchText = ref();
|
||||||
|
@ -101,12 +105,18 @@ async function search() {
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
params: {
|
params: {
|
||||||
...Object.fromEntries(staticParams),
|
|
||||||
search: searchText.value,
|
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) {
|
if (props.whereFilter) {
|
||||||
filter.filter = {
|
filter.filter = {
|
||||||
where: props.whereFilter(searchText.value),
|
where: props.whereFilter(searchText.value),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useStateStore } from 'stores/useStateStore';
|
import { useStateStore } from 'stores/useStateStore';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
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 axios from 'axios';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
|
@ -101,6 +101,7 @@ provide('onItemSaved', onItemSaved);
|
||||||
url="Orders/CatalogFilter"
|
url="Orders/CatalogFilter"
|
||||||
:label="t('Search items')"
|
:label="t('Search items')"
|
||||||
:info="t('You can search items by name or id')"
|
: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>
|
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||||
<QScrollArea class="fit text-grey-8">
|
<QScrollArea class="fit text-grey-8">
|
||||||
|
|
|
@ -163,7 +163,13 @@ onUnmounted(() => {
|
||||||
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
<QBtn color="primary" icon="search" dense flat @click="reFetch()" />
|
||||||
</template>
|
</template>
|
||||||
</VnInput>
|
</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
|
<QTree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
:nodes="nodes"
|
:nodes="nodes"
|
||||||
|
|
Loading…
Reference in New Issue