dfb75dd0ff
- 路由 task-center/board(menuKey admin_task_center)+ guides 文案,both 由既有门禁守 - api 层 5 个只读接口;详情接口把后端 data:null 归一为 null(unwrap 对 null data 回传信封) - 页签一:5 项汇总卡 + 设备卡条(点击按设备筛选/再点取消)+ 10 列任务表(stuck/网页/失败角标、进度条)+ 详情抽屉(分组明细) - 页签二:变体采集专列(不显示设备与店铺),展示麦象 res_mes 与任务参数 - 30s 轮询:页面隐藏跳过、回前台立即刷新、卸载清理;另有手动刷新 - 顺带补 admin_device_logs 缺失的 guide(79b5d403 登记路由时漏补,align-operation-guide 一直红) Tests run: 1634, Failures: 0(node --test 全量)+ vue-tsc 无错误 + vite build 通过, 浏览器真跑:页签切换、设备卡筛选、详情抽屉均正常,控制台无报错
68 lines
5.0 KiB
TypeScript
68 lines
5.0 KiB
TypeScript
import type { RouteRecordRaw } from 'vue-router'
|
|
|
|
export interface AdminPageMeta {
|
|
title: string
|
|
menuKey?: string
|
|
}
|
|
|
|
export interface AdminPageDef extends AdminPageMeta {
|
|
/** 相对 /admin-vue/ 基准的子路径,不带前导斜杠、不带 base 前缀。 */
|
|
path: string
|
|
/** 异步组件加载器(页面按路由分包)。 */
|
|
load: () => Promise<{ default: unknown }>
|
|
}
|
|
|
|
/** 业务域路由注册表(任务 8):首批 account 域;后续按业务域在此登记页面。 */
|
|
export const adminPages: AdminPageDef[] = [
|
|
{ path: 'account/users', menuKey: 'admin_users', title: '用户管理', load: () => import('@/pages/account/UsersPage.vue') },
|
|
{ path: 'account/menus', menuKey: 'admin_columns', title: '菜单管理', load: () => import('@/pages/account/MenusPage.vue') },
|
|
{ path: 'account/groups', menuKey: 'admin_group_manage', title: '数据权限分组', load: () => import('@/pages/account/GroupsPage.vue') },
|
|
{ path: 'account/user-secrets', menuKey: 'admin_user_secrets', title: '密钥管理', load: () => import('@/pages/account/UserSecretsPage.vue') },
|
|
{ path: 'account/user-secret-usage', menuKey: 'admin_user_secret_usage', title: '密钥用量统计', load: () => import('@/pages/account/UserSecretUsagePage.vue') },
|
|
{ path: 'shop-center/duplicate-check', menuKey: 'admin_shop_data_duplicate_check', title: '店铺撞款监控', load: () => import('@/pages/tasks/DuplicateCheckPage.vue') },
|
|
{ path: 'shop-center/keys', menuKey: 'admin_shop_keys', title: '店铺密钥管理', load: () => import('@/pages/shop/ShopKeysPage.vue') },
|
|
{ path: 'shop-center/shops', menuKey: 'admin_shop_manage', title: '店铺管理', load: () => import('@/pages/shop/ShopManagePage.vue') },
|
|
{ path: 'records/history', menuKey: 'admin_history', title: '生成记录', load: () => import('@/pages/records/RecordsHistoryPage.vue') },
|
|
{ path: 'records/software-version', menuKey: 'admin_version', title: '软件版本管理', load: () => import('@/pages/records/RecordsSoftwareVersionPage.vue') },
|
|
{ path: 'records/tutorial', menuKey: 'admin_tutorial', title: '教程管理', load: () => import('@/pages/records/RecordsTutorialPage.vue') },
|
|
{ path: 'records/device-logs', menuKey: 'admin_device_logs', title: '日志管理', load: () => import('@/pages/records/DeviceLogsPage.vue') },
|
|
{ path: 'task-center/board', menuKey: 'admin_task_center', title: '客户端任务管理', load: () => import('@/pages/task-center/TaskCenterBoardPage.vue') },
|
|
{ path: 'records/digital-human-version', menuKey: 'digital_human_version', title: '数字人版本管理', load: () => import('@/pages/records/RecordsDigitalHumanVersionPage.vue') },
|
|
{ path: 'records/image-video-tasks', menuKey: 'admin_image_video_tasks', title: '视频任务记录', load: () => import('@/pages/tasks/ImageVideoTasksPage.vue') },
|
|
{ path: 'shop-center/data-tasks', menuKey: 'admin_shop_data_crawl_tasks', title: '店铺数据记录', load: () => import('@/pages/tasks/ShopDataTasksPage.vue') },
|
|
{ path: 'asin-center/registry', menuKey: 'admin_dedupe_total_data', title: '数据去重总数据', load: () => import('@/pages/asin/DedupeRegistryPage.vue') },
|
|
{ path: 'asin-center/invalid', menuKey: 'admin_invalid_asin_data', title: '不符合ASIN数据', load: () => import('@/pages/asin/AsinInvalidPage.vue') },
|
|
{ path: 'asin-center/query', menuKey: 'admin_query_asin', title: '查询ASIN', load: () => import('@/pages/asin/QueryAsinPage.vue') },
|
|
{ path: 'asin-center/categories', menuKey: 'admin_product_categories', title: '商品类目', load: () => import('@/pages/asin/ProductCategoryPage.vue') },
|
|
{ path: 'asin-center/skip-price', menuKey: 'admin_skip_price_asin', title: '最低价ASIN', load: () => import('@/pages/asin/SkipPricePage.vue') },
|
|
]
|
|
|
|
export function routeOf(page: AdminPageDef): RouteRecordRaw {
|
|
if (!page.path || !page.load || !page.title) {
|
|
throw new Error(`路由注册表页面定义非法,需 path/load/title 齐全: ${JSON.stringify(page)}`)
|
|
}
|
|
const meta: Record<string, string> = { title: page.title }
|
|
if (page.menuKey) meta.menuKey = page.menuKey
|
|
return { path: page.path, component: page.load, meta }
|
|
}
|
|
|
|
export const adminRouteRecords: RouteRecordRaw[] = adminPages.map(routeOf)
|
|
|
|
/** 校验注册表完整性:路径唯一、title/load 齐全、路径为相对子路径。返回问题清单。 */
|
|
export function validateAdminPages(pages: AdminPageDef[]): string[] {
|
|
const issues: string[] = []
|
|
const seen = new Set<string>()
|
|
for (const page of pages) {
|
|
if (!page.path || page.path.startsWith('/')) {
|
|
issues.push(`页面路径必须是相对子路径(不带 / 与 base 前缀): ${page.path || '(空)'}`)
|
|
} else if (seen.has(page.path)) {
|
|
issues.push(`页面路径重复: ${page.path}`)
|
|
}
|
|
seen.add(page.path)
|
|
if (!page.title) issues.push(`页面缺少标题: ${page.path}`)
|
|
if (!page.load) issues.push(`页面缺少异步加载器: ${page.path}`)
|
|
if (page.path.includes('/admin-vue')) issues.push(`页面路径不得包含 base 前缀: ${page.path}`)
|
|
}
|
|
return issues
|
|
}
|