fix: refs #8197 redirection
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-03 10:46:43 +01:00
parent cd44a443c2
commit 9a631a61f9
3 changed files with 14 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import VnSearchbar from 'components/ui/VnSearchbar.vue';
import VnTableFilter from '../VnTable/VnTableFilter.vue'; import VnTableFilter from '../VnTable/VnTableFilter.vue';
import { onBeforeMount, computed } from 'vue'; import { onBeforeMount, computed } from 'vue';
import { useArrayData } from 'src/composables/useArrayData'; import { useArrayData } from 'src/composables/useArrayData';
import { useRoute } from 'vue-router';
const $props = defineProps({ const $props = defineProps({
section: { section: {
@ -40,8 +41,17 @@ const $props = defineProps({
}, },
}); });
const sectionValue = computed(() => $props.section ?? $props.dataKey); const route = useRoute();
let arrayData; let arrayData;
const sectionValue = computed(() => $props.section ?? $props.dataKey);
const isMainSection = computed(() => {
const isSame = sectionValue.value == route.name;
if (!isSame && arrayData) {
arrayData.reset(['userParams', 'userFilter']);
}
return isSame;
});
onBeforeMount(() => { onBeforeMount(() => {
if ($props.dataKey) if ($props.dataKey)
arrayData = useArrayData($props.dataKey, { arrayData = useArrayData($props.dataKey, {
@ -74,6 +84,6 @@ onBeforeMount(() => {
</slot> </slot>
</template> </template>
</RightMenu> </RightMenu>
<slot name="body" v-if="sectionValue == $route.name" /> <slot name="body" v-if="isMainSection" />
<RouterView v-else /> <RouterView v-else />
</template> </template>

View File

@ -126,6 +126,7 @@ async function search() {
delete filter.params.search; delete filter.params.search;
} }
await arrayData.applyFilter(filter); await arrayData.applyFilter(filter);
searchText.value = undefined;
} }
</script> </script>
<template> <template>

View File

@ -221,7 +221,7 @@ async function handleConfirm() {
</span> </span>
</div> </div>
</div> </div>
<FetchedTags :item="props.row.item" /> <FetchedTags :item="props.row.item" :columns="3" />
</QTd> </QTd>
<QTd key="quantity" :props="props"> <QTd key="quantity" :props="props">
{{ props.row.quantity }} {{ props.row.quantity }}