feat: 标准资源使用独立页面并优化详情布局
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 功能:配置平台总后台数据概览与统计报表路由。
|
||||
* 版本:v1.0.0
|
||||
*/
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
import type { AppRouteRecordRaw } from '../types';
|
||||
|
||||
export const dashboardRoute: AppRouteRecordRaw = {
|
||||
path: '/dashboard',
|
||||
name: 'dashboard',
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: '/dashboard/overview',
|
||||
meta: {
|
||||
title: '数据概览',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-dashboard',
|
||||
order: 0,
|
||||
menuCode: 'dashboard',
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'overview',
|
||||
name: 'dashboard-overview',
|
||||
component: () => import('@/views/dashboard/DashboardPage.vue'),
|
||||
meta: {
|
||||
title: '数据概览',
|
||||
requiresAuth: true,
|
||||
menuCode: 'dashboard_overview',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'reports',
|
||||
name: 'dashboard-reports',
|
||||
component: () => import('@/views/dashboard/ReportPage.vue'),
|
||||
meta: {
|
||||
title: '统计报表',
|
||||
requiresAuth: true,
|
||||
menuCode: 'dashboard_overview',
|
||||
hideInMenu: true,
|
||||
activeMenu: 'dashboard-overview',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* 功能:配置财务、钱包及其隐藏详情入口的资源路由。
|
||||
* 版本:v1.0.0
|
||||
*/
|
||||
import { child, group } from './resource-route-builder';
|
||||
|
||||
export const financeRoute = group(
|
||||
'finance',
|
||||
'finance',
|
||||
'财务管理',
|
||||
'icon-bar-chart',
|
||||
90,
|
||||
[
|
||||
child(
|
||||
'finance',
|
||||
'withdrawals',
|
||||
'withdrawals',
|
||||
'提现记录',
|
||||
'/wallet_apply_cash',
|
||||
'wallet_apply_cash',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'payments',
|
||||
'payments',
|
||||
'支付记录',
|
||||
'/fin_payment',
|
||||
'fin_payment',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'refunds',
|
||||
'refunds',
|
||||
'退款审核',
|
||||
'/payment_refund',
|
||||
'payment_refund',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'settlements',
|
||||
'settlements',
|
||||
'财务结算',
|
||||
'/fin_settlement',
|
||||
'fin_settlement',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'reconciliations',
|
||||
'reconciliations',
|
||||
'财务对账',
|
||||
'/fin_reconciliation',
|
||||
'fin_reconciliation',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'wallets',
|
||||
'wallets',
|
||||
'钱包',
|
||||
'/wallet_basic',
|
||||
'wallet_apply_cash',
|
||||
true,
|
||||
'finance-withdrawals',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'wallet-banks',
|
||||
'wallet-banks',
|
||||
'钱包银行卡',
|
||||
'/wallet_bank',
|
||||
'wallet_apply_cash',
|
||||
true,
|
||||
'finance-withdrawals',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'wallet-payments',
|
||||
'wallet-payments',
|
||||
'钱包支付记录',
|
||||
'/payment_order',
|
||||
'fin_payment',
|
||||
true,
|
||||
'finance-payments',
|
||||
),
|
||||
child(
|
||||
'finance',
|
||||
'wallet-records',
|
||||
'wallet-records',
|
||||
'钱包流水',
|
||||
'/wallet_record',
|
||||
'fin_payment',
|
||||
true,
|
||||
'finance-payments',
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -1,136 +1,461 @@
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
/**
|
||||
* 功能:汇总平台总后台标准资源菜单与独立记录页路由。
|
||||
* 版本:v2.0.0
|
||||
*/
|
||||
import type { AppRouteRecordRaw } from '../types';
|
||||
|
||||
const resourcePage = () => import('@/views/shared/ResourcePage.vue');
|
||||
const accountProfilePage = () => import('@/views/account/AccountProfilePage.vue');
|
||||
|
||||
function child(
|
||||
domain: string,
|
||||
path: string,
|
||||
name: string,
|
||||
title: string,
|
||||
resource: string,
|
||||
menuCode = domain,
|
||||
hidden = false,
|
||||
activeMenu?: string,
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path,
|
||||
name: `${domain}-${name}`,
|
||||
component: resourcePage,
|
||||
meta: {
|
||||
title,
|
||||
resource,
|
||||
requiresAuth: true,
|
||||
menuCode,
|
||||
hideInMenu: hidden,
|
||||
...(activeMenu ? { activeMenu } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function group(
|
||||
path: string,
|
||||
name: string,
|
||||
title: string,
|
||||
icon: string,
|
||||
order: number,
|
||||
children: AppRouteRecordRaw[],
|
||||
menuCode = name,
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path: `/${path}`,
|
||||
name,
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: `/${path}/${children[0].path}`,
|
||||
meta: { title, requiresAuth: true, icon, order, menuCode },
|
||||
children,
|
||||
};
|
||||
}
|
||||
import { dashboardRoute } from './dashboard-route';
|
||||
import { financeRoute } from './finance-route';
|
||||
import { child, group, resourceRecordPage } from './resource-route-builder';
|
||||
|
||||
const routes: AppRouteRecordRaw[] = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'dashboard',
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: '/dashboard/overview',
|
||||
meta: { title: '数据概览', requiresAuth: true, icon: 'icon-dashboard', order: 0, menuCode: 'dashboard', hideInMenu: true },
|
||||
children: [
|
||||
{ path: 'overview', name: 'dashboard-overview', component: () => import('@/views/dashboard/DashboardPage.vue'), meta: { title: '数据概览', requiresAuth: true, menuCode: 'dashboard_overview' } },
|
||||
{ path: 'reports', name: 'dashboard-reports', component: () => import('@/views/dashboard/ReportPage.vue'), meta: { title: '统计报表', requiresAuth: true, menuCode: 'dashboard_overview', hideInMenu: true, activeMenu: 'dashboard-overview' } },
|
||||
],
|
||||
},
|
||||
dashboardRoute,
|
||||
group('organization', 'organization', '机构管理', 'icon-storage', 10, [
|
||||
child('organization', 'gas-basic', 'gas-basic', '气站管理', '/gas_basic', 'gas_basic'),
|
||||
child('organization', 'delivery-basic', 'delivery-basic', '配送点管理', '/delivery_basic', 'delivery_basic'),
|
||||
child('organization', 'gas-account', 'gas-account', '气站账户', '/gas_account', 'gas_basic', true, 'organization-gas-basic'),
|
||||
child('organization', 'delivery-account', 'delivery-account', '配送点账户', '/delivery_account', 'delivery_basic', true, 'organization-delivery-basic'),
|
||||
child(
|
||||
'organization',
|
||||
'gas-basic',
|
||||
'gas-basic',
|
||||
'气站管理',
|
||||
'/gas_basic',
|
||||
'gas_basic',
|
||||
),
|
||||
child(
|
||||
'organization',
|
||||
'delivery-basic',
|
||||
'delivery-basic',
|
||||
'配送点管理',
|
||||
'/delivery_basic',
|
||||
'delivery_basic',
|
||||
),
|
||||
child(
|
||||
'organization',
|
||||
'gas-account',
|
||||
'gas-account',
|
||||
'气站账户',
|
||||
'/gas_account',
|
||||
'gas_basic',
|
||||
true,
|
||||
'organization-gas-basic',
|
||||
),
|
||||
child(
|
||||
'organization',
|
||||
'delivery-account',
|
||||
'delivery-account',
|
||||
'配送点账户',
|
||||
'/delivery_account',
|
||||
'delivery_basic',
|
||||
true,
|
||||
'organization-delivery-basic',
|
||||
),
|
||||
]),
|
||||
group('staff', 'staff', '工作人员管理', 'icon-user-group', 30, [
|
||||
{ ...child('staff', 'add', 'add', '新增工作人员', '/staff_account', 'staff_add'), meta: { title: '新增工作人员', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_add', createMode: true } },
|
||||
{ ...child('staff', 'installers', 'installers', '安装人员管理', '/staff_account', 'staff_installer'), meta: { title: '安装人员管理', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_installer', staffType: 'installer' } },
|
||||
{ ...child('staff', 'delivery', 'delivery', '配送人员管理', '/staff_account', 'staff_delivery'), meta: { title: '配送人员管理', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_delivery', staffType: 'delivery' } },
|
||||
{ ...child('staff', 'operations', 'operations', '运维人员管理', '/staff_account', 'staff_operations'), meta: { title: '运维人员管理', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_operations', staffType: 'operations' } },
|
||||
{ path: 'installers/:identity', name: 'staff-installers-profile', component: accountProfilePage, meta: { title: '工作人员资料', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_installer', staffType: 'installer', hideInMenu: true, activeMenu: 'staff-installers', listRouteName: 'staff-installers' } },
|
||||
{ path: 'delivery/:identity', name: 'staff-delivery-profile', component: accountProfilePage, meta: { title: '工作人员资料', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_delivery', staffType: 'delivery', hideInMenu: true, activeMenu: 'staff-delivery', listRouteName: 'staff-delivery' } },
|
||||
{ path: 'operations/:identity', name: 'staff-operations-profile', component: accountProfilePage, meta: { title: '工作人员资料', resource: '/staff_account', requiresAuth: true, menuCode: 'staff_operations', staffType: 'operations', hideInMenu: true, activeMenu: 'staff-operations', listRouteName: 'staff-operations' } },
|
||||
child('staff', 'credential', 'credential', '人员资质', '/staff_credential', 'staff', true, 'staff-installers'),
|
||||
{
|
||||
...child(
|
||||
'staff',
|
||||
'add',
|
||||
'add',
|
||||
'新增工作人员',
|
||||
'/staff_account',
|
||||
'staff_add',
|
||||
),
|
||||
component: resourceRecordPage,
|
||||
meta: {
|
||||
title: '新增工作人员',
|
||||
resource: '/staff_account',
|
||||
requiresAuth: true,
|
||||
menuCode: 'staff_add',
|
||||
createMode: true,
|
||||
recordMode: 'create',
|
||||
listRouteName: 'staff-installers',
|
||||
},
|
||||
},
|
||||
{
|
||||
...child(
|
||||
'staff',
|
||||
'installers',
|
||||
'installers',
|
||||
'安装人员管理',
|
||||
'/staff_account',
|
||||
'staff_installer',
|
||||
),
|
||||
meta: {
|
||||
title: '安装人员管理',
|
||||
resource: '/staff_account',
|
||||
requiresAuth: true,
|
||||
menuCode: 'staff_installer',
|
||||
staffType: 'installer',
|
||||
},
|
||||
},
|
||||
{
|
||||
...child(
|
||||
'staff',
|
||||
'delivery',
|
||||
'delivery',
|
||||
'配送人员管理',
|
||||
'/staff_account',
|
||||
'staff_delivery',
|
||||
),
|
||||
meta: {
|
||||
title: '配送人员管理',
|
||||
resource: '/staff_account',
|
||||
requiresAuth: true,
|
||||
menuCode: 'staff_delivery',
|
||||
staffType: 'delivery',
|
||||
},
|
||||
},
|
||||
{
|
||||
...child(
|
||||
'staff',
|
||||
'operations',
|
||||
'operations',
|
||||
'运维人员管理',
|
||||
'/staff_account',
|
||||
'staff_operations',
|
||||
),
|
||||
meta: {
|
||||
title: '运维人员管理',
|
||||
resource: '/staff_account',
|
||||
requiresAuth: true,
|
||||
menuCode: 'staff_operations',
|
||||
staffType: 'operations',
|
||||
},
|
||||
},
|
||||
child(
|
||||
'staff',
|
||||
'credential',
|
||||
'credential',
|
||||
'人员资质',
|
||||
'/staff_credential',
|
||||
'staff',
|
||||
true,
|
||||
'staff-installers',
|
||||
),
|
||||
]),
|
||||
group('user', 'user', '用户管理', 'icon-user', 40, [
|
||||
child('user', 'user-account', 'account', '用户账户', '/user_account', 'user_account'),
|
||||
{ path: 'user-account/:identity', name: 'user-account-profile', component: accountProfilePage, meta: { title: '用户资料', resource: '/user_account', requiresAuth: true, menuCode: 'user_account', hideInMenu: true, activeMenu: 'user-account', listRouteName: 'user-account' } },
|
||||
child('user', 'user-address', 'address', '用户地址', '/user_address', 'user_address'),
|
||||
child('user', 'service-relation', 'service-relation', '服务关系', '/user_service_relation', 'user_service_relation'),
|
||||
child('user', 'contracts', 'contracts', '合同管理', '/gasorder_contract', 'gasorder_contract'),
|
||||
child('user', 'contract-products', 'contract-products', '合同气瓶', '/gasorder_contract_product', 'gasorder_contract', true, 'user-contracts'),
|
||||
child('user', 'contract-revisions', 'contract-revisions', '合同修订记录', '/gasorder_contract_revision', 'gasorder_contract', true, 'user-contracts'),
|
||||
child(
|
||||
'user',
|
||||
'user-account',
|
||||
'account',
|
||||
'用户账户',
|
||||
'/user_account',
|
||||
'user_account',
|
||||
),
|
||||
child(
|
||||
'user',
|
||||
'user-address',
|
||||
'address',
|
||||
'用户地址',
|
||||
'/user_address',
|
||||
'user_address',
|
||||
),
|
||||
child(
|
||||
'user',
|
||||
'service-relation',
|
||||
'service-relation',
|
||||
'服务关系',
|
||||
'/user_service_relation',
|
||||
'user_service_relation',
|
||||
),
|
||||
child(
|
||||
'user',
|
||||
'contracts',
|
||||
'contracts',
|
||||
'合同管理',
|
||||
'/gasorder_contract',
|
||||
'gasorder_contract',
|
||||
),
|
||||
child(
|
||||
'user',
|
||||
'contract-products',
|
||||
'contract-products',
|
||||
'合同气瓶',
|
||||
'/gasorder_contract_product',
|
||||
'gasorder_contract',
|
||||
true,
|
||||
'user-contracts',
|
||||
),
|
||||
child(
|
||||
'user',
|
||||
'contract-revisions',
|
||||
'contract-revisions',
|
||||
'合同修订记录',
|
||||
'/gasorder_contract_revision',
|
||||
'gasorder_contract',
|
||||
true,
|
||||
'user-contracts',
|
||||
),
|
||||
]),
|
||||
group('product', 'product', '智能气阀管理', 'icon-common', 50, [
|
||||
child('product', 'producers', 'producers', '生产商管理', '/producer_account', 'producer_account'),
|
||||
child('product', 'product-type', 'type', '类型管理', '/product_type', 'product_type'),
|
||||
child('product', 'warehouse', 'warehouse', '库房管理', '/product_warehouse', 'product_warehouse'),
|
||||
child('product', 'product-info', 'info', '智能气阀管理', '/product_info', 'product_info'),
|
||||
child('product', 'repair', 'repair', '智能气阀检修记录', '/product_repair', 'product_info', true, 'product-info'),
|
||||
child('product', 'owner', 'owner', '智能气阀归属记录', '/product_owner', 'product_info', true, 'product-info'),
|
||||
], 'device'),
|
||||
group('gasorder', 'gasorder', '气体配送订单管理', 'icon-list', 60, [
|
||||
{ ...child('gasorder', 'create', 'create', '创建订单', '/gasorder_basic', 'gasorder_create'), meta: { title: '创建订单', resource: '/gasorder_basic', requiresAuth: true, menuCode: 'gasorder_create', createMode: true } },
|
||||
child('gasorder', 'orders', 'orders', '配送订单', '/gasorder_basic', 'gasorder_basic'),
|
||||
child('gasorder', 'order-items', 'order-items', '订单明细', '/gasorder_item', 'gasorder_basic', true, 'gasorder-orders'),
|
||||
child('gasorder', 'assignments', 'assignments', '分配记录', '/gasorder_assign', 'gasorder_basic', true, 'gasorder-orders'),
|
||||
child('gasorder', 'statuses', 'statuses', '状态记录', '/gasorder_status', 'gasorder_basic', true, 'gasorder-orders'),
|
||||
child('gasorder', 'tracks', 'tracks', '运行轨迹', '/gasorder_track', 'gasorder_track'),
|
||||
child('gasorder', 'track-points', 'track-points', '轨迹点', '/gasorder_track_point', 'gasorder_track', true, 'gasorder-tracks'),
|
||||
child('gasorder', 'confirms', 'confirms', '确认记录', '/gasorder_confirm', 'gasorder_basic', true, 'gasorder-orders'),
|
||||
child('gasorder', 'payments', 'payments', '订单支付记录', '/gasorder_payment', 'gasorder_basic', true, 'gasorder-orders'),
|
||||
], 'gasorder'),
|
||||
group(
|
||||
'product',
|
||||
'product',
|
||||
'智能气阀管理',
|
||||
'icon-common',
|
||||
50,
|
||||
[
|
||||
child(
|
||||
'product',
|
||||
'producers',
|
||||
'producers',
|
||||
'生产商管理',
|
||||
'/producer_account',
|
||||
'producer_account',
|
||||
),
|
||||
child(
|
||||
'product',
|
||||
'product-type',
|
||||
'type',
|
||||
'类型管理',
|
||||
'/product_type',
|
||||
'product_type',
|
||||
),
|
||||
child(
|
||||
'product',
|
||||
'warehouse',
|
||||
'warehouse',
|
||||
'库房管理',
|
||||
'/product_warehouse',
|
||||
'product_warehouse',
|
||||
),
|
||||
child(
|
||||
'product',
|
||||
'product-info',
|
||||
'info',
|
||||
'智能气阀管理',
|
||||
'/product_info',
|
||||
'product_info',
|
||||
),
|
||||
child(
|
||||
'product',
|
||||
'repair',
|
||||
'repair',
|
||||
'智能气阀检修记录',
|
||||
'/product_repair',
|
||||
'product_info',
|
||||
true,
|
||||
'product-info',
|
||||
),
|
||||
child(
|
||||
'product',
|
||||
'owner',
|
||||
'owner',
|
||||
'智能气阀归属记录',
|
||||
'/product_owner',
|
||||
'product_info',
|
||||
true,
|
||||
'product-info',
|
||||
),
|
||||
],
|
||||
'device',
|
||||
),
|
||||
group(
|
||||
'gasorder',
|
||||
'gasorder',
|
||||
'气体配送订单管理',
|
||||
'icon-list',
|
||||
60,
|
||||
[
|
||||
{
|
||||
...child(
|
||||
'gasorder',
|
||||
'create',
|
||||
'create',
|
||||
'创建订单',
|
||||
'/gasorder_basic',
|
||||
'gasorder_create',
|
||||
),
|
||||
component: resourceRecordPage,
|
||||
meta: {
|
||||
title: '创建订单',
|
||||
resource: '/gasorder_basic',
|
||||
requiresAuth: true,
|
||||
menuCode: 'gasorder_create',
|
||||
createMode: true,
|
||||
recordMode: 'create',
|
||||
listRouteName: 'gasorder-orders',
|
||||
},
|
||||
},
|
||||
child(
|
||||
'gasorder',
|
||||
'orders',
|
||||
'orders',
|
||||
'配送订单',
|
||||
'/gasorder_basic',
|
||||
'gasorder_basic',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'order-items',
|
||||
'order-items',
|
||||
'订单明细',
|
||||
'/gasorder_item',
|
||||
'gasorder_basic',
|
||||
true,
|
||||
'gasorder-orders',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'assignments',
|
||||
'assignments',
|
||||
'分配记录',
|
||||
'/gasorder_assign',
|
||||
'gasorder_basic',
|
||||
true,
|
||||
'gasorder-orders',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'statuses',
|
||||
'statuses',
|
||||
'状态记录',
|
||||
'/gasorder_status',
|
||||
'gasorder_basic',
|
||||
true,
|
||||
'gasorder-orders',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'tracks',
|
||||
'tracks',
|
||||
'运行轨迹',
|
||||
'/gasorder_track',
|
||||
'gasorder_track',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'track-points',
|
||||
'track-points',
|
||||
'轨迹点',
|
||||
'/gasorder_track_point',
|
||||
'gasorder_track',
|
||||
true,
|
||||
'gasorder-tracks',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'confirms',
|
||||
'confirms',
|
||||
'确认记录',
|
||||
'/gasorder_confirm',
|
||||
'gasorder_basic',
|
||||
true,
|
||||
'gasorder-orders',
|
||||
),
|
||||
child(
|
||||
'gasorder',
|
||||
'payments',
|
||||
'payments',
|
||||
'订单支付记录',
|
||||
'/gasorder_payment',
|
||||
'gasorder_basic',
|
||||
true,
|
||||
'gasorder-orders',
|
||||
),
|
||||
],
|
||||
'gasorder',
|
||||
),
|
||||
group('ec', 'ec', '电商平台管理', 'icon-gift', 70, [
|
||||
child('ec', 'categories', 'categories', '商品分类', '/ec_category', 'ec_category'),
|
||||
child('ec', 'products', 'products', '商品管理', '/ec_product', 'ec_product'),
|
||||
child('ec', 'attributes', 'attributes', '商品属性', '/ec_product_attribute', 'ec_product', true, 'ec-products'),
|
||||
child('ec', 'images', 'images', '商品图片', '/ec_product_image', 'ec_product', true, 'ec-products'),
|
||||
child(
|
||||
'ec',
|
||||
'categories',
|
||||
'categories',
|
||||
'商品分类',
|
||||
'/ec_category',
|
||||
'ec_category',
|
||||
),
|
||||
child(
|
||||
'ec',
|
||||
'products',
|
||||
'products',
|
||||
'商品管理',
|
||||
'/ec_product',
|
||||
'ec_product',
|
||||
),
|
||||
child(
|
||||
'ec',
|
||||
'attributes',
|
||||
'attributes',
|
||||
'商品属性',
|
||||
'/ec_product_attribute',
|
||||
'ec_product',
|
||||
true,
|
||||
'ec-products',
|
||||
),
|
||||
child(
|
||||
'ec',
|
||||
'images',
|
||||
'images',
|
||||
'商品图片',
|
||||
'/ec_product_image',
|
||||
'ec_product',
|
||||
true,
|
||||
'ec-products',
|
||||
),
|
||||
child('ec', 'carts', 'carts', '购物车', '/ec_cart', 'ec_cart'),
|
||||
child('ec', 'orders', 'orders', '商城订单', '/ec_order', 'ec_order'),
|
||||
child('ec', 'order-items', 'order-items', '订单明细', '/ec_order_item', 'ec_order', true, 'ec-orders'),
|
||||
child(
|
||||
'ec',
|
||||
'order-items',
|
||||
'order-items',
|
||||
'订单明细',
|
||||
'/ec_order_item',
|
||||
'ec_order',
|
||||
true,
|
||||
'ec-orders',
|
||||
),
|
||||
child('ec', 'reviews', 'reviews', '商品评价', '/ec_review', 'ec_review'),
|
||||
]),
|
||||
group('finance', 'finance', '财务管理', 'icon-bar-chart', 90, [
|
||||
child('finance', 'withdrawals', 'withdrawals', '提现记录', '/wallet_apply_cash', 'wallet_apply_cash'),
|
||||
child('finance', 'payments', 'payments', '支付记录', '/fin_payment', 'fin_payment'),
|
||||
child('finance', 'refunds', 'refunds', '退款审核', '/payment_refund', 'payment_refund'),
|
||||
child('finance', 'settlements', 'settlements', '财务结算', '/fin_settlement', 'fin_settlement'),
|
||||
child('finance', 'reconciliations', 'reconciliations', '财务对账', '/fin_reconciliation', 'fin_reconciliation'),
|
||||
]),
|
||||
financeRoute,
|
||||
group('content', 'content', '内容管理', 'icon-file', 100, [
|
||||
child('content', 'contents', 'contents', '内容', '/cms_content', 'cms_content'),
|
||||
]),
|
||||
group('customer-service', 'customer_service', '客服管理', 'icon-customer-service', 110, [
|
||||
child('customer_service', 'tickets', 'tickets', '客服工单', '/cs_ticket', 'cs_ticket'),
|
||||
child(
|
||||
'content',
|
||||
'contents',
|
||||
'contents',
|
||||
'内容',
|
||||
'/cms_content',
|
||||
'cms_content',
|
||||
),
|
||||
]),
|
||||
group(
|
||||
'customer-service',
|
||||
'customer_service',
|
||||
'客服管理',
|
||||
'icon-customer-service',
|
||||
110,
|
||||
[
|
||||
child(
|
||||
'customer_service',
|
||||
'tickets',
|
||||
'tickets',
|
||||
'客服工单',
|
||||
'/cs_ticket',
|
||||
'cs_ticket',
|
||||
),
|
||||
],
|
||||
),
|
||||
group('platform', 'platform', '平台管理', 'icon-settings', 120, [
|
||||
child('platform', 'accounts', 'accounts', '平台账户', '/platform_account', 'platform_account'),
|
||||
child('platform', 'roles', 'roles', '平台角色', '/platform_role', 'platform_role'),
|
||||
child('platform', 'menus', 'menus', '平台菜单', '/platform_menu', 'platform_menu'),
|
||||
child(
|
||||
'platform',
|
||||
'accounts',
|
||||
'accounts',
|
||||
'平台账户',
|
||||
'/platform_account',
|
||||
'platform_account',
|
||||
),
|
||||
child(
|
||||
'platform',
|
||||
'roles',
|
||||
'roles',
|
||||
'平台角色',
|
||||
'/platform_role',
|
||||
'platform_role',
|
||||
),
|
||||
child(
|
||||
'platform',
|
||||
'menus',
|
||||
'menus',
|
||||
'平台菜单',
|
||||
'/platform_menu',
|
||||
'platform_menu',
|
||||
),
|
||||
]),
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 功能:为平台标准资源构造列表菜单与新建、详情、编辑隐藏路由。
|
||||
* 版本:v1.0.0
|
||||
*/
|
||||
import { assertResourcePageRules } from '@/api/resource-page-rules';
|
||||
import { getResource, resources } from '@/api/resources';
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
import type { AppRouteRecordRaw } from '../types';
|
||||
|
||||
const resourcePage = () => import('@/views/shared/ResourcePage.vue');
|
||||
export const resourceRecordPage = () =>
|
||||
import('@/views/resource/ResourceRecordPage.vue');
|
||||
|
||||
assertResourcePageRules(resources);
|
||||
|
||||
export function child(
|
||||
domain: string,
|
||||
path: string,
|
||||
name: string,
|
||||
title: string,
|
||||
resource: string,
|
||||
menuCode = domain,
|
||||
hidden = false,
|
||||
activeMenu?: string,
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path,
|
||||
name: `${domain}-${name}`,
|
||||
component: resourcePage,
|
||||
meta: {
|
||||
title,
|
||||
resource,
|
||||
requiresAuth: true,
|
||||
menuCode,
|
||||
hideInMenu: hidden,
|
||||
...(activeMenu ? { activeMenu } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function group(
|
||||
path: string,
|
||||
name: string,
|
||||
title: string,
|
||||
icon: string,
|
||||
order: number,
|
||||
children: AppRouteRecordRaw[],
|
||||
menuCode = name,
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path: `/${path}`,
|
||||
name,
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: `/${path}/${children[0].path}`,
|
||||
meta: { title, requiresAuth: true, icon, order, menuCode },
|
||||
children: expandResourceChildren(children),
|
||||
};
|
||||
}
|
||||
|
||||
/** 为一个列表路由生成隐藏的新建、详情和编辑子页面。 */
|
||||
function expandResourceChildren(children: AppRouteRecordRaw[]) {
|
||||
return children.flatMap((route) => {
|
||||
const resource = String(route.meta?.resource ?? '');
|
||||
if (!resource || route.meta?.createMode) return [route];
|
||||
const definition = getResource(resource);
|
||||
if (definition.pageKind !== 'list') return [route];
|
||||
const listRouteName = String(route.name);
|
||||
const activeMenu = String(route.meta?.activeMenu ?? route.name);
|
||||
const makeRecordRoute = (
|
||||
mode: 'create' | 'detail' | 'edit',
|
||||
suffix: string,
|
||||
titlePrefix: string,
|
||||
): AppRouteRecordRaw => ({
|
||||
path: `${route.path}/${suffix}`,
|
||||
name: `${listRouteName}-${mode}`,
|
||||
component: resourceRecordPage,
|
||||
meta: {
|
||||
...route.meta,
|
||||
requiresAuth: true,
|
||||
title: `${titlePrefix}${definition.title}`,
|
||||
hideInMenu: true,
|
||||
activeMenu,
|
||||
listRouteName,
|
||||
recordMode: mode,
|
||||
},
|
||||
});
|
||||
return [
|
||||
route,
|
||||
...(definition.canCreate
|
||||
? [makeRecordRoute('create', 'new', '新建')]
|
||||
: []),
|
||||
makeRecordRoute('detail', ':identity', ''),
|
||||
...(definition.canEdit
|
||||
? [makeRecordRoute('edit', ':identity/edit', '编辑')]
|
||||
: []),
|
||||
];
|
||||
});
|
||||
}
|
||||
@@ -4,8 +4,10 @@ declare module 'vue-router' {
|
||||
interface RouteMeta {
|
||||
roles?: string[]; // Controls roles that have access to the page
|
||||
menuCode?: string; // Server-assigned menu domain required by this route
|
||||
resource?: string; // 标准资源 API 路径
|
||||
staffType?: 'installer' | 'delivery' | 'operations';
|
||||
listRouteName?: string; // 独立资料页返回的列表路由名称
|
||||
listRouteName?: string; // 独立记录页返回的列表路由名称
|
||||
recordMode?: 'create' | 'detail' | 'edit'; // 独立记录页模式
|
||||
createMode?: boolean;
|
||||
requiresAuth: boolean; // Whether login is required to access the current page (every route must declare)
|
||||
icon?: string; // The icon show in the side menu
|
||||
|
||||
Reference in New Issue
Block a user