fix(admin): save dirty ocean booking before release

This commit is contained in:
2026-08-31 14:52:38 +08:00
parent 4bf937ffd3
commit dc1027804e
3 changed files with 225 additions and 46 deletions
@@ -31,6 +31,7 @@ describe('OceanBookingDetailView draft and release contract', () => {
it('saves incomplete DRAFT data and sends null for blank nullable fields', () => {
expect(source).toContain('保存草稿')
expect(source).toContain('function draftPayload(): OceanBookingDraftData')
expect(source).toContain('channelCode: form.data.channelCode?.trim() || null')
expect(source).toContain('warehouseId: form.data.warehouseId?.trim() || null')
expect(source).toContain('parties: form.data.parties.filter((party) => party.partyName.trim())')
@@ -55,10 +56,19 @@ describe('OceanBookingDetailView draft and release contract', () => {
expect(source).toContain('预计到港时间不能早于预计开船时间')
expect(source).toContain("[form.data.customerId, '客户']")
expect(source).toContain("if (!form.data.carrierCode) return '放舱前请重新选择船公司,所选船公司必须配置标准编码'")
expect(source).toContain("return '船公司标准编码尚未保存,请先保存草稿后再放舱'")
expect(source).not.toContain('请先保存草稿后再放舱')
expect(source).toContain('放舱前请填写${missing[1]}')
expect(source).toContain('放舱后资料将同步到关联货柜,不能修改、不能删除;填写错误只能由管理员处理数据库,请确认资料无误。')
expect(source).toContain('releaseOceanBooking(id.value, { expectedVersion: detail.value.version })')
expect(source).toContain('if (hasUnsavedDraftChanges.value)')
expect(source).toContain('const saved = await persistDraft(false)')
expect(source).toContain('releaseVersion = saved.version')
expect(source).toContain('releaseOceanBooking(id.value, { expectedVersion: releaseVersion })')
expect(source.indexOf('const saved = await persistDraft(false)')).toBeLessThan(source.indexOf('releaseOceanBooking(id.value, { expectedVersion: releaseVersion })'))
expect(source).toContain('if (!saved) return')
expect(source).toContain("{{ form.data.billOfLadingNo || '—' }}")
expect(source).not.toContain("{{ detail?.billOfLadingNo || '—' }}")
expect(source).toContain('const workflowBusy = computed(() => saving.value || actionSaving.value)')
expect(source).toContain(':disabled="workflowBusy" @click="openReleaseDialog"')
expect(source).not.toContain('releaseReason')
})