admin_new/src/router/index.ts
Sisyphus 4b77d67dc2 fix(F006-W17.3.7): list 页统一规范 (:borderless + :page-sizes) + product/shop redirect
- 33 个 ListView.vue 加 :borderless=true + :page-sizes=[10,20,50,100]
  覆盖: order/inquiry/finance/operateguide/sys/Dept|Menu|File|Notice|
        Params|User|Role|Post|DictType|DictData|Product|Schedule|RoleGroup
        user/Enterprise|enterpriselevel|enterprisescore|enterpriserating
        supplier/promoter|couponscope|historylog|logistics|ordercomment|Activity
        other/goodunit|label|textconfig
        api/feedback|help|lunbo
        openapi/AuditLog|CompanyAccount
- OrderListView: columns 抽到 script setup (computed) + :borderless +
  :page-sizes + sub 动态显示选中数
- router/index.ts: /product/shop → redirect /supplier/good
  (删 src/modules/product/shop/ShopListView.vue 旧占位, 后端 404 无意义)
- 沿用 W17 设计规范 v2 (PageHeader+SearchBar+DataTable+ListTabs)
2026-07-07 16:54:37 +08:00

297 lines
16 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
/**
* 路由结构
* - /login 公开
* - / + /dashboard 实际页面
* - /inquiry 询价列表
* - /inquiry/:id 询价详情
* - /:module/:action 通配占位
* - /:pathMatch(.*)* 兜底跳首页
*
* W5.x.x+4: 50 个 P3 路由统一改用 MockTableView + configKey
* - 字段定义 / mock 数据集中在 mockTableConfigs.ts
* - 端点可用时自动透传真数据, 不可用时降级 mock
* - 一个 view 组件 50 路由复用
*/
const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: () => import('@/modules/auth/LoginView.vue'),
meta: { title: '登录', public: true }
},
// W3.x C P0.1: 数据统计首页
{
path: '/',
name: 'Statistics',
component: () => import('@/modules/statistics/StatisticsView.vue'),
meta: { title: '数据统计', icon: 'DataAnalysis' }
},
{
path: '/dashboard',
redirect: '/'
},
{
path: '/statistics/index',
name: 'StatisticsIndex',
component: () => import('@/modules/statistics/StatisticsView.vue'),
meta: { title: '数据统计', icon: 'DataAnalysis' }
},
{
path: '/inquiry',
name: 'InquiryList',
component: () => import('@/modules/inquiry/InquiryListView.vue'),
meta: { title: '询价管理' }
},
{
path: '/inquiry/:id',
name: 'InquiryDetail',
component: () => import('@/modules/inquiry/InquiryDetailView.vue'),
meta: { title: '询价详情' }
},
{ path: '/order/group-supplier', redirect: '/order/groupsupplierorder' },
{ path: '/order/group-service', redirect: '/order/groupserviceorder' },
{
path: '/supplier/inquiry/inquiry',
redirect: '/inquiry'
},
{
path: '/supplier/inquiry',
redirect: '/inquiry'
},
{
path: '/user/user',
name: 'UserUserList',
component: () => import('@/modules/user/UserListView.vue'),
meta: { title: '用户列表' }
},
// W3.2 订单管理
{
path: '/order',
name: 'OrderList',
component: () => import('@/modules/order/OrderListView.vue'),
meta: { title: '订单管理' }
},
{
path: '/order/:id',
name: 'OrderDetail',
component: () => import('@/modules/order/OrderDetailView.vue'),
meta: { title: '订单详情' }
},
// W4.19 业务模块
{
path: '/user/enterprise',
name: 'UserEnterpriseList',
component: () => import('@/modules/user/EnterpriseListView.vue'),
meta: { title: '企业管理' }
},
{
path: '/user/finance',
name: 'UserFinanceList',
component: () => import('@/modules/user/FinanceListView.vue'),
meta: { title: '财务管理' }
},
{
path: '/supplier/activity',
name: 'SupplierActivityList',
component: () => import('@/modules/supplier/ActivityListView.vue'),
meta: { title: '营销活动' }
},
// W4.1 集成管理
{
path: '/openapi/app',
name: 'OpenAppList',
component: () => import('@/modules/openapi/OpenAppListView.vue'),
meta: { title: '应用列表' }
},
{
path: '/openapi/company',
name: 'OpenCompanyAccount',
component: () => import('@/modules/openapi/CompanyAccountListView.vue'),
meta: { title: '公司账号管理' }
},
{
path: '/openapi/audit-log',
name: 'OpenAuditLog',
component: () => import('@/modules/openapi/AuditLogListView.vue'),
meta: { title: '审计日志' }
},
// W3.x C P0.5+ 真实接入: 数据统计/资讯/帮助/操作指南/区域/单位/商品/店铺
{
path: '/other/operateguide',
name: 'OtherOperateguide',
component: () => import('@/modules/other/operateguide/OperateguideListView.vue'),
meta: { title: '操作指南' }
},
{
path: '/api/lunbo',
name: 'ApiLunbo',
component: () => import('@/modules/api/lunbo/LunboListView.vue'),
meta: { title: '轮播管理' }
},
{
path: '/api/help',
name: 'ApiHelp',
component: () => import('@/modules/api/help/HelpListView.vue'),
meta: { title: '帮助中心' }
},
{
path: '/api/feedback',
name: 'ApiFeedback',
component: () => import('@/modules/api/feedback/FeedbackListView.vue'),
meta: { title: '意见反馈' }
},
{
path: '/other/goodunit',
name: 'OtherGoodunit',
component: () => import('@/modules/other/goodunit/GoodunitListView.vue'),
meta: { title: '商品单位' }
},
{
path: '/other/label',
name: 'OtherLabel',
component: () => import('@/modules/other/label/LabelListView.vue'),
meta: { title: '标签管理' }
},
{
path: '/sys/region',
name: 'SysRegion',
component: () => import('@/modules/sys/region/RegionListView.vue'),
meta: { title: '行政区域' }
},
{
path: '/supplier/good',
name: 'SupplierGood',
component: () => import('@/modules/supplier/good/GoodListView.vue'),
meta: { title: '商品管理' }
},
{
path: '/supplier/servicegood',
component: () => import('@/modules/supplier/servicegood/ServiceGoodListView.vue'),
meta: { title: '服务商品' }
},
{
// W3.x C P2 + W17.3.7: 商品店铺后端未实现, redirect 到 supplier/good 实物商品页
path: '/product/shop',
redirect: '/supplier/good'
},
{
path: '/message/feedback',
redirect: '/api/feedback'
},
{
path: '/other/category',
redirect: '/other/category/good'
},
{
path: '/other/categoryGood',
redirect: '/other/category/good'
},
// ============ W5.x.x+4: 50 个 P3 路由 - MockTableView 集中配置 ============
// 4 个 message
{ path: '/message/sms', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'message-sms' }), meta: { title: '短信配置' } },
{ path: '/message/sms-log', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'message-sms-log' }), meta: { title: '短信日志' } },
{ path: '/message/mail-template', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'message-mail-template' }), meta: { title: '邮件模板' } },
{ path: '/message/mail-log', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'message-mail-log' }), meta: { title: '邮件日志' } },
// 4 个运营中心
{ path: '/sys/operation', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-operation-country' }), meta: { title: '全国运营中心' } },
{ path: '/sys/operation/province', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-operation-province' }), meta: { title: '省级运营中心' } },
{ path: '/sys/operation/county', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-operation-county' }), meta: { title: '县级运营中心' } },
{ path: '/sys/operation/association', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-operation-association' }), meta: { title: '行业协会运营' } },
// 3 个资讯类
{ path: '/other/information', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-information' }), meta: { title: '资讯列表' } },
{ path: '/other/industry', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-industry' }), meta: { title: '行业' } },
{ path: '/other/category/zx', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-category-zx' }), meta: { title: '资讯分类' } },
// devtools 5 个
{ path: '/devtools/baseclass', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'devtools-baseclass' }), meta: { title: '基类配置' } },
{ path: '/devtools/datasource', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'devtools-datasource' }), meta: { title: '数据源配置' } },
{ path: '/devtools/fieldtype', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'devtools-fieldtype' }), meta: { title: '字段配置' } },
{ path: '/devtools/param', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'devtools-param' }), meta: { title: '参数配置(开发)' } },
{ path: '/devtools/template', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'devtools-template' }), meta: { title: '模板配置' } },
// job 1 个
{ path: '/job/schedule', component: () => import('@/modules/sys/ScheduleListView.vue'), meta: { title: '定时任务' } },
// order 9 个
{ path: '/order/ordergood', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '商品订单' } },
{ path: '/order/serviceorder', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '服务订单' } },
{ path: '/order/groupsupplierorder', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '商品拼团订单' } },
{ path: '/order/groupserviceorder', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '服务拼团订单' } },
{ path: '/order/ordergood/commission', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '实物订单分佣统计' } },
{ path: '/order/serviceorder/commission', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '服务订单分佣统计' } },
{ path: '/order/ordergood/after', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '商品售后订单' } },
{ path: '/order/orderserviceafter', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '服务售后订单' } },
{ path: '/order/base-price-analysis', component: () => import('@/modules/order/OrderListView.vue'), meta: { title: '基础价格分析表' } },
// W15 新增 - 订单售后 + 退款 + 付款回调 (前端 max-effort mock, 老 vue 同字段)
{ path: '/order/orderpay', component: () => import('@/modules/order/payment/PaymentCallbackListView.vue'), meta: { title: '订单支付回调' } },
{ path: '/order/refund', component: () => import('@/modules/order/refund/RefundProcessListView.vue'), meta: { title: '订单退款管理' } },
{ path: '/order/aftersale', component: () => import('@/modules/order/aftersale/AftersaleListView.vue'), meta: { title: '售后订单' } },
// other 7 个
{ path: '/other/brand', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-brand' }), meta: { title: '品牌管理' } },
{ path: '/other/category/good', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-category-good' }), meta: { title: '平台分类' } },
{ path: '/other/help', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-help' }), meta: { title: '帮助中心' } },
{ path: '/other/guide', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-guide' }), meta: { title: '内容列表' } },
{ path: '/other/textconfig', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-textconfig' }), meta: { title: '常量配置' } },
{ path: '/other/groupbuy', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-groupbuy' }), meta: { title: '拼团活动' } },
{ path: '/other/seckill', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'other-seckill' }), meta: { title: '秒杀活动' } },
// supplier 2 个
{ path: '/supplier/coupon', component: () => import('@/modules/supplier/coupon/CouponListView.vue'), meta: { title: '优惠券' } }, // W7: 独立 view, 走 /supplier/coupon/page 真 API
{ path: '/supplier/promoter', component: () => import('@/modules/supplier/promoter/PromoterListView.vue'), meta: { title: '推广员管理' } },
{ path: '/supplier/historylog', component: () => import('@/modules/supplier/historylog/HistorylogListView.vue'), meta: { title: '浏览足迹' } },
{ path: '/supplier/ordercomment', component: () => import('@/modules/supplier/ordercomment/OrderCommentListView.vue'), meta: { title: '订单评价' } },
{ path: '/supplier/logistics', component: () => import('@/modules/supplier/logistics/LogisticsListView.vue'), meta: { title: '物流方案' } },
{ path: '/supplier/coupon-scope', component: () => import('@/modules/supplier/couponscope/CouponScopeListView.vue'), meta: { title: '优惠券适用范围' } },
// sys 11 个
{ path: '/sys/dict', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-dict' }), meta: { title: '字典类型' } },
{ path: '/sys/log/login', component: () => import('@/modules/sys/LogLoginView.vue'), meta: { title: '登录日志' } },
{ path: '/sys/log/operation', component: () => import('@/modules/sys/LogOperationView.vue'), meta: { title: '操作日志' } },
{ path: '/sys/log/error', component: () => import('@/modules/sys/LogErrorView.vue'), meta: { title: '异常日志' } },
{ path: '/sys/notice', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-notice' }), meta: { title: '通知公告' } },
{ path: '/sys/params', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-params' }), meta: { title: '参数配置' } },
{ path: '/sys/notice-user', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-notice-user' }), meta: { title: '用户通知' } },
{ path: '/sys/userManagement', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'sys-userManagement' }), meta: { title: '全国运营中心' } },
// user 9 个
{ path: '/user/enterprise/level', component: () => import('@/modules/user/enterpriselevel/EnterpriselevelListView.vue'), meta: { title: '企业等级管理' } },
{ path: '/user/enterprise/rating', component: () => import('@/modules/user/enterpriserating/EnterpriseratingListView.vue'), meta: { title: '供应商评级' } },
{ path: '/user/enterprise/score', component: () => import('@/modules/user/enterprisescore/EnterprisescoreListView.vue'), meta: { title: '供应商评分' } },
{ path: '/user/finance/recharge', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-finance-recharge', queryParams: { type: 1 } }), meta: { title: '充值管理' } },
{ path: '/user/finance/recharge-tx', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-finance-recharge-tx', queryParams: { type: 2 } }), meta: { title: '提现管理' } },
{ path: '/user/finance/revenue', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-finance-revenue', queryParams: { type: 3 } }), meta: { title: '分账记录管理' } },
{ path: '/user/finance/transaction', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-finance-transaction' }), meta: { title: '交易流水' } },
{ path: '/user/message', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-message' }), meta: { title: '系统消息' } },
{ path: '/user/message/handel', component: () => import('@/modules/generic/MockTableView.vue'), props: () => ({ configKey: 'user-message-handel' }), meta: { title: '待处理消息' } },
// W3.1 通用通配占位
{
path: '/:module/:action?',
name: 'Placeholder',
component: () => import('@/modules/placeholder/PlaceholderView.vue'),
meta: { title: '即将上线' }
},
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
redirect: '/'
}
]
const router = createRouter({
history: createWebHistory('/admin/'),
routes
})
// 路由守卫
router.beforeEach((to, from, next) => {
const isPublic = to.meta?.public === true
const token = localStorage.getItem('access_token')
if (!isPublic && !token) {
next({ name: 'Login', query: { redirect: to.fullPath } })
} else {
next()
}
})
export default router