forked from verdnatura/salix-front
feat: refs #6891 add redirection on VnfilterPanel
This commit is contained in:
parent
b487ff4adc
commit
15b080f7bd
|
@ -8,6 +8,7 @@ import useCardSize from 'src/composables/useCardSize';
|
||||||
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
import VnSubToolbar from '../ui/VnSubToolbar.vue';
|
||||||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||||
import LeftMenu from 'components/LeftMenu.vue';
|
import LeftMenu from 'components/LeftMenu.vue';
|
||||||
|
import RightMenu from 'components/common/RightMenu.vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
dataKey: { type: String, required: true },
|
dataKey: { type: String, required: true },
|
||||||
|
@ -15,6 +16,7 @@ const props = defineProps({
|
||||||
customUrl: { type: String, default: undefined },
|
customUrl: { type: String, default: undefined },
|
||||||
filter: { type: Object, default: () => {} },
|
filter: { type: Object, default: () => {} },
|
||||||
descriptor: { type: Object, required: true },
|
descriptor: { type: Object, required: true },
|
||||||
|
filterPanel: { type: Object, default: undefined },
|
||||||
searchbarDataKey: { type: String, default: undefined },
|
searchbarDataKey: { type: String, default: undefined },
|
||||||
searchbarUrl: { type: String, default: undefined },
|
searchbarUrl: { type: String, default: undefined },
|
||||||
searchbarLabel: { type: String, default: '' },
|
searchbarLabel: { type: String, default: '' },
|
||||||
|
@ -49,10 +51,8 @@ if (props.baseUrl) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<Teleport
|
<template v-if="stateStore.isHeaderMounted()">
|
||||||
to="#searchbar"
|
<Teleport to="#searchbar" v-if="props.searchbarDataKey">
|
||||||
v-if="stateStore.isHeaderMounted() && props.searchbarDataKey"
|
|
||||||
>
|
|
||||||
<VnSearchbar
|
<VnSearchbar
|
||||||
:data-key="props.searchbarDataKey"
|
:data-key="props.searchbarDataKey"
|
||||||
:url="props.searchbarUrl"
|
:url="props.searchbarUrl"
|
||||||
|
@ -67,6 +67,16 @@ if (props.baseUrl) {
|
||||||
<LeftMenu source="card" />
|
<LeftMenu source="card" />
|
||||||
</QScrollArea>
|
</QScrollArea>
|
||||||
</QDrawer>
|
</QDrawer>
|
||||||
|
<RightMenu>
|
||||||
|
<template #right-panel>
|
||||||
|
<component
|
||||||
|
v-if="props.filterPanel"
|
||||||
|
:is="props.filterPanel"
|
||||||
|
:data-key="props.searchbarDataKey"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</RightMenu>
|
||||||
|
</template>
|
||||||
<QPageContainer>
|
<QPageContainer>
|
||||||
<QPage>
|
<QPage>
|
||||||
<VnSubToolbar />
|
<VnSubToolbar />
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import toDate from 'filters/toDate';
|
import toDate from 'filters/toDate';
|
||||||
|
import useRedirect from 'src/composables/useRedirect';
|
||||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
@ -56,6 +56,7 @@ const arrayData = useArrayData(props.dataKey, {
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const userParams = ref({});
|
const userParams = ref({});
|
||||||
|
const { navigate } = useRedirect();
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
|
if (props.params) userParams.value = JSON.parse(JSON.stringify(props.params));
|
||||||
|
@ -92,6 +93,7 @@ async function search() {
|
||||||
|
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
emit('search');
|
emit('search');
|
||||||
|
navigate(store.data, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function reload() {
|
async function reload() {
|
||||||
|
@ -102,6 +104,7 @@ async function reload() {
|
||||||
if (!props.showAll && !params.length) store.data = [];
|
if (!props.showAll && !params.length) store.data = [];
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
emit('refresh');
|
emit('refresh');
|
||||||
|
navigate(store.data, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearFilters() {
|
async function clearFilters() {
|
||||||
|
|
Loading…
Reference in New Issue