feat: refs #8322 fix route.js and unify with /roadmap
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-27 08:16:29 +01:00
parent f7e0fbf728
commit 6a9bbd93e8
8 changed files with 81 additions and 107 deletions

View File

@ -18,22 +18,6 @@ const props = defineProps({
const emit = defineEmits(['search']);
const supplierList = ref([]);
const exprBuilder = (param, value) => {
switch (param) {
case 'tractorPlate':
case 'trailerPlate':
case 'driverName':
case 'phone':
return { [param]: { like: `%${value}%` } };
case 'supplierFk':
case 'price':
return { [param]: value };
case 'from':
return { etd: { gte: value } };
case 'to':
return { etd: { lte: value } };
}
};
</script>
<template>
@ -48,7 +32,6 @@ const exprBuilder = (param, value) => {
<VnFilterPanel
:data-key="props.dataKey"
:search-button="true"
:expr-builder="exprBuilder"
@search="emit('search')"
>
<template #tags="{ tag, formatFn }">

View File

@ -16,6 +16,7 @@ import VnConfirm from 'components/ui/VnConfirm.vue';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInputTime from 'src/components/common/VnInputTime.vue';
import VnSection from 'src/components/common/VnSection.vue';
import RoadmapFilter from './Roadmap/RoadmapFilter.vue';
const { viewSummary } = useSummaryDialog();
const { t } = useI18n();
@ -130,6 +131,25 @@ function confirmRemove() {
})
.onOk(() => tableRef.value++);
}
function exprBuilder(param, value) {
switch (param) {
case 'search':
return /^\d+$/.test(value) ? { id: value } : { name: { like: `%${value}%` } };
case 'tractorPlate':
case 'trailerPlate':
case 'driverName':
case 'phone':
return { [param]: { like: `%${value}%` } };
case 'supplierFk':
case 'price':
return { [param]: value };
case 'from':
return { etd: { gte: value } };
case 'to':
return { etd: { lte: value } };
}
}
</script>
<template>
@ -175,19 +195,23 @@ function confirmRemove() {
</template>
</VnSubToolbar>
<VnSection
:data-key="dataKey"
:data-key
:columns="columns"
prefix="route.roadmap"
:array-data-props="{
url: 'roadmaps',
exprBuilder,
}"
>
<template #advanced-menu>
<RoadmapFilter :dataKey />
</template>
<template #body>
<VnTable
ref="tableRef"
:data-key="dataKey"
:data-key
:columns="columns"
:right-search="true"
:right-search="false"
:use-model="true"
default-mode="table"
v-model:selected="selectedRows"

View File

@ -12,7 +12,6 @@ import Supplier from './supplier';
import Travel from './travel';
import Order from './order';
import Entry from './entry';
import roadmap from './roadmap';
import Zone from './zone';
import Account from './account';
import Monitor from './monitor';
@ -32,7 +31,6 @@ export default [
Order,
invoiceIn,
Entry,
roadmap,
Zone,
Account,
Monitor,

View File

@ -1,79 +0,0 @@
import { RouterView } from 'vue-router';
const roadmapCard = {
path: ':id',
name: 'RoadmapCard',
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
redirect: { name: 'RoadmapSummary' },
meta: {
menu: ['RoadmapBasicData', 'RoadmapStops'],
},
children: [
{
name: 'RoadmapSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'open_in_new',
},
component: () => import('pages/Route/Roadmap/RoadmapSummary.vue'),
},
{
name: 'RoadmapBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Route/Roadmap/RoadmapBasicData.vue'),
},
{
name: 'RoadmapStops',
path: 'stops',
meta: {
title: 'stops',
icon: 'vn:lines',
},
component: () => import('pages/Route/Roadmap/RoadmapStops.vue'),
},
],
};
export default {
path: '/route/roadmap',
name: 'Roadmap',
meta: {
title: 'roadmap',
icon: 'vn:troncales',
moduleName: 'Roadmap',
},
component: RouterView,
redirect: { name: 'RoadmapMain' },
children: [
{
name: 'RoadmapMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'RoadmapIndexMain' },
children: [
{
name: 'RoadmapIndexMain',
path: '',
redirect: { name: 'RoadmapList' },
component: () => import('src/pages/Route/RouteRoadmap.vue'),
children: [
{
name: 'RoadmapList',
path: 'list',
meta: {
title: 'roadmapList',
icon: 'view_list',
},
},
roadmapCard,
],
},
],
},
],
};

View File

@ -121,6 +121,45 @@ const agencyCard = {
],
};
const roadmapCard = {
path: ':id',
name: 'RoadmapCard',
component: () => import('src/pages/Route/Roadmap/RoadmapCard.vue'),
redirect: { name: 'RoadmapSummary' },
meta: {
menu: ['RoadmapBasicData', 'RoadmapStops'],
},
children: [
{
name: 'RoadmapSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'open_in_new',
},
component: () => import('pages/Route/Roadmap/RoadmapSummary.vue'),
},
{
name: 'RoadmapBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('pages/Route/Roadmap/RoadmapBasicData.vue'),
},
{
name: 'RoadmapStops',
path: 'stops',
meta: {
title: 'stops',
icon: 'vn:lines',
},
component: () => import('pages/Route/Roadmap/RoadmapStops.vue'),
},
],
};
export default {
name: 'Route',
path: '/route',
@ -193,11 +232,23 @@ export default {
{
path: 'roadmap',
name: 'RouteRoadmap',
redirect: { name: 'RoadmapList' },
meta: {
title: 'RouteRoadmap',
icon: 'vn:troncales',
},
component: () => import('src/pages/Route/RouteRoadmap.vue'),
children: [
{
name: 'RoadmapList',
path: 'list',
meta: {
title: 'list',
icon: 'view_list',
},
},
roadmapCard,
],
},
{
path: 'cmr',
@ -210,7 +261,7 @@ export default {
},
{
path: 'agency',
name: 'AgencyMain',
name: 'RouteAgency',
redirect: { name: 'AgencyList' },
meta: {
title: 'agency',

View File

@ -12,7 +12,6 @@ import travel from './modules/travel';
import shelving from 'src/router/modules/shelving';
import order from 'src/router/modules/order';
import entry from 'src/router/modules/entry';
import roadmap from 'src/router/modules/roadmap';
import zone from 'src/router/modules/zone';
import account from './modules/account';
import monitor from 'src/router/modules/monitor';
@ -81,7 +80,6 @@ const routes = [
route,
supplier,
travel,
roadmap,
entry,
zone,
account,

View File

@ -2,7 +2,7 @@ describe('AgencyWorkCenter', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/agency/11/workCenter`);
cy.visit(`/#/route/agency/11/workCenter`);
});
const createButton = '.q-page-sticky > div > .q-btn > .q-btn__content > .q-icon';
const workCenterCombobox = 'input[role="combobox"]';

View File

@ -1,12 +1,11 @@
describe('RoadMap', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/route/roadmap`);
});
it('Route list create roadmap and redirect', () => {
cy.addBtnClick();
cy.get('input[name="name"]').eq(1).type('roadMapTestOne{enter}');
cy.get('input[name="name"]').type('roadMapTestOne{enter}');
cy.get('.q-notification__message').should('have.text', 'Data created');
cy.url().should('include', '/summary');
});