WIP: #7925 remove redirect #897
|
@ -274,7 +274,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
});
|
||||
|
||||
function redirectFn(id) {
|
||||
router.push({ path: `/${$props.redirect}/${id}` });
|
||||
router.push({ path: `/${$props.redirect}/${id}/summary` });
|
||||
}
|
||||
|
||||
function stopEventPropagation(event) {
|
||||
|
@ -599,7 +599,7 @@ function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
|||
<template #item="{ row, colsMap }">
|
||||
<component
|
||||
:is="$props.redirect ? 'router-link' : 'span'"
|
||||
:to="`/${$props.redirect}/` + row.id"
|
||||
:to="`/${$props.redirect}/${row.id}/summary`"
|
||||
>
|
||||
<QCard
|
||||
bordered
|
||||
|
|
|
@ -260,11 +260,17 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
});
|
||||
const { matched: matches } = router.currentRoute.value;
|
||||
const { path } = matches.at(-1);
|
||||
const rowsNumber = store.data.length;
|
||||
|
||||
const to =
|
||||
store?.data?.length === 1
|
||||
? path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`)
|
||||
: path.replace(/:id.*/, '');
|
||||
let to;
|
||||
if (path.includes(':id') && !rowsNumber) {
|
||||
return router.push({ name: 'NotFound' });
|
||||
} else if (rowsNumber === 1) {
|
||||
to = path.replace(/\/(list|:id)|-list/, `/${store.data[0].id}`);
|
||||
if (!to.includes('summary')) to += '/summary';
|
||||
} else {
|
||||
to = path.replace(/:id.*/, '');
|
||||
}
|
||||
|
||||
if (route.path != to) {
|
||||
const pushUrl = { path: to };
|
||||
|
|
|
@ -57,7 +57,6 @@ export default {
|
|||
name: 'SupplierCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Supplier/Card/SupplierCard.vue'),
|
||||
redirect: { name: 'SupplierSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'SupplierSummary',
|
||||
|
|
|
@ -124,7 +124,6 @@ export default {
|
|||
name: 'AccountCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Account/Card/AccountCard.vue'),
|
||||
redirect: { name: 'AccountSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'AccountSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
path: '/agency/:id',
|
||||
name: 'AgencyCard',
|
||||
component: () => import('src/pages/Route/Agency/Card/AgencyCard.vue'),
|
||||
redirect: { name: 'AgencySummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'AgencySummary',
|
||||
|
|
|
@ -45,7 +45,6 @@ export default {
|
|||
name: 'ClaimCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Claim/Card/ClaimCard.vue'),
|
||||
redirect: { name: 'ClaimSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ClaimSummary',
|
||||
|
|
|
@ -98,7 +98,6 @@ export default {
|
|||
name: 'CustomerCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Customer/Card/CustomerCard.vue'),
|
||||
redirect: { name: 'CustomerSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'CustomerSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
name: 'DepartmentCard',
|
||||
path: 'department/:id',
|
||||
component: () => import('src/pages/Department/Card/DepartmentCard.vue'),
|
||||
redirect: { name: 'DepartmentSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'DepartmentSummary',
|
||||
|
|
|
@ -88,7 +88,6 @@ export default {
|
|||
name: 'EntryCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Entry/Card/EntryCard.vue'),
|
||||
redirect: { name: 'EntrySummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'EntrySummary',
|
||||
|
|
|
@ -62,7 +62,6 @@ export default {
|
|||
name: 'InvoiceInCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/InvoiceIn/Card/InvoiceInCard.vue'),
|
||||
redirect: { name: 'InvoiceInSummary' },
|
||||
beforeEnter: async (to, from, next) => {
|
||||
await setRectificative(to);
|
||||
next();
|
||||
|
|
|
@ -55,7 +55,6 @@ export default {
|
|||
name: 'InvoiceOutCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/InvoiceOut/Card/InvoiceOutCard.vue'),
|
||||
redirect: { name: 'InvoiceOutSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'InvoiceOutSummary',
|
||||
|
|
|
@ -103,7 +103,6 @@ export default {
|
|||
name: 'ItemCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Item/Card/ItemCard.vue'),
|
||||
redirect: { name: 'ItemSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ItemSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
name: 'ItemTypeCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Item/ItemType/Card/ItemTypeCard.vue'),
|
||||
redirect: { name: 'ItemTypeSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ItemTypeSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
name: 'AliasCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Account/Alias/Card/AliasCard.vue'),
|
||||
redirect: { name: 'AliasSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'AliasSummary',
|
||||
|
|
|
@ -46,7 +46,6 @@ export default {
|
|||
name: 'OrderCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Order/Card/OrderCard.vue'),
|
||||
redirect: { name: 'OrderSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'OrderSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
path: '/parking/:id',
|
||||
name: 'ParkingCard',
|
||||
component: () => import('src/pages/Parking/Card/ParkingCard.vue'),
|
||||
redirect: { name: 'ParkingSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ParkingSummary',
|
||||
|
|
|
@ -18,7 +18,6 @@ export default {
|
|||
name: 'RouteRoadmapCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
|
||||
redirect: { name: 'RoadmapSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'RoadmapSummary',
|
||||
|
|
|
@ -19,7 +19,6 @@ export default {
|
|||
name: 'RoleCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Account/Role/Card/RoleCard.vue'),
|
||||
redirect: { name: 'RoleSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'RoleSummary',
|
||||
|
|
|
@ -26,7 +26,6 @@ export default {
|
|||
path: '/route',
|
||||
name: 'RouteMain',
|
||||
component: () => import('src/components/common/VnSectionMain.vue'),
|
||||
redirect: { name: 'RouteList' },
|
||||
children: [
|
||||
{
|
||||
path: 'list',
|
||||
|
|
|
@ -60,7 +60,6 @@ export default {
|
|||
name: 'ShelvingLayout',
|
||||
path: ':id',
|
||||
component: () => import('pages/Shelving/Card/ShelvingCard.vue'),
|
||||
redirect: { name: 'ShelvingSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ShelvingSummary',
|
||||
|
|
|
@ -90,7 +90,6 @@ export default {
|
|||
name: 'TicketCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Ticket/Card/TicketCard.vue'),
|
||||
redirect: { name: 'TicketSummary' },
|
||||
children: [
|
||||
{
|
||||
path: 'summary',
|
||||
|
|
|
@ -54,7 +54,6 @@ export default {
|
|||
name: 'TravelCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Travel/Card/TravelCard.vue'),
|
||||
redirect: { name: 'TravelSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'TravelSummary',
|
||||
|
|
|
@ -70,7 +70,6 @@ export default {
|
|||
name: 'WorkerCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Worker/Card/WorkerCard.vue'),
|
||||
redirect: { name: 'WorkerSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'WorkerSummary',
|
||||
|
|
|
@ -66,7 +66,6 @@ export default {
|
|||
name: 'ZoneCard',
|
||||
path: ':id',
|
||||
component: () => import('src/pages/Zone/Card/ZoneCard.vue'),
|
||||
redirect: { name: 'ZoneSummary' },
|
||||
children: [
|
||||
{
|
||||
name: 'ZoneSummary',
|
||||
|
|
Loading…
Reference in New Issue