优化构架

This commit is contained in:
2026-08-03 18:52:30 +08:00
parent 35c713a7ca
commit fed46f42ef
59 changed files with 691 additions and 325 deletions
+26 -19
View File
@@ -232,7 +232,7 @@ import {
type ClientNavigationGroup,
type ClientNavigationLeaf,
type ClientNavigationNode,
} from '../clientNavigation.ts'
} from '../tree.ts'
declare const icon: Component
@@ -286,32 +286,39 @@ void parentLeaf
})
test('keeps the dashboard route permission synchronized with navigation', () => {
const routerSource = readFileSync(new URL('../router/index.ts', import.meta.url), 'utf8')
const dashboardRoute = routerSource.match(/\{ path: '', name: 'dashboard'.*?\}/)?.[0]
const routerSource = readFileSync(new URL('../modules/dashboard/routes.ts', import.meta.url), 'utf8')
const dashboardRoute = routerSource.match(/path: ''[\s\S]*?navigation: \{ key: 'dashboard'[\s\S]*?\}/)?.[0]
assert.ok(dashboardRoute)
assert.match(dashboardRoute, /permission: 'dashboard:view'/)
})
test('registers every prototype-only view through its corresponding business directory', () => {
const routerSource = readFileSync(new URL('../router/index.ts', import.meta.url), 'utf8')
test('keeps every prototype view cataloged with permission metadata but unreleased', () => {
const routerSource = [
'first-leg',
'cross-border',
'overseas-warehouse',
'order-management',
'finance',
].map((moduleName) => readFileSync(new URL(`../modules/${moduleName}/routes.ts`, import.meta.url), 'utf8')).join('\n')
const routes = [
['first-leg/import', 'first-leg/BatchImportView.vue'],
['first-leg/quick-order', 'first-leg/QuickOrderView.vue'],
['cross-border/procurement', 'cross-border/ProcurementView.vue'],
['cross-border/domestic-trucking', 'cross-border/DomesticTruckingView.vue'],
['cross-border/pallet-shipping', 'cross-border/PalletShippingView.vue'],
['overseas-warehouse/labeling', 'overseas-warehouse/LabelingView.vue'],
['overseas-warehouse/return-inbound', 'overseas-warehouse/ReturnInboundView.vue'],
['overseas-warehouse/return-relabel', 'overseas-warehouse/ReturnRelabelView.vue'],
['overseas-warehouse/return-outbound', 'overseas-warehouse/ReturnOutboundView.vue'],
['orders/my', 'order-management/MyOrdersView.vue'],
['orders/inbound', 'order-management/InboundOrdersView.vue'],
['orders/delivery', 'order-management/DeliveryOrdersView.vue'],
['finance/payables', 'finance/PayableBillsView.vue'],
['first-leg/import', 'BatchImportView.vue'],
['first-leg/quick-order', 'QuickOrderView.vue'],
['cross-border/procurement', 'ProcurementView.vue'],
['cross-border/domestic-trucking', 'DomesticTruckingView.vue'],
['cross-border/pallet-shipping', 'PalletShippingView.vue'],
['overseas-warehouse/labeling', 'LabelingView.vue'],
['overseas-warehouse/return-inbound', 'ReturnInboundView.vue'],
['overseas-warehouse/return-relabel', 'ReturnRelabelView.vue'],
['overseas-warehouse/return-outbound', 'ReturnOutboundView.vue'],
['orders/my', 'MyOrdersView.vue'],
['orders/inbound', 'InboundOrdersView.vue'],
['orders/delivery', 'DeliveryOrdersView.vue'],
['finance/payables', 'PayableBillsView.vue'],
]
for (const [path, view] of routes) {
assert.match(routerSource, new RegExp(`path: '${path}'.*?@/views/${view.replace('.', '\\.')}`))
assert.match(routerSource, new RegExp(`path: '${path}'[\\s\\S]*?\\./views/${view.replace('.', '\\.')}[\\s\\S]*?release: 'prototype'[\\s\\S]*?permission:`))
assert.equal(getNavigationLeaves(clientNavigation).some((item) => item.path === `/${path}`), false)
}
})