fix(admin): default manual node times to now

This commit is contained in:
2026-09-10 15:23:39 +08:00
parent 568f2dea8a
commit a2f1ecc6b9
2 changed files with 10 additions and 4 deletions
@@ -76,6 +76,10 @@ describe('CarrierScheduleQueryPanel loading states', () => {
expect(getContainerShippingNodes).toHaveBeenCalledWith('3')
expect(wrapper.findComponent({ name: 'AppDialog' }).props('modelValue')).toBe(true)
const pickers = wrapper.findAllComponents({ name: 'ElDatePicker' })
expect(pickers).toHaveLength(2)
expect(pickers[0]!.props('modelValue')).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)
expect(pickers[1]!.props('modelValue')).toBe(pickers[0]!.props('modelValue'))
})
it('filters large no-op status batches, keeps real actions, deduplicates only adjacent explicit event keys and sorts newest first', async () => {
@@ -254,7 +258,7 @@ describe('CarrierScheduleQueryPanel loading states', () => {
await wrapper.findAll('button').find((button) => button.text().includes('人工补录节点'))!.trigger('click')
const select = wrapper.findComponent({ name: 'ElSelect' }); select.vm.$emit('update:modelValue', 'IN_TRANSIT')
const pickers = wrapper.findAllComponents({ name: 'ElDatePicker' }); pickers[0]!.vm.$emit('update:modelValue', '2026-08-22T10:00:00')
const pickers = wrapper.findAllComponents({ name: 'ElDatePicker' }); pickers[0]!.vm.$emit('update:modelValue', '2026-08-22T10:00:00'); pickers[1]!.vm.$emit('update:modelValue', '')
const inputs = wrapper.findAllComponents({ name: 'ElInput' })
inputs.find((input) => input.props('placeholder') === '可选,如 USLAX')!.vm.$emit('update:modelValue', 'PACIFIC')
inputs.find((input) => String(input.props('maxlength')) === '128')!.vm.$emit('update:modelValue', 'Pacific Ocean')
@@ -279,6 +283,7 @@ describe('CarrierScheduleQueryPanel loading states', () => {
await wrapper.findAll('button').find((button) => button.text().includes('人工补录节点'))!.trigger('click')
wrapper.findComponent({ name: 'ElSelect' }).vm.$emit('update:modelValue', 'PICKUP_READY')
for (const picker of wrapper.findAllComponents({ name: 'ElDatePicker' })) picker.vm.$emit('update:modelValue', '')
wrapper.findAllComponents({ name: 'ElInput' }).find((input) => input.props('type') === 'textarea')!.vm.$emit('update:modelValue', '人工核验可提柜')
await wrapper.findComponent({ name: 'AppDialog' }).vm.$emit('confirm'); await flushPromises()
@@ -195,8 +195,8 @@ const fulfillmentEvents = computed<FulfillmentEvent[]>(() => {
})
function eventTagType(type: FulfillmentEvent['type']) { return ({ '仓内操作': 'info', '确认离仓': 'success', '船运节点': 'primary', '人工补录': 'warning', '异常': 'danger' } as const)[type] }
function resetManualForm() {
Object.assign(manualForm, { standardNode: '', estimatedAt: '', actualAt: '', locationCode: '', locationName: '', reason: '' })
function resetManualForm(initialTime = '') {
Object.assign(manualForm, { standardNode: '', estimatedAt: initialTime, actualAt: initialTime, locationCode: '', locationName: '', reason: '' })
manualError.value = null; manualValidationError.value = ''
}
function createIdempotencyKey() { return globalThis.crypto?.randomUUID?.() || `carrier-node-${Date.now()}-${Math.random().toString(16).slice(2)}` }
@@ -206,7 +206,8 @@ function localDateTimeNow() {
}
function openManualDialog() {
if (!props.containerBookingId) return
resetManualForm(); manualIdempotencyKey.value = createIdempotencyKey(); manualObservedAt.value = localDateTimeNow(); manualDialogOpen.value = true
const now = localDateTimeNow()
resetManualForm(now); manualIdempotencyKey.value = createIdempotencyKey(); manualObservedAt.value = now; manualDialogOpen.value = true
}
async function submitManualNode() {
manualValidationError.value = ''