0
0
Fork 0

feat: role router

This commit is contained in:
Javier Segarra 2024-05-10 18:06:40 +02:00
parent c045b0d1f4
commit 555b5a663c
7 changed files with 71 additions and 16 deletions

View File

@ -4,7 +4,6 @@ import { useRouter } from 'vue-router';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import { toDate } from 'filters/index'; import { toDate } from 'filters/index';
import VnPaginate from 'src/components/ui/VnPaginate.vue'; import VnPaginate from 'src/components/ui/VnPaginate.vue';
import AccountFilter from '../AccountFilter.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import VnUserLink from 'src/components/ui/VnUserLink.vue'; import VnUserLink from 'src/components/ui/VnUserLink.vue';
@ -14,8 +13,6 @@ import { useSummaryDialog } from 'src/composables/useSummaryDialog';
const stateStore = useStateStore(); const stateStore = useStateStore();
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const STATE_COLOR = { const STATE_COLOR = {
pending: 'warning', pending: 'warning',
managed: 'info', managed: 'info',
@ -30,24 +27,19 @@ function stateColor(code) {
function navigate(event, id) { function navigate(event, id) {
if (event.ctrlKey || event.metaKey) if (event.ctrlKey || event.metaKey)
return window.open(`${getApiUrl()}/#/account/${id}/summary`); return window.open(`${getApiUrl()}/#/account/${id}/summary`);
router.push({ path: `/account/${id}` }); router.push({ path: `/account/role/${id}` });
} }
</script> </script>
<template> <template>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<AccountFilter data-key="AccountList" /> <!-- <AccountFilter data-key="RolesList" /> -->
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPage class="column items-center q-pa-md"> <QPage class="column items-center q-pa-md">
<div class="vn-card-list"> <div class="vn-card-list">
<VnPaginate <VnPaginate data-key="RolesList" url="VnRoles" auto-load>
data-key="AccountList"
url="Accounts/filter"
:order="['priority ASC', 'created DESC']"
auto-load
>
<template #body="{ rows }"> <template #body="{ rows }">
<CardList <CardList
:id="row.id" :id="row.id"

View File

@ -0,0 +1,15 @@
<script setup>
import VnCard from 'components/common/VnCard.vue';
import RoleDescriptor from './RoleDescriptor.vue';
</script>
<template>
<VnCard
data-key="Role"
base-url="Roles"
:descriptor="RoleDescriptor"
searchbar-data-key="RoleList"
searchbar-url="Roles/filter"
searchbar-label="Search Role"
searchbar-info="You can search by Role id or customer name"
/>
</template>

View File

@ -28,7 +28,6 @@ export default {
'AccountPrivileges', 'AccountPrivileges',
'AccountLog', 'AccountLog',
], ],
departmentCard: ['BasicData'],
}, },
children: [ children: [
{ {
@ -47,14 +46,13 @@ export default {
component: () => import('src/pages/Account/AccountList.vue'), component: () => import('src/pages/Account/AccountList.vue'),
}, },
{ {
path: 'roles', path: 'role',
name: 'AccountRoles', name: 'AccountRoles',
meta: { meta: {
title: 'roles', title: 'roles',
icon: 'group', icon: 'group',
}, },
component: () => component: () => import('src/pages/Account/Role/AccountRoles.vue'),
import('src/pages/Account/AccountRole/AccountRoles.vue'),
}, },
{ {
path: 'alias', path: 'alias',

View File

@ -12,6 +12,7 @@ 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 Department from './department';
import Role from './role';
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,6 +36,7 @@ export default [
Order, Order,
invoiceIn, invoiceIn,
Department, Department,
Role,
Entry, Entry,
roadmap, roadmap,
Parking, Parking,

View File

@ -0,0 +1,47 @@
import { RouterView } from 'vue-router';
export default {
path: '/role',
name: 'Role',
meta: {
title: 'role',
icon: 'vn:greuge',
moduleName: 'Role',
},
component: RouterView,
redirect: { name: 'RoleCard' },
menus: {
main: [],
card: ['RoleBasicData'],
},
children: [
{
name: 'RoleCard',
path: ':id',
component: () => import('src/pages/Account/Role/Card/RoleCard.vue'),
redirect: { name: 'RoleSummary' },
children: [
{
name: 'RoleSummary',
path: 'summary',
meta: {
title: 'summary',
icon: 'launch',
},
component: () =>
import('src/pages/Account/Role/Card/RoleSummary.vue'),
},
{
name: 'RoleBasicData',
path: 'basic-data',
meta: {
title: 'basicData',
icon: 'vn:settings',
},
component: () =>
import('src/pages/Account/Role/Card/RoleBasicData.vue'),
},
],
},
],
};

View File

@ -23,7 +23,6 @@ export default {
'WorkerDms', 'WorkerDms',
'WorkerTimeControl', 'WorkerTimeControl',
], ],
departmentCard: ['BasicData'],
}, },
children: [ children: [
{ {

View File

@ -10,6 +10,7 @@ import supplier from './modules/Supplier';
import route from './modules/route'; import route from './modules/route';
import travel from './modules/travel'; import travel from './modules/travel';
import department from './modules/department'; import department from './modules/department';
import role from './modules/role';
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';
@ -72,6 +73,7 @@ const routes = [
supplier, supplier,
travel, travel,
department, department,
role,
roadmap, roadmap,
entry, entry,
parking, parking,