优化构架

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
@@ -1,5 +1,5 @@
<script setup lang="ts">
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
import PrototypeFeatureView from '@/components/common/PrototypeFeatureView.vue'
</script>
<template><PrototypeFeatureView title="一键导入" description="批量导入头程订单" /></template>
@@ -3,15 +3,15 @@ import { readFileSync } from 'node:fs'
import test from 'node:test'
const source = readFileSync(new URL('./FirstLegOrdersView.vue', import.meta.url), 'utf8')
const routerSource = readFileSync(new URL('../router/index.ts', import.meta.url), 'utf8')
const editorShellSource = readFileSync(new URL('../components/first-leg/FirstLegOrderEditorShell.vue', import.meta.url), 'utf8')
const routerSource = readFileSync(new URL('../routes.ts', import.meta.url), 'utf8')
const editorShellSource = readFileSync(new URL('../components/FirstLegOrderEditorShell.vue', import.meta.url), 'utf8')
test('routes the confirmed first-leg path to the implemented order view', () => {
assert.match(routerSource, /path: 'orders\/first-leg'.*FirstLegOrdersView\.vue/)
assert.match(routerSource, /path: 'orders\/first-leg'[\s\S]*?component: \(\) => import\('\.\/views\/FirstLegOrdersView\.vue'\)[\s\S]*?release: 'active'/)
})
test('opens order creation as a dedicated protected page while keeping draft editing in a drawer', () => {
assert.match(routerSource, /path: 'orders\/first-leg\/create'.*name: 'first-leg-order-create'.*permission: 'order:first-leg:create'/)
assert.match(routerSource, /path: 'orders\/first-leg\/create'[\s\S]*?name: 'first-leg-order-create'[\s\S]*?release: 'active'[\s\S]*?permission: 'order:first-leg:create'/)
assert.match(source, /router\.push\(\{ name: 'first-leg-order-create' \}\)/)
assert.match(source, /const isCreatePage = computed\(\(\) => route\.name === 'first-leg-order-create'\)/)
assert.match(source, /<FirstLegOrderEditorShell[^>]*:page="isCreatePage"/)
@@ -6,13 +6,13 @@ import { AlertTriangle, Box, Eye, FilePlus2, MapPin, PackageCheck, Pencil, Plus,
import { FIRST_LEG_ORDER_STATUSES, FIRST_LEG_TRANSPORT_MODES, type FirstLegOrderStatus } from '@chongchong/shared'
import QueryToolbar, { type QueryField, type QueryModel } from '@/components/common/QueryToolbar.vue'
import DataTable, { type DataTableColumn } from '@/components/common/DataTable.vue'
import FirstLegOrderEditorShell from '@/components/first-leg/FirstLegOrderEditorShell.vue'
import { useFirstLegOrdersStore } from '@/stores/firstLegOrders'
import { useTenantAdministrationStore } from '@/stores/tenantAdministration'
import { useAuthStore } from '@/stores/auth'
import { createFirstLegPartySnapshot, type FirstLegPartyRole } from '@/data/firstLegParties'
import { firstLegPartySource } from '@/data/firstLegPartySource'
import type { FirstLegOrder, FirstLegOrderDraft } from '@/types/firstLegOrder'
import FirstLegOrderEditorShell from '@/modules/first-leg/components/FirstLegOrderEditorShell.vue'
import { useFirstLegOrdersStore } from '@/modules/first-leg/store/firstLegOrders'
import { useTenantAdministrationStore } from '@/modules/tenant-management/public'
import { useAuthStore } from '@/modules/auth/public'
import { createFirstLegPartySnapshot, type FirstLegPartyRole } from '@/modules/first-leg/data/firstLegParties'
import { firstLegPartySource } from '@/modules/first-leg/data/firstLegPartySource'
import type { FirstLegOrder, FirstLegOrderDraft } from '@/modules/first-leg/types/firstLegOrder'
import {
canClientEditFirstLegOrder,
createEmptyCargoItem,
@@ -21,7 +21,7 @@ import {
getFirstLegTransportModeLabel,
summarizeFirstLegCargo,
validateFirstLegOrderDraft,
} from '@/utils/firstLegOrder'
} from '@/modules/first-leg/utils/firstLegOrder'
const store = useFirstLegOrdersStore()
const tenantStore = useTenantAdministrationStore()
@@ -1,5 +1,5 @@
<script setup lang="ts">
import PrototypeFeatureView from '@/views/prototype/PrototypeFeatureView.vue'
import PrototypeFeatureView from '@/components/common/PrototypeFeatureView.vue'
</script>
<template><PrototypeFeatureView title="快速下单" description="快速创建头程订单" /></template>