forked from verdnatura/salix-front
Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix-front into 6942-improveInvoceIn
This commit is contained in:
parent
c450290d3c
commit
b46760116f
|
@ -1,11 +1,9 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
|
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
|
||||||
|
|
||||||
import { useArrayData } from 'composables/useArrayData';
|
import { useArrayData } from 'composables/useArrayData';
|
||||||
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
|
|
||||||
const quasar = useQuasar();
|
const quasar = useQuasar();
|
||||||
|
|
||||||
|
@ -67,8 +65,7 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const router = useRouter();
|
const { currentRoute, push } = useRouter();
|
||||||
const route = useRoute();
|
|
||||||
const arrayData = useArrayData(props.dataKey, { ...props });
|
const arrayData = useArrayData(props.dataKey, { ...props });
|
||||||
const store = arrayData.store;
|
const store = arrayData.store;
|
||||||
const searchText = ref('');
|
const searchText = ref('');
|
||||||
|
@ -92,18 +89,20 @@ async function search() {
|
||||||
});
|
});
|
||||||
if (!props.redirect) return;
|
if (!props.redirect) return;
|
||||||
|
|
||||||
if (props.customRouteRedirectName) {
|
if (props.customRouteRedirectName)
|
||||||
router.push({
|
return push({
|
||||||
name: props.customRouteRedirectName,
|
name: props.customRouteRedirectName,
|
||||||
params: { id: searchText.value },
|
params: { id: searchText.value },
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { matched: matches } = route;
|
const { matched: matches } = currentRoute.value;
|
||||||
const { path } = matches[matches.length - 1];
|
const { path } = matches.at(-1);
|
||||||
const newRoute = path.replace(':id', searchText.value);
|
|
||||||
await router.push(newRoute);
|
let targetUrl = path.replace(':id', searchText.value);
|
||||||
|
if (path.endsWith('/list') && store.data.length === 1)
|
||||||
|
targetUrl = targetUrl.replace('/list', `/${store.data[0].id}/summary`);
|
||||||
|
|
||||||
|
await push(targetUrl);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue