feat: implement gas and delivery admin systems
This commit is contained in:
31
frontend/gas_admin/src/router/routes/base.ts
Normal file
31
frontend/gas_admin/src/router/routes/base.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { REDIRECT_ROUTE_NAME } from '@/router/constants';
|
||||
|
||||
export const DEFAULT_LAYOUT = () => import('@/layout/default-layout.vue');
|
||||
|
||||
export const REDIRECT_MAIN: RouteRecordRaw = {
|
||||
path: '/redirect',
|
||||
name: 'redirectWrapper',
|
||||
component: DEFAULT_LAYOUT,
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: '/redirect/:path',
|
||||
name: REDIRECT_ROUTE_NAME,
|
||||
component: () => import('@/views/redirect/index.vue'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const NOT_FOUND_ROUTE: RouteRecordRaw = {
|
||||
path: '/:pathMatch(.*)*',
|
||||
name: 'notFound',
|
||||
component: () => import('@/views/not-found/index.vue'),
|
||||
};
|
||||
10
frontend/gas_admin/src/router/routes/externalModules/arco.ts
Normal file
10
frontend/gas_admin/src/router/routes/externalModules/arco.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
path: 'https://arco.design',
|
||||
name: 'arcoWebsite',
|
||||
meta: {
|
||||
locale: 'menu.arcoWebsite',
|
||||
icon: 'icon-link',
|
||||
requiresAuth: true,
|
||||
order: 8,
|
||||
},
|
||||
};
|
||||
10
frontend/gas_admin/src/router/routes/externalModules/faq.ts
Normal file
10
frontend/gas_admin/src/router/routes/externalModules/faq.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export default {
|
||||
path: 'https://arco.design/vue/docs/pro/faq',
|
||||
name: 'faq',
|
||||
meta: {
|
||||
locale: 'menu.faq',
|
||||
icon: 'icon-question-circle',
|
||||
requiresAuth: true,
|
||||
order: 9,
|
||||
},
|
||||
};
|
||||
8
frontend/gas_admin/src/router/routes/index.ts
Normal file
8
frontend/gas_admin/src/router/routes/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { RouteRecordNormalized } from 'vue-router';
|
||||
import platformRoutes from './modules/platform';
|
||||
|
||||
/** 气站后台仅注册已实现的业务路由,菜单能力由后端返回。 */
|
||||
export const appRoutes: RouteRecordNormalized[] = platformRoutes as unknown as RouteRecordNormalized[];
|
||||
|
||||
/** 本期没有外部菜单。 */
|
||||
export const appExternalRoutes: RouteRecordNormalized[] = [];
|
||||
102
frontend/gas_admin/src/router/routes/modules/platform.ts
Normal file
102
frontend/gas_admin/src/router/routes/modules/platform.ts
Normal file
@@ -0,0 +1,102 @@
|
||||
import { DEFAULT_LAYOUT } from '../base';
|
||||
import type { AppRouteRecordRaw } from '../types';
|
||||
|
||||
const resourcePage = () => import('@/views/shared/ResourcePage.vue');
|
||||
|
||||
function child(
|
||||
domain: string,
|
||||
path: string,
|
||||
title: string,
|
||||
resource: string,
|
||||
menuCode: string,
|
||||
meta: Record<string, unknown> = {},
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path,
|
||||
name: `${domain}-${path}`,
|
||||
component: resourcePage,
|
||||
meta: { title, resource, requiresAuth: true, menuCode, ...meta },
|
||||
};
|
||||
}
|
||||
|
||||
function group(
|
||||
path: string,
|
||||
name: string,
|
||||
title: string,
|
||||
icon: string,
|
||||
order: number,
|
||||
children: AppRouteRecordRaw[],
|
||||
): AppRouteRecordRaw {
|
||||
return {
|
||||
path: `/${path}`,
|
||||
name,
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: `/${path}/${children[0].path}`,
|
||||
meta: { title, requiresAuth: true, icon, order, menuCode: name },
|
||||
children,
|
||||
};
|
||||
}
|
||||
|
||||
const routes: AppRouteRecordRaw[] = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'dashboard',
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: '/dashboard/overview',
|
||||
meta: { title: '数据概述', requiresAuth: true, icon: 'icon-dashboard', order: 10, menuCode: 'dashboard' },
|
||||
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_reports' } },
|
||||
],
|
||||
},
|
||||
group('delivery', 'delivery', '配送点管理', 'icon-storage', 20, [
|
||||
child('delivery', 'points', '配送点列表', '/delivery_basic', 'delivery_basic'),
|
||||
child('delivery', 'accounts', '配送点账户', '/delivery_account', 'delivery_basic', { hideInMenu: true, activeMenu: 'delivery-points' }),
|
||||
]),
|
||||
group('staff', 'staff', '工作人员管理', 'icon-user-group', 30, [
|
||||
child('staff', 'add', '新增工作人员', '/staff_account', 'staff_add', { createMode: true }),
|
||||
child('staff', 'installers', '安装人员', '/staff_account', 'staff_installer', { staffType: 'installer' }),
|
||||
child('staff', 'delivery', '配送人员', '/staff_account', 'staff_delivery', { staffType: 'delivery' }),
|
||||
child('staff', 'operations', '运维人员', '/staff_account', 'staff_operations', { staffType: 'operations' }),
|
||||
child('staff', 'credentials', '人员资质', '/staff_credential', 'staff', { hideInMenu: true, activeMenu: 'staff-installers' }),
|
||||
]),
|
||||
group('user', 'user', '用户管理', 'icon-user', 40, [
|
||||
child('user', 'accounts', '用户账户', '/user_account', 'user_account'),
|
||||
child('user', 'addresses', '用户地址', '/user_address', 'user_account', { hideInMenu: true, activeMenu: 'user-accounts' }),
|
||||
]),
|
||||
group('contract', 'contract', '合同管理', 'icon-file', 50, [
|
||||
child('contract', 'contracts', '配送合同', '/gasorder_contract', 'gasorder_contract'),
|
||||
child('contract', 'products', '合同气瓶', '/gasorder_contract_product', 'gasorder_contract', { hideInMenu: true, activeMenu: 'contract-contracts' }),
|
||||
child('contract', 'revisions', '合同修订记录', '/gasorder_contract_revision', 'gasorder_contract', { hideInMenu: true, activeMenu: 'contract-contracts' }),
|
||||
child('contract', 'products-candidates', '合同可选气瓶', '/product_info', 'gasorder_contract', { hideInMenu: true, activeMenu: 'contract-contracts' }),
|
||||
]),
|
||||
group('gasorder', 'gasorder', '燃气配送订单', 'icon-list', 60, [
|
||||
child('gasorder', 'create', '创建订单', '/gasorder_basic', 'gasorder_create', { createMode: true }),
|
||||
child('gasorder', 'orders', '配送订单', '/gasorder_basic', 'gasorder_basic'),
|
||||
]),
|
||||
group('finance', 'finance', '财务管理', 'icon-bar-chart', 70, [
|
||||
child('finance', 'wallet', '钱包', '/wallet_basic', 'wallet_basic'),
|
||||
child('finance', 'banks', '银行卡', '/wallet_bank', 'wallet_bank'),
|
||||
child('finance', 'payments', '支付记录', '/wallet_payment', 'wallet_payment'),
|
||||
child('finance', 'records', '钱包流水', '/wallet_record', 'wallet_record'),
|
||||
child('finance', 'refunds', '退款记录', '/wallet_refund', 'wallet_refund'),
|
||||
child('finance', 'withdrawals', '提现申请', '/wallet_apply_cash', 'wallet_apply_cash'),
|
||||
child('finance', 'settlements', '财务结算', '/fin_settlement', 'fin_settlement'),
|
||||
child('finance', 'reconciliations', '财务对账', '/fin_reconciliation', 'fin_reconciliation'),
|
||||
]),
|
||||
group('ticket', 'ticket', '工单管理', 'icon-customer-service', 80, [
|
||||
child('ticket', 'tickets', '客服工单', '/cs_ticket', 'cs_ticket'),
|
||||
]),
|
||||
{
|
||||
path: '/invitation',
|
||||
name: 'invitation',
|
||||
component: DEFAULT_LAYOUT,
|
||||
redirect: '/invitation/qrcode',
|
||||
meta: { title: '邀请注册', requiresAuth: true, icon: 'icon-qrcode', order: 90, menuCode: 'invitation' },
|
||||
children: [
|
||||
{ path: 'qrcode', name: 'invitation-qrcode', component: () => import('@/views/invitation/QrcodePage.vue'), meta: { title: '邀请二维码', requiresAuth: true, menuCode: 'invitation_qrcode' } },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
20
frontend/gas_admin/src/router/routes/types.ts
Normal file
20
frontend/gas_admin/src/router/routes/types.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { defineComponent } from 'vue';
|
||||
import type { NavigationGuard, RouteMeta } from 'vue-router';
|
||||
|
||||
export type Component<T = any> =
|
||||
| ReturnType<typeof defineComponent>
|
||||
| (() => Promise<typeof import('*.vue')>)
|
||||
| (() => Promise<T>);
|
||||
|
||||
export interface AppRouteRecordRaw {
|
||||
path: string;
|
||||
name?: string | symbol;
|
||||
meta?: RouteMeta;
|
||||
redirect?: string;
|
||||
component: Component | string;
|
||||
children?: AppRouteRecordRaw[];
|
||||
alias?: string | string[];
|
||||
props?: Record<string, any>;
|
||||
beforeEnter?: NavigationGuard | NavigationGuard[];
|
||||
fullPath?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user