优化
This commit is contained in:
@@ -199,6 +199,7 @@ describe('UnifiedOrdersView list request coordination', () => {
|
||||
vi.mocked(listPlatformUnifiedOrders).mockResolvedValue({
|
||||
records: [{
|
||||
orderId: '2089223263733518337', orderVersion: 7, tenantId: '2089176869176389634',
|
||||
internalOrderStatus: 'SUBMITTED',
|
||||
inboundCode: 'NYEXX2609030001', expectedArrivalAt: '2026-09-10T08:30:00', estimatedVolumeCbm: 0.25,
|
||||
}], page: 1, size: 20, total: 1, pages: 1,
|
||||
} as never)
|
||||
@@ -235,4 +236,23 @@ describe('UnifiedOrdersView list request coordination', () => {
|
||||
showClose: true,
|
||||
}))
|
||||
})
|
||||
|
||||
it('shows planning values without editors after the order enters irreversible fulfillment', async () => {
|
||||
vi.mocked(listPlatformUnifiedOrders).mockResolvedValue({
|
||||
records: [{
|
||||
orderId: '2099751993783402497', orderVersion: 7, tenantId: '2097708157074210818',
|
||||
internalOrderStatus: 'PROCESSING', mainStatus: 'LOADED', inboundCode: 'AT0E9B5BF2839C6944CFA3',
|
||||
expectedArrivalAt: '2026-10-15T00:00:00', estimatedVolumeCbm: 220,
|
||||
}], page: 1, size: 20, total: 1, pages: 1,
|
||||
} as never)
|
||||
|
||||
const wrapper = mountView()
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.findComponent({ name: 'ElInputNumber' }).exists()).toBe(false)
|
||||
expect(wrapper.findComponent({ name: 'ElDatePicker' }).exists()).toBe(false)
|
||||
expect(wrapper.text()).toContain('220')
|
||||
expect(wrapper.text()).toContain('2026-10-15 00:00')
|
||||
expect(updatePlatformUnifiedOrderPlanning).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -627,6 +627,9 @@ describe('UnifiedOrdersView contract', () => {
|
||||
})
|
||||
|
||||
it('only exposes declaration editing before loading and marks channel changes', () => {
|
||||
expect(source).toContain("new Set(['DRAFT', 'REJECTED', 'SUBMITTED', 'APPROVED'])")
|
||||
expect(source).toContain("planningEditableOrderStatuses.has(row.internalOrderStatus || '')")
|
||||
expect(source).toContain('v-if="canEditPlanning(row as UnifiedOrderResource)"')
|
||||
expect(source).toContain("new Set<UnifiedOrderMainStatus>(['PENDING_REVIEW', 'WAIT_MEASURE', 'WAIT_SPLIT'])")
|
||||
expect(source).toContain('declarationEditableStatuses.has(detail.value.summary.mainStatus)')
|
||||
expect(source).not.toContain("detail.value.summary.mainStatus === 'WAIT_MEASURE'")
|
||||
|
||||
@@ -733,7 +733,7 @@ function planningDraft(row: UnifiedOrderResource) {
|
||||
|
||||
async function savePlanning(row: UnifiedOrderResource) {
|
||||
const draft = planningDraft(row)
|
||||
if (!can('platform:order:declaration:edit') || draft.saving) return
|
||||
if (!canEditPlanning(row) || draft.saving) return
|
||||
const estimatedVolumeCbm = draft.estimatedVolumeCbm ?? null
|
||||
draft.estimatedVolumeCbm = estimatedVolumeCbm
|
||||
if (!Number.isInteger(row.orderVersion)) {
|
||||
@@ -777,6 +777,13 @@ async function savePlanning(row: UnifiedOrderResource) {
|
||||
}
|
||||
}
|
||||
|
||||
const planningEditableOrderStatuses = new Set(['DRAFT', 'REJECTED', 'SUBMITTED', 'APPROVED'])
|
||||
|
||||
function canEditPlanning(row: UnifiedOrderResource) {
|
||||
return can('platform:order:declaration:edit')
|
||||
&& planningEditableOrderStatuses.has(row.internalOrderStatus || '')
|
||||
}
|
||||
|
||||
const declarationEditableStatuses = new Set<UnifiedOrderMainStatus>(['PENDING_REVIEW', 'WAIT_MEASURE', 'WAIT_SPLIT'])
|
||||
const canEditDeclaration = computed(() => Boolean(
|
||||
detail.value
|
||||
@@ -2673,7 +2680,7 @@ onBeforeUnmount(() => {
|
||||
<template #estimatedVolume="{ row }">
|
||||
<div class="planning-cell">
|
||||
<el-input-number
|
||||
v-if="can('platform:order:declaration:edit')"
|
||||
v-if="canEditPlanning(row as UnifiedOrderResource)"
|
||||
v-model="planningDraft(row as UnifiedOrderResource).estimatedVolumeCbm"
|
||||
class="planning-volume-input"
|
||||
:min="0.0001"
|
||||
@@ -2692,7 +2699,7 @@ onBeforeUnmount(() => {
|
||||
<div class="planning-cell">
|
||||
<el-date-picker
|
||||
style="width: 100%;"
|
||||
v-if="can('platform:order:declaration:edit')"
|
||||
v-if="canEditPlanning(row as UnifiedOrderResource)"
|
||||
v-model="planningDraft(row as UnifiedOrderResource).expectedArrivalAt"
|
||||
class="planning-arrival-input"
|
||||
type="datetime"
|
||||
|
||||
Reference in New Issue
Block a user