refactor: refs #8322 set department inside worker
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2025-01-07 13:00:00 +01:00
parent e7f2d6ae7f
commit 245530b542
7 changed files with 55 additions and 78 deletions

View File

@ -40,7 +40,7 @@ onMounted(async () => {
<template #body="{ entity: department }"> <template #body="{ entity: department }">
<QCard class="column"> <QCard class="column">
<VnTitle <VnTitle
:url="`#/department/department/${entityId}/basic-data`" :url="`#/worker/department/${entityId}/basic-data`"
:text="t('Basic data')" :text="t('Basic data')"
/> />
<div class="full-width row wrap justify-between content-between"> <div class="full-width row wrap justify-between content-between">

View File

@ -1,11 +1,16 @@
<script setup> <script setup>
import VnSection from 'src/components/common/VnSection.vue';
import WorkerDepartmentTree from './WorkerDepartmentTree.vue'; import WorkerDepartmentTree from './WorkerDepartmentTree.vue';
</script> </script>
<template> <template>
<QPage class="column items-center q-pa-md"> <VnSection data-key="WorkerDepartment">
<WorkerDepartmentTree /> <template #body>
</QPage> <div class="flex flex-center q-pa-md">
<WorkerDepartmentTree />
</div>
</template>
</VnSection>
</template> </template>
<i18n> <i18n>

View File

@ -111,18 +111,16 @@ function handleEvent(type, event, node) {
switch (type) { switch (type) {
case 'path': case 'path':
state.set('TreeState', lastId); state.set('TreeState', lastId);
node.id && router.push({ path: `/department/department/${node.id}/summary` }); node.id && router.push({ path: `/worker/department/${node.id}/summary` });
break; break;
case 'tab': case 'tab':
state.set('TreeState', lastId); state.set('TreeState', lastId);
node.id && node.id && window.open(`#/worker/department/${node.id}/summary`, '_blank');
window.open(`#/department/department/${node.id}/summary`, '_blank');
break; break;
default: default:
node.id && node.id && router.push({ path: `#/worker/department/${node.id}/summary` });
router.push({ path: `#/department/department/${node.id}/summary` });
break; break;
} }
} }

View File

@ -1,55 +0,0 @@
import { RouterView } from 'vue-router';
const departmentCard = {
name: 'DepartmentCard',
path: ':id',
component: () => import('src/pages/Department/Card/DepartmentCard.vue'),
redirect: { name: 'DepartmentSummary' },
meta: {
menu: [
'DepartmentBasicData',
]
},
children: [
{
path: 'summary',
name: 'DepartmentSummary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Department/Card/DepartmentSummary.vue'),
},
{
path: 'basic-data',
name: 'DepartmentBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Department/Card/DepartmentBasicData.vue'),
},
],
};
export default {
name: 'Department',
path: '/worker/department',
meta: {
title: 'department',
icon: 'vn:greuge',
moduleName: 'Department',
menu: [],
},
component: RouterView,
redirect: { name: 'DepartmentMain' },
children: [
{
name: 'DepartmentMain',
path: '',
component: () => import('src/components/common/VnModule.vue'),
redirect: { name: 'DepartmentIndexMain' },
children: [departmentCard],
},
],
};

View File

@ -11,7 +11,6 @@ import Route from './route';
import Supplier from './supplier'; import Supplier from './supplier';
import Travel from './travel'; import Travel from './travel';
import Order from './order'; import Order from './order';
import Department from './department';
import Entry from './entry'; import Entry from './entry';
import roadmap from './roadmap'; import roadmap from './roadmap';
import Parking from './parking'; import Parking from './parking';
@ -35,7 +34,6 @@ export default [
Travel, Travel,
Order, Order,
invoiceIn, invoiceIn,
Department,
Entry, Entry,
roadmap, roadmap,
Parking, Parking,

View File

@ -62,8 +62,7 @@ const workerCard = {
title: 'notes', title: 'notes',
icon: 'vn:notes', icon: 'vn:notes',
}, },
component: () => component: () => import('src/pages/Worker/Card/WorkerNotes.vue'),
import('src/pages/Worker/Card/WorkerNotes.vue'),
}, },
], ],
}, },
@ -74,8 +73,7 @@ const workerCard = {
title: 'timeControl', title: 'timeControl',
icon: 'access_time', icon: 'access_time',
}, },
component: () => component: () => import('src/pages/Worker/Card/WorkerTimeControl.vue'),
import('src/pages/Worker/Card/WorkerTimeControl.vue'),
}, },
{ {
name: 'WorkerCalendar', name: 'WorkerCalendar',
@ -190,6 +188,36 @@ const workerCard = {
], ],
}; };
const departmentCard = {
name: 'DepartmentCard',
path: ':id',
component: () => import('src/pages/Department/Card/DepartmentCard.vue'),
redirect: { name: 'DepartmentSummary' },
meta: {
menu: ['DepartmentBasicData'],
},
children: [
{
path: 'summary',
name: 'DepartmentSummary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () => import('src/pages/Department/Card/DepartmentSummary.vue'),
},
{
path: 'basic-data',
name: 'DepartmentBasicData',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () => import('src/pages/Department/Card/DepartmentBasicData.vue'),
},
],
};
export default { export default {
name: 'Worker', name: 'Worker',
path: '/worker', path: '/worker',
@ -224,16 +252,21 @@ export default {
}, },
}, },
workerCard, workerCard,
] ],
}, },
{ {
path: 'department', path: 'department',
name: 'WorkerDepartment', name: 'Department',
meta: { redirect: { name: 'WorkerDepartment' },
title: 'department',
icon: 'vn:greuge',
},
component: () => import('src/pages/Worker/WorkerDepartment.vue'), component: () => import('src/pages/Worker/WorkerDepartment.vue'),
children: [
{
name: 'WorkerDepartment',
path: 'list',
meta: { title: 'department', icon: 'vn:greuge' },
},
departmentCard,
],
}, },
{ {
path: 'create', path: 'create',

View File

@ -9,7 +9,6 @@ import invoiceIn from './modules/invoiceIn';
import wagon from './modules/wagon'; import wagon from './modules/wagon';
import supplier from './modules/supplier'; import supplier from './modules/supplier';
import travel from './modules/travel'; import travel from './modules/travel';
import department from './modules/department';
import ItemType from './modules/itemType'; import ItemType from './modules/itemType';
import shelving from 'src/router/modules/shelving'; import shelving from 'src/router/modules/shelving';
import order from 'src/router/modules/order'; import order from 'src/router/modules/order';
@ -85,7 +84,6 @@ const routes = [
route, route,
supplier, supplier,
travel, travel,
department,
roadmap, roadmap,
entry, entry,
parking, parking,