feat(admin): bind booking documents and truck containers

This commit is contained in:
2026-08-31 19:54:37 +08:00
parent 0f4f635686
commit a759eb1b6b
24 changed files with 691 additions and 179 deletions
@@ -0,0 +1,33 @@
import { describe, expect, it } from 'vitest'
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
const source = readFileSync(resolve(process.cwd(), 'src/modules/ocean-bookings/components/OceanBookingDocumentsPanel.vue'), 'utf8')
describe('OceanBookingDocumentsPanel contract', () => {
it('owns the two confirmed document types under the booking', () => {
expect(source).toContain("value: 'BOOKING_CONFIRMATION', label: '订舱确认文件'")
expect(source).toContain("value: 'BILL_OF_LADING', label: '提单文件'")
expect(source).toContain('文件统一归属当前订舱')
expect(source).not.toContain('TRUCK_APPOINTMENT_ATTACHMENT')
})
it('supports upload, replacement, logical invalidation and download with version chaining', () => {
expect(source).toContain('uploadOceanBookingDocument(props.bookingId, props.bookingVersion, type, file)')
expect(source).toContain('invalidateOceanBookingDocument(props.bookingId, item.id, version)')
expect(source).toContain('version = invalidated.bookingVersion')
expect(source).toContain('确认替换')
expect(source).toContain('确认作废')
expect(source).toContain('downloadOceanBookingDocument')
expect(source).toContain('URL.createObjectURL(blob)')
})
it('makes released booking files permanently read-only and preserves traced errors', () => {
expect(source).toContain("props.bookingStatus === 'DRAFT' && props.canManage")
expect(source).toContain('已放舱 · 永久只读')
expect(source).toContain('manageReason')
expect(source).toContain('<ApiErrorMeta :details="error" />')
expect(source).toContain('订舱资料上传失败,请稍后重试')
expect(source).toContain('订舱资料下载失败,请稍后重试')
})
})