2026-08-04 21:01:39 +08:00
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
|
|
|
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/inbounds/components/InboundWorkflowWorkspace.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
describe('InboundWorkflowWorkspace', () => {
|
|
|
|
|
it('assembles every phase-two inbound domain behind one server-backed workspace', () => {
|
|
|
|
|
expect(source).toContain('InboundSummaryPanel')
|
|
|
|
|
expect(source).toContain('InboundHistoryPanel')
|
|
|
|
|
expect(source).toContain('InboundMeasurementPanel')
|
|
|
|
|
expect(source).toContain('WeightOcrPanel')
|
|
|
|
|
expect(source).toContain('MeasurementReviewPanel')
|
|
|
|
|
expect(source).toContain('InboundFeePanel')
|
|
|
|
|
expect(source).toContain('getPlatformInbound')
|
|
|
|
|
expect(source).toContain('StatusBadge')
|
|
|
|
|
expect(source).toContain('label="基本信息"')
|
2026-08-12 16:31:46 +08:00
|
|
|
expect(source).toContain('label="货品与测量"')
|
2026-08-04 21:01:39 +08:00
|
|
|
expect(source).toContain('label="测量审核"')
|
2026-08-06 13:56:04 +08:00
|
|
|
expect(source).toContain('label="费用信息"')
|
2026-08-12 16:31:46 +08:00
|
|
|
expect(source).toContain('label="状态历史"')
|
|
|
|
|
expect(source).toContain('label="其他记录"')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('opens measurement editing and review in prototype-sized centered dialogs', () => {
|
|
|
|
|
expect(source).toContain('title="编辑入库测量数据"')
|
2026-08-13 19:00:37 +08:00
|
|
|
expect(source).toContain('width="min(1240px, calc(100vw - 32px))"')
|
2026-08-12 16:31:46 +08:00
|
|
|
expect(source).toContain('title="审核入库测量数据"')
|
2026-08-13 19:00:37 +08:00
|
|
|
expect(source).toContain('width="min(1240px, calc(100vw - 32px))"')
|
2026-08-12 16:31:46 +08:00
|
|
|
expect(source).toContain('height: 92vh')
|
|
|
|
|
expect(source).toContain('max-height: 92vh')
|
|
|
|
|
expect(source).toContain('.el-dialog__body) { min-height: 0; flex: 1 1 auto; overflow-y: auto;')
|
|
|
|
|
expect(source).toContain('@media (max-width: 720px)')
|
|
|
|
|
expect(source).toContain('@media (max-width: 360px)')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('keeps domain writes inside their existing panels and mounts them only in dialog bodies', () => {
|
|
|
|
|
expect(source).toContain('@click="measurementDialogOpen = true"')
|
|
|
|
|
expect(source).toContain('@click="reviewDialogOpen = true"')
|
|
|
|
|
expect(source).toContain(':key="`measurement-dialog-${revision}`"')
|
|
|
|
|
expect(source).toContain(':key="`review-dialog-${revision}`"')
|
|
|
|
|
expect(source).toContain('@changed="handleReviewChanged"')
|
|
|
|
|
expect(source).toContain('<template #footer>')
|
|
|
|
|
expect(source).toContain('measurementPanelRef?.saveDraft()')
|
|
|
|
|
expect(source).toContain('measurementPanelRef?.submitForReview()')
|
|
|
|
|
expect(source).toContain("reviewPanelRef?.openReasonDialog('reject')")
|
|
|
|
|
expect(source).toContain('reviewPanelRef?.confirmApprove()')
|
|
|
|
|
expect(source).toContain('inbound-operation-dialog__footer')
|
|
|
|
|
expect(source).not.toContain('approveMeasurement')
|
|
|
|
|
expect(source).not.toContain('submitInboundMeasurement')
|
2026-08-04 21:01:39 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('uses the established first-leg detail density without nested framed surfaces', () => {
|
2026-08-06 13:56:04 +08:00
|
|
|
expect(source).toContain('padding: 18px 24px 16px')
|
2026-08-04 21:01:39 +08:00
|
|
|
expect(source).toContain('border-bottom: 1px solid var(--cc-border)')
|
|
|
|
|
expect(source).not.toContain('border-radius: 10px')
|
|
|
|
|
expect(source).not.toContain('<el-tag')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('refreshes the aggregate and remounts domains after manual or child refresh', () => {
|
|
|
|
|
expect(source).toContain('function handleDomainChanged()')
|
|
|
|
|
expect(source).toContain('async function refreshWorkspace()')
|
|
|
|
|
expect(source).toContain('revision.value += 1')
|
|
|
|
|
expect(source).toContain('void refreshWorkspace()')
|
|
|
|
|
expect(source).toContain('@click="refreshWorkspace"')
|
|
|
|
|
expect(source).toContain('@changed="handleDomainChanged"')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('uses customer context in the page layer and maps it to compatible domain APIs', () => {
|
|
|
|
|
expect(source).toContain('customerId: string')
|
|
|
|
|
expect(source).toContain('getPlatformInbound(props.customerId, props.inboundId)')
|
|
|
|
|
expect(source).toContain(':tenant-id="customerId"')
|
|
|
|
|
expect(source).toContain('缺少所属企业信息')
|
|
|
|
|
expect(source).not.toContain('请选择企业')
|
|
|
|
|
expect(source).not.toContain('租户')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('does not mount the review domain without its required measurement data permission', () => {
|
|
|
|
|
expect(source).toContain("access.can('platform:firstleg:inbound:measure:view')")
|
|
|
|
|
expect(source).toContain('v-if="canViewMeasurement"')
|
|
|
|
|
expect(source).toContain('无测量审核查看权限')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('keeps pallet and location results read-only in the overview', () => {
|
|
|
|
|
expect(source).toContain(':pallet-locations="detail.palletLocations"')
|
2026-08-12 16:31:46 +08:00
|
|
|
expect(source).toContain(':sections="[\'history\']"')
|
|
|
|
|
expect(source).toContain(':sections="[\'allocations\', \'files\', \'notes\', \'remark\']"')
|
2026-08-04 21:01:39 +08:00
|
|
|
expect(source).not.toContain('reserveLocation')
|
|
|
|
|
expect(source).not.toContain('allocatePallet')
|
|
|
|
|
})
|
2026-08-12 18:00:26 +08:00
|
|
|
|
|
|
|
|
it('uses semantic outlined or solid buttons for workflow launches and decisions', () => {
|
|
|
|
|
expect(source).toContain('<el-button type="primary" @click="measurementDialogOpen = true">')
|
|
|
|
|
expect(source).toContain('<el-button type="primary" @click="reviewDialogOpen = true">')
|
|
|
|
|
expect(source).toContain('type="primary" plain')
|
|
|
|
|
expect(source).toContain('type="danger" plain')
|
|
|
|
|
expect(source).toContain('type="warning" plain')
|
|
|
|
|
expect(source).toContain('<Pencil :size="16" />编辑测量数据')
|
|
|
|
|
expect(source).toContain('<ClipboardCheck :size="16" />审核测量数据')
|
|
|
|
|
expect(source).toContain('@media (max-width: 360px)')
|
|
|
|
|
})
|
2026-08-04 21:01:39 +08:00
|
|
|
})
|